/**
 * game-common.css - Shared structural styles for game pages
 *
 * Base reset, layout, header, overlays, buttons, and stat boxes.
 * Game-specific colours, animations, and boards override inline.
 * Loaded BEFORE each game's <style> so inline rules win on override.
 */

/* ========================================
   CSS RESET
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   BODY BASE
   ======================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    color: white;
    overflow: hidden;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 101;
}

h1 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BACK BUTTON (pill)
   ======================================== */

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: bold;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.back-btn:hover,
.back-btn:active {
    background: white;
}

/* ========================================
   STATS ROW
   ======================================== */

.stats-row,
.stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ========================================
   STAT / SCORE BOXES
   ======================================== */

.stat-box,
.score-box {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 8px 20px;
    color: white;
    font-weight: bold;
    text-align: center;
}

.stat-box .label,
.score-label {
    font-size: 0.75rem;
    opacity: 0.8;
    text-transform: uppercase;
}

.stat-box .value,
.score-value {
    font-size: 1.3rem;
    font-weight: bold;
}

/* ========================================
   OVERLAY / START-SCREEN / GAME-OVER
   ======================================== */

.overlay,
.start-screen,
.game-over-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.overlay.hidden {
    display: none;
}

.overlay h2,
.start-screen h2,
.game-over-screen h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.overlay p,
.start-screen p,
.game-over-screen p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 20px;
    text-align: center;
    max-width: 300px;
}

/* ========================================
   PLAY BUTTON
   ======================================== */

.play-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
    padding: 18px 45px;
    font-size: 1.4rem;
    font-weight: bold;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.play-btn:active {
    transform: scale(0.95);
}

/* ========================================
   BACK LINK (in overlays)
   ======================================== */

.back-link {
    display: block;
    margin-top: 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1rem;
}

.back-link:hover,
.back-link:active {
    color: white;
    text-decoration: underline;
}

/* ========================================
   CONFETTI
   ======================================== */

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti {
    position: fixed;
    top: -50px;
    pointer-events: none;
    z-index: 200;
    animation: confettiFall var(--duration, 3s) linear forwards;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

/* ========================================
   HIDDEN UTILITY
   ======================================== */

.hidden {
    display: none !important;
}

/* ========================================
   SHARED KEYFRAMES
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes speechPop {
    0% { transform: translateX(-50%) scale(0); }
    50% { transform: translateX(-50%) scale(1.2); }
    100% { transform: translateX(-50%) scale(1); }
}

@keyframes comboAppear {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 1; }
    30% { transform: translate(-50%, -50%) scale(1.5) rotate(10deg); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2) rotate(0deg); opacity: 0; }
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-100px) scale(1.5); }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .play-btn,
    .back-btn {
        transition: none;
    }

    .confetti,
    .confetti-piece {
        animation: none;
        display: none;
    }
}
