:root {
  --bg: #fbf5ea;
  --surface: #fffdf8;
  --ink: #2a1d12;
  --muted: #7a6754;
  --line: #eadcc6;
  --red: #c8102e;
  --red-ink: #a10d25;
  --gold: #f2c230;
  --cap: #e9c792;
  --cap-ring: #c79d63;
  --wood-dark: #4a2c12;
  --shadow: rgba(60, 35, 10, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b140e;
    --surface: #251c15;
    --ink: #f3e8d8;
    --muted: #b09c86;
    --line: #3a2d22;
    --red: #e0283f;
    --red-ink: #ff6b7c;
    --gold: #f2c230;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin: 0 0 0.4rem; }

.top, main, footer { width: min(980px, 100% - 32px); margin-inline: auto; }

.top {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 36px 0 24px;
}
.tagline { margin: 4px 0 0; color: var(--muted); }
.toggles { display: flex; gap: 8px; }

button { font: inherit; color: inherit; cursor: pointer; }

.chip {
  border: 1px solid var(--line); background: var(--surface);
  padding: 6px 14px; border-radius: 999px; font-size: 0.9rem;
}
.chip:hover { border-color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(18px, 4vw, 32px);
  margin-bottom: 20px;
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px var(--shadow);
}

.tio-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.countdown { margin: 0; color: var(--red-ink); font-weight: 600; }

.play {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: 24px; align-items: center; margin-top: 12px;
}
@media (max-width: 720px) { .play { grid-template-columns: 1fr; } }

.stage { position: relative; }

.tio-btn {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  border-radius: 16px; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tio-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.tio { display: block; width: 100%; height: auto; overflow: visible; }

.shadow { fill: var(--shadow); }
.leg { stroke: var(--wood-dark); stroke-width: 11; stroke-linecap: round; }
.grain { fill: none; stroke: rgba(40, 20, 5, 0.35); stroke-width: 3; stroke-linecap: round; }
.cap { fill: var(--cap); stroke: #7a4a20; stroke-width: 8; }
.ring { fill: none; stroke: var(--cap-ring); stroke-width: 2.5; }
.eyes { fill: #2a1a0c; transform-origin: 141px 188px; animation: blink 5s infinite; }
.cheek { fill: #e8798a; opacity: 0.55; }
.mouth { fill: none; stroke: #2a1a0c; stroke-width: 4; stroke-linecap: round; }
.hat { fill: var(--red); }
.hat-band { fill: #8e0b21; }
.blanket-edge { fill: none; stroke: rgba(80, 20, 0, 0.25); stroke-width: 3; }

.body { transform-origin: 285px 300px; transform: scale(var(--fat, 1)); transition: transform 0.5s cubic-bezier(.3, 1.6, .5, 1); }
.blanket { transform-origin: 365px 300px; transition: transform 0.45s ease, opacity 0.35s ease; }
.uncovered .blanket { opacity: 0; transform: translate(60px, 20px) scale(0.85) rotate(6deg); pointer-events: none; }

.hit .body { animation: squish 0.28s ease; }
.hit .blanket { animation: wobble 0.3s ease; }
.chew .mouth { animation: chew 0.18s ease 4 alternate; transform-origin: 141px 220px; }
.lift .blanket { animation: lift 0.9s ease; }
.nope .body { animation: shake 0.4s ease; }

@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
@keyframes squish { 40% { transform: scale(calc(var(--fat, 1) * 1.04), calc(var(--fat, 1) * 0.92)); } }
@keyframes wobble { 40% { transform: skewX(-3deg) translateY(4px); } }
@keyframes chew { to { transform: scaleY(0.55); } }
@keyframes lift { 35%, 65% { transform: translateY(-46px) rotate(-4deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px) scale(var(--fat, 1)); } 40%, 80% { transform: translateX(8px) scale(var(--fat, 1)); } }

.fx { position: absolute; inset: 0; pointer-events: none; }

.stick {
  position: absolute; width: 120px; height: 14px; margin: -7px 0 0 -6px;
  background: linear-gradient(#8a5a2e, #5b3818); border-radius: 7px;
  transform-origin: 6px 50%; animation: swing 0.32s ease-out forwards;
}
.stick::after { content: ""; position: absolute; left: 40px; top: -7px; width: 18px; height: 7px; border-radius: 4px 4px 0 0; background: #6b431f; transform: rotate(-30deg); }
@keyframes swing {
  0% { transform: rotate(-70deg) translateX(10px); opacity: 1; }
  45% { transform: rotate(-12deg) translateX(0); }
  100% { transform: rotate(-30deg) translateX(0); opacity: 0; }
}

.pam {
  position: absolute; font: 800 1.6rem/1 var(--serif); color: var(--red);
  -webkit-text-stroke: 1px var(--surface); transform: translate(-50%, -50%);
  animation: pam 0.6s ease-out forwards;
}
@keyframes pam { from { transform: translate(-50%, -50%) scale(0.4) rotate(-12deg); } 30% { transform: translate(-50%, -90%) scale(1.15) rotate(-6deg); } to { transform: translate(-50%, -150%) scale(1) rotate(0); opacity: 0; } }

.drop {
  position: absolute; left: 74%; bottom: 4%; font-size: clamp(2.4rem, 7vw, 3.4rem);
  transform: translateX(-50%); animation: drop 1.6s cubic-bezier(.2, .9, .3, 1.2) forwards;
  filter: drop-shadow(0 6px 6px var(--shadow));
}
@keyframes drop {
  0% { transform: translate(-50%, 30%) scale(0.2); opacity: 0; }
  30% { transform: translate(-10%, -60%) scale(1.2); opacity: 1; }
  55% { transform: translate(0, 0) scale(1); }
  85% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(0, 40%) scale(0.6); opacity: 0; }
}

.song { list-style: none; margin: 0; padding: 0; font-family: var(--serif); font-size: 1.2rem; }
.song li { padding: 3px 0 3px 14px; border-left: 3px solid var(--line); color: var(--muted); transition: color 0.2s, border-color 0.2s; }
.song li.sung { color: var(--ink); border-color: var(--gold); }
.song li.now { color: var(--red-ink); border-color: var(--red); font-weight: 600; }
.song .gloss { display: block; font: italic 0.85rem/1.3 var(--sans); color: var(--muted); font-weight: 400; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 20px; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 600;
  background: var(--red); color: #fff;
  box-shadow: 0 2px 0 #7e0a1d; transition: transform 0.08s;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:focus-visible, .chip:focus-visible, .link:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
#cover { background: var(--gold); color: #3a2400; box-shadow: 0 2px 0 #b58b10; }
.belly { color: var(--muted); font-size: 0.95rem; }

.status { min-height: 1.6em; margin: 14px 0 0; font-weight: 600; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

.gifts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 0.92rem; }
.link:hover { color: var(--ink); }

.gifts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gifts li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; font-size: 0.95rem;

}
.gifts li.new { animation: pop 0.4s cubic-bezier(.3, 1.6, .5, 1); }
.gifts li .e { font-size: 1.8rem; line-height: 1; }
.gifts li.bad { border-color: var(--red); border-style: dashed; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.empty { color: var(--muted); margin: 12px 0 0; }

.about p { max-width: 62ch; }
.about h2:not(:first-child) { margin-top: 1.4rem; }

footer { padding: 8px 0 48px; color: var(--muted); font-size: 0.92rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .drop { animation: none; }
}
