/* ========================
   RESET & BASE STYLES
   ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    user-select: none;
}

/* ========================
   GAME CONTAINER
   ======================== */
#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ========================
   HUD (TOP BAR)
   ======================== */
#hud {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid rgba(255, 100, 100, 0.3);
    z-index: 100;
}

.hud-left, .hud-right {
    display: flex;
    gap: 30px;
    align-items: center;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-label {
    font-size: 12px;
    color: #888;
    letter-spacing: 2px;
}

.hud-value {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.combo-display {
    color: #ff6b6b;
    transition: transform 0.2s ease;
}

.combo-display.combo-active {
    transform: scale(1.2);
    color: #ff3838;
    text-shadow: 0 0 20px rgba(255, 56, 56, 0.8);
}

/* Hearts */
.hearts-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.heart {
    width: 24px;
    height: 24px;
    color: #ff3838;
    font-size: 24px;
    animation: heartbeat 1s ease-in-out infinite;
}

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

/* ========================
   HEAT METER
   ======================== */
#heat-container {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 100, 100, 0.2);
}

.heat-label {
    font-size: 14px;
    font-weight: bold;
    color: #ff6b6b;
    letter-spacing: 2px;
}

.heat-bar-bg {
    flex: 1;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 100, 100, 0.4);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.heat-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff6b6b 0%, #ff3838 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 56, 56, 0.6);
}

.heat-bar-fill.max-heat {
    animation: pulse-heat 0.5s ease-in-out infinite;
}

@keyframes pulse-heat {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.focus-indicator {
    position: absolute;
    right: 30px;
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    opacity: 0;
    transition: opacity 0.3s ease;
    letter-spacing: 2px;
}

.focus-indicator.active {
    opacity: 1;
    animation: glow-pulse 1s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
    50% { text-shadow: 0 0 30px rgba(255, 215, 0, 1); }
}

/* ========================
   GAME AREA (FALLING WORDS)
   ======================== */
#game-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.word {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.word.matched {
    opacity: 0;
    transform: scale(1.5);
}

/* Special word types */
.word.golden {
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.1);
    animation: golden-glow 1s ease-in-out infinite;
}

@keyframes golden-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}

.word.bomb {
    color: #ff3838;
    text-shadow: 0 0 20px rgba(255, 56, 56, 0.8);
    border-color: rgba(255, 56, 56, 0.5);
    background: rgba(255, 56, 56, 0.1);
}

.word.freeze {
    color: #4ecdc4;
    text-shadow: 0 0 20px rgba(78, 205, 196, 0.8);
    border-color: rgba(78, 205, 196, 0.5);
    background: rgba(78, 205, 196, 0.1);
}

/* ========================
   INPUT CONTAINER
   ======================== */
#input-container {
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-top: 2px solid rgba(255, 100, 100, 0.3);
}

#word-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 100, 100, 0.4);
    border-radius: 10px;
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

#word-input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

#word-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ========================
   GAME OVER SCREEN
   ======================== */
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

#game-over.hidden {
    display: none;
}

.game-over-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.game-over-title {
    font-size: 64px;
    color: #ff3838;
    text-shadow: 0 0 30px rgba(255, 56, 56, 0.8);
    margin-bottom: 40px;
    letter-spacing: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.stat-label {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.restart-button {
    padding: 15px 50px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff3838 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 4px;
    box-shadow: 0 5px 20px rgba(255, 56, 56, 0.4);
}

.restart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 56, 56, 0.6);
}

.restart-button:active {
    transform: translateY(0);
}

/* ========================
   START SCREEN
   ======================== */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

#start-screen.hidden {
    display: none;
}

.start-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.game-title {
    font-size: 72px;
    color: #ff6b6b;
    text-shadow: 0 0 40px rgba(255, 107, 107, 0.8);
    margin-bottom: 20px;
    letter-spacing: 12px;
    animation: title-glow 2s ease-in-out infinite;
}

@keyframes title-glow {
    0%, 100% { text-shadow: 0 0 40px rgba(255, 107, 107, 0.8); }
    50% { text-shadow: 0 0 60px rgba(255, 107, 107, 1); }
}

.game-subtitle {
    font-size: 18px;
    color: #aaa;
    margin-bottom: 40px;
    letter-spacing: 2px;
}

.instructions {
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid rgba(255, 100, 100, 0.3);
    margin-bottom: 40px;
}

.instructions h3 {
    font-size: 20px;
    color: #ff6b6b;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

.instructions ul {
    list-style: none;
}

.instructions li {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.instructions li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #ff6b6b;
}

.start-button {
    padding: 15px 50px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff3838 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 4px;
    box-shadow: 0 5px 20px rgba(255, 56, 56, 0.4);
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 56, 56, 0.6);
}

.start-button:active {
    transform: translateY(0);
}

/* ========================
   ANIMATIONS & EFFECTS
   ======================== */

/* Screen shake on damage */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s;
}

/* ========================
   RESPONSIVE DESIGN
   ======================== */
@media (max-width: 768px) {
    #hud {
        padding: 15px 20px;
    }
    
    .hud-left, .hud-right {
        gap: 15px;
    }
    
    .hud-value {
        font-size: 20px;
    }
    
    .heart {
        width: 20px;
        height: 20px;
        font-size: 20px;
    }
    
    #heat-container {
        padding: 8px 20px;
    }
    
    .word {
        font-size: 18px;
        padding: 6px 12px;
    }
    
    #word-input {
        font-size: 18px;
        padding: 12px 16px;
    }
    
    .game-over-title {
        font-size: 48px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .game-title {
        font-size: 48px;
        letter-spacing: 8px;
    }
    
    .instructions {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .game-over-title {
        font-size: 36px;
        letter-spacing: 4px;
    }
    
    .game-title {
        font-size: 36px;
        letter-spacing: 4px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .restart-button, .start-button {
        font-size: 18px;
        padding: 12px 40px;
    }
}
