:root {
  --sky: #020617; --ink: #f7faff; --glow: #0c1e4c; --accent: #ffd66b; --on-accent: #161022;
  --glass: rgb(8 14 40 / .5); --line: rgb(255 255 255 / .18);
  --rainbow: linear-gradient(100deg, #ff3b5c, #ffb13b, #2bf59a, #22d3ff, #a46bff, #ff4fd8);
  --display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
}
[data-theme="candy"] { --sky: #14032e; --glow: #4d1263; --glass: rgb(32 6 52 / .5); }
[data-theme="summer"] { --sky: #071440; --glow: #54246e; --glass: rgb(18 14 58 / .5); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--sky); color: var(--ink); font: 1rem/1.5 system-ui, sans-serif; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; text-wrap: balance; }
button, input { font: inherit; }
button, .controls a {
  min-height: 44px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 22px;
  background: rgb(255 255 255 / .07); color: inherit; font: inherit; line-height: 1.5; cursor: pointer;
  text-decoration: none; touch-action: manipulation; transition: background-color .2s, color .2s;
}
button[aria-pressed="true"], .primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.hero {
  position: relative; isolation: isolate; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 560px;
  /* Search crawlers render in a viewport over 10,000px tall. */
  max-height: 1600px;
  background: linear-gradient(var(--sky), var(--glow)); color: var(--ink);
}
.scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.no-3d .scene { visibility: hidden; }
.answer { padding: 14px 12px 0; text-align: center; }
.answer p { margin: 0; }
h1 { margin: 0 auto; padding: 0 38px; max-width: 18em; font-size: clamp(1.15rem, 5.2vw, 1.6rem); text-shadow: 0 2px 8px #0008; }
.answer .greeting { margin-top: 4px; color: var(--accent); font: 700 1.15rem/1.3 var(--display); overflow-wrap: anywhere; }
.count strong {
  display: block; height: var(--number); color: var(--accent);
  font: 700 calc(var(--number) * .85)/var(--number) var(--display);
}
.count { --number: clamp(92px, 17svh, 170px); }
.count.lit strong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.marquee { display: block; width: 100%; height: var(--number); }
.is-christmas .count strong { height: auto; margin-top: 20px; font-size: clamp(2.6rem, 10vw, 5rem); line-height: 1.05; }
.count span {
  display: block; min-height: 1.4em; font: 700 clamp(1.15rem, 5.4vw, 1.7rem)/1.4 var(--display);
  text-shadow: 0 2px 8px #0008;
}
.answer .date { font-size: .9rem; }
.timer { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 420px; margin: 8px auto 0; }
.timer p { padding: 4px 0 3px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(rgb(255 255 255 / .12), rgb(255 255 255 / .03)); }
.timer b { display: block; font: 600 clamp(1.4rem, 6.5vw, 2.1rem)/1.2 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer span { display: block; color: rgb(255 255 255 / .82); font-size: .625rem; letter-spacing: .08em; text-transform: uppercase; }
.answer .basis { margin-top: 4px; font-size: .75rem; text-shadow: 0 1px 3px #000c; }

.controls {
  position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 6px; padding: 0 6px;
}
.controls a { display: inline-flex; align-items: center; }
.controls button, .controls a { padding: 8px 12px; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.controls button:not([aria-pressed="true"]), .controls a, .motion, .exit {
  background: rgb(6 10 30 / .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.controls button[aria-pressed="true"] { border-color: var(--accent); }
.switch { display: flex; }
.switch button:first-child { border-radius: 22px 0 0 22px; }
.switch button:last-child { border-radius: 0 22px 22px 0; }

.motion, .exit { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; }
.motion { width: 44px; padding: 0; display: grid; place-items: center; }
.motion::before { content: ""; width: 10px; height: 14px; border: solid currentColor; border-width: 0 3px; }
.motion.paused::before { width: 0; height: 0; margin-left: 3px; border-color: transparent transparent transparent currentColor; border-width: 7px 0 7px 12px; }
.exit { display: none; }
.hero:not(.no-3d) { cursor: crosshair; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.hero button, .hero a { cursor: pointer; }
.hint {
  position: absolute; left: 50%; bottom: calc(62px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  min-height: 44px; padding: 8px 12px; border-color: #ffd66b80; border-radius: 22px;
  background: rgb(6 10 30 / .62); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); font-size: .8125rem; white-space: nowrap;
}
/* After the first firework it steps aside, but stays available to keyboards and screen readers. */
.hint.used:not(:focus-visible) { opacity: 0; pointer-events: none; }
.no-3d .hint, .presenting .hint { display: none; }
.presenting { position: fixed; inset: 0; z-index: 10; height: auto; min-height: 0; max-height: none; }
.presenting .controls, .presenting .motion { display: none; }
.presenting .exit { display: block; }

/* Side by side: a glass panel with the answer, the delivery beside it. */
@media (min-width: 900px), (min-width: 600px) and (max-height: 500px) {
  .answer {
    position: absolute; left: 2.5vw; top: 50%; transform: translateY(-50%);
    width: 36%; max-width: 640px; padding: clamp(16px, 3.4vh, 40px) clamp(12px, 1.8vw, 36px);
    border: 1px solid var(--line); border-radius: 32px; background: var(--glass);
    -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .16), 0 24px 70px rgb(0 0 0 / .28);
  }
  h1 { padding: 0; font-size: clamp(1.1rem, 2.1vw, 2.3rem); }
  .count { --number: clamp(96px, 26vh, 300px); }
  .count span { font-size: clamp(1.05rem, 1.9vw, 2rem); }
  .answer .greeting { font-size: clamp(1.05rem, 1.7vw, 1.7rem); }
  .answer .date { font-size: 1rem; }
  .answer .timer { max-width: none; margin-top: 14px; }
  .is-christmas .count strong { font-size: clamp(1.8rem, min(5vw, 14vh), 5rem); }
  .timer b { font-size: clamp(1.2rem, 2.3vw, 2.4rem); }
  .hint { left: 70%; bottom: 14px; }
  .controls { position: static; flex-wrap: wrap; margin-top: 16px; padding: 0; }
  .controls button, .controls a { padding-inline: clamp(8px, .9vw, 16px); }
}
@media (max-height: 500px) {
  .hero { min-height: 320px; }
  .answer { left: max(8px, env(safe-area-inset-left)); width: 48%; padding: 6px 8px; border-radius: 22px; }
  h1 { font-size: .9rem; max-width: none; }
  .answer .greeting { margin: 0; font-size: .8rem; line-height: 1.2; }
  .count { --number: min(25vh, 120px); }
  .count span { font-size: .9rem; }
  .answer .date { font-size: .75rem; }
  .answer .basis { display: none; }
  .answer .timer { margin-top: 2px; gap: 4px; }
  .timer p { padding: 1px 0; border-radius: 10px; }
  .timer b { font-size: 1.05rem; }
  .timer span { font-size: .5625rem; }
  .controls { flex-wrap: nowrap; gap: 4px; margin: 5px 0 0; }
  .controls button, .controls a { padding: 8px 6px; font-size: .6875rem; }
}

.maker {
  display: grid; gap: 32px; align-items: center; max-width: 1000px; margin: auto; padding: 48px 16px;
}
.maker h2 { margin-top: 0; font-size: 1.9rem; }
form, fieldset { min-width: 0; }
.field { display: block; padding: 0; margin: 20px 0 6px; font-weight: 700; }
#name, #link {
  width: 100%; min-height: 44px; padding: 8px 12px; font-size: 16px;
  border: 1px solid #ffffff66; border-radius: 14px; background: rgb(255 255 255 / .06); color: inherit;
}
::placeholder { color: currentColor; opacity: .5; }
fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.theme {
  display: flex; align-items: center; gap: 12px; min-height: 56px; margin-top: 8px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 18px; background: rgb(255 255 255 / .04); cursor: pointer;
}
.theme:has(input:checked) { border-color: var(--accent); background: rgb(255 255 255 / .1); }
.theme::after { content: ""; width: 56px; height: 32px; margin-left: auto; border-radius: 10px; }
.theme.snow::after { background: linear-gradient(120deg, #020617, #0c1e4c, #19f59a); }
.theme.candy::after { background: linear-gradient(120deg, #14032e, #ff4fd0, #38d6ff); }
.theme.summer::after { background: linear-gradient(120deg, #071440, #ff5470, #ffbd3d); }
.theme input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.status { min-height: 1.5em; margin: 8px 0; }
.note { font-size: .875rem; }
.card { display: block; width: 100%; max-width: 420px; height: auto; margin: auto; border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 24px 80px rgb(0 0 0 / .4); }

.facts { display: grid; gap: 8px 48px; max-width: 1000px; margin: auto; padding: 24px 16px; }
.facts > div { min-width: 0; }
.facts h2 { font-size: 1.6rem; }
.facts h3 { margin: 20px 0 8px; font-family: var(--display); font-size: 1.15rem; }
.facts table { width: 100%; border-collapse: collapse; font-size: .9375rem; font-variant-numeric: tabular-nums; }
.facts th, .facts td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); text-align: left; }
.facts tbody th { font-weight: 400; }
.facts td { font-weight: 600; }
.facts td:last-child { font-weight: 400; }

.about { display: grid; gap: 24px; max-width: 1000px; margin: auto; padding: 16px 16px 64px; }
.about h2 { font-size: 1.15rem; }

@media (min-width: 760px) {
  .maker { grid-template-columns: 1fr 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts-intro { grid-column: 1 / -1; }
  .about { grid-template-columns: repeat(3, 1fr); }
}
.maker { position: relative; }
.maker::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 4px; border-radius: 2px; background: var(--rainbow); }
.maker h2:focus { outline: none; }
@media (max-width: 359px) {
  .controls { gap: 4px; padding: 0 4px; }
  .controls button, .controls a { padding: 8px 8px; font-size: .75rem; }
}

.controls button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.sheet {
  width: min(820px, calc(100% - 16px)); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
  padding: 20px; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: 28px; background: var(--sky); color: var(--ink);
}
.sheet::backdrop { background: rgb(0 0 0 / .6); }
html:has(.sheet[open]) { overflow: hidden; }
.sheet h2 { margin: 0 48px 14px 0; font-size: 1.4rem; }
.sheet h2:focus { outline: none; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 44px; padding: 0; font-size: 1.6rem; line-height: 1; }
.sheet-body { display: grid; gap: 14px; }
.sheet-media {
  justify-self: center; overflow: hidden;
  height: min(42vh, 400px); height: min(42dvh, 400px); aspect-ratio: 9 / 16;
  border-radius: 20px; background: rgb(255 255 255 / .06);
}
.sheet-media video, .sheet-media img, .making canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.making { position: relative; height: 100%; }
.making progress {
  position: absolute; left: 10%; bottom: 14px; width: 80%; height: 6px; overflow: hidden;
  -webkit-appearance: none; appearance: none; border: 0; border-radius: 3px; background: #ffffff33;
}
.making progress::-webkit-progress-bar { background: #ffffff33; }
.making progress::-webkit-progress-value { background: var(--accent); }
.making progress::-moz-progress-bar { background: var(--accent); }
.sheet-side { min-width: 0; }
.sheet-main { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-main button { flex: 1 1 auto; min-height: 50px; font-weight: 700; white-space: nowrap; }
.sheet-main .primary { flex-basis: 55%; }
.sheet button:disabled { opacity: .65; cursor: progress; }
.sheet .status { margin: 8px 0; font-size: .875rem; }
.in-app { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 14px; font-size: .875rem; }
.steps { margin: 0; font-size: .875rem; }
.steps dt { margin-top: 8px; font-weight: 700; }
.steps dd { margin: 0; color: rgb(255 255 255 / .8); }
.steps[data-route="upload"] .by-sheet, .steps:not([data-route="upload"]) .by-upload { display: none; }
.photos { margin: 10px 0 0; color: rgb(255 255 255 / .8); font-size: .8125rem; }
.sheet-more { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.sheet-more button { padding: 8px 12px; font-size: .8125rem; }
#share-link-field { width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 12px; font-size: 16px; }
@media (min-width: 620px) {
  .sheet { padding: 28px; }
  .sheet-body { grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; }
  .sheet-media { height: min(68vh, 560px); height: min(68dvh, 560px); }
}
noscript a { color: var(--accent); }
.foot { padding: 0 16px 32px; text-align: center; font-size: .875rem; }
.foot a { display: inline-block; padding: 10px; color: inherit; }
