/* Spelling Wasp — Styles */

:root {
  --bg: #000000;
  --surface: #1a1a1c;
  --border: #3a3a3c;
  --text: #d7dadc;
  --text-dim: #8a8a8a;
  --hex-outer: #2a2a2c;
  --hex-center: #f7da21;
  --hex-text: #ffffff;
  --correct: #538d4e;
  --score-fill: #f7da21;
  --ctrl-bg: #2a2a2c;
  --ctrl-border: #565758;
  --rank-labels: #565758;
  --yellow: #f6c945;
  --pill: #2a2a2a;
  --pill-hover: #333;
}

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

html {
  touch-action: manipulation;
  background: var(--bg);
  color: var(--text);
  /* Use iOS rounded font for a premium native app feel if available */
  font-family: 'Manrope', ui-rounded, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  min-height: 100dvh;
  min-height: 100svh; /* iOS Safari support */
  display: flex;
  justify-content: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.shell {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 0 32px;
}

/* Header — sw-header redesign */
.sw-header {
  width: 100%;
  background: var(--bg);
  padding: 22px 22px 0;
  box-sizing: border-box;
}

.sw-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sw-title {
  font: 800 30px/0.95 'Mona Sans', system-ui, sans-serif;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0;
}

.sw-title .accent { color: var(--yellow); }

.sw-new-btn {
  background: var(--pill);
  color: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: 600 14px/1 'Manrope', system-ui, sans-serif;
  letter-spacing: 0.01em;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, transform 0.08s;
}

.sw-new-btn:hover { background: var(--pill-hover); }
.sw-new-btn:active { transform: scale(0.92); }
.sw-new-btn svg { display: block; }

.sw-progress-wrap {
  position: relative;
  margin-top: 22px;
}

.sw-progress-rail {
  height: 30px;
  background: #1c1c1c;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.sw-progress-fill {
  --pct: 0%;
  position: absolute;
  inset: 0;
  background: var(--yellow);
  border-radius: 999px;
  clip-path: inset(0 calc(100% - var(--pct)) 0 0 round 999px);
  transition: clip-path 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.sw-high-score-marker {
  position: absolute;
  top: -16px;
  font-size: 13px;
  opacity: 0.45;
  pointer-events: none;
  z-index: 2;
  transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateX(-50%);
  line-height: 1;
}

/* Rank labels live inside the progress bar. Two identical layers:
   a dim one on the dark rail, and a dark one inside the clipped
   yellow fill — labels flip colour as the fill sweeps past them. */
.sw-ranks {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  font: 700 10px/1 'Manrope', system-ui, sans-serif;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.sw-ranks--base { color: #707072; }
.sw-ranks--base .sw-rank.is-active { color: var(--text); }

.sw-ranks--fill { color: rgba(18, 18, 19, 0.5); }
.sw-ranks--fill .sw-rank.is-active { color: #121213; }

.sw-score-line {
  text-align: center;
  margin-top: 12px;
  padding-bottom: 18px;
  font: 600 15px/1 'Manrope', system-ui, sans-serif;
  color: var(--text);
  letter-spacing: 0.01em;
}

.sw-score-line .sw-dim { color: var(--text-dim); font-weight: 500; }

/* Honeycomb — perfectly even mathematically scaled gaps */
/* Hex: 84w × 96h. */
/* Centers scaled by 1.096 to produce an exact uniform ~8px gap on all 6 sides. */
/* Container: 268px wide, 254px tall */

.honeycomb {
  position: relative;
  width: 268px;
  height: 254px;
  margin: 16px auto;
  user-select: none;
}

.hex {
  position: absolute;
  width: 84px;
  height: 96px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: transform 0.08s cubic-bezier(0.2, 0, 0, 1), opacity 0.1s;
}

/* iOS active touch state */
.hex:active { transform: scale(0.85); }

/* Center hex — at grid origin (92, 79) */
#h3 { top: 79px; left: 92px; background: var(--hex-center); color: #121213; }

/* Outer hexes */
#h0 { top: 0px;   left: 46px;  background: var(--hex-outer); color: var(--hex-text); }
#h1 { top: 0px;   left: 138px; background: var(--hex-outer); color: var(--hex-text); }
#h2 { top: 79px;  left: 0px;   background: var(--hex-outer); color: var(--hex-text); }
#h4 { top: 79px;  left: 184px; background: var(--hex-outer); color: var(--hex-text); }
#h5 { top: 158px; left: 46px;  background: var(--hex-outer); color: var(--hex-text); }
#h6 { top: 158px; left: 138px; background: var(--hex-outer); color: var(--hex-text); }

.hex.used { opacity: 0.3; pointer-events: none; }

/* Input area */
.input-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.current-word {
  min-height: 44px;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text);
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: center;
}

.current-word .center-highlight {
  color: var(--hex-center);
}

/* Adding a blinking cursor for native feel */
.current-word::after {
  content: '|';
  color: var(--hex-center);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  font-weight: 400;
  opacity: 0.5;
}
.current-word:empty::after {
  content: '|'; /* Ensure it shows even when empty */
}

@keyframes blink {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.7; }
}

.input-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  padding: 0 22px;
}

.ctrl-btn {
  width: 100%;
  height: 52px;
  padding: 0;
  border-radius: 26px;
  border: none;
  background: var(--ctrl-bg);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s, opacity 0.1s;
}

.ctrl-btn:active {
  transform: scale(0.94);
  opacity: 0.8;
}

.ctrl-btn.enter {
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
}

/* Message */
.message {
  min-height: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
}

.message.error { color: #e05b5b; }
.message.success { color: var(--correct); }

/* Word list */
.word-list {
  width: 100%;
  flex: 1;
  min-height: 120px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
}

.word-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  margin-bottom: 12px;
  padding-left: 22px;
}

.words {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 0 22px;
}

.word-item {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 16px; /* Pill shape */
  background: var(--surface);
  color: var(--text-dim);
  text-transform: capitalize;
  animation: wordPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.word-item.pangram {
  background: var(--hex-center);
  color: var(--bg);
}

.word-item.just-added {
  background: var(--correct);
  color: white;
}

/* ── Frozen (after Give Up) ────────────────────── */
.honeycomb.frozen { opacity: 0.3; pointer-events: none; }
.input-area.frozen { opacity: 0.3; pointer-events: none; }

/* ── Give Up ──────────────────────────────────── */
.give-up-section {
  width: 100%;
  text-align: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.pill-btn {
  background: var(--pill);
  color: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font: 600 14px/1 'Manrope', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
}
.pill-btn:hover { background: var(--pill-hover); }
.pill-btn:active { transform: scale(0.92); }

.pill-btn.give-up {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 18px;
  opacity: 0.6;
}
.pill-btn.give-up:hover { opacity: 1; color: #e05b5b; background: var(--pill-hover); }
.pill-btn.give-up.hidden { display: none; }

.remaining-wrap {
  margin-top: 14px;
}

.remaining-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}

.words.remaining .word-item {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  opacity: 0.55;
  text-transform: capitalize;
}
.words.remaining .word-item.pangram {
  border-color: var(--hex-center);
  color: var(--hex-center);
  opacity: 0.75;
}

@keyframes wordPop {
  0% { transform: scale(0.8) translateY(10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Pangram toast */
.pangram-toast {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translate(-50%, 0);
  background: var(--hex-center);
  color: #121213;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 12px 28px;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), toastOut 0.4s ease 2s forwards;
  pointer-events: none;
}

.pangram-toast.hidden { display: none; }

@keyframes toastIn {
  0% { transform: translate(-50%, -20px) scale(0.8); opacity: 0; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

@keyframes toastOut {
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
}

/* Shake animation for invalid words */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.current-word.shake { animation: shake 0.4s ease; }

/* ── High score celebration ────────────────────── */
.celebration-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  overflow: hidden;
}
.celebration-overlay.hidden { display: none; }

/* High-score bee bump */
@keyframes highScoreBeeBump {
  0%   { transform: translateX(-50%) scale(1); opacity: 0.45; }
  8%   { transform: translateX(-50%) scale(2.8); opacity: 1; filter: drop-shadow(0 0 12px #f7da21); }
  16%  { transform: translateX(-50%) scale(2.0) rotate(-12deg); opacity: 1; }
  24%  { transform: translateX(-50%) scale(2.4) rotate(10deg); opacity: 1; }
  32%  { transform: translateX(-50%) scale(2.1) rotate(-6deg); opacity: 1; }
  40%  { transform: translateX(-50%) scale(2.2) rotate(6deg); opacity: 1; }
  50%  { transform: translateX(-50%) scale(1.6); opacity: 1; filter: drop-shadow(0 0 6px #f7da21); }
  100% { transform: translateX(-50%) scale(1); opacity: 0.45; filter: none; }
}
.high-score-bump {
  animation: highScoreBeeBump 1.8s ease forwards;
  z-index: 210 !important;
}

/* Screen shake */
@keyframes screenBump {
  0%   { transform: translate(0, 0); }
  4%   { transform: translate(-5px, 2px); }
  8%   { transform: translate(5px, -3px); }
  12%  { transform: translate(-4px, 1px); }
  16%  { transform: translate(4px, -2px); }
  20%  { transform: translate(-3px, 2px); }
  24%  { transform: translate(3px, -1px); }
  28%  { transform: translate(-2px, 1px); }
  32%  { transform: translate(2px, -1px); }
  36%  { transform: translate(-1px, 0); }
  40%, 100% { transform: translate(0, 0); }
}
.screen-bump { animation: screenBump 0.7s ease; }

/* Rank-up shake — progressively stronger by rank */
@keyframes rankScreenShake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  5%   { transform: translate(var(--shake-neg), var(--shake-y-pos)) rotate(var(--twist-neg)); }
  10%  { transform: translate(var(--shake-pos), var(--shake-y-neg)) rotate(var(--twist-pos)); }
  16%  { transform: translate(var(--shake-neg-soft), var(--shake-y-soft-pos)) rotate(var(--twist-neg-soft)); }
  23%  { transform: translate(var(--shake-pos-soft), var(--shake-y-soft-neg)) rotate(var(--twist-pos-soft)); }
  31%  { transform: translate(var(--shake-neg-tiny), var(--shake-y-tiny-pos)) rotate(var(--twist-neg-tiny)); }
  40%  { transform: translate(var(--shake-pos-tiny), var(--shake-y-tiny-neg)) rotate(var(--twist-pos-tiny)); }
  52%  { transform: translate(var(--shake-settle), 0) rotate(0deg); }
  65%, 100% { transform: translate(0, 0) rotate(0deg); }
}
.rank-screen-shake {
  --shake-pos: 2px;
  --shake-neg: -2px;
  --shake-pos-soft: 1px;
  --shake-neg-soft: -1px;
  --shake-pos-tiny: 1px;
  --shake-neg-tiny: -1px;
  --shake-settle: -1px;
  --shake-y-pos: 1px;
  --shake-y-neg: -1px;
  --shake-y-soft-pos: 1px;
  --shake-y-soft-neg: -1px;
  --shake-y-tiny-pos: 0;
  --shake-y-tiny-neg: 0;
  --twist-pos: 0deg;
  --twist-neg: 0deg;
  --twist-pos-soft: 0deg;
  --twist-neg-soft: 0deg;
  --twist-pos-tiny: 0deg;
  --twist-neg-tiny: 0deg;
  animation: rankScreenShake var(--shake-duration, 0.55s) ease-out;
}
.rank-screen-shake.rank-shake-1 {
  --shake-pos: 2px; --shake-neg: -2px; --shake-pos-soft: 1px; --shake-neg-soft: -1px; --shake-pos-tiny: 1px; --shake-neg-tiny: -1px; --shake-settle: -1px;
  --shake-y-pos: 1px; --shake-y-neg: -1px; --shake-y-soft-pos: 1px; --shake-y-soft-neg: 0; --shake-y-tiny-pos: 0; --shake-y-tiny-neg: 0; --shake-duration: 0.42s;
}
.rank-screen-shake.rank-shake-2 {
  --shake-pos: 3px; --shake-neg: -3px; --shake-pos-soft: 2px; --shake-neg-soft: -2px; --shake-pos-tiny: 1px; --shake-neg-tiny: -1px; --shake-settle: -1px;
  --shake-y-pos: 1px; --shake-y-neg: -1px; --shake-y-soft-pos: 1px; --shake-y-soft-neg: -1px; --shake-y-tiny-pos: 1px; --shake-y-tiny-neg: 0;
  --twist-pos: 0.08deg; --twist-neg: -0.08deg; --twist-pos-soft: 0.04deg; --twist-neg-soft: -0.04deg; --twist-pos-tiny: 0.02deg; --twist-neg-tiny: -0.02deg; --shake-duration: 0.5s;
}
.rank-screen-shake.rank-shake-3 {
  --shake-pos: 5px; --shake-neg: -5px; --shake-pos-soft: 3px; --shake-neg-soft: -4px; --shake-pos-tiny: 2px; --shake-neg-tiny: -2px; --shake-settle: -1px;
  --shake-y-pos: 2px; --shake-y-neg: -2px; --shake-y-soft-pos: 1px; --shake-y-soft-neg: -1px; --shake-y-tiny-pos: 1px; --shake-y-tiny-neg: -1px;
  --twist-pos: 0.12deg; --twist-neg: -0.12deg; --twist-pos-soft: 0.07deg; --twist-neg-soft: -0.07deg; --twist-pos-tiny: 0.03deg; --twist-neg-tiny: -0.03deg; --shake-duration: 0.62s;
}
.rank-screen-shake.rank-shake-4 {
  --shake-pos: 7px; --shake-neg: -7px; --shake-pos-soft: 5px; --shake-neg-soft: -6px; --shake-pos-tiny: 3px; --shake-neg-tiny: -3px; --shake-settle: -1px;
  --shake-y-pos: 3px; --shake-y-neg: -3px; --shake-y-soft-pos: 2px; --shake-y-soft-neg: -2px; --shake-y-tiny-pos: 1px; --shake-y-tiny-neg: -1px;
  --twist-pos: 0.18deg; --twist-neg: -0.18deg; --twist-pos-soft: 0.1deg; --twist-neg-soft: -0.1deg; --twist-pos-tiny: 0.05deg; --twist-neg-tiny: -0.05deg; --shake-duration: 0.72s;
}
.rank-screen-shake.rank-shake-5 {
  --shake-pos: 10px; --shake-neg: -10px; --shake-pos-soft: 7px; --shake-neg-soft: -8px; --shake-pos-tiny: 4px; --shake-neg-tiny: -4px; --shake-settle: -2px;
  --shake-y-pos: 4px; --shake-y-neg: -5px; --shake-y-soft-pos: 3px; --shake-y-soft-neg: -3px; --shake-y-tiny-pos: 2px; --shake-y-tiny-neg: -1px;
  --twist-pos: 0.28deg; --twist-neg: -0.28deg; --twist-pos-soft: 0.16deg; --twist-neg-soft: -0.16deg; --twist-pos-tiny: 0.08deg; --twist-neg-tiny: -0.08deg; --shake-duration: 0.88s;
}

/* Firework particles */
@keyframes fireworkBurst {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  50%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
.firework-particle {
  position: fixed;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--color);
  animation: fireworkBurst 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  animation-delay: var(--delay);
  pointer-events: none;
  box-shadow: 0 0 3px var(--color);
}

/* Bee swarm */
@keyframes beeFlyRight {
  0%   { transform: translate(var(--sx), var(--sy)); opacity: 0; }
  5%   { opacity: 1; }
  20%  { transform: translate(30vw, calc(var(--sy) + var(--wa) * 0.25)); }
  40%  { transform: translate(50vw, calc(var(--sy) + var(--wa) * -0.25)); }
  60%  { transform: translate(70vw, calc(var(--sy) + var(--wa) * 0.25)); }
  80%  { transform: translate(90vw, calc(var(--sy) + var(--wa) * -0.15)); }
  95%  { opacity: 1; }
  100% { transform: translate(var(--ex), calc(var(--sy) + var(--wa) * 0.05)); opacity: 0; }
}
@keyframes beeFlyLeft {
  0%   { transform: translate(var(--sx), var(--sy)); opacity: 0; }
  5%   { opacity: 1; }
  20%  { transform: translate(70vw, calc(var(--sy) + var(--wa) * 0.25)); }
  40%  { transform: translate(50vw, calc(var(--sy) + var(--wa) * -0.25)); }
  60%  { transform: translate(30vw, calc(var(--sy) + var(--wa) * 0.25)); }
  80%  { transform: translate(10vw, calc(var(--sy) + var(--wa) * -0.15)); }
  95%  { opacity: 1; }
  100% { transform: translate(var(--ex), calc(var(--sy) + var(--wa) * 0.05)); opacity: 0; }
}
.swarm-bee {
  position: fixed;
  left: 0;
  top: 0;
  line-height: 1;
  pointer-events: none;
  animation: beeFlyRight var(--dur) ease-in-out forwards;
  animation-delay: var(--delay);
}
/* Alternate direction for bees starting from the right */
.swarm-bee:nth-child(2n) { animation-name: beeFlyLeft; }

/* ── Rank milestone celebrations ────────────────────── */
#rank-celebration-container {
  z-index: 250;
}

/* Good — angel rising */
@keyframes angelRise {
  0%   { transform: translateY(100vh) scale(0.6); opacity: 0; }
  10%  { opacity: 1; }
  30%  { transform: translateY(70vh) translateX(calc(var(--sway) * 0.5)) scale(1); }
  60%  { transform: translateY(35vh) translateX(calc(var(--sway) * -0.5)) scale(1); }
  85%  { transform: translateY(10vh) translateX(calc(var(--sway) * 0.3)) scale(1); opacity: 0.9; }
  100% { transform: translateY(-15vh) scale(0.8); opacity: 0; }
}
.rank-angel {
  position: fixed;
  left: var(--sx);
  top: 0;
  line-height: 1;
  pointer-events: none;
  animation: angelRise var(--dur) ease-out forwards;
  animation-delay: var(--delay);
}

/* Great — crowns flying up quickly */
@keyframes crownFly {
  0%   { transform: translateY(95vh) scale(0.4) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; transform: translateY(80vh) scale(1) rotate(0deg); }
  60%  { transform: translateY(30vh) translateX(var(--spread)) scale(1.1) rotate(calc(var(--spin) * 0.5)); opacity: 1; }
  100% { transform: translateY(-15vh) translateX(calc(var(--spread) * 1.4)) scale(0.9) rotate(var(--spin)); opacity: 0; }
}
.rank-crown {
  position: fixed;
  left: var(--sx);
  top: 0;
  line-height: 1;
  pointer-events: none;
  animation: crownFly var(--dur) cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
  animation-delay: var(--delay);
}

/* Amazing — firework emoji at burst center */
@keyframes fireworkEmoji {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20%  { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
  60%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
}
.rank-firework-emoji {
  position: fixed;
  left: var(--x);
  top: var(--y);
  font-size: 48px;
  line-height: 1;
  pointer-events: none;
  animation: fireworkEmoji 1.0s ease-out forwards;
  animation-delay: var(--delay);
}

/* Genius — nerd zooms to fill screen, then pops */
@keyframes nerdZoom {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  15%  { opacity: 1; }
  50%  { transform: translate(-50%, -50%) scale(8); opacity: 1; }
  68%  { transform: translate(-50%, -50%) scale(9); opacity: 1; filter: drop-shadow(0 0 30px #f7da21); }
  72%  { transform: translate(-50%, -50%) scale(10); opacity: 0.95; filter: drop-shadow(0 0 50px #fff); }
  78%  { transform: translate(-50%, -50%) scale(11); opacity: 0; filter: brightness(2); }
  100% { transform: translate(-50%, -50%) scale(12); opacity: 0; }
}
.rank-nerd {
  position: fixed;
  left: 50%;
  top: 50%;
  font-size: 36px;
  line-height: 1;
  pointer-events: none;
  animation: nerdZoom 1.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  z-index: 260;
}

/* Genius — brains fly outward in all directions */
@keyframes brainBurst {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  10%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.6); opacity: 0; }
}
.rank-brain {
  position: fixed;
  left: 50%;
  top: 50%;
  line-height: 1;
  pointer-events: none;
  animation: brainBurst var(--dur) cubic-bezier(0.15, 0.85, 0.3, 1) forwards;
  z-index: 261;
}

/* King Wasp — royal bee slam + gold chaos */
@keyframes kingWaspSlam {
  0%   { transform: translate(-50%, -50%) scale(0.15) rotate(-22deg); opacity: 0; filter: drop-shadow(0 0 0 #f7da21); }
  12%  { transform: translate(-50%, -50%) scale(4.2) rotate(10deg); opacity: 1; filter: drop-shadow(0 0 36px #f7da21); }
  22%  { transform: translate(-50%, -50%) scale(3.2) rotate(-8deg); opacity: 1; }
  34%  { transform: translate(-50%, -50%) scale(3.7) rotate(6deg); opacity: 1; filter: drop-shadow(0 0 48px #ffffff); }
  58%  { transform: translate(-50%, -50%) scale(2.8) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.15) rotate(0deg); opacity: 0; filter: drop-shadow(0 0 10px #f7da21); }
}
.rank-king-bee {
  position: fixed;
  left: 50%;
  top: 48%;
  font-size: 42px;
  line-height: 1;
  pointer-events: none;
  z-index: 270;
  animation: kingWaspSlam 2.2s cubic-bezier(0.18, 0.9, 0.25, 1) forwards;
}

@keyframes royalCrownRain {
  0%   { transform: translateY(-15vh) translateX(0) rotate(0deg) scale(0.7); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translateY(115vh) translateX(var(--drift)) rotate(var(--spin)) scale(1.2); opacity: 0; }
}
.rank-royal-crown {
  position: fixed;
  left: var(--sx);
  top: 0;
  line-height: 1;
  pointer-events: none;
  animation: royalCrownRain var(--dur) cubic-bezier(0.2, 0.75, 0.25, 1) forwards;
  animation-delay: var(--delay);
  z-index: 262;
}

@media (prefers-reduced-motion: reduce) {
  .screen-bump,
  .rank-screen-shake,
  .high-score-bump,
  .firework-particle,
  .swarm-bee,
  .rank-angel,
  .rank-crown,
  .rank-firework-emoji,
  .rank-nerd,
  .rank-brain,
  .rank-king-bee,
  .rank-royal-crown {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}


