:root {
    --bg-color: #111;
    --track-color: #222;
    --acc-color: #00ffcc;
    --warn-color: #ff3366;
    --text-color: #ffffff;
    --glass-bg: rgba(10, 10, 20, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    font-family: 'Orbitron', sans-serif;
}

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

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 800px;
    background-color: #000;
    box-shadow: 0 0 50px rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.2);
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    text-align: center;
}

h1 {
    font-size: 4rem;
    font-weight: 900;
    color: var(--acc-color);
    text-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
    margin-bottom: 30px;
    letter-spacing: 4px;
    font-style: italic;
}

.settings-panel {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    background: rgba(0,0,0,0.5);
    padding: 20px 40px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

label {
    font-size: 0.9rem;
    color: #888;
    letter-spacing: 1px;
}

select {
    padding: 10px;
    font-size: 1.1rem;
    background: #222;
    color: #fff;
    border: 1px solid var(--acc-color);
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.leaderboard {
    margin-bottom: 40px;
    color: #aaa;
}

.leaderboard h3 {
    color: #fff;
    margin-bottom: 10px;
}

.leaderboard p {
    margin: 5px 0;
}

.leaderboard span {
    color: var(--acc-color);
    font-weight: bold;
}

button {
    padding: 15px 50px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
    background: var(--acc-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.4);
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-style: italic;
}

button:hover {
    transform: scale(1.05);
    background: #fff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
}

button:active {
    transform: scale(0.95);
}

.results {
    background: rgba(0,0,0,0.5);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--acc-color);
    margin-bottom: 40px;
    text-align: left;
}

.results p {
    font-size: 1.5rem;
    margin: 10px 0;
}

.highlight {
    font-size: 3rem;
    color: var(--acc-color);
    font-weight: 900;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.stat-box {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ccc;
}

.stat-box span {
    color: #fff;
}

.combo span {
    color: var(--acc-color);
    text-shadow: 0 0 10px var(--acc-color);
}

/* Typing Interface */
#typing-interface {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    background: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 40px;
}

#word-display {
    display: flex;
    gap: 15px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 2.5rem;
    color: #666;
    margin-bottom: 20px;
    white-space: nowrap;
}

.word {
    transition: color 0.1s;
}

.word.current {
    color: #fff;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.word.correct {
    color: #555;
}

.letter.correct {
    color: var(--acc-color);
    text-shadow: 0 0 8px var(--acc-color);
}

.letter.incorrect {
    color: var(--warn-color);
    text-decoration: underline;
}

#typing-input {
    width: 60%;
    max-width: 600px;
    background: rgba(0,0,0,0.5);
    border: 2px solid #444;
    border-radius: 8px;
    color: transparent; /* Hide actual text */
    text-shadow: 0 0 0 #fff; /* Shadow creates visible text */
    padding: 15px 20px;
    font-size: 2rem;
    font-family: 'Share Tech Mono', monospace;
    text-align: center;
    outline: none;
    pointer-events: auto;
}

#typing-input:focus {
    border-color: var(--acc-color);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.2);
}

.shake {
    animation: shake 0.3s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}
