/* ────────────────────────────────────────────
   squidsquirt.com — styles
   ──────────────────────────────────────────── */

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

body {
  background: linear-gradient(180deg, #7dd3fc 0%, #0ea5e9 35%, #0369a1 70%, #0c4a6e 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 22px;
  padding-bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  font-family: 'Boogaloo', cursive;
}

/* Underwater light rays / caustics hint */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 30% 20%, rgba(255, 255, 255, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 70% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Ink canvas (full-screen overlay) ── */
#ink-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

/* ── Squid confetti (milestone bursts) ── */
.squid-confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 25;
  will-change: transform, opacity;
}

.squid-confetti-piece svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

/* ── Main layout (counter only; squid is in #squid-wrap) ── */
#app {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Squid + hint: fixed layer, random position after each squirt */
#squid-wrap {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

/* Dive: squid shrinks into the background */
#squid-wrap.squid-dive {
  animation: squid-dive 0.28s ease-in forwards;
}

/* Surface: squid emerges at the new position */
#squid-wrap.squid-surface {
  animation: squid-surface 0.38s ease-out forwards;
}

@keyframes squid-dive {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.08); }
}

@keyframes squid-surface {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.08); }
  50%  { opacity: 0.6; }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#squid-wrap #squid-btn {
  pointer-events: auto;
}

/* ── Counter ── */
#counter-section {
  text-align: center;
  margin-bottom: 18px;
}

#counter-label {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-bottom: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

#counter {
  font-family: 'VT323', monospace;
  font-size: clamp(3rem, 10vw, 6rem);
  line-height: 1;
  color: #fff;
  min-width: 6ch;
  text-align: center;
  display: inline-block;
  text-shadow: 0 0 25px rgba(255, 255, 255, 0.5), 0 2px 8px rgba(0, 60, 120, 0.3);
}

#counter.pop {
  animation: counter-pop 0.25s cubic-bezier(0.34, 1.8, 0.64, 1) forwards;
}

/* ── Global squirts (shared backend; em dash when offline) ── */
#global-bar {
  position: fixed;
  z-index: 4;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.5rem 0.75rem;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

#global-counter {
  font-family: 'VT323', monospace;
  font-size: 2.5rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 6px rgba(0, 60, 120, 0.25);
}

@keyframes counter-pop {
  50% {
    transform: scale(1.35);
    color: #fef08a;
  }
}

/* ── Squid button ── */
#squid-btn {
  --squid-idle-scale: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  outline: none;
  border: none;
  background: none;
  padding: 0;
  display: block;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.25));
  border-radius: 50%;
  transform-origin: center center;
  transition:
    filter 0.3s,
    transform 0.38s cubic-bezier(0.34, 1.15, 0.52, 1);
}

#squid-btn:hover {
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 30px rgba(200, 120, 255, 0.4));
}

#squid-btn:focus-visible {
  outline: 3px solid #a855f7;
  outline-offset: 4px;
}

#squid-svg {
  width: clamp(140px, 38vw, 260px);
  display: block;
  transform-origin: 50% 42%;
  transform: scale(var(--squid-idle-scale, 1));
}

/* Idle: gentle float + tentacle wave (honors prefers-reduced-motion below) */
#squid-drift-layer {
  transform-origin: 200px 125px;
  transform-box: fill-box;
  animation: squid-drift 10s ease-in-out infinite;
}

#squid-arms {
  transform-origin: 200px 198px;
  transform-box: fill-box;
  animation: tentacle-arms 2.85s ease-in-out infinite;
}

#squid-feeders {
  transform-origin: 200px 198px;
  transform-box: fill-box;
  animation: tentacle-feeders 2.85s ease-in-out -0.42s infinite;
}

@keyframes squid-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%       { transform: translate(2px, -5px) rotate(-1.1deg); }
  66%       { transform: translate(-3px, 3px) rotate(0.9deg); }
}

@keyframes tentacle-arms {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(2.8deg); }
}

@keyframes tentacle-feeders {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-2.2deg); }
}

/* Immediate compress while pointer is down — axis matches random squish (set in JS) */
#squid-btn:active.squid-press-v #squid-svg {
  transform: scale(var(--squid-idle-scale, 1)) scaleX(1.06) scaleY(0.88);
  transition: transform 0.05s ease-out;
}

#squid-btn:active.squid-press-h #squid-svg {
  transform: scale(var(--squid-idle-scale, 1)) scaleX(0.88) scaleY(1.06);
  transition: transform 0.05s ease-out;
}

/* Squish + spring: mantle-led; axis chosen at random per click */
#squid-body {
  transform-box: fill-box;
  transform-origin: 50% 28%;
}

#squid-body.squish-v {
  animation: squish-v 0.44s cubic-bezier(0.34, 1.15, 0.52, 1) forwards;
}

#squid-body.squish-h {
  animation: squish-h 0.44s cubic-bezier(0.34, 1.15, 0.52, 1) forwards;
}

/* Vertical compression: shorter & wider, then rebound */
@keyframes squish-v {
  0%   { transform: scaleX(1)    scaleY(1);    }
  14%  { transform: scaleX(1.28) scaleY(0.48); }
  26%  { transform: scaleX(1.2)  scaleY(0.52); }
  48%  { transform: scaleX(0.88) scaleY(1.12); }
  68%  { transform: scaleX(1.06) scaleY(0.94); }
  86%  { transform: scaleX(0.98) scaleY(1.02); }
  100% { transform: scaleX(1)    scaleY(1);    }
}

/* Horizontal compression: narrower & taller, then rebound */
@keyframes squish-h {
  0%   { transform: scaleX(1)    scaleY(1);    }
  14%  { transform: scaleX(0.48) scaleY(1.28); }
  26%  { transform: scaleX(0.52) scaleY(1.2);  }
  48%  { transform: scaleX(1.12) scaleY(0.88); }
  68%  { transform: scaleX(0.94) scaleY(1.06); }
  86%  { transform: scaleX(1.02) scaleY(0.98); }
  100% { transform: scaleX(1)    scaleY(1);    }
}

/* Blush cheeks */
#blush-left,
#blush-right {
  transition: opacity 0.4s;
}

/* ── Static hint (initial prompt only) ── */
#hint {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.15em;
  margin-top: 14px;
  max-width: min(92vw, 440px);
  text-align: center;
  line-height: 1.35;
  opacity: 0.4;
  animation: hint-pulse 2.5s ease-in-out infinite;
  transition: opacity 0.6s;
  text-shadow: 0 1px 4px rgba(0, 40, 80, 0.3);
}

@keyframes hint-pulse {
  50% {
    opacity: 1;
    color: rgba(255, 255, 255, 0.75);
  }
}

/* ── Floating speech bubbles ── */
.speech-bubble {
  position: fixed;
  z-index: 28;
  transform: translate(-50%, 0);
  pointer-events: none;
  font-family: 'Boogaloo', cursive;
  font-size: 1.15rem;
  line-height: 1.3;
  text-align: center;
  max-width: min(88vw, 380px);
  padding: 10px 18px;
  border-radius: 20px;
  white-space: nowrap;
  animation: bubble-float 4s ease-in forwards;
}

.bubble--taunt {
  background: rgba(255, 255, 255, 0.75);
  color: #1e3a5f;
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.bubble--thanks {
  background: rgba(255, 255, 255, 0.85);
  color: #581c87;
  border: 1px solid rgba(168, 85, 247, 0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.bubble--milestone {
  background: rgba(251, 191, 36, 0.9);
  color: #78350f;
  border: 1px solid rgba(251, 191, 36, 0.6);
  font-size: 1.35rem;
  text-shadow: 0 1px 2px rgba(120, 53, 15, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Tail pointer */
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
}

.bubble--taunt::after  { border-top: 8px solid rgba(255, 255, 255, 0.75); }
.bubble--thanks::after { border-top: 8px solid rgba(255, 255, 255, 0.85); }
.bubble--milestone::after { border-top: 8px solid rgba(251, 191, 36, 0.9); }

@keyframes bubble-float {
  0%   { opacity: 1;   transform: translate(-50%, 0) translateY(0); }
  15%  { opacity: 1; }
  70%  { opacity: 0.7; }
  100% { opacity: 0;   transform: translate(-50%, 0) translateY(-220px); }
}

/* ── Ambient bubbles ── */
.bubble {
  position: fixed;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  animation: bubble-rise linear infinite;
}

@keyframes bubble-rise {
  0%   { transform: translateY(0);      opacity: 0;   }
  10%  {                                opacity: 0.7; }
  90%  {                                opacity: 0.3; }
  100% { transform: translateY(-110vh); opacity: 0;   }
}

/* ── Control buttons (bottom-right) ── */
#controls {
  position: fixed;
  z-index: 30;
  right: 12px;
  bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#controls button {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#controls button:hover {
  background: rgba(255, 255, 255, 0.35);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

#controls button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

#controls button.active {
  background: rgba(255, 255, 255, 0.45);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.ctrl-icon { width: 18px; height: 18px; }

/* Sound muted state */
#mute-btn.muted .sound-wave { display: none; }
#mute-btn.muted::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 20px;
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 1px;
}

/* Share copied flash */
#share-btn.share-copied {
  background: rgba(16, 163, 74, 0.55);
  color: #fff;
  border-color: #22c55e;
}

/* ── Side panels (accessories) ── */
.side-panel {
  position: fixed;
  z-index: 31;
  right: -280px;
  bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  width: 240px;
  max-height: 420px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  padding: 14px;
  font-family: 'Boogaloo', cursive;
  color: #1e3a5f;
  transition: right 0.3s cubic-bezier(0.34, 1.15, 0.52, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.side-panel.open {
  right: 56px;
}

.panel-title {
  font-size: 0.9rem;
  color: #581c87;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.accessory-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 4px;
  border: 1px solid rgba(0, 80, 160, 0.12);
  border-radius: 8px;
  background: rgba(0, 80, 160, 0.06);
  color: #1e3a5f;
  font-family: 'Boogaloo', cursive;
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.accessory-option:hover:not(:disabled) {
  background: rgba(0, 80, 160, 0.14);
  border-color: rgba(0, 80, 160, 0.25);
}

.accessory-option:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.accessory-option.selected {
  background: rgba(88, 28, 135, 0.15);
  border-color: #7c3aed;
  color: #581c87;
}

.accessory-option.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Unlock picker tabs ── */
#unlock-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.unlock-tab {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid rgba(0, 80, 160, 0.15);
  border-radius: 6px;
  background: rgba(0, 80, 160, 0.06);
  color: #1e3a5f;
  font-family: 'Boogaloo', cursive;
  font-size: 0.78rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.unlock-tab:hover {
  background: rgba(0, 80, 160, 0.14);
}

.unlock-tab:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.unlock-tab.active {
  background: rgba(88, 28, 135, 0.18);
  border-color: #7c3aed;
  color: #581c87;
}

/* Section headers inside tabs */
.unlock-section-title {
  font-size: 0.72rem;
  color: #581c87;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 10px 0 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(88, 28, 135, 0.15);
}

.unlock-section-title:first-child {
  margin-top: 0;
}

/* Buy button on locked items */
.unlock-buy-btn {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border: 1px solid rgba(88, 28, 135, 0.3);
  border-radius: 4px;
  background: rgba(88, 28, 135, 0.1);
  color: #7c3aed;
  font-family: 'Boogaloo', cursive;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
}

.unlock-buy-btn:hover {
  background: rgba(88, 28, 135, 0.22);
}

/* ── Emoji particles (scattered by ink system) ── */
.emoji-particle {
  position: fixed;
  pointer-events: none;
  z-index: 21;
  will-change: transform, opacity;
  line-height: 1;
}

/* ── Payment modal ── */
.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.payment-modal[hidden] {
  display: none;
}

.payment-modal-inner {
  position: relative;
  width: min(90vw, 380px);
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 24px;
  font-family: 'Boogaloo', cursive;
  color: #1e3a5f;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.payment-close {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}

.payment-close:hover {
  color: #475569;
  background: rgba(0, 0, 0, 0.06);
}

.payment-close:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.payment-title {
  font-size: 1.2rem;
  color: #581c87;
  margin-bottom: 12px;
  text-align: center;
}

.payment-body {
  margin-bottom: 16px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
}

.payment-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.payment-actions input[type="text"],
.payment-actions textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(0, 80, 160, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  font-family: 'Boogaloo', cursive;
  font-size: 0.9rem;
  color: #1e3a5f;
  outline: none;
  transition: border-color 0.2s;
}

.payment-actions input[type="text"]:focus,
.payment-actions textarea:focus {
  border-color: #7c3aed;
}

.payment-actions input[type="text"]:focus-visible,
.payment-actions textarea:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.payment-actions textarea {
  min-height: 60px;
  resize: vertical;
}

.payment-submit-btn {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  background: #7c3aed;
  color: #fff;
  font-family: 'Boogaloo', cursive;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.payment-submit-btn:hover {
  background: #6d28d9;
}

.payment-submit-btn:active {
  transform: scale(0.96);
}

.payment-submit-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.payment-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress bar (patience payment) */
.payment-progress {
  width: 100%;
  height: 20px;
  background: rgba(0, 80, 160, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.payment-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  border-radius: 10px;
  transition: width 0.3s ease-out;
  width: 0%;
}

/* Queue display (wait in line payment) */
.payment-queue-number {
  font-size: 2.5rem;
  color: #7c3aed;
  font-family: 'VT323', monospace;
  margin: 8px 0;
}

/* Checkbox list (promise payment) */
.payment-promise-list {
  text-align: left;
  list-style: none;
  padding: 0;
}

.payment-promise-list li {
  padding: 6px 0;
}

.payment-promise-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}

.payment-promise-list input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #7c3aed;
}

/* Trivia choices */
.payment-trivia-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.payment-trivia-choice {
  padding: 10px 14px;
  border: 1px solid rgba(0, 80, 160, 0.2);
  border-radius: 8px;
  background: rgba(0, 80, 160, 0.06);
  color: #1e3a5f;
  font-family: 'Boogaloo', cursive;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.payment-trivia-choice:hover {
  background: rgba(0, 80, 160, 0.14);
  border-color: rgba(0, 80, 160, 0.3);
}

.payment-trivia-choice.correct {
  background: rgba(22, 163, 74, 0.2);
  border-color: #16a34a;
  color: #15803d;
}

.payment-trivia-choice.wrong {
  background: rgba(220, 38, 38, 0.15);
  border-color: #dc2626;
  color: #dc2626;
}

/* Easter egg reveal animation */
.easter-egg-reveal {
  position: fixed;
  z-index: 55;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  animation: easter-egg-pop 1.5s ease-out forwards;
  pointer-events: none;
}

@keyframes easter-egg-pop {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
  50%  { transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) translateY(-40px); opacity: 0; }
}

/* ── Milestone flash ── */
.milestone-flash {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.35) 0%, transparent 70%);
  pointer-events: none;
  animation: milestone-flash-anim 0.8s ease-out forwards;
}

@keyframes milestone-flash-anim {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #counter-label {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
  }

  #controls {
    right: 8px;
    gap: 6px;
    bottom: calc(42px + env(safe-area-inset-bottom, 0px));
  }

  #controls button {
    width: 40px;
    height: 40px;
  }

  .ctrl-icon { width: 20px; height: 20px; }

  .side-panel {
    width: calc(100vw - 70px);
    max-height: 50vh;
    right: -100vw;
  }

  .side-panel.open {
    right: 52px;
  }

  .speech-bubble {
    font-size: 1rem;
    padding: 8px 14px;
    max-width: min(80vw, 300px);
  }

  #global-bar {
    font-size: 0.65rem;
  }

  #global-counter {
    font-size: 2rem;
  }
}

/* ── Feedback form ── */
.feedback-label {
  display: block;
  font-size: 0.8rem;
  color: #94a3b8;
  margin: 10px 0 4px;
  text-align: left;
}
.feedback-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.9rem;
}
.feedback-textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.9rem;
  resize: vertical;
  font-family: inherit;
}
.feedback-textarea:focus,
.feedback-select:focus {
  outline: 2px solid #7c3aed;
  outline-offset: 1px;
}

/* ── Leaderboard ── */
.leaderboard-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
}
.leaderboard-panel.open {
  display: flex;
}
.leaderboard-inner {
  background: #1e1b4b;
  border: 1px solid #312e81;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  color: #e2e8f0;
}
.leaderboard-title {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  text-align: center;
  color: #c4b5fd;
  margin: 0 0 12px;
}
.leaderboard-name-row {
  margin-bottom: 16px;
}
.leaderboard-name-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.leaderboard-name-input-row input { flex: 1; }
.leaderboard-name-input-row .recovery-btn {
  flex-shrink: 0;
  padding: 6px 14px;
}
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}
.leaderboard-entry:nth-child(1) { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.leaderboard-entry:nth-child(2) { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; }
.leaderboard-entry:nth-child(3) { background: rgba(180, 83, 9, 0.12); color: #d97706; }
.leaderboard-entry-rank { font-weight: 700; min-width: 28px; }
.leaderboard-entry-name { flex: 1; margin: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-entry-count { font-family: 'VT323', monospace; font-size: 1.1rem; }
.leaderboard-rank {
  text-align: center;
  margin-top: 16px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  font-size: 0.95rem;
}

/* ── Recovery code ── */
.recovery-section {
  margin-top: 16px;
  border-top: 1px solid #312e81;
  padding-top: 12px;
}
.recovery-toggle {
  width: 100%;
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px;
}
.recovery-toggle:hover { color: #a78bfa; }
.recovery-content {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.recovery-code-display {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  text-align: center;
  color: #fbbf24;
  word-break: break-all;
  user-select: all;
  min-height: 0;
}
.recovery-code-display:empty { display: none; }
.recovery-btn {
  padding: 6px 12px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1e293b;
  color: #c4b5fd;
  font-size: 0.85rem;
  cursor: pointer;
}
.recovery-btn:hover { background: #312e81; }
.recovery-btn:disabled { opacity: 0.4; cursor: default; }
.recovery-divider {
  text-align: center;
  font-size: 0.75rem;
  color: #475569;
  margin: 4px 0;
}
.recovery-status {
  text-align: center;
  font-size: 0.8rem;
  min-height: 1.2em;
}
.recovery-status.success { color: #4ade80; }
.recovery-status.error { color: #f87171; }

/* ── Landscape immersive ── */
@media (orientation: landscape) and (max-height: 500px) {
  #counter-section {
    position: fixed;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(10, 10, 26, 0.6);
    backdrop-filter: blur(6px);
    padding: 4px 16px;
    border-radius: 12px;
  }
  #counter-label { font-size: 0.6rem; }
  #counter { font-size: 1.4rem; }

  #global-bar { display: none; }

  #controls {
    position: fixed;
    bottom: 8px;
    right: 8px;
    flex-direction: row;
    gap: 6px;
    z-index: 20;
  }
  #controls button {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }

  #squid-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #hint {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ── Visually hidden (screen-reader only) ── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* Wizard hat glow pulse */
.wizard-glow {
  animation: wizard-pulse 3s ease-in-out infinite;
}
@keyframes wizard-pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.35; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  #squid-drift-layer,
  #squid-arms,
  #squid-feeders {
    animation: none !important;
  }
  .milestone-flash { animation-duration: 0.01s; }
  .side-panel { transition-duration: 0.01s; }
  .easter-egg-reveal { animation-duration: 0.01s; }
  .payment-modal-inner { transition-duration: 0.01s; }
  .unlock-bubble { animation: none !important; transition: none !important; }
  .unlock-bubble.popping { animation: unlock-bubble-pop 0.01s forwards !important; }
  .unlock-pop-particle { animation-duration: 0.01s !important; }
  .unlock-bubble-name { animation-duration: 0.01s !important; }
  .wizard-glow { animation: none; opacity: 0.25; }
}

/* ── Unlock reveal bubble ── */
.unlock-bubble {
  position: fixed;
  z-index: 50;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.6), rgba(180,210,255,0.25) 50%, rgba(140,180,240,0.15) 80%, rgba(100,150,220,0.1));
  box-shadow:
    inset 0 -4px 8px rgba(100,150,220,0.15),
    inset 0 2px 6px rgba(255,255,255,0.5),
    0 2px 12px rgba(100,150,220,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
  pointer-events: auto;
  transition: box-shadow 0.15s;
}

.unlock-bubble::before {
  content: '';
  position: absolute;
  top: 12%;
  left: 22%;
  width: 30%;
  height: 20%;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  filter: blur(2px);
  pointer-events: none;
}

.unlock-bubble:hover {
  box-shadow:
    inset 0 -4px 8px rgba(100,150,220,0.2),
    inset 0 2px 6px rgba(255,255,255,0.6),
    0 4px 20px rgba(140,100,220,0.35);
}

.unlock-bubble:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 3px;
}

.unlock-bubble.settled {
  animation: unlock-bubble-bob 3s ease-in-out infinite;
}

.unlock-bubble.popping {
  animation: unlock-bubble-pop 0.35s ease-out forwards;
  pointer-events: none;
}

.unlock-bubble-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.unlock-bubble-preview {
  pointer-events: none;
}

/* Item name that appears after pop */
.unlock-bubble-name {
  position: fixed;
  z-index: 51;
  transform: translateX(-50%);
  font-family: 'Boogaloo', cursive;
  font-size: 1rem;
  color: #581c87;
  text-shadow: 0 1px 4px rgba(255,255,255,0.8);
  pointer-events: none;
  white-space: nowrap;
  animation: unlock-name-rise 1.8s ease-out forwards;
}

/* Pop burst particles */
.unlock-pop-particle {
  position: fixed;
  z-index: 50;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180,210,255,0.7), rgba(140,180,240,0.3));
  pointer-events: none;
  animation: unlock-pop-burst 0.45s ease-out forwards;
}

@keyframes unlock-bubble-bob {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.05); }
}

@keyframes unlock-bubble-pop {
  0%   { transform: scale(1); opacity: 1; }
  30%  { transform: scale(1.3); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes unlock-name-rise {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0); }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

@keyframes unlock-pop-burst {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; }
}
