/* Whack-a-Mole Styles */
:root {
    --bg-dark: #050505;
    --bg-card: rgba(20, 20, 25, 0.7);
    --primary-neon: #6366f1;
    --secondary-neon: #ec4899;
    --accent-cyan: #06b6d4;
    --text-main: #fff;
    --text-dim: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.1);
    --radius-xl: 24px;
    --golden: #fbbf24;
    --danger: #ef4444;
    --success: #22c55e;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Screens */
.game-container {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 70vh;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

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

/* Start Screen */
.start-content {
    text-align: center;
    padding-top: 20px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.game-subtitle {
    color: var(--text-dim);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.mole-preview {
    margin: 20px auto 30px;
}

.preview-mole {
    font-size: 4rem;
    animation: previewBounce 1.5s ease-in-out infinite;
}

@keyframes previewBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.85rem;
}

.legend-mole {
    font-size: 1.3rem;
}

.legend-pts {
    font-weight: 700;
    font-size: 0.85rem;
}

.legend-pts.plus {
    color: var(--success);
}

.legend-pts.golden-pts {
    color: var(--golden);
}

.legend-pts.minus {
    color: var(--danger);
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 14px 48px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: scale(0.96);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 36px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
    color: var(--text-main);
    border-color: var(--primary-neon);
}

.high-score-display {
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.high-score-display span:last-child {
    color: var(--golden);
    font-weight: 700;
}

/* HUD */
.hud {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.hud-item {
    flex: 1;
    text-align: center;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 10px 8px;
}

.hud-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hud-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 2px;
}

.timer-item .hud-value {
    color: var(--accent-cyan);
}

/* Timer Bar */
.timer-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin-bottom: 20px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--primary-neon));
    border-radius: 3px;
    transition: width 0.3s linear;
}

.timer-bar.warning {
    background: linear-gradient(90deg, var(--danger), var(--secondary-neon));
}

/* Game Board */
.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px;
    user-select: none;
    -webkit-user-select: none;
}

/* Hole */
.hole {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.hole-inner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, #1a1520 0%, #0d0a12 70%);
    border: 2px solid rgba(99, 102, 241, 0.15);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.hole-front {
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 35%;
    background: linear-gradient(to top, rgba(20, 15, 30, 0.95), transparent);
    border-radius: 0 0 50% 50%;
    z-index: 3;
    pointer-events: none;
}

/* Mole */
.mole {
    position: absolute;
    bottom: -100%;
    width: 70%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: bottom 0.15s ease-out;
    z-index: 2;
    cursor: pointer;
}

.mole.active {
    bottom: 10%;
}

.mole.whacked {
    animation: whackSquish 0.3s ease forwards;
}

@keyframes whackSquish {
    0% { transform: scale(1); }
    30% { transform: scale(1.3, 0.6); }
    50% { transform: scale(0.8, 1.2); }
    70% { transform: scale(1.05, 0.95); }
    100% { transform: scale(0) rotate(20deg); opacity: 0; bottom: -100%; }
}

/* Score popup */
.score-popup {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.3rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 10;
    animation: scoreFloat 0.8s ease-out forwards;
    text-shadow: 0 0 10px currentColor;
}

.score-popup.plus {
    color: var(--success);
}

.score-popup.golden {
    color: var(--golden);
}

.score-popup.minus {
    color: var(--danger);
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1.3); }
}

/* Whack stars */
.whack-stars {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.whack-star {
    position: absolute;
    font-size: 1rem;
    animation: starBurst 0.5s ease-out forwards;
}

@keyframes starBurst {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.3); }
}

/* Countdown */
.countdown-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.countdown-overlay.active {
    display: flex;
}

.countdown-text {
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-neon), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: countdownPulse 0.8s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Game Over */
.gameover-content {
    text-align: center;
    padding-top: 30px;
}

.gameover-title {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.new-record {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--golden);
    margin-bottom: 20px;
    animation: recordPulse 0.6s ease infinite alternate;
}

.new-record.hidden {
    display: none;
}

@keyframes recordPulse {
    from { transform: scale(1); }
    to { transform: scale(1.08); text-shadow: 0 0 20px rgba(251, 191, 36, 0.5); }
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0 30px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 16px 12px;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
}

.gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* Hole active glow */
.hole.glow-normal .hole-inner {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.15);
}

.hole.glow-golden .hole-inner {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.hole.glow-bomb .hole-inner {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

/* Screen shake */
.shake {
    animation: screenShake 0.3s ease;
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* Score flash */
.score-flash {
    animation: flashScore 0.3s ease;
}

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

/* Ad container */
.g4f-ad-container {
    max-width: 560px;
    margin: 20px auto;
    padding: 20px;
    text-align: center;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
}

.ad-placeholder-content {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 400px) {
    .game-board {
        gap: 10px;
        padding: 10px;
    }

    .mole {
        font-size: 2rem;
    }

    .game-title {
        font-size: 2rem;
    }

    .legend {
        gap: 8px;
    }

    .legend-item {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .hud-value {
        font-size: 1.2rem;
    }
}

@media (min-width: 600px) {
    .game-board {
        gap: 20px;
    }

    .mole {
        font-size: 3rem;
    }
}
