/* ═══════════════════════════════════════════════════════
   🏰 PHONICS FORTRESS — ANGRY BIRDS EDITION CSS v6.3
   (Landscape-responsive, orientation-adaptive HUD)
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@600;700;800;900&display=swap');

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

:root {
  --bg-dark: #1A0050; --bg-mid: #4A20AA; --bg-light: #6030CC;
  --gold: #FFD700; --red: #FF4060; --green: #39FF14;
  --blue: #00BFFF; --purple: #CC44FF; --orange: #FF8C00;
  --wood: #FF8C00; --ice: #60F0FF; --stone: #B0C4DE;
  --lava: #FF4500; --crystal: #FF44FF;
}

body {
  font-family: 'Nunito', sans-serif; background: var(--bg-dark);
  overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  width: 100vw; height: 100vh;
}

/* ===================== SAGA MAP ===================== */
#sagaScreen {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(180deg, #2A0080 0%, #5520CC 40%, #20AA40 100%);
  display: flex; flex-direction: column; overflow: hidden;
}
#sagaScreen.saga-theme-wood   { background: linear-gradient(180deg, #00AAFF 0%, #20CC60 50%, #18AA40 100%); }
#sagaScreen.saga-theme-ice    { background: linear-gradient(180deg, #CC60FF 0%, #8040DD 40%, #40CCFF 100%); }
#sagaScreen.saga-theme-stone  { background: linear-gradient(180deg, #4080FF 0%, #3060CC 40%, #60BB60 100%); }
#sagaScreen.saga-theme-lava   { background: linear-gradient(180deg, #FF4400 0%, #FF6600 40%, #FF8800 100%); }
#sagaScreen.saga-theme-crystal{ background: linear-gradient(180deg, #FF40CC 0%, #AA30DD 40%, #7020BB 100%); }

.saga-header {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: linear-gradient(180deg, rgba(30,0,80,0.7), rgba(80,30,160,0.4));
  border-bottom: 3px solid rgba(255,215,0,0.5); z-index: 10;
}
.saga-title {
  font-family: 'Fredoka One', cursive; font-size: clamp(18px, 4vw, 28px);
  background: linear-gradient(135deg, #FFD700, #FF6B35);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.saga-score-display { font-family: 'Fredoka One', cursive; font-size: 18px; color: var(--gold); }
.saga-back-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)); border: 2px solid rgba(255,255,255,0.3);
  color: #fff; border-radius: 16px; padding: 6px 14px; font-weight: 800;
  font-size: 14px; cursor: pointer; font-family: 'Nunito', sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.saga-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; position: relative;
  -webkit-overflow-scrolling: touch;
}
.saga-scroll::-webkit-scrollbar { width: 0; }
.saga-map-inner { position: relative; width: 100%; min-height: 200vh; padding-bottom: 100px; }

/* ═════════ PREMIUM 3D SAGA LEVEL NODES ═════════ */
/* ═════════ PLAYFUL "GUMMY/JELLY" SAGA NODES ═════════ */
.saga-node, .level-node {
  position: absolute; width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  font-family: 'Fredoka One', cursive; font-size: 1.1rem; font-weight: 900;
  color: #fff; cursor: pointer; transition: transform 0.1s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.1s; z-index: 5;
  background: linear-gradient(180deg, #66FF66, #00CC00) !important;
  border: 4px solid #fff !important;
  box-shadow: 0 5px 0 #008000, 0 8px 10px rgba(0,0,0,0.3) !important;
  text-shadow: 1px 2px 1px #008000 !important;
}
.saga-node:active, .level-node:active {
  transform: scale(0.92) translateY(3px) !important;
  box-shadow: 0 2px 0 #008000, 0 3px 6px rgba(0,0,0,0.3) !important;
}
/* Completed node — teal gummy */
.saga-node.node-done {
  background: linear-gradient(180deg, #69F0AE, #00897B) !important;
  box-shadow: 0 5px 0 #00574B, 0 8px 10px rgba(0,0,0,0.3) !important;
  text-shadow: 1px 2px 1px #00574B !important;
}
/* Current node — sunshine yellow, pulsing gummy */
.saga-node.node-current, .level-node.current {
  background: linear-gradient(180deg, #FFFF66, #FF9900) !important;
  border: 4px solid #fff !important;
  box-shadow: 0 6px 0 #CC6600, 0 10px 15px rgba(0,0,0,0.4) !important;
  transform: scale(1.15) !important;
  color: #8B0000 !important;
  text-shadow: 1px 1px 0px rgba(255,255,255,0.9) !important;
  animation: gummyPulse 1.5s ease-in-out infinite !important;
}
@keyframes gummyPulse {
  0%,100% { transform: scale(1.15); }
  50%      { transform: scale(1.25); }
}
/* Locked node — grey gummy */
.saga-node.node-locked {
  background: linear-gradient(180deg, #CFD8DC, #607D8B) !important;
  border: 4px solid rgba(255,255,255,0.6) !important;
  box-shadow: 0 4px 0 #37474F, 0 6px 8px rgba(0,0,0,0.25) !important;
  opacity: 0.75; cursor: default;
}
/* ★ PLAYER AVATAR — floating above current node ★ */
.player-avatar {
  position: absolute; top: -38px; left: 50%; transform: translateX(-50%);
  font-size: 28px; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
  animation: avatarBounce 1.2s ease-in-out infinite; z-index: 10;
  pointer-events: none;
}
@keyframes avatarBounce {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}
.saga-node .node-num { font-size: 18px; line-height: 1; }
.node-stars { position: absolute; bottom: -18px; font-size: 12px; letter-spacing: 1px; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,0.6); }
.node-lock { font-size: 24px; opacity: 0.6; }

.saga-level-badge {
  position: absolute; font-family: 'Fredoka One', cursive;
  font-size: clamp(13px, 3vw, 17px); color: #fff;
  background: rgba(0,0,0,0.6); padding: 6px 20px; border-radius: 30px;
  border: 2px solid rgba(255,255,255,0.15); white-space: nowrap;
  z-index: 4; text-align: center; transform: translateX(-50%);
}
.saga-zone-decor {
  position: absolute; font-size: clamp(22px, 5vw, 40px);
  opacity: 0.15; pointer-events: none; z-index: 1;
  animation: floatDecor 6s ease-in-out infinite alternate;
}
.saga-footer { flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(0,0,0,0.3); }
.reset-btn { font-size: 12px; color: #e74c3c; cursor: pointer; opacity: 0.5; background: none; border: none; font-family: 'Nunito', sans-serif; font-weight: 700; }

/* ═════════ PLAYFUL "GUMMY/JELLY" MODE BUTTONS ═════════ */
#pf-play-modes {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    flex-shrink: 0;
    z-index: 100;
}
.pf-mode-btn {
    border-radius: 50px !important; /* Full pill shape */
    font-family: 'Fredoka One', 'Bubblegum Sans', 'Nunito', sans-serif !important;
    font-size: clamp(0.9rem, 3.5vw, 1.2rem) !important;
    font-weight: 900 !important;
    color: white !important;
    padding: 12px 18px !important;
    cursor: pointer !important;
    flex: 1 !important;
    text-align: center !important;
    border: 4px solid #fff !important;
    transition: transform 0.1s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.1s !important;
    position: relative !important;
    overflow: hidden !important;
    -webkit-tap-highlight-color: transparent !important;
}
/* Cute top gloss highlight */
.pf-mode-btn::before {
    content: '';
    position: absolute;
    top: 2px; left: 10%; right: 10%;
    height: 35%;
    background: rgba(255,255,255,0.5);
    border-radius: 50px 50px 10px 10px;
    pointer-events: none;
}
/* Squishy press */
.pf-mode-btn:active {
    transform: scale(0.95) translateY(4px) !important;
    box-shadow: 0 0 0 transparent !important;
}
/* 🍋 Sunshine Yellow — All Words */
.btn-candy-gold {
    background: linear-gradient(180deg, #FFFF66, #FFCC00) !important;
    box-shadow: 0 6px 0 #CC9900, 0 8px 15px rgba(255,204,0,0.4) !important;
    color: #D35400 !important;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.8) !important;
}
/* 🍬 Bubblegum Pink — Fix Mistakes */
.btn-candy-red {
    background: linear-gradient(180deg, #FF66B2, #FF1493) !important;
    box-shadow: 0 6px 0 #C71585, 0 8px 15px rgba(255,20,147,0.4) !important;
    text-shadow: 1px 2px 0px #C71585 !important;
}
/* 🐬 Jelly Blue — Revision */
.btn-candy-blue {
    background: linear-gradient(180deg, #33CCFF, #0088CC) !important;
    box-shadow: 0 6px 0 #005580, 0 8px 15px rgba(0,136,204,0.4) !important;
    text-shadow: 1px 2px 0px #005580 !important;
}

@keyframes floatDecor { 0% { transform: translateY(0) rotate(0deg); } 100% { transform: translateY(-12px) rotate(8deg); } }
@keyframes currentPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255,215,0,0.4); } 50% { transform: scale(1.12); box-shadow: 0 0 35px rgba(255,215,0,0.7); } }

/* ===================== GAME SCREEN ===================== */
#gameScreen {
  position: fixed; inset: 0; display: none; z-index: 600;
  flex-direction: column; background: #1A0050;
}
#gameScreen.active { display: flex; }
#gameCanvas {
  display: block; flex: 1; cursor: crosshair;
  width: 100%; height: 100%;
  touch-action: none;
}

/* ★ v6.3: LANDSCAPE-RESPONSIVE — auto-scale for any orientation ★ */
@media (orientation: landscape) {
  .game-hud { height: 44px; padding: 4px 12px; }
  .hud-text { font-size: 16px; }
  .hud-btn { font-size: 12px; padding: 3px 8px; }
  #qBar { font-size: clamp(11px, 2vh, 15px); padding: 3px 10px; min-height: 28px; }
  .q-type-badge { font-size: 10px; padding: 2px 7px; }
  #qImageWrap { max-width: 80px; max-height: 60px; }
  #ballQueue .bq-ball { width: 26px; height: 26px; font-size: 13px; }
}
@media (orientation: portrait) {
  .game-hud { height: 52px; }
  #qBar { font-size: clamp(12px, 3vw, 16px); }
}
/* Ensure full-bleed canvas on all devices */
@media (max-height: 500px) {
  .game-hud { height: 38px; padding: 2px 8px; }
  #qBar { min-height: 24px; font-size: 11px; padding: 2px 8px; }
}

/* Screen Shake */
@keyframes screenShake {
  0%,100% { transform: translate(0,0); } 10% { transform: translate(-6px, 3px); }
  20% { transform: translate(5px, -4px); } 30% { transform: translate(-4px, 5px); }
  40% { transform: translate(6px, -2px); } 50% { transform: translate(-3px, 4px); }
  60% { transform: translate(4px, -3px); } 70% { transform: translate(-5px, 2px); }
  80% { transform: translate(3px, -5px); } 90% { transform: translate(-2px, 3px); }
}
#gameScreen.shake { animation: screenShake 0.4s ease; }

/* --- Game HUD --- */
.game-hud {
  position: absolute; top: 0; left: 0; right: 0; height: 52px;
  background: linear-gradient(180deg, rgba(30,0,80,0.85) 0%, rgba(30,0,80,0.2) 80%, transparent 100%);
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; gap: 6px; z-index: 20; pointer-events: none;
}
.game-hud > * { pointer-events: auto; }
.hud-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.08)); border: 2px solid rgba(255,255,255,0.4);
  color: #fff; border-radius: 16px; padding: 5px 12px; font-weight: 800;
  font-size: 13px; cursor: pointer; font-family: 'Nunito', sans-serif;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.2);
}
.hud-text { font-family: 'Fredoka One', cursive; color: var(--gold); font-size: 18px; text-shadow: 1px 1px 3px rgba(0,0,0,0.6); }
.hud-progress { display: flex; align-items: center; gap: 4px; font-family: 'Nunito', sans-serif; font-weight: 800; color: #fff; font-size: 12px; }
.hud-progress-bar { width: 60px; height: 8px; background: rgba(255,255,255,0.15); border-radius: 10px; overflow: hidden; }
.hud-progress-fill { height: 100%; background: linear-gradient(90deg, #39FF14, #00FF88); border-radius: 10px; transition: width 0.4s ease; box-shadow: 0 0 8px rgba(57,255,20,0.5); }

/* --- Combo HUD --- */
.hud-combo {
  display: flex; align-items: center; gap: 2px;
  font-family: 'Fredoka One', cursive; font-size: 18px; color: #fff;
  background: linear-gradient(135deg, #ff4500, #ff6b35);
  padding: 2px 10px; border-radius: 14px; animation: comboPulse 0.6s ease infinite;
}
.combo-fire { font-size: 16px; } .combo-x { font-size: 12px; opacity: 0.8; }
@keyframes comboPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ===================== BALL QUEUE (Angry Birds style) ===================== */
.ball-queue {
  position: absolute; bottom: 70px; left: 10px; z-index: 22;
  display: flex; align-items: center; gap: 4px;
  pointer-events: none;
}
.bq-ball {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: transform 0.3s, opacity 0.3s;
}
.bq-ball.used { opacity: 0.2; transform: scale(0.7); }
.bq-ball.current { transform: scale(1.2); border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,0.5); }
.bq-ball.ball-red    { background: radial-gradient(circle at 35% 35%, #ff6b6b, #c0392b); }
.bq-ball.ball-yellow { background: radial-gradient(circle at 35% 35%, #fff176, #f9a825); }
.bq-ball.ball-black  { background: radial-gradient(circle at 35% 35%, #555, #1a1a1a); }
.bq-ball.ball-blue   { background: radial-gradient(circle at 35% 35%, #64b5f6, #1565c0); }
/* ★ NEW BALL TYPES ★ */
.bq-ball.ball-white  {
  background: radial-gradient(circle at 35% 35%, #f5f5f5, #bdbdbd);
  border-color: rgba(255,255,255,0.7);
}
.bq-ball.ball-green  {
  background: radial-gradient(circle at 35% 35%, #81c784, #2e7d32);
  border-color: rgba(100,220,100,0.6);
}
.bq-ball.ball-grey   {
  background: radial-gradient(circle at 35% 35%, #90a4ae, #37474f);
  border-color: rgba(180,200,210,0.5);
  box-shadow: 0 3px 8px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.15);
}

/* ===================== TAP HINT ===================== */
.tap-hint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 25; pointer-events: none; display: none;
  font-family: 'Fredoka One', cursive; font-size: 28px; color: #fff;
  background: rgba(255,107,53,0.85); padding: 8px 22px; border-radius: 50px;
  animation: tapPulse 0.5s ease infinite;
  box-shadow: 0 4px 20px rgba(255,107,53,0.5);
}
.tap-hint.show { display: block; }
@keyframes tapPulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.15); } }

/* --- Question Bar --- */
.q-bar {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #7C4DFF, #FF4081, #FF6D00); color: #fff;
  padding: 8px 20px; border-radius: 0 0 20px 20px;
  font-family: 'Fredoka One', cursive; font-size: clamp(13px, 3.2vw, 19px);
  text-align: center; z-index: 20; box-shadow: 0 4px 18px rgba(124,77,255,0.4), 0 0 12px rgba(255,64,129,0.2);
  max-width: 96%; pointer-events: none; line-height: 1.3;
  border: 2px solid rgba(255,255,255,0.2); border-top: none;
}
.q-type-badge {
  display: inline-block; font-size: 10px; background: rgba(255,255,255,0.25);
  padding: 2px 8px; border-radius: 8px; margin-right: 4px;
  font-family: 'Nunito', sans-serif; font-weight: 800; vertical-align: middle;
}

/* --- Hear Button --- */
.hear-btn {
  position: absolute; top: 52px; right: 10px; z-index: 25;
  background: linear-gradient(135deg, #39FF14, #00CC66); color: #fff;
  border: 2px solid rgba(255,255,255,0.3); border-radius: 50px; padding: 6px 14px;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 13px;
  cursor: pointer; box-shadow: 0 3px 12px rgba(57,255,20,0.35); display: none;
}

/* --- Question Image --- */
.q-image-wrap {
  position: absolute; top: 95px; left: 50%; transform: translateX(-50%);
  z-index: 22; pointer-events: none;
  background: rgba(30,0,80,0.65); border: 3px solid rgba(255,215,0,0.4);
  border-radius: 20px; padding: 8px; backdrop-filter: blur(4px); text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), 0 0 12px rgba(255,215,0,0.15);
}
.q-image-wrap img { max-width: min(50vw, 180px); max-height: min(30vh, 140px); border-radius: 12px; object-fit: contain; display: block; }
.q-image-emoji { font-size: clamp(48px, 12vw, 80px); line-height: 1; }

/* --- Day Badge --- */
.day-badge-game {
  position: absolute; top: 90px; right: 10px;
  font-family: 'Fredoka One', cursive; font-size: 11px; color: rgba(255,255,255,0.4);
  background: rgba(0,0,0,0.25); padding: 2px 8px; border-radius: 6px;
  z-index: 20; pointer-events: none;
}

/* ===================== OVERLAYS ===================== */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center; z-index: 700;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay-box {
  background: linear-gradient(145deg, #5520CC, #3010AA, #1A0080); border: 3px solid rgba(255,215,0,0.4);
  border-radius: 28px; padding: 28px; text-align: center; max-width: 400px; width: 92%;
  animation: popIn 0.35s ease-out; box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 30px rgba(85,32,204,0.3), inset 0 1px 3px rgba(255,255,255,0.15);
}
@keyframes popIn { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.overlay-emoji { font-size: 54px; margin-bottom: 8px; animation: bounceEmoji 0.6s ease-out; }
@keyframes bounceEmoji { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.2) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); } }
.overlay-title { font-family: 'Fredoka One', cursive; font-size: 28px; margin-bottom: 8px; }
.overlay-sub { font-size: 14px; color: #D0C0FF; margin-bottom: 12px; line-height: 1.4; }

.overlay-stars { font-size: 42px; margin-bottom: 10px; letter-spacing: 6px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.star-earned { display: inline-block; animation: starPop 0.4s ease-out backwards; filter: drop-shadow(0 0 6px rgba(255,215,0,0.6)); }
.star-earned:nth-child(1) { animation-delay: 0.15s; } .star-earned:nth-child(2) { animation-delay: 0.35s; } .star-earned:nth-child(3) { animation-delay: 0.55s; }
.star-empty { display: inline-block; opacity: 0.25; filter: grayscale(1); }
@keyframes starPop { 0% { transform: scale(0) rotate(-30deg); } 60% { transform: scale(1.3) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); } }

.accuracy-wrap { margin: 10px auto; max-width: 260px; }
.accuracy-label { font-size: 12px; color: #b8a9d4; margin-bottom: 4px; font-weight: 700; }
.accuracy-bar { width: 100%; height: 14px; background: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; position: relative; }
.accuracy-fill { height: 100%; border-radius: 10px; transition: width 0.8s ease; background: linear-gradient(90deg, #FF4060, #FF8C00, #FFD700, #39FF14); box-shadow: 0 0 6px rgba(255,215,0,0.3); }
.accuracy-text { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.victory-score { font-family: 'Fredoka One', cursive; font-size: 36px; color: var(--gold); margin: 6px 0; text-shadow: 0 2px 8px rgba(255,215,0,0.4); }

.btn { font-family: 'Fredoka One', cursive; font-size: 16px; padding: 12px 28px; border: none; border-radius: 50px; cursor: pointer; margin: 5px; transition: transform 0.15s, box-shadow 0.15s; display: inline-block; letter-spacing: 0.5px; }
.btn:active { transform: scale(0.93); }
.btn-gold { background: linear-gradient(135deg, #FFD700, #FF6B35); color: #1a0a2e; box-shadow: 0 4px 16px rgba(255,107,53,0.5), 0 0 20px rgba(255,215,0,0.3); border: 2px solid rgba(255,255,255,0.3); }
.btn-ghost { background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05)); color: #fff; border: 3px solid rgba(255,255,255,0.35); box-shadow: 0 3px 12px rgba(0,0,0,0.2); }

#confettiCanvas { position: fixed; inset: 0; z-index: 750; pointer-events: none; }

/* ===================== RESPONSIVE ===================== */
/* ═══════ v9.0: ENHANCED QUESTION BAR & TYPE BADGES ═══════ */
.q-type-badge[data-type="rhyme"]     { background: rgba(255,107,107,0.4); color: #fff; }
.q-type-badge[data-type="picture"]   { background: rgba(100,181,246,0.4); color: #fff; }
.q-type-badge[data-type="oddone"]    { background: rgba(255,183,77,0.4); color: #fff; }
.q-type-badge[data-type="fillblank"] { background: rgba(129,199,132,0.4); color: #fff; }
.q-type-badge[data-type="spelling"]  { background: rgba(186,104,200,0.4); color: #fff; }
/* sequence badge → see Sniper Mode section above */
.q-type-badge[data-type="beginSound"]{ background: rgba(77,208,225,0.4); color: #fff; }
.q-type-badge[data-type="plural"]    { background: rgba(174,213,129,0.4); color: #333; }
.q-type-badge[data-type="fillVowel"] { background: rgba(255,138,128,0.4); color: #fff; }

/* Correct block glow pulse (applied to word blocks in canvas via theme) */
@keyframes correctPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(118,255,3,0.3); }
  50% { box-shadow: 0 0 20px rgba(118,255,3,0.6); }
}

/* ═══════════════════════════════════════════════════════
   🎯 SNIPER MODE — CSS v10.0
   Zero-gravity wordScramble / sentenceOrder puzzle mode
   ═══════════════════════════════════════════════════════ */

/* ★ Sniper Mode qBar badge — golden pulse ★ */
.q-type-badge[data-type="sequence"] {
  background: linear-gradient(135deg, rgba(255,213,79,0.7), rgba(255,160,0,0.5));
  color: #1a0a00;
  font-weight: 900;
  box-shadow: 0 0 8px rgba(255,213,79,0.4);
  animation: sniperBadgePulse 1.4s ease-in-out infinite;
}
@keyframes sniperBadgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,213,79,0.3); }
  50%       { box-shadow: 0 0 16px rgba(255,213,79,0.7), 0 0 28px rgba(255,160,0,0.3); }
}

/* ★ Sniper qBar special gradient ★ */
#qBar[data-sniper="true"],
.q-bar[data-sniper="true"] {
  background: linear-gradient(135deg, #b8860b, #FF8C00, #FFD700);
  border-color: rgba(255,215,0,0.5);
  box-shadow: 0 4px 18px rgba(255,160,0,0.45), 0 0 14px rgba(255,215,0,0.25);
}

/* ═══════════════════════════════════════════════════════
   🦅 7-BALL ARSENAL — HUD tooltip styles
   ═══════════════════════════════════════════════════════ */

/* ★ Ball queue: current ball glows match its type ★ */
.bq-ball.current.ball-red    { box-shadow: 0 0 14px rgba(255,80,80,0.7),  0 0 6px rgba(255,80,80,0.4); }
.bq-ball.current.ball-yellow { box-shadow: 0 0 14px rgba(255,220,50,0.7), 0 0 6px rgba(255,220,50,0.4); }
.bq-ball.current.ball-black  { box-shadow: 0 0 14px rgba(120,80,200,0.7), 0 0 6px rgba(100,50,150,0.4); }
.bq-ball.current.ball-blue   { box-shadow: 0 0 14px rgba(100,181,246,0.7),0 0 6px rgba(100,181,246,0.4); }
.bq-ball.current.ball-white  { box-shadow: 0 0 14px rgba(255,255,255,0.8),0 0 6px rgba(220,220,220,0.5); }
.bq-ball.current.ball-green  { box-shadow: 0 0 14px rgba(80,220,80,0.7),  0 0 6px rgba(80,220,80,0.4); }
.bq-ball.current.ball-grey   { box-shadow: 0 0 14px rgba(160,180,190,0.6),0 0 6px rgba(144,164,174,0.4); }

/* ★ Ball ability tap hint — per-ball color ★ */
.tap-hint.hint-yellow { background: rgba(249,168,37,0.9);  box-shadow: 0 4px 20px rgba(249,168,37,0.6); }
.tap-hint.hint-black  { background: rgba(80,0,160,0.9);    box-shadow: 0 4px 20px rgba(100,50,200,0.6); }
.tap-hint.hint-blue   { background: rgba(21,101,192,0.9);  box-shadow: 0 4px 20px rgba(100,181,246,0.6); }
.tap-hint.hint-white  { background: rgba(100,100,120,0.9); box-shadow: 0 4px 20px rgba(200,200,220,0.4); }
.tap-hint.hint-green  { background: rgba(46,125,50,0.9);   box-shadow: 0 4px 20px rgba(129,199,132,0.6); }

/* ★ Grey wrecking ball: destruction label ★ */
.bq-ball.ball-grey::after {
  content: '🪨';
  position: absolute;
  font-size: 8px;
  bottom: -2px; right: -2px;
}

/* ★ White bomber: egg label ★ */
.bq-ball.ball-white::after {
  content: '🥚';
  position: absolute;
  font-size: 8px;
  bottom: -2px; right: -2px;
}

/* ★ Green boomerang: curved arrow label ★ */
.bq-ball.ball-green::after {
  content: '🪃';
  position: absolute;
  font-size: 8px;
  bottom: -2px; right: -2px;
}

/* ★ Make bq-ball position:relative for ::after to work ★ */
.bq-ball { position: relative; }

/* ═══════════════════════════════════════════════════════
   📱 RESPONSIVE — updated for 7-ball queue on small screens
   ═══════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .saga-node { width: 46px; height: 46px; font-size: 15px; }
  .overlay-box { padding: 22px 16px; } .overlay-title { font-size: 22px; }
  .overlay-stars { font-size: 34px; } .victory-score { font-size: 26px; }
  .btn { font-size: 13px; padding: 8px 18px; }
  /* 7 balls on small screen: slightly smaller */
  .bq-ball { width: 22px; height: 22px; font-size: 9px; }
}
@media (min-width: 768px) {
  .saga-node { width: 60px; height: 60px; font-size: 20px; }
  .overlay-box { max-width: 440px; }
  /* 7 balls on tablet: slightly bigger */
  .bq-ball { width: 32px; height: 32px; font-size: 13px; }
}
/* Landscape small screens — compact ball queue */
@media (orientation: landscape) and (max-height: 500px) {
  .ball-queue { bottom: 50px; }
  .bq-ball { width: 22px; height: 22px; font-size: 9px; }
}
/* ★ v6.5: LANDSCAPE OVERLAY — compact layout for short screens ★ */
@media (orientation: landscape) and (max-height: 500px) {
  .overlay-box {
    padding: 12px 18px; max-width: 90vw; max-height: 88vh;
    overflow-y: auto; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center;
  }
  .overlay-emoji { font-size: 32px; margin-bottom: 4px; }
  .overlay-title { font-size: 18px; margin-bottom: 4px; }
  .overlay-sub { font-size: 11px; margin-bottom: 6px; }
  .overlay-stars { font-size: 28px; margin-bottom: 6px; letter-spacing: 4px; }
  .victory-score { font-size: 22px; margin: 4px 0; }
  .accuracy-wrap { margin: 4px auto; max-width: 200px; }
  .accuracy-bar { height: 10px; }
  .btn { font-size: 12px; padding: 6px 16px; margin: 2px; }
}
@media (orientation: landscape) and (max-height: 380px) {
  .overlay-box { padding: 8px 14px; max-height: 92vh; }
  .overlay-emoji { font-size: 24px; }
  .overlay-title { font-size: 15px; }
  .overlay-stars { font-size: 22px; }
  .victory-score { font-size: 18px; }
  .btn { font-size: 11px; padding: 5px 12px; }
}
/* ★ v6.5 + v12: IMAGE LIFECYCLE transitions ★ */
.q-image-wrap {
  transition: transform 0.4s ease, opacity 0.4s ease, top 0.4s ease, left 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.q-image-wrap.aim-shrink {
  transform: translateX(0) scale(0.4) !important;
  opacity: 0.5;
  top: 54px !important; left: 12px !important;
}

/* ★ v12: VICTORY SIDE-BY-SIDE ★ */
.q-image-wrap.victory-side {
  top: 50% !important; left: 22% !important;
  transform: translate(-50%, -50%) scale(1.1) !important;
  opacity: 1 !important;
  background: rgba(0,0,0,0.65);
  border: 3px solid rgba(255,215,0,0.6);
  box-shadow: 0 0 25px rgba(255,215,0,0.3), 0 8px 32px rgba(0,0,0,0.5);
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.4s ease, top 0.5s cubic-bezier(0.34,1.56,0.64,1),
              left 0.5s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.4s ease;
  z-index: 55;
}
.q-image-wrap.victory-side img { max-width: min(35vw, 160px); max-height: min(35vh, 150px); }
.q-image-wrap.victory-side .q-image-emoji { font-size: clamp(52px, 14vw, 90px); }
.q-image-wrap.victory-fadeout {
  top: 50% !important; left: 22% !important;
  transform: translate(-50%, -50%) scale(0.6) !important;
  opacity: 0 !important; pointer-events: none;
  transition: transform 0.6s ease-out, opacity 0.5s ease-out; z-index: 55;
}
@media (max-width: 480px) {
  .q-image-wrap.victory-side { left: 50% !important; top: 25% !important; transform: translate(-50%, -50%) scale(0.9) !important; }
  .q-image-wrap.victory-side img { max-width: min(40vw, 120px); max-height: min(20vh, 100px); }
  .q-image-wrap.victory-fadeout { left: 50% !important; top: 25% !important; }
}

/* ★ v7.5: Earthquake Power-Up Button ★ */
.earthquake-btn {
  position: fixed; bottom: 14px; left: 14px; z-index: 30;
  background: linear-gradient(135deg, #FF6B35, #FF8C00); color: #fff;
  border: 3px solid rgba(255,215,0,0.6); border-radius: 18px; padding: 8px 14px;
  font-family: 'Fredoka One', cursive; font-size: 12px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(255,107,53,0.4), 0 0 12px rgba(255,140,0,0.2);
  transition: transform 0.2s, opacity 0.3s;
}
.earthquake-btn:active { transform: scale(0.92); }

/* ═══════════════════════════════════════════════════════
   🔍 TAP-TO-READ POPUP  — v10.0 (moved from JS injection)
   Transparent dim overlay + large centred word card.
   Overlay background: rgba(0,0,0,0.70) — game still visible
   behind, just darkened (professional cinema-style dim).
   ═══════════════════════════════════════════════════════ */

/* ── Overlay container ── */
#tapReadPopup {
  position: fixed;
  inset: 0;                          /* top/left/right/bottom: 0 */
  z-index: 9999;
  display: none;                     /* JS sets to 'flex' when shown */
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none;
  /* ★ TRANSPARENT DIM — game visible behind, not solid black ★ */
  background-color: rgba(0, 0, 0, 0.70);
}

/* ── Big word card ── */
#tapReadPopup_word {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(68px, 18vw, 120px);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);                /* default; JS overrides for correct/wrong */
  background: rgba(10, 0, 40, 0.96);
  border: 4px solid rgba(255, 215, 0, 0.80);
  border-radius: 28px;
  padding: 24px 60px;
  text-shadow:
    0 0 40px rgba(255, 215, 0, 0.70),
    3px 3px 0   rgba(0,   0,  0, 0.90);
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.70);
  cursor: pointer;
  pointer-events: auto;
  transform: scale(1);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Slight pop-in scale when displayed */
#tapReadPopup[style*="flex"] #tapReadPopup_word {
  transform: scale(1.04);
}

/* ── "tap to close" hint text ── */
.tap-read-hint {
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: rgba(210, 230, 255, 0.75);
  margin-top: 14px;
  pointer-events: none;
  letter-spacing: 1px;
}

/* Compact on small landscape screens */
@media (orientation: landscape) and (max-height: 500px) {
  #tapReadPopup_word {
    font-size: clamp(42px, 12vw, 70px);
    padding: 14px 36px;
    border-radius: 18px;
  }
  .tap-read-hint { font-size: 12px; margin-top: 8px; }
}

/* ═══════════════════════════════════════════════════════
   🖼️ IMAGE TAP-TO-ZOOM  — v12.0 (moved from JS injection)
   .q-image-wrap.img-user-enlarged   → full-size centred
   .q-image-wrap.aim-shrink          → cursor + tap hint
   ═══════════════════════════════════════════════════════ */

/* Tap hint icon when image is in aim-shrink corner */
.q-image-wrap.aim-shrink {
  cursor: zoom-in !important;
}
.q-image-wrap.aim-shrink::after {
  content: "👆";
  position: absolute;
  bottom: -2px;
  right: -2px;
  font-size: 10px;
  pointer-events: none;
}

/* Enlarged / zoomed-in state */
.q-image-wrap.img-user-enlarged {
  top:       50% !important;
  left:      50% !important;
  transform: translate(-50%, -50%) scale(1.1) !important;
  opacity:   0.97 !important;
  z-index:   90  !important;
  cursor:    zoom-out !important;
  background:   rgba(20, 0, 60, 0.82) !important;
  border:       3px solid rgba(255, 215, 0, 0.70) !important;
  box-shadow:   0 0 30px rgba(0, 0, 0, 0.60) !important;
  transition:
    transform  0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    top        0.35s ease,
    left       0.35s ease,
    opacity    0.30s ease !important;
}

/* Portrait overlay removed — CSS transform in victory_modal_premium.css handles it */
#pfPortraitOverlay, #portraitOverlay { display:none !important; }

/* ═══════════════════════════════════════════════════════
   🏆 VICTORY WORD BANNER  — #pfVictoryWord
   HTML div — ALWAYS above canvas, HUD, tap-hint.
   z-index: 999999 — highest layer in the game.
   Slides down from top-center on correct hit,
   slides back up on next question load.
   ═══════════════════════════════════════════════════════ */
#pfVictoryWord {
  /* Position: fixed top-center, starts hidden above viewport */
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-130%);
  z-index: 999999;          /* above every other element */
  pointer-events: none;

  /* Typography */
  font-family: 'Fredoka One', cursive;
  font-size: clamp(36px, 9vw, 72px);
  font-weight: 900;
  letter-spacing: 3px;
  color: #39FF14;

  /* Card */
  background: rgba(8, 0, 35, 0.96);
  border: 3px solid rgba(57, 255, 20, 0.85);
  border-radius: 0 0 26px 26px;   /* rounded bottom only — drops from top */
  padding: 14px 44px 18px;
  text-shadow:
    0 0 32px rgba(57, 255, 20, 0.85),
    2px 2px 0  rgba(0, 0, 0, 0.95);
  box-shadow:
    0 8px 36px rgba(57, 255, 20, 0.28),
    0 4px 18px rgba(0, 0, 0, 0.65);

  /* Slide transition */
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity   0.22s ease;
  opacity: 0;
  white-space: nowrap;
}

/* Shown — slides into view from top */
#pfVictoryWord.pf-victory-show {
  transform: translateX(-50%) translateY(0%);
  opacity: 1;
}

/* Hidden — slides back above viewport */
#pfVictoryWord.pf-victory-hide {
  transform: translateX(-50%) translateY(-130%);
  opacity: 0;
}

/* Compact on small landscape screens */
@media (orientation: landscape) and (max-height: 500px) {
  #pfVictoryWord {
    font-size: clamp(24px, 5.5vw, 44px);
    padding: 8px 28px 10px;
    border-radius: 0 0 16px 16px;
  }
}

/* ═══ PORTRAIT OVERLAY — permanently disabled ═══ */
#portraitOverlay, #pfPortraitOverlay { display: none !important; }
