/* ============================================================
   TYPE MASTER PRO — TYPING TEST PAGE STYLES (2026)
   Glassy · Modern · Premium · Sticky · 3-Line Typing Area
   ============================================================ */

/* ============================================================
   PAGE LAYOUT — FIXED FOR STICKY ELEMENTS
   ============================================================ */
html {
    height: 100%;
    overflow-y: scroll;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}

/* ============================================================
   TYPING FONTS
   ============================================================ */
#typed-text-display,
.text-display {
    font-family: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
}

/* ============================================================
   TEST CONTAINER — Glassy Card
   ============================================================ */
.test-container {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 32px;
    border-radius: 28px;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.6);
    width: 100%;
    max-width: 900px;
    text-align: center;
    transition: background-color .3s, color .3s, box-shadow .3s;
    box-sizing: border-box;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.test-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
    opacity: 0.9;
}

body.dark-mode .test-container {
    background: rgba(19, 26, 43, 0.72);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.test-container h1 {
    color: var(--light-primary, #4f46e5);
    margin-bottom: 10px;
    font-size: clamp(1.6rem, 4vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: color .3s;
}

body.dark-mode .test-container h1 {
    background: linear-gradient(135deg, #818cf8 0%, #c4b5fd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.test-container .subtitle {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    font-weight: 500;
    color: var(--light-text-soft, #475569);
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

body.dark-mode .test-container .subtitle {
    color: var(--dark-text-soft, #cbd5e1);
}

.test-container > p {
    color: var(--light-text-muted, #94a3b8);
    margin-bottom: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
}

body.dark-mode .test-container > p {
    color: var(--dark-text-muted, #94a3b8);
}

/* ============================================================
   CONFIG BAR — Glassy Pills
   ============================================================ */
.config-bar {
    justify-content: center;
    display: flex;
    margin-bottom: 25px;
    align-items: center;
    gap: 20px;
    font-size: 1.05rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 100000 !important;
}

.config-bar,
.stat p {
    color: var(--light-text-soft, #475569);
    font-weight: 600;
    transition: color .3s;
}

body.dark-mode .config-bar,
body.dark-mode .stat p {
    color: var(--dark-text-soft, #cbd5e1);
}

.config-bar p,
.stat p {
    margin: 0;
}

.time-selector {
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--light-text, #0f172a);
    z-index: 100000 !important;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.time-selector:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: var(--light-primary, #4f46e5);
    color: var(--light-primary, #4f46e5);
}

body.dark-mode .time-selector {
    background: rgba(20, 26, 43, 0.85);
    border-color: rgba(129, 140, 248, 0.2);
    color: var(--dark-text, #e5e7eb);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .time-selector:hover {
    background: rgba(30, 40, 60, 0.95);
    border-color: var(--dark-primary, #818cf8);
    color: var(--dark-primary, #818cf8);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 14px;
    box-shadow:
        0 12px 40px rgba(15, 23, 42, 0.15),
        0 4px 12px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    min-width: 100%;
    z-index: 100001 !important;
    padding: 6px;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    transition: opacity .2s cubic-bezier(0.4, 0, 0.2, 1),
                transform .2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top center;
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.dropdown-item {
    padding: 10px 18px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    color: var(--light-text, #0f172a);
    border-radius: 10px;
    transition: background-color .15s, color .15s, transform .15s;
    font-size: 0.95rem;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(124, 58, 237, 0.1));
    color: var(--light-primary, #4f46e5);
    transform: translateX(3px);
}

body.dark-mode .dropdown-menu {
    background: rgba(20, 26, 43, 0.96);
    border-color: rgba(129, 140, 248, 0.18);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 4px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .dropdown-item {
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .dropdown-item:hover {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.15), rgba(167, 139, 250, 0.15));
    color: var(--dark-primary, #818cf8);
}

/* ============================================================
   TEST AREA
   ============================================================ */
.test-area {
    position: relative;
    margin-bottom: 10px;
}

.overlay-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--light-text, #0f172a);
    font-size: 2.5rem;
    font-weight: 800;
    justify-content: center;
    display: flex;
    align-items: center;
    border-radius: 14px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease-in-out;
    flex-direction: column;
    line-height: 1.2;
    cursor: pointer;
    letter-spacing: -0.02em;
}

#times-up-overlay,
body.dark-mode #times-up-overlay {
    color: #ef4444;
    cursor: default;
    font-size: 3rem;
    text-shadow: 0 2px 20px rgba(239, 68, 68, 0.4);
}

body.dark-mode .overlay-message {
    background: rgba(10, 14, 26, 0.85);
    color: var(--dark-text, #e5e7eb);
}

.overlay-message.show {
    opacity: 1;
    pointer-events: auto;
}

.overlay-message .resume-prompt {
    font-size: 1.15rem;
    font-weight: 500;
    margin-top: 16px;
    color: var(--light-text-soft, #475569);
    letter-spacing: 0;
}

body.dark-mode .overlay-message .resume-prompt {
    color: var(--dark-text-soft, #cbd5e1);
}

/* ============================================================
   TEXT DISPLAY — Shows exactly ~3 lines
   ============================================================ */
.text-display {
    color: var(--light-text-muted, #94a3b8);
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    /* 📐 Math: 3 lines × (1.4rem × 1.6 line-height) ≈ 108px
       + padding (28px) + border (2px) = ~120px total */
    height: 120px;
    min-height: 110px;
    max-height: 130px;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    transition: border-color .3s, color .3s, height .3s, background-color .3s;
    cursor: text;
    overflow-anchor: none;
    overscroll-behavior: contain;
    box-shadow:
        inset 0 1px 3px rgba(15, 23, 42, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.9);
    font-family: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
    font-size: 1.4rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
    text-align: left;
}

body.dark-mode .text-display {
    background: rgba(15, 20, 35, 0.55);
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text-muted, #94a3b8);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.04);
}

.text-display::-webkit-scrollbar {
    display: none;
}

.text-display span {
    display: inline;
    padding: 2px 0;
    border-radius: 3px;
    transition: color .12s ease-out;
}

span.space {
    padding: 2px .25em;
}

#typed-text-display {
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-sizing: border-box;
    font-family: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--light-text, #0f172a);
    transition: background-color .3s, color .3s, border-color .3s;
    font-size: 1.1rem;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.04);
}

body.dark-mode #typed-text-display {
    background: rgba(15, 20, 35, 0.5);
    color: var(--dark-text, #e5e7eb);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.input-field {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: -1;
    resize: none;
    overflow: hidden;
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* ============================================================
   STATS — Glassy Cards
   ============================================================ */
.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin: 25px 0;
    flex-wrap: wrap;
    min-height: 58px;
}

.stat {
    font-size: 1.05rem;
    padding: 14px 22px;
    border-radius: 14px;
    min-width: 130px;
    position: relative;
    transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
    opacity: 0;
    transition: opacity .3s;
}

.stat:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(79, 70, 229, 0.2);
}

.stat:hover::before {
    opacity: 1;
}

body.dark-mode .stat {
    background: rgba(20, 26, 43, 0.7);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .stat:hover {
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.35);
}

.stat.hidden {
    display: none;
}

.stat span {
    font-size: 1.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    line-height: 1;
}

body.dark-mode .stat span {
    background: linear-gradient(135deg, #818cf8, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat span.timer-value {
    background: linear-gradient(135deg, #d946ef, #f0abfc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .stat span.timer-value {
    background: linear-gradient(135deg, #e879f9, #f0abfc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat p {
    margin: 6px 0 0 0;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--light-text-muted, #94a3b8);
}

body.dark-mode .stat p {
    color: var(--dark-text-muted, #94a3b8);
}

/* ============================================================
   BUTTONS — Premium Gradient
   ============================================================ */
.button-container {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
}

#pause-resume-button,
#reset-button {
    border: none;
    padding: 13px 30px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

#pause-resume-button::after,
#reset-button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .6s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#pause-resume-button:hover::after,
#reset-button:hover::after {
    transform: translateX(100%);
}

#reset-button {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

#pause-resume-button {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

#pause-resume-button:hover:not(:disabled),
#reset-button:hover {
    transform: translateY(-2px);
}

#pause-resume-button:hover:not(:disabled) {
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
}

#reset-button:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.45);
}

#pause-resume-button:active:not(:disabled),
#reset-button:active {
    transform: translateY(0) scale(.98);
}

#pause-resume-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: .6;
    box-shadow: none;
}

body.dark-mode #pause-resume-button:disabled {
    background: #374151;
}

/* ============================================================
   TYPING STATES
   ============================================================ */
.correct {
    color: #10b981 !important;
    font-weight: 600;
}

body.dark-mode .correct {
    color: #34d399 !important;
}

.incorrect {
    color: #ef4444 !important;
    text-decoration: underline wavy;
    text-decoration-color: #ef4444;
    text-underline-offset: 4px;
}

body.dark-mode .incorrect {
    color: #f87171 !important;
    text-decoration-color: #f87171;
}

.current,
span.space.current {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25), rgba(124, 58, 237, 0.25));
    border-radius: 4px;
    transition: background .15s ease-out;
}

body.dark-mode .current,
body.dark-mode span.space.current {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.35), rgba(196, 181, 253, 0.35));
}

/* ============================================================
   SEO CONTENT — Glassy Blocks
   ============================================================ */
.seo-content-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    box-sizing: border-box;
}

.seo-content-block {
    margin-bottom: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.68);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: 28px 32px;
    border-radius: 28px;
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 8px 32px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: background-color .3s, transform .3s ease-out, box-shadow .3s ease-out;
    position: relative;
    overflow: hidden;
}

.seo-content-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #c026d3);
    opacity: 0.9;
}

.seo-content-block:hover {
    transform: translateY(-4px);
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 20px 50px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(79, 70, 229, 0.2);
}

body.dark-mode .seo-content-block {
    background: rgba(19, 26, 43, 0.68);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .seo-content-block:hover {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 20px 50px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.3);
}

.seo-content-block h2 {
    color: var(--light-text, #0f172a);
    border-bottom: 2px solid rgba(79, 70, 229, 0.15);
    padding-bottom: 12px;
    margin-top: 0;
    transition: color .3s, border-color .3s;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

body.dark-mode .seo-content-block h2 {
    color: var(--dark-text, #e5e7eb);
    border-bottom-color: rgba(129, 140, 248, 0.2);
}

.seo-content-block p,
.seo-content-block li {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--light-text-soft, #475569);
    text-align: justify;
    transition: color .3s;
    letter-spacing: -0.005em;
}

body.dark-mode .seo-content-block p,
body.dark-mode .seo-content-block li {
    color: var(--dark-text-soft, #cbd5e1);
}

.seo-content-block ol,
.seo-content-block ul {
    line-height: 1.75;
    padding-left: 1.5rem;
    font-size: 1.05rem;
}

.seo-content-block li {
    margin-bottom: 8px;
}

.seo-content-block strong {
    color: var(--light-text, #0f172a);
    font-weight: 700;
}

body.dark-mode .seo-content-block strong {
    color: var(--dark-text, #e5e7eb);
}

.seo-content-block a {
    color: var(--light-primary, #4f46e5);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .15s, color .15s;
}

.seo-content-block a:hover {
    color: var(--light-primary-hover, #4338ca);
    border-bottom-color: currentColor;
}

body.dark-mode .seo-content-block a {
    color: var(--dark-primary, #818cf8);
}

.typing-faq h3 {
    font-size: 1.15rem;
    margin: 22px 0 8px;
    color: var(--light-text, #0f172a);
    font-weight: 700;
}

body.dark-mode .typing-faq h3 {
    color: var(--dark-text, #e5e7eb);
}

.typing-faq p {
    margin-top: 0;
}

/* ============================================================
   VOLUME CONTROL — Glassy
   ============================================================ */
.volume-control-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 8px 4px 4px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.dark-mode .volume-control-container {
    background: rgba(20, 26, 43, 0.7);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.volume-slider {
    width: 100px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(79, 70, 229, 0.15);
    border-radius: 999px;
    outline: 0;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
    transition: transform .15s;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.volume-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
}

.volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: rgba(79, 70, 229, 0.15);
    border-radius: 999px;
}

body.dark-mode .volume-slider {
    background: rgba(129, 140, 248, 0.2);
}

body.dark-mode .volume-slider::-webkit-slider-thumb {
    background: linear-gradient(135deg, #818cf8, #c4b5fd);
}

body.dark-mode .volume-slider::-moz-range-thumb {
    background: linear-gradient(135deg, #818cf8, #c4b5fd);
}

body.dark-mode .volume-slider::-moz-range-track {
    background: rgba(129, 140, 248, 0.2);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background-color .2s, transform .2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--light-text, #0f172a);
}

.icon-btn:hover {
    background-color: rgba(79, 70, 229, 0.1);
    transform: scale(1.05);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}

body.dark-mode .icon-btn {
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .icon-btn:hover {
    background-color: rgba(129, 140, 248, 0.15);
}

/* ============================================================
   RESULTS SUMMARY — Glassy
   ============================================================ */
.hidden {
    display: none !important;
}

.results-summary-container {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    animation: fadeInResult 0.5s ease-out;
}

body.dark-mode .results-summary-container {
    border-top-color: rgba(129, 140, 248, 0.15);
}

@keyframes fadeInResult {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-summary-container h2 {
    color: var(--light-text, #0f172a);
    margin-bottom: 24px;
    font-weight: 800;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #10b981, #059669);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .results-summary-container h2 {
    background: linear-gradient(135deg, #34d399, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.results-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.profile-pic-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--light-text, #0f172a);
    font-weight: 600;
    font-size: 0.9rem;
}

.profile-pic-preview {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid transparent;
    background:
        linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.9)) padding-box,
        linear-gradient(135deg, #4f46e5, #7c3aed) border-box;
    transition: transform .25s ease, box-shadow .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
}

body.dark-mode .profile-pic-preview {
    background:
        linear-gradient(rgba(19, 26, 43, 0.9), rgba(19, 26, 43, 0.9)) padding-box,
        linear-gradient(135deg, #818cf8, #c4b5fd) border-box;
}

.profile-pic-preview i {
    font-size: 50px;
    color: #4f46e5;
    transition: opacity 0.3s ease;
}

.profile-pic-preview.has-image i {
    opacity: 0;
}

.profile-pic-label:hover .profile-pic-preview {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.4);
}

.result-card {
    background: transparent;
    border: none;
    padding: 0;
    width: 100%;
    max-width: 380px;
}

.result-card h3 {
    font-size: 1.35rem;
    margin: 0 0 15px 0;
    color: var(--light-text, #0f172a);
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.dark-mode .result-card h3 {
    color: var(--dark-text, #e5e7eb);
}

.final-wpm-container {
    text-align: center;
    margin-bottom: 12px;
}

.final-wpm-container span {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #10b981, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    letter-spacing: -0.03em;
}

.final-wpm-container p {
    font-size: 0.85rem;
    margin: 4px 0 0 0;
    color: var(--light-text-muted, #94a3b8);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

body.dark-mode .final-wpm-container p {
    color: var(--dark-text-muted, #94a3b8);
}

.share-name-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    color: var(--light-text, #0f172a);
    border-radius: 14px;
    text-align: center;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
}

.share-name-input:focus {
    outline: none;
    border-color: var(--light-primary, #4f46e5);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

body.dark-mode .share-name-input {
    background: rgba(11, 17, 32);
    border-color: rgba(11, 17, 32);
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .share-name-input:focus {
    border-color: var(--dark-primary, #818cf8);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
}

.result-card p {
    color: var(--light-text-soft, #475569);
    font-size: 0.95rem;
}

body.dark-mode .result-card p {
    color: var(--dark-text-soft, #cbd5e1);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-btn:hover {
    opacity: 0.95;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.facebook { background: linear-gradient(135deg, #3b5998, #2d4373); }
.twitter { background: linear-gradient(135deg, #0f1419, #000000); }
.whatsapp { background: linear-gradient(135deg, #25d366, #128C7E); }
.linkedin { background: linear-gradient(135deg, #0a66c2, #004182); }
.copy-link { background: linear-gradient(135deg, #64748b, #475569); }

#copy-feedback {
    font-size: 0.9rem;
    color: #10b981;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 1s, opacity 1s;
    font-weight: 600;
}

#copy-feedback.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 1s;
}

.results-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.download-result-btn {
    border: none;
    padding: 13px 30px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    font-family: inherit;
}

.download-result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.5);
}

.download-result-btn:active {
    transform: translateY(0) scale(.98);
}

/* ============================================================
   PAGE LAYOUT + STICKY SIDE ADS
   ============================================================ */
.test-layout {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 10px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.test-main-content {
    flex: 1;
    min-width: 0;
    order: 1;
}

.test-side-ad {
    position: -webkit-sticky;
    position: sticky;
    top: 90px;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    min-height: 620px;
    max-height: calc(100vh - 110px);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    padding: 10px 8px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
    align-self: flex-start;
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.test-side-ad:hover {
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.test-side-ad-label {
    display: block;
    width: 100%;
    text-align: center;
    font: 10px/18px Arial, sans-serif;
    color: var(--light-text-muted, #94a3b8);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-bottom: 6px;
    font-weight: 700;
}

.test-side-ad-box {
    width: 100%;
    height: 600px;
    min-height: 600px;
    max-width: 160px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    position: relative;
}

.test-side-ad-box .adsbygoogle {
    display: block;
    width: 160px;
    height: 600px;
    max-width: 160px;
    min-height: 600px;
    border: none;
}

.test-side-ad-box::after {
    content: "Ad Space";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(148, 163, 184, 0.5);
    font-size: 11px;
    font-family: Arial, sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    pointer-events: none;
}

.test-side-ad-left { order: 0; }
.test-side-ad-right { order: 2; }

body.dark-mode .test-side-ad {
    background: #0b1120;
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .test-side-ad:hover {
    border-color: rgba(129, 140, 248, 0.3);
}

body.dark-mode .test-side-ad-label {
    color: var(--dark-text-muted, #94a3b8);
}

body.dark-mode .test-side-ad-box {
    background: rgba(15, 20, 35, 0.5);
}

body.dark-mode .test-side-ad-box::after {
    color: rgba(100, 116, 139, 0.4);
}

/* ============================================================
   IN-CONTENT ADS
   ============================================================ */
.ad-space {
    position: relative;
    min-width: 0;
    min-height: 250px;
    height: 250px;
    border: 1px dashed rgba(15, 23, 42, 0.1);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(238, 241, 248, 0.5));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin: 24px 0;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    contain: layout paint;
}

.ad-space:hover {
    border-color: rgba(79, 70, 229, 0.35);
}

.ad-space .ad-label {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--light-text-muted, #94a3b8);
    font-size: 8px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    z-index: 1;
    font-family: Arial, sans-serif;
    font-weight: 700;
    pointer-events: none;
}

.ad-space .ad-inner {
    width: 100%;
    height: 250px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
    z-index: 0;
    box-sizing: border-box;
}

.ad-space .ad-inner ins {
    width: 100%;
    display: block;
}

body.dark-mode .ad-space {
    background: linear-gradient(180deg, rgba(20, 26, 43, 0.6), rgba(10, 14, 26, 0.5));
    border-color: rgba(129, 140, 248, 0.15);
}

body.dark-mode .ad-space .ad-label {
    color: var(--dark-text-muted, #94a3b8);
}

/* ============================================================
   AUTH STATUS
   ============================================================ */
#testLoginStatus {
    display: none;
    text-align: center;
    padding: 10px 15px;
    border-radius: 14px;
    margin-bottom: 15px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    color: var(--light-text, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#testLoginStatus a {
    font-weight: 600;
    text-decoration: none;
    transition: opacity .15s;
}

#testLoginStatus a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

body.dark-mode #testLoginStatus {
    border-color: rgba(129, 140, 248, 0.15);
    background: rgba(19, 26, 43, 0.6);
    color: var(--dark-text, #e5e7eb);
}

#saveStatus {
    display: none;
    text-align: center;
    padding: 6px 12px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-weight: 600;
}

body.dark-mode #saveStatus {
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
}

.results-tip {
    text-align: center;
    font-size: 0.85rem;
    color: var(--light-text-soft, #475569);
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 10px;
    width: 100%;
    display: none;
    box-sizing: border-box;
    line-height: 1.5;
}

body.dark-mode .results-tip {
    color: var(--dark-text-soft, #cbd5e1);
    background: rgba(129, 140, 248, 0.1);
    border-color: rgba(129, 140, 248, 0.2);
}

#results-dashboard-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    padding: 13px 30px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

#results-dashboard-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform .6s;
}

#results-dashboard-btn:hover::after {
    transform: translateX(100%);
}

#results-dashboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.5);
}

#results-dashboard-btn:active {
    transform: translateY(0) scale(.98);
}

#results-dashboard-btn.login-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
}

#results-dashboard-btn.login-btn:hover {
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.5);
}

body.dark-mode #results-dashboard-btn {
    background: linear-gradient(135deg, #818cf8, #c084fc);
    box-shadow: 0 4px 14px rgba(129, 140, 248, 0.4);
}

body.dark-mode #results-dashboard-btn.login-btn {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

/* ============================================================
   AUTH STATUS — Inline Layouts
   ============================================================ */
.test-auth-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.test-auth-message a {
    text-decoration: none;
}

.logged-in-message {
    gap: 12px;
    padding: 4px 0;
}

.logged-in-message .test-auth-welcome {
    font-size: 1.05rem;
}

.logged-in-message .test-auth-separator {
    color: var(--light-text-muted, #94a3b8);
}

.logged-in-message a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all .15s;
}

.logged-in-message a:first-of-type {
    color: var(--light-primary, #4f46e5);
    background: rgba(79, 70, 229, 0.1);
}

.logged-in-message a:first-of-type:hover {
    background: rgba(79, 70, 229, 0.18);
}

.logged-in-message a:last-of-type {
    color: #ef4444;
    font-weight: 500;
    background: rgba(239, 68, 68, 0.08);
}

.logged-in-message a:last-of-type:hover {
    background: rgba(239, 68, 68, 0.15);
}

body.dark-mode .logged-in-message .test-auth-separator {
    color: var(--dark-text-muted, #94a3b8);
}

.guest-message {
    justify-content: space-between;
    gap: 20px;
    padding: 14px 24px;
    box-sizing: border-box;
}

.test-auth-info {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.test-auth-info strong,
.test-auth-info small {
    display: block;
}

.test-auth-info strong {
    font-size: 1rem;
    color: #2c3e50;
    font-weight: 700;
}

.test-auth-info small {
    font-size: 0.85rem;
    opacity: 0.8;
}

.test-auth-emoji {
    font-size: 1.4rem;
}

.test-auth-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.test-auth-actions a {
    color: #fff;
    padding: 10px 24px;
    border-radius: 999px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(52, 152, 219, 0.25);
}

.test-auth-actions a:first-child {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.test-auth-actions a:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

.test-auth-actions a:last-child {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3);
}

.test-auth-actions a:last-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.4);
}

#testLoginStatus.is-authenticated {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(52, 211, 153, 0.15));
    backdrop-filter: blur(12px);
    color: #065f46;
    border-color: rgba(16, 185, 129, 0.3);
    padding: 12px 20px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
    border-width: 1px;
    border-style: solid;
}

body.dark-mode #testLoginStatus.is-authenticated {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.18));
    color: #a7f3d0;
    border-color: rgba(52, 211, 153, 0.3);
}

#testLoginStatus.is-guest {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.15));
    backdrop-filter: blur(12px);
    color: #92400e;
    border-color: rgba(245, 158, 11, 0.3);
    padding: 0;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
    border-width: 1px;
    border-style: solid;
}

body.dark-mode #testLoginStatus.is-guest {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.18));
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.3);
}

body.dark-mode .guest-message .test-auth-info strong {
    color: #fcd34d;
}

body.dark-mode .guest-message .test-auth-info small {
    color: #fde68a;
    opacity: 0.85;
}

/* ============================================================
   STABILITY + PERFORMANCE
   ============================================================ */
#testLoginStatus.status-slot {
    display: block;
    min-height: 92px;
    visibility: hidden;
    box-sizing: border-box;
}

#testLoginStatus.status-slot[style*="display: block"] {
    visibility: visible;
}

#saveStatus.save-status-slot {
    display: block;
    min-height: 34px;
    box-sizing: border-box;
    visibility: hidden;
}

#saveStatus.save-status-slot[style*="display: block"] {
    visibility: visible;
}

.icon-svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: middle;
    flex: 0 0 auto;
}

.camera-icon {
    width: 50px;
    height: 50px;
}

.share-icon {
    width: 22px;
    height: 22px;
}

.profile-pic-preview i {
    display: none;
}

.test-container,
.results-summary-container,
.ad-space,
.test-login-status,
#testLoginStatus,
#saveStatus {
    overflow-anchor: none;
}

#time-select-container {
    position: relative;
    z-index: 100000 !important;
}

#time-dropdown {
    position: absolute;
    z-index: 100001 !important;
}

.text-display {
    overscroll-behavior: contain;
    -webkit-tap-highlight-color: transparent;
}

.time-selector,
.dropdown-item,
.icon-btn,
button,
a {
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */
@media (max-width: 1050px) {
    .test-side-ad {
        display: none !important;
    }
}

@media (max-width: 820px) {
    .ad-space,
    .ad-space .ad-inner {
        min-height: 180px;
        height: 180px;
    }
}

@media (max-width: 768px) {
    .config-bar {
        flex-direction: column;
        gap: 12px;
    }
    .seo-content-container {
        width: 92%;
        padding: 10px;
        gap: 20px;
    }
    .test-container {
        width: 100%;
        padding: 22px 18px;
        border-radius: 20px;
    }
    .seo-content-block {
        padding: 22px 20px;
        border-radius: 20px;
    }
    .seo-content-block h2 {
        font-size: 1.4rem;
    }
    .seo-content-block p,
    .seo-content-block li {
        font-size: 0.98rem;
        line-height: 1.65;
    }
    .results-content {
        flex-direction: column;
        gap: 20px;
    }
    .stats {
        gap: 10px;
    }
    .stat {
        min-width: 110px;
        padding: 12px 16px;
    }
    .stat span {
        font-size: 1.65rem;
    }
}

@media (min-width: 992px) {
    .stats {
        flex-wrap: nowrap;
    }
}

@media (max-height: 750px) and (max-width: 992px) {
    .main-content {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .test-container {
        padding: 20px;
    }
    .text-display {
        height: 110px;
        min-height: 100px;
        max-height: 120px;
        font-size: 1.15rem;
        line-height: 1.55;
    }
    #typed-text-display {
        font-size: 1rem;
    }
    .stats {
        margin: 15px 0;
        gap: 10px;
    }
    .stat {
        min-width: 110px;
        padding: 10px 14px;
    }
    .button-container {
        margin-top: 15px;
    }
}

@media (max-width: 650px) {
    html, body {
        overflow-x: hidden;
    }

    .main-content {
        width: 100%;
        box-sizing: border-box;
        padding: max(16px, env(safe-area-inset-top)) 10px max(20px, env(safe-area-inset-bottom));
    }

    .test-container {
        width: 100%;
        padding: 18px 14px;
        border-radius: 14px;
    }

    .test-container h1 {
        font-size: clamp(1.5rem, 6.5vw, 1.9rem);
        margin-bottom: 8px;
    }

    .test-container .subtitle {
        font-size: 0.95rem;
        line-height: 1.4;
        margin-bottom: 10px;
    }

    .test-container > p {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .config-bar {
        width: 100%;
        gap: 10px 14px;
        margin-bottom: 16px;
        font-size: 0.95rem;
    }

    .config-bar > p {
        width: 100%;
    }

    .time-selector {
        min-width: 92px;
        padding: 10px 16px;
        text-align: center;
    }

    .dropdown-menu {
        min-width: 100%;
        max-height: 50vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }

    .text-display {
        height: 105px;
        min-height: 100px;
        max-height: 120px;
        padding: 10px 12px;
        font-size: clamp(1rem, 4.5vw, 1.1rem);
        line-height: 1.5;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    #typed-text-display {
        margin-top: 8px;
        padding: 8px;
        font-size: clamp(0.95rem, 4vw, 1rem);
    }

    .stats {
        width: 100%;
        gap: 8px;
        margin: 14px 0;
    }

    .stat {
        min-width: 0;
        flex: 1 1 calc(50% - 8px);
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .stat span {
        font-size: 1.55rem;
    }

    .overlay-message {
        font-size: clamp(1.7rem, 8vw, 2.3rem);
    }

    .button-container {
        gap: 8px;
        flex-wrap: wrap;
    }

    .button-container button {
        min-height: 44px;
    }

    .guest-message {
        justify-content: center;
        padding: 12px 14px;
    }

    .test-auth-actions {
        width: 100%;
        justify-content: center;
    }

    .test-auth-actions a {
        padding: 9px 18px;
    }
}

@media (max-width: 480px) {
    .seo-content-block h2 {
        font-size: 1.25rem;
    }
    .seo-content-block p,
    .seo-content-block li {
        font-size: 0.94rem;
        text-align: left;
    }
    .final-wpm-container span {
        font-size: 3.2rem;
    }
}

@media (max-width: 380px) {
    .test-container {
        padding: 14px 10px;
    }
    .config-bar {
        gap: 8px;
    }
    .text-display {
        font-size: 1.05rem;
        line-height: 1.5;
    }
    .stat {
        flex-basis: 100%;
    }
}

@media (hover: none) and (pointer: coarse) {
    .time-selector:hover {
        background: rgba(255, 255, 255, 0.7);
    }
    .dropdown-item:hover {
        background: inherit;
        transform: none;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   TEST STATISTICS SECTION
   ============================================================ */

.test-stats-section {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: 28px;
    padding: 36px 32px;
    margin: 30px auto;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 1px 0 rgba(15, 23, 42, 0.04),
        0 12px 40px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
    transition: background-color .3s, border-color .3s;
}

.test-stats-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #c026d3 100%);
    opacity: 0.9;
}

body.dark-mode .test-stats-section {
    background: rgba(19, 26, 43, 0.72);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.test-stats-header {
    text-align: center;
    margin-bottom: 32px;
}

.test-stats-header h2 {
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    font-weight: 800;
    color: var(--light-text, #0f172a);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.test-stats-header h2 i {
    color: var(--light-primary, #4f46e5);
}

body.dark-mode .test-stats-header h2 {
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .test-stats-header h2 i {
    color: var(--dark-primary, #818cf8);
}

.test-stats-header p {
    color: var(--light-text-muted, #94a3b8);
    font-size: 0.95rem;
    margin: 0;
}

body.dark-mode .test-stats-header p {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-loading {
    text-align: center;
    padding: 40px 20px;
}

.test-stats-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(79, 70, 229, 0.15);
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: testStatsSpin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes testStatsSpin {
    to { transform: rotate(360deg); }
}

.test-stats-loading p {
    color: var(--light-text-muted, #94a3b8);
    font-size: 0.9rem;
    margin: 0;
}

body.dark-mode .test-stats-loading p {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.test-stat-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    transition: transform .25s, box-shadow .25s, background-color .3s;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 1px 3px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.test-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    opacity: 0;
    transition: opacity .25s;
}

.test-stat-card:hover::before {
    opacity: 1;
}

.test-stat-card:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    border-color: rgba(79, 70, 229, 0.2);
}

body.dark-mode .test-stat-card {
    background: rgba(20, 26, 43, 0.7);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.dark-mode .test-stat-card:hover {
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 140, 248, 0.35);
}

.test-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin: 0 auto 12px;
}

.test-stat-icon.purple { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }
.test-stat-icon.green { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.test-stat-icon.blue { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.test-stat-icon.orange { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

.test-stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--light-text, #0f172a);
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .test-stat-value {
    background: linear-gradient(135deg, #818cf8, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.test-stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--light-text-muted, #94a3b8);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.dark-mode .test-stat-label {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stat-sub {
    font-size: 0.7rem;
    color: var(--light-text-muted, #94a3b8);
    margin-top: 6px;
    opacity: 0.75;
    font-weight: 500;
}

body.dark-mode .test-stat-sub {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(79, 70, 229, 0.08);
}

body.dark-mode .test-stats-secondary {
    background: rgba(129, 140, 248, 0.08);
    border-color: rgba(129, 140, 248, 0.15);
}

.test-stat-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--light-text-soft, #475569);
    font-weight: 500;
}

.test-stat-mini i {
    color: #4f46e5;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.test-stat-mini-value {
    font-weight: 800;
    color: var(--light-text, #0f172a);
    font-size: 0.95rem;
}

body.dark-mode .test-stat-mini-value {
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .test-stat-mini {
    color: var(--dark-text-soft, #cbd5e1);
}

.test-stat-mini-label {
    color: var(--light-text-muted, #94a3b8);
    font-size: 0.78rem;
}

body.dark-mode .test-stat-mini-label {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.test-stats-panel {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 18px;
    transition: background-color .3s, border-color .3s;
}

body.dark-mode .test-stats-panel {
    background: rgba(15, 20, 35, 0.55);
    border-color: rgba(129, 140, 248, 0.15);
}

.test-stats-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 6px;
}

.test-stats-panel-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--light-text, #0f172a);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-stats-panel-header h3 i {
    color: #4f46e5;
    font-size: 0.85rem;
}

body.dark-mode .test-stats-panel-header h3 {
    color: var(--dark-text, #e5e7eb);
}

.test-stats-panel-sub {
    font-size: 0.7rem;
    color: var(--light-text-muted, #94a3b8);
    font-weight: 500;
}

body.dark-mode .test-stats-panel-sub {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-chart-wrap {
    position: relative;
    height: 160px;
    width: 100%;
}

.test-stats-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.test-stats-chart-empty {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--light-text-muted, #94a3b8);
}

.test-stats-chart-empty i {
    font-size: 1.8rem;
    opacity: 0.3;
    margin-bottom: 6px;
}

.test-stats-chart-empty p {
    font-size: 0.8rem;
    margin: 0;
}

body.dark-mode .test-stats-chart-empty {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-difficult-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 80px;
    align-content: flex-start;
}

.test-key-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    transition: transform .15s;
    cursor: default;
}

.test-key-chip:hover {
    transform: scale(1.05);
}

.test-key-chip .test-key-char {
    font-size: 0.95rem;
    font-weight: 900;
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
}

.test-key-chip .test-key-count {
    font-size: 0.65rem;
    opacity: 0.75;
    font-weight: 600;
}

.test-key-chip.high {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.test-key-chip.medium {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.test-key-chip.low {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

body.dark-mode .test-key-chip.high { color: #f87171; }
body.dark-mode .test-key-chip.medium { color: #fbbf24; }
body.dark-mode .test-key-chip.low { color: #60a5fa; }

.test-stats-key-legend {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.65rem;
    color: var(--light-text-muted, #94a3b8);
    flex-wrap: wrap;
}

.test-stats-key-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.test-key-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.test-key-dot.high { background: #dc2626; }
.test-key-dot.medium { background: #d97706; }
.test-key-dot.low { background: #2563eb; }

body.dark-mode .test-stats-key-legend {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-durations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.test-duration-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    transition: transform .15s, box-shadow .15s;
}

.test-duration-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

body.dark-mode .test-duration-card {
    background: rgba(20, 26, 43, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
}

.test-duration-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--light-text-muted, #94a3b8);
    margin-bottom: 6px;
}

body.dark-mode .test-duration-label {
    color: var(--dark-text-muted, #94a3b8);
}

.test-duration-best {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .test-duration-best {
    background: linear-gradient(135deg, #818cf8, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.test-duration-sub {
    font-size: 0.7rem;
    color: var(--light-text-muted, #94a3b8);
    margin-top: 4px;
}

body.dark-mode .test-duration-sub {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.test-stats-list::-webkit-scrollbar {
    width: 4px;
}

.test-stats-list::-webkit-scrollbar-thumb {
    background: rgba(79, 70, 229, 0.3);
    border-radius: 4px;
}

.test-stats-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    font-size: 0.8rem;
    transition: background-color .15s;
}

.test-stats-list-item:hover {
    background: rgba(79, 70, 229, 0.06);
}

body.dark-mode .test-stats-list-item {
    background: rgba(20, 26, 43, 0.6);
}

body.dark-mode .test-stats-list-item:hover {
    background: rgba(129, 140, 248, 0.1);
}

.test-stats-list-item .test-list-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.test-stats-list-item .test-list-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    background: rgba(79, 70, 229, 0.12);
    color: #4f46e5;
    flex-shrink: 0;
}

.test-stats-list-item .test-list-title {
    font-weight: 600;
    color: var(--light-text, #0f172a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .test-stats-list-item .test-list-title {
    color: var(--dark-text, #e5e7eb);
}

.test-stats-list-item .test-list-meta {
    font-size: 0.7rem;
    color: var(--light-text-muted, #94a3b8);
    white-space: nowrap;
}

body.dark-mode .test-stats-list-item .test-list-meta {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-list-item .test-list-badge {
    font-weight: 800;
    font-size: 0.78rem;
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.test-list-badge.excellent {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.test-list-badge.good {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.test-list-badge.average {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.test-list-badge.poor {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.test-stats-records {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.test-record-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: transform .15s;
}

.test-record-item:hover {
    transform: translateY(-2px);
}

body.dark-mode .test-record-item {
    background: rgba(20, 26, 43, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
}

.test-record-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--light-text, #0f172a);
}

body.dark-mode .test-record-value {
    color: var(--dark-text, #e5e7eb);
}

.test-record-label {
    font-size: 0.65rem;
    color: var(--light-text-muted, #94a3b8);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

body.dark-mode .test-record-label {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-empty-mini {
    text-align: center;
    padding: 20px 10px;
    color: var(--light-text-muted, #94a3b8);
}

.test-stats-empty-mini i {
    font-size: 1.5rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 6px;
}

.test-stats-empty-mini p {
    font-size: 0.78rem;
    margin: 0;
}

body.dark-mode .test-stats-empty-mini {
    color: var(--dark-text-muted, #94a3b8);
}

.test-stats-login-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.15));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 14px;
    margin-bottom: 18px;
    color: #92400e;
    font-size: 0.88rem;
    font-weight: 500;
}

.test-stats-login-prompt i {
    font-size: 1.05rem;
}

.test-stats-login-btn {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    padding: 8px 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.test-stats-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
}

body.dark-mode .test-stats-login-prompt {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.18));
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.3);
}

.test-stats-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.test-stats-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all .25s;
    min-height: 44px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.01em;
}

.test-stats-action-btn.primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.test-stats-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.45);
}

.test-stats-action-btn.secondary {
    background: rgba(255, 255, 255, 0.7);
    color: var(--light-text, #0f172a);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.test-stats-action-btn.secondary:hover {
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.3);
    transform: translateY(-2px);
}

body.dark-mode .test-stats-action-btn.secondary {
    background: rgba(20, 26, 43, 0.7);
    color: var(--dark-text, #e5e7eb);
    border-color: rgba(129, 140, 248, 0.15);
}

.test-stats-empty {
    text-align: center;
    padding: 48px 20px;
}

.test-stats-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.6rem;
    color: #4f46e5;
}

.test-stats-empty h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--light-text, #0f172a);
    margin: 0 0 6px;
}

body.dark-mode .test-stats-empty h3 {
    color: var(--dark-text, #e5e7eb);
}

.test-stats-empty p {
    color: var(--light-text-muted, #94a3b8);
    font-size: 0.88rem;
    margin: 0;
}

body.dark-mode .test-stats-empty p {
    color: var(--dark-text-muted, #94a3b8);
}

@media (max-width: 768px) {
    .test-stats-section {
        padding: 20px 14px;
        margin: 20px auto;
        border-radius: 20px;
    }

    .test-stats-header {
        margin-bottom: 20px;
    }

    .test-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .test-stat-card {
        padding: 14px 12px;
    }

    .test-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        margin-bottom: 8px;
    }

    .test-stat-value {
        font-size: 1.4rem;
    }

    .test-stat-label {
        font-size: 0.65rem;
    }

    .test-stat-sub {
        font-size: 0.62rem;
    }

    .test-stats-secondary {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 10px 12px;
    }

    .test-stat-mini {
        font-size: 0.78rem;
    }

    .test-stats-two-col {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .test-stats-chart-wrap {
        height: 140px;
    }

    .test-stats-panel {
        padding: 14px;
    }

    .test-stats-panel-header h3 {
        font-size: 0.82rem;
    }

    .test-stats-list {
        max-height: 150px;
    }

    .test-stats-list-item {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .test-stats-action-btn {
        width: 100%;
        justify-content: center;
        padding: 11px 20px;
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    .test-stats-section {
        padding: 16px 10px;
    }

    .test-stats-grid {
        gap: 8px;
    }

    .test-stat-card {
        padding: 12px 10px;
    }

    .test-stat-value {
        font-size: 1.2rem;
    }

    .test-stat-sub {
        display: none;
    }

    .test-key-chip {
        font-size: 0.7rem;
        padding: 5px 10px;
    }

    .test-key-chip .test-key-char {
        font-size: 0.85rem;
    }

    .test-stats-list-item .test-list-meta {
        display: none;
    }

    .test-stats-records {
        grid-template-columns: 1fr;
    }
}