/* Base styles and responsive design - Enhanced font sizes for better readability */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px; /* Increased from 14px for better readability */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    overflow-x: hidden;
}

/* Container setup for iframe compatibility */
#gameContainer {
    width: 100%;
    height: 450px;
    position: relative;
    overflow: hidden;
}

/* Adjust height when not in iframe */
@media (min-height: 500px) {
    body:not(.iframe-mode) #gameContainer {
        height: 90vh;
        min-height: 600px;
    }
}

/* Tooltip styles - Enhanced font size */
.tooltip {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 15px; /* Increased from 13px */
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    max-width: 300px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

.tooltip-content h3 {
    margin-bottom: 4px;
    font-size: 16px; /* Increased from 14px */
}

/* Game header - Enhanced font sizes */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.score-display, .level-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 16px; /* Increased from 14px */
}

.score-label, .level-label {
    color: #666;
}

#scoreValue, #currentLevel {
    color: #4CAF50;
    font-weight: bold;
}

.header-right {
    display: flex;
    gap: 8px;
}

.control-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    background: #ff6b6b;
    color: white;
    font-size: 14px; /* Increased from 12px */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Screen management */
.screen {
    width: 100%;
    height: calc(100% - 50px);
    position: absolute;
    top: 50px;
    left: 0;
}

/* Enhanced level selection styles with animations and visual elements */
.battle-arena {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Added floating background elements for visual excitement */
.background-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-icon {
    position: absolute;
    font-size: 24px;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-icon:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.floating-icon:nth-child(2) { top: 20%; right: 15%; animation-delay: 1s; }
.floating-icon:nth-child(3) { top: 60%; left: 5%; animation-delay: 2s; }
.floating-icon:nth-child(4) { bottom: 20%; right: 10%; animation-delay: 3s; }
.floating-icon:nth-child(5) { bottom: 10%; left: 20%; animation-delay: 4s; }
.floating-icon:nth-child(6) { top: 40%; right: 5%; animation-delay: 5s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Enhanced arena header with more visual appeal */
.arena-header {
    text-align: center;
    margin-bottom: 30px;
    z-index: 1;
    position: relative;
}

.arena-title {
    font-size: 26px; /* Increased from 22px */
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 255, 255, 0.3); }
    to { text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 255, 255, 0.6); }
}

.arena-subtitle {
    font-size: 18px; /* Increased from 16px */
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
}

.arena-description {
    font-size: 16px; /* Increased from 14px */
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.highlight-text {
    font-weight: bold;
    color: #FFD700;
}

.level-cards {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
    z-index: 1;
    position: relative;
}

/* Enhanced level cards with icons and difficulty indicators */
.level-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 15px;
    padding: 30px; /* Increased from 25px */
    width: 220px; /* Increased from 200px */
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border-color: #4CAF50;
}

.level-card.compulsory {
    background: linear-gradient(145deg, #fff3e0, #ffe0b2);
    border-color: #ff9800;
}

.level-card.compulsory::before {
    content: "⭐";
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 20px; /* Increased from 18px */
}

/* New card icon */
.card-icon {
    font-size: 36px; /* Increased from 32px */
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.card-header {
    font-size: 15px; /* Increased from 13px */
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-title {
    font-size: 18px; /* Increased from 16px */
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.card-description {
    font-size: 15px; /* Increased from 13px */
    color: #777;
    margin-bottom: 15px;
    line-height: 1.4;
}

.card-stats {
    font-size: 14px; /* Increased from 12px */
    color: #999;
    font-weight: 600;
    margin-bottom: 8px;
}

/* New difficulty indicator */
.card-difficulty {
    font-size: 16px; /* Increased from 14px */
    margin-top: 5px;
}

/* New motivational footer */
.arena-footer {
    margin-top: 25px;
    z-index: 1;
    position: relative;
}

.motivational-text {
    font-size: 18px; /* Increased from 16px */
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulse 2s infinite;
}

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

/* Clash Royale inspired visual elements */
.clash-visuals {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(90deg, #4a90e2, #7b68ee);
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.battle-tower {
    font-size: 32px;
    animation: towerPulse 3s ease-in-out infinite;
}

.battle-field {
    font-size: 28px;
    animation: battleSpin 4s linear infinite;
}

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

@keyframes battleSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Battle interface - Enhanced font sizes */
.battle-interface {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    gap: 15px;
}

.question-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px; /* Increased from 15px */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 16px; /* Increased from 14px */
    color: #666;
}

.question-text {
    font-size: 18px; /* Increased from 15px */
    line-height: 1.5;
    color: #333;
    font-weight: 500;
}

/* Answer grids - Enhanced font sizes */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px; /* Increased from 8px */
    flex: 1;
    overflow-y: auto;
}

.answer-option {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px; /* Increased from 15px */
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px; /* Increased from 14px */
    line-height: 1.4;
    text-align: left;
    min-height: 60px; /* Increased from 50px */
    display: flex;
    align-items: center;
}

.answer-option:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    transform: translateX(3px);
}

.answer-option.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    font-weight: 600;
}

.answer-option.correct {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.answer-option.incorrect {
    border-color: #f44336;
    background: rgba(244, 67, 54, 0.2);
    color: #c62828;
}

/* Level 3 dual selection */
.dual-selection {
    display: flex;
    gap: 15px;
    flex: 1;
    overflow: hidden;
}

.selection-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 20px; /* Increased from 15px */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.panel-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 12px;
    text-align: center;
    font-size: 17px; /* Increased from 15px */
}

/* Action panel - Enhanced font sizes */
.action-panel {
    flex-shrink: 0;
    text-align: center;
}

.submit-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 18px 40px; /* Increased from 15px 35px */
    font-size: 17px; /* Increased from 15px */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    min-width: 190px; /* Increased from 170px */
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Modal styles - Enhanced font sizes */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 35px; /* Increased from 30px */
    text-align: center;
    max-width: 90%;
    max-height: 80%;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-icon {
    font-size: 64px; /* Increased from 56px */
    margin-bottom: 15px;
}

.result-message {
    font-size: 20px; /* Increased from 18px */
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.correct-answer {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 18px; /* Increased from 15px */
    margin: 15px 0;
    font-size: 16px; /* Increased from 14px */
    line-height: 1.5;
    text-align: left;
}

.correct-answer h4 {
    color: #4CAF50;
    margin-bottom: 8px;
    font-size: 17px; /* Increased from 15px */
}

.next-btn, .menu-btn {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 18px 35px; /* Increased from 15px 30px */
    font-size: 17px; /* Increased from 15px */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    min-width: 160px; /* Increased from 140px */
}

.next-btn:hover, .menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.completion-icon {
    font-size: 80px; /* Increased from 72px */
    margin-bottom: 20px;
}

.completion-message {
    font-size: 22px; /* Increased from 20px */
    font-weight: bold;
    margin-bottom: 25px;
    color: #333;
}

.completion-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Mobile optimizations - Enhanced font sizes */
@media (max-width: 768px) {
    body {
        font-size: 17px; /* Increased from 15px */
    }
    
    .arena-title {
        font-size: 22px; /* Increased from 20px */
    }
    
    .arena-subtitle {
        font-size: 16px; /* Increased from 14px */
    }
    
    .level-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .level-card {
        width: 100%;
        max-width: 320px; /* Increased from 300px */
    }
    
    .dual-selection {
        flex-direction: column;
        gap: 10px;
    }
    
    .answers-grid {
        max-height: 200px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 25px; /* Increased from 20px */
    }
    
    .answer-option {
        font-size: 17px; /* Increased from 15px */
    }
    
    .question-text {
        font-size: 18px; /* Increased from 16px */
    }
    
    .clash-visuals {
        padding: 8px 15px;
    }
    
    .battle-tower {
        font-size: 28px; /* Slightly reduced for mobile */
    }
    
    .battle-field {
        font-size: 24px; /* Slightly reduced for mobile */
    }
}

/* Touch-friendly targets - Enhanced sizes */
@media (pointer: coarse) {
    .answer-option {
        min-height: 65px; /* Increased from 55px */
        padding: 20px; /* Increased from 18px */
        font-size: 17px; /* Increased from 15px */
    }
    
    .level-card {
        padding: 35px; /* Increased from 30px */
    }
    
    .submit-btn {
        padding: 20px 45px; /* Increased from 18px 40px */
        min-height: 65px; /* Increased from 55px */
        font-size: 18px; /* Increased from 16px */
    }
}