/* =========================================================
   TYPEMASTER PRO — style.css
   Dead classes removed, duplicates scoped, palette unified.
   All IDs and JS-targeted classes preserved exactly.
========================================================= */

/* ── Variables ─────────────────────────────────────────── */
:root {
    /* Brand */
    --brand-primary: #0d9488;
    --brand-primary-hover: #0f766e;
    --brand-secondary: #f0fdfa;

    /* Light theme surfaces */
    --bg-main: #f4f6f8;
    --bg-surface: #ffffff;
    --bg-soft: #eef1f5;

    /* Text */
    --text-strong: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;

    /* Border */
    --border-color: #e2e8f0;

    /* Typing states */
    --typed-correct: #059669;
    --typed-incorrect: #e11d48;
    --typed-waiting: #94a3b8;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.06);

    /* Fonts */
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', monospace;
}

/* Dark theme — toggled by JS via body.light-theme class */
body.light-theme {
    --bg-main: #0f172a;
    --bg-surface: #1e293b;
    --bg-soft: #0b1120;
    --text-strong: #f8fafc;
    --text-body: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --typed-correct: #34d399;
    --typed-incorrect: #fb7185;
    --typed-waiting: #475569;
    --brand-secondary: #134e4a;
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.35);
}

/* ── Reset ─────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-body);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    scroll-behavior: smooth;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ── Typography ────────────────────────────────────────── */
h1,
h2,
h3,
h4 {
    color: var(--text-strong);
    font-weight: 700;
    line-height: 1.25;
}

.highlight {
    color: var(--brand-primary);
    font-weight: 700;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

/* Spacing utilities */
.mt-10 {
    margin-top: 10px;
}

.mt-15 {
    margin-top: 15px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-30 {
    margin-top: 30px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--brand-primary);
    color: white !important;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.btn-primary:hover {
    background-color: var(--brand-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-strong);
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background-color: var(--bg-soft);
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: var(--bg-soft);
    color: var(--text-strong);
}

/* ── Badge label ────────────────────────────────────────── */
.badge-label {
    background: var(--brand-secondary);
    color: var(--brand-primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-block;
    border: 1px solid rgba(13, 148, 136, 0.2);
}

/* ── kbd ────────────────────────────────────────────────── */
kbd {
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-strong);
}

/* =========================================================
   GLOBAL HEADER
========================================================= */
.global-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand-primary);
}

.logo-icon {
    width: 26px;
    height: 26px;
}

#site-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 4px;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s, background 0.2s;
    padding: 7px 13px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--brand-primary);
    background: var(--brand-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* =========================================================
   LAYOUT
========================================================= */
.content-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 80vh;
}

.page-section {
    padding-top: 48px;
    padding-bottom: 80px;
}

/* Generic card used by lessons & analytics */
.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 36px;
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* =========================================================
   PRACTICE WORKSPACE — soft 3D aesthetic
========================================================= */
.app-workspace.soft-aesthetic {
    position: relative;
    padding: 60px 20px 48px;
    background: linear-gradient(135deg, #e9eff5 0%, #d8e3eb 100%);
    border-radius: 24px;
    overflow: hidden;
    font-family: 'DM Sans', 'Inter', sans-serif;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

/* ── Time selector ── */
.soft-top-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    z-index: 10;
}

.dummy-icon {
    background: transparent;
    border: none;
    font-size: 1.15rem;
    color: #8e9bad;
    cursor: pointer;
    transition: color 0.2s;
}

.dummy-icon:hover {
    color: #5a6b82;
}

.soft-time-pill {
    display: flex;
    background: rgba(255, 255, 255, 0.45);
    border-radius: 30px;
    padding: 4px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.soft-time-pill .time-btn {
    background: transparent;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 500;
    color: #8e9bad;
    cursor: pointer;
    transition: all 0.25s;
    font-size: 0.9rem;
}

.soft-time-pill .time-btn.active,
.soft-time-pill .time-btn:hover {
    background: linear-gradient(135deg, #c4f1e5, #a3ebd5);
    color: #2b5c50;
    box-shadow: 0 3px 8px rgba(163, 235, 213, 0.4);
}

/* ── Main typing card ── */
.soft-app-card {
    background: #ffffff;
    width: 100%;
    max-width: 740px;
    border-radius: 22px;
    padding: 44px 48px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.03);
    z-index: 10;
    position: relative;
}

.soft-typing-container {
    position: relative;
    min-height: 120px;
}

#typing-area {
    position: relative;
    font-family: var(--font-mono);
    font-size: 1.55rem;
    line-height: 1.8;
    color: #2d3748;
    text-align: center;
}

#words-display {
    color: var(--typed-waiting);
}

.correct {
    color: var(--typed-correct);
}

.incorrect {
    color: var(--typed-incorrect);
    border-bottom: 2px solid var(--typed-incorrect);
}

/* Cursor highlight on next character */
#words-display span.correct+span:not(.correct):not(.incorrect),
#words-display span.incorrect+span:not(.correct):not(.incorrect),
#words-display span:not(.correct):not(.incorrect):first-child {
    border-left: 3px solid #89badd;
    margin-left: -3px;
    border-radius: 2px;
    animation: smoothBlink 1s infinite;
}

@keyframes smoothBlink {

    0%,
    100% {
        border-color: #89badd;
    }

    50% {
        border-color: transparent;
    }
}

#hidden-input {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: default;
    pointer-events: none;
}

/* ── Progress bar ── */
.soft-slider-track {
    width: 100%;
    height: 8px;
    background: #eef2f6;
    border-radius: 10px;
    margin-top: 36px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: visible;
}

.soft-slider-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #9bbde8, #a3ebd5);
    border-radius: 10px;
    position: relative;
    transition: width 1s linear;
}

.soft-slider-fill.warning {
    background: linear-gradient(90deg, #f9cb66, #f59e0b);
}

.soft-slider-fill.danger {
    background: linear-gradient(90deg, #fb7185, #e11d48);
}

.slider-thumb {
    position: absolute;
    right: -6px;
    top: -4px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ── Click-to-focus overlay ── */
.typing-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    transition: opacity 0.25s, visibility 0.25s;
}

.typing-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

body.light-theme .typing-overlay {
    background: rgba(15, 23, 42, 0.6);
}

.overlay-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 11px 22px;
    border-radius: 30px;
    font-weight: 500;
    color: #4a6cf7;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.typing-overlay:hover .overlay-content {
    transform: scale(1.05);
}

/* ── Stats strip below card ── */
.soft-footer-stats {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.soft-aesthetic .live-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.soft-aesthetic .stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.soft-aesthetic .stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8e9bad;
    font-weight: 600;
}

.soft-aesthetic .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    font-family: var(--font-mono);
    line-height: 1;
}

#restart-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    color: #8e9bad;
    cursor: pointer;
    transition: color 0.25s, transform 0.35s;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#restart-btn:hover {
    color: var(--brand-primary);
    transform: rotate(180deg);
}

.shortcut-hint {
    font-size: 0.78rem;
    color: #a0aec0;
}

.soft-aesthetic .shortcut-hint kbd {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: none;
}

/* ── History toggle button ── */
.history-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(13, 148, 136, 0.2);
    color: var(--brand-primary);
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    font-family: var(--font-ui);
    backdrop-filter: blur(6px);
    margin-top: 4px;
}

.history-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
    transform: translateY(-1px);
}

.history-toggle-btn.active {
    background: var(--brand-secondary);
    border-color: rgba(13, 148, 136, 0.35);
}

/* ── History panel (outside practice workspace) ── */
.history-panel {
    max-width: 740px;
    margin: 0 auto 48px;
    border-radius: 20px;
    padding: 32px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.soft-history-card .history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-close {
    font-size: 1rem;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.soft-history-card h3 {
    color: #2d3748;
    margin: 0;
}

.user-id-badge {
    background: var(--bg-soft);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.clean-list {
    list-style: none;
    margin-top: 16px;
}

.soft-history-card .clean-list li {
    background: white;
    padding: 11px 14px;
    margin-bottom: 7px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #2d3748;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    background: var(--bg-soft) !important;
    padding: 20px !important;
}

/* Chart */
.chart-container {
    margin: 16px 0;
}

/* =========================================================
   FLOATING 3D KEYS (inside practice workspace)
========================================================= */
.float-element {
    position: absolute;
    z-index: 5;
    pointer-events: none;
}

.float-key {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    border-radius: 12px;
}

.key-enter {
    width: 80px;
    height: 90px;
    top: 5%;
    left: 10%;
    background-color: #f3a895;
    color: #ba604c;
    font-size: 0.8rem;
    line-height: 1.2;
    transform: rotate(-15deg);
    box-shadow: inset -2px -4px 6px rgba(0, 0, 0, 0.1),
        inset 2px 4px 6px rgba(255, 255, 255, 0.5),
        4px 8px 0px #d98875,
        10px 20px 30px rgba(217, 136, 117, 0.3);
    animation: floatSlow 6s ease-in-out infinite;
    --rot: -15deg;
}

.key-shift {
    width: 90px;
    height: 45px;
    top: 45%;
    left: 5%;
    background-color: #bde4cd;
    color: #5c9e7e;
    font-size: 0.85rem;
    transform: rotate(10deg);
    box-shadow: inset -2px -4px 6px rgba(0, 0, 0, 0.1),
        inset 2px 4px 6px rgba(255, 255, 255, 0.5),
        3px 6px 0px #9dcbb4,
        8px 15px 25px rgba(157, 203, 180, 0.3);
    animation: floatSlow 5s ease-in-out infinite reverse;
    --rot: 10deg;
}

.key-space {
    width: 45px;
    height: 160px;
    bottom: -5%;
    right: 12%;
    background-color: #a7c8e6;
    color: #5880a8;
    font-size: 0.8rem;
    writing-mode: vertical-rl;
    transform: rotate(20deg);
    box-shadow: inset -2px -4px 6px rgba(0, 0, 0, 0.1),
        inset 2px 4px 6px rgba(255, 255, 255, 0.5),
        4px 6px 0px #8eb0cf,
        10px 20px 30px rgba(142, 176, 207, 0.3);
    animation: floatSlow 7s ease-in-out infinite;
    --rot: 20deg;
}

.key-c {
    width: 40px;
    height: 40px;
    top: 10%;
    left: 22%;
    background-color: #c9bcf0;
    color: #7f6db0;
    font-size: 1rem;
    border-radius: 8px;
    transform: rotate(15deg);
    box-shadow: inset -2px -4px 6px rgba(0, 0, 0, 0.1),
        inset 2px 4px 6px rgba(255, 255, 255, 0.5),
        2px 4px 0px #b1a2d6;
}

.key-arrow {
    width: 45px;
    height: 45px;
    bottom: 2%;
    right: 25%;
    background-color: #c9bcf0;
    color: #7f6db0;
    font-size: 1.2rem;
    border-radius: 10px;
    transform: rotate(-10deg);
    box-shadow: inset -2px -4px 6px rgba(0, 0, 0, 0.1),
        inset 2px 4px 6px rgba(255, 255, 255, 0.5),
        2px 5px 0px #b1a2d6,
        5px 10px 15px rgba(177, 162, 214, 0.3);
}

.decor-icon {
    font-size: 1.5rem;
    color: #9bbad6;
    opacity: 0.55;
}

.icon-mouse {
    top: 40%;
    right: 8%;
    transform: rotate(-20deg);
}

.icon-align {
    top: 50%;
    right: 5%;
    font-size: 2rem;
}

.icon-arrows-bot {
    bottom: 15%;
    right: 6%;
}

.decor-ring {
    color: #9bbad6;
    opacity: 0.45;
    font-size: 1.5rem;
    font-weight: bold;
}

.ring-1 {
    top: 30%;
    left: 8%;
}

.ring-2 {
    top: 50%;
    left: 12%;
}

@keyframes floatSlow {
    0% {
        transform: translateY(0px) rotate(var(--rot, 0deg));
    }

    50% {
        transform: translateY(-14px) rotate(var(--rot, 0deg));
    }

    100% {
        transform: translateY(0px) rotate(var(--rot, 0deg));
    }
}

@media (max-width: 900px) {

    .float-key,
    .decor-icon,
    .decor-ring {
        display: none;
    }

    .soft-app-card {
        padding: 28px 24px;
    }
}

/* =========================================================
   LESSONS PAGE (Page 2)
========================================================= */
.page-header {
    max-width: 860px;
    margin: 0 auto 36px;
    text-align: center;
}

.page-header h2 {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.curriculum-grid {
    max-width: 860px;
    margin: 0 auto;
}

.lesson-cards {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.lesson-cards li {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 22px 26px;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, color 0.2s;
    font-weight: 600;
    font-size: 1.05rem;
    box-shadow: var(--shadow-sm);
}

.lesson-cards li:hover {
    border-color: var(--brand-primary);
    transform: translateX(5px);
    color: var(--brand-primary);
}

#lesson-test-area {
    max-width: 860px;
    margin: 0 auto;
}

.lesson-test-header {
    margin-bottom: 24px;
}

.lesson-test-header h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.lesson-test-header p {
    color: var(--text-muted);
}

/* Lesson stat box — different from soft-aesthetic version */
#lesson-test-area .stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 10px;
}

#lesson-test-area .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

#lesson-test-area .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-strong);
    font-family: var(--font-mono);
    line-height: 1;
}

#lesson-test-area .stat-value small {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.typing-text-large {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    text-align: center;
    color: var(--typed-waiting);
    margin: 36px 0;
    line-height: 1.6;
}

.modern-input {
    width: 100%;
    padding: 18px 20px;
    font-family: var(--font-mono);
    font-size: 1.15rem;
    background: var(--bg-soft);
    border: 2px solid var(--border-color);
    color: var(--text-strong);
    border-radius: 12px;
    text-align: center;
    outline: none;
    transition: border-color 0.25s, background 0.25s;
}

.modern-input:focus {
    border-color: var(--brand-primary);
    background: var(--bg-surface);
}

.results-panel {
    background: var(--bg-soft);
    padding: 28px;
    border-radius: 12px;
    margin-top: 28px;
    text-align: center;
}

.results-header h4 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.results-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 22px 0;
}

.r-stat {
    display: flex;
    flex-direction: column;
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--font-mono);
}

.r-stat .label {
    font-size: 0.82rem;
    font-family: var(--font-ui);
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.r-stat .value {
    color: var(--text-strong);
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* =========================================================
   ANALYTICS PAGE (Page 3)
========================================================= */
.analytics-grid {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#keyboard-heatmap {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
    margin: 24px 0;
    background: var(--bg-soft);
    padding: 24px;
    border-radius: 12px;
}

.key-box {
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    transition: background 0.2s;
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.key-box.good {
    background: var(--typed-correct);
    color: white;
    border-color: var(--typed-correct);
}

.key-box.warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.key-box.danger {
    background: var(--typed-incorrect);
    color: white;
    border-color: var(--typed-incorrect);
}

.diagnostic-box {
    background: var(--brand-secondary);
    border: 1px solid rgba(13, 148, 136, 0.2);
    padding: 22px;
    border-radius: 12px;
    margin-top: 16px;
}

.diagnostic-box.success {
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.2);
    color: var(--typed-correct);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.diag-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-primary);
    margin-bottom: 12px;
}

.diag-header h4 {
    color: inherit;
    margin: 0;
}

#achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 18px;
    margin-top: 8px;
}

.badge {
    background: var(--bg-soft);
    border: 2px dashed var(--border-color);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    opacity: 0.55;
    filter: grayscale(1);
    transition: all 0.3s;
}

.badge.unlocked {
    border: 2px solid var(--brand-primary);
    opacity: 1;
    filter: grayscale(0);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.badge h4 {
    color: var(--brand-primary);
    margin-bottom: 7px;
}

/* =========================================================
   BENCHMARK SECTION (wpm-)
========================================================= */
.wpm-section {
    font-family: 'Sora', 'Inter', sans-serif;
    padding: 72px 24px;
    background: var(--bg-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 48px;
    border-radius: 24px;
    margin-bottom: 32px;
}

.wpm-section__header {
    text-align: center;
    max-width: 540px;
}

.wpm-section__title {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 800;
    color: #1a1d2e;
    margin: 0 0 10px;
    letter-spacing: -0.5px;
}

.wpm-section__subtitle {
    font-size: 0.98rem;
    color: #6b7280;
    margin: 0;
}

.wpm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    width: 100%;
    max-width: 1050px;
}

.wpm-card {
    border-radius: 22px;
    padding: 26px 22px 30px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 10px 28px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s, box-shadow 0.25s;
}

.wpm-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.09), 0 18px 44px rgba(0, 0, 0, 0.10);
}

.wpm-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0%, transparent 60%);
    pointer-events: none;
}

.wpm-card--blue {
    background: linear-gradient(145deg, #c2e8f8 0%, #a8dcf0 60%, #bde6f5 100%);
}

.wpm-card--mint {
    background: linear-gradient(145deg, #bdf2d8 0%, #a4ecc8 60%, #b8f0d4 100%);
}

.wpm-card--yellow {
    background: linear-gradient(145deg, #f5e9b0 0%, #eedfa0 60%, #f2e8b8 100%);
}

.wpm-card--pink {
    background: linear-gradient(145deg, #f0c8e0 0%, #e4b8d8 60%, #dcc8f0 100%);
}

.wpm-card__icon {
    width: 72px;
    height: 72px;
    margin-bottom: 10px;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.10));
}

.wpm-card__icon svg {
    width: 100%;
    height: 100%;
}

.wpm-card__speed {
    font-size: clamp(2.2rem, 3.5vw, 3rem);
    font-weight: 800;
    color: #1a1d2e;
    line-height: 1;
    letter-spacing: -1px;
}

.wpm-card__speed span {
    display: block;
    font-size: 0.9em;
    font-weight: 800;
    margin-top: 2px;
}

.wpm-card__label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1a1d2e;
    margin: 10px 0 3px;
}

.wpm-card__desc {
    font-size: 0.85rem;
    color: #3a3d4e;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 900px) {
    .wpm-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .wpm-grid {
        grid-template-columns: 1fr;
        max-width: 340px;
    }

    .wpm-section {
        padding: 48px 16px;
    }
}

/* =========================================================
   ERGONOMICS SECTION (ergo-)
========================================================= */
#ergonomics-section.ergo-section {
    font-family: 'DM Sans', sans-serif;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 0;
    background: linear-gradient(135deg, #ece9e2 0%, #e8e5de 50%, #eaeae4 100%);
    min-height: 460px;
    padding: 64px 48px;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
}

#ergonomics-section.ergo-section::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 12%;
    height: 76%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(180, 178, 172, 0.35), transparent);
    pointer-events: none;
}

.ergo-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 20px;
}

.ergo-illustration {
    width: 100%;
    max-width: 360px;
}

.ergo-svg {
    width: 100%;
    height: auto;
    display: block;
}

.ergo-caption {
    display: inline-block;
    margin-top: 18px;
    background: rgba(40, 40, 36, 0.7);
    color: #f0ece4;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 7px 18px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

.ergo-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-left: 40px;
}

.ergo-title {
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 600;
    color: #1c1c1a;
    margin: 0 0 6px;
    letter-spacing: -0.3px;
}

.ergo-tips {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ergo-tip {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f5f4f0;
    border: 1px solid rgba(200, 198, 192, 0.5);
    border-radius: 14px;
    padding: 16px 22px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 4px 10px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

.ergo-tip:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.07);
}

.ergo-tip--active {
    background: linear-gradient(135deg, #dceaf7 0%, #cfe0f2 100%);
    border-color: rgba(160, 192, 230, 0.6);
}

.ergo-tip__icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.ergo-tip__icon svg {
    width: 26px;
    height: 26px;
}

.ergo-tip p {
    margin: 0;
    font-size: 0.97rem;
    font-weight: 500;
    color: #2a2a28;
}

@media (max-width: 860px) {
    #ergonomics-section.ergo-section {
        grid-template-columns: 1fr;
        padding: 48px 28px;
        gap: 36px;
    }

    #ergonomics-section.ergo-section::after {
        display: none;
    }

    .ergo-content {
        padding-left: 0;
    }

    .ergo-illustration {
        max-width: 280px;
        margin: 0 auto;
    }
}

/* =========================================================
   ANIMATIONS & TOASTS
========================================================= */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.toast {
    background: var(--text-strong);
    color: var(--bg-main);
    padding: 14px 22px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.5s ease, fadeOut 0.5s ease-in 4.5s forwards;
    font-size: 0.9rem;
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* =========================================================
   GLOBAL RESPONSIVE
========================================================= */
@media (max-width: 768px) {
    .header-container {
        padding: 12px 16px;
    }

    #main-nav {
        display: none;
    }

    .content-wrapper {
        padding: 0 16px;
    }

    .app-workspace.soft-aesthetic {
        padding: 40px 16px 36px;
        border-radius: 16px;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   SITE FOOTER
   Paste this at the bottom of style.css.
   Save the keycap image as footer-bg.png in your project.
========================================================= */
.site-footer {
    position: relative;
    height: 400px;
    border-radius: 20px;
    overflow: hidden;

    /* ← the keycap image as background */
    background-image: url('assets/images/footer-bg.webp');
    background-size: cover;
    background-position: center;

    /* dark overlay so text stays readable */
    isolation: isolate;
}

/* semi-transparent overlay on top of the image */
.site-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(14, 20, 30, 0.55);
    border-radius: inherit;
    z-index: 0;
}

/* content sits above the overlay */
.ft-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 240px 1fr 1fr;
    gap: 0;
    padding: 6rem;
    align-items: center;
}

.ft-brand-name {
    font-size: 1.5rem;
    font-weight: 400;
    color: #ede9e2;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    font-family: var(--font-ui);
}

.ft-brand-sub {
    font-size: 0.84rem;
    font-weight: 300;
    color: rgba(200, 196, 190, 0.55);
    line-height: 1.65;
    max-width: 175px;
    font-family: var(--font-ui);
}

.ft-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ft-nav ul li a {
    font-size: 0.92rem;
    font-weight: 400;
    color: rgba(200, 198, 193, 0.62);
    text-decoration: none;
    transition: color 0.18s;
    font-family: var(--font-ui);
}

.ft-nav ul li a:hover {
    color: #ede9e2;
}

.ft-copy {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 14px 72px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.78rem;
    color: rgba(170, 168, 163, 0.35);
    font-family: var(--font-ui);
    margin: 0;
}

/* ── Responsive ── */
@media (max-width: 820px) {
    .site-footer {
        margin: 40px 16px 28px;
    }

    .ft-content {
        grid-template-columns: 1fr 1fr;
        gap: 28px;
        padding: 40px 32px;
    }

    .ft-brand {
        grid-column: 1 / -1;
    }

    .ft-copy {
        padding: 12px 32px 18px;
    }
}

@media (max-width: 480px) {
    .ft-content {
        grid-template-columns: 1fr;
        padding: 32px 24px;
    }
}