/*
 * TouchType 2026 visual system
 * Loaded last on every public page so the product feels consistent
 * without changing the existing markup or application behaviour.
 */

:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --bg-accent: #eeefff;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: #ffffff;
    --panel-soft: #f1f2f8;
    --panel-border: rgba(32, 34, 55, 0.1);
    --border: rgba(32, 34, 55, 0.1);
    --text: #171927;
    --text-secondary: #4f5367;
    --muted: #71758a;
    --accent: #6957e8;
    --accent-dark: #5140ce;
    --accent-hover: #5b49db;
    --accent-soft: rgba(105, 87, 232, 0.1);
    --accent-softer: rgba(105, 87, 232, 0.055);
    --ok: #159669;
    --success: #159669;
    --bad: #df4b5f;
    --danger: #df4b5f;
    --current: #f0ad35;
    --radius: 22px;
    --radius-sm: 15px;
    --radius-xs: 11px;
    --shadow: 0 18px 60px rgba(30, 34, 58, 0.09);
    --shadow-sm: 0 10px 30px rgba(30, 34, 58, 0.07);
    --shadow-accent: 0 12px 28px rgba(105, 87, 232, 0.24);
    --sans: Inter, "SF Pro Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "SFMono-Regular", "Cascadia Code", "Fira Code", Consolas, monospace;
}

html[data-theme="dark"],
body[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e0f14;
    --bg-accent: #181924;
    --panel: rgba(24, 25, 34, 0.88);
    --panel-strong: #191a22;
    --panel-soft: #20212b;
    --panel-border: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.1);
    --text: #f2f2f6;
    --text-secondary: #c6c6d1;
    --muted: #9b9dad;
    --accent: #9b8cff;
    --accent-dark: #7b6aee;
    --accent-hover: #aa9dff;
    --accent-soft: rgba(155, 140, 255, 0.14);
    --accent-softer: rgba(155, 140, 255, 0.075);
    --ok: #45c993;
    --success: #45c993;
    --bad: #ff7185;
    --danger: #ff7185;
    --current: #ffc45d;
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
    --shadow-sm: 0 12px 36px rgba(0, 0, 0, 0.25);
    --shadow-accent: 0 14px 34px rgba(123, 106, 238, 0.25);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    position: relative;
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 8% -8%, rgba(105, 87, 232, 0.15), transparent 31rem),
        radial-gradient(circle at 96% 14%, rgba(77, 182, 172, 0.09), transparent 28rem),
        var(--bg);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: -0.006em;
    transition: background-color 180ms ease, color 180ms ease;
}

html[data-theme="dark"] body,
body[data-theme="dark"] {
    background:
        radial-gradient(circle at 8% -8%, rgba(123, 106, 238, 0.17), transparent 34rem),
        radial-gradient(circle at 98% 18%, rgba(71, 182, 162, 0.07), transparent 30rem),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.32;
    background-image: radial-gradient(circle, rgba(105, 87, 232, 0.16) 0.7px, transparent 0.8px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

html[data-theme="dark"] body::before,
body[data-theme="dark"]::before {
    opacity: 0.16;
}

body > * {
    position: relative;
    z-index: 1;
}

::selection {
    color: #fff;
    background: var(--accent);
}

a,
button,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
summary {
    cursor: pointer;
}

img,
svg,
canvas {
    max-width: 100%;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
    outline-offset: 3px;
}

.container {
    width: min(1280px, calc(100% - 40px));
    margin-inline: auto;
}

/* Shared header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--panel-border);
    background: color-mix(in srgb, var(--bg) 76%, transparent);
    box-shadow: none;
    backdrop-filter: blur(22px) saturate(150%);
}

.navbar {
    min-height: 72px;
    padding: 10px 0;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 850;
    letter-spacing: -0.035em;
}

.logo::before {
    content: "T";
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #8171f2, #5744d2);
    box-shadow: 0 8px 20px rgba(105, 87, 232, 0.28), inset 0 1px rgba(255, 255, 255, 0.3);
    font-size: 0.94rem;
    font-weight: 900;
}

.nav-links {
    gap: 4px;
}

.nav-links a,
.nav-more summary {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"],
.nav-more[open] summary,
.nav-more summary:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.nav-links a[aria-current="page"] {
    color: var(--accent);
}

.auth-buttons,
.auth-status-slot {
    gap: 8px;
}

.auth-user-name {
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    color: var(--text);
    background: var(--panel);
    font-size: 0.82rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.nav-more-menu {
    top: calc(100% + 10px);
    min-width: 210px;
    padding: 8px;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel-strong) 96%, transparent);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.nav-more-menu .nav-more-link {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    font-size: 0.88rem;
}

.nav-more-menu .nav-more-link:hover {
    background: var(--accent-soft);
}

/* Buttons */
.btn,
.user-panel button,
.primary-action,
.secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
    border: 1px solid var(--panel-border);
    border-radius: 13px;
    color: var(--text);
    background: var(--panel-strong);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
    font-size: 0.86rem;
    font-weight: 780;
    line-height: 1;
    white-space: nowrap;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.btn:hover,
.user-panel button:hover,
.primary-action:hover,
.secondary-action:hover {
    border-color: color-mix(in srgb, var(--accent) 32%, var(--panel-border));
    background: var(--panel-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-primary,
.primary-action {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #7564ed, var(--accent-dark));
    box-shadow: var(--shadow-accent), inset 0 1px rgba(255, 255, 255, 0.24);
}

.btn-primary:hover,
.primary-action:hover {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #8171f2, var(--accent));
    box-shadow: 0 15px 32px rgba(105, 87, 232, 0.3);
}

.btn-secondary,
.secondary-action {
    color: var(--text);
    background: var(--panel);
}

html[data-theme="dark"] .btn-primary,
body[data-theme="dark"] .btn-primary {
    color: #fff;
}

/* Theme switch */
.theme-switcher {
    min-height: 38px;
    gap: 7px;
}

.theme-label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.switch {
    width: 48px;
    height: 28px;
}

.slider {
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    background: var(--panel-soft);
    box-shadow: inset 0 1px 3px rgba(28, 31, 51, 0.08);
    transition: background-color 180ms ease, border-color 180ms ease;
}

.slider::before {
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    box-shadow: 0 3px 9px rgba(25, 28, 48, 0.2);
}

.switch input:checked + .slider,
.theme-switcher input[type="checkbox"]:checked + .slider {
    border-color: transparent;
    background: linear-gradient(135deg, #7564ed, var(--accent-dark));
}

.switch input:checked + .slider::before,
.theme-switcher input[type="checkbox"]:checked + .slider::before {
    transform: translateX(20px);
}

/* Main content primitives */
.page {
    flex: 1;
    padding: clamp(26px, 4vw, 52px) 0;
}

.hero-panel,
.content-card,
.topic-card,
.article-body,
.panel,
.leaderboard-panel,
.profile-card,
.results-filter-panel,
.results-summary-grid .stat-card,
.results-chart-panel,
.results-table-panel,
.results-help-panel,
.password-card,
.password-info-grid article,
.password-seo-card,
.password-faq-card,
.password-side-nav,
.hotkeys-focus,
.hotkeys-info-grid article,
.blog-card,
.video-card,
.video-section,
.practice-note,
.admin-sidebar,
.admin-editor,
.admin-status {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.hero-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(30px, 6vw, 72px);
    margin-bottom: 22px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--panel-strong) 96%, transparent), color-mix(in srgb, var(--accent-soft) 52%, var(--panel)));
}

.hero-panel::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: -90px;
    right: -70px;
    width: 320px;
    height: 320px;
    border: 54px solid color-mix(in srgb, var(--accent) 10%, transparent);
    border-radius: 50%;
}

.hero-kicker,
.eyebrow,
.block-label,
.meta-label,
.ad-caption,
.start-kicker {
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    color: var(--text);
    letter-spacing: -0.035em;
    text-wrap: balance;
}

h1 {
    font-weight: 820;
}

.hero-panel h1 {
    max-width: 920px;
    font-size: clamp(2.2rem, 5.5vw, 5rem);
    line-height: 0.98;
}

.hero-text {
    max-width: 760px;
    color: var(--muted);
    font-size: clamp(1rem, 1.5vw, 1.18rem);
    line-height: 1.7;
}

.hero-actions,
.button-row {
    gap: 10px;
    margin-top: 24px;
}

.topic-grid {
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 16px;
}

.topic-card {
    position: relative;
    min-height: 190px;
    padding: 22px;
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.topic-card::after {
    content: "↗";
    position: absolute;
    right: 18px;
    bottom: 16px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 10px;
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 800;
}

.topic-card:hover {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--panel-border));
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.topic-card h2,
.topic-card h3 {
    margin-bottom: 10px;
    font-size: 1.16rem;
}

.topic-card p,
.content-card p,
.article-body p,
.article-body li {
    color: var(--muted);
}

.content-grid {
    gap: 16px;
    margin-top: 16px;
}

.content-card,
.article-body {
    padding: clamp(22px, 3vw, 38px);
}

.article-body {
    max-width: 940px;
}

.article-body h2 {
    margin-top: 1.7em;
}

.article-body h2:first-child {
    margin-top: 0;
}

.note {
    border: 0;
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--accent-soft);
}

/* Form elements */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea,
.sidebar-search {
    border: 1px solid var(--panel-border);
    border-radius: 13px;
    background: var(--panel-strong);
    color: var(--text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus,
.sidebar-search:focus {
    border-color: color-mix(in srgb, var(--accent) 70%, var(--panel-border));
    box-shadow: 0 0 0 4px var(--accent-soft);
    outline: none;
}

input::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, var(--muted) 72%, transparent);
}

input[type="checkbox"],
input[type="radio"],
input[type="range"] {
    accent-color: var(--accent);
}

/* Trainer */
.page:has(.layout) {
    padding: 20px 0 44px;
}

.layout {
    grid-template-columns: 244px minmax(0, 1fr) 216px;
    gap: 16px;
    align-items: start;
}

.left-sidebar,
.trainer-column,
.right-sidebar {
    max-height: none;
    overflow: visible;
}

.panel {
    background: var(--panel);
}

.left-sidebar .panel,
.right-sidebar .panel {
    position: sticky;
    top: 92px;
}

.left-sidebar .panel,
.right-sidebar .panel,
.trainer-panel {
    padding: 18px;
}

.panel-heading h2,
.trainer-topbar h2 {
    font-size: clamp(1rem, 1.3vw, 1.22rem);
}

.panel-heading p {
    margin: 7px 0 0;
}

.trainer-panel {
    overflow: hidden;
    box-shadow: var(--shadow);
}

.trainer-topbar {
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--panel-border);
}

.lesson-badge,
.password-strength,
.card-tag {
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 999px;
    color: var(--accent);
    background: var(--accent-soft);
}

.trainer-mode-panel,
.custom-text-panel {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--accent-softer);
}

.trainer-settings-summary {
    min-height: 44px;
    border: 1px solid var(--panel-border);
    border-radius: 13px;
    background: var(--panel-strong);
}

.settings-summary-action {
    background: var(--accent-soft);
    color: var(--accent);
}

.mode-btn {
    min-height: 34px;
    padding: 6px 11px;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    background: var(--panel-strong);
    color: var(--muted);
}

.mode-btn.active,
.mode-btn:hover {
    border-color: transparent;
    color: #fff;
    background: var(--accent);
}

.level-control select {
    min-height: 34px;
    border-radius: 10px;
}

.stats-grid {
    gap: 8px;
    margin-bottom: 14px;
}

.stat-card {
    position: relative;
    min-width: 0;
    padding: 12px 8px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: 15px;
    background: var(--panel-strong);
    box-shadow: none;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -16px;
    bottom: -22px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--accent-softer);
}

.stat-title {
    color: var(--muted);
    font-weight: 720;
}

.stat-card strong {
    color: var(--text);
    font-size: clamp(1.05rem, 1.5vw, 1.5rem);
    letter-spacing: -0.04em;
}

.typing-area {
    gap: 9px;
}

.text-panel,
.input-panel,
.keyboard-panel {
    border: 1px solid var(--panel-border);
    border-radius: 17px;
    background: var(--panel-strong);
    box-shadow: none;
}

.text-panel {
    padding: 15px;
}

.text-display {
    min-height: 88px;
    max-height: 150px;
    color: var(--text);
    font-family: var(--mono);
    font-size: clamp(1.05rem, 1.35vw, 1.35rem);
    line-height: 1.62;
}

#userInput {
    min-height: 92px;
    max-height: 150px;
    padding: 14px 15px;
    font-family: var(--mono);
    font-size: 0.94rem;
    line-height: 1.55;
}

.keyboard-panel {
    padding: 10px;
    background: color-mix(in srgb, var(--panel-strong) 82%, var(--panel-soft));
}

.keyboard-hint {
    gap: 4px;
}

.keyboard-row {
    gap: 4px;
}

.keyboard-key {
    min-height: 38px;
    border: 1px solid var(--panel-border);
    border-radius: 9px;
    color: var(--text-secondary);
    background: var(--panel-strong);
    box-shadow: 0 3px 0 color-mix(in srgb, var(--panel-border) 82%, transparent);
}

.keyboard-key.active {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    color: #fff;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft), 0 3px 0 var(--accent-dark);
}

.char-current {
    color: var(--text);
    background: color-mix(in srgb, var(--current) 58%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--current) 22%, transparent);
}

.char-future {
    color: var(--muted);
}

.char-correct {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 11%, transparent);
}

.char-wrong {
    color: var(--bad);
    background: color-mix(in srgb, var(--bad) 12%, transparent);
}

.control-row {
    gap: 8px;
    margin-top: 12px;
}

.tree-group,
.tree-child {
    border: 1px solid var(--panel-border);
    border-radius: 13px;
    background: var(--panel-strong);
}

.tree-child {
    background: var(--panel-soft);
}

.tree-group-title,
.tree-child-title {
    min-height: 38px;
    border-radius: 12px;
}

.tree-group-title::after,
.tree-child-title::after {
    background: var(--accent-soft);
    color: var(--accent);
}

.lesson-item {
    border-radius: 10px;
}

.lesson-item:hover,
.lesson-item.active {
    border-color: color-mix(in srgb, var(--accent) 24%, var(--panel-border));
    background: var(--panel-strong);
    box-shadow: var(--shadow-sm);
}

.sidebar-tree {
    scrollbar-color: color-mix(in srgb, var(--accent) 25%, transparent) transparent;
}

.leaderboard-preview-item,
.sidebar-more-btn,
.sidebar-all-lessons {
    border-color: var(--panel-border);
    border-radius: 10px;
    background: var(--panel-strong);
}

.ad-slot,
.ad-placeholder {
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    color: var(--muted);
    background: var(--panel-soft);
}

.trainer-seo-grid,
.trainer-faq-grid {
    gap: 16px;
}

.trainer-seo-grid article,
.trainer-faq-grid article,
.trainer-heading-section .trainer-heading {
    padding: 20px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

/* Lessons and articles */
.lessons-toolbar {
    max-width: 680px;
}

.lessons-search {
    min-height: 48px;
    padding: 11px 14px;
}

.lessons-tree {
    gap: 14px;
}

.lesson-group,
.lesson-child,
.lesson-row,
.lesson-empty {
    border-color: var(--panel-border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.lesson-child,
.lesson-row {
    border-radius: var(--radius-sm);
    background: var(--panel-strong);
    box-shadow: none;
}

.lesson-group summary,
.lesson-child summary {
    padding: 18px 20px;
}

.lesson-group summary::after,
.lesson-child summary::after {
    background: var(--accent-soft);
    color: var(--accent);
}

/* Useful / articles hub */
.useful-page {
    padding-bottom: 52px;
}

.useful-hero {
    position: relative;
    overflow: hidden;
    margin: 20px auto 38px;
    width: min(1280px, calc(100% - 40px));
    padding: clamp(42px, 7vw, 82px) 24px;
    border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.18), transparent 18rem),
        linear-gradient(135deg, #6f5de8, #4939bd 70%);
    box-shadow: var(--shadow-accent);
}

.useful-hero h1 {
    max-width: 820px;
    margin-inline: auto;
    font-size: clamp(2.4rem, 6vw, 5.4rem);
    line-height: 0.95;
}

.section-title {
    margin: 38px 0 18px;
    padding-left: 0;
    border-left: 0;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.section-title > span:first-child {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 13px;
    background: var(--accent-soft);
    font-size: 1.05rem;
}

.blog-grid,
.video-grid {
    gap: 16px;
}

.blog-card,
.video-card {
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.blog-card:hover,
.video-card:hover {
    border-color: color-mix(in srgb, var(--accent) 34%, var(--panel-border));
    box-shadow: var(--shadow);
    transform: translateY(-4px);
}

.blog-visual {
    min-height: 210px;
}

.blog-visual::before {
    border-radius: 18px;
}

.blog-visual span {
    border-radius: 11px;
    backdrop-filter: blur(12px);
}

.practice-note,
.video-section {
    padding: 24px;
}

.subscribe-banner {
    border-radius: var(--radius);
    background: linear-gradient(135deg, #6f5de8, #e36f98);
}

/* Dashboards and tools */
.leaderboard-page,
.profile-page,
.results-page,
.password-page {
    padding: clamp(28px, 5vw, 64px) 0;
}

.leaderboard-panel,
.profile-card,
.results-chart-panel,
.results-table-panel,
.results-help-panel,
.password-card,
.password-seo-card,
.password-faq-card {
    background: var(--panel);
}

.leaderboard-toolbar,
.leaderboard-info,
.results-filter-panel {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--accent-softer);
}

.leaderboard-metrics article,
.results-summary-grid .stat-card,
.profile-links a,
.setting-check,
.password-item {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--panel-strong);
}

.leaderboard-table-wrap,
.results-table-wrapper {
    border-color: var(--panel-border);
    border-radius: var(--radius-sm);
}

.leaderboard-table,
.results-table {
    background: var(--panel-strong);
}

.leaderboard-table th,
.leaderboard-table td,
.results-table th,
.results-table td {
    border-color: var(--panel-border);
}

.profile-avatar {
    border: 0;
    background: linear-gradient(145deg, #8171f2, #5744d2);
    box-shadow: var(--shadow-accent);
}

.password-side-nav {
    top: 92px;
}

.password-settings-card {
    top: 92px;
}

.password-copy-btn,
.results-table-link {
    border-color: var(--panel-border);
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}

.password-info-grid {
    gap: 16px;
}

.password-faq-list details {
    border-color: var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--panel-strong);
}

/* Hotkeys */
.hotkeys-title {
    font-size: clamp(2.5rem, 6vw, 5.2rem);
    line-height: 0.98;
}

.hotkeys-text {
    font-size: 1.05rem;
}

.hotkeys-focus {
    padding: clamp(24px, 4vw, 42px);
}

.hotkeys-info-grid {
    gap: 16px;
}

.hotkeys-info-grid article {
    padding: 24px;
}

.hotkey-combo-list kbd,
.kbd-row span {
    border-color: var(--panel-border);
    border-radius: 8px;
    color: var(--text);
    background: var(--panel-soft);
    box-shadow: 0 2px 0 var(--panel-border);
}

/* Authentication */
.auth-page {
    min-height: calc(100vh - 72px);
    padding: clamp(24px, 5vw, 64px) 20px;
}

.auth-page > .auth-card {
    width: min(980px, 100%);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: 26px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.auth-aside {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 4vw, 52px);
    color: #fff;
    background:
        radial-gradient(circle at 90% 5%, rgba(255, 255, 255, 0.2), transparent 16rem),
        linear-gradient(145deg, #7361e8, #4333af);
}

.auth-aside h1,
.auth-aside p,
.auth-aside span {
    color: #fff;
}

.auth-aside h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1;
}

.auth-main {
    padding: clamp(28px, 4vw, 52px);
    background: var(--panel-strong);
}

.auth-tabs {
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--panel-soft);
}

.auth-tabs button {
    min-height: 38px;
    border-radius: 10px;
    color: var(--muted);
}

.auth-tabs button.active {
    color: var(--text);
    background: var(--panel-strong);
    box-shadow: var(--shadow-sm);
}

.auth-form input {
    min-height: 48px;
    padding: 10px 13px;
}

.auth-form label {
    color: var(--text-secondary);
}

.auth-note {
    color: var(--muted);
}

.auth-check,
.profile-check {
    border-color: var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--accent-softer);
}

.auth-message,
.auth-profile {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--panel-soft);
}

.auth-message[data-type="success"] {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 10%, var(--panel-strong));
}

.auth-message[data-type="error"] {
    color: var(--bad);
    background: color-mix(in srgb, var(--bad) 10%, var(--panel-strong));
}

.reset-card,
.verify-card {
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

/* Admin */
.admin-page {
    padding: 40px 18px 52px;
}

.admin-heading h1,
.admin-status,
.admin-sidebar label,
.admin-editor label,
.admin-stat-grid strong,
.admin-lesson-item {
    color: var(--text);
}

.admin-sidebar,
.admin-editor {
    padding: 22px;
}

.admin-stat-grid article,
.admin-lesson-item {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
}

.admin-sidebar select,
.admin-sidebar input,
.admin-editor input,
.admin-editor textarea {
    border-color: var(--panel-border);
    border-radius: 13px;
    color: var(--text);
    background: var(--panel-strong);
}

.admin-stat-grid span,
.admin-lesson-item span {
    color: var(--muted);
}

.admin-library {
    border-color: var(--panel-border);
}

.admin-lesson-item.active {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--panel-border));
    background: var(--accent-soft);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--panel-border);
    color: var(--muted);
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(20px);
}

.site-footer-thin {
    font-size: 0.78rem;
}

.footer-content {
    min-height: 64px;
    padding: 12px 0;
}

.footer-links,
.footer-social {
    gap: 14px;
}

.footer-links a,
.footer-social a {
    color: var(--muted);
}

.footer-links a:hover,
.footer-social a:hover,
.footer-social strong {
    color: var(--text);
}

/* Dark surface corrections for legacy hard-coded gradients */
html[data-theme="dark"] :is(
    .profile-card,
    .results-summary-grid .stat-card,
    .results-chart-panel,
    .results-table-panel,
    .results-help-panel,
    .leaderboard-panel,
    .leaderboard-metrics article,
    .leaderboard-table,
    .leaderboard-info,
    .password-card,
    .password-info-grid article,
    .password-seo-card,
    .password-faq-card,
    .password-side-nav,
    .blog-card,
    .video-card,
    .practice-note,
    .video-section,
    .trainer-seo-grid article,
    .trainer-faq-grid article,
    .trainer-heading-section .trainer-heading,
    .ad-slot,
    .ad-placeholder
),
body[data-theme="dark"] :is(
    .profile-card,
    .results-summary-grid .stat-card,
    .results-chart-panel,
    .results-table-panel,
    .results-help-panel,
    .leaderboard-panel,
    .leaderboard-metrics article,
    .leaderboard-table,
    .leaderboard-info,
    .password-card,
    .password-info-grid article,
    .password-seo-card,
    .password-faq-card,
    .password-side-nav,
    .blog-card,
    .video-card,
    .practice-note,
    .video-section,
    .trainer-seo-grid article,
    .trainer-faq-grid article,
    .trainer-heading-section .trainer-heading,
    .ad-slot,
    .ad-placeholder
) {
    color: var(--text);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] :is(.stat-card, .tree-group, .tree-child, .lesson-item.active, .password-item, .setting-check),
body[data-theme="dark"] :is(.stat-card, .tree-group, .tree-child, .lesson-item.active, .password-item, .setting-check) {
    background: var(--panel-strong);
}

/* Responsive */
@media (max-width: 1180px) {
    .layout {
        grid-template-columns: 220px minmax(0, 1fr);
    }

    .right-sidebar {
        grid-column: 1 / -1;
    }

    .right-sidebar .panel {
        position: static;
    }

    .right-sidebar .ad-panel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .right-sidebar .ad-placeholder {
        min-height: 140px;
    }
}

@media (max-width: 900px) {
    .container {
        width: min(100% - 28px, 1280px);
    }

    .navbar {
        min-height: 64px;
    }

    .layout,
    .content-grid,
    .password-page-grid,
    .password-layout,
    .profile-grid,
    .results-dashboard {
        grid-template-columns: 1fr;
    }

    .trainer-column {
        order: 1;
    }

    .left-sidebar {
        order: 2;
    }

    .right-sidebar {
        order: 3;
    }

    .left-sidebar .panel,
    .password-side-nav,
    .password-settings-card {
        position: static;
    }

    .password-side-nav {
        display: flex;
        overflow-x: auto;
    }

    .password-side-nav .block-label {
        display: none;
    }

    .auth-page > .auth-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .site-header {
        position: sticky;
    }

    .navbar {
        gap: 8px;
        padding: 8px 0;
    }

    .logo::before {
        width: 32px;
        height: 32px;
    }

    .nav-links {
        order: 3;
        flex: 1 0 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 2px 0 3px;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a,
    .nav-more summary {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .auth-buttons {
        margin-left: auto;
    }

    .theme-label {
        display: none;
    }

    .hero-panel {
        border-radius: 22px;
    }

    .hero-panel h1 {
        font-size: clamp(2.1rem, 11vw, 3.4rem);
    }

    .stats-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .stat-card {
        padding: 9px 3px;
    }

    .stat-title,
    .stat-card small {
        font-size: 0.57rem;
    }

    .stat-card strong {
        font-size: 1rem;
    }

    .right-sidebar .ad-panel {
        grid-template-columns: 1fr;
    }

    .useful-hero {
        width: min(100% - 28px, 1280px);
        border-radius: 22px;
    }

    .practice-note {
        align-items: flex-start;
        flex-direction: column;
    }

    .results-heading,
    .password-output-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .password-head-tools {
        width: 100%;
        justify-items: start;
    }

    .password-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 540px) {
    .container {
        width: min(100% - 20px, 1280px);
    }

    .logo {
        gap: 7px;
        font-size: 0.98rem;
    }

    .auth-buttons .btn {
        min-height: 34px;
        padding: 7px 9px;
        font-size: 0.72rem;
    }

    .auth-buttons .btn-secondary {
        display: none;
    }

    .switch {
        width: 44px;
        height: 26px;
    }

    .slider::before {
        width: 18px;
        height: 18px;
    }

    .switch input:checked + .slider::before,
    .theme-switcher input[type="checkbox"]:checked + .slider::before {
        transform: translateX(18px);
    }

    .page,
    .page:has(.layout) {
        padding: 14px 0 34px;
    }

    .hero-panel {
        padding: 26px 22px;
    }

    .topic-grid,
    .trainer-seo-grid,
    .trainer-faq-grid,
    .hotkeys-info-grid,
    .password-info-grid {
        grid-template-columns: 1fr;
    }

    .trainer-panel,
    .left-sidebar .panel,
    .right-sidebar .panel {
        padding: 12px;
    }

    .trainer-topbar {
        align-items: flex-start;
    }

    .keyboard-panel {
        padding: 7px 4px;
    }

    .keyboard-row {
        gap: 2px;
    }

    .keyboard-key {
        min-width: 15px;
        min-height: 26px;
        border-radius: 5px;
        font-size: 0.42rem;
    }

    .control-row .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .password-item {
        grid-template-columns: 1.8rem minmax(0, 1fr);
    }

    .password-copy-btn {
        grid-column: 1 / -1;
    }

    .footer-content {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
