/* ==========================================
   GAME STYLES V3 - Interactive Journey
   ========================================== */

:root {
    --primary-red: #DA251D;
    --primary-yellow: #FFCD00;
    --gold: #d4af37;
    --bg-dark: #1a0f0a;
    --bg-paper: #f4e4c1;
    --text-dark: #2d2d2d;
    --text-light: #ffffff;
    --panel-bg: rgba(255, 255, 255, 0.98);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'VT323', monospace;
    background: linear-gradient(135deg, #1a0f0a 0%, #2d1810 100%);
    color: var(--text-dark);
    overflow: hidden;
    user-select: none;
}

/* ==========================================
   SCREENS
   ========================================== */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.screen.active {
    display: flex;
}

/* ==========================================
   START SCREEN
   ========================================== */

#start-screen {
    background: linear-gradient(135deg, #DA251D 0%, #8B0000 50%, #1a0f0a 100%);
    flex-direction: column;
}

.start-content {
    text-align: center;
    animation: fadeIn 1s ease;
}

.game-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--primary-yellow);
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5),
                 0 0 30px rgba(255, 205, 0, 0.5);
    margin-bottom: 24px;
    animation: pulse 2s infinite;
}

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

.game-subtitle {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 48px;
    opacity: 0.9;
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 48px;
}

.btn-primary, .btn-secondary {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    padding: 16px 32px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-primary {
    background: var(--primary-yellow);
    color: var(--text-dark);
    box-shadow: 0 4px 0 var(--gold), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--gold), 0 12px 24px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--gold), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--text-light);
    border: 3px solid var(--text-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.start-footer {
    font-size: 1.2rem;
    color: var(--primary-yellow);
    opacity: 0.8;
}

.start-footer p {
    margin: 8px 0;
}

/* ==========================================
   INSTRUCTIONS SCREEN
   ========================================== */

#instructions-screen {
    background: rgba(0, 0, 0, 0.95);
}

.instructions-content {
    background: var(--panel-bg);
    padding: 48px;
    border-radius: 16px;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.instructions-content h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    color: var(--primary-red);
    margin-bottom: 32px;
    text-align: center;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(218, 37, 29, 0.1);
    border-left: 4px solid var(--primary-red);
}

.instruction-item .icon {
    font-size: 2rem;
}

.instruction-item p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin: 0;
}

.instruction-section {
    margin-bottom: 32px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 2px solid rgba(218, 37, 29, 0.2);
}

.instruction-section:last-of-type {
    margin-bottom: 24px;
}

.instruction-section h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--gold);
    margin-bottom: 16px;
    text-align: center;
    line-height: 1.6;
}



.instruction-section .instruction-item {
    margin-bottom: 12px;
}

.instruction-section .instruction-item:last-child {
    margin-bottom: 0;
}

/* ==========================================
   GAME SCREEN
   ========================================== */

#game-screen {
    background: var(--bg-paper);
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 50px, rgba(0,0,0,.03) 50px, rgba(0,0,0,.03) 51px),
        repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(0,0,0,.03) 50px, rgba(0,0,0,.03) 51px);
    flex-direction: column;
}

/* HUD */
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-red) 0%, #8B0000 100%);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 50;
    gap: 40px;
}

.hud-left, .hud-center, .hud-right {
    flex: 1;
}

.hud-center {
    text-align: center;
    padding: 0 24px;
}

.hud-right {
    text-align: right;
    padding-left: 24px;
}

.progress-container label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.progress-bar {
    position: relative;
    width: 300px;
    height: 32px;
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid var(--text-light);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-yellow) 0%, var(--gold) 100%);
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    color: var(--text-dark);
    text-shadow: 1px 1px 0 white;
    z-index: 2;
}

.points-display, .achievements-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.points-display .label, .achievements-display .label {
    font-size: 0.9rem;
    color: var(--primary-yellow);
}

.points-display .value, .achievements-display .value {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--text-light);
}

/* Game Container */
.game-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    border: 8px solid var(--text-dark);
    box-shadow: var(--shadow);
    background: var(--bg-paper);
    cursor: crosshair;
}

.location-info {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--text-light);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 1.2rem;
    box-shadow: var(--shadow);
}

.game-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
}

.control-btn {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    padding: 8px 16px;
    background: var(--primary-red);
    color: var(--text-light);
    border: 3px solid var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    transform: scale(1.05);
    background: #ff3333;
}

/* ==========================================
   SIDE PANELS
   ========================================== */

.side-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--panel-bg);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    transition: right 0.3s ease;
    z-index: 200;
    overflow-y: auto;
}

.side-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: var(--primary-red);
    color: var(--text-light);
}

.panel-header h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.panel-content {
    padding: 24px;
}

/* Journey Log Items */
.journey-item {
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid var(--primary-red);
    background: rgba(218, 37, 29, 0.1);
}

.journey-item.locked {
    opacity: 0.5;
    border-left-color: #999;
}

.journey-item .year {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    color: var(--primary-red);
    margin-bottom: 8px;
}

.journey-item .title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.journey-item .status {
    font-size: 1rem;
    color: #666;
}

/* Achievement Items */
.achievement-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
    background: rgba(255, 205, 0, 0.1);
    border: 3px solid var(--primary-yellow);
}

.achievement-item.locked {
    opacity: 0.4;
    border-color: #999;
    background: rgba(0, 0, 0, 0.05);
}

.achievement-item .icon {
    font-size: 2.5rem;
}

.achievement-item .details .name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 8px;
}

.achievement-item .details .desc {
    font-size: 1.1rem;
    color: #666;
}

/* ==========================================
   MODALS
   ========================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--panel-bg);
    padding: 48px;
    border-radius: 16px;
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-dark);
}

/* ==========================================
   CHALLENGE STYLES
   ========================================== */

.challenge-modal-content {
    max-width: 1000px;
    width: 95%;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3d4 100%);
    border: 4px solid var(--gold);
}

.challenge-container {
    padding: 24px;
}

.challenge-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    color: var(--primary-red);
    text-align: center;
    margin-bottom: 24px;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

/* Quiz Challenge */
.quiz-question,
.timeline-question {
    font-family: 'VT323', monospace;
    font-size: 1.6rem;
    line-height: 1.6;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
}

.quiz-options,
.dice-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-option,
.dice-option {
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    padding: 16px;
    background: white;
    border: 3px solid var(--text-dark);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.quiz-option:hover,
.dice-option:hover {
    background: var(--primary-yellow);
    transform: translateX(8px);
}

.quiz-option:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quiz-feedback,
.timeline-feedback,
.dice-feedback {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 16px;
    display: none;
}

.quiz-feedback.correct,
.timeline-feedback.correct,
.dice-feedback.correct {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
}

.quiz-feedback.incorrect,
.timeline-feedback.incorrect,
.dice-feedback.incorrect {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

/* Timeline Challenge */
.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    min-height: 200px;
}

.timeline-event {
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    padding: 16px;
    background: white;
    border: 3px solid var(--text-dark);
    border-radius: 8px;
    cursor: move;
    transition: all 0.2s;
}

.timeline-event:hover {
    background: var(--primary-yellow);
    transform: scale(1.02);
}

.timeline-event.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Map Challenge */
.map-guide {
    text-align: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--gold);
    border-radius: 4px;
}

.map-guide p {
    margin: 4px 0;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    line-height: 1.4;
    color: var(--text-dark);
}

.map-question-container {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-left: 4px solid var(--primary-red);
    border-radius: 8px;
}

.map-question-number {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    color: var(--gold);
    margin-bottom: 8px;
}

.map-question-text {
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    color: var(--text-dark);
    line-height: 1.6;
    margin: 0;
}

.map-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 4px solid var(--text-dark);
    border-radius: 12px;
    margin: 24px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
}

.map-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.map-pin:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 20;
}

.map-pin-marker {
    font-size: 2rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    transition: all 0.3s;
}

.map-pin:hover .map-pin-marker {
    font-size: 2.5rem;
}

.map-pin-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    background: white;
    padding: 4px 8px;
    border: 2px solid var(--text-dark);
    border-radius: 4px;
    margin-top: 4px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
    line-height: 1.2;
}

.map-pin.correct .map-pin-marker {
    filter: drop-shadow(0 0 8px #28a745);
}

.map-pin.correct .map-pin-label {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.map-pin.incorrect .map-pin-marker {
    filter: drop-shadow(0 0 8px #dc3545);
}

.map-pin.incorrect .map-pin-label {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.map-feedback {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
    display: none;
}

.map-feedback.correct {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
    animation: successPulse 0.5s ease;
}

.map-feedback.incorrect {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

/* Legacy Cards Challenge - FINALE */
.legacy-guide {
    text-align: center;
    margin-bottom: 24px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(218, 41, 28, 0.1) 100%);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
}

.legacy-guide p {
    margin: 8px 0;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text-dark);
}

.legacy-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    border: 2px dashed #ccc;
    min-height: 150px;
}

.legacy-card {
    background: white;
    border: 3px solid var(--text-dark);
    border-radius: 8px;
    padding: 12px;
    cursor: grab;
    transition: all 0.2s;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.legacy-card:hover {
    transform: translateY(-4px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    border-color: var(--gold);
}

.legacy-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.legacy-card-year {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    color: var(--primary-red);
    background: var(--gold);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
}

.legacy-card-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.legacy-card-desc {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    line-height: 1.4;
    color: #666;
}

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

.legacy-category {
    border: 3px solid var(--text-dark);
    border-radius: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
}

.legacy-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.legacy-category-icon {
    font-size: 1.5rem;
}

.legacy-category-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    color: var(--primary-red);
    line-height: 1.4;
}

.legacy-category-desc {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: #666;
    margin-bottom: 12px;
    font-style: italic;
}

.legacy-category-dropzone {
    min-height: 200px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.2s;
}

.legacy-category-dropzone.drag-over {
    border-color: var(--gold);
    background: rgba(255, 193, 7, 0.1);
    border-width: 3px;
}

.legacy-feedback {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
    display: none;
}

.legacy-feedback.correct {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 2px solid #28a745;
    animation: successPulse 0.5s ease;
}

.legacy-feedback.incorrect {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #dc3545;
}

.legacy-feedback.warning {
    display: block;
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffc107;
}

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

/* Challenge Actions */
.challenge-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn-hint,
.btn-skip {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hint {
    background: #ffc107;
    color: #000;
}

.btn-hint:hover {
    background: #ffb300;
    transform: translateY(-2px);
}

.btn-skip {
    background: #6c757d;
    color: white;
}

.btn-skip:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Responsive */

/* Tablet: 2 columns for Legacy Cards */
@media (max-width: 1024px) and (min-width: 769px) {
    .modal-content,
    .challenge-modal-content {
        max-width: 95%;
        width: 95%;
    }
    
    .legacy-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .legacy-cards {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .reward-item {
        min-width: 280px;
    }
    
    .story-image, .story-video {
        max-height: 500px;
    }
}

/* Mobile: 1 column for Legacy Cards */
@media (max-width: 768px) {
    .challenge-modal-content {
        max-width: 95%;
        width: 95%;
        padding: 16px;
    }
    
    .challenge-title {
        font-size: 0.9rem;
    }
    
    /* Legacy Cards Mobile */
    .legacy-categories {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .legacy-cards {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .legacy-card {
        padding: 10px;
    }
    .legacy-card-title {
        font-size: 0.65rem;
    }
    .legacy-card-desc {
        font-size: 1rem;
    }
    .legacy-category-name {
        font-size: 0.65rem;
    }
    .legacy-category-desc {
        font-size: 0.9rem;
    }
    .legacy-category-dropzone {
        min-height: 150px;
    }
    
    .quiz-question,
    .timeline-question {
        font-size: 1.2rem;
    }
    
    .quiz-option,
    .dice-option,
    .timeline-event {
        font-size: 1.1rem;
    }
    
    .dice-face {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }
    
    .btn-roll-dice {
        font-size: 0.9rem;
        padding: 12px 24px;
    }
    
    .dice-question {
        font-size: 1.2rem;
    }
    
    .dice-option {
        font-size: 1.1rem;
        padding: 12px 16px;
    }
    
    .dice-guide p {
        font-size: 1rem;
    }
    
    .story-segment {
        padding: 12px 16px 12px 60px;
    }
    
    .story-segment-year {
        font-size: 0.8rem;
        padding: 6px 8px;
        left: 8px;
    }
    
    .story-segment-title {
        font-size: 0.75rem;
    }
    
    .story-segment-text {
        font-size: 1.1rem;
    }
    
    .story-guide p {
        font-size: 1rem;
    }
    
    .challenge-actions {
        flex-direction: column;
    }
}

/* Story Media */
.story-media {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.story-image, .story-video {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.story-audio {
    width: 100%;
    margin: 16px 0;
}

.story-header {
    text-align: center;
    margin-bottom: 32px;
}

.story-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    color: var(--primary-red);
    margin-bottom: 16px;
}

.story-year {
    font-size: 2rem;
    color: var(--primary-yellow);
    font-weight: bold;
}

.story-body {
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 24px;
}

.story-body p {
    margin-bottom: 16px;
}

.story-quote {
    background: linear-gradient(135deg, rgba(255, 205, 0, 0.2) 0%, rgba(212, 175, 55, 0.1) 100%);
    border-left: 4px solid var(--primary-yellow);
    padding: 24px;
    margin: 24px 0;
    font-style: italic;
    font-size: 1.2rem;
}

.story-reward {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 32px 0;
    flex-wrap: wrap;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(255, 205, 0, 0.2);
    border: 2px solid rgba(255, 205, 0, 0.4);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 0 0 auto;
    min-width: 300px;
    transition: all 0.3s ease;
}

.reward-item:hover {
    background: rgba(255, 205, 0, 0.3);
    border-color: rgba(255, 205, 0, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.reward-icon {
    font-size: 2rem;
}

.reward-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    color: var(--primary-red);
}

.modal-content > .btn-primary {
    display: block;
    margin: 32px auto 0;
}

/* ==========================================
   ACHIEVEMENT POPUP
   ========================================== */

.achievement-popup {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--gold) 100%);
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 400;
    transition: top 0.5s ease;
}

.achievement-popup.show {
    top: 100px;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.achievement-icon {
    font-size: 3rem;
    animation: spin 0.5s ease;
}

@keyframes spin {
    from { transform: rotate(0deg) scale(0); }
    to { transform: rotate(360deg) scale(1); }
}

.achievement-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.achievement-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--primary-red);
}

/* ==========================================
   VICTORY SCREEN
   ========================================== */

#victory-screen {
    background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--gold) 50%, var(--primary-red) 100%);
    flex-direction: column;
}

.victory-content {
    text-align: center;
    animation: fadeIn 1s ease;
}

.victory-title {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--text-dark);
    margin-bottom: 16px;
    text-shadow: 3px 3px 0 rgba(255, 255, 255, 0.5);
}

.victory-subtitle {
    font-size: 2rem;
    color: var(--primary-red);
    margin-bottom: 48px;
}

.victory-stats {
    background: rgba(255, 255, 255, 0.9);
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 2px dashed rgba(0, 0, 0, 0.1);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 1.3rem;
}

.stat-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--primary-red);
}

.victory-message {
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-light);
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 32px;
    max-width: 800px;
}

.victory-message p {
    font-size: 1.3rem;
    line-height: 1.8;
    font-style: italic;
}

.victory-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Victory Flags Animation */
.victory-flags {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.vietnam-flag {
    position: absolute;
    font-size: 3rem;
    animation: flagFloat 4s ease-in-out infinite;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    transform-origin: center;
}

.victory-content {
    position: relative;
    z-index: 2;
}

@keyframes flagFloat {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(5deg);
    }
    50% {
        transform: translateY(-40px) rotate(0deg);
    }
    75% {
        transform: translateY(-20px) rotate(-5deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes flagWave {
    0%, 100% {
        transform: scaleX(1);
    }
    50% {
        transform: scaleX(0.95);
    }
}

@keyframes flagSway {
    0%, 100% {
        transform: translateX(0) rotate(0deg);
    }
    50% {
        transform: translateX(10px) rotate(3deg);
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

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

@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .btn-primary, .btn-secondary {
        font-size: 0.8rem;
        padding: 12px 24px;
    }
    
    .game-hud {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .hud-left, .hud-center, .hud-right {
        text-align: center;
    }
    
    .progress-bar {
        width: 100%;
    }
    
    .side-panel {
        width: 100%;
        right: -100%;
    }
    
    .modal-content {
        max-width: 95%;
        width: 95%;
        padding: 24px;
    }
    
    .story-title {
        font-size: 1rem;
    }
    
    .story-image, .story-video {
        max-height: 400px;
    }
    
    .story-media {
        min-height: 150px;
    }
    
    .story-year {
        font-size: 1.5rem;
    }
    
    .story-body {
        font-size: 1.1rem;
    }
    
    .story-reward {
        flex-direction: column;
        gap: 16px;
        margin: 24px 0;
    }
    
    .reward-item {
        min-width: 100%;
        padding: 12px 16px;
    }
    
    .reward-text {
        font-size: 0.75rem;
        line-height: 1.4;
    }
    
    .modal-content > .btn-primary {
        margin: 24px auto 0;
        width: 100%;
        max-width: 300px;
    }
}
