/* ==========================================================================
   ¡PA' MIAMI, ACERE! — Pixar / Cartoon Comic UI Stylesheet
   Mobile-first, responsive portrait & landscape
   ========================================================================== */

:root {
  --ink: #16263b;
  --sun: #ffd038;
  --sun-dark: #e69d00;
  --coral: #ff5454;
  --coral-dark: #c92626;
  --aqua: #15c6d8;
  --aqua-dark: #0b8ea1;
  --mint: #2ee59d;
  --cream: #fffaf0;
  --font-display: 'Fredoka', 'Trebuchet MS', 'Arial Rounded MT Bold', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #1ba9d6;
  font-family: var(--font-body);
  color: var(--ink);
  touch-action: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   TOP HUD
   ========================================================================== */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  z-index: 20;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.hud-center {
  flex: 1;
  max-width: 420px;
  min-width: 130px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 250, 240, 0.94);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.hud-back {
  background: var(--sun);
  transition: transform 0.1s;
}
.hud-back:active {
  transform: translateY(2px);
}

.hud-health {
  gap: 2px;
  padding: 4px 9px;
}
.tube-icon {
  font-size: 17px;
  transition: transform 0.25s, opacity 0.25s;
}
.tube-icon.lost {
  opacity: 0.22;
  filter: grayscale(1);
  transform: scale(0.75);
}

.hud-score .label {
  font-size: 10px;
  color: #e66b00;
  letter-spacing: 0.5px;
}

.hud-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 0 3px 0 var(--ink);
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}
.hud-icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

/* Act 1 Town Mission Checklist Bar */
.mission-wrap {
  background: rgba(255, 250, 240, 0.95);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 5px 10px 6px;
  box-shadow: 0 3px 0 var(--ink);
}
.mission-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.mission-count {
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
}
.mission-parts-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.part-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 2px solid rgba(22, 38, 59, 0.35);
  background: rgba(22, 38, 59, 0.08);
  color: #4b5e73;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 900;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, color 0.2s;
}
.part-chip.done {
  background: linear-gradient(180deg, #9cf6d0 0%, #2ee59d 100%);
  border-color: var(--ink);
  color: var(--ink);
  transform: scale(1.06);
  box-shadow: 0 2px 0 var(--ink);
}
.part-chip.done::after {
  content: ' ✓';
  font-weight: 900;
}
.mission-beach-cta {
  margin-top: 2px;
  padding: 4px 10px;
  border-radius: 10px;
  background: linear-gradient(90deg, #2ee59d, #ffd038);
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
  animation: popBounce 0.35s ease;
}

/* Progress Bar (Cuba -> Frontera -> Miami) */
.progress-wrap {
  background: rgba(255, 250, 240, 0.92);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 5px 10px 7px;
  box-shadow: 0 3px 0 var(--ink);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}

#distance-label {
  color: #0b6e99;
}

.progress-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #c8f1ff;
  overflow: visible;
}

.progress-zone-cuba {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 46%;
  background: rgba(255, 190, 60, 0.35);
  border-right: 2px dashed #ff3b3b;
  border-radius: 999px 0 0 999px;
}

.progress-zone-usa {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 54%;
  background: rgba(35, 155, 255, 0.22);
  border-radius: 0 999px 999px 0;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #ff9f1c, #2ee59d);
  border-radius: 999px;
  transition: width 0.12s linear;
}

.progress-marker {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -56%);
  font-size: 17px;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.35));
  transition: left 0.12s linear;
}

/* Compass Pill */
.compass-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1b365d;
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: 11px;
  box-shadow: 0 3px 0 var(--ink);
}
.compass-arrow {
  display: inline-block;
  color: var(--sun);
  font-size: 16px;
  line-height: 1;
  transition: transform 0.08s linear;
}

/* ==========================================================================
   COMIC RADIO TICKER & 3D SPEECH BUBBLES
   ========================================================================== */
.radio-ticker {
  margin: 8px auto 0;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 252, 242, 0.96);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 7px 14px;
  box-shadow: 0 4px 0 var(--ink);
  animation: popBounce 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radio-ticker.theme-balsero { border-color: #16263b; background: #fff9dc; }
.radio-ticker.theme-cuba { border-color: #9e1b1b; background: #fff1f1; }
.radio-ticker.theme-usa { border-color: #133b8c; background: #eef6ff; }
.radio-ticker.theme-ghost { border-color: #0d9468; background: #e6fff5; box-shadow: 0 4px 0 #0a5c41, 0 0 18px rgba(46, 229, 157, 0.45); }

.radio-avatar {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.radio-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.radio-speaker {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #d9480f;
}
.radio-ticker.theme-cuba .radio-speaker { color: #b51717; }
.radio-ticker.theme-usa .radio-speaker { color: #1346a8; }
.radio-ticker.theme-ghost .radio-speaker { color: #0b7a55; }

.radio-line {
  font-weight: 900;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
}

#bubbles-layer, #popups-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 15;
}

.speech-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 230px;
  padding: 8px 12px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 13px;
  line-height: 1.22;
  text-align: center;
  box-shadow: 0 4px 0 rgba(22, 38, 59, 0.9);
  animation: bubblePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, left, top;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  border-width: 10px 8px 0 8px;
  border-style: solid;
  border-color: var(--ink) transparent transparent transparent;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-width: 8px 6px 0 6px;
  border-style: solid;
  border-color: #ffffff transparent transparent transparent;
  z-index: 1;
}

.speech-bubble .bubble-tag {
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.speech-bubble.speaker-balsero {
  background: #fff7cc;
}
.speech-bubble.speaker-balsero::before {
  border-top-color: #fff7cc;
}
.speech-bubble.speaker-balsero .bubble-tag {
  color: #c96a00;
}

.speech-bubble.speaker-cuba {
  background: #ffe8e5;
  border-color: #7d1515;
}
.speech-bubble.speaker-cuba::after {
  border-top-color: #7d1515;
}
.speech-bubble.speaker-cuba::before {
  border-top-color: #ffe8e5;
}
.speech-bubble.speaker-cuba .bubble-tag {
  color: #b01818;
}

.speech-bubble.speaker-usa {
  background: #e8f3ff;
  border-color: #103a8c;
}
.speech-bubble.speaker-usa::after {
  border-top-color: #103a8c;
}
.speech-bubble.speaker-usa::before {
  border-top-color: #e8f3ff;
}
.speech-bubble.speaker-usa .bubble-tag {
  color: #103a8c;
}

.speech-bubble.speaker-ghost {
  background: #e2fff3;
  border-color: #0b7a55;
  box-shadow: 0 4px 0 #074f37, 0 0 16px rgba(46, 229, 157, 0.55);
}
.speech-bubble.speaker-ghost::after {
  border-top-color: #0b7a55;
}
.speech-bubble.speaker-ghost::before {
  border-top-color: #e2fff3;
}
.speech-bubble.speaker-ghost .bubble-tag {
  color: #0b7a55;
}

/* Zone Banner */
.zone-banner {
  position: absolute;
  top: 23%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  text-align: center;
  background: linear-gradient(135deg, #ffd038, #ff9900);
  border: 4px solid var(--ink);
  border-radius: 24px;
  padding: 12px 26px;
  box-shadow: 0 7px 0 var(--ink), 0 14px 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: popBounce 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
}
.zone-banner.banner-usa {
  background: linear-gradient(135deg, #3b82f6, #ef4444);
  color: #fff;
}
.zone-banner.banner-miami {
  background: linear-gradient(135deg, #2ee59d, #15c6d8);
}

.zone-banner-title {
  font-family: var(--font-display);
  font-size: clamp(19px, 4vw, 28px);
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.zone-banner-sub {
  font-weight: 800;
  font-size: clamp(12px, 2.5vw, 15px);
  margin-top: 2px;
}

/* Floating Score Popup */
.score-popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--sun);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 0 3px 0 var(--ink);
  animation: floatUpFade 1.15s ease-out forwards;
  white-space: nowrap;
}

/* ==========================================================================
   BOTTOM CONTROLS (DESKTOP + MOBILE)
   ========================================================================== */
#controls-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 18;
}

.desktop-hud-bottom {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.turbo-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 250, 240, 0.92);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: 0 3px 0 var(--ink);
}

.turbo-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #d9480f;
}

.turbo-track {
  width: 140px;
  height: 12px;
  background: #e5e7eb;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.turbo-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff6b00, #ffd038);
  transition: width 0.08s linear;
}

.controls-hint {
  display: flex;
  gap: 8px;
  background: rgba(22, 38, 59, 0.72);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* Virtual Joystick (Mobile / Touch) */
.joystick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48%;
  height: 55%;
  pointer-events: auto;
  touch-action: none;
  display: none;
}

.joystick-base {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.28);
  border: 3px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(2px);
}

.joystick-arrows span {
  position: absolute;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 900;
}
.ja-up { top: 8px; left: 50%; transform: translateX(-50%); }
.ja-down { bottom: 8px; left: 50%; transform: translateX(-50%); }
.ja-left { left: 10px; top: 50%; transform: translateY(-50%); }
.ja-right { right: 10px; top: 50%; transform: translateY(-50%); }

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe680, #ffaa00);
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
}

/* Touch Action Buttons */
.touch-actions {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.action-btn {
  position: relative;
  border-radius: 50%;
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transition: transform 0.08s;
}
.action-btn:active, .action-btn.active {
  transform: translateY(3px) scale(0.95);
  box-shadow: 0 2px 0 var(--ink);
}

.btn-turbo {
  width: 92px;
  height: 92px;
  background: radial-gradient(circle at 30% 25%, #ffe066, #ff6b00);
  color: #fff;
  text-shadow: 0 2px 0 var(--ink);
}

.turbo-ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  transform: rotate(-90deg);
  pointer-events: none;
}
.ring-bg {
  fill: none;
  stroke: rgba(22, 38, 59, 0.35);
  stroke-width: 7;
}
.ring-fg {
  fill: none;
  stroke: #2ee59d;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 276.46;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.08s linear;
}

.btn-taunt {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle at 30% 25%, #a8f5ff, #15c6d8);
}

.action-emoji {
  font-size: 26px;
  line-height: 1;
}
.btn-taunt .action-emoji {
  font-size: 20px;
}
.action-label {
  font-size: 11px;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

/* Show touch controls on touch devices or narrow screens */
body.is-touch .joystick-zone,
body.is-touch .touch-actions {
  display: flex;
}
body.is-touch .joystick-zone {
  display: block;
}
body.is-touch .desktop-hud-bottom {
  display: none;
}

/* ==========================================================================
   OVERLAY SCREENS (TITLE / PAUSE / GAME OVER / VICTORY)
   ========================================================================== */
.overlay-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at center, rgba(16, 48, 86, 0.32), rgba(10, 28, 52, 0.65));
  backdrop-filter: blur(3px);
}

.cartoon-card {
  width: 100%;
  max-width: 470px;
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #fffdf6 0%, #fff4d6 100%);
  border: 4px solid var(--ink);
  border-radius: 30px;
  padding: 22px 24px 20px;
  text-align: center;
  box-shadow: 0 10px 0 var(--ink), 0 22px 45px rgba(0, 0, 0, 0.38);
  animation: popBounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.small-card {
  max-width: 380px;
}

.badge-satire {
  display: inline-block;
  background: var(--aqua);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.8px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  margin-bottom: 10px;
}

.badge-danger { background: var(--coral); }
.badge-win { background: #10b981; }

.game-title {
  margin: 2px 0 8px;
  font-family: var(--font-display);
  line-height: 0.95;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-top {
  font-size: clamp(34px, 8vw, 48px);
  color: #ff6b1a;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 0 5px 0 var(--ink);
  transform: rotate(-2deg);
}

.title-bottom {
  font-size: clamp(42px, 10vw, 58px);
  color: var(--sun);
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 0 5px 0 var(--ink);
  transform: rotate(1.5deg);
}

.game-subtitle {
  margin: 6px 0 14px;
  font-size: 14px;
  line-height: 1.4;
  color: #2c415c;
  font-weight: 700;
}

.mini-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 7px 10px;
  text-align: left;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.15;
}
.legend-item span {
  font-size: 20px;
}

/* Difficulty Selector on Title Card */
.difficulty-picker {
  margin-bottom: 14px;
}
.diff-heading {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.9px;
  color: #4b6584;
  margin-bottom: 7px;
}
.diff-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 9px 6px;
  border-radius: 15px;
  border: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.1s, background 0.12s, box-shadow 0.1s;
}
.diff-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.diff-btn .diff-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}
.diff-btn small {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 800;
  color: #4b6584;
  line-height: 1.15;
}
.diff-btn.active[data-diff="easy"] {
  background: linear-gradient(180deg, #a7f3d0 0%, #34d399 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--ink);
}
.diff-btn.active[data-diff="medium"] {
  background: linear-gradient(180deg, #fde68a 0%, #fbbf24 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--ink);
}
.diff-btn.active[data-diff="hard"] {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--ink);
}
.diff-btn.active[data-diff="hard"] small {
  color: #fff3f3;
}

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  padding: 13px 20px;
  border-radius: 20px;
  border: 3.5px solid var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-primary {
  background: linear-gradient(180deg, #ffe066 0%, #ffb300 100%);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--ink);
}
.btn-primary:hover {
  filter: brightness(1.04);
}
.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--ink);
}

.btn-big {
  font-size: clamp(18px, 4.5vw, 22px);
  padding: 15px 22px;
}

.btn-secondary {
  background: linear-gradient(180deg, #6ee7ff 0%, #15c6d8 100%);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
}
.btn-secondary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #29527a;
  font-size: 15px;
  padding: 8px;
}
.btn-ghost:hover {
  text-decoration: underline;
}

.title-footer {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  color: #4b6584;
}

.control-tip-mobile { display: none; }
body.is-touch .control-tip-mobile { display: block; }
body.is-touch .control-tip-desktop { display: none; }

.link-blog {
  margin-top: 4px;
  color: #0b6e99;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
}

.result-card h2 {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(24px, 6vw, 32px);
}

.stars-row {
  font-size: 36px;
  margin: 2px 0 8px;
  letter-spacing: 4px;
}

.comic-quote {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 10px 14px;
  margin: 8px 0 14px;
  font-weight: 900;
  font-size: 15px;
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(22, 38, 59, 0.2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.9);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
}
.stat-label {
  font-size: 11px;
  font-weight: 800;
  color: #5b708b;
  text-transform: uppercase;
}
.stat-val {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================================================
   ANIMATIONS & SMALL SCREEN TUNING
   ========================================================================== */
@keyframes popBounce {
  0% { transform: scale(0.78); opacity: 0; }
  70% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bubblePop {
  0% { transform: translate(-50%, -80%) scale(0.5); opacity: 0; }
  100% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
}

@keyframes floatUpFade {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 1; }
  100% { transform: translate(-50%, -140%) scale(1.15); opacity: 0; }
}

@media (max-width: 680px) {
  .hud-row {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .hud-center {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .hud-pill {
    padding: 4px 8px;
    font-size: 12px;
  }
  .compass-tag {
    display: none;
  }
  .hud-icon-btn {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  .radio-ticker {
    padding: 5px 10px;
    gap: 8px;
  }
  .radio-line {
    font-size: 12.5px;
  }
  .cartoon-card {
    padding: 18px 16px 16px;
    border-radius: 24px;
  }
  .speech-bubble {
    max-width: 175px;
    font-size: 11.5px;
    padding: 6px 9px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .cartoon-card {
    padding: 12px 18px;
  }
  .mini-legend {
    display: none;
  }
  .joystick-base {
    width: 104px;
    height: 104px;
    bottom: 14px;
  }
  .btn-turbo {
    width: 78px;
    height: 78px;
  }
  .btn-taunt {
    width: 54px;
    height: 54px;
  }
}
