*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
/* Layout: one narrow column over a live night sky; a star-chart strip on top shows the answers you've lit. */
:root {
  color-scheme: dark;
  --sky: #0a0f24;
  --sky-deep: #060917;
  --panel: rgba(20, 27, 58, 0.78);
  --panel-solid: #141b3a;
  --line: rgba(160, 172, 230, 0.18);
  --ink: #ebe8f4;
  --dim: #a3a8cb;
  --faint: #6d7399;
  --gold: #f2d27f;
  --gold-ink: #1b1608;
  --ice: #a9c9ff;
  --rose: #e6a0ad;
  --display: "Bodoni Moda", "Didot", "Bodoni 72", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
html, body { min-height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #17204a 0%, var(--sky) 55%, var(--sky-deep) 100%) fixed, var(--sky);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding-block: 20px 40px; display: flex; flex-direction: column; gap: 18px; }

header.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wordmark { font-family: var(--display); font-style: italic; font-size: 1.35rem; letter-spacing: 0.01em; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 0; }
.wordmark span { color: var(--gold); }
.linkish { background: none; border: 0; color: var(--dim); font: inherit; font-size: 0.9rem; cursor: pointer; padding: 4px 0; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.linkish:hover { color: var(--ink); }

.chart { position: relative; border: 1px solid var(--line); border-radius: 4px; background: rgba(6, 9, 23, 0.55); overflow: hidden; }
.chart canvas { display: block; width: 100%; height: 190px; }
.chart .chart-cap { position: absolute; left: 12px; top: 8px; right: 12px; display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); pointer-events: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 22px 20px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; flex-direction: column; gap: 16px; }
.eyebrow { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
h1.title { font-family: var(--display); font-weight: 500; font-size: clamp(3rem, 14vw, 4.6rem); line-height: 0.95; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1.title em { color: var(--gold); }
.lede { margin: 0; color: var(--dim); max-width: 46ch; }
.lede strong { color: var(--ink); font-weight: 700; }

.btn { font: inherit; font-weight: 700; border-radius: 3px; padding: 12px 18px; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.btn:hover { border-color: var(--dim); background: rgba(255, 255, 255, 0.04); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.primary:hover { background: #f7dd98; }
.btn:focus-visible, .linkish:focus-visible, .wordmark:focus-visible, input:focus-visible, .row-btn:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row .btn { flex: 1 1 auto; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px; font-weight: 400; }
.mode b { font-weight: 700; }
.mode small { color: var(--dim); font-size: 0.8rem; line-height: 1.3; }
@media (max-width: 460px) { .modes { grid-template-columns: 1fr; } }

.stats { display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--mono); font-size: 0.8rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.stats b { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.1; }
.fineprint { font-size: 0.82rem; color: var(--faint); margin: 0; }

/* round */
.round-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.timer { position: relative; width: 60px; height: 60px; flex: none; }
.timer svg { width: 60px; height: 60px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3; }
.timer .track { stroke: var(--line); }
.timer .arc { stroke: var(--gold); stroke-linecap: round; transition: stroke 0.3s; }
.timer.low .arc { stroke: var(--rose); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 1rem; font-variant-numeric: tabular-nums; }
.prompt { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 7vw, 2.5rem); line-height: 1.1; margin: 0; text-wrap: balance; }
form.answer { display: flex; gap: 10px; flex-wrap: wrap; }
form.answer input { flex: 1 1 200px; min-width: 0; font: inherit; font-size: 1.15rem; padding: 12px 14px; border-radius: 3px; border: 1px solid var(--line); background: rgba(6, 9, 23, 0.6); color: var(--ink); }
form.answer input::placeholder { color: var(--faint); }

.reveal { display: flex; flex-direction: column; gap: 14px; animation: rise 0.35s ease-out; }
@keyframes rise { from { transform: translateY(6px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.verdict .ans { font-family: var(--display); font-style: italic; font-size: 2rem; line-height: 1.1; overflow-wrap: anywhere; min-width: 0; }
.verdict .pts { font-family: var(--mono); font-size: 1.1rem; color: var(--gold); font-variant-numeric: tabular-nums; white-space: nowrap; }
.verdict.miss .ans { color: var(--rose); }
.verdict.miss .pts { color: var(--faint); }
.meta { font-family: var(--mono); font-size: 0.82rem; color: var(--dim); margin: 0; }
.meta .mag { color: var(--ice); }
.others { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.92rem; margin: 0; }
.others dt { color: var(--faint); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 3px; }
.others dd { margin: 0; min-width: 0; }

/* summary */
.const-name { font-family: var(--display); font-style: italic; font-weight: 500; font-size: clamp(2rem, 9vw, 3rem); line-height: 1; margin: 0; overflow-wrap: anywhere; }
.score-line { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.score-line .big { font-family: var(--display); font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score-line .big small { font-size: 1rem; color: var(--dim); font-family: var(--mono); }
.bortle { font-family: var(--mono); font-size: 0.85rem; color: var(--ice); }
table.log { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.log td { padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
table.log td:first-child { padding-left: 0; color: var(--dim); }
table.log td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; }
table.log td.ans { font-weight: 700; overflow-wrap: anywhere; }
table.log td.ans.miss { color: var(--rose); font-weight: 400; }
.sharebox { width: 100%; font-family: var(--mono); font-size: 0.85rem; background: rgba(6, 9, 23, 0.6); color: var(--ink); border: 1px solid var(--line); border-radius: 3px; padding: 10px; resize: none; }

/* lists */
.list { display: flex; flex-direction: column; }
.row-btn { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.row-btn:hover { background: rgba(255, 255, 255, 0.03); }
.row-btn .r-main { display: flex; flex-direction: column; min-width: 0; }
.row-btn .r-main small { color: var(--dim); font-size: 0.82rem; }
.row-btn .r-side { font-family: var(--mono); font-size: 0.85rem; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-btn .r-side.todo { color: var(--dim); }
h2.sec { font-family: var(--display); font-weight: 500; font-size: 2rem; margin: 0; line-height: 1.1; }

.howto ol { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.howto li::marker { color: var(--gold); font-family: var(--mono); }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-family: var(--mono); font-size: 0.75rem; color: var(--dim); text-align: center; }
.scale div { border: 1px solid var(--line); border-radius: 3px; padding: 8px 4px; }
.scale b { display: block; font-size: 1.1rem; color: var(--ink); }

/* judging and rarity reveal */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
.judging { display: flex; align-items: center; gap: 12px; color: var(--dim); font-family: var(--mono); font-size: 0.9rem; min-height: 48px; }
.judging .scope { width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px dashed var(--ice); border-right-color: transparent; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.retry-msg { margin: 0; color: var(--rose); }
.retry-msg b { color: var(--ink); }
form.answer input.nope { border-color: var(--rose); animation: nudge 0.35s; }
@keyframes nudge { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.tier { align-self: flex-start; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; border: 1px solid currentColor; opacity: 0; }
.tier.on { opacity: 1; animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.tier.clouded { color: var(--rose); }
.tier.faint { color: var(--faint); }
.tier.visible { color: var(--ice); }
.tier.bright { color: #fff3dc; box-shadow: 0 0 14px rgba(255, 243, 220, 0.2); }
.tier.brilliant { color: var(--gold); box-shadow: 0 0 20px rgba(242, 210, 127, 0.4); }
.tier.supernova { color: var(--gold-ink); border-color: transparent; font-weight: 500; background: linear-gradient(100deg, #f2d27f, #fff6d6 40%, #f2d27f 60%, #e6a0ad); background-size: 200% 100%; box-shadow: 0 0 30px rgba(255, 233, 168, 0.6); }
.tier.supernova.on { animation: pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1), shimmer 1.6s linear infinite; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.verdict.brilliant .ans, .verdict.supernova .ans { color: var(--gold); text-shadow: 0 0 22px rgba(242, 210, 127, 0.45); }
.verdict.faint .ans { color: var(--dim); }
.note { margin: 0; color: var(--dim); font-style: italic; }
.panel.shake { animation: shake 0.5s; }
@keyframes shake { 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, -1px); } 80% { transform: translate(2px, 1px); } }

@media (prefers-reduced-motion: reduce) { .reveal, .tier.on, .tier.supernova.on, .panel.shake, .judging .scope, form.answer input.nope { animation: none; } .btn { transition: none; } }
