:root {
  --cream: #f5edda;
  --cream-deep: #ecdfc2;
  --ink: #2a1608;
  --salmon: #ff6b4a;
  --salmon-deep: #e8502f;
  --wasabi: #a8b545;
  --soy: #3b2010;
  --shadow: 6px 6px 0 var(--ink);
  --font-display: "Fraunces", serif;
  --font-mono: "Azeret Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 30 30"><circle cx="15" cy="15" r="10" fill="none" stroke="%232a1608" stroke-width="2.5"/><ellipse cx="15" cy="15" rx="3.4" ry="4.6" fill="%23ff6b4a" stroke="%232a1608" stroke-width="1.4"/></svg>') 15 15, crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.bg-vignette {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(255, 226, 178, 0.55), transparent 60%),
    radial-gradient(140% 120% at 50% 110%, rgba(214, 178, 122, 0.4), transparent 55%);
  pointer-events: none;
}

.grain {
  position: fixed; inset: -50%; z-index: 40;
  pointer-events: none;
  opacity: 0.5;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/><feComponentTransfer><feFuncA type="table" tableValues="0 0.06"/></feComponentTransfer></filter><rect width="100%25" height="100%25" filter="url(%23n)"/></svg>');
  animation: grain-shift 0.9s steps(3) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

canvas#scene {
  position: fixed; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
}

/* ---- giant wordmark ---- */
.word {
  position: fixed;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: -0.015em;
  pointer-events: none;
}
.word .reveal {
  display: block;
  overflow: hidden;
  padding: 0.06em 0.1em;
}
.word .reveal > span {
  display: inline-block;
  transform: translateY(115%) rotate(3deg);
  animation: word-up 0.9s cubic-bezier(0.16, 1.1, 0.3, 1) forwards;
}
@keyframes word-up {
  to { transform: translateY(0) rotate(0deg); }
}
.word-nigiri {
  top: 4vh;
  z-index: 1;
  font-size: clamp(4.5rem, 19vw, 19rem);
  color: var(--ink);
}
.word-nigiri .reveal > span { animation-delay: 0.15s; }
.word-slut {
  bottom: 7vh;
  z-index: 3;
  font-size: clamp(5rem, 23vw, 23rem);
  color: var(--salmon);
  text-shadow: 0.02em 0.025em 0 var(--ink);
}
.word-slut .reveal > span { animation-delay: 0.3s; }

/* ---- HUD stickers ---- */
.hud { position: fixed; z-index: 10; }

.hud-brand {
  top: 20px; left: 20px;
  font-size: 11px;
  letter-spacing: 0.08em;
  animation: hud-in 0.7s 0.8s cubic-bezier(0.16, 1.1, 0.3, 1) backwards;
}
.brand-line { font-weight: 800; font-size: 13px; }
.brand-sub { margin-top: 3px; opacity: 0.65; }
.mute {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 5px 9px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.mute:hover { background: var(--ink); color: var(--cream); }

.hud-counter {
  top: 20px; right: 20px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  text-align: right;
  min-width: 230px;
  transform: rotate(1.2deg);
  animation: hud-in 0.7s 0.9s cubic-bezier(0.16, 1.1, 0.3, 1) backwards;
}
.counter-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  opacity: 0.7;
}
.counter-num {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.counter-num.bump { animation: num-bump 0.18s ease-out; }
@keyframes num-bump {
  40% { transform: scale(1.12) rotate(-1.5deg); color: var(--salmon-deep); }
}
.counter-rank {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--salmon-deep);
  margin-top: 2px;
}
.counter-soy {
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1.5px dashed rgba(42, 22, 8, 0.35);
  color: var(--soy);
  font-weight: 600;
}
.counter-twerk {
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-top: 4px;
  color: #6e7a2b;
  font-weight: 600;
}
.counter-twerk.soon {
  color: var(--salmon-deep);
  animation: twerk-pulse 0.5s steps(2) infinite;
}
@keyframes twerk-pulse {
  50% { opacity: 0.25; }
}

@keyframes hud-in {
  from { opacity: 0; transform: translateY(-14px); }
}

.hint {
  white-space: nowrap;
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24vh;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  background: var(--wasabi);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 7px 14px;
  box-shadow: 4px 4px 0 var(--ink);
  animation: hint-bob 1.6s ease-in-out infinite, hud-in 0.7s 1.4s backwards;
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
}
.hint.gone { opacity: 0; transform: translateX(-50%) translateY(12px); }
@keyframes hint-bob {
  50% { margin-bottom: 8px; }
}

/* ---- rain button ---- */
.hud-actions {
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  z-index: 11;
  animation: hud-in 0.7s 1.1s cubic-bezier(0.16, 1.1, 0.3, 1) backwards;
}
.rain-btn {
  position: relative;
  font-family: var(--font-mono);
  background: var(--salmon);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 15px 30px 13px;
  cursor: pointer;
  text-align: center;
  transform: rotate(-1.4deg);
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}
.rain-btn:hover {
  transform: rotate(-1.4deg) translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}
.rain-btn:active,
.rain-btn.raining {
  transform: rotate(-1.4deg) translate(4px, 4px);
  box-shadow: 2px 2px 0 var(--ink);
}
.rain-btn.raining { background: var(--soy); color: var(--cream); }
.rain-label {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.rain-sub {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  margin-top: 2px;
  opacity: 0.75;
}
.rain-btn::after {
  content: "";
  position: absolute;
  left: 10%; right: 10%; top: 100%;
  height: 26px;
  background:
    radial-gradient(6px 14px at 18% 0px, var(--soy) 60%, transparent 61%),
    radial-gradient(5px 20px at 46% 0px, var(--soy) 60%, transparent 61%),
    radial-gradient(7px 11px at 74% 0px, var(--soy) 60%, transparent 61%),
    radial-gradient(4px 17px at 92% 0px, var(--soy) 60%, transparent 61%);
  background-repeat: no-repeat;
  opacity: 0;
  transform: scaleY(0.2);
  transform-origin: top;
  transition: opacity 0.2s, transform 0.35s cubic-bezier(0.6, 0, 0.7, 1.4);
  pointer-events: none;
}
.rain-btn:hover::after,
.rain-btn.raining::after { opacity: 1; transform: scaleY(1); }

/* ---- toast ---- */
.toast {
  position: fixed;
  z-index: 20;
  top: 15vh;
  left: 50%;
  transform: translateX(-50%) translateY(-16px) rotate(-2deg);
  background: var(--ink);
  color: var(--cream);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 12px 22px;
  border: 3px solid var(--salmon);
  box-shadow: 6px 6px 0 rgba(42, 22, 8, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s cubic-bezier(0.16, 1.3, 0.4, 1);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) rotate(-2deg);
}

/* ---- ticker ---- */
.ticker {
  position: fixed;
  z-index: 12;
  left: 0; right: 0; bottom: 0;
  background: var(--ink);
  color: var(--cream);
  border-top: 3px solid var(--ink);
  overflow: hidden;
  padding: 9px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  white-space: nowrap;
}
.ticker-track {
  display: inline-block;
  animation: ticker-roll 28s linear infinite;
}
.ticker-track .sep { color: var(--salmon); margin: 0 1.2em; }
@keyframes ticker-roll {
  to { transform: translateX(-50%); }
}

/* ---- floating +N ---- */
.floater {
  position: fixed;
  z-index: 15;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: 26px;
  color: var(--salmon-deep);
  text-shadow: 1.5px 1.5px 0 var(--ink);
  pointer-events: none;
  animation: float-up 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.6) rotate(-6deg); }
  15% { opacity: 1; transform: translate(-50%, -14px) scale(1.15) rotate(2deg); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(0.95) rotate(-3deg); }
}

@media (max-width: 720px) {
  .hud-brand { top: 12px; left: 12px; }
  .brand-line { font-size: 11px; }
  .brand-sub { display: none; }
  .mute { margin-top: 6px; font-size: 9px; padding: 4px 7px; }
  .hud-counter {
    top: 12px; right: 12px;
    min-width: 0;
    padding: 8px 12px;
    border-width: 2px;
    box-shadow: 4px 4px 0 var(--ink);
  }
  .counter-label { font-size: 8px; }
  .counter-num { font-size: 25px; }
  .counter-rank { font-size: 9px; }
  .counter-soy { font-size: 8px; margin-top: 4px; padding-top: 4px; }
  .counter-twerk { font-size: 8px; }
  .word-nigiri { top: 13vh; font-size: clamp(3.4rem, 21vw, 19rem); }
  .word-slut { bottom: 14vh; font-size: clamp(4rem, 26vw, 23rem); }
  .hud-actions { bottom: 60px; }
  .rain-btn { padding: 12px 22px 10px; border-width: 2.5px; }
  .rain-label { font-size: 15px; }
  .rain-sub { font-size: 9px; }
  .hint { bottom: 31vh; font-size: 10px; padding: 6px 10px; letter-spacing: 0.1em; }
  .toast { top: 11vh; font-size: 11px; padding: 10px 14px; max-width: 86vw; text-align: center; }
  .ticker { font-size: 10px; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
  .floater { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track, .grain, .hint { animation: none; }
}
