/* Game UI - Sharp, Clean Design */
:root {
    /* Clean Blue Game Palette - Based on #00BADE */
    --primary: #00BADE;
    --primary-hover: #00d4fc;
    --primary-light: #33c8e5;
    --secondary: #80e0f0;
    --accent: #00a5c4;
    --accent-hover: #0090ab;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg-dark: #0f1419;
    --bg-medium: #1a1f2e;
    --bg-light: #252b3d;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border: #374151;
    --border-bright: #4b5563;
    --shadow: none;
    --shadow-hover: 0 0 15px rgba(0, 186, 222, 0.4);
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #00BADE;
    --secondary: #80e0f0;
    --accent: #00a5c4;
    --bg-dark: #0f1419;
    --bg-medium: #1a1f2e;
    --bg-light: #252b3d;
}

/* OLED Theme */
[data-theme="oled"] {
    --primary: #00BADE;
    --secondary: #80e0f0;
    --accent: #00a5c4;
    --bg-dark: #000000;
    --bg-medium: #111111;
    --bg-light: #1a1a1a;
}

/* Light Theme */
[data-theme="light"] {
    --primary: #00BADE;
    --secondary: #0090ab;
    --accent: #00a5c4;
    --bg-dark: #f8fafc;
    --bg-medium: #ffffff;
    --bg-light: #f1f5f9;
    --text-primary: #1f2937;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --border: #d1d5db;
    --border-bright: #9ca3af;
    --shadow-hover: 0 0 15px rgba(0, 186, 222, 0.2);
}

[data-theme="light"] .stats-placeholder,
[data-theme="light"] .stat-value,
[data-theme="light"] .stat-value.error,
[data-theme="light"] .result-value {
    text-shadow: none;
}

[data-theme="light"] .nav-btn {
    text-shadow: 0 0 4px rgba(0, 186, 222, 0.5);
}

[data-theme="light"] .nav-btn svg {
    filter: drop-shadow(0 0 3px rgba(0, 186, 222, 0.5));
}

[data-theme="light"] .nav-btn:hover {
    text-shadow: 0 0 8px var(--primary);
}

[data-theme="light"] .nav-btn:hover svg {
    filter: drop-shadow(0 0 6px var(--primary));
}

[data-theme="light"] .ctrl-btn svg {
    filter: drop-shadow(0 0 3px rgba(0, 186, 222, 0.5));
}

[data-theme="light"] .ctrl-btn:hover svg {
    filter: drop-shadow(0 0 6px var(--primary));
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.4;
    width: 100%;
    height: 100vh;
    overflow: auto; /* ALLOW SCROLLING */
    touch-action: manipulation;
    font-weight: 500;
}

/* Game Container */
.game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* MIN HEIGHT INSTEAD OF FIXED */
    width: 100vw;
    background: var(--bg-dark);
}

/* Header removed - more space for content */

/* Game Buttons - Sharp, Clean Blue Design - CONSISTENT STYLING */
.control-btn,
.game-btn,
.theme-btn {
    background: var(--bg-medium);
    border: 2px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0 1rem;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn:hover,
.game-btn:hover,
.theme-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: var(--shadow-hover);
    transform: none;
}

.control-btn:active,
.game-btn:active,
.theme-btn:active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* Button Variants */
.game-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.game-btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

.game-btn.secondary {
    background: var(--bg-light);
    border-color: var(--border-bright);
    color: var(--text-primary);
}

.game-btn.large {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    min-height: 48px;
}

.game-btn.full-width {
    width: 100%;
}

.game-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-medium);
    color: var(--text-muted);
    border-color: var(--border);
}

.game-btn:disabled:hover {
    background: var(--bg-medium);
    color: var(--text-muted);
    border-color: var(--border);
    box-shadow: none;
}

/* Blue accent line */
.accent-line {
    height: 2px;
    background: var(--primary);
    width: 100%;
}

/* Stats Bar - Clean Blue Game UI */
.stats-bar {
    background: var(--bg-medium);
    padding: 1rem 2rem;
    display: flex;
    min-height: 80px;
    align-items: center;
}

.stats-placeholder {
    flex: 1;
    text-align: center;
    color: var(--text-primary);
    font-size: 2.2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-shadow: 0 0 15px var(--primary);
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    width: 100%;
}

.stats-content.hidden {
    display: none;
}

.stat {
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 0;
    padding: 1rem;
    text-align: center;
    transition: border-color 0.15s ease;
    position: relative;
}

.stat:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1;
    text-shadow: 0 0 15px var(--primary);
}

.stat-value.error {
    color: var(--text-primary);
    text-shadow: 0 0 15px var(--error);
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.25rem;
    font-family: var(--font-ui);
}

/* Main Game Area - Sharp Game Design */
.game-main {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    background: var(--bg-dark);
}

.game-dashboard {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

/* Verse Reference - Clean Blue Style */
.verse-reference-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-medium);
    border: none;
    border-bottom: 2px solid var(--border);
    border-radius: 0;
    padding: 0.75rem 1.5rem;
    min-height: 50px;
}

.verse-reference {
    flex: 1;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 0;
    letter-spacing: 0.5px;
    font-family: var(--font-ui);
}

.nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    text-shadow: 0 0 6px var(--primary);
}

.nav-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    filter: drop-shadow(0 0 4px var(--primary));
}

/* Neutral-colored glyphs brighten to white with a blue glow on hover.
   Primary-colored text/icons are never glowed with the primary color. */
.nav-btn:hover {
    color: var(--text-primary);
    text-shadow: 0 0 12px var(--primary);
    transform: scale(1.2);
}

.nav-btn:hover svg {
    filter: drop-shadow(0 0 8px var(--primary));
}

.nav-btn.random-on {
    color: var(--primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.nav-btn.random-on svg {
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

/* Typing Container - Game UI Style */
.typing-container {
    flex: 1;
    background: var(--bg-dark);
    border: none;
    border-top: 2px solid var(--border);
    border-radius: 0; /* SHARP */
    padding: 2rem;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.typing-container:focus-within {
    border-top-color: var(--primary);
    box-shadow: inset 0 2px 0 0 var(--primary);
}

.text-display {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    line-height: 1.8;
    color: var(--text-secondary);
    position: relative;
    cursor: text;
    user-select: none;
    min-height: 60px;
    flex: 1;
    /* FIX: TOP ALIGNED - NOT CENTERED */
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* TOP */
    align-items: flex-start; /* LEFT */
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-y: auto;
}

.text-container {
    width: 100%;
    word-wrap: break-word;
    white-space: pre-wrap;
    /* Ensure text starts at top */
    margin: 0;
    padding: 0;
}

.letter {
    position: relative;
    transition: all 0.1s ease;
}

.letter.correct {
    color: var(--success);
    background: rgba(0, 208, 132, 0.1);
}

.letter.incorrect {
    color: var(--error);
    background: rgba(255, 71, 87, 0.15);
}

.letter.incorrect.extra {
    color: var(--error);
    background: rgba(255, 71, 87, 0.25);
    border-bottom: 2px solid var(--error);
}

/* Caret */
#caret {
    position: absolute;
    width: 3px;
    height: 2rem;
    background: var(--accent);
    border-radius: 2px;
    animation: blink 1.2s infinite;
    transition: left 0.1s ease, top 0.1s ease;
    z-index: 10;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Hidden Input */
.hidden-input {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    border: none !important;
    outline: none !important;
    font-size: 16px !important;
    background: transparent !important;
    z-index: 5 !important;
}

/* Game Controls - Single Row Bottom Bar */
.game-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-medium);
    border-top: 2px solid var(--border);
    padding: 0.5rem 1rem;
    flex-shrink: 0;
    margin-top: auto;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.controls-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 8px;
}

.ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    position: relative;
}

.ctrl-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
    filter: drop-shadow(0 0 4px var(--primary));
}

.ctrl-btn .btn-label {
    display: none;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ctrl-btn:hover {
    background: var(--bg-light);
    border-color: var(--border);
    color: var(--text-primary);
}

.ctrl-btn:hover svg {
    filter: drop-shadow(0 0 8px var(--primary));
}

.ctrl-btn:active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.ctrl-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* Show labels on wide screens */
@media (min-width: 900px) {
    .ctrl-btn {
        width: auto;
        padding: 0 0.75rem;
        height: 40px;
    }

    .ctrl-btn .btn-label {
        display: inline;
    }
}

/* Instructions moved to header */

/* Fullscreen Background Fireworks */
@keyframes firework-particle {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--end-x), var(--end-y));
        opacity: 0;
    }
}

.firework-burst {
    pointer-events: none;
}

.firework-particle {
    pointer-events: none;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 1.5rem;
    color: var(--text-muted);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Screen - Clean Blue Style */
.results-screen {
    padding: 1.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: var(--bg-dark);
    flex: 1;
}

.results-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
    width: 100%;
}

.results-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary);
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 100%;
}

.result-stat {
    background: var(--bg-medium);
    border: 2px solid var(--border);
    padding: 2rem;
    border-radius: 0;
    transition: all 0.15s ease;
    min-width: 0;
    overflow: hidden;
}

.result-stat:hover {
    border-color: var(--primary);
    background: var(--bg-light);
    box-shadow: var(--shadow-hover);
}

.result-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1;
    text-shadow: 0 0 20px var(--primary);
}

.result-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.75rem;
    font-family: var(--font-ui);
}

.results-verse {
    background: var(--bg-medium);
    border: 2px solid var(--border);
    padding: 2rem;
    border-radius: 0;
    margin-bottom: 2rem;
    overflow: visible;
}

.verse-ref {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verse-text {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Results error highlighting */
.result-error {
    position: relative;
    color: var(--error);
    cursor: pointer;
}

.result-error:hover::after {
    content: attr(data-typed);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 2px 6px;
    white-space: nowrap;
    z-index: 10;
}

.feedback {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.continue-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.continue-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.continue-hint kbd {
    background: var(--bg-accent);
    border: 2px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Mobile responsiveness removed FAB styles */

/* Modals - Sharp Game Style */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--bg-medium);
    border: 2px solid var(--border);
    border-radius: 0; /* SHARP */
    box-shadow: none;
    position: relative;
    z-index: 1;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 2rem;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-dark);
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 900;
    margin: 0;
    color: var(--primary);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-close {
    background: var(--error);
    border: 2px solid var(--error);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 0; /* SHARP */
    font-size: 1.2rem;
    font-weight: 900;
    padding: 0;
}

.modal-close:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

/* Form Elements - Sharp Game Style */
.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    display: block;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.form-control {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0; /* SHARP */
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    transition: all 0.05s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: inset 0 0 0 2px var(--primary);
}

.form-control:disabled {
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: var(--border);
}

/* Help Content */
.help-section {
    margin-bottom: 2.5rem;
}

.help-section h4 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 1rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 0.75rem 0;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.help-section li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.4rem;
}

/* Context browsing buttons - flush, full-width, always visible */
.context-load-btn {
    width: 100%;
    border-left: none;
    border-right: none;
    border-radius: 0;
    flex-shrink: 0;
    min-height: 44px;
}

/* Context Text */
.context-text {
    line-height: 1.8;
}

.context-verse {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.context-verse:not(.current) {
    cursor: pointer;
}

.context-verse:not(.current):hover {
    background: var(--bg-accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.context-verse.current {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.context-reference {
    font-weight: 700;
    color: var(--accent);
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.context-verse.current .context-reference {
    color: white;
}

/* Init Screen - Corpus Selection */
.init-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
    gap: 2.5rem;
}

.init-title {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    font-family: var(--font-ui);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.init-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
}

.init-row {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 60px;
}

.init-link {
    flex: 1;
    min-width: 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-medium);
    border: 2px solid var(--border);
    border-right: none;
    border-radius: 0;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.init-link:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
}

.init-link:active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.init-play {
    width: 60px;
    min-width: 60px;
    height: auto;
    min-height: 60px;
    border: 2px solid var(--border);
    border-radius: 0;
    background: var(--bg-medium);
    font-size: 1.4rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
}

.init-play:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    text-shadow: 0 0 12px rgba(255,255,255,0.6);
}

.init-random {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.init-random-btn {
    padding: 1rem 2.5rem;
    background: var(--bg-medium);
    border: 2px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.init-random-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.init-random-btn:active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    transform: scale(0.97);
}

.init-random-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
}

/* Random indicator active state */
.random-indicator.active {
    border-radius: 20px;
    background: var(--primary);
    border: 2px solid var(--primary);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(0, 186, 222, 0.4);
}

.random-indicator.active:hover {
    background: var(--primary);
    opacity: 0.85;
}

/* Wave text animation */
.wave-text {
    display: inline-block;
}

.wave-char {
    display: inline-block;
    animation: wave-enlarge 2.5s ease-in-out infinite;
    animation-delay: var(--wave-delay);
}

@keyframes wave-enlarge {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.6); }
    30% { transform: scale(1); }
}

/* Responsive Design - Game Mobile Optimization */
@media (max-width: 768px) {
    /* Header removed - no mobile styles needed */
    
    .stats-bar {
        padding: 0.75rem 1rem;
        min-height: 60px;
    }
    
    .stats-placeholder {
        font-size: 1.8rem;
    }
    
    .stats-content {
        gap: 0.5rem; /* SMALLER GAP */
    }
    
    .stat {
        padding: 0.5rem; /* SMALLER PADDING */
    }
    
    .stat-value {
        font-size: 1.2rem; /* SMALLER TEXT */
    }
    
    .stat-label {
        font-size: 0.6rem; /* SMALLER LABEL */
    }
    
    .game-main {
        padding: 0;
        gap: 0;
    }
    
    .verse-reference-bar {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .verse-reference {
        font-size: 1.4rem;
        padding: 0.3rem;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
    }
    
    .typing-container {
        padding: 1rem;
        flex: 1;
    }
    
    .text-display {
        font-size: 1.1rem;
        line-height: 1.6;
        min-height: 60px;
        /* CRITICAL: Force top alignment on mobile */
        justify-content: flex-start !important;
        align-items: flex-start !important;
    }
    
    .text-container {
        /* CRITICAL: Ensure text container takes full space */
        width: 100%;
    }
    
    #caret {
        height: 1.4rem;
        width: 2px;
    }
    
    .game-controls {
        padding: 0.25rem 0.5rem;
        min-height: 36px;
    }
    
    .ctrl-btn {
        width: 36px;
        height: 36px;
    }
    
    .ctrl-btn .btn-label {
        display: none;
    }
    
    .controls-divider {
        height: 24px;
        margin: 0 4px;
    }
    
    .game-btn {
        width: 100%;
        justify-content: center;
        height: clamp(44px, 10vw, 56px);
        font-size: clamp(0.8rem, 2vw, 1rem);
    }
    
    .results-title {
        font-size: 2rem;
        margin-bottom: 1.5rem;
        letter-spacing: 2px;
    }
    
    .results-stats {
        grid-template-columns: repeat(3, 1fr); /* KEEP 3 COLUMNS */
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
        overflow: hidden;
    }
    
    .result-stat {
        padding: 0.75rem 0.5rem; /* SMALLER PADDING */
        min-width: 0; /* ALLOW SHRINKING */
        overflow: hidden;
    }
    
    .result-value {
        font-size: 1.8rem; /* SMALLER TEXT */
    }
    
    .modal-content {
        margin: 1rem;
        max-height: 90vh;
    }
    
    .modal-header,
    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-bar {
        padding: 0.5rem;
        min-height: 50px;
    }
    
    .stats-placeholder {
        font-size: 1.6rem;
    }
    
    .stats-content {
        grid-template-columns: repeat(4, 1fr); /* KEEP 4 COLUMNS ON SMALL SCREENS */
        gap: 0.25rem; /* TINY GAP */
    }
    
    .stat {
        padding: 0.4rem 0.2rem; /* VERY COMPACT */
    }
    
    .stat-value {
        font-size: 1rem; /* SMALLER BUT READABLE */
    }
    
    .stat-label {
        font-size: 0.5rem; /* TINY LABELS */
        margin-top: 0.1rem;
    }
    
    .verse-reference-bar {
        padding: 0.5rem;
    }
    
    .verse-reference {
        font-size: 1.2rem;
        padding: 0.3rem;
    }
    
    .nav-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .typing-container {
        padding: 0.75rem;
    }
    
    .text-display {
        font-size: 1rem;
        min-height: 40px;
        line-height: 1.5;
        /* CRITICAL: Double-ensure top alignment */
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
    }
    
    .text-container {
        /* CRITICAL: Full width and proper sizing */
        width: 100% !important;
    }
    
    #caret {
        height: 1.2rem;
        width: 2px;
    }
    
    .game-controls {
        padding: 0.2rem 0.4rem;
        min-height: 32px;
    }
    
    .ctrl-btn {
        width: 32px;
        height: 32px;
    }
    
    .ctrl-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .controls-divider {
        height: 20px;
        margin: 0 3px;
    }
    
    .results-screen {
        padding: 1rem;
    }
    
    .results-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
        max-width: 100%;
        overflow: hidden;
    }
    
    .result-stat {
        padding: 0.5rem 0.25rem;
        min-width: 0;
        overflow: hidden;
    }
    
    .result-value {
        font-size: 1.4rem;
    }
    
    .result-label {
        font-size: 0.65rem;
    }
}

/* Key Press Feedback */
.key-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    padding: 1rem 2rem;
    border: 2px solid var(--primary);
    border-radius: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    text-shadow: 0 0 15px #ffffff;
}

.key-feedback.show {
    opacity: 0.9;
}
.hidden {
    display: none !important;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #caret {
        animation: none;
        opacity: 1;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --border-hover: #333333;
    }
    
    .letter.correct {
        background-color: rgba(0, 208, 132, 0.3);
    }
    
    .letter.incorrect {
        background-color: rgba(255, 71, 87, 0.3);
    }
}

/* Focus management */
.control-btn:focus-visible,
.game-btn:focus-visible,
.nav-btn:focus-visible,
.ctrl-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}