:root {
  --navy: #0c1352;
  --royal: #1d2f9e;
  --royal-hi: #3651d1;
  --cream: #f6ebc8;
  --lotion: #fffaf0;
  --red: #e3242b;
  --red-dark: #b4161c;
  --ink: #0b0f33;
  --focus: #ffd84d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--cream);
  background-color: var(--navy);
  background-image:
    radial-gradient(120% 70% at 50% 100%, var(--royal-hi) 0%, var(--royal) 38%, transparent 75%),
    radial-gradient(3px 3px at 12% 18%, #fff8 50%, transparent 52%),
    radial-gradient(2px 2px at 78% 12%, #fff6 50%, transparent 52%),
    radial-gradient(2px 2px at 64% 34%, #fff5 50%, transparent 52%),
    radial-gradient(3px 3px at 28% 40%, #fff4 50%, transparent 52%),
    radial-gradient(2px 2px at 90% 46%, #fff5 50%, transparent 52%),
    linear-gradient(180deg, var(--navy), #111a66);
  -webkit-tap-highlight-color: transparent;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 700;
}
.skip:focus { top: 12px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- top bar ---------- */
.top {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 8px;
}

.brand {
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.brand .dot { color: var(--red); }

.sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #f6ebc855;
  border-radius: 999px;
  background: #0c135299;
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}
.sound-icon { width: 18px; height: 18px; flex: none; }
.sound .wave { display: none; }
.sound .mute { display: inline; }
.sound[aria-pressed="true"] .wave { display: inline; }
.sound[aria-pressed="true"] .mute { display: none; }
.sound[aria-pressed="true"] {
  border-color: var(--cream);
  background: var(--cream);
  color: var(--ink);
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  min-height: 0;
  padding: 0 16px;
}

.message {
  position: relative;
  z-index: 30;
  text-align: center;
  padding-top: clamp(4px, 3dvh, 32px);
}

.headline {
  margin: 0;
  font-size: clamp(2.6rem, 11vw, 5.6rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--lotion);
  -webkit-text-stroke: 3px var(--navy);
  paint-order: stroke fill;
  text-shadow:
    0 3px 0 var(--red),
    0 6px 0 var(--red-dark),
    0 12px 24px #0008;
  transform-origin: 50% 80%;
}

.sub {
  margin: 14px 0 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  color: var(--cream);
  -webkit-text-stroke: 4px var(--navy);
  paint-order: stroke fill;
  text-shadow: 0 2px 8px #000a;
}

/* Hidden until the first splat lands (JS only). */
.js .headline, .js .sub { opacity: 0; }
.js .message.show .headline { animation: pop 700ms cubic-bezier(.2, 1.6, .4, 1) both; }
.js .message.show .sub { animation: rise 500ms 250ms ease-out both; }

@keyframes pop {
  0%   { opacity: 0; transform: scale(.3) rotate(-8deg); }
  60%  { opacity: 1; transform: scale(1.12) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.thrower {
  position: relative;
  z-index: 15;
  align-self: end;
  display: flex;
  justify-content: center;
  min-height: 0;
}

.mascot {
  display: block;
  height: clamp(200px, 40dvh, 420px);
  width: auto;
  filter: drop-shadow(0 18px 22px #0009);
  transform-origin: 50% 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.mascot.throwing { animation: toss 620ms cubic-bezier(.3, .1, .3, 1); }

@keyframes toss {
  0%   { transform: none; }
  35%  { transform: rotate(9deg) translateY(10px) scale(1.03, .93); }
  60%  { transform: rotate(-11deg) translateY(-22px) scale(.97, 1.06); }
  80%  { transform: rotate(3deg) translateY(-4px); }
  100% { transform: none; }
}

.controls {
  position: relative;
  z-index: 30;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 0 4px;
}

.throw {
  min-height: 56px;
  min-width: 220px;
  padding: 14px 30px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 0 var(--red-dark), 0 14px 24px #0007;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.throw:hover { background: #f0343b; }
.throw:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--red-dark), 0 8px 16px #0007; }

.hint {
  margin: 0;
  font-size: 0.85rem;
  color: #f6ebc8bb;
}
kbd {
  padding: 1px 6px;
  border: 1px solid #f6ebc866;
  border-radius: 5px;
  font: inherit;
  font-weight: 700;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

/* ---------- splats ---------- */
.splats {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50% 50% 46% 54% / 56% 50% 50% 44%;
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, var(--lotion) 40%, #e9dcc0 100%);
  box-shadow: 0 4px 10px #0005;
  will-change: transform;
}

.splat {
  position: absolute;
  width: var(--size, 160px);
  height: var(--size, 160px);
  margin: calc(var(--size, 160px) / -2) 0 0 calc(var(--size, 160px) / -2);
  filter: drop-shadow(0 6px 10px #0006);
}
.splat svg { display: block; width: 100%; height: 100%; overflow: visible; }

.splat.landed svg { animation: splat-in 420ms cubic-bezier(.2, 1.5, .4, 1) both; }
.splat.fading { animation: splat-out 1400ms ease-in forwards; }

.drip {
  transform-origin: 50% 0;
  animation: drip 5s 400ms cubic-bezier(.4, 0, .2, 1) both;
}

@keyframes splat-in {
  0%   { transform: scale(.2, .1); opacity: .6; }
  55%  { transform: scale(1.15, .9); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes splat-out {
  to { opacity: 0; transform: translateY(40px); }
}
@keyframes drip {
  from { transform: scaleY(0); }
  to   { transform: scaleY(1); }
}

.splat-static {
  position: absolute;
  width: 160px;
  height: 160px;
}

/* ---------- footer ---------- */
.foot {
  position: relative;
  z-index: 30;
  padding: 6px 16px max(12px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 0.85rem;
}
.foot a {
  color: var(--cream);
  text-underline-offset: 3px;
}

/* ---------- short / wide screens ---------- */
@media (max-height: 560px) {
  .mascot { height: clamp(150px, 34dvh, 260px); }
  .sub { display: none; }
  .hint { display: none; }
}

/* ---------- reduced motion: static splats + message, no flying ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .headline, .js .sub { opacity: 1; }
  .js .message.show .headline, .js .message.show .sub { animation: none; }
  .mascot.throwing { animation: none; }
  .splat.landed svg, .splat.fading, .drip { animation: none; }
  .throw { transition: none; }
}
