/* Midnight Countdown — deep night blue + gold. Mobile first. No inline styles anywhere (CSP style-src 'self'). */
:root {
  --night: #070b22;
  --night2: #0d1540;
  --ink: #eef0ff;
  --muted: #a8b0d8;
  --gold: #f4c56a;
  --gold2: #ffe3a3;
  --gold3: #c9922e;
  --card: rgba(20, 28, 72, 0.62);
  --line: rgba(244, 197, 106, 0.22);
  --r: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #10164a; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.6 var(--sans);
  background: radial-gradient(120% 70% at 50% 110%, #2a2466 0%, rgba(42, 36, 102, 0) 60%), linear-gradient(180deg, var(--night) 0%, var(--night2) 70%, #191a52 100%);
}
a { color: var(--gold2); text-underline-offset: 3px; }
a:hover { color: #fff; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
.small { font-size: .88rem; color: var(--muted); }
.center { text-align: center; }
.offscreen { position: fixed; left: -9999px; top: 0; }

/* Night sky: two layers of tiny stars, slow twinkle. */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky::before, .sky::after {
  content: ""; position: absolute; inset: -10%;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 42%, #dfe6ff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 47% 12%, #fff6d8 50%, transparent 51%), radial-gradient(1px 1px at 63% 33%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 81% 21%, #e9ecff 50%, transparent 51%), radial-gradient(1px 1px at 92% 47%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 7% 63%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 36% 77%, #fff6d8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 68%, #fff 50%, transparent 51%), radial-gradient(1.1px 1.1px at 55% 88%, #dfe6ff 50%, transparent 51%);
  background-size: 420px 420px;
  opacity: .75; animation: twinkle 6s ease-in-out infinite alternate;
}
.sky::after { background-size: 260px 260px; background-position: 90px 140px; opacity: .45; animation-duration: 9s; animation-delay: -3s; }
@keyframes twinkle { from { opacity: .35; } to { opacity: .85; } }
canvas.fw { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; opacity: 0; transition: opacity .4s; }
canvas.fw.on { opacity: 1; }

header.top, main, footer.foot { position: relative; z-index: 1; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 18px; max-width: 980px; margin: 0 auto; }
header.top.slim { justify-content: center; }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 1.15rem; letter-spacing: .02em; }
.logo b { color: var(--gold); font-weight: 600; }
.logo img { display: block; }
.mainnav { display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; }
.mainnav a { color: var(--muted); text-decoration: none; }
.mainnav a:hover { color: var(--gold2); }

main { max-width: 720px; margin: 0 auto; padding: 8px 18px 40px; }
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(2rem, 7.5vw, 3.4rem); margin-bottom: .35em; background: linear-gradient(180deg, #fff 10%, var(--gold2) 60%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.crumb { font-size: .85rem; color: var(--muted); margin: 0 0 10px; }
.sub { color: var(--muted); max-width: 560px; margin: 14px auto 22px; }
.tz { font-size: .85rem; color: var(--muted); margin: 8px 0 0; min-height: 1.4em; }
.cdsub { color: var(--gold); font-size: .95rem; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 14px; }
.cdname { word-break: break-word; }

/* The clock */
.clock { display: flex; justify-content: center; align-items: flex-start; gap: 4px; margin: 12px auto 4px; font-variant-numeric: tabular-nums; }
.clock .unit { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.clock .unit b {
  display: block; font-family: var(--serif); font-weight: 600; line-height: 1; font-size: clamp(2.6rem, 14vw, 5.6rem);
  padding: .18em .16em .14em; border-radius: 14px; min-width: 1.45em; text-align: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: var(--gold2); text-shadow: 0 0 24px rgba(244, 197, 106, .45);
}
.clock .unit b.tick { animation: tick .45s ease-out; }
/* Position only: the digit never fades or changes colour, so every frame (and every screenshot) is fully bright. */
@keyframes tick { from { transform: translateY(-6%); } to { transform: none; } }
.clock .unit span { margin-top: 6px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.clock .sep { font-style: normal; font-family: var(--serif); color: var(--gold3); font-size: clamp(1.8rem, 8vw, 3.6rem); line-height: 1.35; opacity: .8; }
.clock.last .unit b { color: #fff; box-shadow: 0 0 30px rgba(244, 197, 106, .55); }
.clock.zero .unit b { color: var(--gold); animation: glow 2.4s ease-in-out infinite alternate; }
@keyframes glow { from { text-shadow: 0 0 12px rgba(244, 197, 106, .4); } to { text-shadow: 0 0 34px rgba(255, 227, 163, .95); } }
.done { font-family: var(--serif); font-size: 1.5rem; color: var(--gold2); margin: 10px 0 0; animation: rise .8s ease-out; }
.count { margin: 16px auto 0; color: var(--muted); font-size: 1rem; }
.count.has { color: var(--gold2); }
.count.has::before { content: "🔒 "; }

/* Cards, forms, buttons */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
main > .card, main > section.card { margin: 22px 0; }
.create { text-align: left; max-width: 480px; margin: 0 auto; }
label { display: block; margin: 0 0 14px; }
label > span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
input:not([type=checkbox]), textarea {
  width: 100%; font: inherit; color: var(--ink); background: rgba(7, 11, 34, .7); border: 1px solid rgba(168, 176, 216, .3); border-radius: 12px; padding: 12px 14px; outline: none;
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244, 197, 106, .2); }
input:disabled { opacity: .45; }
input::placeholder, textarea::placeholder { color: rgba(168, 176, 216, .6); }
label.toggle, label.inline { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
label.toggle > span, label.inline > span { margin: 0; color: var(--ink); font-size: .95rem; }
label.toggle small { display: block; color: var(--muted); font-size: .82rem; }
input[type=checkbox] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 1rem var(--sans); cursor: pointer; text-decoration: none;
  color: #1c1405; background: linear-gradient(180deg, var(--gold2), var(--gold) 55%, var(--gold3)); border: 0; border-radius: 999px; padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(244, 197, 106, .25), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn:hover { filter: brightness(1.06); color: #1c1405; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.big { width: 100%; padding: 15px 22px; font-size: 1.05rem; }
.btn.sm { padding: 8px 14px; font-size: .88rem; }
.btn.ghost { background: transparent; color: var(--gold2); border: 1px solid var(--line); box-shadow: none; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; font-size: .88rem; padding: 0; }
.link-btn:hover { color: var(--gold2); }
.formsafe { text-align: center; font-size: .82rem; color: var(--muted); margin: 12px 0 0; }
.err { color: #ffb3b3; font-size: .9rem; margin: 10px 0 0; }
.ok { color: var(--gold2); font-weight: 600; margin: 0 0 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.cnt { font-size: .8rem; color: var(--muted); }
.mine { max-width: 480px; margin: 18px auto 0; text-align: left; }
.mine ul { list-style: none; padding: 0; margin: 0; }
.mine li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mine small { color: var(--muted); }
.h3 { font-size: 1.1rem; font-family: var(--serif); color: var(--gold2); }

/* Owner box */
.linkrow { margin: 12px 0; }
.linkrow .lbl { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 5px; }
.linkrow input.link { font-size: .85rem; padding: 9px 12px; min-width: 0; flex: 1; }
.danger { margin: 14px 0 0; text-align: right; }
.mineline { font-size: .92rem; color: var(--gold2); }
#write.sealed { animation: seal .9s ease-out; }
@keyframes seal { 0% { box-shadow: 0 0 0 0 rgba(244, 197, 106, .7); } 100% { box-shadow: 0 0 0 22px rgba(244, 197, 106, 0); } }

/* Revealed messages */
#msgs { margin: 26px 0; }
#msgs h2 { color: var(--gold2); font-size: 1.6rem; }
ol.msgs { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.msg { position: relative; background: linear-gradient(180deg, rgba(255, 244, 214, .97), rgba(246, 226, 178, .97)); color: #2a1f0b; border-radius: 16px; padding: 18px 18px 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .4); }
.msg .body { margin: 0 0 10px; white-space: pre-wrap; word-break: break-word; font-family: var(--serif); font-size: 1.08rem; line-height: 1.5; }
.msg .from { margin: 0; font-size: .9rem; color: #7a5a1c; font-weight: 600; }
.msg .rm { position: absolute; right: 14px; bottom: 12px; color: #8a6a2c; font-size: .8rem; }
ol.msgs.reveal .msg { opacity: 0; animation: unfold .8s cubic-bezier(.2, .8, .2, 1) forwards; }
ol.msgs.reveal .msg:nth-child(1) { animation-delay: .5s; } ol.msgs.reveal .msg:nth-child(2) { animation-delay: .85s; }
ol.msgs.reveal .msg:nth-child(3) { animation-delay: 1.2s; } ol.msgs.reveal .msg:nth-child(4) { animation-delay: 1.55s; }
ol.msgs.reveal .msg:nth-child(5) { animation-delay: 1.9s; } ol.msgs.reveal .msg:nth-child(6) { animation-delay: 2.25s; }
ol.msgs.reveal .msg:nth-child(n+7) { animation-delay: 2.6s; }
@keyframes unfold { from { opacity: 0; transform: translateY(18px) rotateX(35deg) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
main.gone .clock { opacity: .3; }
.own { text-align: center; margin-top: 26px; }

/* Content blocks */
.block { margin: 46px 0; }
.block h2 { font-size: 1.6rem; color: var(--gold2); }
.block p { color: #d9ddf6; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.steps .num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; color: #1c1405; background: linear-gradient(180deg, var(--gold2), var(--gold3)); }
.steps h3 { font-size: 1.05rem; margin: 4px 0 4px; }
.steps p { margin: 0; color: var(--muted); }
.ideas { padding-left: 1.2em; color: #d9ddf6; }
.ideas li { margin: 6px 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; position: relative; padding-right: 26px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 0; color: var(--gold); font-size: 1.2rem; line-height: 1.3; }
.faq details[open] summary::after { content: "–"; }
.faq p { margin: 8px 0 0; color: var(--muted); }
.capsule-teaser { text-align: left; }
.prose { margin-top: 18px; }
.prose h2 { font-size: 1.15rem; color: var(--gold2); margin-top: 1.4em; }
.prose p { color: #d9ddf6; }

footer.foot { max-width: 980px; margin: 0 auto; padding: 26px 18px 40px; text-align: center; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); }
footer.foot a { color: var(--muted); }
footer.foot a:hover { color: var(--gold2); }
.credit { opacity: .8; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; background: #1b2358; color: var(--ink); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: .92rem; max-width: 90vw; animation: rise .3s ease-out; }

@media (min-width: 720px) {
  .clock { gap: 10px; }
  .hero { padding-top: 34px; }
  .steps { grid-template-columns: 1fr 1fr; }
  ol.msgs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .clock .unit b { border-radius: 10px; }
  .clock .unit span { font-size: .62rem; letter-spacing: .08em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ol.msgs.reveal .msg { opacity: 1; }
}

/* Owner share buttons + "Start your own" card */
.lead { color: var(--ink); margin: 0 0 12px; }
.sharebox { display: grid; gap: 10px; margin: 0 0 14px; }
.btn.wa { background: linear-gradient(180deg, #4fe07f, #25d366 55%, #1aa84f); color: #04220f; }
.btn.wa:hover { color: #04220f; }
.cta { margin: 22px 0 0; text-align: center; border-color: rgba(244, 197, 106, .55); background: linear-gradient(180deg, rgba(60, 48, 120, .75), rgba(20, 28, 72, .75)); }
.cta h2 { color: var(--gold2); font-size: 1.35rem; }
.cta p { color: #d9ddf6; margin: 0 0 14px; }
#msgs .cta { margin-top: 26px; }


/* Time zone menu under the clock (display only) */
.tzpick { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: nowrap; margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.tzpick select { font: inherit; color: var(--gold2); background: rgba(7, 11, 34, .7); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; min-width: 0; max-width: 58vw; }
.tzpick label { white-space: nowrap; }
.tzpick select:focus { outline: none; border-color: var(--gold); }
.lede { color: var(--gold2); font-family: var(--serif); font-size: 1.12rem; margin: -6px auto 6px; max-width: 520px; }
.hero .create { margin-top: 16px; }
.hero .sub { margin-top: 22px; }
.scenes { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.scene { display: block; text-decoration: none; color: var(--ink); padding: 16px 18px; }
.scene b { display: block; color: var(--gold2); font-family: var(--serif); font-size: 1.1rem; margin-bottom: 4px; }
.scene span { color: var(--muted); font-size: .95rem; }
.scene:hover { border-color: var(--gold); color: var(--ink); }
.find { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (min-width: 720px) { .scenes { grid-template-columns: 1fr 1fr; } }

/* Phones: keep the clock and the Start button on the first screen. */
@media (max-width: 560px) {
  header.top { padding: 10px 14px; gap: 6px; }
  .mainnav { gap: 12px; font-size: .84rem; }
  .hero { padding-top: 6px; }
  .hero h1 { font-size: clamp(1.75rem, 8.4vw, 2.3rem); margin-bottom: .2em; }
  .lede { font-size: 1rem; margin: 0 auto 2px; }
  .clock { margin-top: 8px; }
  .clock .unit b { font-size: clamp(2.2rem, 12.5vw, 3.4rem); padding: .14em .12em .1em; }
  .clock .unit span { margin-top: 4px; }
  .create { padding: 14px 16px; }
  .create label { margin-bottom: 10px; }
  .create label > span { margin-bottom: 4px; }
  .create input:not([type=checkbox]) { padding: 10px 12px; }
  .create .btn.big { padding: 13px 20px; }
  .formsafe { margin-top: 8px; }
}
