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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Main game container with responsive height */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 8px;
    gap: 6px;
}

/* Responsive height for full browser */
@media (min-height: 600px) {
    .game-container {
        height: 90vh;
        gap: 10px;
        padding: 12px;
    }
}

/* Stats panel - horizontal layout for space efficiency */
.stats-panel {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 4px;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
    cursor: help;
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.stat-value {
    display: block;
    font-size: 1.1rem;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Question panel */
.question-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.instruction-text {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

/* Mole grid - 3x3 responsive layout */
.mole-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    flex: 1;
    max-height: 250px;
}

@media (min-height: 600px) {
    .mole-grid {
        max-height: 350px;
        gap: 12px;
    }
}

/* Mole holes */
.mole-hole {
    background: radial-gradient(circle, #8B4513 0%, #654321 70%, #3d2817 100%);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 70px;
}

.mole-hole:hover {
    transform: scale(1.02);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Mole character */
.mole {
    position: absolute;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 90%;
    background: linear-gradient(145deg, #D2691E, #A0522D);
    border-radius: 50% 50% 40% 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: bottom 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 4px;
}

.mole.active {
    bottom: 10%;
}

.mole.correct {
    background: linear-gradient(145deg, #32CD32, #228B22);
    animation: celebrate 0.5s ease;
}

.mole.incorrect {
    background: linear-gradient(145deg, #FF6347, #DC143C);
    animation: shake 0.5s ease;
}

.mole-face {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.answer-text {
    font-size: 0.7rem;
    font-weight: bold;
    color: white;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.1;
    word-wrap: break-word;
    max-width: 100%;
}

@media (min-height: 600px) {
    .mole-hole {
        min-height: 90px;
    }
    
    .mole-face {
        font-size: 1.5rem;
    }
    
    .answer-text {
        font-size: 0.8rem;
    }
}

/* Control panel */
.control-panel {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.game-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    min-height: 36px;
    flex: 1;
    max-width: 100px;
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.game-btn:active:not(:disabled) {
    transform: translateY(0);
}

.game-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pause-btn {
    background: linear-gradient(145deg, #FF9800, #F57C00);
}

.reset-btn {
    background: linear-gradient(145deg, #f44336, #d32f2f);
}

/* Feedback messages */
.feedback-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.feedback-message.show {
    opacity: 1;
}

.feedback-message.correct {
    background: rgba(76, 175, 80, 0.9);
}

.feedback-message.incorrect {
    background: rgba(244, 67, 54, 0.9);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    width: 90%;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 10px;
}

.final-stats {
    margin: 15px 0;
    font-weight: bold;
    color: #555;
}

.final-stats div {
    margin: 5px 0;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1500;
    max-width: 200px;
    text-align: center;
}

/* Animations */
@keyframes celebrate {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(-50%); }
    25% { transform: translateX(-55%); }
    75% { transform: translateX(-45%); }
}

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

/* Mobile optimizations */
@media (max-width: 480px) {
    .question-text {
        font-size: 1.1rem;
    }
    
    .instruction-text {
        font-size: 0.7rem;
    }
    
    .game-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .mole-grid {
        gap: 6px;
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .mole-hole:hover {
        transform: none;
    }
    
    .mole-hole:active {
        transform: scale(0.98);
    }
    
    .game-btn:hover {
        transform: none;
    }
    
    .game-btn:active {
        transform: scale(0.98);
    }
}