:root {
  color-scheme: dark;
  --bg0: #0E0B12;
  --bg1: #1A1320;
  --gold: #E9C27A;
  --blue: #6F8FD8;
  --bg: #0E0B12;
  --ink: #F3EDE2;
  --muted: #C9BFB0;
  --card: #1A1320;
  --line: #3a3344;
  --accent: #E9C27A;
  --soft: #241c2e;
  --on: #0E0B12;
  --tap: #1A1320;
  --pulse: rgba(233, 194, 122, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--ink);
  font-family: "PingFang HK", "Microsoft JhengHei", "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

.wrap {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: max(64px, calc(env(safe-area-inset-top) + 48px)) 20px max(32px, env(safe-area-inset-bottom));
}

.brand {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--accent);
}

h1 {
  margin: 0 0 12px;
  font-size: 1.7rem;
  line-height: 1.35;
  font-weight: 700;
}

h1:focus { outline: none; }

h2 { margin: 0 0 4px; font-size: 1.15rem; }

p { margin: 0; }

.kicker { margin: 0 0 6px; color: var(--accent); font-size: 0.9rem; }

.lead, .foot, .fine { color: var(--muted); }

.lead { margin-bottom: 18px; }

.foot { margin-top: 28px; font-size: 14px; }

.status { min-height: 3.2em; margin: 8px 0 14px; font-weight: 700; }

.stack, .cards { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.card p { color: var(--muted); font-size: 16px; margin-bottom: 10px; }

.card.is-on { border-color: var(--accent); background: var(--soft); }

.split { display: flex; gap: 10px; }

button {
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 14px;
  touch-action: manipulation;
}

button.primary, button.choice, a.primary {
  width: 100%;
  background: var(--accent);
  color: var(--on);
  border-color: var(--accent);
  font-weight: 700;
}

a.primary, a.home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  text-decoration: none;
  box-sizing: border-box;
}

a.home {
  position: absolute;
  z-index: 22;
  top: max(8px, env(safe-area-inset-top));
  left: 8px;
  padding: 12px 10px;
  color: var(--muted);
  font-size: 14px;
}

button.ghost { width: 100%; background: transparent; }

button.link {
  background: none;
  border: none;
  text-decoration: underline;
  color: var(--muted);
  font-size: 14px;
  padding: 12px 8px;
}

.split button { flex: 1; }

button:disabled { opacity: 0.45; }

button:focus { outline: none; }

button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.tap {
  display: block;
  width: min(68vw, 240px);
  aspect-ratio: 1;
  margin: 8px auto 12px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--tap);
  color: var(--ink);
  font-size: 32px;
  font-weight: 700;
  user-select: none;
}

.tap.is-down { background: var(--accent); color: var(--on); }

.tap.is-live { animation: tapPulse 0.7s ease-out infinite; }

.fine { margin-top: 8px; }

.staff {
  position: relative;
  width: 100%;
  height: 92px;
  margin: 18px 0 8px;
}

.staff span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.55;
}

.staff span:nth-child(1) { top: 8px; }
.staff span:nth-child(2) { top: 20px; }
.staff span:nth-child(3) { top: 32px; }
.staff span:nth-child(4) { top: 44px; }
.staff span:nth-child(5) { top: 56px; }

#staffNote {
  position: absolute;
  left: 46%;
  top: 26px;
  width: 22px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
  transform: rotate(-18deg);
}

#staffNote::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 6px;
  width: 3px;
  height: 36px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(18deg);
  transform-origin: bottom right;
}

.noscript {
  max-width: 420px;
  margin: 12px auto;
  padding: 0 20px;
}

[hidden] { display: none !important; }

@keyframes tapPulse {
  0% { box-shadow: 0 0 0 0 var(--pulse); }
  100% { box-shadow: 0 0 0 26px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
