@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --bg-color: #050505;
    --primary: #00ffcc;
    --secondary: #ff007f;
    --text: #e0e0e0;
    --danger: #ff3333;
    --font: 'Share Tech Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text);
    font-family: var(--font);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* CRT Scanline Effect */
.crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    z-index: 999;
    pointer-events: none;
    opacity: 0.3;
}

.lang-selector {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-selector button {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 5px 10px;
    font-family: var(--font);
    cursor: pointer;
}
.lang-selector button:hover {
    background: var(--primary);
    color: #000;
}

.screen {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.screen.active {
    display: flex;
}

.hidden { display: none !important; }

#score-container {
    text-align: center;
    font-size: 2rem;
    color: var(--primary);
}

#score-text {
    display: inline-block;
    transition: transform 0.1s ease-out, color 0.1s ease-out;
}

h1 {
    font-size: 4rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    margin-bottom: 2rem;
}

.text-danger {
    color: var(--danger);
    text-shadow: 0 0 10px var(--danger);
}

.cyber-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 15px 30px;
    font-size: 1.5rem;
    font-family: var(--font);
    cursor: pointer;
    margin: 10px;
    text-transform: uppercase;
    transition: all 0.2s;
    box-shadow: 0 0 5px var(--primary) inset, 0 0 5px var(--primary);
}

.cyber-btn:hover {
    background: var(--primary);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--primary) inset, 0 0 20px var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}
.modal-content {
    background: #111;
    border: 1px solid var(--secondary);
    padding: 30px;
    max-width: 600px;
    text-align: left;
    box-shadow: 0 0 15px var(--secondary);
}
.modal-content h2 { color: var(--secondary); margin-bottom: 15px;}
.modal-content p { font-size: 1.2rem; line-height: 1.5; margin-bottom: 20px;}

/* HUD */
.hud {
    position: absolute;
    top: 20px;
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-box { font-size: 1.2rem; width: 30%; text-align: left;}
.enemy-stat { text-align: right; }

.bar-bg {
    width: 100%;
    height: 15px;
    background: #222;
    border: 1px solid #555;
    margin-top: 5px;
}

.bar-fill { height: 100%; transition: width 0.3s; }
.hp-bar { background: var(--primary); width: 100%; box-shadow: 0 0 10px var(--primary);}
.enemy-bar { background: var(--secondary); width: 100%; box-shadow: 0 0 10px var(--secondary);}

/* Combat Area */
.combat-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 50px;
}

#enemy-sprite {
    width: 150px; height: 150px;
    border: 3px solid var(--secondary);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    margin-bottom: 40px;
    box-shadow: 0 0 30px var(--secondary);
}

#enemy-sprite .eye {
    width: 50px; height: 10px;
    background: var(--danger);
    box-shadow: 0 0 15px var(--danger);
    animation: scan 2s infinite alternate;
}

@keyframes scan {
    0% { transform: translateY(-20px); }
    100% { transform: translateY(20px); }
}

/* Puzzle */
.puzzle-container {
    background: rgba(0,255,204,0.1);
    padding: 30px;
    border: 1px solid var(--primary);
    border-radius: 10px;
}

#stroop-word {
    font-size: 4rem;
    font-weight: bold;
    margin: 20px 0;
    text-transform: uppercase;
}

.options {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.color-btn {
    background: #111;
    border: 1px solid var(--text);
    color: var(--text);
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 1.2rem;
    cursor: pointer;
}
.color-btn:hover { background: #333; }

.timer-bar-container {
    width: 100%;
    height: 5px;
    background: #333;
}
#timer-bar {
    height: 100%;
    background: var(--danger);
    width: 100%;
}

/* Shake Animation for Damage */
.shake {
    animation: shake 0.5s;
}
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* Combo & Juice */
#combo-container {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary);
    animation: pulse-combo 1s infinite alternate;
}

@keyframes pulse-combo {
    0% { transform: scale(1); text-shadow: 0 0 10px var(--primary); }
    100% { transform: scale(1.1); text-shadow: 0 0 20px #fff, 0 0 30px var(--primary); }
}

.floating-text {
    position: absolute;
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 10px #fff;
    animation: float-up 1s forwards ease-out;
}

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

.puzzle-btn {
    background: #111;
    border: 1px solid var(--text);
    color: var(--text);
    padding: 15px 25px;
    font-family: var(--font);
    font-size: 1.5rem;
    cursor: pointer;
    min-width: 100px;
}
@media (hover: hover) {
    .puzzle-btn:hover { background: #333; }
}

#puzzle-question {
    font-size: 4rem;
    font-weight: bold;
    margin: 20px 0;
    text-transform: uppercase;
}

.glitch-text {
    color: var(--text);
}

/* Leaderboard & Input */
#player-name-input {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font);
    font-size: 1.5rem;
    padding: 10px;
    width: 120px;
    text-align: center;
    margin: 0 10px;
}
#player-name-input:focus {
    outline: none;
    box-shadow: 0 0 10px var(--primary);
}

.leaderboard-container {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--primary);
    width: 80%;
    max-width: 500px;
    height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 10px;
}

#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.2rem;
}

#leaderboard-table th, #leaderboard-table td {
    padding: 15px 10px;
    border-bottom: 1px solid #003300;
}

#leaderboard-table th {
    color: var(--secondary);
}

#leaderboard-table th:first-child, #leaderboard-table td:first-child {
    text-align: left;
    width: 20%;
}

#leaderboard-table th:nth-child(2), #leaderboard-table td:nth-child(2) {
    text-align: left;
    width: 50%;
}

#leaderboard-table th:last-child, #leaderboard-table td:last-child {
    text-align: right;
    width: 30%;
}

@keyframes score-pop {
    0% { transform: scale(1); color: var(--primary); }
    50% { transform: scale(2); color: var(--secondary); text-shadow: 0 0 20px var(--secondary); }
    100% { transform: scale(1); color: var(--primary); }
}

.pop-anim {
    animation: score-pop 0.3s ease-out;
}

/* Mobile Optimization */
@media (max-width: 600px) {
    #top-bar {
        font-size: 0.8rem;
        padding: 10px;
        flex-wrap: wrap;
    }
    .hp-bar-container {
        width: 80px;
        height: 10px;
    }
    #score-container {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 15px;
        font-size: 1.2rem;
    }
    #btn-mute {
        top: auto !important;
        bottom: 20px !important;
        left: 20px !important;
        font-size: 2rem !important;
    }
    h1 {
        font-size: 2.5rem !important;
    }
    #puzzle-question {
        font-size: 2.5rem !important;
    }
    #puzzle-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        margin: 15px auto 20px auto;
    }
    .puzzle-btn {
        min-width: 0;
        padding: 12px 5px;
        font-size: 1rem;
    }
    .puzzle-container {
        padding: 15px;
        width: 95%;
    }
    .combat-area {
        margin-top: 20px;
    }
    #enemy-sprite {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }
    .lang-selector {
        bottom: 10px;
        right: 10px;
    }
    .lang-selector button {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
    .leaderboard-container {
        width: 95%;
    }
    #player-name-input {
        width: 100px;
        font-size: 1.2rem;
    }
}
