/* CODEX - Spy Phonics Game */

/* Dyslexia-friendly font - Lexend (modern, clean, designed for readability) */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0a12;
    --bg-mid: #12121f;
    --bg-light: #1a1a2e;
    --accent: #00ff88;
    --accent-dim: #00aa55;
    --accent-glow: rgba(0, 255, 136, 0.4);
    --secondary: #00ccff;
    --secondary-glow: rgba(0, 204, 255, 0.4);
    --warning: #ff6b35;
    --error: #ff3366;
    --text: #e8e8e8;
    --text-dim: #666677;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    /* Dyslexia-friendly: Lexend - modern, clean, designed for readability */
    font-family: 'Lexend', Verdana, Arial, sans-serif;
    letter-spacing: 0.02em;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Screens */
.screen {
    position: absolute;
    inset: 0;
    display: none;
}

.screen.active {
    display: block;
}

/* ============ PLATFORMER ============ */

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

#game-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    pointer-events: none;
}

.glyphs-known {
    display: flex;
    gap: 8px;
}

.glyph-badge {
    width: 40px;
    height: 40px;
    background: var(--bg-light);
    border: 2px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Touch Controls */
#touch-controls {
    position: absolute;
    bottom: 30px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.touch-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.1s;
}

.touch-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

#btn-jump {
    position: absolute;
    right: 20px;
    bottom: 0;
}

#btn-left {
    margin-right: 10px;
}

/* Hide touch controls on desktop */
@media (hover: hover) and (pointer: fine) {
    #touch-controls {
        display: none;
    }
}

/* ============ TRAINING SCREEN ============ */

#training-screen {
    background: var(--bg-dark);
    background-image: url('images/command-center.png');
    background-size: cover;
    background-position: center;
    display: none;
    flex-direction: column;
}

#training-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 18, 0.92);
    pointer-events: none;
    transition: background 0.8s ease;
}

/* Lights ON - reveal the command center background */
#training-screen.lights-on::before {
    background: rgba(10, 10, 18, 0.3);
}

/* Transparent background when showing decoded symbol - just the letter, nothing else */
#training-screen[data-show-decoded="true"]::before {
    display: none !important;
    content: none !important;
}

#training-screen.active {
    display: flex;
}

/* ============ CUTSCENE SCREEN ============ */

#cutscene-screen {
    background: var(--bg-dark);
    background-image: url('images/command-center.png');
    background-size: cover;
    background-position: center;
    display: none;
}

#cutscene-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 18, 0.95);
    pointer-events: none;
}

#cutscene-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cutscene-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cutscene-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: cutscene-fade-in 0.5s ease-out;
}

@keyframes cutscene-fade-in {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cutscene-decoder-ring {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cutscene-ring {
    position: relative;
    width: 180px;
    height: 180px;
    animation: pulse-glow 2s infinite ease-in-out;
}

.cutscene-amplifier {
    font-size: 80px;
    width: 150px;
    height: 150px;
    animation: pulse-glow 2s infinite ease-in-out;
}

.cutscene-help {
    font-size: 60px;
    width: 120px;
    height: 120px;
    animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

.cutscene-skip {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 48px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 20px 40px;
    border: 2px solid var(--text-dim);
    border-radius: 50%;
    transition: all 0.2s;
}

.cutscene-skip:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.cutscene-ready {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.cutscene-start {
    font-size: 64px;
    color: var(--accent);
    cursor: pointer;
    padding: 30px 50px;
    border: 3px solid var(--accent);
    border-radius: 50%;
    animation: pulse-glow 1.5s infinite ease-in-out;
    transition: all 0.2s;
}

.cutscene-start:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent-glow);
}

.training-hud {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.training-hud .help-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-35%);
}

.progress-dots {
    display: flex;
    gap: 12px;
}

.progress-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    transition: all 0.3s;
}

.progress-dot.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.progress-dot.complete {
    background: var(--accent);
    border-color: var(--accent);
}

.training-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 0; /* Allow flex shrinking */
}

/* Phase intro - audio only, just a tap-to-start button */
.phase-intro {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 18, 0.95);
    z-index: 100;
}

.tap-to-start {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 0 30px var(--accent-glow);
    animation: pulse-tap 1.5s ease-in-out infinite;
}

@keyframes pulse-tap {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px var(--accent-glow); }
    50% { transform: scale(1.1); box-shadow: 0 0 50px var(--accent-glow); }
}

.tap-to-start:active {
    transform: scale(0.95);
    animation: none;
}

.tap-icon {
    font-size: 50px;
    color: var(--bg-dark);
    margin-left: 8px; /* Optical centering for play icon */
}

/* Training Phase: Sound Introduction */
.sound-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.sound-symbol {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.sound-symbol-char {
    font-size: 140px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 40px var(--accent-glow);
    transition: transform 0.1s, text-shadow 0.1s;
    text-transform: lowercase;
}

.sound-symbol:active .sound-symbol-char {
    transform: scale(1.1);
    text-shadow: 0 0 60px var(--accent-glow), 0 0 80px var(--accent-glow);
}

.sound-symbol-ring {
    position: absolute;
    width: 180px;
    height: 180px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    opacity: 0;
}

.sound-symbol.playing .sound-symbol-ring {
    animation: ring-pulse 0.6s ease-out;
}

@keyframes ring-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

.tap-counter {
    display: flex;
    gap: 10px;
}

.tap-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    transition: all 0.2s;
}

.tap-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Training Phase: Sound Matching */
.match-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.match-target {
    width: 100px;
    height: 100px;
    background: var(--bg-mid);
    border: 3px dashed var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.match-target-ring {
    position: absolute;
    inset: -10px;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    opacity: 0.5;
    animation: target-pulse 2s ease-in-out infinite;
}

@keyframes target-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.2; }
}

.match-target-label {
    font-size: 40px;
    color: var(--secondary);
}

.match-target.correct {
    border-color: var(--accent);
    border-style: solid;
    background: rgba(0, 255, 136, 0.2);
}

.match-target.correct .match-target-label {
    color: var(--accent);
}

.match-target.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.match-hint {
    font-size: 14px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.match-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 400px;
}

.match-option {
    width: 120px;
    height: 120px;
    background: var(--bg-mid);
    border: 3px solid var(--text-dim);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.match-option::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, var(--secondary-glow) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.2s;
}

.match-option:active::before {
    opacity: 1;
}

.match-option.selected {
    border-color: var(--secondary);
    box-shadow: 0 0 20px var(--secondary-glow);
    transform: scale(1.05);
}

.match-option-icon {
    font-size: 50px;
}

.match-option.correct {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.15);
    animation: correct-pulse 0.4s ease;
}

.match-option.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

@keyframes correct-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

@keyframes pulse-highlight {
    0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
    50% { box-shadow: 0 0 25px var(--accent-glow), 0 0 40px var(--accent-glow); }
}

/* Training Phase: Find in Context */
.context-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.word-display {
    display: flex;
    gap: 8px;
    padding: 30px;
    background: var(--bg-mid);
    border-radius: 15px;
}

.word-letter {
    width: 60px;
    height: 70px;
    background: var(--bg-light);
    border: 3px solid var(--text-dim);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: lowercase;
}

.word-letter:active {
    transform: scale(0.95);
}

.word-letter.found {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.word-letter.wrong {
    animation: shake 0.3s ease;
    border-color: var(--error);
}

/* Training Phase: Grid Hunt */
.hunt-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    background: var(--bg-mid);
    border-radius: 15px;
}

.hunt-cell {
    width: 55px;
    height: 55px;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: lowercase;
}

.hunt-cell:active {
    transform: scale(0.9);
}

.hunt-cell.found {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.hunt-cell.wrong {
    animation: shake 0.3s ease;
    border-color: var(--error);
}

/* Training Phase: Moving Targets */
.intercept-arena {
    width: 100%;
    max-width: 700px;
    height: 450px;  /* Much taller for more movement */
    background: var(--bg-mid);
    border: 2px solid var(--text-dim);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.intercept-arena::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, var(--secondary-glow) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, var(--accent-glow) 0%, transparent 30%);
    opacity: 0.3;
}

.intercept-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 10px;
    z-index: 20;
}

.freeze-btn {
    padding: 10px 20px;
    background: rgba(0, 150, 255, 0.3);
    border: 3px solid #00ccff;
    border-radius: 25px;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.freeze-btn:hover {
    background: rgba(0, 150, 255, 0.5);
}

.freeze-btn:active {
    transform: scale(0.95);
}

.intercept-arena.frozen {
    background: rgba(0, 150, 255, 0.1);
}

.intercept-arena.frozen .intercept-target {
    border-color: #88ddff;
    box-shadow: 0 0 20px rgba(136, 221, 255, 0.6);
}

.intercept-target {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: bold;
    color: #ffffff !important;
    cursor: pointer;
    transition: transform 0.1s;
    text-transform: lowercase;
    z-index: 1;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.7);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.4);
}

/* Targets should look identical to distractors - no visual hint */

.intercept-target:active,
.intercept-target.tapped {
    transform: scale(0.8);
    background: var(--bg-mid);
    border-color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary-glow);
}

.intercept-target.caught {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    animation: caught 0.4s ease forwards;
}

@keyframes caught {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); }
    100% { transform: scale(0); opacity: 0; }
}

.intercept-target.missed {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

/* Training Phase: Quick Drill */
.drill-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.drill-option {
    width: 110px;
    height: 110px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 3px solid #00ddff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
}

.drill-option:active {
    transform: scale(0.95);
    background: var(--bg-light);
}

.drill-option.correct {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 30px var(--accent-glow);
}

.drill-option.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

/* Training Phase: Blending (DI-style touch-and-blend) */
.blend-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    height: 100%;
    padding: 20px;
}

.blend-phase-label {
    font-size: 18px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    min-height: 24px;
}

.blend-word-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.blend-word {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.blend-letter {
    width: 85px;
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 55px;
    font-weight: bold;
    color: #ffffff;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 18px;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
    transition: all 0.2s;
    position: relative;
    cursor: default;
    user-select: none;
}

.blend-letter.blend-touchable {
    cursor: pointer;
    animation: pulse-glow 2s infinite;
}

.blend-letter.blend-touchable:hover {
    transform: scale(1.05);
    border-color: var(--secondary);
}

.blend-letter.blend-touched {
    background: var(--secondary);
    border-color: var(--secondary);
    transform: scale(1.1);
    animation: none;
}

.blend-letter.blend-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    text-shadow: none;
    box-shadow: 0 0 25px var(--accent-glow);
    transform: scale(1.05);
}

.blend-letter.blend-complete {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

/* Next letter to tap (left-to-right guidance) */
.blend-letter.blend-next {
    cursor: pointer;
    border-color: var(--secondary);
    box-shadow: 0 0 20px var(--secondary-glow);
    animation: pulse-glow 1.5s infinite;
}

/* Hint flash when tapping out of order */
.blend-letter.blend-hint {
    animation: hint-flash 0.3s ease-out;
}

@keyframes hint-flash {
    0%, 100% { border-color: #00ddff; }
    50% { border-color: #ff6b6b; box-shadow: 0 0 30px rgba(255, 100, 100, 0.6); }
}

/* Error flash on wrong letter tap */
.blend-letter.blend-error {
    animation: error-flash 0.4s ease-out;
}

@keyframes error-flash {
    0%, 100% { background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%); }
    50% { background: rgba(255, 50, 50, 0.5); border-color: #ff4444; box-shadow: 0 0 30px rgba(255, 50, 50, 0.8); }
}

/* Left-to-right arrow indicator */
.blend-arrow {
    position: absolute;
    top: -50px;
    left: 0;
    font-size: 36px;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary-glow);
    transform: translateX(-50%);
    opacity: 0;
    transition: left 0.3s ease, opacity 0.2s;
    pointer-events: auto;
    cursor: pointer;
}

.blend-arrow.visible {
    opacity: 1;
    animation: arrow-bounce 0.8s infinite;
}

@keyframes arrow-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

.letter-check {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 16px;
    color: var(--accent);
}

/* Underline for blending */
.blend-underline {
    width: 100%;
    height: 6px;
    background: var(--bg-mid);
    border-radius: 3px;
    margin-top: 10px;
    transition: all 0.3s;
}

.blend-underline.blend-ready {
    background: var(--secondary);
    box-shadow: 0 0 10px var(--secondary-glow);
}

.blend-underline.blend-complete {
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Arrow/finger for sliding - REMOVED: conflicted with blend-arrow positioning */

/* Result display */
.blend-result {
    font-size: 48px;
    font-weight: bold;
    color: var(--accent);
    text-transform: lowercase;
    letter-spacing: 4px;
}

.blend-result.blend-success {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Winch Blend Machine */
.winch-machine {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
}

.winch-crank {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle at 30% 30%, #1a3050, #0d1a2a);
    border-radius: 50%;
    border: 4px solid #00ddff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.6s ease;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
}

.winch-crank::before {
    content: '';
    width: 20px;
    height: 6px;
    background: #00ddff;
    border-radius: 3px;
}

.winch-crank.activated {
    transform: rotate(360deg);
}

.winch-arm {
    width: 50px;
    height: 8px;
    background: linear-gradient(to bottom, #00ddff, #0088aa);
    border-radius: 4px;
    transition: width 0.6s ease;
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.4);
}

.winch-arm.activated {
    width: 8px;
}

.winch-letters {
    display: flex;
    justify-content: center;
    gap: 60px;
    transition: gap 0.6s ease;
    position: relative;
}

.winch-letters.squished {
    gap: 5px;
}

/* Arrow for guided mode - points down at target letter */
.winch-letters .blend-arrow {
    position: absolute;
    top: -50px;
    font-size: 36px;
    color: var(--secondary);
    text-shadow: 0 0 15px var(--secondary-glow);
    animation: arrow-bounce-down 0.8s infinite;
    transition: all 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.winch-letters .blend-arrow.visible {
    opacity: 1;
}

@keyframes arrow-bounce-down {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* Arrow pointing at right winch - flows left to right */
.winch-letters .blend-arrow.point-at-winch {
    left: auto !important;
    right: -70px !important;
    top: 50%;
    transform: translateY(-50%);
    animation: arrow-bounce-right 0.8s infinite;
}

@keyframes arrow-bounce-right {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(8px); }
}

.winch-letter {
    width: 85px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 55px;
    font-family: 'Lexend', sans-serif;
    font-weight: bold;
    color: #ffffff;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 18px;
    text-transform: lowercase;
    opacity: 0.5;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
}

.winch-letter.active {
    opacity: 1;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
    border-color: var(--accent);
    box-shadow: 0 0 25px var(--accent-glow);
}

/* Tappable letter - pulsing to indicate clickable */
.winch-letter.blend-next {
    opacity: 0.8;
    cursor: pointer;
    animation: pulse-glow 1.5s infinite;
    border-color: var(--secondary);
    box-shadow: 0 0 20px var(--secondary-glow);
}

/* Winch crank ready to click */
.winch-crank.blend-next {
    cursor: pointer;
    animation: pulse-glow 1.5s infinite;
    border-color: var(--secondary);
    box-shadow: 0 0 25px var(--secondary-glow);
}

/* Error flash on wrong letter tap */
.winch-letter.blend-error {
    animation: error-flash 0.4s ease-out;
}

/* Hint flash */
.winch-letter.blend-hint {
    animation: hint-flash 0.3s ease-out;
}

/* Replay/Continue choice buttons */
.blend-choice-buttons {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 30px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.blend-choice-buttons.visible {
    opacity: 1;
}

.blend-choice-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    color: var(--accent);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px var(--accent-glow);
}

.blend-choice-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px var(--accent-glow);
}

.blend-choice-btn.continue-btn {
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary-glow);
    animation: pulse-glow 1.5s infinite;
}

.blend-choice-btn.continue-btn:hover {
    box-shadow: 0 0 25px var(--secondary-glow);
}

/* Play button for blending */
.blend-play-btn {
    width: 80px;
    height: 80px;
    margin-top: 30px;
    font-size: 36px;
    color: var(--bg-dark);
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 20px var(--accent-glow);
    animation: pulse-glow 2s infinite;
}

.blend-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent-glow);
}

.blend-play-btn.hidden {
    display: none;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(0, 200, 255, 0.35); }
    50% { box-shadow: 0 0 25px rgba(0, 200, 255, 0.6); }
}

/* Legacy blend choices (for future picture-based check) */
.blend-choices {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.blend-choices.hidden {
    display: none;
}

.blend-choice {
    padding: 15px 30px;
    font-size: 32px;
    font-weight: bold;
    color: var(--text);
    background: var(--bg-mid);
    border: 3px solid var(--text-dim);
    border-radius: 15px;
    cursor: pointer;
    text-transform: lowercase;
    transition: all 0.2s;
}

.blend-choice:hover {
    border-color: var(--secondary);
}

.blend-choice.correct {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 25px var(--accent-glow);
}

.blend-choice.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.blend-choice.was-correct {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

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

/* ============ COMPREHENSION TEST ============ */
/* Scene-based test: decode the "note" and click on the item */

.comprehension-test {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 15px;
    height: 100%;
}

.scene-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--secondary);
    box-shadow: 0 4px 25px rgba(0, 200, 255, 0.3);
    cursor: crosshair;
}

.scene-image {
    width: 100%;
    height: auto;
    display: block;
}

/* The "note" with letters */
.note-container {
    background: linear-gradient(135deg, #2a2a1a 0%, #1a1a10 100%);
    border: 2px solid #8b7355;
    border-radius: 8px;
    padding: 15px 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.note-letters {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.note-letter {
    width: 60px;
    height: 70px;
    background: var(--bg-mid);
    border: 3px solid var(--secondary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: bold;
    color: var(--text);
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 0 10px var(--secondary-glow);
}

.note-letter:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.note-letter-active {
    background: var(--secondary);
    color: var(--bg-dark);
    transform: scale(1.1);
}

/* Click markers */
.click-marker {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    transform: translate(-50%, -50%);
    animation: popIn 0.3s ease-out;
    pointer-events: none;
}

.click-marker.correct {
    background: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 30px var(--accent-glow);
}

.click-marker.incorrect {
    background: var(--error);
    color: white;
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.5);
}

/* Highlight correct region when wrong */
.correct-region {
    position: absolute;
    border: 4px solid var(--accent);
    border-radius: 8px;
    background: rgba(0, 255, 136, 0.2);
    animation: pulse-border 1s infinite;
    pointer-events: none;
}

@keyframes popIn {
    from { transform: translate(-50%, -50%) scale(0); }
    to { transform: translate(-50%, -50%) scale(1); }
}

@keyframes pulse-border {
    0%, 100% { border-color: var(--accent); }
    50% { border-color: var(--secondary); }
}

/* Target word display - shown prominently above scene */
.target-word-display {
    font-size: 72px;
    font-weight: bold;
    color: var(--text);
    text-transform: lowercase;
    text-align: center;
    padding: 20px 40px;
    background: var(--bg-mid);
    border: 3px solid var(--secondary);
    border-radius: 12px;
    box-shadow: 0 0 20px var(--secondary-glow);
    letter-spacing: 8px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.target-word-display.pulse,
.blend-word-container.pulse {
    animation: wordPulse 0.6s ease-in-out 3;
}

@keyframes wordPulse {
    0%, 100% {
        transform: scale(1);
        border-color: var(--secondary);
        box-shadow: 0 0 20px var(--secondary-glow);
    }
    50% {
        transform: scale(1.05);
        border-color: var(--accent);
        box-shadow: 0 0 40px var(--accent-glow);
    }
}

/* Correct region pulse animation for remediation */
.correct-region.pulse {
    animation: regionPulse 0.6s ease-in-out 3;
}

@keyframes regionPulse {
    0%, 100% {
        background: rgba(0, 255, 136, 0.2);
        border-width: 4px;
    }
    50% {
        background: rgba(0, 255, 136, 0.5);
        border-width: 6px;
    }
}

/* Mission intro area - empty during audio */
.mission-intro-area {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Comprehension test word - positioned above scene */
.comprehension-word {
    margin-bottom: 15px;
}

/* Scene wrapper for magnifying glass positioning */
.scene-wrapper {
    position: relative;
    width: 100%;
    max-width: 700px;
}

/* Magnifying glass button */
.magnify-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--secondary);
    background: var(--bg-mid);
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.magnify-btn:hover {
    transform: scale(1.1);
    border-color: var(--accent);
}

.magnify-btn.active {
    background: var(--secondary);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--secondary-glow);
}

/* Explore mode cursor */
.scene-container.explore-mode {
    cursor: zoom-in;
}

.scene-container.explore-mode .scene-image {
    filter: brightness(1.1);
}

/* Success Screen */
.success-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.success-badge {
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 50px var(--accent-glow);
    animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% { box-shadow: 0 0 50px var(--accent-glow); }
    50% { box-shadow: 0 0 80px var(--accent-glow), 0 0 100px var(--secondary-glow); }
}

.success-symbol {
    font-size: 80px;
    font-weight: bold;
    color: var(--bg-dark);
    text-transform: lowercase;
}

.continue-btn {
    padding: 20px 50px;
    background: transparent;
    border: 3px solid var(--accent);
    border-radius: 50px;
    color: var(--accent);
    font-size: 18px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.continue-btn:hover, .continue-btn:active {
    background: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* ============ AUDIO INDICATOR ============ */

#audio-indicator {
    position: fixed;
    bottom: 20px;
    left: 20px;
    transform: none;
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    border: 2px solid var(--secondary);
    z-index: 1000;
}

#audio-indicator.hidden {
    display: none;
}

.audio-wave {
    width: 4px;
    height: 20px;
    background: var(--secondary);
    border-radius: 2px;
    animation: wave 0.5s ease-in-out infinite;
}

.audio-wave:nth-child(2) { animation-delay: 0.1s; }
.audio-wave:nth-child(3) { animation-delay: 0.2s; }

@keyframes wave {
    0%, 100% { height: 10px; }
    50% { height: 25px; }
}

/* ============ TAP PROMPT ============ */

#tap-prompt {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

#tap-prompt.hidden {
    display: none;
}

.tap-circle {
    width: 100px;
    height: 100px;
    border: 4px solid var(--accent);
    border-radius: 50%;
    animation: tap-pulse 1s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 136, 0.15);
}

.tap-circle::after {
    content: '▶';
    font-size: 40px;
    color: var(--accent);
}

@keyframes tap-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.5; }
}

/* ============ PHASE 1: ACQUISITION (Decoder Ring) ============ */

.acquisition-area {
    position: relative;
    height: 100%;
    width: 100%;
    min-height: 300px;
}

.decrypt-progress {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    padding: 12px 20px;
    border-radius: 25px;
}

.decrypt-bar {
    width: 45px;
    height: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    transition: all 0.2s;
}

.decrypt-bar.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.target-sigil {
    position: absolute;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    font-weight: bold;
    color: #ffffff !important;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 50%;
    text-transform: lowercase;
    text-shadow: 0 0 8px rgba(0, 220, 255, 0.8);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.target-sigil.decoding {
    transform: scale(1.15);
    border-color: var(--accent);
    box-shadow:
        0 0 60px var(--accent-glow),
        inset 0 0 40px rgba(0, 255, 136, 0.3);
}

.target-sigil.decoded {
    border-color: var(--accent);
    box-shadow: 0 0 80px var(--accent-glow);
    animation: pulse-glow 0.5s ease infinite;
}

.decoder-ring {
    position: absolute;
    width: 150px;
    height: 150px;
    cursor: grab;
    z-index: 20;
    transition: transform 0.1s;
    /* CSS-only decoder ring - no image needed */
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%,
            rgba(0, 220, 255, 0.3) 0%,
            transparent 40%),
        conic-gradient(from 0deg,
            #0a1520, #1a3050, #0a1520, #1a3050,
            #0a1520, #1a3050, #0a1520, #1a3050);
    border: 6px solid;
    border-color: #00ddff #006688 #00ddff #006688;
    box-shadow:
        0 0 20px rgba(0, 220, 255, 0.5),
        inset 0 0 30px rgba(0, 220, 255, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.decoder-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, #00ddff 0%, #004466 50%, #001122 100%);
    border: 3px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.8);
}

.decoder-ring::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border-radius: 50%;
    border: 2px dashed rgba(0, 220, 255, 0.4);
}

.decoder-ring.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    box-shadow:
        0 0 40px rgba(0, 255, 136, 0.7),
        inset 0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    border-color: #00ff88 #00aa55 #00ff88 #00aa55;
}

.ring-img {
    display: none; /* Hide the image, using CSS ring instead */
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 40px var(--accent-glow); }
    50% { box-shadow: 0 0 80px var(--accent-glow); }
}

/* ============ PHASE 1b: INTERCEPTED TRANSMISSION ============ */

.transmission-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    gap: 20px;
}

.transmission-header {
    font-size: 18px;
    font-weight: bold;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--secondary);
    border-radius: 5px;
    text-shadow: 0 0 10px var(--secondary);
}

.transmission-header.decoded {
    color: var(--accent);
    border-color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
    animation: pulse-glow 0.5s ease infinite;
}

.transmission-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 20px;
    background: linear-gradient(135deg, #0a1520 0%, #1a2a3a 50%, #0a1520 100%);
    border: 3px solid var(--secondary);
    border-radius: 10px;
    box-shadow:
        0 0 20px rgba(0, 200, 255, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    max-width: 360px;
}

/* When showing decoded symbol, remove grid styling */
.transmission-grid:has(.decoded-reveal) {
    display: flex;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: none;
}

.transmission-cell {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: rgba(0, 200, 255, 0.7);
    background: rgba(0, 50, 80, 0.3);
    border: 2px solid rgba(0, 150, 200, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.transmission-cell.distractor {
    color: rgba(100, 150, 180, 0.5);
}

.transmission-cell.scramble {
    color: rgba(0, 200, 255, 0.4);
    animation: flicker 0.1s linear infinite;
}

.transmission-grid.scrambling {
    opacity: 0.8;
}

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

.transmission-cell.target {
    color: rgba(0, 220, 255, 0.8);
}

.transmission-cell:active,
.transmission-cell.tapped {
    transform: scale(0.9);
}

.transmission-cell.found {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 15px var(--accent-glow);
}

.transmission-cell.wrong {
    animation: shake 0.3s ease;
    border-color: var(--error);
}

.transmission-progress {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.progress-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 200, 255, 0.2);
    border: 2px solid rgba(0, 200, 255, 0.5);
    transition: all 0.2s;
}

.progress-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.decoded-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.decoded-symbol {
    font-size: 120px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
    animation: pulse-glow 0.5s ease infinite;
}

/* Overlay for showing decoded letter over the transmission grid */
.decoded-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 10;
    pointer-events: none;
    animation: fadeIn 0.4s ease;
}

.decoded-letter {
    font-size: 150px;
    font-weight: bold;
    color: var(--secondary);
    text-shadow:
        0 0 10px var(--secondary),
        0 0 30px var(--secondary-glow);
    animation: decoded-pulse 2s ease-in-out infinite;
    transition: all 0.6s ease-in-out;
}

/* Coin image version of decoded letter */
.decoded-coin {
    width: 280px;
    height: auto;
    filter: drop-shadow(0 0 20px var(--secondary)) drop-shadow(0 0 40px var(--secondary-glow));
    animation: coin-pulse 2s ease-in-out infinite;
    transition: all 0.6s ease-in-out;
}

@keyframes coin-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 20px var(--secondary)) drop-shadow(0 0 40px var(--secondary-glow));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 30px var(--secondary)) drop-shadow(0 0 60px var(--secondary-glow));
        transform: scale(1.03);
    }
}

.decoded-coin.fly-to-codex {
    animation: flyToCodex 0.7s ease-in forwards;
}

@keyframes decoded-pulse {
    0%, 100% {
        text-shadow:
            0 0 10px var(--secondary),
            0 0 30px var(--secondary-glow);
        transform: scale(1);
    }
    50% {
        text-shadow:
            0 0 15px var(--secondary),
            0 0 40px var(--secondary-glow);
        transform: scale(1.02);
    }
}

/* Flying animation to codex */
.decoded-letter.fly-to-codex {
    animation: flyToCodex 0.7s ease-in forwards;
}

@keyframes flyToCodex {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    50% {
        transform: scale(0.6) translate(30vw, -10vh);
        opacity: 1;
    }
    100% {
        transform: scale(0.2) translate(45vw, -20vh);
        opacity: 0;
    }
}

/* Codex receive flash */
.codex-toggle.codex-receive {
    animation: codexReceive 0.6s ease;
}

@keyframes codexReceive {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow);
        background: var(--accent);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.codex-message {
    font-size: 18px;
    color: var(--accent);
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ============ PHASE 2: SIGNAL HUNT ============ */

.signal-hunt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 30px;
}

.hunt-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.hunt-option {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: bold;
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
}

.hunt-option:active,
.hunt-option.tapped {
    transform: scale(0.9);
    background: var(--bg-light);
    border-color: var(--secondary);
}

.hunt-option.correct {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* DI correction highlight - pulsing to draw attention */
.di-highlight {
    animation: di-pulse 0.6s ease-in-out infinite;
    border-color: var(--accent) !important;
    box-shadow: 0 0 30px var(--accent-glow) !important;
}

@keyframes di-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.hunt-option.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

/* ============ CHASE GAME (replaces Signal Hunt) ============ */

.chase-game {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chase-scene {
    position: relative;
    width: 100%;
    height: 100%;
    background: url('images/backdrops/chase_scene.png') center/cover no-repeat;
}

/* Review level uses different backdrop with enforced aspect ratio.
   Container aspect ratio matches image exactly so paths align correctly.
   The paths in the editor were drawn at this aspect ratio. */
.chase-scene.review-backdrop {
    background: url('images/backdrops/Gemini_Generated_Image_d9wf55d9wf55d9wf.png') center/cover no-repeat;
    aspect-ratio: 2528 / 1696;
    width: auto;
    height: 100%;
    max-width: 100%;
}

/* Chase Variant 2: City Street Scene */
.chase-scene.review-backdrop-v2 {
    background: url('images/backdrops/Gemini_Generated_Image_z353lxz353lxz353.png') center/cover no-repeat;
    aspect-ratio: 2816 / 1536;
    width: auto;
    height: 100%;
    max-width: 100%;
}

.chase-agent {
    position: absolute;
    transform: translate(-50%, -100%);
    transition: opacity 0.15s;
    cursor: pointer;
    z-index: 10;
}

/* Expand clickable area beyond visual bounds using pseudo-element */
.chase-agent::after {
    content: '';
    position: absolute;
    inset: -15px;
    z-index: 1;
}

.chase-agent.hidden {
    opacity: 0;
    pointer-events: none;
}

.chase-agent.caught {
    animation: agent-caught 0.3s ease-out forwards;
}

@keyframes agent-caught {
    0% { transform: translate(-50%, -100%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -100%) scale(1.3); opacity: 0.8; }
    100% { transform: translate(-50%, -100%) scale(0); opacity: 0; }
}

.chase-agent.wrong {
    animation: agent-wrong 0.3s ease;
}

@keyframes agent-wrong {
    0%, 100% { filter: none; }
    50% { filter: brightness(0.5) sepia(1) saturate(10) hue-rotate(-50deg); }
}

.chase-agent-silhouette {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    transition: transform 0.1s;
}

.chase-agent-silhouette.frame1 {
    background-image: url('images/characters/silhouettes/runner_frame1_cropped.png');
}

.chase-agent-silhouette.frame2 {
    background-image: url('images/characters/silhouettes/runner_frame2_cropped.png');
}

.chase-agent-silhouette.crouch {
    background-image: url('images/characters/silhouettes/crouch_cropped.png');
}

.chase-agent-silhouette.facing-left {
    transform: scaleX(-1);
}

.chase-agent-badge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 200, 255, 0.9);
    color: #000;
    font-size: 18px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: lowercase;
    pointer-events: none;
}

.chase-progress {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
}

.chase-progress-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 220, 255, 0.5);
}

.chase-progress-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.chase-sound-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Competitive Chase Scores */
.competitive-scores {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 12px;
    border-radius: 12px;
}

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

.score-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    text-transform: lowercase;
}

.player-badge {
    background: #2196F3;
    color: white;
    border: 2px solid #64B5F6;
}

.ai-badge {
    background: #f44336;
    color: white;
    border: 2px solid #ef9a9a;
}

.score-dots {
    display: flex;
    gap: 4px;
}

.score-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.player-score-dot.filled {
    background: #2196F3;
    border-color: #64B5F6;
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.6);
}

.ai-score-dot.filled {
    background: #f44336;
    border-color: #ef9a9a;
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.6);
}

/* AI caught animation - red flash */
.chase-agent.ai-caught {
    animation: ai-catch 0.3s ease-out forwards;
}

@keyframes ai-catch {
    0% { transform: translate(-50%, -100%) scale(1); filter: none; }
    50% { transform: translate(-50%, -100%) scale(1.2); filter: brightness(1.5) sepia(1) saturate(5) hue-rotate(-50deg); }
    100% { transform: translate(-50%, -100%) scale(0); opacity: 0; }
}

/* ============ PHASE 3: BADGE CHECK ============ */

/* Fullscreen backdrop for badge check - covers entire viewport including HUD */
.badge-check-backdrop {
    position: fixed;
    inset: 0;
    background: url('images/checkpoint.png') center/cover no-repeat;
    z-index: 0;
}

.badge-check-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 18, 0.75);
}

.badge-check-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    /* Fill the training-content area */
    position: absolute;
    inset: 0;
    padding: 20px;
    z-index: 1;
}

.gate-status {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    z-index: 1;
}

.replay-sound-btn {
    width: 60px;
    height: 60px;
    background: var(--bg-mid);
    border: 3px solid var(--secondary);
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-sound-btn:active {
    background: var(--secondary);
    transform: scale(0.95);
}

/* Help button - plays phase instructions */
.help-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-mid);
    border: 2px solid var(--text-dim);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-btn:active {
    background: var(--text-dim);
    color: var(--bg-dark);
}

.agent-queue {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 1;
}

.agent-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px;
    background: var(--bg-mid);
    border: 3px solid var(--text-dim);
    border-radius: 20px;
    transition: all 0.4s ease;
}

.agent-card.approaching {
    transform: translateY(100px);
    opacity: 0;
}

.agent-silhouette {
    font-size: 60px;
    color: var(--text-dim);
}

.agent-badge {
    font-size: 52px;
    font-weight: bold;
    color: #fff;
    padding: 15px 25px;
    background: linear-gradient(135deg, #2a3a4a 0%, #1a2a3a 100%);
    border: 5px solid #00ccff;
    border-radius: 15px;
    text-transform: lowercase;
    box-shadow: 0 0 25px rgba(0, 204, 255, 0.5);
}

.agent-badge.double-badge {
    font-size: 42px;
    letter-spacing: 2px;  /* Minimal spacing to keep letters together as a word */
}

.agent-card.admitted {
    border-color: var(--accent);
    animation: slide-right 0.4s ease forwards;
}

.agent-card.admitted .agent-badge {
    border-color: var(--accent);
    color: var(--accent);
}

.agent-card.rejected {
    border-color: var(--warning);
    animation: slide-left 0.4s ease forwards;
}

.agent-card.wrong-decision {
    border-color: var(--error);
    animation: shake 0.3s ease forwards;
}

@keyframes slide-right {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(200px); opacity: 0; }
}

@keyframes slide-left {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(-200px); opacity: 0; }
}

.gate-controls {
    display: flex;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.gate-btn {
    padding: 25px 50px;
    border-radius: 15px;
    font-size: 32px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}

.gate-btn.reject {
    background: transparent;
    border: 3px solid var(--error);
    color: var(--error);
}

.gate-btn.reject:active,
.gate-btn.reject.tapped {
    background: var(--error);
    color: var(--bg-dark);
    transform: scale(0.95);
}

.gate-btn.admit {
    background: transparent;
    border: 3px solid var(--accent);
    color: var(--accent);
}

.gate-btn.admit:active,
.gate-btn.admit.tapped {
    background: var(--accent);
    color: var(--bg-dark);
    transform: scale(0.95);
}

.badge-score {
    font-size: 16px;
    color: var(--text-dim);
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.badge-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
    max-width: 300px;
}

.progress-bubble {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    transition: all 0.3s;
}

.progress-bubble.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ============ PHASE 4: GRID SWEEP ============ */

.grid-sweep {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.sweep-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    background: var(--bg-mid);
    border-radius: 15px;
}

.sweep-cell {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 3px solid #00ddff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: bold;
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    text-shadow: 0 0 5px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.35);
}

.sweep-cell:active,
.sweep-cell.tapped {
    transform: scale(0.85);
    background: var(--bg-mid);
    border-color: var(--secondary);
}

.sweep-cell.found {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.sweep-cell.wrong {
    animation: shake 0.3s ease;
    border-color: var(--error);
}

.sweep-counter {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.sweep-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--text-dim);
    transition: all 0.2s;
}

.sweep-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.sweep-replay {
    margin-bottom: 15px;
}

/* ============ PHASE 5: INTERCEPT ============ */

.intercept-replay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.intercept-progress {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: var(--bg-dark);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--text-dim);
    z-index: 10;
}

/* ============ PHASE 6: RAPID DECODE ============ */

.rapid-decode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.rapid-replay {
    margin-bottom: 10px;
}

.rapid-timer {
    width: 300px;
    height: 8px;
    background: var(--accent);
    border-radius: 4px;
    /* Animation applied via JS after audio plays, not here */
}

@keyframes timer-shrink {
    0% { width: 300px; background: var(--accent); }
    70% { background: var(--warning); }
    100% { width: 0; background: var(--error); }
}

.rapid-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.rapid-hidden {
    visibility: hidden;
    opacity: 0;
}

.rapid-option {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: bold;
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: lowercase;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.35);
}

.rapid-option:active,
.rapid-option.tapped {
    transform: scale(0.85);
    background: var(--bg-light);
    border-color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary-glow);
}

.rapid-option.correct {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.2);
    box-shadow: 0 0 25px var(--accent-glow);
}

.rapid-option.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.rapid-option.was-correct {
    border-color: var(--accent);
    animation: pulse-hint 0.5s ease;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============ PHASE 7: SOUND CONFIRM ============ */

.sound-confirm {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.confirm-sigil {
    font-size: 100px;
    font-weight: bold;
    color: #ffffff !important;
    text-transform: lowercase;
    padding: 35px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 25px;
    text-shadow: 0 0 8px rgba(0, 220, 255, 0.7);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
}

.confirm-question {
    font-size: 16px;
    color: var(--text-dim);
    text-align: center;
}

.confirm-buttons {
    display: flex;
    gap: 30px;
}

.confirm-btn {
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 20px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn.no {
    background: transparent;
    border: 3px solid var(--error);
    color: var(--error);
}

.confirm-btn.no:active,
.confirm-btn.no.tapped {
    background: var(--error);
    color: var(--bg-dark);
    transform: scale(0.95);
}

.confirm-btn.yes {
    background: transparent;
    border: 3px solid var(--accent);
    color: var(--accent);
}

.confirm-btn.yes:active,
.confirm-btn.yes.tapped {
    background: var(--accent);
    color: var(--bg-dark);
    transform: scale(0.95);
}

.confirm-btn.correct {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--bg-dark) !important;
    box-shadow: 0 0 20px var(--accent-glow);
}

.confirm-btn.incorrect {
    background: var(--error) !important;
    border-color: var(--error) !important;
    color: var(--bg-dark) !important;
}

/* ============ PHASE 8: SOUND MATCH ============ */

.sound-match {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.target-sigil-display {
    font-size: 80px;
    font-weight: bold;
    color: #ffffff;
    text-transform: lowercase;
    padding: 25px 40px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 4px solid #00ddff;
    border-radius: 20px;
    text-shadow: 0 0 8px rgba(0, 220, 255, 0.7);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.4);
}

.sound-agents {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.sound-agent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: var(--bg-mid);
    border: 3px solid var(--text-dim);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.sound-agent:hover {
    border-color: var(--secondary);
}

.sound-agent .agent-icon {
    font-size: 50px;
    color: var(--text);
}

.sound-agent .agent-speaker {
    font-size: 24px;
    background: transparent;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.sound-agent .agent-speaker:hover {
    background: var(--secondary);
}

.sound-agent.correct {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 25px var(--accent-glow);
}

.sound-agent.correct .agent-icon {
    color: var(--bg-dark);
}

.sound-agent.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.sound-agent.was-correct {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Agent images for Sound Match */
.sound-agent .agent-portrait {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--text-dim);
    transition: all 0.2s;
}

.sound-agent:hover .agent-portrait {
    border-color: var(--secondary);
    box-shadow: 0 0 15px rgba(0, 220, 255, 0.5);
}

.sound-agent.correct .agent-portrait {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.sound-agent.incorrect .agent-portrait {
    border-color: var(--error);
}

.sound-agent.di-highlight .agent-portrait {
    border-color: var(--accent);
    animation: pulse-highlight 0.5s ease infinite;
}

/* Agent enter/exit animations */
@keyframes agent-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes agent-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.8);
    }
}

.sound-agent.entering {
    animation: agent-enter 0.4s ease forwards;
}

.sound-agent.exiting {
    animation: agent-exit 0.3s ease forwards;
}

/* Drag-to-target mode for sound match */
.sound-match.drag-mode {
    position: relative;
    height: 100%;
    justify-content: center;
    padding: 20px;
}

.target-drop-zone {
    padding: 15px;
    border: 4px dashed rgba(0, 200, 255, 0.7);
    border-radius: 24px;
    transition: all 0.2s;
    animation: pulse-drop-zone 2s ease-in-out infinite;
    position: relative;
}

@keyframes pulse-drop-zone {
    0%, 100% {
        border-color: rgba(0, 200, 255, 0.5);
        box-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
    }
    50% {
        border-color: rgba(0, 200, 255, 0.9);
        box-shadow: 0 0 30px rgba(0, 200, 255, 0.4);
    }
}

.target-drop-zone::after {
    content: '↑';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: rgba(0, 200, 255, 0.6);
    animation: bounce-arrow 1s ease-in-out infinite;
}

@keyframes bounce-arrow {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

.target-drop-zone.hover {
    border-color: var(--primary);
    background: rgba(0, 200, 255, 0.2);
    transform: scale(1.08);
    animation: none;
}

.target-drop-zone.hover::after {
    display: none;
}

.target-drop-zone.correct {
    border-color: var(--accent);
    border-style: solid;
    background: rgba(0, 255, 136, 0.2);
    animation: none;
}

.target-drop-zone.correct::after {
    display: none;
}

.target-drop-zone.incorrect {
    border-color: var(--error);
    animation: shake 0.3s ease;
}

.target-drop-zone.incorrect::after {
    display: none;
}

.sound-match.drag-mode .sound-agent {
    cursor: grab;
    touch-action: none;
    user-select: none;
    position: relative;
}

.sound-match.drag-mode .sound-agent::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px dashed rgba(0, 200, 255, 0.4);
    border-radius: 18px;
    animation: pulse-agent 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse-agent {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.sound-match.drag-mode .sound-agent.dragging {
    cursor: grabbing;
    z-index: 100;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.6);
}

.sound-match.drag-mode .sound-agent.dragging::after {
    display: none;
}

/* ============ SECRET OPERATIVES (Sound Confirm Redesign) ============ */

.operative-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    height: 100%;
}

.operatives-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 90vw;
}

.operative {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: var(--bg-mid);
    border: 4px solid var(--text-dim);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.operative .operative-portrait {
    width: min(22vw, 160px);
    height: min(22vw, 160px);
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--text-dim);
    transition: all 0.2s;
}

.operative .operative-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: min(7vw, 50px);
    height: min(7vw, 50px);
    background: var(--bg-dark);
    border: 3px solid var(--secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(4vw, 28px);
    font-weight: bold;
    color: var(--text);
    text-transform: lowercase;
}

.operative:hover {
    border-color: var(--secondary);
}

.operative:hover .operative-portrait {
    box-shadow: 0 0 12px rgba(0, 220, 255, 0.5);
}

/* Marked as spy */
.operative.marked-spy {
    border-color: #ff4444;
    border-width: 4px;
    background: rgba(255, 50, 50, 0.3);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.6), inset 0 0 15px rgba(255, 50, 50, 0.3);
    transform: scale(1.05);
}

.operative.marked-spy .operative-portrait {
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.5);
}

.operative.marked-spy::after {
    content: "?";
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 18px;
    font-weight: bold;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.8);
}

/* Revealed states */
.operative.revealed-correct {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.2);
}

.operative.revealed-correct::after {
    content: "✓";
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 16px;
    background: var(--accent);
    color: var(--bg-dark);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.operative.revealed-wrong {
    border-color: var(--error);
    opacity: 0.6;
}

.operative.di-highlight {
    border-color: var(--accent);
    animation: pulse-highlight 0.5s ease infinite;
}

.operative-submit {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    background: var(--secondary);
    color: var(--bg-dark);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.operative-submit:hover {
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.operative-submit:disabled {
    background: var(--text-dim);
    cursor: not-allowed;
}

/* ============ PHASE 9: MESSAGE SCAN ============ */

.message-scan {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    height: 100%;
    position: relative;
}

.message-scan .replay-sound-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.scan-message {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #0d1825 0%, #0a1218 100%);
    border: 3px solid var(--primary);
    border-radius: 16px;
    max-width: 90%;
}

.scan-phrase {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
    padding: 10px;
    white-space: nowrap;
    word-break: keep-all;
}

.scan-phrase.entering {
    animation: phrase-enter 0.4s ease forwards;
}

@keyframes phrase-enter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.scan-space {
    width: 20px;
}

.scan-letter {
    min-width: 36px;
    height: 48px;
    padding: 0 8px;
    background: linear-gradient(135deg, #1a3050 0%, #0d1a2a 100%);
    border: 3px solid #00ddff;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: #ffffff !important;
    cursor: pointer;
    transition: all 0.15s;
    text-shadow: 0 0 6px rgba(0, 220, 255, 0.6);
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
}

.scan-letter:active,
.scan-letter.tapped {
    transform: scale(0.9);
    background: var(--bg-mid);
    border-color: var(--secondary);
}

.scan-letter.found {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark) !important;
    box-shadow: 0 0 15px var(--accent-glow);
    text-shadow: none;
}

.scan-letter.wrong {
    animation: shake 0.3s ease;
    border-color: var(--error);
}

.scan-letter.di-highlight {
    animation: di-pulse 0.6s ease-in-out infinite;
    border-color: var(--accent) !important;
    box-shadow: 0 0 20px var(--accent-glow) !important;
}

.scan-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.scan-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-mid);
    border: 2px solid var(--text-dim);
    transition: all 0.2s;
}

.scan-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 500px) {
    .sound-symbol-char {
        font-size: 100px;
    }

    .match-option {
        width: 110px;
        height: 110px;
    }

    .word-letter {
        width: 50px;
        height: 60px;
        font-size: 32px;
    }

    .hunt-cell {
        width: 45px;
        height: 45px;
        font-size: 26px;
    }

    .drill-option {
        width: 90px;
        height: 90px;
        font-size: 44px;
    }

    .blend-letter {
        font-size: 60px;
    }

    .blend-track {
        width: 150px;
    }

    /* New phases responsive */
    .sigil {
        font-size: 90px;
    }

    .decoder-ring {
        width: 70px;
        height: 70px;
    }

    .ring-icon {
        font-size: 32px;
    }

    .hunt-option {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .gate-btn {
        padding: 15px 25px;
        font-size: 14px;
    }

    .agent-badge {
        font-size: 36px;
        padding: 8px 16px;
    }

    .sweep-cell {
        width: 45px;
        height: 45px;
        font-size: 26px;
    }

    .rapid-option {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .rapid-timer {
        width: 250px;
    }

    .confirm-sigil {
        font-size: 80px;
        padding: 20px;
    }

    .confirm-btn {
        padding: 15px 30px;
        font-size: 16px;
    }

    .scan-letter {
        width: 50px;
        height: 60px;
        font-size: 32px;
    }

    .intercept-arena {
        height: 350px;  /* Taller even on mobile */
    }

    .intercept-target {
        width: 60px;
        height: 60px;
        font-size: 32px;
    }
}

/* ============ CODEX SIDEBAR ============ */

#codex-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

#codex-sidebar.codex-expanded {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    justify-content: center;
    align-items: center;
}

.codex-toggle {
    background: linear-gradient(135deg, #0a1520 0%, #1a2a3a 100%);
    border: 2px solid var(--secondary);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 15px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    transition: all 0.2s;
}

.codex-toggle:hover {
    background: linear-gradient(135deg, #0a1a25 0%, #2a3a4a 100%);
    box-shadow: 0 0 25px rgba(0, 200, 255, 0.5);
}

.codex-count {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}

.codex-icon {
    font-size: 20px;
    color: var(--secondary);
    animation: pulse-glow 2s ease infinite;
}

.codex-panel {
    background: linear-gradient(135deg, #0a1520 0%, #1a2a3a 50%, #0a1520 100%);
    border: 2px solid var(--secondary);
    border-right: none;
    border-radius: 15px 0 0 15px;
    padding: 20px;
    width: 0;
    max-height: 80vh;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.3);
    display: flex;
    flex-direction: column;
}

.codex-collapsed .codex-panel {
    width: 0;
    padding: 0;
    opacity: 0;
}

.codex-expanded .codex-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    padding: 40px;
    opacity: 1;
    border-radius: 0;
    border: none;
}

.codex-expanded .codex-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    border-radius: 10px;
    border: 2px solid var(--secondary);
}

/* Close tab on left edge of expanded codex */
.codex-close-tab {
    display: none;
}

.codex-expanded .codex-close-tab {
    display: flex;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background: linear-gradient(90deg, rgba(0, 100, 130, 0.9), rgba(0, 150, 180, 0.7));
    border: 2px solid var(--secondary);
    border-left: none;
    border-radius: 0 10px 10px 0;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--secondary);
    font-size: 24px;
    transition: all 0.2s;
    z-index: 110;
}

.codex-expanded .codex-close-tab:hover {
    background: linear-gradient(90deg, rgba(0, 130, 160, 1), rgba(0, 180, 210, 0.9));
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
}

.codex-header {
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary);
    text-align: center;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 15px var(--secondary-glow);
}

.codex-grid {
    position: relative;
    width: 100%;
    aspect-ratio: 2752 / 1536;
    margin: 0 auto;
    background-image: url('images/codex_grid.png');
    background-size: 100% 100%;
    background-position: top left;
    background-repeat: no-repeat;
}

.codex-hex {
    position: absolute;
    width: 7%;
    height: 11%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(20px, 3vw, 36px);
    font-weight: bold;
    cursor: pointer;
    transition: box-shadow 0.2s, color 0.2s, background 0.2s;
    /* Flat-top hexagon orientation */
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: transparent;
    border: none;
    color: rgba(100, 150, 180, 0.2);
}

.codex-hex.mastered {
    background: linear-gradient(135deg, rgba(0, 40, 60, 0.9), rgba(0, 60, 80, 0.7));
    /* Holographic neon glow - cyan core with magenta bloom */
    color: #e0ffff;
    text-shadow:
        0 0 5px #0ff,
        0 0 10px #0ff,
        0 0 20px #0ff,
        0 0 30px rgba(255, 0, 255, 0.5),
        0 0 40px rgba(255, 0, 255, 0.3);
    box-shadow:
        0 0 10px rgba(0, 200, 255, 0.4),
        inset 0 0 15px rgba(0, 200, 255, 0.2);
}

.codex-hex.mastered:hover {
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.6),
        0 0 40px rgba(255, 0, 255, 0.4),
        inset 0 0 20px rgba(0, 200, 255, 0.3);
    text-shadow:
        0 0 5px #0ff,
        0 0 15px #0ff,
        0 0 30px #0ff,
        0 0 45px rgba(255, 0, 255, 0.6);
}

.codex-hex.current {
    animation: hex-pulse 1s ease infinite;
    background: linear-gradient(135deg, rgba(0, 60, 80, 0.9), rgba(0, 80, 100, 0.7));
    color: #e0ffff;
    text-shadow:
        0 0 5px #0ff,
        0 0 10px #0ff,
        0 0 20px #0ff;
}

@keyframes hex-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0, 200, 255, 0.4), inset 0 0 10px rgba(0, 200, 255, 0.2);
        text-shadow: 0 0 5px #0ff, 0 0 10px #0ff, 0 0 20px #0ff;
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 255, 255, 0.7), 0 0 50px rgba(255, 0, 255, 0.3), inset 0 0 20px rgba(0, 200, 255, 0.3);
        text-shadow: 0 0 8px #0ff, 0 0 15px #0ff, 0 0 30px #0ff, 0 0 40px rgba(255, 0, 255, 0.5);
    }
}

/* ============ REVIEW PROMPT OVERLAY ============ */

#review-prompt {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#review-prompt.hidden {
    display: none;
}

.review-prompt-content {
    background: linear-gradient(135deg, #0a1520 0%, #1a2a3a 100%);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.4);
}

.review-sound {
    font-size: 80px;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
    margin-bottom: 20px;
}

.review-question {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 30px;
}

.review-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.review-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.review-no {
    background: rgba(255, 50, 100, 0.2);
    border-color: var(--error);
    color: var(--error);
}

.review-no:hover {
    background: rgba(255, 50, 100, 0.4);
    box-shadow: 0 0 20px rgba(255, 50, 100, 0.5);
}

.review-yes {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--accent);
    color: var(--accent);
}

.review-yes:hover {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ============ LINEUP TUTORIAL ============ */

.lineup-tutorial {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.lineup-scene {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 16/9;
}

.lineup-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.lineup-clickzones {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lineup-person {
    position: absolute;
    top: 15%;
    height: 75%;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
}

.lineup-person:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
}

.lineup-clickzones.magnify-mode .lineup-person:hover {
    border-color: rgba(0, 255, 255, 0.5);
    background: rgba(0, 255, 255, 0.1);
    cursor: help;
}

.lineup-person.correct {
    border-color: var(--accent) !important;
    background: rgba(0, 255, 136, 0.3) !important;
    box-shadow: 0 0 20px var(--accent-glow);
}

.lineup-person.wrong {
    border-color: #ff4444 !important;
    background: rgba(255, 0, 0, 0.2) !important;
    animation: shake 0.3s ease-in-out;
}

/* Mode toggle buttons - top right corner */
.lineup-mode-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.lineup-mode-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lineup-mode-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--secondary);
}

.lineup-mode-btn.active {
    background: rgba(0, 255, 255, 0.3);
    border-color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary);
}

/* Cursor styles based on mode */
.lineup-clickzones.question-mode .lineup-person {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><circle cx="12" cy="12" r="8" fill="none" stroke="%2300ffff" stroke-width="2"/><line x1="18" y1="18" x2="28" y2="28" stroke="%2300ffff" stroke-width="3" stroke-linecap="round"/></svg>') 12 12, pointer;
}

.lineup-clickzones.accuse-mode .lineup-person {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M16 2 L16 20 M10 14 L16 20 L22 14" fill="none" stroke="%23ff4444" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><circle cx="16" cy="26" r="3" fill="%23ff4444"/></svg>') 16 28, pointer;
}

/* Legacy support for old magnify button */
.lineup-magnify {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: none; /* Hide old button, use new toggle instead */
}

.lineup-magnify:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: var(--secondary);
}

.lineup-magnify.active {
    background: rgba(0, 255, 255, 0.3);
    border-color: var(--secondary);
    box-shadow: 0 0 15px var(--secondary);
}

.lineup-note {
    margin-top: 20px;
    padding: 15px 30px;
    background: rgba(255, 255, 200, 0.95);
    border-radius: 4px;
    transform: rotate(-2deg);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Override conflicting .note-word styles for lineup notes */
.lineup-note .note-word {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-size: 42px;
    color: #222;
    text-transform: capitalize;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Clickable letters below the note word for decoding help */
.lineup-note .note-letters {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.lineup-note .note-letter {
    font-family: var(--font-main);
    font-size: 28px;
    color: #444;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #999;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.lineup-note .note-letter:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #666;
}

.lineup-note .note-letter:active,
.lineup-note .note-letter.playing {
    background: #ffd700;
    border-color: #b8860b;
    transform: scale(1.1);
}

/* ============ SETTINGS MODAL ============ */

.settings-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--secondary);
    color: var(--secondary);
}

/* Settings button in training screen - positioned in training-hud */
.settings-btn.training-settings {
    position: absolute;
    bottom: auto;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#settings-modal.hidden {
    display: none;
}

.settings-content {
    position: relative;
    background: linear-gradient(135deg, #0a1520 0%, #1a2a3a 100%);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.4);
}

.settings-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 2px solid var(--text-dim);
    border-radius: 50%;
    color: var(--text-dim);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-close:hover {
    border-color: var(--error);
    color: var(--error);
}

.settings-section {
    margin-bottom: 25px;
}

.settings-label {
    font-size: 14px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.settings-code-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

#current-save-code {
    font-size: 28px;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 0.15em;
    font-family: monospace;
}

.settings-copy-btn {
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-copy-btn:hover {
    background: rgba(0, 255, 136, 0.3);
}

.settings-copy-btn.copied {
    background: var(--accent);
    color: var(--bg-dark);
}

.settings-code-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

#save-code-input {
    flex: 1;
    padding: 12px 15px;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 0.15em;
    font-family: monospace;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--text-dim);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

#save-code-input:focus {
    border-color: var(--secondary);
}

#save-code-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.settings-apply-btn {
    width: 44px;
    height: 44px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-apply-btn:hover {
    background: rgba(0, 255, 136, 0.3);
}

.settings-error {
    margin-top: 8px;
    font-size: 14px;
    color: var(--error);
}

.settings-error.hidden {
    display: none;
}

.settings-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--text-dim), transparent);
    margin: 25px 0;
}

.settings-info-text {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
}

/* Mobile adjustments for Settings */
@media (max-width: 600px) {
    .settings-content {
        padding: 30px 25px;
    }

    #current-save-code {
        font-size: 24px;
    }

    #save-code-input {
        font-size: 18px;
        padding: 10px 12px;
    }
}

/* Mobile adjustments for Codex */
@media (max-width: 600px) {
    .codex-expanded .codex-panel {
        width: 100vw;
        height: 100vh;
        padding: 20px;
    }

    .codex-hex {
        width: 7%;
        height: 11%;
        font-size: clamp(16px, 2.5vw, 24px);
    }

    .codex-header {
        font-size: 18px;
    }

    .review-prompt-content {
        padding: 30px 40px;
    }

    .review-sound {
        font-size: 60px;
    }

    .review-btn {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}

/* ============ TORN NOTE MISSION ============ */

.torn-note-mission {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.torn-note-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.torn-note-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.note-words-overlay {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 10px;
}

.note-word {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--secondary);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 24px;
    font-weight: bold;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.note-word:hover {
    background: rgba(0, 100, 150, 0.7);
    box-shadow: 0 0 15px var(--secondary-glow);
}

.note-word.word-active {
    background: var(--secondary);
    color: var(--bg);
    transform: scale(1.1);
}

.torn-note-mission .scene-wrapper {
    width: 100%;
    max-width: 500px;
}

@media (max-width: 600px) {
    .torn-note-container {
        max-width: 300px;
    }

    .note-word {
        font-size: 18px;
        padding: 8px 15px;
    }

    .torn-note-mission .scene-wrapper {
        max-width: 350px;
    }
}

/* ============ WORD CHAIN (Garbled Transmission) - Full Screen Radio Scene ============ */

.word-chain-area {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Full-screen backdrop - placeholder until radio_transmission.png is ready */
.word-chain-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('images/backdrops/radio_transmission.png') center/cover no-repeat,
                linear-gradient(180deg, #0a1218 0%, #1a2a3a 50%, #0a1520 100%);
    filter: brightness(0.6);
    z-index: 0;
}

/* Content layer above backdrop */
.word-chain-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

/* Large transmission display - top half */
.transmission-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.transmission-frame {
    background: rgba(0, 20, 30, 0.9);
    border: 4px solid #0a3a3a;
    border-radius: 20px;
    padding: 40px 60px;
    position: relative;
    box-shadow:
        0 0 50px rgba(0, 255, 150, 0.2),
        inset 0 0 100px rgba(0, 50, 40, 0.5),
        0 10px 40px rgba(0, 0, 0, 0.5);
}

/* CRT static/scanline overlay */
.static-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 150, 0.02) 2px,
            rgba(0, 255, 150, 0.02) 4px
        );
    pointer-events: none;
    border-radius: 16px;
    animation: static-flicker 0.1s infinite;
}

@keyframes static-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

/* The word being decoded - large and prominent */
.transmission-word {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.transmission-letter {
    width: 100px;
    height: 130px;
    background: linear-gradient(180deg, #0a2a2a 0%, #051515 100%);
    border: 3px solid #00ff96;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    font-weight: bold;
    font-family: inherit;
    color: #00ff96;
    text-transform: lowercase;
    text-shadow:
        0 0 20px #00ff96,
        0 0 40px rgba(0, 255, 150, 0.5);
    box-shadow:
        0 0 20px rgba(0, 255, 150, 0.3),
        inset 0 0 30px rgba(0, 50, 40, 0.5);
    transition: all 0.3s ease;
}

/* Garbled/corrupted letter - the one that needs fixing */
.transmission-letter.garbled {
    color: #ff6b6b;
    border-color: #ff6b6b;
    text-shadow:
        0 0 20px #ff6b6b,
        0 0 40px rgba(255, 100, 100, 0.5);
    box-shadow:
        0 0 30px rgba(255, 100, 100, 0.4),
        inset 0 0 30px rgba(50, 20, 20, 0.5);
    animation: garbled-pulse 0.8s infinite, garbled-glitch 2s infinite;
}

@keyframes garbled-pulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 100, 100, 0.4), inset 0 0 30px rgba(50, 20, 20, 0.5);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 100, 100, 0.6), inset 0 0 40px rgba(50, 20, 20, 0.7);
    }
}

@keyframes garbled-glitch {
    0%, 90%, 100% { transform: translateX(0); }
    92% { transform: translateX(-3px); }
    94% { transform: translateX(3px); }
    96% { transform: translateX(-2px); }
    98% { transform: translateX(2px); }
}

/* Successfully decoded letter */
.transmission-letter.decoded {
    color: #00ff96;
    border-color: #00ff96;
    animation: decode-success 0.5s ease;
}

@keyframes decode-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); }
}

/* Signal strength bar */
.signal-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 50, 40, 0.5);
    border-radius: 3px;
    margin-top: 20px;
    overflow: hidden;
}

.signal-strength {
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, #00ff96, #00cc76);
    border-radius: 3px;
    animation: signal-wave 2s infinite;
}

@keyframes signal-wave {
    0%, 100% { width: 55%; opacity: 0.8; }
    50% { width: 70%; opacity: 1; }
}

/* Replay button */
.transmission-replay {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(0, 40, 30, 0.9);
    border: 2px solid #00ff96;
    color: #00ff96;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(0, 255, 150, 0.3);
}

.transmission-replay:hover {
    background: rgba(0, 80, 60, 0.9);
    box-shadow: 0 0 25px rgba(0, 255, 150, 0.5);
    transform: scale(1.1);
}

/* Frequency panel - bottom strip */
.frequency-panel {
    background: linear-gradient(180deg, rgba(20, 40, 50, 0.95) 0%, rgba(10, 25, 35, 0.98) 100%);
    border-top: 2px solid rgba(0, 255, 150, 0.3);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.frequency-label {
    color: rgba(0, 255, 150, 0.6);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-family: monospace;
}

/* Horizontal strip of frequency buttons */
.frequency-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.frequency-btn {
    width: 70px;
    height: 80px;
    background: linear-gradient(180deg, #1a3a3a 0%, #0a2020 100%);
    border: 2px solid rgba(0, 200, 180, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: bold;
    font-family: inherit;
    color: #00ddcc;
    text-transform: lowercase;
    cursor: pointer;
    transition: all 0.15s ease;
    text-shadow: 0 0 10px rgba(0, 220, 200, 0.5);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.frequency-btn:hover {
    transform: translateY(-3px);
    border-color: #00ffee;
    box-shadow:
        0 8px 25px rgba(0, 255, 200, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #00ffee;
}

.frequency-btn:active {
    transform: translateY(0);
}

.frequency-btn.correct {
    background: linear-gradient(180deg, #0a4a3a 0%, #052a2a 100%);
    border-color: #00ff96;
    color: #00ff96;
    box-shadow: 0 0 30px rgba(0, 255, 150, 0.5);
    animation: freq-correct 0.4s ease;
}

@keyframes freq-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.frequency-btn.incorrect {
    background: linear-gradient(180deg, #4a1a1a 0%, #2a0d0d 100%);
    border-color: #ff6b6b;
    color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 100, 100, 0.4);
    animation: shake 0.3s ease;
}

/* Progress dots */
.transmission-progress {
    display: flex;
    gap: 10px;
}

.transmission-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 200, 180, 0.2);
    border: 2px solid rgba(0, 200, 180, 0.4);
    transition: all 0.3s ease;
}

.transmission-dot.decoded {
    background: #00ff96;
    border-color: #00ff96;
    box-shadow: 0 0 10px rgba(0, 255, 150, 0.5);
}

.transmission-dot.active {
    background: #00ddcc;
    border-color: #00ddcc;
    box-shadow: 0 0 15px rgba(0, 220, 200, 0.6);
    animation: dot-pulse 1s infinite;
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Mobile responsive */
@media (max-width: 600px) {
    .transmission-frame {
        padding: 25px 30px;
    }

    .transmission-letter {
        width: 75px;
        height: 100px;
        font-size: 52px;
    }

    .transmission-word {
        gap: 12px;
    }

    .frequency-btn {
        width: 55px;
        height: 65px;
        font-size: 34px;
    }

    .frequency-buttons {
        gap: 8px;
    }
}

/* ============ TRY SAYING IT YOURSELF SCREEN ============ */
.try-saying-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 80px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 100;
}

.spy-display {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spy-character {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.3));
}

.held-sigil {
    position: absolute;
    bottom: 60px;
    right: -20px;
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 15px var(--accent-glow));
    animation: sigil-float 2s ease-in-out infinite;
}

@keyframes sigil-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.pitch-options {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.pitch-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 3px solid var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 36px;
}

.pitch-btn:hover {
    background: rgba(0, 204, 255, 0.2);
    transform: scale(1.05);
}

.pitch-btn.playing {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.2);
    animation: pulse-glow 0.5s ease-in-out;
}

.pitch-btn.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 20px var(--accent-glow);
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 rgba(0, 255, 136, 0); }
    50% { box-shadow: 0 0 30px var(--accent-glow); }
    100% { box-shadow: 0 0 0 rgba(0, 255, 136, 0); }
}

.pitch-icon {
    font-size: 36px;
}

/* Size variations for visual cue about pitch */
#pitch-low .pitch-icon {
    font-size: 28px;
    opacity: 0.8;
}

#pitch-normal .pitch-icon {
    font-size: 36px;
}

#pitch-high .pitch-icon {
    font-size: 44px;
}

@media (max-width: 600px) {
    .spy-character {
        width: 120px;
    }
    
    .held-sigil {
        width: 60px;
        height: 60px;
        bottom: 50px;
        right: -10px;
    }
    
    .pitch-btn {
        width: 80px;
        height: 80px;
    }
    
    .pitch-options {
        gap: 20px;
    }
}

/* Pitch options start hidden, revealed after pause */
.pitch-options {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.pitch-options.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Continue button for try-saying screen */
.try-saying-continue {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: var(--bg-dark);
    font-size: 32px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 101;
}

.try-saying-continue.visible {
    opacity: 1;
    transform: scale(1);
}

.try-saying-continue:hover {
    background: var(--accent-bright);
    transform: scale(1.1);
}

/* Review choice screen - shown to high performers after 7 sigils */
.review-choice-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px;
}

.review-choice-buttons {
    display: flex;
    gap: 60px;
    justify-content: center;
    align-items: center;
}

.review-icon-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.review-icon-btn .review-icon {
    font-size: 48px;
}

.review-icon-btn.do-review-btn {
    border-color: var(--accent);
    color: var(--accent);
}

.review-icon-btn.do-review-btn:hover,
.review-icon-btn.do-review-btn.highlighted {
    background: var(--accent);
    color: var(--bg-dark);
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent);
}

.review-icon-btn.skip-review-btn {
    border-color: #4CAF50;
    color: #4CAF50;
}

.review-icon-btn.skip-review-btn:hover,
.review-icon-btn.skip-review-btn.highlighted {
    background: #4CAF50;
    color: var(--bg-dark);
    transform: scale(1.1);
    box-shadow: 0 0 30px #4CAF50;
}

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

/* Review level screen */
.review-level-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px;
    text-align: center;
}

.review-intro {
    font-size: 1.5rem;
    color: var(--accent);
}

/* Capitals Introduction */
.capitals-intro-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 20px;
    gap: 30px;
}

/* Paper scrap base style - looks like torn paper */
.paper-scrap {
    background: linear-gradient(135deg, #f5f5dc 0%, #e8e0c8 50%, #d4cbb5 100%);
    box-shadow:
        2px 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    position: relative;
    transform: rotate(var(--scrap-rotation, 0deg));
}

/* Torn paper edge effect */
.paper-scrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(90deg, transparent 98%, rgba(139, 119, 101, 0.3) 100%),
        linear-gradient(180deg, transparent 97%, rgba(139, 119, 101, 0.4) 100%);
    pointer-events: none;
}

/* Spy guide - letter pairs at the top */
.capitals-spy-guide {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 500px;
}

.letter-pair-scrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 2.2rem;
}

.letter-pair-scrap:nth-child(1) { --scrap-rotation: -2deg; }
.letter-pair-scrap:nth-child(2) { --scrap-rotation: 1deg; }
.letter-pair-scrap:nth-child(3) { --scrap-rotation: -1deg; }
.letter-pair-scrap:nth-child(4) { --scrap-rotation: 2deg; }
.letter-pair-scrap:nth-child(5) { --scrap-rotation: -3deg; }
.letter-pair-scrap:nth-child(6) { --scrap-rotation: 1deg; }
.letter-pair-scrap:nth-child(7) { --scrap-rotation: -1deg; }

.scrap-upper {
    color: #1a3a52;
    font-weight: bold;
}

.scrap-lower {
    color: #3d5a73;
}

/* Example phrases */
.capitals-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 600px;
}

.example-scrap {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    font-size: 1.6rem;
    transition: transform 0.3s, box-shadow 0.3s, opacity 0.8s;
}

.example-scrap:nth-child(1) { --scrap-rotation: 1deg; }
.example-scrap:nth-child(2) { --scrap-rotation: -2deg; }
.example-scrap:nth-child(3) { --scrap-rotation: 2deg; }
.example-scrap:nth-child(4) { --scrap-rotation: -1deg; }
.example-scrap:nth-child(5) { --scrap-rotation: 3deg; }
.example-scrap:nth-child(6) { --scrap-rotation: -2deg; }
.example-scrap:nth-child(7) { --scrap-rotation: 1deg; }

.example-scrap.reading {
    transform: scale(1.1) rotate(0deg) !important;
    box-shadow:
        0 0 25px rgba(0, 255, 136, 0.6),
        2px 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.example-name {
    color: #1a3a52;
}

.highlight-cap {
    color: #0a8a4a;
    font-weight: bold;
    font-size: 1.8rem;
}

.example-word {
    color: #3d5a73;
}

/* Legacy pair styles for matching game */
.capitals-pairs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    max-width: 600px;
}

.capital-pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    background: rgba(0, 255, 136, 0.1);
    border: 2px solid var(--accent);
    border-radius: 12px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.capital-pair.highlight {
    transform: scale(1.15);
    box-shadow: 0 0 20px var(--accent-glow);
    background: rgba(0, 255, 136, 0.2);
}

.capital-upper {
    font-size: 3rem;
    color: var(--accent);
    font-weight: bold;
}

.capital-lower {
    font-size: 2.5rem;
    color: var(--secondary);
}

/* Capitals Matching Game */
.capitals-match-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px 20px;
    gap: 40px;
}

.capitals-uppers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

/* Upper scraps in matching game - paper style */
.upper-scrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    transition: transform 0.3s;
}

.upper-scrap:nth-child(1) { --scrap-rotation: -1deg; }
.upper-scrap:nth-child(2) { --scrap-rotation: 2deg; }
.upper-scrap:nth-child(3) { --scrap-rotation: -2deg; }
.upper-scrap:nth-child(4) { --scrap-rotation: 1deg; }
.upper-scrap:nth-child(5) { --scrap-rotation: -1deg; }
.upper-scrap:nth-child(6) { --scrap-rotation: 2deg; }
.upper-scrap:nth-child(7) { --scrap-rotation: -1deg; }

.upper-scrap.wrong-match {
    animation: shake 0.3s ease;
}

.upper-scrap .scrap-upper {
    font-size: 2.5rem;
}

.capital-drop-zone {
    width: 55px;
    height: 55px;
    border: 2px dashed rgba(58, 82, 102, 0.5);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #3d5a73;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.2s, border-color 0.2s;
}

.capital-drop-zone.drag-over {
    background: rgba(10, 138, 74, 0.2);
    border-color: #0a8a4a;
}

.capital-drop-zone.matched {
    background: rgba(10, 138, 74, 0.3);
    border: 2px solid #0a8a4a;
    color: #0a8a4a;
    font-weight: bold;
}

/* Skip button for matching game fallback */
.skip-match-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    font-size: 16px;
    background: rgba(0, 50, 80, 0.8);
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 100;
}

.skip-match-btn:hover {
    background: rgba(0, 100, 150, 0.8);
    box-shadow: 0 0 15px var(--primary-glow);
}

.capitals-lowers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

/* Draggable lowercase paper scraps */
.draggable-lower {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: lowercase;
    font-size: 2rem;
    font-weight: bold;
    color: #3d5a73;
}

.draggable-lower:nth-child(1) { --scrap-rotation: 3deg; }
.draggable-lower:nth-child(2) { --scrap-rotation: -2deg; }
.draggable-lower:nth-child(3) { --scrap-rotation: 1deg; }
.draggable-lower:nth-child(4) { --scrap-rotation: -3deg; }
.draggable-lower:nth-child(5) { --scrap-rotation: 2deg; }
.draggable-lower:nth-child(6) { --scrap-rotation: -1deg; }
.draggable-lower:nth-child(7) { --scrap-rotation: 2deg; }

.draggable-lower:hover {
    transform: scale(1.1) rotate(0deg);
    box-shadow:
        0 0 15px rgba(10, 138, 74, 0.4),
        2px 2px 8px rgba(0, 0, 0, 0.3);
}

.draggable-lower.dragging {
    opacity: 0.8;
    cursor: grabbing;
    transform: scale(1.1) rotate(0deg);
}

/* Lost Badges Activity */
.lost-badges-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    padding: 20px;
    gap: 20px;
}

.lost-badges-intro {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 10px;
}

.lost-badges-agents {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    max-width: 700px;
}

.badge-agent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.badge-agent:hover {
    transform: scale(1.05);
}

.badge-agent:active {
    transform: scale(0.95);
}

.badge-agent-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
}

.badge-drop-zone {
    width: 50px;
    height: 50px;
    border: 2px dashed var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    transition: all 0.2s ease;
}

.badge-drop-zone.drag-over {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.1);
}

.badge-drop-zone.filled {
    border-style: solid;
    background: var(--accent);
    color: var(--bg-dark);
}

.badge-drop-zone.filled.correct {
    border-color: #4CAF50;
    background: #4CAF50;
}

.badge-drop-zone.incorrect {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.3);
    animation: shake 0.3s ease;
}

.badge-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: auto;
}

.draggable-badge {
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: var(--bg-dark);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

.draggable-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4);
}

.draggable-badge.dragging {
    opacity: 0.7;
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.5);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Responsive adjustments for Lost Badges */
@media (max-width: 600px) {
    .badge-agent-img {
        width: 60px;
        height: 60px;
    }
    
    .badge-drop-zone,
    .draggable-badge {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Disguises Activity */
.disguises-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
    padding: 20px;
    gap: 20px;
}

.disguises-intro {
    font-size: 1.5rem;
    color: var(--accent);
}

.disguises-hint {
    font-size: 1rem;
    color: #888;
    font-style: italic;
}

.file-folders {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.file-folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: linear-gradient(135deg, #3a3a5e 0%, #2a2a4e 100%);
    border: 2px solid #555;
    border-radius: 8px;
    min-width: 60px;
    transition: all 0.2s ease;
}

.file-folder.drag-over {
    border-color: var(--accent);
    background: linear-gradient(135deg, #4a4a6e 0%, #3a3a5e 100%);
    transform: scale(1.05);
}

.file-folder.correct-drop {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.3);
}

.file-folder.wrong-drop {
    border-color: #f44336;
    animation: shake 0.3s ease;
}

.folder-label {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    margin-bottom: 5px;
}

.folder-slot {
    width: 40px;
    height: 40px;
    border: 1px dashed #666;
    border-radius: 4px;
}

.disguised-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    max-width: 500px;
}

.disguised-letter {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.disguised-letter:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.disguised-letter.dragging {
    opacity: 0.8;
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 8px 25px rgba(0, 255, 255, 0.5);
}

.disguised-letter.filed {
    opacity: 0;
    transform: scale(0);
}

/* Responsive */
@media (max-width: 600px) {
    .disguised-letter {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
    
    .file-folder {
        min-width: 50px;
        padding: 8px;
    }
    
    .folder-label {
        font-size: 1.2rem;
    }
}

/* Competitive Chase - Team Selection (no text, just colored circles) */
.team-select-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px;
}

.team-buttons {
    display: flex;
    gap: 60px;
}

.team-btn {
    width: 120px;
    height: 120px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-btn.blue-team {
    background: #2196F3;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.5);
}

.team-btn.blue-team:hover {
    transform: scale(1.15);
    box-shadow: 0 0 40px rgba(33, 150, 243, 0.8);
}

.team-btn.red-team {
    background: #f44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

.team-btn.red-team:hover {
    transform: scale(1.15);
    box-shadow: 0 0 40px rgba(244, 67, 54, 0.8);
}

/* Team Selection Screen */
.team-selection-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 40px;
}

/* Round Indicator */
.round-indicator {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1.2rem;
    color: var(--accent);
    z-index: 25;
}

/* Round Score Screen (between rounds) */
.round-score-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    background: var(--bg-dark);
}

.round-score-display {
    display: flex;
    align-items: center;
    gap: 30px;
}

.score-team {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: white;
}

.score-team.blue-score {
    background: #2196F3;
    border: 4px solid #64B5F6;
}

.score-team.red-score {
    background: #f44336;
    border: 4px solid #ef9a9a;
}

.score-team.leading {
    transform: scale(1.2);
    box-shadow: 0 0 30px currentColor;
}

.score-vs {
    font-size: 2rem;
    color: var(--text-dim);
}

/* Final Result Screen */
.final-result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: 40px;
    background: var(--bg-dark);
}

.final-score {
    display: flex;
    align-items: center;
    gap: 30px;
}

.final-icon {
    font-size: 5rem;
}

/* Badge colors for swapped teams */
.player-badge-red {
    background: #f44336;
    color: white;
    border: 2px solid #ef9a9a;
}

.ai-badge-blue {
    background: #2196F3;
    color: white;
    border: 2px solid #64B5F6;
}

/* Competitive Chase - Game Screen */
.competitive-chase-screen {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 10px;
}

.chase-scoreboard {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin-bottom: 10px;
}

.score-panel {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 8px;
}

.score-panel.blue-panel {
    background: rgba(33, 150, 243, 0.3);
    border: 2px solid #2196F3;
}

.score-panel.red-panel {
    background: rgba(244, 67, 54, 0.3);
    border: 2px solid #f44336;
}

.score-dots {
    display: flex;
    gap: 8px;
}

.score-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: transparent;
    transition: all 0.3s ease;
}

.score-dot.filled {
    background: #fff;
}

.score-panel.blue-panel .score-dot.filled {
    background: #2196F3;
    border-color: #2196F3;
    box-shadow: 0 0 10px #2196F3;
}

.score-panel.red-panel .score-dot.filled {
    background: #f44336;
    border-color: #f44336;
    box-shadow: 0 0 10px #f44336;
}

.chase-arena {
    flex: 1;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    min-height: 300px;
}

.chase-spy {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chase-spy-img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid;
}

.blue-spy .chase-spy-img {
    border-color: #2196F3;
}

.red-spy .chase-spy-img {
    border-color: #f44336;
}

.spy-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.2rem;
    margin-top: 5px;
}

.blue-badge {
    background: #2196F3;
    color: #fff;
}

.red-badge {
    background: #f44336;
    color: #fff;
}

.chase-spy:hover:not(.caught) {
    transform: scale(1.1);
}

.chase-spy.caught {
    opacity: 0.4;
    pointer-events: none;
}

.chase-spy.player-caught {
    animation: catchPulse 0.5s ease;
}

.chase-spy.ai-caught {
    animation: aiCatch 0.5s ease;
}

.chase-spy.escaped {
    animation: escape 0.5s ease;
    pointer-events: none;
}

@keyframes catchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 0.4; }
}

@keyframes aiCatch {
    0% { opacity: 1; }
    100% { opacity: 0.4; transform: translateY(-20px); }
}

@keyframes escape {
    0% { transform: translateX(0); }
    25% { transform: translateX(-20px); }
    75% { transform: translateX(20px); }
    100% { transform: translateX(0); }
}

/* Catch Prompt */
.catch-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 30px;
    border-radius: 15px;
    border: 2px solid var(--accent);
    text-align: center;
    z-index: 100;
}

.catch-prompt.hidden {
    display: none;
}

.catch-question {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--accent);
}

.catch-options {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.catch-option {
    width: 60px;
    height: 60px;
    border: 2px solid var(--accent);
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.catch-option:hover {
    background: var(--accent);
    color: var(--bg-dark);
    transform: scale(1.1);
}

/* Chase Result */
.chase-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    text-align: center;
}

.chase-result .result-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.chase-result .result-text {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.chase-result.win .result-text {
    color: #4CAF50;
}

.chase-result.lose .result-text {
    color: var(--accent);
}

.chase-result .result-subtitle {
    font-size: 1.2rem;
    color: #888;
}

/* Competitive Chase Scene */
.chase-scene-competitive {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #1a1a3e 0%, #2a2a5e 100%);
    border-radius: 10px;
    min-height: 350px;
    overflow: hidden;
}

.competitive-agent {
    position: absolute;
    cursor: pointer;
    transition: opacity 0.3s;
}

.competitive-agent.blue-agent .chase-agent-badge {
    background: #2196F3;
    border: 2px solid #64B5F6;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.competitive-agent.red-agent .chase-agent-badge {
    background: #f44336;
    border: 2px solid #EF5350;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

.competitive-agent.caught {
    opacity: 0.3;
    pointer-events: none;
}

.competitive-agent.player-caught {
    animation: competitiveCatch 0.5s ease;
}

.competitive-agent.ai-caught {
    animation: competitiveAiCatch 0.5s ease;
}

@keyframes competitiveCatch {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.4); filter: brightness(1.5); }
    100% { transform: scale(1); opacity: 0.3; }
}

@keyframes competitiveAiCatch {
    0% { opacity: 1; }
    50% { filter: brightness(0.5); }
    100% { opacity: 0.3; }
}

/* Quick Draw Duel */
.quick-draw-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: 30px;
}

.analysis-display {
    display: flex;
    gap: 60px;
    align-items: center;
}

.best-sigil, .tricky-sigil {
    font-size: 5rem;
    padding: 30px 50px;
    border-radius: 15px;
    font-weight: bold;
}

.best-sigil {
    background: rgba(0, 204, 255, 0.2);
    border: 3px solid var(--secondary);
    color: var(--secondary);
}

.tricky-sigil {
    background: rgba(255, 200, 50, 0.2);
    border: 3px solid #ffc832;
    color: #ffc832;
}

.quick-draw-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: 40px;
}

.duel-arena {
    display: flex;
    align-items: center;
    gap: 40px;
}

.duel-option {
    font-size: 5rem;
    padding: 40px 60px;
    background: rgba(0, 204, 255, 0.15);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, opacity 0.3s;
}

.duel-option.hidden {
    opacity: 0;
    pointer-events: none;
}

.duel-option.shrinking {
    animation: duel-shrink 3s linear forwards;
}

@keyframes duel-shrink {
    0% { transform: scale(1); }
    70% { transform: scale(0.85); }
    100% { transform: scale(0.6); opacity: 0.5; }
}

.duel-option:hover {
    transform: scale(1.05);
    background: rgba(0, 204, 255, 0.25);
}

.duel-option:active {
    transform: scale(0.95);
}

.duel-option.correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--accent);
    color: var(--accent);
}

.duel-option.wrong {
    background: rgba(255, 107, 107, 0.3);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.duel-option.was-correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--accent);
    color: var(--accent);
    animation: pulse-correct 0.5s ease;
}

.duel-option.fade {
    opacity: 0.3;
}

@keyframes pulse-correct {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.duel-vs {
    font-size: 2rem;
    color: var(--secondary);
    font-weight: bold;
}

.duel-progress {
    font-size: 1.5rem;
    color: var(--secondary);
}

.quick-draw-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.result-score {
    font-size: 4rem;
    color: var(--accent);
    font-weight: bold;
}

/* Minimal Pairs Exercise */
.minimal-pairs-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    gap: 40px;
}

.word-pair {
    display: flex;
    align-items: center;
    gap: 60px;
}

.pair-word {
    font-size: 4rem;
    font-family: 'Lora', Georgia, serif;
    padding: 40px 50px;
    background: rgba(0, 204, 255, 0.15);
    border: 3px solid var(--secondary);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    min-width: 180px;
    text-align: center;
}

.pair-word:hover {
    transform: scale(1.05);
    background: rgba(0, 204, 255, 0.25);
}

.pair-word:active {
    transform: scale(0.95);
}

.pair-word.correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--accent);
    color: var(--accent);
}

.pair-word.wrong {
    background: rgba(255, 107, 107, 0.3);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.pair-word.was-correct {
    background: rgba(0, 255, 136, 0.3);
    border-color: var(--accent);
    color: var(--accent);
    animation: pulse-correct 0.5s ease;
}

.replay-sound-btn {
    font-size: 2.5rem;
    padding: 15px 25px;
    background: rgba(0, 204, 255, 0.2);
    border: 2px solid var(--secondary);
    border-radius: 50%;
    color: var(--secondary);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    margin-top: 20px;
}

.replay-sound-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 204, 255, 0.3);
}

.replay-sound-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 600px) {
    .team-buttons {
        flex-direction: column;
        gap: 20px;
    }
    
    .team-btn {
        padding: 20px 40px;
    }
    
    .chase-spy-img {
        width: 50px;
        height: 50px;
    }
    
    .spy-badge {
        font-size: 1rem;
        padding: 2px 6px;
    }
    
    .catch-option {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

/* ============ STORY MISSION / PICTURE BOOK ============ */
.story-page-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
    height: 100%;
}

.story-book {
    background: linear-gradient(180deg, #0d1a2a 0%, #1a2840 50%, #0d1a2a 100%);
    border: 3px solid rgba(0, 200, 255, 0.4);
    border-radius: 12px;
    padding: 20px;
    max-width: 600px;
    width: 95%;
    box-shadow:
        0 0 30px rgba(0, 100, 150, 0.3),
        inset 0 0 60px rgba(0, 50, 100, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.story-image-container {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: rgba(0, 20, 40, 0.5);
    border: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-text-area {
    position: relative;
    padding: 15px 10px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 2px solid rgba(0, 200, 255, 0.2);
}

.story-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 100, 150, 0.3);
    border: 2px solid rgba(0, 200, 255, 0.4);
    transition: all 0.3s ease;
}

.story-dot.current {
    background: var(--warning);
    border-color: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.story-dot.complete {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.sentence-words {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.word-box {
    background: linear-gradient(180deg, #1a3050 0%, #0d1a2a 100%);
    border: 2px solid rgba(0, 200, 255, 0.4);
    border-radius: 8px;
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.word-box .word-text {
    font-size: 26px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    text-transform: lowercase;
    transition: color 0.3s ease;
}

.word-box.current {
    border-color: var(--warning);
    box-shadow: 0 0 20px rgba(255, 200, 0, 0.4);
    animation: pulse-word 1s ease infinite;
}

.word-box.current .word-text {
    color: #fff;
}

.word-box.decoded {
    background: linear-gradient(180deg, #0a4a3a 0%, #052a2a 100%);
    border-color: var(--accent);
}

.word-box.decoded .word-text {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

.word-box.sight-word {
    border-style: dashed;
}

.word-box.sight-word .word-text {
    font-style: italic;
}

@keyframes pulse-word {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 200, 0, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 200, 0, 0.5); }
}

.sentence-punctuation {
    font-size: 26px;
    color: rgba(200, 220, 255, 0.7);
    margin-left: -5px;
}

.sentence-replay {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 30, 50, 0.8);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sentence-replay:hover {
    background: rgba(0, 200, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

/* ============ VERIFIED STORY MISSION (3-spy verification) ============ */
.verified-story .story-sentence {
    font-size: 24px;
    color: #e0f0ff;
    text-align: center;
    line-height: 1.5;
    padding: 10px 15px;
    background: rgba(0, 30, 60, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(0, 200, 255, 0.2);
}

/* Tappable words for decoding */
.story-words {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 4px;
    justify-content: center;
    align-items: baseline;
    padding: 15px;
    font-size: 32px;
    line-height: 1.4;
}

.story-word {
    color: #a0c0e0;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.story-word:hover {
    background: rgba(0, 200, 255, 0.15);
    border-color: rgba(0, 200, 255, 0.4);
}

.story-word.decoding {
    background: rgba(255, 200, 0, 0.2);
    border-color: var(--warning);
    animation: pulse-word 0.5s ease infinite;
}

.story-word.decoded {
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow);
}

.story-words .punct {
    color: rgba(200, 220, 255, 0.6);
    margin-left: -4px;
}

.verified-story .ready-btn {
    margin-top: 15px;
    padding: 15px 50px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(180deg, #0a6a4a 0%, #053a2a 100%);
    border: 2px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: center;
}

.verified-story .ready-btn:hover {
    background: linear-gradient(180deg, #0c8a5a 0%, #064a3a 100%);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.05);
}

.spy-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 10px 0;
}

.spy-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: linear-gradient(180deg, #1a3050 0%, #0d1a2a 100%);
    border: 2px solid rgba(0, 200, 255, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spy-option:hover {
    border-color: rgba(0, 200, 255, 0.7);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.3);
    transform: translateY(-2px);
}

.spy-option.selected {
    border-color: var(--warning);
    box-shadow: 0 0 20px rgba(255, 200, 0, 0.4);
    background: linear-gradient(180deg, #2a3a50 0%, #1a2a3a 100%);
}

.spy-option.correct {
    border-color: var(--accent);
    box-shadow: 0 0 25px var(--accent-glow);
    background: linear-gradient(180deg, #0a5a4a 0%, #053a2a 100%);
}

.spy-option.incorrect {
    border-color: var(--danger);
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.4);
    background: linear-gradient(180deg, #4a1a1a 0%, #2a0a0a 100%);
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.spy-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.spy-option.selected .spy-avatar {
    border-color: var(--warning);
    box-shadow: 0 0 15px rgba(255, 200, 0, 0.5);
}

.spy-option.correct .spy-avatar {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.spy-option.incorrect .spy-avatar {
    border-color: var(--danger);
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.5);
    filter: grayscale(50%);
}

/* Verification mode - smaller image to make room for options */
.verification-mode .story-image-container {
    aspect-ratio: 16 / 8;
}

.verification-mode .story-sentence {
    font-size: 20px;
    padding: 8px 12px;
}

.briefing-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 2px solid rgba(0, 200, 255, 0.2);
}

.briefing-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 100, 150, 0.3);
    border: 2px solid rgba(0, 200, 255, 0.4);
    transition: all 0.3s ease;
}

.briefing-dot.current {
    background: var(--warning);
    border-color: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.briefing-dot.complete {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Responsive for story mission */
@media (max-width: 600px) {
    .mission-briefing {
        padding: 20px;
    }

    .mission-title {
        font-size: 16px;
    }

    .word-box .word-text {
        font-size: 20px;
    }

    .sentence-replay {
        right: -40px;
        width: 35px;
        height: 35px;
    }
}
