:root {
    /* Typing Specific Variables */
    --text-faded: rgba(99, 102, 241, 0.6);
    --error-color: #ef4444; /* Red 500 */
    --font-mono: 'JetBrains Mono', monospace;
    --transition-bounce: var(--ease-spring);
}

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

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 100vh;
    background: var(--bg-soft);
    color: var(--text-main);
    font-family: var(--font-sans);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding-bottom: 2rem;
}

/* Background Decorations - soft blobs for light theme */
.background-globes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.globe-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -200px;
    left: -200px;
    animation: float 20s infinite ease-in-out alternate;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation: float 25s infinite ease-in-out alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 30px); }
}

/* Main Layout */
.app-wrapper {
    width: 900px;
    max-width: 95%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: auto;
    margin-bottom: auto;
    margin-left: auto;
    margin-right: auto;
    padding-top: 73px;
}

/* Header */
.app-wrapper header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    margin-bottom: 10px;
}

.typing-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
    font-family: 'Poppins', sans-serif;
}

.dot {
    color: var(--primary);
}

.timer-selector {
    background: var(--bg-white);
    padding: 6px;
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    gap: 5px;
    border: 1px solid rgba(0,0,0,0.05);
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 9999px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-weight: 600;
    transition: var(--transition-bounce);
}

.time-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.time-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* New WPM Bar */
.wpm-bar {
    background: var(--bg-white);
    padding: 20px 40px;
    border-radius: var(--r-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.wpm-info {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.wpm-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
}

.wpm-value {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    font-family: var(--font-mono);
}

.time-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.time-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.time-value {
    font-size: 2.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-main);
}

/* Typing Area */
.typing-container {
    background: var(--bg-white);
    border-radius: var(--r-xl);
    padding: 50px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 30px;
    position: relative;
    border: 1px solid var(--border);
    transition: var(--transition-bounce);
}

.typing-container:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(99,102,241,0.2);
}

.input-field {
    opacity: 0;
    position: absolute;
    z-index: -999;
}

.typing-text {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    line-height: 2.2;
    color: rgba(15, 23, 42, 0.4);
    user-select: none;
    max-height: 250px;
    overflow: hidden;
}

.typing-text p {
    margin: 0;
}

.typing-text span {
    position: relative;
    transition: color 0.1s;
}

.typing-text span.correct {
    color: var(--text-main);
}

.typing-text span.incorrect {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

.typing-text span.active {
    color: var(--text-main);
}

.typing-text span.active::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 2px;
    height: 3px;
    width: 100%;
    background: var(--secondary);
    animation: blink 1s infinite cubic-bezier(0.4, 0, 0.6, 1);
    border-radius: 2px;
}

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

/* Footer Stats */
.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-main);
}

.restart-btn {
    background: var(--gradient-brand);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: var(--r-full);
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-bounce);
    font-size: 1.05rem;
    box-shadow: var(--shadow-brand);
}

.restart-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.45);
}

@media (max-width: 768px) {
    .app-wrapper { width: 100%; padding: 15px; }
    .app-wrapper header { flex-direction: column; gap: 15px; align-items: flex-start; }
    .timer-selector { width: 100%; justify-content: center; }
    .wpm-bar { flex-direction: column; gap: 20px; padding: 25px; align-items: flex-start; }
    .wpm-info, .time-info { width: 100%; justify-content: space-between; align-items: center; flex-direction: row; }
    .time-info { border-top: 1px solid rgba(0,0,0,0.05); padding-top: 20px; }
    .wpm-value { font-size: 3rem; }
    .typing-container { padding: 25px; border-radius: 24px; }
    .typing-text { font-size: 1.4rem; }
    .navbar .container { padding: 0 15px; }
}