/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    overflow: hidden;
    user-select: none;
}

/* Responsive container - adapts to iframe vs full screen */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    position: relative;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* Full screen mode detection */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
    }
}

/* Game header with controls and stats */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    height: 50px;
    flex-shrink: 0;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-center {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Control buttons */
.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 40px;
    height: 36px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mode-toggle {
    background: rgba(74, 144, 226, 0.8);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 8px 12px;
    white-space: nowrap;
}

/* Score and level displays */
.score-display, .level-display {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.score-label, .level-label, .lives-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-right: 4px;
}

#scoreValue, #levelValue {
    font-weight: bold;
    color: #FFD700;
    font-size: 14px;
}

.lives-hearts {
    font-size: 16px;
    letter-spacing: 2px;
}

/* Progress bar */
.progress-container {
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
    margin: 0 12px;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

/* Prompt panel */
.prompt-panel {
    background: rgba(255, 255, 255, 0.95);
    margin: 8px 12px;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prompt-text {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.streak-display {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

/* Main game area */
.game-area {
    flex: 1;
    position: relative;
    margin: 0 12px 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* Detective character */
.detective {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    z-index: 10;
    transition: left 0.2s ease;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Falling cards */
.falling-card {
    position: absolute;
    top: -60px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    text-align: center;
    min-width: 80px;
    max-width: 120px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.1s ease;
    cursor: default;
    z-index: 5;
}

.falling-card.correct-catch {
    background: #4CAF50;
    color: white;
    transform: scale(1.1);
}

.falling-card.wrong-catch {
    background: #f44336;
    color: white;
    transform: scale(1.1);
}

/* Touch controls */
.touch-controls {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.touch-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

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

/* Hide touch controls on desktop */
@media (min-width: 768px) {
    .touch-controls {
        display: none;
    }
}

/* Power-up indicator */
.power-up-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 215, 0, 0.9);
    color: #333;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    transform: translateX(200px);
    transition: transform 0.3s ease;
    z-index: 15;
}

.power-up-indicator.active {
    transform: translateX(0);
}

/* Game over screen */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.game-over-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
}

.game-over-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.final-score, .final-level {
    font-size: 16px;
    margin-bottom: 10px;
    color: #666;
}

#playerInitials {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    margin: 15px 0;
    text-transform: uppercase;
}

.game-over-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.game-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
}

.game-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.danger-btn {
    background: #f44336;
}

.danger-btn:hover {
    background: #da190b;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-content.large {
    max-width: 700px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.help-content ul {
    text-align: left;
    margin: 10px 0;
    padding-left: 20px;
}

.help-content li {
    margin-bottom: 5px;
}

/* Leaderboard */
.leaderboard-list {
    margin: 20px 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.leaderboard-entry:nth-child(1) { background: #FFD700; color: #333; }
.leaderboard-entry:nth-child(2) { background: #C0C0C0; color: #333; }
.leaderboard-entry:nth-child(3) { background: #CD7F32; color: white; }

/* Vocabulary management */
.vocab-management {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 20;
}

.vocab-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.vocab-editor textarea {
    width: 100%;
    font-family: monospace;
    font-size: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes levelUp {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.level-up-animation {
    animation: levelUp 0.5s ease-in-out;
}

@keyframes scoreBonus {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-30px) scale(1.2); opacity: 0; }
}

.score-bonus {
    position: absolute;
    color: #FFD700;
    font-weight: bold;
    font-size: 16px;
    pointer-events: none;
    animation: scoreBonus 1s ease-out forwards;
    z-index: 20;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .game-header {
        padding: 6px 8px;
        height: 45px;
    }
    
    .control-btn {
        padding: 6px 8px;
        font-size: 14px;
        min-width: 35px;
        height: 32px;
    }
    
    .prompt-text {
        font-size: 14px;
    }
    
    .detective {
        font-size: 28px;
    }
    
    .falling-card {
        font-size: 12px;
        padding: 6px 8px;
        min-width: 70px;
        max-width: 100px;
    }
}