:root {
  --bg: #070b14;
  --panel: #111b2e;
  --panel-2: #172540;
  --ink: #edf3ff;
  --muted: #9aabc9;
  --line: #283a58;
  --accent: #ffd166;
  --accent-ink: #221a05;
  --good: #79e2b5;
  --bad: #ff93a5;
  --radius: 18px;
  --tap: 44px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 50% -10%, #1c2b4c 0%, transparent 64%),
    radial-gradient(700px 380px at 100% 105%, #17233d 0%, transparent 62%),
    var(--bg);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

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

.wrap {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 16px 16px 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .12em;
}

.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.seed-chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stage {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(23, 37, 64, .94), rgba(11, 19, 33, .96));
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #182741;
  color: var(--ink);
  text-align: center;
  transition: background .15s, border-color .15s, transform .15s;
}

.btn:hover { background: #1d3050; border-color: #3b5278; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  border-color: #f0be55;
  background: linear-gradient(180deg, #ffe08a, #f7bf4b);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 9px 24px rgba(255, 193, 70, .2);
}

.btn-primary:hover { background: linear-gradient(180deg, #ffe8a6, #ffcb5c); border-color: #ffd77a; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 18px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); }

.intro h1 {
  font-size: clamp(27px, 6vw, 41px);
  line-height: 1.15;
  letter-spacing: .01em;
}

.lede {
  max-width: 30em;
  margin-top: 10px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a1526;
  color: var(--ink);
}

.field input::placeholder { color: #627696; }

.start-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.seed-line {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.hud-item {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 13, 24, .5);
}

.hud-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
}

.hud-item b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.hud-item small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
}

.hud-item.is-low b { color: var(--bad); }
.hud-item.is-warm b { color: var(--good); }

.kicker {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .16em;
}

.node-title {
  font-size: clamp(22px, 4.6vw, 30px);
  line-height: 1.25;
}

.node-body {
  max-width: 34em;
  margin-top: 8px;
  color: #c8d5ea;
}

.feedback {
  margin: 14px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: rgba(255, 209, 102, .08);
  color: #f4e4b8;
  font-size: 14px;
}

.feedback:empty { display: none; }

.choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.choice {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #17253d, #121e33);
  color: var(--ink);
  text-align: left;
  transition: background .15s, border-color .15s, transform .15s;
}

.choice:hover { border-color: #4a6693; background: linear-gradient(180deg, #1c2d4b, #15223a); }
.choice:active { transform: translateY(1px); }
.choice-label { font-size: 16px; font-weight: 650; }
.choice-note { color: var(--muted); font-size: 12.5px; }

.ending h2 {
  font-size: clamp(24px, 5.5vw, 35px);
  line-height: 1.2;
}

.ending-line {
  max-width: 32em;
  margin-top: 10px;
  color: #d9e4f5;
  font-size: 17px;
}

.ending-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.summary {
  display: grid;
  gap: 6px;
  margin: 16px 0 0;
  padding-left: 22px;
  color: #cbd8ec;
}

.summary li::marker { color: var(--accent); }
.summary b { color: var(--ink); font-weight: 650; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.action-status {
  min-height: 1.3em;
  margin-top: 10px;
  color: var(--good);
  font-size: 13px;
}

.nickname-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.fineprint {
  margin-top: 14px;
  color: #7284a3;
  font-size: 11.5px;
  text-align: center;
}

.copy-fallback {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 7, 15, .84);
}

.copy-fallback[hidden] { display: none; }

.copy-panel {
  width: min(520px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.copy-panel p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.copy-panel textarea {
  width: 100%;
  min-height: 190px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0a1322;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}

.copy-panel .btn {
  width: 100%;
  margin-top: 10px;
}

@media (max-width: 520px) {
  .wrap { padding: 12px 12px 24px; }
  .stage { padding: 14px; border-radius: 16px; }
  .hud { gap: 6px; }
  .hud-item { padding: 7px 8px; }
  .hud-item b { font-size: 15px; }
  .choice { min-height: 64px; }
  .start-row .btn { flex: 1 1 auto; }
  .actions .btn { flex: 1 1 100%; }
}

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