/* =========================================================
   BUGHUNT: POKEMON-STYLE COMBAT BATTLE ARENA (css/battle.css)
   Native 1920x1080 Viewport Coordinate Grid
========================================================= */

#battle-screen {
    display: none;
    position: relative;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
    color: #f3e8ff;
    padding-bottom: 24px;
}

/* Difficulty backgrounds */
#battle-screen.easy-battle {
    background-image: linear-gradient(rgba(10, 5, 20, 0.45), rgba(5, 2, 14, 0.7)), url("bgassets/easy.png");
}

#battle-screen.normal-battle {
    background-image: linear-gradient(rgba(10, 5, 20, 0.45), rgba(5, 2, 14, 0.7)), url("bgassets/normal.png");
}

#battle-screen.hard-battle {
    background-image: linear-gradient(rgba(10, 5, 20, 0.45), rgba(5, 2, 14, 0.7)), url("bgassets/hard.png");
}

#battle-screen.hell-battle {
    background-image: linear-gradient(rgba(15, 2, 10, 0.45), rgba(8, 2, 10, 0.75)), url("bgassets/hell.png");
}

/* Subtle Vignette */
#battle-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
    z-index: 1;
}

/* =========================================================
   TOP BATTLE NAVIGATION & STATUS STRIP
========================================================= */

#battle-top {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 1600px;
    margin: clamp(4px, 1vh, 12px) auto clamp(2px, 0.6vh, 8px) auto;
    padding: 0 clamp(12px, 2.5vw, 36px);
    height: auto;
    min-height: clamp(38px, 4.5vh, 48px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    z-index: 100;
    pointer-events: auto;
    box-sizing: border-box;
    gap: 12px;
    flex-shrink: 0;
}

#battle-back-button {
    justify-self: start;
    background: rgba(26, 18, 44, 0.92);
    border: 1px solid var(--theme-primary, #7c3aed);
    color: var(--theme-text-sub, #e9d5ff);
    font-family: 'Inter', sans-serif;
    font-size: clamp(14px, 1.3vmin + 2px, 16.5px);
    font-weight: 700;
    padding: clamp(7px, 1vh, 11px) clamp(14px, 1.4vw, 22px);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

#battle-back-button:hover {
    background: var(--theme-primary, #7c3aed);
    color: #ffffff;
    transform: translateX(-3px);
    box-shadow: 0 0 16px var(--theme-glow, rgba(124, 58, 237, 0.6));
}

/* Centered Unified Status Pill Cluster (Difficulty | Enemy # | Timer) */
.battle-top-center-cluster {
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(18, 12, 34, 0.94);
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 30px;
    padding: 6px 22px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(124, 58, 237, 0.2);
    user-select: none;
}

.battle-diff-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #facc15;
    background: transparent;
    border: none;
    padding: 0;
    text-transform: uppercase;
    line-height: 1.4;
}

.cluster-sep {
    color: rgba(167, 139, 250, 0.35);
    font-size: 13px;
    font-weight: 400;
    user-select: none;
}

.battle-counter-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: #f3e8ff;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.battle-top-center-cluster .battle-timer-pill {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15.5px;
    font-weight: 800;
    color: #67e8f9;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.battle-top-center-cluster .battle-timer-pill.warning {
    color: #fde047 !important;
}

.battle-top-center-cluster .battle-timer-pill.danger {
    color: #f87171 !important;
    animation: timerPulseDanger 0.8s infinite alternate ease-in-out;
}

.battle-top-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
}

#battle-guide-button {
    background: rgba(26, 18, 44, 0.92);
    border: 1px solid var(--theme-primary, #a855f7);
    color: var(--theme-text-title, #f3e8ff);
    font-family: 'Inter', sans-serif;
    font-size: clamp(14px, 1.3vmin + 2px, 16.5px);
    font-weight: 700;
    padding: clamp(7px, 1vh, 11px) clamp(14px, 1.4vw, 22px);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

#battle-guide-button:hover {
    background: #9333ea;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.6);
}

#battle-intel-button {
    background: rgba(20, 28, 55, 0.92);
    border: 1px solid #00d2ff;
    color: #bbf2f6;
    font-family: 'Inter', sans-serif;
    font-size: clamp(12.5px, 1.1vmin + 2px, 15px);
    font-weight: 700;
    padding: clamp(6px, 0.8vh, 10px) clamp(12px, 1.2vw, 18px);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}

#battle-intel-button:hover {
    background: #0088cc;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 0 16px rgba(0, 210, 255, 0.6);
}

/* Battle Question Countdown Timer Pill */
.battle-timer-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 20, 36, 0.9);
    border: 1.5px solid #00d2ff;
    border-radius: 20px;
    padding: clamp(4px, 0.6vh, 8px) clamp(12px, 1.2vw, 18px);
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(13px, 1.2vmin + 2px, 16px);
    font-weight: 800;
    color: #67e8f9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 12px rgba(0, 210, 255, 0.3);
    transition: all 0.3s ease;
    user-select: none;
}

.battle-timer-pill .timer-icon {
    font-size: 16px;
    line-height: 1;
}

.battle-timer-pill.warning {
    border-color: #f59e0b;
    color: #fde047;
    background: rgba(40, 28, 10, 0.92);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
}

.battle-timer-pill.danger {
    border-color: #ef4444;
    color: #fca5a5;
    background: rgba(45, 10, 16, 0.95);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.7);
    animation: timerPulseDanger 0.8s infinite alternate ease-in-out;
}

@keyframes timerPulseDanger {
    0% { transform: scale(1); box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
    100% { transform: scale(1.05); box-shadow: 0 0 24px rgba(239, 68, 68, 0.9); }
}

.battle-lang-box {
    background: rgba(26, 18, 44, 0.92) !important;
    border: 1px solid #634394 !important;
    border-radius: 8px !important;
    padding: 7px 12px !important;
}

/* =========================================================
   POKEMON BATTLE ARENA (COMBATANTS & CENTER TERMINAL)
========================================================= */

#pokemon-battle-arena {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 1550px;
    margin: 0 auto;
    min-height: 220px;
    height: clamp(230px, 44vh, 460px);
    flex: 1 1 auto;
    z-index: 10;
    pointer-events: auto;
    box-sizing: border-box;
    overflow: hidden;
}

/* --- 1. HUD Cards (Player Top-Left, Enemy Bottom-Right as requested) --- */
.pokemon-hud-card {
    position: absolute;
    width: clamp(200px, 24%, 320px);
    max-width: 26%;
    background: linear-gradient(135deg, rgba(20, 14, 38, 0.95), rgba(10, 6, 22, 0.98));
    border: 2px solid #5a388a;
    border-radius: 12px;
    padding: clamp(6px, 1vh, 10px) clamp(8px, 1vw, 14px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(120, 60, 200, 0.2);
    box-sizing: border-box;
    backdrop-filter: blur(10px);
    z-index: 18;
}

/* Player HP Card: Top-Left */
.pokemon-hud-card.player-card {
    top: clamp(6px, 1.5%, 16px);
    left: clamp(10px, 2%, 24px);
    bottom: auto;
    right: auto;
    border-left: 5px solid #00d2ff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 210, 255, 0.25);
    z-index: 50;
}

/* Combat Log Toggle Button on Player Card */
.combat-log-pill-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 14px;
    background: rgba(0, 210, 255, 0.16);
    border: 1px solid #00d2ff;
    color: #7dd3fc;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.combat-log-pill-btn:hover {
    background: #00d2ff;
    color: #0b1120;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.7);
    transform: translateY(-1px);
}

.combat-log-pill-btn.active {
    background: #00d2ff;
    color: #0b1120;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.85);
}

/* Side-Deck Combat Log Panel (Docked cleanly beside Core Blocks in pokemon-battle-window) */
.player-combat-log-popover,
.arena-side-core-log,
.arena-bottom-left-log,
.arena-bottom-right-log {
    position: relative;
    width: clamp(280px, 28vw, 380px);
    flex: 0 0 clamp(280px, 28vw, 380px);
    height: 100%;
    min-height: 0;
    max-height: 100%;
    background: linear-gradient(135deg, rgba(14, 18, 36, 0.98), rgba(8, 10, 24, 0.98));
    border: 2px solid #00d2ff;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 210, 255, 0.3);
    backdrop-filter: blur(14px);
    z-index: 35;
    display: none;
    flex-direction: column;
    gap: 8px;
    animation: combatLogPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow: hidden;
}

.player-combat-log-popover.active {
    display: flex;
}

@keyframes combatLogPop {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.player-combat-log-popover .dialogue-tag-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 210, 255, 0.25);
    flex-shrink: 0;
    margin-bottom: 2px;
}

.log-strip-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00d2ff;
    box-shadow: 0 0 6px #00d2ff;
    display: inline-block;
}

.dialogue-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.dialogue-close-btn:hover {
    color: #ffffff;
    background: rgba(239, 68, 68, 0.6);
    border-color: #ef4444;
}

/* Enemy HP Card: Bottom-Right */
.pokemon-hud-card.enemy-card {
    bottom: clamp(6px, 1.5%, 16px);
    right: clamp(10px, 2%, 24px);
    top: auto;
    left: auto;
    border-right: 5px solid #e0316d;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7), 0 0 15px rgba(224, 49, 109, 0.25);
}

.pokemon-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pokemon-combatant-name,
#enemy-name {
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    letter-spacing: 0.5px !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6) !important;
    text-align: left !important;
    min-width: auto !important;
}

.pokemon-topic-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(224, 49, 109, 0.2);
    border: 1px solid rgba(224, 49, 109, 0.6);
    color: #ff85b3;
    text-transform: uppercase;
}

.player-header-pills {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pokemon-shield-pill {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 210, 255, 0.25);
    border: 1px solid #00d2ff;
    color: #80edff;
    animation: pulseShield 1.5s infinite;
}

@keyframes pulseShield {
    0%, 100% { box-shadow: 0 0 6px rgba(0, 210, 255, 0.4); }
    50% { box-shadow: 0 0 16px rgba(0, 210, 255, 0.85); }
}

.pokemon-tp-pill,
#true-points-display {
    position: static !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    background: rgba(255, 204, 0, 0.18) !important;
    border: 1px solid rgba(255, 204, 0, 0.6) !important;
    color: #ffe066 !important;
    margin: 0 !important;
}

/* Primary Hearts Indicator (Clean, Non-Redundant) */
.pokemon-hearts-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 2px 0;
}

.pokemon-hearts-deck,
#enemy-hearts,
#player-hearts {
    position: static !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    min-width: auto !important;
    width: auto !important;
}

.pokemon-hearts-deck .heart,
.hud-heart,
.heart {
    font-size: 26px !important;
    line-height: 1 !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.pokemon-hearts-deck .heart.full-heart,
.heart.full-heart {
    color: #ff3366 !important;
    text-shadow: 0 0 14px rgba(255, 51, 102, 0.85);
    transform: scale(1);
}

.pokemon-hearts-deck .heart.empty-heart,
.heart.empty-heart {
    color: #4a385c !important;
    text-shadow: none !important;
    opacity: 0.45 !important;
    transform: scale(0.9);
}

/* --- 2. Ground Pedestals and Character Sprites --- */
.pokemon-stage-wrap {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    pointer-events: none;
    z-index: 12;
}

.pokemon-stage-wrap.enemy-stage {
    top: clamp(6px, 1.2%, 14px);
    right: clamp(8px, 2%, 28px);
    width: clamp(230px, 28vw, 360px);
    max-width: 32%;
    height: clamp(190px, 30vh, 320px);
    z-index: 12;
}

.pokemon-stage-wrap.player-stage {
    bottom: clamp(6px, 1.2%, 14px);
    left: clamp(8px, 2%, 28px);
    width: clamp(230px, 28vw, 360px);
    max-width: 32%;
    height: clamp(190px, 30vh, 320px);
    z-index: 15;
}

.pokemon-ground-pedestal {
    position: absolute;
    bottom: 6px;
    border-radius: 50%;
    z-index: 1;
}

.pokemon-ground-pedestal.enemy-ground {
    width: clamp(190px, 23vw, 290px);
    height: clamp(38px, 4.8vh, 58px);
    background: radial-gradient(ellipse at center, rgba(100, 20, 120, 0.8) 0%, rgba(25, 8, 35, 0.55) 60%, transparent 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 20px rgba(220, 50, 140, 0.35);
    border: 1.5px solid rgba(220, 50, 140, 0.4);
}

.pokemon-ground-pedestal.player-ground {
    width: clamp(200px, 24vw, 300px);
    height: clamp(40px, 5vh, 60px);
    background: radial-gradient(ellipse at center, rgba(0, 160, 240, 0.7) 0%, rgba(10, 30, 70, 0.5) 60%, transparent 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 200, 255, 0.45);
    border: 1.5px solid rgba(0, 200, 255, 0.4);
}

.pokemon-sprite,
#enemy-sprite,
#player-sprite {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: 2 !important;
    object-fit: contain !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: none !important;
}

.pokemon-sprite.enemy-sprite,
#enemy-sprite {
    max-height: clamp(200px, 28vh, 320px) !important;
    max-width: clamp(200px, 26vw, 320px) !important;
    height: auto !important;
    width: auto !important;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.85));
    animation: enemyFloat 3s ease-in-out infinite alternate;
}

.pokemon-sprite.player-sprite,
#player-sprite {
    max-height: clamp(210px, 30vh, 330px) !important;
    max-width: clamp(210px, 28vw, 330px) !important;
    height: auto !important;
    width: auto !important;
    filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.85))
            drop-shadow(0 0 20px rgba(0, 210, 255, 0.4));
    animation: playerIdlePulse 2.8s ease-in-out infinite alternate;
}

@keyframes enemyFloat {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-8px); }
}

@keyframes playerIdlePulse {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-5px); }
}

/* --- 3. Elevated Central Python Challenge Terminal & Collapsible Mission Directive --- */
.pokemon-challenge-terminal,
#challenge-box {
    position: absolute !important;
    top: clamp(8px, 1.8vh, 18px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: clamp(340px, 46vw, 640px) !important;
    max-width: 52% !important;
    height: auto !important;
    max-height: 94% !important;
    background: linear-gradient(135deg, rgba(20, 14, 40, 0.96), rgba(12, 8, 26, 0.98)) !important;
    border: 1.5px solid rgba(168, 85, 247, 0.45) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), 0 0 20px rgba(147, 51, 234, 0.25) !important;
    backdrop-filter: blur(12px) !important;
    z-index: 25 !important;
    margin: 0 !important;
    padding: 8px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    overflow: hidden !important;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#challenge-box.is-expanded,
.minimal-mission-box.is-expanded {
    border-color: var(--theme-primary, #a855f7) !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 25px var(--theme-glow, rgba(168, 85, 247, 0.35)) !important;
}

.mission-directive-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.mission-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.mission-challenge-title {
    font-family: 'Inter', sans-serif;
    font-size: clamp(15px, 1.25vmin + 2px, 17.5px);
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mission-details-toggle-btn {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #e9d5ff;
    background: rgba(139, 92, 246, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.45);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mission-details-toggle-btn:hover {
    background: rgba(168, 85, 247, 0.4);
    border-color: #c084fc;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.mission-question-card {
    background: rgba(14, 10, 32, 0.78);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 8px;
    padding: 9px 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.mission-question-card:hover {
    border-color: rgba(168, 85, 247, 0.6);
    background: rgba(18, 12, 40, 0.88);
}

.mission-question-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
}

.mission-badge-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    padding: 2.5px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1.2;
}

.mission-badge-pill.quiz-pill {
    background: rgba(14, 165, 233, 0.22);
    border: 1px solid rgba(56, 189, 248, 0.65);
    color: #7dd3fc;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.mission-badge-pill.parson-pill {
    background: rgba(147, 51, 234, 0.22);
    border: 1px solid rgba(168, 85, 247, 0.65);
    color: #e9d5ff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.25);
}

.mission-question-text {
    font-family: 'Inter', sans-serif;
    font-size: clamp(14px, 1.2vmin + 2px, 16.5px);
    font-weight: 600;
    color: #ffffff;
    line-height: 1.45;
    margin: 0;
    word-break: break-word;
}

.mission-goal-output-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13.5px;
    flex-wrap: wrap;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mission-inline-goal,
.mission-inline-output {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.mission-inline-label {
    font-weight: 700;
    color: #cbd5e1;
    font-size: 13px;
    white-space: nowrap;
}

.mission-inline-value {
    color: #a7f3d0;
    font-weight: 600;
    font-size: 13.5px;
}

.mission-minimal-output-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    padding: 2px 0 0 0;
}

.minimal-output-label {
    font-weight: 600;
    color: #bae6fd;
    font-size: 13.5px;
    white-space: nowrap;
}

.minimal-output-pre {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #38bdf8 !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

/* Quiz question callout inside quiz workspace */
.quiz-question-callout {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.12), rgba(99, 102, 241, 0.08));
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-left: 3px solid #38bdf8;
    border-radius: 6px;
    padding: 3px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    margin-bottom: 0px;
    flex-shrink: 0;
}

.quiz-question-callout .callout-icon {
    font-size: 13px;
    flex-shrink: 0;
    line-height: 1;
}

.quiz-question-callout .callout-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.quiz-question-callout .callout-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.quiz-question-callout .callout-text {
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsible Drawer */
.mission-details-drawer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    pointer-events: none;
}

#challenge-box.is-expanded .mission-details-drawer,
.minimal-mission-box.is-expanded .mission-details-drawer {
    max-height: 280px;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(139, 92, 246, 0.25);
}

.mission-drawer-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mission-extra-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 6px;
}

.terminal-hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(26, 18, 48, 0.95);
    border-bottom: 1px solid #4a3074;
    flex-shrink: 0;
}

.terminal-traffic-lights {
    display: flex;
    gap: 7px;
}

.terminal-traffic-lights .t-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-traffic-lights .t-dot.red { background: #ef4444; }
.terminal-traffic-lights .t-dot.yellow { background: #f59e0b; }
.terminal-traffic-lights .t-dot.green { background: #10b981; }

.terminal-header-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #e2d4f8;
    letter-spacing: 0.5px;
}

.terminal-category-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.terminal-category-badge.cat-syntax {
    background: rgba(234, 179, 8, 0.18);
    border: 1px solid rgba(234, 179, 8, 0.6);
    color: #fef08a;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.3);
}

.terminal-category-badge.cat-logical {
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.6);
    color: #e9d5ff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.terminal-category-badge.cat-runtime {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.6);
    color: #fca5a5;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.terminal-protect-badge {
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.terminal-code-scroll {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: rgba(10, 7, 20, 0.85);
}

.terminal-code-pre,
#bug-code {
    margin: 0 !important;
    font-family: 'JetBrains Mono', 'Courier New', monospace !important;
    font-size: clamp(17.5px, 1.2vw + 3px, 20.5px) !important;
    line-height: 1.7 !important;
    color: #8be9fd !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    user-select: none !important;
    cursor: default !important;
}

/* =========================================================
   PARSONS PUZZLE: CENTRAL RPG MISSION DIALOGUE BOX
========================================================= */

.rpg-mission-box {
    border: 2px solid #8b5cf6 !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.85), 0 0 25px rgba(139, 92, 246, 0.3) !important;
    background: linear-gradient(180deg, rgba(16, 12, 32, 0.96) 0%, rgba(8, 6, 18, 0.98) 100%) !important;
}

.rpg-box-header {
    background: linear-gradient(90deg, rgba(30, 20, 56, 0.98), rgba(18, 12, 38, 0.98)) !important;
    border-bottom: 1.5px solid #6b46c1 !important;
    padding: 10px 16px !important;
}

.rpg-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rpg-intel-btn {
    background: rgba(0, 210, 255, 0.18);
    border: 1px solid #00d2ff;
    color: #a5f3fc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.rpg-intel-btn:hover {
    background: #00d2ff;
    color: #0b1120;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.7);
    transform: translateY(-1px);
}

.rpg-mission-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 1.2vh, 12px);
    padding: clamp(10px, 1.4vh, 16px) clamp(12px, 1.4vw, 18px);
    background: rgba(10, 7, 22, 0.88);
    overflow-y: auto;
    box-sizing: border-box;
    min-height: 0;
}

/* RPG Dialogue Directive Card */
.rpg-dialogue-card {
    background: linear-gradient(135deg, rgba(36, 24, 68, 0.9), rgba(20, 14, 42, 0.95));
    border: 1px solid var(--theme-border, rgba(168, 85, 247, 0.45));
    border-left: 4px solid var(--theme-primary, #a855f7);
    border-radius: 10px;
    padding: clamp(8px, 1vh, 12px) clamp(10px, 1.2vw, 14px);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rpg-dialogue-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpg-speaker-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #c084fc;
    background: rgba(147, 51, 234, 0.3);
    border: 1px solid rgba(168, 85, 247, 0.6);
    border-radius: 4px;
    padding: 2px 7px;
}

.rpg-speaker-badge.badge-quiz {
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.25);
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.rpg-speaker-badge.badge-parson {
    color: #c084fc;
    background: rgba(147, 51, 234, 0.25);
    border-color: rgba(168, 85, 247, 0.65);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.25);
}

.rpg-challenge-title {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: clamp(13px, 1.2vmin + 2px, 16px);
    font-weight: 700;
    color: #f3e8ff;
    letter-spacing: 0.2px;
}

.rpg-directive-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rpg-step-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: rgba(12, 8, 26, 0.75);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
    transition: border-color 0.2s ease;
}

.rpg-step-box.step-exclude {
    border-left: 3px solid #ef4444;
}

.rpg-step-box.step-reorder {
    border-left: 3px solid #00d2ff;
}

.rpg-step-box.step-quiz-read {
    border-left: 3px solid #38bdf8;
}

.rpg-step-box.step-quiz-choose {
    border-left: 3px solid #10b981;
}

.step-num-pill {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--theme-primary, #7c3aed);
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.rpg-step-box.step-exclude .step-num-pill {
    background: #dc2626;
}

.rpg-step-box.step-reorder .step-num-pill {
    background: #0284c7;
}

.rpg-step-box.step-quiz-read .step-num-pill {
    background: #0284c7;
}

.rpg-step-box.step-quiz-choose .step-num-pill {
    background: #059669;
}

.step-desc-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.step-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #e9d5ff;
}

.step-sub {
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    line-height: 1.35;
    color: #cbd5e1;
}

.exclude-chip {
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 800;
}

/* Expected Terminal Output Box */
.rpg-output-box {
    background: rgba(10, 8, 20, 0.95);
    border: 1.5px solid rgba(16, 185, 129, 0.4);
    border-radius: 10px;
    padding: clamp(8px, 1vh, 12px) clamp(10px, 1.2vw, 14px);
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 14px rgba(16, 185, 129, 0.15);
    min-height: 0;
}

.rpg-output-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 700;
    color: #6ee7b7;
    letter-spacing: 0.6px;
}

.rpg-expected-output-pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(14.5px, 1.1vmin + 3px, 17px);
    line-height: 1.55;
    color: #4ade80;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: 6px;
    padding: 10px 14px;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
    max-height: 110px;
}

/* Backward compatibility legacy styles */
.parsons-question-banner {
    display: none;
}
.parsons-meta-grid {
    display: none;
}

/* =========================================================
   CODE INTEL & DIAGNOSIS MODAL (BOOTSTRAP 5 CYBERPUNK THEME)
========================================================= */

.intel-modal-shell {
    background: linear-gradient(145deg, #18122b 0%, #0d0a1a 100%) !important;
    border: 2px solid #00d2ff !important;
    border-radius: 16px !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 210, 255, 0.3) !important;
    color: #f1f5f9 !important;
}

.intel-modal-hdr {
    background: rgba(22, 16, 40, 0.95) !important;
    border-bottom: 1px solid rgba(0, 210, 255, 0.3) !important;
    padding: 16px 22px !important;
}

.intel-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.intel-modal-hdr-icon {
    font-size: 24px;
    line-height: 1;
}

.intel-modal-title-text {
    font-family: 'Inter', sans-serif !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    letter-spacing: 0.5px !important;
    margin: 0 !important;
}

.intel-modal-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    color: #00d2ff;
    font-weight: 600;
}

.intel-modal-body {
    padding: 20px 24px !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(10, 8, 20, 0.92);
}

.intel-modal-ftr {
    background: rgba(22, 16, 40, 0.95) !important;
    border-top: 1px solid rgba(139, 92, 246, 0.3) !important;
    padding: 12px 22px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.intel-modal-tip {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #cbd5e1;
}

.intel-close-action-btn {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
    border: none !important;
    font-weight: 700 !important;
    padding: 8px 18px !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    transition: all 0.2s ease !important;
}

.intel-close-action-btn:hover {
    background: #00d2ff !important;
    color: #0b1120 !important;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.6) !important;
}

/* Intel Detail Blocks */
.intel-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.intel-data-card {
    background: rgba(24, 18, 44, 0.85);
    border: 1px solid rgba(147, 51, 234, 0.4);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.intel-data-card.defect-card {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(45, 12, 24, 0.5);
}

.intel-data-card.goal-card {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(10, 36, 26, 0.5);
}

.intel-card-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #c084fc;
    display: flex;
    align-items: center;
    gap: 6px;
}

.intel-data-card.defect-card .intel-card-title {
    color: #f87171;
}

.intel-data-card.goal-card .intel-card-title {
    color: #34d399;
}

.intel-card-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #e2e8f0;
    margin: 0;
}

.parsons-box-desc {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    line-height: 1.45;
    color: #e9d5ff;
    flex: 1;
}

.parsons-box-output {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14.5px;
    line-height: 1.5;
    color: #50fa7b;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(80, 250, 123, 0.25);
    border-radius: 6px;
    padding: 8px 10px;
    white-space: pre-wrap;
    word-break: break-all;
    flex: 1;
    overflow-y: auto;
}

/* =========================================================
   POKEMON BOTTOM BATTLE WINDOW (UNIFIED FULL-WIDTH DECK)
========================================================= */

.pokemon-battle-window {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 1350px;
    margin: clamp(4px, 0.8vh, 8px) auto clamp(4px, 1vh, 12px) auto;
    padding: 0 clamp(8px, 2vw, 24px);
    box-sizing: border-box;
    min-height: 170px;
    height: clamp(170px, 44vh, 410px);
    flex: 0 0 clamp(170px, 44vh, 410px);
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: clamp(8px, 1.2vw, 14px);
    z-index: 30;
    pointer-events: auto;
}

/* Parsons Code Action & Tactics Command Deck (Core Blocks Workspace) */
.pokemon-command-pane,
.parsons-command-pane {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 1100px;
    margin: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(20, 16, 40, 0.96), rgba(10, 8, 22, 0.98));
    border: 2px solid #634394;
    border-radius: 14px;
    padding: clamp(6px, 1vh, 10px) clamp(8px, 1.2vw, 14px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 4px;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
    overflow: hidden;
}

/* =========================================================
   PARSONS WORKSPACE & REORDERABLE DECK
========================================================= */

.parsons-workspace-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 6px;
}

.parsons-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.parsons-workspace-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.parsons-deck-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #c084fc;
    background: rgba(124, 58, 237, 0.25);
    border: 1px solid rgba(124, 58, 237, 0.5);
    border-radius: 5px;
    padding: 3px 8px;
    letter-spacing: 0.5px;
}

.parsons-deck-tip {
    font-size: 13.5px;
    color: #a78bfa;
}

.parsons-reset-btn {
    background: rgba(38, 24, 62, 0.9);
    border: 1px solid var(--theme-primary, #7c3aed);
    color: var(--theme-text-sub, #e9d5ff);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.parsons-reset-btn:hover {
    background: var(--theme-primary, #7c3aed);
    color: #ffffff;
    box-shadow: 0 0 10px var(--theme-glow, rgba(124, 58, 237, 0.6));
}

.parsons-blocks-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 0.6vh, 6px);
    padding-right: 4px;
    min-height: 0;
    max-height: none;
}

.parsons-blocks-list::-webkit-scrollbar {
    width: 6px;
}

.parsons-blocks-list::-webkit-scrollbar-track {
    background: rgba(15, 10, 25, 0.7);
    border-radius: 4px;
}

.parsons-blocks-list::-webkit-scrollbar-thumb {
    background: #634394;
    border-radius: 4px;
}

.parsons-block-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(22, 16, 42, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 7px;
    padding: 7px 12px;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y;
    cursor: grab;
    box-sizing: border-box;
}

.parsons-block-item:hover {
    border-color: var(--theme-primary, #a855f7);
    background: rgba(36, 24, 68, 0.95);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.parsons-block-item.is-dragging {
    opacity: 0.45;
    border-color: var(--theme-primary, #a855f7);
    background: #1e1438;
}

.parsons-block-item.is-distractor-excluded {
    background: rgba(26, 12, 20, 0.65);
    border: 1.5px dashed rgba(239, 68, 68, 0.45);
    opacity: 0.6;
}

.parsons-block-item.is-distractor-excluded .block-code-text {
    color: #fca5a5;
    text-decoration: line-through;
    opacity: 0.75;
}

.parsons-block-item.is-clue-target {
    border: 2px solid #fbbf24 !important;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.22) 0%, rgba(36, 24, 68, 0.98) 100%) !important;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.55), inset 0 0 10px rgba(251, 191, 36, 0.25) !important;
    animation: clueBlockPulse 1.4s ease-in-out infinite alternate !important;
    z-index: 5;
}

@keyframes clueBlockPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
    }
    100% {
        transform: scale(1.02);
        box-shadow: 0 0 26px rgba(251, 191, 36, 0.85), 0 0 6px #fbbf24;
    }
}

.clue-step-pill {
    background: #fbbf24 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    padding: 2px 7px !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.6) !important;
    border: none !important;
}

.memory-card.is-clue-pair {
    border: 2px solid #fbbf24 !important;
    box-shadow: 0 0 22px rgba(251, 191, 36, 0.75) !important;
    animation: clueCardPulse 1.2s ease-in-out infinite alternate;
}

@keyframes clueCardPulse {
    0% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.4); }
    100% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.9); }
}

.block-drag-handle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14.5px;
    font-weight: 700;
    color: #8b5cf6;
    cursor: grab;
    letter-spacing: -1px;
    padding: 0 4px;
    line-height: 1;
    user-select: none;
}

.block-step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #a78bfa;
    background: rgba(124, 58, 237, 0.18);
    border: 1px solid rgba(124, 58, 237, 0.35);
    padding: 2.5px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.block-distractor-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 2.5px 7px;
    border-radius: 4px;
    flex-shrink: 0;
}

.block-code-text {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(16.5px, 1.1vw + 3px, 18.5px);
    line-height: 1.55;
    color: #f3e8ff;
    white-space: pre;
    overflow-x: auto;
    tab-size: 4;
}

.indent-guide-dash {
    color: rgba(167, 139, 250, 0.45);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14.5px;
    letter-spacing: -1px;
    user-select: none;
    margin-right: 4px;
}

.block-reorder-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.block-btn.block-btn-up,
.block-btn.block-btn-down {
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #c4b5fd;
    border-radius: 5px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.block-btn.block-btn-up:hover:not(:disabled),
.block-btn.block-btn-down:hover:not(:disabled) {
    background: #7c3aed;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
    transform: translateY(-1px);
}

.block-btn.block-btn-up:disabled,
.block-btn.block-btn-down:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    border-color: rgba(100, 70, 150, 0.25);
    pointer-events: none;
}

.block-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.block-btn.toggle-distractor {
    background: rgba(225, 29, 72, 0.15);
    border: 1px solid rgba(225, 29, 72, 0.45);
    color: #fca5a5;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    line-height: 1;
}

.block-btn.toggle-distractor:hover {
    background: #e11d48;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(225, 29, 72, 0.65);
}

.block-btn.include-btn {
    border-color: rgba(34, 197, 94, 0.6);
    color: #86efac;
    background: rgba(20, 50, 30, 0.8);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.block-btn.include-btn:hover {
    background: #22c55e;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}

/* Submit Action Row */
.parsons-submit-row {
    margin-top: 3px;
    flex-shrink: 0;
}

.parsons-submit-btn,
#submit-button {
    width: 100% !important;
    height: clamp(34px, 3.8vh, 42px) !important;
    background: var(--theme-btn-gradient, linear-gradient(135deg, #a855f7 0%, #7c3aed 100%)) !important;
    border: 1.5px solid #c084fc !important;
    border-radius: 8px !important;
    color: #ffffff !important;
    font-family: 'Inter', sans-serif !important;
    font-size: clamp(12px, 1.1vmin + 2px, 13.5px) !important;
    font-weight: 800 !important;
    letter-spacing: 0.8px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.45), 0 0 15px rgba(168, 85, 247, 0.3) !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.parsons-submit-btn:hover,
#submit-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 25px rgba(168, 85, 247, 0.65), 0 0 22px rgba(192, 132, 252, 0.45) !important;
    background: linear-gradient(135deg, #c084fc 0%, #9333ea 100%) !important;
}

/* Tactics & Powerups Bar */
.pokemon-tactics-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
    padding-top: 3px;
    border-top: 1px solid rgba(100, 70, 150, 0.35);
    flex-shrink: 0;
}

.powerups-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.powerups-deck-label {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #a78bfa;
}

.powerup-action-btn {
    background: rgba(35, 24, 60, 0.85);
    border: 1px solid var(--theme-primary, #7c3aed);
    border-radius: 8px;
    color: #e9d5ff;
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}

.powerup-action-btn:hover:not(.disabled) {
    background: rgba(80, 45, 130, 0.9);
    border-color: #c084fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

.powerup-action-btn.disabled,
.powerup-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #3b2b52;
}

.powerup-quota-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--theme-glow-soft, rgba(168, 85, 247, 0.2));
    border: 1px solid var(--theme-primary, #a855f7);
    color: var(--theme-text-sub, #e9d5ff);
}

.powerup-quota-pill.free-quota {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #6ee7b7;
}

.powerup-quota-pill.paid-mode {
    background: rgba(234, 179, 8, 0.2);
    border-color: #eab308;
    color: #fde047;
}

.powerup-quota-pill.empty,
.powerup-quota-pill.paid-mode.empty {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #fca5a5;
}

.hint-action-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.combat-hint-btn,
#hint-button {
    background: rgba(30, 20, 50, 0.85);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    color: #fde68a;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 16px;
    cursor: pointer;
    transition: all 0.2s;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
}

.combat-hint-btn:hover:not(:disabled),
#hint-button:hover:not(:disabled) {
    background: rgba(70, 45, 10, 0.85);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.combat-hint-btn:disabled,
#hint-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #4b3815;
}

.combat-hint-cost {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    color: #a395be;
}

/* =========================================================
   COMBAT SHAKE ANIMATIONS
========================================================= */

.attack-shake {
    animation: attackShake 0.4s ease-in-out;
}

.hit-shake {
    animation: hitShake 0.45s ease-in-out;
}

.screen-shake {
    animation: screenShake 0.35s ease-in-out;
}

.enemy-attack-lunge {
    animation: enemyAttackLunge 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.player-hit-flash {
    animation: playerHitFlash 0.5s ease-in-out !important;
}

@keyframes attackShake {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateX(18px) translateY(-8px); }
    70% { transform: translateX(-8px) translateY(4px); }
}

@keyframes hitShake {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.7)); }
    25% { transform: translateX(-15px); filter: drop-shadow(0 0 15px #ef4444); }
    50% { transform: translateX(15px); }
    75% { transform: translateX(-8px); }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-4px, 4px); }
    40% { transform: translate(4px, -4px); }
    60% { transform: translate(-3px, -2px); }
    80% { transform: translate(3px, 2px); }
}

@keyframes enemyAttackLunge {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    30% {
        transform: translate(-48px, 16px) scale(1.18);
        filter: drop-shadow(0 0 25px rgba(239, 68, 68, 0.95)) brightness(1.3) contrast(1.1);
    }
    60% {
        transform: translate(-18px, 6px) scale(1.06);
        filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.7));
    }
}

@keyframes playerHitFlash {
    0%, 100% {
        transform: translate(0, 0);
        filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.7));
    }
    20% {
        transform: translate(-20px, -6px);
        filter: drop-shadow(0 0 22px #ef4444) brightness(1.6) contrast(1.2);
    }
    40% {
        transform: translate(14px, 4px);
    }
    60% {
        transform: translate(-8px, -2px);
    }
    80% {
        transform: translate(4px, 1px);
    }
}

/* =========================================================
   IN-GAME ARCADE HUD TOAST NOTIFICATION
========================================================= */

.game-toast {
    position: absolute;
    top: 95px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    z-index: 99999;
    padding: 14px 28px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85);
    animation: toastSlideDown 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
    max-width: 650px;
    text-align: center;
}

@keyframes toastSlideDown {
    0% { opacity: 0; transform: translateX(-50%) translateY(-25px); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.game-toast.toast-warning,
.game-toast.toast-warn {
    background: linear-gradient(135deg, rgba(40, 25, 10, 0.98), rgba(20, 12, 5, 0.98));
    border: 2px solid #f59e0b;
    color: #fef3c7;
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4);
}

.game-toast.toast-error {
    background: linear-gradient(135deg, rgba(45, 10, 15, 0.98), rgba(22, 5, 8, 0.98));
    border: 2px solid #ef4444;
    color: #fee2e2;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.4);
}

.game-toast.toast-success {
    background: linear-gradient(135deg, rgba(10, 35, 20, 0.98), rgba(5, 18, 10, 0.98));
    border: 2px solid #10b981;
    color: #d1fae5;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
}

.game-toast.toast-info {
    background: linear-gradient(135deg, rgba(20, 25, 45, 0.98), rgba(10, 12, 25, 0.98));
    border: 2px solid #3b82f6;
    color: #dbeafe;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

/* =========================================================
   ACCESSIBILITY PALETTES: COLOR BLIND & HIGH CONTRAST MODES
========================================================= */

#game-container.colorblind-mode .pokemon-hud-card.enemy-card {
    border-left: 6px solid #e69f00 !important;
    border-color: #e69f00 !important;
}

#game-container.colorblind-mode .pokemon-hud-card.player-card {
    border-right: 6px solid #56b4e9 !important;
    border-color: #56b4e9 !important;
}

#game-container.colorblind-mode .pokemon-bar-fill.hp-green {
    background: #56b4e9 !important;
}

#game-container.colorblind-mode .pokemon-bar-fill.hp-yellow {
    background: #f0e442 !important;
}

#game-container.colorblind-mode .pokemon-bar-fill.hp-red {
    background: #d55e00 !important;
}

#game-container.colorblind-mode .pokemon-submit-btn,
#game-container.colorblind-mode #submit-button {
    background: #0072b2 !important;
    border-color: #56b4e9 !important;
}

#game-container.high-contrast-mode {
    background: #000000 !important;
}

#game-container.high-contrast-mode .pokemon-hud-card,
#game-container.high-contrast-mode .pokemon-challenge-terminal,
#game-container.high-contrast-mode #challenge-box,
#game-container.high-contrast-mode .pokemon-dialogue-pane,
#game-container.high-contrast-mode .pokemon-command-pane,
#game-container.high-contrast-mode .diff-stage-card,
#game-container.high-contrast-mode .steam-achieve-card {
    background: #0a0a0a !important;
    border-color: #ffffff !important;
    box-shadow: 0 0 0 1px #ffffff !important;
}

/* =========================================================
   AUTO-HIDE GLOBAL ACCESS BAR IN BATTLE MODES
   Prevents obstruction of the back button and combat HUD
body.in-battle #global-access-bar,
.in-battle #global-access-bar,
#game-container:has(#battle-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#enemy-intro-overlay.visible) #global-access-bar,
#game-container:has(#victory-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#defeat-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#collection-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#codex-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#shop-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#about-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#compiler-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#leaderboard-screen:not([style*="display: none"])) #global-access-bar,
#game-container:has(#admin-screen:not([style*="display: none"])) #global-access-bar {
    display: none !important;
}



/* =========================================================
   BATTLE TACTICAL DIALOGUE INTEL & FEEDBACK SYSTEM
========================================================= */

#dialogue-text {
    scrollbar-width: thin;
    scrollbar-color: var(--theme-scrollbar, #7c3aed) rgba(10, 5, 20, 0.4);
}

#dialogue-text::-webkit-scrollbar {
    width: 6px;
}

#dialogue-text::-webkit-scrollbar-track {
    background: rgba(10, 5, 20, 0.4);
    border-radius: 4px;
}

#dialogue-text::-webkit-scrollbar-thumb {
    background: #6b21a8;
    border-radius: 4px;
}

#dialogue-text::-webkit-scrollbar-thumb:hover {
    background: #9333ea;
}

.combat-intel-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    animation: fadeInIntel 0.3s ease-out;
}

@keyframes fadeInIntel {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.intel-tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.intel-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.intel-badge.badge-syntax {
    background: rgba(234, 179, 8, 0.18);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.45);
}

.intel-badge.badge-logical {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.45);
}

.intel-badge.badge-runtime {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.intel-subtag {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
}

.intel-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.intel-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    line-height: 1.45;
    color: #f1f5f9;
}

.intel-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #c084fc;
    background: rgba(139, 92, 246, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.intel-val {
    flex: 1;
    font-size: 13px;
    color: #e2e8f0;
}

.intel-line.error-line .intel-label {
    color: #fb7185;
    background: rgba(244, 63, 94, 0.18);
    border: 1px solid rgba(244, 63, 94, 0.35);
}

.intel-line.error-line .intel-val {
    color: #ffd2dc;
    font-weight: 500;
}

/* Combat Feedback (Wrong / Correct / Info) */
.combat-feedback-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    animation: fadeInFeedback 0.25s ease-out;
}

@keyframes fadeInFeedback {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.feedback-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.feedback-badge-wrong {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #fecdd3;
    background: rgba(225, 29, 72, 0.35);
    border: 1px solid #f43f5e;
    padding: 3px 10px;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.3);
}

.feedback-badge-correct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.25);
    border: 1px solid #22c55e;
    padding: 3px 10px;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.feedback-badge-info {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #bae6fd;
    background: rgba(14, 165, 233, 0.25);
    border: 1px solid #0284c7;
    padding: 3px 10px;
    border-radius: 6px;
}

.feedback-note {
    font-size: 13.5px;
    line-height: 1.45;
    color: #e2e8f0;
    margin: 0;
}

/* Tactical Clue / Hint Box in Feedback */
.feedback-hint-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(180, 83, 9, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.08);
    border-radius: 10px;
    padding: 8px 12px;
    margin-top: 2px;
}

.feedback-hint-box .hint-lamp {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.2;
}

.feedback-hint-box .hint-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.feedback-hint-box .hint-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 800;
    color: #fbbf24;
    letter-spacing: 0.5px;
}

.feedback-hint-box .hint-body {
    font-size: 13px;
    line-height: 1.4;
    color: #fef3c7;
    margin: 0;
}

.feedback-recap-toggle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    color: #c084fc;
    cursor: pointer;
    text-decoration: underline;
    align-self: flex-start;
    transition: color 0.2s ease;
    margin-top: 2px;
}

.feedback-recap-toggle:hover {
    color: #e9d5ff;
}

/* =========================================================
   NEW BATTLE MECHANIC: MEMORY MATCH STYLES
========================================================= */

.memory-workspace-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 6px;
}

.memory-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.memory-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.memory-deck-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.5);
    border-radius: 5px;
    padding: 3px 8px;
    letter-spacing: 0.5px;
}

.memory-deck-tip {
    font-size: 13.5px;
    color: #bae6fd;
}

.memory-status-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.memory-progress-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 5px;
    padding: 3px 8px;
}

.memory-cards-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    max-height: 145px;
    overflow-y: auto;
    padding-right: 4px;
}

.memory-cards-grid::-webkit-scrollbar {
    width: 6px;
}
.memory-cards-grid::-webkit-scrollbar-thumb {
    background: #634394;
    border-radius: 4px;
}

.memory-card {
    perspective: 800px;
    height: 64px;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.35s ease;
    transform-style: preserve-3d;
    border-radius: 8px;
}

.memory-card.is-flipped .memory-card-inner,
.memory-card.is-matched .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
}

/* Face Down */
.memory-card-front {
    background: linear-gradient(135deg, rgba(30, 20, 55, 0.95), rgba(16, 10, 32, 0.95));
    border: 1.5px solid #5a3c88;
    color: #a78bfa;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    font-weight: 700;
}

.memory-card-front:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.memory-card-front .card-emblem {
    font-size: 18px;
}

/* Face Up (Revealed) */
.memory-card-back {
    background: linear-gradient(135deg, rgba(40, 26, 75, 0.95), rgba(22, 14, 45, 0.95));
    border: 1.5px solid var(--theme-primary, #a855f7);
    color: #ffffff;
    transform: rotateY(180deg);
    line-height: 1.25;
    word-break: break-word;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.memory-card.is-matched {
    pointer-events: none;
}

.memory-card.is-matched .memory-card-back {
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.92), rgba(4, 47, 46, 0.95));
    border: 2px solid #10b981;
    color: #6ee7b7;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.55);
}

.memory-card.is-wrong .memory-card-back {
    border-color: #ef4444;
    background: rgba(69, 10, 10, 0.92);
    color: #fca5a5;
    animation: cardShake 0.4s ease;
}

@keyframes cardShake {
    0%, 100% { transform: rotateY(180deg) translateX(0); }
    25% { transform: rotateY(180deg) translateX(-4px); }
    75% { transform: rotateY(180deg) translateX(4px); }
}

/* =========================================================
   NEW BATTLE MECHANIC: SPOT THE BUG STYLES
========================================================= */

.spotbug-workspace-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 6px;
}

.spotbug-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.spotbug-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spotbug-deck-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid rgba(244, 63, 94, 0.5);
    border-radius: 5px;
    padding: 3px 8px;
    letter-spacing: 0.5px;
}

.spotbug-deck-tip {
    font-size: 13.5px;
    color: #fecdd3;
}

.spotbug-target-badge-wrap {
    display: flex;
    align-items: center;
}

.spotbug-target-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 5px;
    padding: 3px 8px;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.spotbug-target-pill.has-target {
    color: #ffffff;
    background: #e11d48;
    border-color: #f43f5e;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.6);
    animation: pulseTarget 1.5s infinite;
}

@keyframes pulseTarget {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.02); }
}

.spotbug-code-lines-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 4px;
    max-height: 145px;
}

.spotbug-code-lines-list::-webkit-scrollbar {
    width: 6px;
}
.spotbug-code-lines-list::-webkit-scrollbar-thumb {
    background: #634394;
    border-radius: 4px;
}

.spotbug-line-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(24, 16, 46, 0.95);
    border: 1.5px solid #5a3c88;
    border-radius: 7px;
    padding: 6px 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.spotbug-line-item:hover {
    border-color: var(--theme-primary, #a855f7);
    background: rgba(38, 24, 72, 0.95);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.spotbug-line-item.is-selected {
    border-color: #f43f5e;
    background: rgba(76, 5, 25, 0.9);
    box-shadow: 0 0 16px rgba(244, 63, 94, 0.65);
}

.spotbug-line-no {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: #a78bfa;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(167, 139, 250, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
}

.spotbug-line-item.is-selected .spotbug-line-no {
    color: #ffffff;
    background: #e11d48;
    border-color: #f43f5e;
}

.spotbug-line-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13.5px;
    color: #f3e8ff;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-all;
}

.spotbug-target-icon {
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.15s;
    user-select: none;
}

.spotbug-line-item.is-selected .spotbug-target-icon {
    opacity: 1;
}

/* =========================================================
   RESPONSIVE ZOOM & PROPORTIONAL VIEWPORT SCALING
========================================================= */

@media (max-height: 720px) {
    #pokemon-battle-arena {
        height: clamp(280px, 42vh, 360px);
    }
    .pokemon-sprite.player-sprite,
    #player-sprite {
        max-height: clamp(90px, 14vh, 130px) !important;
    }
    .pokemon-sprite.enemy-sprite,
    #enemy-sprite {
        max-height: clamp(80px, 13vh, 120px) !important;
    }
    .parsons-blocks-list {
        max-height: clamp(140px, 20vh, 200px);
    }
    .pokemon-dialogue-pane {
        min-height: 140px;
    }
    .pokemon-command-pane,
    .parsons-command-pane {
        min-height: 160px;
    }
    .bughunt-quiz-workspace-container {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
    .quiz-broken-code-box {
        max-height: 90px;
    }
    .quiz-code-pre {
        max-height: 75px;
        font-size: 14.5px;
    }
    .quiz-option-card {
        padding: 4px 8px;
        min-height: 32px;
    }
    .option-code-snippet {
        font-size: 14px;
    }
}

/* =========================================================
   BUG HUNT // MULTIPLE CHOICE QUIZ WORKSPACE
========================================================= */

.bughunt-quiz-workspace-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 3px;
    animation: fadeIn 0.25s ease-out;
}

.bughunt-quiz-workspace-container::-webkit-scrollbar {
    width: 5px;
}
.bughunt-quiz-workspace-container::-webkit-scrollbar-track {
    background: rgba(15, 10, 25, 0.7);
    border-radius: 4px;
}
.bughunt-quiz-workspace-container::-webkit-scrollbar-thumb {
    background: #634394;
    border-radius: 4px;
}

.quiz-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 2px;
    flex-shrink: 0;
}

.quiz-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-deck-badge {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 5px;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(236, 72, 153, 0.35);
}

.quiz-deck-tip {
    font-size: 13.5px;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

.quiz-selected-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.indicator-label {
    color: #64748b;
    font-weight: 700;
}

.indicator-badge {
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.indicator-badge.none {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.indicator-badge.selected,
.indicator-badge.has-target {
    background: rgba(0, 210, 255, 0.2);
    color: #00d2ff;
    border: 1px solid #00d2ff;
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.4);
}

/* Broken Code Snippet Box */
.quiz-broken-code-box {
    background: #090d16;
    border: 1.5px solid rgba(239, 68, 68, 0.45);
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(239, 68, 68, 0.05);
    flex-shrink: 0;
}

.quiz-code-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.9);
    padding: 3px 8px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.25);
}

.code-bar-left {
    display: flex;
    align-items: center;
    gap: 5px;
}

.code-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.code-filename {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #94a3b8;
    margin-left: 2px;
}

.code-error-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 800;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.quiz-code-pre {
    margin: 0;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(14.5px, 1vw + 2px, 17px);
    line-height: 1.55;
    color: #fca5a5;
    overflow-y: auto;
    overflow-x: auto;
    background: transparent;
    max-height: clamp(80px, 12vh, 120px);
    white-space: pre-wrap;
    word-break: break-word;
}

.quiz-code-pre code {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* 4 Choices Grid */
.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .quiz-options-grid {
        grid-template-columns: 1fr;
    }
}

.quiz-option-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1.5px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    padding: 4px 8px;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    position: relative;
    user-select: none;
}

.quiz-option-card:hover {
    border-color: rgba(0, 210, 255, 0.7);
    background: rgba(0, 210, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 210, 255, 0.2);
}

.quiz-option-card.selected {
    border-color: #00d2ff !important;
    background: rgba(0, 210, 255, 0.16) !important;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.35) !important;
    transform: translateY(-1px);
}

.option-badge-col {
    flex-shrink: 0;
}

.option-letter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.2);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 800;
    transition: all 0.15s;
    flex-shrink: 0;
}

.quiz-option-card:hover .option-letter-badge {
    border-color: #00d2ff;
    color: #00d2ff;
}

.quiz-option-card.selected .option-letter-badge {
    background: #00d2ff;
    color: #0b1120;
    border-color: #00d2ff;
    box-shadow: 0 0 6px #00d2ff;
}

.option-content-col {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.option-code-snippet {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(14px, 0.95vw + 2px, 16px);
    line-height: 1.45;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    background: transparent;
    display: block;
}

.quiz-option-card.selected .option-code-snippet {
    color: #ffffff;
    font-weight: 600;
}

.option-check-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    flex-shrink: 0;
    transition: all 0.15s;
}

.quiz-option-card.selected .option-check-circle {
    border-color: #00d2ff;
    background: #00d2ff;
    box-shadow: 0 0 6px #00d2ff;
}

.quiz-option-card.is-ruled-out {
    opacity: 0.35 !important;
    pointer-events: none !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

.quiz-option-card.is-ruled-out .option-letter-badge {
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
}

.quiz-option-card.is-ruled-out .option-code-snippet {
    text-decoration: line-through;
    color: #f87171 !important;
}



