/* ============================================
   WORD BOMB - Viral Game Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800;900&display=swap');

:root {
    /* Colors */
    --bg-dark: #0a0a0f;
    --bg-gradient: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    --primary: #ff6b35;
    --primary-glow: rgba(255, 107, 53, 0.5);
    --success: #00ff88;
    --success-glow: rgba(0, 255, 136, 0.5);
    --danger: #ff3366;
    --danger-glow: rgba(255, 51, 102, 0.5);
    --warning: #ffcc00;
    --white: #ffffff;
    --gray: #666680;

    /* Typography */
    --font: 'Outfit', -apple-system, sans-serif;

    /* Sizing */
    --bomb-size: min(280px, 70vw);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-gradient);
    color: var(--white);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ============================================
   SCREENS
   ============================================ */

.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    padding-top: 40px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   START SCREEN
   ============================================ */

.logo-container {
    text-align: center;
    margin-bottom: 40px;
}

.bomb-icon {
    font-size: 80px;
    animation: bomb-bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 0 30px var(--primary-glow));
}

@keyframes bomb-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(-5deg);
    }

    50% {
        transform: translateY(-15px) rotate(5deg);
    }
}

.game-title {
    font-size: clamp(36px, 10vw, 56px);
    font-weight: 900;
    letter-spacing: 2px;
    margin-top: 10px;
    text-shadow: 0 0 40px var(--primary-glow);
}

.game-title .highlight {
    color: var(--primary);
}

.subtitle {
    font-size: 18px;
    color: var(--gray);
    margin-top: 10px;
}

.language-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px 40px;
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
}

.flag-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 48px;
}

.arrow {
    color: var(--primary);
    font-size: 32px;
}

.lang-label {
    margin-top: 10px;
    color: var(--gray);
    font-size: 14px;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c5a 100%);
    border: none;
    border-radius: 50px;
    padding: 18px 50px;
    font-family: var(--font);
    font-size: 20px;
    font-weight: 800;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 10px 40px var(--primary-glow);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 50px var(--primary-glow);
}

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

.btn-icon {
    font-size: 24px;
}

.mic-hint {
    margin-top: 20px;
    color: var(--gray);
    font-size: 14px;
}

/* ============================================
   GAME SCREEN
   ============================================ */

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(10, 10, 15, 0.9) 0%, transparent 100%);
    z-index: 10;
}

.score-container,
.streak-container,
.lives-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 10px;
    color: var(--gray);
    letter-spacing: 2px;
}

.score-value {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--warning), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.streak-container {
    display: flex;
    flex-direction: row;
    gap: 5px;
}

.streak-fire {
    font-size: 24px;
    animation: fire-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes fire-pulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.2);
    }
}

.streak-value {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
}

.lives-container {
    font-size: 24px;
    letter-spacing: 5px;
}

/* ============================================
   BOMB
   ============================================ */

.bomb-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 60px;
}

.bomb {
    position: relative;
    width: var(--bomb-size);
    height: var(--bomb-size);
}

.bomb-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #2a2a3a 0%, #1a1a2a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 -10px 30px rgba(0, 0, 0, 0.3),
        inset 0 10px 30px rgba(255, 255, 255, 0.05);
    animation: bomb-shake 0.1s ease-in-out infinite;
    animation-play-state: paused;
}

.bomb.shaking .bomb-body {
    animation-play-state: running;
}

@keyframes bomb-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px) rotate(-1deg);
    }

    75% {
        transform: translateX(3px) rotate(1deg);
    }
}

.bomb-fuse {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 40px;
    background: linear-gradient(to top, #333, #666);
    border-radius: 4px;
}

.fuse-spark {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 30px;
    animation: spark-flicker 0.2s ease-in-out infinite;
}

@keyframes spark-flicker {

    0%,
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 0.5;
        transform: translateX(-50%) scale(0.8);
    }
}

.bomb-face {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 80%;
}

.word-display {
    font-size: clamp(20px, 6vw, 32px);
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    color: var(--white);
    text-shadow: 0 0 20px var(--primary-glow);
    padding: 10px;
    word-break: break-word;
    line-height: 1.1;
}

.timer-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-top-color: var(--primary);
    animation: timer-rotate 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timer-ring.active {
    opacity: 1;
}

@keyframes timer-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.timer-display {
    margin-top: 30px;
    font-size: 48px;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary-glow);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.timer-display.warning {
    color: var(--danger);
    text-shadow: 0 0 30px var(--danger-glow);
    animation: timer-pulse 0.5s ease-in-out infinite;
}

@keyframes timer-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* ============================================
   MICROPHONE BUTTON
   ============================================ */

.mic-container {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mic-btn {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c5a 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px var(--primary-glow);
    transition: all 0.3s ease;
}

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

.mic-btn.recording {
    background: linear-gradient(135deg, var(--danger) 0%, #ff6688 100%);
    box-shadow: 0 10px 40px var(--danger-glow);
}

.mic-btn.recording .mic-pulse {
    animation: mic-pulse-anim 1s ease-out infinite;
}

.mic-icon {
    font-size: 36px;
}

.mic-pulse {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    opacity: 0;
}

@keyframes mic-pulse-anim {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.mic-status {
    margin-top: 15px;
    color: var(--gray);
    font-size: 14px;
    transition: color 0.3s ease;
}

.mic-status.recording {
    color: var(--danger);
}

.recognized-text {
    margin-top: 20px;
    font-size: 24px;
    font-weight: 600;
    color: var(--gray);
    min-height: 32px;
    text-align: center;
}

/* ============================================
   FEEDBACK OVERLAY
   ============================================ */

.feedback-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.feedback-overlay.active {
    opacity: 1;
    visibility: visible;
}

.feedback-overlay.success {
    background: rgba(0, 50, 30, 0.95);
}

.feedback-overlay.fail {
    background: rgba(50, 10, 20, 0.95);
}

.feedback-content {
    text-align: center;
    animation: feedback-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes feedback-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback-icon {
    font-size: 100px;
    margin-bottom: 20px;
}

.feedback-word {
    font-size: 42px;
    font-weight: 900;
    margin-bottom: 10px;
}

.feedback-translation {
    font-size: 24px;
    color: var(--gray);
    margin-bottom: 20px;
}

.feedback-points {
    font-size: 36px;
    font-weight: 800;
    color: var(--success);
}

.feedback-points.negative {
    color: var(--danger);
}

/* ============================================
   EXPLOSION EFFECT
   ============================================ */

.explosion {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    z-index: 50;
}

.explosion.active {
    animation: explosion-flash 0.5s ease-out forwards;
}

@keyframes explosion-flash {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3);
    }
}

.explosion-ring {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary) 0%, var(--danger) 50%, transparent 70%);
}

/* Screen shake effect */
.screen-shake {
    animation: screen-shake 0.5s ease-out;
}

@keyframes screen-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(-10px) rotate(-1deg);
    }

    20% {
        transform: translateX(10px) rotate(1deg);
    }

    30% {
        transform: translateX(-10px) rotate(-1deg);
    }

    40% {
        transform: translateX(10px) rotate(1deg);
    }

    50% {
        transform: translateX(-5px);
    }

    60% {
        transform: translateX(5px);
    }

    70% {
        transform: translateX(-2px);
    }

    80% {
        transform: translateX(2px);
    }
}

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

.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 60;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }

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

/* ============================================
   GAME OVER SCREEN
   ============================================ */

.gameover-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gameover-title {
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--danger), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-score {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px 60px;
    margin-bottom: 30px;
}

.final-label {
    display: block;
    color: var(--gray);
    font-size: 14px;
    margin-bottom: 10px;
}

.final-value {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--warning), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 40px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--success);
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   SCORE POPUP ANIMATION
   ============================================ */

.score-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    font-weight: 900;
    pointer-events: none;
    z-index: 70;
    animation: score-fly 1s ease-out forwards;
}

.score-popup.positive {
    color: var(--success);
    text-shadow: 0 0 30px var(--success-glow);
}

.score-popup.negative {
    color: var(--danger);
    text-shadow: 0 0 30px var(--danger-glow);
}

@keyframes score-fly {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -100%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -150%) scale(1);
        opacity: 0;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-height: 700px) {
    .bomb-container {
        margin-top: 30px;
    }

    .timer-display {
        margin-top: 15px;
        font-size: 36px;
    }

    .mic-container {
        margin-top: 20px;
    }

    .mic-btn {
        width: 60px;
        height: 60px;
    }

    .mic-icon {
        font-size: 28px;
    }
}

/* ============================================
   AI FEEDBACK
   ============================================ */

.ai-feedback-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 30px;
    max-width: 320px;
    min-height: 80px;
    backdrop-filter: blur(10px);
}

.ai-feedback-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--gray);
    font-size: 14px;
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ai-feedback-text {
    display: none;
    font-size: 16px;
    line-height: 1.5;
    color: var(--white);
    text-align: center;
    animation: feedback-fade-in 0.5s ease-out;
}

.ai-feedback-text.visible {
    display: block;
}

@keyframes feedback-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-feedback-loader.hidden {
    display: none;
}