/* ============================================================
   TYPE MASTER PRO — HINDI TYPING PAGE STYLES (2026)
   Glassy · Modern · Premium · Sticky Side Ads
   ============================================================ */

/* --- Hindi Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Hind:wght@400;500;600;700&display=swap');

/* Custom Mangal font for SSC mode */
@font-face {
    font-family: 'Mangal';
    src: url('/fonts/Mangal-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Mangal';
    src: url('/fonts/Mangal-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
html {
    height: 100%;
    overflow-y: scroll;
    scroll-behavior: smooth;
}

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;
}

.hidden { display: none !important; }

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
}

/* ============================================================
   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.5rem, 3.5vw, 2rem);
    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(0.95rem, 2.5vw, 1.1rem);
    font-weight: 500;
    color: var(--light-text-soft, #475569);
    margin: 0 0 20px;
    letter-spacing: -0.01em;
}

body.dark-mode .test-container .subtitle {
    color: var(--dark-text-soft, #cbd5e1);
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}
.loading-indicator.active { display: block; animation: spin 1s linear infinite; }
@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================
   CONFIG BAR — Glassy Pills
   ============================================================ */
.config-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.5);
    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 .config-bar {
    background: rgba(20, 26, 43, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.config-bar > p {
    margin: 0;
    font-weight: 700;
    color: var(--light-text-soft, #475569);
    font-size: 1rem;
}

body.dark-mode .config-bar > p {
    color: var(--dark-text-soft, #cbd5e1);
}

/* Difficulty Radio Buttons */
.difficulty-selector {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

body.dark-mode .difficulty-selector {
    background: rgba(30, 40, 60, 0.7);
    border-color: rgba(129, 140, 248, 0.15);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 600;
    color: var(--light-text-soft, #475569);
    user-select: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.radio-label:hover { color: var(--light-primary, #4f46e5); }

.radio-label input[type="radio"] {
    accent-color: #4f46e5;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

body.dark-mode .radio-label {
    color: var(--dark-text-soft, #cbd5e1);
}

body.dark-mode .radio-label:hover { color: var(--dark-primary, #818cf8); }

body.dark-mode .radio-label input[type="radio"] {
    accent-color: #818cf8;
}

/* Time Selector Dropdown */
.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: 1rem;
    font-weight: 600;
    color: var(--light-text, #0f172a);
    z-index: 100000 !important;
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    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);
    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);
}

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);
    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);
}

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);
}

/* Volume & Icon Buttons */
.volume-control-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 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);
}

body.dark-mode .volume-control-container {
    background: rgba(20, 26, 43, 0.7);
    border-color: rgba(129, 140, 248, 0.15);
}

.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);
}

.volume-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: rgba(79, 70, 229, 0.15);
    border-radius: 999px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s, transform 0.2s;
    color: var(--light-text-soft, #475569);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--light-primary, #4f46e5);
    transform: scale(1.05);
}

body.dark-mode .icon-btn { color: var(--dark-text-soft, #cbd5e1); }
body.dark-mode .icon-btn:hover {
    background-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-primary, #818cf8);
}

.icon-btn svg { fill: currentColor; }

/* ============================================================
   TEST AREA & TEXT DISPLAY
   ============================================================ */
.test-area {
    position: relative;
    margin-bottom: 15px;
    contain: content;
}

.text-display {
    color: var(--light-text-soft, #475569);
    padding: 20px 24px;
    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;
    height: 170px;
    min-height: 150px;
    max-height: 190px;
    overflow-y: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    pointer-events: none;
    transition: border-color .3s, color .3s, background-color .3s;
    font-family: 'Hind', 'JetBrains Mono', sans-serif;
    font-size: 1.85rem;
    line-height: 1.7;
    text-align: left;
    user-select: none;
    box-shadow:
        inset 0 1px 3px rgba(15, 23, 42, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.9);
    will-change: transform, scroll-position;
}

body.dark-mode .text-display {
    background: rgba(15, 20, 35, 0.55);
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text-soft, #cbd5e1);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.3),
        0 1px 0 rgba(255, 255, 255, 0.04);
}

.text-display.ssc-mode {
    font-family: 'Mangal', 'Hind', 'Noto Sans Devanagari', sans-serif;
    font-weight: 500;
}

.text-display:focus { outline: none; border-color: var(--light-primary, #4f46e5); }

.text-display span {
    display: inline;
    border-radius: 2px;
    transition: background-color 0.1s;
}

span.space { padding: 0 4px; }

.current,
span.space.current {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25), rgba(124, 58, 237, 0.25));
    border-bottom: 3px solid var(--light-primary, #4f46e5);
    color: #000;
    border-radius: 4px;
}

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));
    border-bottom-color: var(--dark-primary, #818cf8);
    color: #fff;
}

.correct { color: #10b981; font-weight: 600; }

body.dark-mode .correct { color: #34d399; }

.incorrect {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
    text-decoration: underline wavy;
    text-decoration-color: #ef4444;
    text-underline-offset: 4px;
    font-weight: 600;
}

body.dark-mode .incorrect {
    color: #f87171;
    background-color: rgba(248, 113, 113, 0.1);
    text-decoration-color: #f87171;
}

/* Overlay Messages */
.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.2rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease-in-out;
    flex-direction: column;
    cursor: pointer;
}

.overlay-message.show { opacity: 1; pointer-events: auto; }

.overlay-message .resume-prompt {
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 10px;
    color: var(--light-text-soft, #475569);
}

body.dark-mode .overlay-message {
    background: rgba(10, 14, 26, 0.85);
    color: var(--dark-text, #e5e7eb);
}

body.dark-mode .overlay-message .resume-prompt {
    color: var(--dark-text-soft, #cbd5e1);
}

#times-up-overlay {
    color: #ef4444;
    cursor: default;
    font-size: 3rem;
    text-shadow: 0 2px 20px rgba(239, 68, 68, 0.4);
}

/* Typed Text Display */
#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: 'Hind', 'JetBrains Mono', sans-serif;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--light-text, #0f172a);
    font-size: 1.3rem;
    text-align: center;
    pointer-events: none;
    transition: background-color .3s, color .3s;
}

body.dark-mode #typed-text-display {
    background: rgba(15, 20, 35, 0.5);
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text, #e5e7eb);
}

.input-field {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    z-index: -1;
}

/* Highlight Legend */
.highlight-preview {
    margin: 12px 0;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    color: var(--light-text-soft, #475569);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

body.dark-mode .highlight-preview {
    background: rgba(20, 26, 43, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text-soft, #cbd5e1);
}

.highlight-preview .example-char {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

.highlight-preview .to-type {
    color: var(--light-text, #0f172a);
    background: rgba(79, 70, 229, 0.08);
}

.highlight-preview .current {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.25), rgba(124, 58, 237, 0.25));
    color: var(--light-primary, #4f46e5);
}

.highlight-preview .correct {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.highlight-preview .incorrect {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.highlight-preview .space {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

body.dark-mode .highlight-preview .to-type {
    color: var(--dark-text, #e5e7eb);
    background: rgba(129, 140, 248, 0.1);
}

/* ============================================================
   STATS
   ============================================================ */
.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin: 25px 0;
    flex-wrap: wrap;
    min-height: 58px;
}

.stat {
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 14px;
    min-width: 120px;
    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);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    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);
}

.stat.hidden { display: none; }

.stat p {
    margin: 0 0 4px 0;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--light-text-muted, #94a3b8);
    font-weight: 700;
}

body.dark-mode .stat p { color: var(--dark-text-muted, #94a3b8); }

.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;
    font-family: 'Inter', sans-serif;
}

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;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.button-container {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 20px;
    flex-wrap: wrap;
}

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);
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

#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:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

body.dark-mode #pause-resume-button:disabled { background: #374151; }

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

/* ============================================================
   RESULTS SUMMARY
   ============================================================ */
.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 {
    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: 45px;
    color: #4f46e5;
    transition: opacity 0.3s ease;
}

body.dark-mode .profile-pic-preview i { color: #818cf8; }

.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;
    font-family: 'Inter', sans-serif;
}

.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;
}

.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(15, 20, 35, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text, #e5e7eb);
}

.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: 18px;
    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 {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    border: none;
    padding: 13px 30px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 999px;
    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: 'Inter', sans-serif;
}

.download-result-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.5);
}

/* ============================================================
   SEO CONTENT 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 {
    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;
    box-sizing: border-box;
}

.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);
}

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;
    font-size: 1.55rem;
    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 h3 {
    color: var(--light-text, #0f172a);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 20px 0 12px;
}

body.dark-mode .seo-content-block h3 { color: var(--dark-text, #e5e7eb); }

.seo-content-block h4 {
    color: var(--light-text, #0f172a);
    font-size: 1rem;
    font-weight: 700;
    margin: 16px 0 8px;
}

body.dark-mode .seo-content-block h4 { color: var(--dark-text, #e5e7eb); }

.seo-content-block p,
.seo-content-block li {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--light-text-soft, #475569);
    text-align: justify;
    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 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); }

.seo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.full-width { grid-column: 1 / -1; }

/* Mode Cards */
.mode-card {
    padding: 20px;
    border-radius: 16px;
    border: 1px solid;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    transition: transform .25s;
}

.mode-card:hover { transform: translateY(-3px); }

.mode-simple {
    background: linear-gradient(135deg, rgba(219, 234, 254, 0.7), rgba(191, 219, 254, 0.5));
    border-color: rgba(96, 165, 250, 0.4);
}

.mode-simple h3 { color: #1e40af; border-bottom: none; margin-top: 0; }

.mode-ssc {
    background: linear-gradient(135deg, rgba(254, 243, 199, 0.7), rgba(253, 230, 138, 0.5));
    border-color: rgba(251, 191, 36, 0.4);
}

.mode-ssc h3 { color: #b45309; border-bottom: none; margin-top: 0; }

.mode-crpf {
    background: linear-gradient(135deg, rgba(254, 226, 226, 0.7), rgba(252, 165, 165, 0.5));
    border-color: rgba(248, 113, 113, 0.4);
}

.mode-crpf h3 { color: #b91c1c; border-bottom: none; margin-top: 0; }

body.dark-mode .mode-simple {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.2), rgba(59, 130, 246, 0.15));
    border-color: rgba(96, 165, 250, 0.3);
}

body.dark-mode .mode-ssc {
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.2), rgba(217, 119, 6, 0.15));
    border-color: rgba(251, 191, 36, 0.3);
}

body.dark-mode .mode-crpf {
    background: linear-gradient(135deg, rgba(185, 28, 28, 0.2), rgba(239, 68, 68, 0.15));
    border-color: rgba(248, 113, 113, 0.3);
}

body.dark-mode .mode-simple h3 { color: #93c5fd; }
body.dark-mode .mode-ssc h3 { color: #fcd34d; }
body.dark-mode .mode-crpf h3 { color: #fca5a5; }

/* Setup Guide */
.setup-guide {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(124, 58, 237, 0.06));
    border-left: 4px solid var(--light-primary, #4f46e5);
    padding: 22px 26px;
    border-radius: 0 14px 14px 0;
    margin: 20px 0;
}

.setup-guide h3 {
    margin-top: 0;
    color: var(--light-primary, #4f46e5);
}

body.dark-mode .setup-guide {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.1), rgba(167, 139, 250, 0.08));
    border-left-color: var(--dark-primary, #818cf8);
}

body.dark-mode .setup-guide h3 { color: var(--dark-primary, #818cf8); }

.setup-guide ol {
    line-height: 1.85;
    margin-left: 20px;
    padding-left: 0;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-family: 'Inter', sans-serif;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.comparison-table th,
.comparison-table td {
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.9rem;
}

.comparison-table th {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    font-weight: 700;
}

body.dark-mode .comparison-table th {
    background: linear-gradient(135deg, #6366f1, #818cf8);
}

body.dark-mode .comparison-table td {
    border-color: rgba(129, 140, 248, 0.15);
    color: var(--dark-text, #e5e7eb);
}

/* Keyboard Keys */
kbd {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 6px;
    box-shadow: 0 2px 0 rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    color: var(--light-text, #0f172a);
    display: inline-block;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

body.dark-mode kbd {
    background: rgba(30, 40, 60, 0.8);
    border-color: rgba(129, 140, 248, 0.2);
    color: var(--dark-text, #e5e7eb);
    box-shadow: none;
}

/* ============================================================
   KEYBOARD SHORTCUTS MODAL
   ============================================================ */
.shortcuts-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.shortcuts-modal.show { display: flex; }

.shortcuts-content {
    background: var(--light-surface, #fff);
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

body.dark-mode .shortcuts-content {
    background: rgba(19, 26, 43, 0.98);
    border-color: rgba(129, 140, 248, 0.15);
}

.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.shortcuts-header h2 {
    margin: 0;
    color: var(--light-primary, #4f46e5);
    font-size: 1.4rem;
}

body.dark-mode .shortcuts-header h2 { color: var(--dark-primary, #818cf8); }

.close-shortcuts {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--light-text-soft, #475569);
    padding: 5px 10px;
    border-radius: 8px;
    transition: background-color 0.2s;
    width: auto;
}

.close-shortcuts:hover { background: rgba(79, 70, 229, 0.1); }

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-size: 1rem;
    color: var(--light-text, #0f172a);
}

.shortcut-item:last-child { border-bottom: none; }

body.dark-mode .shortcut-item {
    border-bottom-color: rgba(129, 140, 248, 0.1);
    color: var(--dark-text, #e5e7eb);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGE LAYOUT WITH 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: rgba(19, 26, 43, 0.6);
    border-color: rgba(129, 140, 248, 0.15);
}

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); }

/* ============================================================
   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) {
    .test-container {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .config-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        border-radius: 20px;
        padding: 16px;
    }

    .config-bar > p {
        text-align: center;
    }

    .difficulty-selector {
        justify-content: center;
        flex-wrap: wrap;
    }

    .text-display {
        font-size: 1.5rem;
        height: 130px;
        padding: 16px 18px;
    }

    .stats { gap: 10px; }

    .stat {
        min-width: 45%;
        padding: 12px;
    }

    .stat span { font-size: 1.7rem; }

    .seo-grid { grid-template-columns: 1fr; }
    .results-content { flex-direction: column; }

    .seo-content-block {
        padding: 22px 20px;
        border-radius: 20px;
    }

    .seo-content-block h2 { font-size: 1.3rem; }

    .time-selector {
        justify-content: center;
        width: 100%;
    }

    .volume-control-container {
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .test-container h1 { font-size: 1.4rem; }
    .radio-label { font-size: 0.85rem; }
    .text-display { font-size: 1.3rem; padding: 14px 16px; height: 120px; }
    .stat { min-width: 100%; }
    .final-wpm-container span { font-size: 3.2rem; }
    .button-container { flex-direction: column; }
    button { width: 100%; justify-content: center; }
    .seo-content-block h2 { font-size: 1.15rem; }
    .seo-content-block p,
    .seo-content-block li { font-size: 0.92rem; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}