:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --accent: #ff8c00;
    --accent-glow: rgba(255, 140, 0, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #666666;
    --guide-line: #333333;
    --border: #222222;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 0 20px;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.title-text {
    background: linear-gradient(135deg, var(--text-primary), #cccccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-bolt {
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 0 10px var(--accent));
}

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

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Reading Display */
.reading-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 20px;
    margin: 20px 0;
    position: relative;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.guide-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--guide-line), transparent);
}

.guide-line.top { top: 60px; }
.guide-line.bottom { bottom: 80px; }

.focal-point {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0.3;
}

.tick-mark {
    width: 2px;
    height: 20px;
    background: var(--accent);
    border-radius: 1px;
}

.word-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
    animation: wordPop 0.1s ease-out;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
    word-break: break-word;
}

.word-display.active {
    text-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent-glow);
}

@keyframes wordPop {
    0% { transform: scale(0.95); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.progress-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ffaa33);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Controls Panel */
.controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.wpm-control {
    margin-bottom: 16px;
}

.wpm-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.wpm-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.wpm-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 4px;
    cursor: pointer;
}

.wpm-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 15px var(--accent-glow);
    transition: transform 0.2s;
}

.wpm-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.wpm-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.preset-btn {
    flex: 1;
    min-width: 50px;
    padding: 10px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.preset-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    font-weight: 700;
}

.main-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.play-btn, .reset-btn, .sound-btn, .challenge-btn {
    padding: 14px 20px;
    border-radius: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.play-btn {
    flex: 2;
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.play-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.play-btn.playing {
    background: #ff5500;
    border-color: #ff5500;
}

.reset-btn {
    flex: 1;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.reset-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.sound-btn {
    width: 52px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 1.2rem;
    padding: 14px;
}

.sound-btn.on {
    color: var(--accent);
    border-color: var(--accent);
}

.challenge-btn {
    flex: 1.5;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.challenge-btn.active {
    background: linear-gradient(135deg, #ff6b00, #ff8c00);
    color: var(--bg-primary);
    border-color: var(--accent);
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.highlight {
    color: var(--accent);
}

/* Text Input */
.text-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.input-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.word-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent);
}

.text-input {
    flex: 1;
    min-height: 150px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent);
}

.text-input::placeholder {
    color: var(--text-secondary);
}

.sample-btn {
    margin-top: 12px;
    padding: 12px 20px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sample-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    border-style: solid;
}

/* Shortcuts */
.shortcuts {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.shortcuts span {
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0 20px;
    margin-top: auto;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--accent);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .app-container {
        padding: 15px;
    }

    .title {
        font-size: 1.8rem;
    }

    .tagline {
        font-size: 0.85rem;
    }

    .reading-display {
        padding: 30px 15px;
        min-height: 180px;
    }

    .word-display {
        font-size: 2rem;
    }

    .guide-line.top { top: 40px; }
    .guide-line.bottom { bottom: 60px; }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-controls {
        flex-direction: column;
    }

    .play-btn, .reset-btn, .challenge-btn {
        width: 100%;
    }

    .sound-btn {
        width: 100%;
    }

    .preset-buttons {
        justify-content: space-between;
    }

    .preset-btn {
        min-width: 55px;
        flex: 0 1 auto;
    }

    .shortcuts {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
}