:root {
  color-scheme: dark;
  --bg: #0b121e;
  --surface: #131f2d;
  --surface-alt: #192535;
  --rail: #0d1723;
  --terminal: #0a111b;
  --dark: var(--terminal);
  --ink: #f3f7fb;
  --mid: #aebdd0;
  --line: #2b3d51;
  --line-strong: #40536a;
  --accent: #ffbe70;
  --accent-deep: #ffd398;
  --accent-ink: #221a11;
  --accent-fill: var(--accent);
  --accent-fill-hover: var(--accent-deep);
  --accent-border: var(--accent);
  --accent-soft: #3b2c23;
  --green: #91e0ba;
  --green-soft: #183b32;
  --blue: #a4c8ff;
  --blue-soft: #233550;
  --red: #ffaea6;
  --red-soft: #462831;
  --amber: #ffd08d;
  --amber-soft: #3f2e1d;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 18px 40px #02060e66;
  --dock-shadow: 0 -4px 16px #0005;
  --code-ink: #e0ebf7;
  --modal-scrim: rgba(4, 8, 15, .74);
  --relay-image: url("../assets/night-relay.jpg");
  --relay-position: 72% 54%;
  --relay-shade: linear-gradient(90deg, #0b121e 1%, #0b121ef2 26%, #0b121e98 47%, #0b121e17 75%);
  --relay-mobile-shade: linear-gradient(0deg, #0b121e91, transparent 64%);
  --relay-card: rgba(19, 31, 45, .96);
  --auth-shade: linear-gradient(90deg, var(--bg) 24%, rgba(11, 18, 30, .82));
  --font-sans: "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif;
  --font-display: "Bahnschrift", "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f9fbfd;
  --surface: #fff;
  --surface-alt: #f1f5fa;
  --rail: #fff;
  --terminal: #f5f8fc;
  --ink: #142334;
  --mid: #4b6076;
  --line: #e0e7f0;
  --line-strong: #c3d0de;
  --accent: #86521c;
  --accent-deep: #6d4015;
  --accent-ink: #43290e;
  --accent-fill: #ffe5bd;
  --accent-fill-hover: #f9d9a9;
  --accent-border: #edc791;
  --accent-soft: #fff4e3;
  --green: #1c6b49;
  --green-soft: #e9f7ef;
  --blue: #295a8d;
  --blue-soft: #eaf3ff;
  --red: #a83339;
  --red-soft: #fff0ee;
  --amber: #815016;
  --amber-soft: #fff3dc;
  --shadow: 0 16px 40px #243b5915;
  --dock-shadow: 0 -4px 16px #243b5912;
  --code-ink: #253d55;
  --modal-scrim: rgba(30, 50, 73, .24);
  --relay-image: none;
  --relay-shade: none;
  --relay-mobile-shade: none;
  --relay-card: var(--surface);
  --auth-shade: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-fill); color: var(--accent-ink); }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
button[disabled] { cursor: not-allowed; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { max-width: 1240px; margin-inline: auto; padding-inline: 30px; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -.035em;
  line-height: 1.18;
  font-weight: 720;
}
.display { font-size: clamp(2.4rem, 4.75vw, 4.1rem); line-height: 1.12; font-weight: 770; }
.h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .075em;
}
.sub { color: var(--mid); max-width: 60ch; }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }

.section { padding-block: 54px; }
.section-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 19px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: .89rem;
  font-weight: 680;
  line-height: 1.3;
  text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { flex-shrink: 0; }
.btn-solid { background: var(--surface-alt); border-color: var(--line-strong); color: var(--ink); }
.btn-solid:hover { background: var(--line); }
.btn-accent { background: var(--accent-fill); border-color: var(--accent-border); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--line-strong); }
.btn-light { background: var(--ink); color: var(--bg); }
.btn-light:hover { background: #fff; }
.btn-sm { min-height: 35px; padding: 6px 10px; font-size: .8rem; }
.btn-lg { min-height: 46px; padding: 9px 16px; font-size: .93rem; }
.btn[disabled] { opacity: .55; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 660;
  line-height: 1.36;
  white-space: nowrap;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--green-soft); color: var(--green); }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-bad { background: var(--red-soft); color: var(--red); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-neutral { background: var(--surface-alt); color: var(--mid); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card-tight { padding: 13px 15px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--rail);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; min-height: 67px; gap: 19px; }
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font: 740 1.34rem/1 var(--font-display);
  letter-spacing: -.045em;
  white-space: nowrap;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--accent-fill);
}
.logo-mark::before {
  content: "";
  width: 23px;
  height: 23px;
  background: var(--accent-ink);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='4' cy='12' r='1.5'/%3E%3Ccircle cx='20' cy='5' r='1.5'/%3E%3Ccircle cx='20' cy='12' r='1.5'/%3E%3Ccircle cx='20' cy='19' r='1.5'/%3E%3Cpath d='M5.5 12h13m-10 0 5-7h5m-10 7 5 7h5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.nav-links { display: flex; align-items: center; gap: 22px; color: var(--mid); font-size: .88rem; font-weight: 640; }
.nav-links a:hover { color: var(--accent); }
.topbar-cta { display: flex; gap: 6px; align-items: center; }
.mobile-nav-toggle {
  display: none;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.lang-toggle { min-width: 41px; font-weight: 700; }

.theme-toggle { white-space: nowrap; }
.theme-toggle::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2m0 16v2M2 12h2m16 0h2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4m0-14.2-1.4 1.4M6.3 17.7l-1.4 1.4'/%3E%3C/svg%3E") center / contain no-repeat;
}
:root[data-theme="light"] .theme-toggle::before {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 14a9 9 0 1 1-11-11 7.25 7.25 0 0 0 11 11Z'/%3E%3C/svg%3E");
}

.code-block { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--terminal); color: var(--code-ink); }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--mid);
  font-size: .78rem;
}
.code-dots { display: inline-flex; gap: 5px; }
.code-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.code-body { padding: 10px 12px; font: .82rem/1.6 var(--font-mono); overflow-x: auto; white-space: pre; }
.tok-c { color: var(--mid); }
.tok-k { color: var(--accent); }
.tok-s { color: var(--green); }
.tok-f { color: var(--blue); }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  min-height: 31px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--ink);
  font-size: .74rem;
  font-weight: 650;
}
.copy-btn:hover { border-color: var(--line-strong); }

.footer { padding-block: 26px 20px; border-top: 1px solid var(--line); background: var(--rail); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 25px; }
.footer h5 { margin-bottom: 9px; color: var(--mid); font-size: .81rem; }
.footer ul { display: grid; gap: 6px; list-style: none; color: var(--mid); font-size: .87rem; }
.footer a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px 16px;
  padding-top: 11px;
  margin-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--mid);
  font-size: .78rem;
}
.disclaimer { display: flex; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.disclaimer svg, .app-disc svg { flex-shrink: 0; margin-top: 2px; color: var(--mid); }
.disclaimer h4 { margin-bottom: 4px; font-size: .93rem; }
.disclaimer p { color: var(--mid); font-size: .81rem; }
.app-disc { display: flex; align-items: flex-start; gap: 7px; margin-top: 19px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--mid); font-size: .76rem; }

.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 120;
  display: grid;
  gap: 7px;
  max-width: calc(100% - 36px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: .84rem;
  overflow-wrap: anywhere;
  transition: opacity .25s, transform .25s;
}
.toast svg { flex-shrink: 0; color: var(--green); }
.toast.out { opacity: 0; transform: translateY(5px); }

.reveal.in { animation: enter .26s ease-out both; }
@keyframes enter { from { opacity: .7; transform: translateY(5px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .wrap { padding-inline: 18px; }
  .section { padding-block: 36px; }
  .topbar-in { min-height: 58px; gap: 8px; position: relative; }
  .mobile-nav-toggle { display: grid; order: 3; }
  .topbar-cta { margin-left: auto; order: 2; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 14px;
    right: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 1px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--rail);
    box-shadow: var(--shadow);
  }
  .nav-links a { display: flex; align-items: center; min-height: 43px; padding: 6px 9px; border-radius: var(--radius-sm); }
  .nav-links a:hover { background: var(--surface); }
  .topbar.menu-open .nav-links { display: flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .wrap { padding-inline: 14px; }
  .display { font-size: clamp(2rem, 8.9vw, 2.64rem); }
  .h2 { font-size: 1.46rem; }
  .logo { font-size: 1.2rem; gap: 6px; }
  .logo-mark { width: 30px; height: 30px; border-radius: 9px; }
  .logo-mark::before { width: 20px; height: 20px; }
  .theme-toggle { min-width: 36px; padding-inline: 7px; }
  .theme-toggle span { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
