:root {
  --ink: #0c1218;
  --ink-2: #16202b;
  --gold: #e4c56a;
  --gold-deep: #8a6a2f;
  --cream: #f6f1e6;
  --paper: #f3ecdf;
  --mist: #c5d0dc;
  --line: rgba(228, 197, 106, 0.45);
  --ok: #1f7a4d;
  --down: #9a3b3b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(228, 197, 106, 0.16), transparent 60%),
    radial-gradient(700px 380px at 0% 20%, rgba(90, 140, 170, 0.18), transparent 55%),
    var(--ink);
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; }
code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
  color: var(--gold);
  background: rgba(228, 197, 106, 0.08);
  padding: 0.1em 0.35em;
}

.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(10px);
  background: rgba(12, 18, 24, 0.82);
  border-bottom: 1px solid var(--line);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  letter-spacing: 0.08em;
}
.brand strong { font-size: 22px; font-weight: 700; }
.brand span { color: var(--gold); font-size: 12px; letter-spacing: 0.22em; }
.top-end {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a {
  text-decoration: none;
  padding: 8px 14px;
  color: var(--mist);
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.nav a:hover { color: var(--gold); }
.nav a[aria-current="page"] {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.nav .go {
  margin-left: 6px;
  color: #1a1408;
  background: linear-gradient(#f0d78a, #c9a24b);
  border: 0;
  border-bottom: none;
  border-radius: 2px;
  font-weight: 700;
  padding: 9px 16px;
  transition: filter 0.2s ease, transform 0.2s ease;
}
.nav .go:hover {
  color: #1a1408;
  border-bottom: none;
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.nav .go[aria-current="page"] {
  color: #1a1408;
  border-bottom: none;
  box-shadow: inset 0 0 0 1px rgba(26, 20, 8, 0.25);
}
.top-support {
  text-decoration: none;
  padding: 8px 0;
  color: var(--mist);
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.2s ease;
}
.top-support:hover { color: var(--gold); }

.hero { padding: 64px 0 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 36px;
  align-items: center;
}
.kicker {
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 12px;
  margin: 0 0 12px;
}
h1 {
  font-family: "PMingLiU", "Songti TC", "Microsoft JhengHei", serif;
  font-size: clamp(42px, 6vw, 68px);
  font-weight: 500;
  line-height: 1.05;
  margin: 0 0 16px;
}
.lead { font-size: 18px; line-height: 1.7; color: var(--mist); max-width: 38em; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 2px;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-gold { background: linear-gradient(#f0d78a, #c9a24b); color: #1a1408; }
.btn-ghost { border-color: var(--line); color: var(--cream); background: transparent; }
.btn-ghost:hover { background: rgba(228, 197, 106, 0.08); }
button.btn { font: inherit; }

.gate {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 30%),
    var(--ink-2);
  padding: 22px;
  position: relative;
}
.gate:before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(228, 197, 106, 0.25);
  pointer-events: none;
}
.status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}
.pill {
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
}
.pill.is-up { color: #b7ebc9; border-color: #1f7a4d; }
.pill.is-down { color: #f0c2c2; border-color: var(--down); }
.addr { font-variant-numeric: tabular-nums; color: var(--gold); margin: 0; }
.gate p { color: var(--mist); line-height: 1.6; }

.section { padding: 18px 0 48px; }
h2 {
  font-family: "PMingLiU", "Songti TC", "Microsoft JhengHei", serif;
  font-weight: 500;
  font-size: 32px;
  margin: 0 0 8px;
}
.sub { color: var(--mist); margin-top: 0; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.step {
  border-top: 2px solid var(--gold);
  background: rgba(255,255,255,0.03);
  padding: 16px;
}
.step b { display: block; color: var(--gold); font-size: 13px; letter-spacing: 0.12em; margin-bottom: 8px; }
.step p { margin: 0; color: var(--mist); line-height: 1.6; }

/* Download page */
.download-hero {
  padding: 48px 0 56px;
}
.download-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}
.download-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background:
    linear-gradient(135deg, rgba(228, 197, 106, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 35%),
    var(--ink-2);
  padding: 28px 26px 24px;
  position: relative;
}
.download-card:before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(228, 197, 106, 0.22);
  pointer-events: none;
}
.download-card h2 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
}
.download-card .page-lead { margin: 0 0 22px; max-width: 36em; }
.download-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}
.download-meta li {
  font-size: 13px;
  color: var(--mist);
  border: 1px solid rgba(228, 197, 106, 0.28);
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.22);
}
.download-meta strong { color: var(--gold); font-weight: 700; }
.btn-download {
  width: 100%;
  min-height: 54px;
  font-size: 17px;
  letter-spacing: 0.06em;
}
.btn-download small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.75;
  margin-top: 2px;
}
.download-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: #9aa8b5;
  line-height: 1.55;
}
.howto {
  border-left: 2px solid var(--gold);
  padding: 4px 0 4px 18px;
}
.howto h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
  color: var(--cream);
}
.howto ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: how;
}
.howto li {
  counter-increment: how;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--mist);
  line-height: 1.65;
}
.howto li:last-child { margin-bottom: 0; }
.howto li::before {
  content: counter(how, decimal-leading-zero);
  color: var(--gold);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.howto a { color: var(--gold); text-underline-offset: 3px; }

/* Ranks */
.ranks-page { padding-top: 40px; }
.rank-tabs {
  display: flex;
  gap: 8px;
  margin: 28px 0 16px;
  flex-wrap: wrap;
}
.rank-tab {
  font: inherit;
  cursor: pointer;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mist);
  border-radius: 2px;
  transition: background 0.2s ease, color 0.2s ease;
}
.rank-tab:hover { color: var(--gold); }
.rank-tab.is-active {
  color: #1a1408;
  background: linear-gradient(#f0d78a, #c9a24b);
  border-color: transparent;
  font-weight: 700;
}
.rank-status {
  color: #9aa8b5;
  font-size: 14px;
  min-height: 1.4em;
  margin: 0 0 14px;
}
.rank-status.is-error { color: #f0c2c2; }
.rank-panel[hidden] { display: none !important; }
.rank-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--ink-2);
  box-shadow: var(--shadow);
}
.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.rank-table th,
.rank-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(228, 197, 106, 0.12);
}
.rank-table th {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
}
.rank-table td { color: var(--mist); }
.rank-table tbody tr.is-top td:first-child { color: var(--gold); font-weight: 700; }
.rank-table tbody tr:hover td { background: rgba(228, 197, 106, 0.05); }
.family-detail {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 22px;
}
.family-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
}
.family-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--cream);
  font-weight: 600;
}
.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.member-list li {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid rgba(228, 197, 106, 0.1);
  color: var(--mist);
  font-size: 13px;
}
.member-list li:first-child { border-top: 0; }
.member-list span { color: var(--gold); }
.member-list strong { color: var(--cream); font-weight: 600; }
.member-list em { font-style: normal; color: #9aa8b5; }
.member-list b { font-weight: 600; color: var(--gold); }

.board {
  background: var(--paper);
  color: #241c12;
  padding: 8px 0;
  box-shadow: var(--shadow);
}
.board li {
  list-style: none;
  display: grid;
  grid-template-columns: 72px 110px 1fr;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(36, 28, 18, 0.08);
  align-items: baseline;
}
.board { margin: 0; padding-left: 0; }
.tag {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold-deep);
  font-weight: 700;
}
.board time { color: #6d6254; font-variant-numeric: tabular-nums; }
.board p { margin: 4px 0 0; color: #4e453a; }

.panel {
  width: min(560px, 100%);
  margin: 36px auto 64px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
}
label { display: block; margin: 14px 0 6px; color: var(--mist); }
input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(228, 197, 106, 0.35);
  background: #0c1218;
  color: var(--cream);
  padding: 0 12px;
  font: inherit;
  border-radius: 2px;
}
input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.hint { color: #9aa8b5; font-size: 13px; line-height: 1.5; }
.form-error { color: #f0c2c2; min-height: 1.4em; }
.form-ok { color: #b7ebc9; line-height: 1.6; }
.hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.page-lead { color: var(--mist); line-height: 1.7; }
.legal {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: #9aa8b5;
  font-size: 14px;
  line-height: 1.75;
}
.legal p { margin: 0 0 12px; max-width: 52em; }
.terms-fine {
  margin-top: 14px;
  padding: 0;
  border: 0;
  color: #8b97a3 !important;
  font-size: 12px !important;
  line-height: 1.4;
  max-width: 36em;
  opacity: 0.85;
}
.terms-fine summary {
  cursor: pointer;
  list-style: none;
  color: #9aa8b5 !important;
  font-size: 12px !important;
  font-weight: 400;
  letter-spacing: 0.04em;
  user-select: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.terms-fine summary::-webkit-details-marker { display: none; }
.terms-fine[open] summary { margin-bottom: 10px; }
.terms-fine p {
  margin: 0 0 6px !important;
  color: #8b97a3 !important;
  font-size: 11px !important;
  line-height: 1.5;
}
.terms-fine[open] {
  opacity: 1;
  max-width: none;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.terms-fine[open] p {
  margin: 0 0 12px !important;
  color: #9aa8b5 !important;
  font-size: 14px !important;
  line-height: 1.75;
  max-width: 52em;
}
.terms-fine p:last-child { margin-bottom: 0 !important; }
.panel .terms-fine,
.panel .terms-fine summary {
  color: #8b97a3 !important;
}
.panel .terms-fine[open] p {
  color: #9aa8b5 !important;
}

footer {
  border-top: 1px solid var(--line);
  color: #8b97a3;
  padding: 22px 0 36px;
  font-size: 13px;
  line-height: 1.6;
}
footer .copy {
  margin: 0 0 6px;
  color: var(--mist);
  letter-spacing: 0.04em;
}
footer p { margin: 0; }
footer a {
  color: var(--gold);
  text-underline-offset: 3px;
}

.bgm-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 24, 0.92);
  color: var(--gold);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.bgm-toggle[aria-pressed="true"] {
  background: linear-gradient(#f0d78a, #c9a24b);
  color: #1a1408;
  border-color: transparent;
}
.bgm-panel {
  position: fixed;
  right: 16px;
  bottom: 64px;
  z-index: 20;
  width: 200px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 24, 0.95);
  box-shadow: var(--shadow);
  color: var(--mist);
  font-size: 13px;
}
.bgm-panel label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}
.bgm-panel input[type="range"] {
  width: 120px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

@media (max-width: 800px) {
  .hero-grid, .steps, .board li, .download-layout, .family-detail { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .board time { display: block; }
  .nav .go { margin-left: 0; }
}
