/* 
  NumType - High End Practice 
  Themes: Cyberpunk Neon (Default) | Glassmorphism
*/

:root {
    /* 
    THEME A: CYBERPUNK NEON 
    High contrast, glowing, glitchy, monolithic.
    */
    --bg-color: #050505;
    --text-primary: #e0e0e0;
    --text-dim: #444;

    --accent-primary: #00f3ff;
    /* Cyan Neon */
    --accent-secondary: #ff0055;
    /* Magenta Neon */
    --accent-glow: rgba(0, 243, 255, 0.4);

    --grid-color: rgba(255, 255, 255, 0.05);

    --key-bg: #111;
    --key-border: #333;
    --key-active: #00f3ff;

    --font-stack: 'Roboto Mono', monospace;

    --glass-blur: 0px;
    --card-bg: rgba(0, 0, 0, 0.8);
    --border-radius: 2px;
    /* Sharp corners for cyber feel */
}

[data-theme="glass"] {
    /* 
    THEME B: GLASSMORPHISM
    Soft, fluid, blurred, elegant, apple-esque.
    */
    --bg-color: #0f172a;
    /* Deep blue-grey */
    --text-primary: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.4);

    --accent-primary: #60a5fa;
    /* Soft Blue */
    --accent-secondary: #c084fc;
    /* Soft Purple */
    --accent-glow: rgba(96, 165, 250, 0.3);

    --grid-color: transparent;

    --key-bg: rgba(255, 255, 255, 0.1);
    --key-border: rgba(255, 255, 255, 0.2);
    --key-active: rgba(255, 255, 255, 0.4);

    --glass-blur: 20px;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-radius: 16px;
    /* Rounded for soft feel */
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-stack);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease;
    user-select: none;
}

/* --- Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* --- Background Effects --- */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -2;
    pointer-events: none;
    opacity: 0.5;
}

.bg-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    opacity: 0;
    /* Hidden in Neon by default, visible in Glass */
    transition: opacity 1s ease;
}

[data-theme="glass"] .bg-blobs {
    opacity: 1;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    left: -100px;
    opacity: 0.2;
    animation: float 10s infinite alternate;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -100px;
    right: -100px;
    opacity: 0.15;
    animation: float 12s infinite alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 30px);
    }
}

/* --- HUD Header --- */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    font-size: 14px;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--grid-color);
    transition: opacity 0.5s ease-in-out;
}

body.focus-mode .hud-header {
    opacity: 0.1;
    /* Dimmed but barely visible, or 0 if desired */
    /* opacity: 0; */
}

body.focus-mode .hud-header:hover {
    opacity: 1;
}

.logo {
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-glow);
}

.stats-container {
    display: flex;
    gap: 40px;
}

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

.stat-item .label {
    font-size: 10px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.stat-item .value {
    font-size: 20px;
    font-weight: 500;
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--text-dim);
    color: var(--text-primary);
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.theme-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* --- Practice Stage --- */
.practice-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Teaching Tip HUD - HIDDEN by user request */
.teaching-tip {
    display: none;
}

/* Number Stream */
/* Number Stream - Line Mode */
.number-stream {
    font-size: 3rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    /* Allow wrapping if needed, but we aim for one line mostly */
    gap: 4px;
    position: relative;
    max-width: 90%;
    text-align: center;
}

.number-char {
    position: relative;
    color: var(--text-dim);
    transition: all 0.1s;
    min-width: 0.6em;
    /* Fixed width for monospaced feel */
    display: inline-block;
}

body.focus-mode .number-char:not(.current) {
    opacity: 0.1;
    filter: blur(2px);
    transition: opacity 0.5s ease, filter 0.5s ease;
}

.number-char.current {
    color: var(--text-primary);
    text-shadow: 0 0 20px var(--accent-glow);
    text-shadow: 0 0 20px var(--accent-glow);
    transform: scale(1.1);
    /* Ensure current overrides the dimming */
    opacity: 1 !important;
    filter: none !important;
    opacity: 1 !important;
    filter: none !important;
    z-index: 10;
}

/* Look-ahead: Next 5 characters visible (Total 6 visible including current) */
body.focus-mode .number-char.current+.number-char,
body.focus-mode .number-char.current+.number-char+.number-char,
body.focus-mode .number-char.current+.number-char+.number-char+.number-char,
body.focus-mode .number-char.current+.number-char+.number-char+.number-char+.number-char,
body.focus-mode .number-char.current+.number-char+.number-char+.number-char+.number-char+.number-char {
    opacity: 0.5;
    filter: blur(0.5px);
    transition: all 0.2s ease;
}

/* Optional: Make the immediate next one slightly clearer */
body.focus-mode .number-char.current+.number-char {
    opacity: 0.7;
    filter: none;
}

.number-char.current::after {
    /* Caret */
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    animation: blink 1s infinite;
}

.number-char.correct {
    color: var(--accent-secondary);
    /* In neon, maybe we want them to stay or fade out. Let's make them fade to dim styling or distinctive color */
    color: var(--text-dim);
    opacity: 0.3;
}

.number-char.wrong {
    color: #ff3333;
    animation: shake 0.3s;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes shake {

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

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

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

#hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* --- Keyboard --- */
.keyboard-stage {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.mac-keyboard {
    transform: scale(0.9);
}

.key-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    justify-content: center;
}

.key {
    width: 50px;
    height: 50px;
    background: var(--key-bg);
    border: 1px solid var(--key-border);
    border-radius: 6px;
    /* Mac keys are slightly rounded */
    color: var(--text-dim);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    transition: color 0.2s ease, border-color 0.2s ease, text-shadow 0.2s ease;
}

.key.active {
    background: transparent;
    color: var(--accent-primary);
    border-color: rgba(0, 243, 255, 0.4);
    box-shadow: none;
    text-shadow: 0 0 10px var(--accent-glow);
    transform: none;
}

.key-tab {
    width: 80px;
    font-size: 12px;
}

.key-backspace {
    width: 80px;
    font-size: 12px;
}

.key-slash {
    width: 80px;
}

/* Hand Zones Removed */

/* Focus Mode */
.keyboard-stage {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

body.focus-mode .keyboard-stage {
    opacity: 0.2;
}

body.focus-mode .keyboard-stage:hover {
    opacity: 0.8;
    /* Allow peeking on hover */
}