/*
freew.org presents apps and repositories you can use without paying.
Copyright (C) 2026 Pengfan Chang
Contact: https://swiphtgroup.com/

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --sidebar: rgba(242, 242, 247, 0.86);
  --bar: rgba(249, 249, 249, 0.84);
  --card: #ffffff;
  --label: #1d1d1f;
  --secondary: rgba(60, 60, 67, 0.6);
  --separator: rgba(60, 60, 67, 0.29);
  --blue: #007aff;
  --selection: rgba(0, 0, 0, 0.06);
  --shadow: rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --external-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M1.2 4.1h2.1v1.2H2.4v4.3h4.3V8.4h1.2v2.3c0 .5-.4.9-.9.9H2.1c-.5 0-.9-.4-.9-.9V5c0-.5.4-.9.9-.9z'/%3E%3Cpath fill='%23000' d='M6.2 1.4h4.4v4.4H9.4V3.5L5.6 7.3 4.7 6.4l3.8-3.8H6.2V1.4z'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --sidebar: rgba(28, 28, 30, 0.86);
    --bar: rgba(22, 22, 23, 0.84);
    --card: #1c1c1e;
    --label: #f5f5f7;
    --secondary: rgba(235, 235, 245, 0.6);
    --separator: rgba(84, 84, 88, 0.65);
    --blue: #0a84ff;
    --selection: rgba(255, 255, 255, 0.12);
    --shadow: rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 4;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--card);
  color: var(--blue);
}

.skip:focus {
  top: calc(12px + env(safe-area-inset-top));
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app {
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px calc(12px + env(safe-area-inset-left));
  padding-right: calc(12px + env(safe-area-inset-right));
  background: var(--bar);
  border-bottom: 0.5px solid var(--separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.wordmark {
  margin: 0 8px 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.wordmark a {
  color: var(--label);
  text-decoration: none;
}

.side-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  color: var(--blue);
  font-size: 15px;
  letter-spacing: -0.016em;
  text-decoration: none;
}

.side-nav a[aria-current="page"] {
  background: var(--selection);
  color: var(--label);
  font-weight: 600;
}

.side-nav a.external::after,
a.row.external .row-title::after {
  content: "";
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  margin-left: 5px;
  vertical-align: -1px;
  background: currentColor;
  opacity: 0.72;
  -webkit-mask-image: var(--external-icon);
  mask-image: var(--external-icon);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.sheet {
  width: min(680px, 100%);
  margin: 0;
  padding: 12px 20px calc(40px + env(safe-area-inset-bottom));
  padding-left: calc(20px + env(safe-area-inset-left));
  padding-right: calc(20px + env(safe-area-inset-right));
}

h1 {
  margin: 8px 0 12px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.lede,
.copy {
  margin: 0 0 12px;
}

.lede {
  font-size: 20px;
  line-height: 1.35;
  letter-spacing: -0.022em;
}

.section-label {
  margin: 28px 16px 8px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.008em;
  text-transform: uppercase;
}

.group {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 0 0 0.5px var(--shadow);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin: 0;
  padding: 11px 16px;
  border-bottom: 0.5px solid var(--separator);
  color: inherit;
  text-decoration: none;
}

.row:last-child {
  border-bottom: 0;
}

a.row:active,
.side-nav a:active {
  background: var(--selection);
}

@media (hover: hover) {
  a.row:hover,
  .side-nav a:hover {
    background: var(--selection);
  }
}

.row-title {
  display: block;
  font-weight: 400;
}

.row-detail {
  display: block;
  margin-top: 2px;
  color: var(--secondary);
  font-size: 15px;
  line-height: 1.33;
  letter-spacing: -0.016em;
}

.row-detail code {
  font-family: Menlo, ui-monospace, "SF Mono", monospace;
  font-size: 0.92em;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.group + .copy {
  margin-top: 20px;
}

.chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-top: 1.5px solid var(--secondary);
  border-right: 1.5px solid var(--secondary);
  transform: rotate(45deg);
}

.empty {
  margin: 0;
  padding: 28px 20px;
  color: var(--secondary);
  text-align: center;
}

.phosphor {
  margin: 20px 0 0;
}

.phosphor-screen {
  margin: 0;
  padding: 16px 18px;
  border-radius: 12px;
  background: #1a1000;
  color: #ffb000;
  font-family: Menlo, ui-monospace, "SF Mono", monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: 0;
  white-space: pre-wrap;
}

.phosphor-dim {
  color: #665500;
}

.phosphor-fg {
  color: #ffb000;
}

.phosphor-bold {
  color: #ffd066;
  font-weight: 700;
}

.phosphor-low {
  color: #332200;
}

.phosphor-high {
  color: #ffe099;
}

.ansi-red {
  color: #ff6622;
}

.ansi-green {
  color: #88aa00;
}

.ansi-yellow {
  color: #ffb000;
}

.ansi-blue {
  color: #cc8844;
}

.ansi-magenta {
  color: #dd7744;
}

.ansi-cyan {
  color: #aaaa33;
}

.phosphor figcaption {
  margin: 8px 16px 0;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.008em;
}

.colophon {
  margin: 28px 16px 0;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.008em;
}

.colophon p {
  margin: 0 0 8px;
}

.colophon a,
.copy a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (min-width: 900px) {
  .app {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: block;
    height: 100dvh;
    padding: 28px 12px 20px;
    background: var(--sidebar);
    border-right: 0.5px solid var(--separator);
    border-bottom: 0;
  }

  .wordmark {
    margin: 0 12px 18px;
    font-size: 15px;
  }

  .side-nav {
    display: grid;
    margin-bottom: 22px;
  }

  .side-nav a {
    min-height: 32px;
    padding: 4px 12px;
    border-radius: 8px;
    color: var(--label);
    font-size: 14px;
  }

  .side-nav a[aria-current="page"] {
    background: var(--selection);
  }

  .sheet {
    margin-inline: auto;
    padding-top: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
