/* ==========================================================================
   KeyTest Blue — main stylesheet
   ========================================================================== */

:root {
	--primary: #1d6ff2;
	--primary-2: #0ea5e9;
	--primary-ink: #ffffff;
	--primary-soft: color-mix(in srgb, var(--primary) 12%, #fff);
	--bg: #f4f7fd;
	--bg-grad: radial-gradient(1200px 500px at 50% -120px, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%);
	--surface: #ffffff;
	--surface-2: #f1f5fc;
	--border: #dfe7f3;
	--border-strong: #c9d6ea;
	--text: #0d1b36;
	--muted: #5a6a88;
	--shadow: 0 1px 2px rgba(15, 40, 90, .05), 0 8px 24px rgba(15, 40, 90, .06);

	--key-bg: #ffffff;
	--key-border: #d3deef;
	--key-edge: #c3d1e8;
	--key-text: #2a3957;
	--key-ok-bg: color-mix(in srgb, var(--primary) 24%, #fff);
	--key-ok-border: color-mix(in srgb, var(--primary) 60%, #fff);
	--key-ok-text: color-mix(in srgb, var(--primary) 75%, #000);
	--key-down-bg: var(--primary);
	--key-down-text: #fff;
	--key-chat-bg: #fff1e2;
	--key-chat-border: #f59e0b;
	--key-chat-text: #b45309;
	--board-bg: linear-gradient(180deg, #eaf1fc, #e2ebf9);

	--danger: #e11d48;
	--warn: #f59e0b;
	--ok: #16a34a;

	--radius: 16px;
	--radius-sm: 10px;
	--font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
	--container: 1180px;
	color-scheme: light;
}

:root[data-theme="dark"] {
	--primary-soft: color-mix(in srgb, var(--primary) 22%, #0b1428);
	--bg: #081122;
	--bg-grad: radial-gradient(1200px 500px at 50% -120px, color-mix(in srgb, var(--primary) 28%, transparent), transparent 70%);
	--surface: #0f1b33;
	--surface-2: #15233f;
	--border: #1f2f4f;
	--border-strong: #2b3f66;
	--text: #e7eefc;
	--muted: #93a4c6;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);

	--key-bg: #172641;
	--key-border: #26395e;
	--key-edge: #0b1529;
	--key-text: #c9d6ef;
	--key-ok-bg: color-mix(in srgb, var(--primary) 30%, #0f1b33);
	--key-ok-border: color-mix(in srgb, var(--primary) 70%, #0f1b33);
	--key-ok-text: #dbe8ff;
	--key-chat-bg: #3a2610;
	--key-chat-text: #fbbf24;
	--board-bg: linear-gradient(180deg, #0c172c, #0a1426);
	color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.65;
	color: var(--text);
	background: var(--bg-grad), var(--bg);
	background-repeat: no-repeat;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container--wide { max-width: 1320px; }

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 999px; border: 0; font-weight: 600; text-decoration: none !important; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--surface) 82%, transparent);
	backdrop-filter: saturate(1.4) blur(12px);
	-webkit-backdrop-filter: saturate(1.4) blur(12px);
	border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .02em; color: var(--text); text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 40%, transparent); }
.brand-text { background: linear-gradient(90deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; text-transform: uppercase; }
.custom-logo-link img { max-height: 44px; width: auto; display: block; }

.main-nav { margin-left: auto; }
.main-nav .menu { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.main-nav .menu li { position: relative; }
.main-nav .menu a { display: block; padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: none; }
.main-nav .menu a:hover, .main-nav .current-menu-item > a { color: var(--primary); background: var(--primary-soft); }
.main-nav .sub-menu { list-style: none; position: absolute; top: 100%; left: 0; min-width: 200px; padding: 6px; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); display: none; }
.main-nav li:hover > .sub-menu, .main-nav li:focus-within > .sub-menu { display: block; }

.header-tools { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.lang-switch button { border: 0; background: none; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 40, 90, .12); }

.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.icon-btn:hover { color: var(--primary); border-color: var(--border-strong); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
.nav-toggle { display: none; }

@media (max-width: 860px) {
	.nav-toggle { display: grid; }
	.header-tools { margin-left: auto; }
	.main-nav { position: absolute; top: 64px; left: 0; right: 0; margin: 0; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); display: none; padding: 8px 16px 16px; }
	.main-nav.is-open { display: block; }
	.main-nav .menu { flex-direction: column; }
	.main-nav .sub-menu { position: static; display: block; box-shadow: none; border: 0; padding-left: 12px; }
}

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 40px 0 22px; }
.hero-title { margin: 0 auto 12px; max-width: 900px; font-size: clamp(26px, 4vw, 42px); line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
.hero-desc { margin: 0 auto; max-width: 760px; color: var(--muted); font-size: clamp(15px, 1.6vw, 17px); }

/* ==========================================================================
   Keyboard tester
   ========================================================================== */
.kt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 28px; }
.kt > *, .tt > *, .mt > * { min-width: 0; }
.kt:fullscreen { background: var(--bg); padding: 24px; overflow: auto; align-content: start; }

.kt-toolbar {
	display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end;
	padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kt-group { display: grid; gap: 6px; }
.kt-group.is-disabled { opacity: .45; pointer-events: none; }
.kt-group--actions { margin-left: auto; }
.kt-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kt-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.kt-seg button { border: 0; background: none; padding: 6px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.kt-seg button:hover { color: var(--text); }
.kt-seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 40, 90, .14); }
:root[data-theme="dark"] .kt-seg button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.kt-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.kt-act { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 600; color: var(--text); }
.kt-act:hover { border-color: var(--primary); color: var(--primary); }
.kt-act--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.kt-act--danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

.kt-typing { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); min-height: 52px; }
.kt-typing-text { flex: 1; min-width: 0; font-family: var(--mono); font-size: 15px; white-space: pre; overflow: hidden; color: var(--text); }
.kt-typing-text:empty::before { content: attr(data-ph); font-family: var(--font); font-style: italic; color: var(--muted); }
.kt-typing-text .caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 1px; vertical-align: -3px; background: var(--primary); animation: kt-blink 1s steps(1) infinite; }
@keyframes kt-blink { 50% { opacity: 0; } }
.kt-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.kt-pill b { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-size: 13px; }

.kt-board-wrap {
	padding: 18px; border-radius: 20px; background: var(--board-bg); border: 1px solid var(--border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), var(--shadow);
	overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.kt-board { --u: 48px; position: relative; margin: 0 auto; width: calc(var(--W) * var(--u)); height: calc(var(--H) * var(--u)); user-select: none; -webkit-user-select: none; }

.key {
	--g: calc(var(--u) * .1);
	position: absolute;
	left: calc(var(--x) * var(--u));
	top: calc(var(--y) * var(--u));
	width: calc(var(--w) * var(--u) - var(--g));
	height: calc(var(--h) * var(--u) - var(--g));
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
	padding: 0 4px;
	border-radius: calc(var(--u) * .16);
	background: var(--key-bg);
	border: 1px solid var(--key-border);
	box-shadow: 0 calc(var(--u) * .06) 0 var(--key-edge), 0 2px 6px rgba(15, 40, 90, .06);
	color: var(--key-text);
	font-size: calc(var(--u) * .27);
	font-weight: 600;
	line-height: 1.05;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	transition: background-color .18s, border-color .18s, color .18s, transform .06s, box-shadow .06s;
}
.key .sub { font-size: .78em; opacity: .6; font-weight: 500; }
.key .ic { width: 1.15em; height: 1.15em; }
.key.is-small { font-size: calc(var(--u) * .22); }
.key.is-half { font-size: calc(var(--u) * .2); }
.key.ok { background: var(--key-ok-bg); border-color: var(--key-ok-border); color: var(--key-ok-text); }
.key.chatter { background: var(--key-chat-bg); border-color: var(--key-chat-border); color: var(--key-chat-text); }
.key.down {
	background: var(--key-down-bg); border-color: var(--key-down-bg); color: var(--key-down-text);
	transform: translateY(calc(var(--u) * .05));
	box-shadow: 0 0 0 var(--key-edge), 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent), 0 6px 18px color-mix(in srgb, var(--primary) 45%, transparent);
}
.key.na { background: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--muted) 14%, transparent) 5px 7px), var(--surface-2); color: var(--muted); border-style: dashed; box-shadow: none; }
.key.flash { animation: kt-flash .45s ease-out; }
@keyframes kt-flash { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 60%, transparent); } to { box-shadow: 0 0 0 10px transparent; } }

.kt-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 0 4px; }
.kt-progress-bar { flex: 1 1 240px; height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.kt-progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: inherit; transition: width .3s; }
.kt-legend, .color-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.kt-legend li, .color-list li { display: inline-flex; align-items: center; gap: 6px; }
.lg { flex: none; display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--key-border); background: var(--key-bg); }
.lg-down { background: var(--primary); border-color: var(--primary); }
.lg-ok { background: var(--key-ok-bg); border-color: var(--key-ok-border); }
.lg-chat { background: var(--key-chat-bg); border-color: var(--key-chat-border); }
.lg-na { border-style: dashed; background: repeating-linear-gradient(135deg, transparent 0 3px, color-mix(in srgb, var(--muted) 30%, transparent) 3px 4px), var(--surface-2); }

.kt-panels { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.kt-panels--single { grid-template-columns: 1fr; }
.kt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 18px; box-shadow: var(--shadow); min-width: 0; }
.kt-card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.kt-card-title svg { color: var(--primary); }

.kt-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kt-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.kt-stat span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kt-stat b { font-size: 20px; font-weight: 800; color: var(--primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-stat b.mono { font-family: var(--mono); font-size: 16px; line-height: 30px; }
.kt-stat--wide { grid-column: span 2; }
.kt-stat--wide b { font-size: 16px; line-height: 30px; }
.kt-stat--warn { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.kt-stat--warn b { color: var(--key-chat-text); }
.kt-stat b.is-done { color: var(--ok); }

.kt-mouse-pad { position: relative; display: grid; place-items: center; gap: 6px; padding: 14px; border-radius: 14px; border: 1.5px dashed var(--border-strong); background: var(--surface-2); cursor: crosshair; user-select: none; -webkit-user-select: none; }
.kt-mouse-pad:hover, .kt-mouse-pad:focus { border-color: var(--primary); outline: none; }
.kt-mouse-svg { width: 96px; height: 144px; }
.kt-mouse-svg .m-body { fill: var(--key-bg); stroke: var(--key-border); stroke-width: 2; }
.kt-mouse-svg .m-btn { fill: var(--key-bg); stroke: var(--key-border); stroke-width: 1.5; transition: fill .15s; }
.kt-mouse-svg .m-btn.ok { fill: var(--key-ok-bg); stroke: var(--key-ok-border); }
.kt-mouse-svg .m-btn.down { fill: var(--primary); stroke: var(--primary); }
.kt-mouse-svg .m-arrow { fill: var(--muted); opacity: .5; transition: fill .15s, opacity .15s; }
.kt-mouse-svg .m-arrow.down { fill: var(--primary); opacity: 1; }
.kt-mouse-hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.kt-mouse-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 0; padding: 0; font-size: 13px; }
.kt-mouse-list li { display: flex; justify-content: space-between; padding: 5px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.kt-mouse-list li b { color: var(--text); }
.kt-mouse-list li.ok b { color: var(--primary); }

.kt-perf-box { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.kt-perf-box canvas { width: 100%; height: 140px; display: block; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.kt-perf-meters { display: grid; gap: 8px; align-content: start; }
.kt-perf-meters div { min-width: 86px; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.kt-perf-meters span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.kt-perf-meters b { font-size: 20px; color: var(--primary); }

.kt-toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; transition: opacity .2s, transform .2s; }
.kt-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1080px) {
	.kt-panels { grid-template-columns: 1fr; }
	.kt-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.kt-mouse-list { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 720px) {
	.kt-group--actions { margin-left: 0; }
	.kt-toolbar { gap: 12px 16px; padding: 12px; }
	.kt-seg button { padding: 6px 10px; }
	.kt-board-wrap { padding: 12px; }
	.kt-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.kt-mouse-list { grid-template-columns: 1fr 1fr; }
	.kt-perf-box { grid-template-columns: 1fr; }
	.kt-perf-meters { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Tool tabs ---------- */
.tool-tabs { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 4px; margin: 0 auto 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.tool-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none !important; }
.tool-tab:hover { color: var(--primary); background: var(--primary-soft); }
.tool-tab.is-active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent); }

/* ---------- Key event log ---------- */
.kt-log-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-bottom: 12px; }
.kt-log-head .kt-card-title { margin: 0; }
.kt-log-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.kt-log-meta b { color: var(--primary); }
.kt-log-head .kt-actions { margin-left: auto; }
.kt-act.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.kt-log-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.kt-log-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.kt-log-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.kt-log-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.kt-log-table tbody tr:last-child td { border-bottom: 0; }
.kt-log-table tbody tr:hover td { background: var(--primary-soft); }
.kt-log-table .ev-down { color: var(--primary); font-weight: 700; font-family: var(--font); }
.kt-log-table .ev-up { color: var(--muted); font-family: var(--font); }
.kt-log-table tr.is-chat td { background: var(--key-chat-bg); color: var(--key-chat-text); }
.kt-log-table tr.is-long td { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }
.kt-log-empty td { text-align: center; color: var(--muted); font-family: var(--font) !important; padding: 18px !important; white-space: normal !important; }
.kt-log-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- Typing test ---------- */
.tt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 28px; }
.tt-live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tt-live-item { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; }
.tt-live-item span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tt-live-item b { font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1.2; font-variant-numeric: tabular-nums; }
.tt-live-item b i { font-style: normal; }
.tt-live-item b i.bad { color: var(--danger); }
.tt-live-item--time b { background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.tt-board { position: relative; padding: 22px 22px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.tt-timebar { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--surface-2); }
.tt-timebar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .1s linear; }
.tt-words { position: relative; height: calc(1.9em * 3); overflow: hidden; font-size: clamp(19px, 2.4vw, 25px); cursor: text; user-select: none; -webkit-user-select: none; }
.tt-words-inner { position: relative; line-height: 1.9; color: var(--muted); transition: transform .18s ease; word-spacing: .12em; }
.tt-words .w { position: relative; padding: 2px 3px; border-radius: 6px; white-space: nowrap; }
.tt-words .w em { font-style: normal; }
.tt-words .w em.c { color: var(--text); }
.tt-words .w em.x { color: var(--danger); text-decoration: underline; text-decoration-thickness: 2px; }
.tt-words .w em.extra { opacity: .7; }
.tt-words .w.cur { background: var(--primary-soft); color: var(--text); box-shadow: inset 0 -2px 0 var(--primary); }
.tt-words .w.cur.err-live { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); box-shadow: inset 0 -2px 0 var(--danger); }
.tt-words .w.ok { color: var(--primary); }
.tt-words .w.err { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 2px; opacity: .85; }
.tt-input-row { display: flex; gap: 10px; margin-top: 16px; }
.tt-input { flex: 1; min-width: 0; height: 52px; padding: 0 18px !important; font-size: 20px !important; border-radius: 14px !important; border: 2px solid var(--border-strong) !important; background: var(--surface-2) !important; }
.tt-input:focus { border-color: var(--primary) !important; background: var(--surface) !important; }
.tt-input:disabled { opacity: .6; }
.tt-input-row .icon-btn { width: 52px; height: 52px; border-radius: 14px; }
.tt-hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

.tt-result { border: 2px solid color-mix(in srgb, var(--primary) 35%, var(--border)); animation: tt-in .35s ease-out; }
@keyframes tt-in { from { opacity: 0; transform: translateY(8px); } }
.tt-result-main { display: flex; align-items: center; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }
.tt-score { display: grid; place-items: center; width: 132px; height: 132px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 10px 30px color-mix(in srgb, var(--primary) 40%, transparent); align-content: center; }
.tt-score b { font-size: 46px; font-weight: 800; line-height: 1; }
.tt-score span { font-size: 13px; font-weight: 700; letter-spacing: .1em; opacity: .9; }
.tt-rank { margin: 0 0 4px; font-size: 26px; font-weight: 800; }
.tt-best { margin: 0; color: var(--muted); }
.tt-best b { color: var(--primary); }
.tt-newbest { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--key-chat-text); font-size: 12px; font-weight: 700; }
.tt-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
@media (max-width: 720px) {
	.tt-live { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tt-board { padding: 18px 14px 14px; }
	.tt-input { font-size: 17px !important; padding: 0 12px !important; }
}

/* ---------- Mouse test ---------- */
.mt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 28px; }
.mt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 14px; }
.mt-poll { grid-column: 1 / -1; }
.mt-zone {
	position: relative; display: grid; place-items: center; align-content: center; gap: 4px; width: 100%; min-height: 250px; padding: 20px;
	border: 2px dashed var(--border-strong); border-radius: 16px; background: var(--surface-2); color: var(--text);
	user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
}
.mt-zone:hover { border-color: var(--primary); }
.mt-zone.is-running { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.mt-zone.is-done { border-style: solid; border-color: var(--ok); }
.mt-zone.pop .mt-zone-big { animation: mt-pop .12s ease-out; }
@keyframes mt-pop { from { transform: scale(1.12); } }
.mt-zone-big { font-size: 72px; font-weight: 800; line-height: 1; color: var(--primary); font-variant-numeric: tabular-nums; }
.mt-zone-msg { font-size: 15px; font-weight: 600; color: var(--muted); }
.mt-zone-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: transparent; }
.mt-zone-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.mt-cps-stats { margin-top: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }

.mt-dc-body { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: start; }
.mt-dc-body .kt-mouse-pad { min-height: 250px; }
.mt-verdict { padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.mt-verdict.is-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.mt-verdict.is-bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.mt-dc-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.mt-dc-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mt-dc-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mt-dc-table tr.is-ok td:first-child { color: var(--primary); font-weight: 700; }
.mt-dc-table tr.is-bad td { color: var(--danger); font-weight: 700; background: color-mix(in srgb, var(--danger) 6%, transparent); }
.mt-wheel { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.mt-wheel b { color: var(--primary); }
.mt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mt-chip { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border)); }

.mt-poll-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.mt-poll-zone { position: relative; height: 220px; border-radius: 14px; border: 1.5px dashed var(--border-strong); background: var(--surface-2); cursor: crosshair; overflow: hidden; touch-action: none; }
.mt-poll-zone.is-active { border-color: var(--primary); border-style: solid; }
.mt-poll-zone canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.mt-poll-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; pointer-events: none; transition: opacity .2s; }
.mt-poll-zone.is-active .mt-poll-msg { opacity: .25; }
.mt-poll-meters div { min-width: 110px; }

@media (max-width: 1000px) {
	.mt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
	.mt-dc-body { grid-template-columns: 1fr; }
	.mt-cps-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.mt-poll-body { grid-template-columns: 1fr; }
	.mt-poll-meters { grid-template-columns: repeat(3, 1fr); }
	.mt-poll-meters div { min-width: 0; }
}

/* ---------- Ads ---------- */
.ktb-ad { margin: 16px 0; text-align: center; overflow: hidden; }

/* ==========================================================================
   Content
   ========================================================================== */
.entry { max-width: 860px; margin: 24px auto 40px; padding: 32px clamp(18px, 4vw, 44px); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.entry--home { margin-top: 8px; }
.page-head { max-width: 860px; margin-top: 36px; }
.page-title { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.25; margin: 0 0 16px; font-weight: 800; letter-spacing: -.01em; }
.page-desc { color: var(--muted); }
.post-meta { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.entry-thumb { margin: 0 0 20px; }
.entry-thumb img { border-radius: 14px; display: block; }

.entry-content { overflow-wrap: break-word; }
.entry-content h2 { font-size: clamp(21px, 2.6vw, 26px); line-height: 1.3; margin: 2em 0 .7em; letter-spacing: -.01em; }
.entry-content h2::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; margin-bottom: 12px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.entry-content h3 { font-size: 18px; margin: 1.5em 0 .5em; }
.entry-content img { border-radius: 12px; }
.entry-content blockquote { margin: 1.5em 0; padding: 12px 20px; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 0 12px 12px 0; }
.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.entry-content th { background: var(--surface-2); }
.entry-content pre, .entry-content code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border-radius: 6px; }
.entry-content code { padding: 2px 6px; }
.entry-content pre { padding: 14px; overflow-x: auto; }
.lead { font-size: 18px; color: var(--muted); }
.alignwide { max-width: 1100px; }
.aligncenter { margin-left: auto; margin-right: auto; }

.toc { margin: 0 0 24px; padding: 16px 20px; border-radius: 14px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent); }
.toc-title { margin: 0 0 6px; font-weight: 700; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 3px 0; }

.steps { display: grid; gap: 12px; }
.step { display: flex; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.step h3 { margin: 0 0 4px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 15px; }
.step-no { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 800; }

.color-list { display: grid; gap: 8px; font-size: 16px; color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
.card { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.card h3 { margin: 0 0 4px; font-size: 16px; color: var(--primary); }
.card p { margin: 0; font-size: 15px; color: var(--muted); }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.faq summary { list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details[open] summary { color: var(--primary); }
.faq details p { margin: 0; padding: 0 16px 14px; color: var(--muted); }

/* Blog */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin: 8px 0 32px; }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); transition: transform .2s; }
.post-card:hover { transform: translateY(-3px); }
.post-card-thumb img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card-body { padding: 16px 18px 18px; }
.post-card-title { font-size: 18px; line-height: 1.35; margin: 0 0 8px; }
.post-card-title a { color: var(--text); }
.post-card-body p:last-child { margin: 0; color: var(--muted); font-size: 15px; }
.pagination .nav-links { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }
.pagination .page-numbers { padding: 6px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.post-tags a { display: inline-block; padding: 2px 10px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--primary-soft); font-size: 13px; }

.notfound { text-align: center; }
.notfound-code { margin: 0; font-size: 96px; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Forms */
input[type="text"], input[type="email"], input[type="url"], input[type="search"], input[type="password"], textarea {
	width: 100%; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
input[type="submit"], button[type="submit"] { padding: 10px 22px; border: 0; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 600; cursor: pointer; }
.search-form { display: flex; gap: 8px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-list .children { list-style: none; padding-left: 24px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 24px; padding: 28px 0; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 20px; }
.widget-title { font-size: 15px; color: var(--text); margin: 0 0 8px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-text { margin: 0; }
.footer-nav .menu { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 0; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--primary); }

/* ---------- Cookie ---------- */
.cookie-bar { position: fixed; left: 50%; bottom: 16px; z-index: 90; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 40px rgba(15, 40, 90, .18); font-size: 14px; }
.cookie-bar p { margin: 0; flex: 1; }
.cookie-bar[hidden] { display: none; }
@media (max-width: 560px) { .cookie-bar { flex-direction: column; text-align: center; } }

/* WP core */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
.wp-caption-text, figcaption { font-size: 13px; color: var(--muted); text-align: center; }
.sticky, .bypostauthor, .gallery-caption { }
.alignleft { float: left; margin: 0 1.2em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.2em; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
