/* New Year's Beat Drop Calculator: midnight navy + champagne gold.
   Light = crisp white with navy text; dark = night sky. The answer card is always "midnight". */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --wash: #f8f2e2;          /* champagne wash behind the hero */
  --ink: #0d1838;
  --muted: #475273;
  --line: #e1e4ec;
  --gold: #855d00;          /* gold text on white: AA */
  --gold-fill: #e6c266;
  --gold-ink: #0d1838;
  --field: #ffffff;
  --field-line: #b9c1d3;
  --focus: #1f4fd8;
  --warn-bg: #fff3d6;
  --warn-ink: #5e3d00;
  /* answer card: midnight in both themes */
  --night: #0b1636;
  --night-2: #13224f;
  --night-ink: #f6f0e0;
  --night-muted: #b8c1dc;
  --night-gold: #f0cd72;
  --night-line: #2a3a6c;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Avenir Next", Avenir, "Futura PT", Futura, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --r-card: 20px;
  --r-ctl: 10px;
  --wide: 1080px;
  --text: 680px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1330;
    --wash: #0f1b45;
    --ink: #f3eedf;
    --muted: #aab4d2;
    --line: #233160;
    --gold: #f0cd72;
    --gold-fill: #f0cd72;
    --gold-ink: #0b1636;
    --field: #0d1839;
    --field-line: #3a4a7d;
    --focus: #9db4ff;
    --warn-bg: #3a2c0b;
    --warn-ink: #ffe3a3;
    --night: #050b20;
    --night-2: #0d1940;
    --night-line: #3b4a7a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg) linear-gradient(180deg, var(--wash), var(--bg) 520px) no-repeat;
  min-height: 100vh;
  overflow-x: hidden;
}
.sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; }
@media (prefers-color-scheme: dark) {
  .sky {
    opacity: .7;
    background-image:
      radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 28% 72%, #fff 50%, transparent 51%),
      radial-gradient(1.2px 1.2px at 47% 9%, #ffeec2 50%, transparent 51%),
      radial-gradient(1px 1px at 63% 44%, #fff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 84% 22%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 91% 66%, #cfd8ff 50%, transparent 51%),
      radial-gradient(1.2px 1.2px at 6% 88%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 39% 94%, #fff 50%, transparent 51%);
  }
}

a { color: var(--gold); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

main { max-width: var(--wide); margin: 0 auto; padding: 0 16px; }

/* ---------- Hero: left edge, one sentence ---------- */
.hero { padding: 36px 0 22px; max-width: 760px; }
h1 {
  font-family: var(--display);
  font-size: clamp(2.1rem, 7.4vw, 3.6rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.025em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.lede { margin: 0; max-width: 34em; color: var(--muted); font-size: 1.1rem; text-wrap: pretty; }
@media (min-width: 700px) { .hero { padding: 64px 0 34px; } .lede { font-size: 1.2rem; } }

/* ---------- Tool layout ---------- */
.tool-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "in" "out" "opts"; }
.area-in { grid-area: in; }
.area-out { grid-area: out; min-width: 0; margin: 4px 0 30px; }
.area-opts { grid-area: opts; min-width: 0; }
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); grid-template-areas: "in out" "opts out"; column-gap: 56px; }
  .area-out { position: sticky; top: 24px; align-self: start; margin: 0; }
}

.field { margin: 0 0 20px; display: grid; gap: 6px; min-width: 0; }
label, legend { font-weight: 650; }
.opt { font-weight: 400; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0 0 6px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
input[type=text], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; min-width: 0;
  font: inherit; color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--field-line);
  border-radius: var(--r-ctl);
  padding: 11px 13px;
}
#drop {
  font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700;
  font-size: 2rem; letter-spacing: -.01em; padding: 10px 16px; max-width: 14ch;
}
#drop::placeholder { color: var(--field-line); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent); }
.hint { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--muted); }
.hint.err { color: var(--warn-ink); background: var(--warn-bg); padding: 6px 10px; border-radius: 6px; }
.hint .linkish { font: inherit; font-weight: 700; background: none; border: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; padding: 4px 2px; min-height: 44px; cursor: pointer; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.seg label { flex: 1 1 170px; position: relative; font-weight: 600; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; min-height: 46px; text-align: center; padding: 8px 12px;
  border-radius: var(--r-ctl); border: 1.5px solid var(--field-line); cursor: pointer;
}
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

details.advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 4px 0 6px; }
details.advanced summary { cursor: pointer; font-weight: 650; padding: 12px 0; min-height: 44px; }
details.advanced[open] { padding-bottom: 4px; }

/* ---------- The answer: the only card ---------- */
.answer-card {
  position: relative; overflow: hidden;
  container-type: inline-size;
  color: var(--night-ink);
  background:
    radial-gradient(2.5px 2.5px at 3% 5%, var(--night-gold) 50%, transparent 52%),
    radial-gradient(2px 2px at 17% 8%, #fff 50%, transparent 52%),
    radial-gradient(3px 1.6px at 90% 12%, var(--night-gold) 50%, transparent 52%),
    radial-gradient(2px 2px at 82% 6%, #ffe9b8 50%, transparent 52%),
    radial-gradient(2px 2px at 95% 30%, #fff 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 4% 40%, #ffe9b8 50%, transparent 52%),
    radial-gradient(600px 260px at 50% -30%, var(--night-2), transparent 70%),
    var(--night);
  border: 1px solid var(--night-line);
  border-radius: var(--r-card);
  padding: 26px 22px 22px;
  box-shadow: 0 18px 50px rgba(8, 15, 40, .22);
}
@media (min-width: 600px) { .answer-card { padding: 34px 34px 26px; } }
.answer-card a { color: var(--night-gold); }
.spark {
  position: absolute; width: 14px; height: 14px; background: var(--night-gold); pointer-events: none;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: .85;
}
.spark.s1 { top: 18px; right: 26px; }
.spark.s2 { top: 52px; right: 58px; width: 8px; height: 8px; background: #fff; opacity: .7; }
.spark.s3 { top: 22px; left: 46%; width: 9px; height: 9px; opacity: .55; }
.spark.s4 { bottom: 8px; right: 10px; width: 10px; height: 10px; background: #ffe9b8; opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .spark { animation: twinkle 2.6s ease-in-out infinite alternate; }
  .spark.s2 { animation-delay: .8s; } .spark.s3 { animation-delay: 1.5s; } .spark.s4 { animation-delay: 2s; }
}
@keyframes twinkle { from { transform: scale(.6) rotate(0); opacity: .35; } to { transform: scale(1.1) rotate(20deg); } }

.empty { color: var(--night-muted); max-width: 22em; position: relative; }
.empty::before {
  content: "--:--:--"; display: block; margin-bottom: 6px;
  font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 14cqi, 4.4rem); line-height: 1; letter-spacing: -.03em;
  color: var(--night-line);
}
.press-label { margin: 0; font-size: 1rem; font-weight: 600; color: var(--night-muted); }
.press-time {
  margin: 2px 0 4px;
  font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 800;
  font-size: clamp(2.6rem, 15cqi, 5.4rem); line-height: 1; letter-spacing: -.035em;
  color: var(--night-gold); white-space: nowrap;
  text-shadow: 0 0 34px rgba(240, 205, 114, .25);
}
.press-time .ampm { font-size: .42em; font-weight: 700; letter-spacing: 0; margin-left: .12em; }
.press-day { margin: 0; font-weight: 600; font-size: 1.05rem; }
.press-explain { margin: 6px 0 0; color: var(--night-muted); max-width: 32em; }
.warn { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: #3a2c0b; color: #ffe3a3; }
.chain-list { margin: 14px 0 0; padding-left: 1.3em; }
.chain-list li { padding: 2px 0; }
.chain-list .mono { font-variant-numeric: tabular-nums; font-weight: 700; }
.chain-list li.drop { color: var(--night-gold); font-weight: 700; }

.live { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--night-line); }
.stat { margin: 0; padding: 4px 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; }
.stat-label { font-size: 1rem; color: var(--night-muted); }
.stat-num { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 700; font-size: clamp(1.2rem, 5.5cqi, 1.6rem); line-height: 1.3; }
.missed { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: #3a2c0b; color: #ffe3a3; }

/* ---------- Actions ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 0; }
.actions .primary, .actions .toggle { grid-column: 1 / -1; }
.actions .toggle { justify-content: flex-start; }
@media (min-width: 520px) { .actions { display: flex; flex-wrap: wrap; } .actions .toggle { justify-content: center; } }
.status { flex-basis: 100%; margin: 2px 0 0; min-height: 1.4em; font-size: .95rem; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 9px; justify-content: center;
  font: inherit; font-weight: 650; font-size: 1rem; color: var(--ink); text-decoration: none;
  background: transparent; border: 1.5px solid var(--field-line); border-radius: var(--r-ctl); padding: 8px 15px; min-height: 44px; cursor: pointer;
}
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold-fill); border-color: var(--gold-fill); color: var(--gold-ink); }
/* Toggle: a small switch that visibly flips on/off; aria-pressed carries the state. */
.toggle .sw { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--field-line); flex: none; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); transition: transform .15s; }
.toggle[aria-pressed=true] { border-color: var(--gold); }
.toggle[aria-pressed=true] .sw { background: var(--gold); }
.toggle[aria-pressed=true] .sw::after { transform: translateX(12px); }

.clock-check { margin: 12px 0 0; font-size: .95rem; color: var(--muted); }

/* ---------- Reading content ---------- */
.content { max-width: var(--text); margin: 72px 0 32px; }
.content section { margin-bottom: 44px; }
.content h2 { font-family: var(--display); font-size: 1.6rem; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; margin: 0 0 10px; }
.content li { margin-bottom: 6px; }
.content ol, .content ul { padding-left: 1.25em; }
.content li::marker { color: var(--gold); font-weight: 700; }
.example-links a { font-weight: 650; padding: 10px 0; }
.example-links { line-height: 2.2; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; min-height: 44px; }
.faq details p { margin: 0 0 16px; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--wide); margin: 0 auto; padding: 24px 16px 44px;
  border-top: 1px solid var(--line); font-size: .95rem; color: var(--muted);
}
.sb-footer p { margin: 0 0 8px; }
.sb-more a, .sb-credit a { color: var(--gold); font-weight: 600; }
.sb-more a { display: inline-block; padding: 6px 2px; }
.sb-credit { color: var(--ink); }

/* ---------- 404 ---------- */
.site-header { max-width: var(--wide); margin: 0 auto; padding: 14px 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-family: var(--display); font-weight: 700; }
.brand svg { color: var(--gold); }
.notfound { padding: 40px 0 60px; max-width: var(--text); }
.notfound .big { font-family: var(--display); font-weight: 800; font-size: clamp(3.4rem, 18vw, 6.5rem); line-height: 1; letter-spacing: -.04em; color: var(--gold); margin: 0 0 8px; }
.notfound p { color: var(--muted); }

/* ---------- Party mode (navy, not purple) ---------- */
.party {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  background: #04081a radial-gradient(900px 520px at 50% 115%, #13224f, transparent 70%);
  color: #f6f0e0; padding: 16px; overflow-y: auto;
}
.party-inner { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0; }
.party-song { margin: 0; color: #c8cfe6; font-size: clamp(1rem, 3vw, 1.4rem); max-width: 90vw; overflow-wrap: anywhere; }
.party-stage { margin: 6px 0; font-family: var(--display); font-weight: 700; font-size: clamp(1.2rem, 4.8vw, 2.4rem); color: #f0cd72; }
.party-num {
  margin: 0; font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 800;
  font-size: clamp(3.8rem, min(23vw, 34vh), 18rem); line-height: 1; letter-spacing: -.04em; white-space: nowrap;
}
.party.far .party-num { font-size: clamp(2.2rem, 10vw, 7rem); white-space: normal; letter-spacing: -.02em; }
.party-sub { margin: 10px 0 0; font-size: clamp(1rem, 3.2vw, 1.5rem); color: #c8cfe6; min-height: 1.5em; }
.party-clock { margin: 18px 0 0; color: #9fa8c8; }
@media (max-height: 500px) { .party-stage { margin: 2px 0; font-size: 1.2rem; } .party-sub { margin-top: 4px; } .party-clock { margin-top: 6px; } }
.party-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.party .btn { color: #f6f0e0; border-color: #33416f; }
.party .toggle .sw { background: #33416f; }
.party .toggle .sw::after { background: #04081a; }
.party .toggle[aria-pressed=true] .sw { background: #f0cd72; }
.party.go { background: #f0cd72; color: #0b1636; }
.party.go .party-stage, .party.go .party-sub, .party.go .party-song, .party.go .party-clock { color: #0b1636; }
.party.go .btn { color: #0b1636; border-color: #0b1636; }
.party.celebrate .party-num { font-size: clamp(2.6rem, 12vw, 9rem); white-space: normal; color: #f0cd72; }
@media (prefers-reduced-motion: no-preference) {
  .party.go .party-num { animation: pulse .5s ease-in-out infinite alternate; }
  .party.celebrate .party-num { animation: glow 1.2s ease-in-out infinite alternate; }
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.05); } }
@keyframes glow { from { text-shadow: 0 0 0 transparent; } to { text-shadow: 0 0 40px rgba(240, 205, 114, .7); } }

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

/* ---------- Print: keep the plan, drop the controls ---------- */
@media print {
  :root { --bg: #fff; --ink: #000; --muted: #333; --line: #bbb; --gold: #000; --night: #fff; --night-ink: #000; --night-gold: #000; --night-muted: #333; --night-line: #bbb; }
  body { background: #fff; font-size: 12pt; }
  .sky, .site-header, .actions, .live, .party, .clock-check, details.advanced, .area-opts, .hint, .content, .sb-more, .spark { display: none !important; }
  .tool-grid { display: block; }
  .answer-card { background: #fff; box-shadow: none; border: 2px solid #000; }
  .press-time { text-shadow: none; }
}
