/* =======================================================================
   Finders Keypress - styles
   Dual theme (dark default / light). All colors are CSS variables, so the
   whole UI re-skins from the token blocks below.
   ======================================================================= */

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- Tokens ---------- */
:root {
    /* Accents */
    --accent: #37f0b0;
    --accent-2: #4da3ff;
    --accent-soft: rgba(55, 240, 176, 0.14);
    --warn: #ffb454;
    --danger: #ff5d73;

    /* Radius: two-step scale (small for data chrome, larger for the readout) */
    --r-data: 3px;
    --r-panel: 12px;

    /* Spacing: 4px baseline rhythm, used with intent (not uniform) */
    --s1: 4px;
    --s2: 8px;
    --s3: 12px;
    --s4: 16px;
    --s5: 24px;
    --s6: 32px;
    --s7: 48px;

    --font: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Dark (default) */
html[data-theme='dark'] {
    --bg: #0b1020;
    --bg-grid: rgba(255, 255, 255, 0.03);
    --surface: #121a2f;
    --surface-2: #18233d;
    --surface-3: #1f2c4a;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --hair: rgba(255, 255, 255, 0.06);
    --text: #e8eefc;
    --text-dim: #93a2c4;
    --text-faint: #5f6f93;
    --elev: 0 18px 48px -24px rgba(0, 0, 0, 0.8);
    --led: var(--accent);
}

/* Light (clinical) */
html[data-theme='light'] {
    --bg: #eef2f8;
    --bg-grid: rgba(10, 30, 70, 0.035);
    --surface: #ffffff;
    --surface-2: #f4f7fb;
    --surface-3: #e9eff7;
    --border: rgba(16, 38, 76, 0.1);
    --border-strong: rgba(16, 38, 76, 0.2);
    --hair: rgba(16, 38, 76, 0.08);
    --text: #11203a;
    --text-dim: #51617f;
    --text-faint: #8695ad;
    --elev: 0 18px 40px -24px rgba(31, 51, 92, 0.4);
    --accent: #0ea574;
    --accent-2: #2b7fff;
    --accent-soft: rgba(14, 165, 116, 0.12);
    --led: #0ea574;
}

/* ---------- Base ---------- */
html,
body {
    height: 100%;
}

body {
    font-family: var(--font-ui);
    color: var(--text);
    /* Fine background grid. */
    background:
        linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 -1px / 100% 32px,
        linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) -1px 0 / 32px 100%,
        var(--bg);
    transition:
        background-color 0.4s var(--ease),
        color 0.3s var(--ease);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Tabular numerals so numbers line up. */
.mini-stat-value,
.stat-num,
.readout-key,
.log-table td,
.log-table th,
.chip,
.mini-stat-label {
    font-variant-numeric: tabular-nums;
    font-feature-settings:
        'tnum' 1,
        'cv01' 1;
}

/* Main content column. */
.app {
    max-width: 1060px;
    margin: 0 auto;
    padding: var(--s6) var(--s6) 128px;
}

h1,
h2 {
    font-weight: 640;
    letter-spacing: -0.015em;
}

/* Reusable small uppercase label styling. */
.panel-sub,
.readout-label,
.mode-tab-sub {
    font-family: var(--font);
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ========================= Top bar ========================= */
.topbar {
    display: flex;
    align-items: flex-end; /* baseline-ish alignment, not centered */
    justify-content: space-between;
    gap: var(--s4);
    padding-bottom: var(--s5);
    margin-bottom: var(--s6);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s4);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    z-index: 2;
}
.brand-wave {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0 5px, var(--accent) 5px 6px);
    opacity: 0.16;
    -webkit-mask: radial-gradient(circle at center, #000 0, transparent 68%);
    mask: radial-gradient(circle at center, #000 0, transparent 68%);
}

.brand-name {
    font-size: 1.18rem;
    line-height: 1;
}
.brand-tagline {
    margin-top: 5px;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: var(--s2);
}

/* Status: a flat bordered readout, not a rounded pill. */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    padding: 7px 11px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-data);
    font-family: var(--font);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}
.status-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--led);
    box-shadow: 0 0 8px var(--led);
    animation: breathe 2.4s var(--ease) infinite;
}
@keyframes breathe {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}
.status-led.hit {
    animation: none;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--r-data);
    border: 1px solid var(--border);
    background: transparent; /* ghost button */
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    display: grid;
    place-items: center;
    transition:
        border-color 0.2s,
        background 0.2s;
}
.icon-btn:hover {
    border-color: var(--accent);
    background: var(--surface);
}
html[data-theme='dark'] .theme-icon-light {
    display: none;
}
html[data-theme='light'] .theme-icon-dark {
    display: none;
}

/* ========================= Mode tabs ========================= */
/* Tabs sized to content; the active tab shows an underline. */
.mode-switch {
    position: relative;
    display: flex;
    gap: var(--s6);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--s6);
    padding-left: 2px;
}
.mode-tab {
    position: relative;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0 0 var(--s4);
    text-align: left;
    color: var(--text-faint);
    transition: color 0.25s var(--ease);
}
.mode-tab.active {
    color: var(--text);
}
.mode-tab-title {
    display: block;
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: -0.01em;
}
.mode-tab-sub {
    display: block;
    margin-top: 3px;
    color: var(--text-faint);
}
/* The underline indicator rides the active tab's width (content-sized). */
.mode-tab::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
}
.mode-tab.active::after {
    transform: scaleX(1);
}
.mode-indicator {
    display: none;
} /* retired in favor of per-tab underline */

/* ========================= Sections (flat, hairline) ========================= */
/* Sections use a hairline top rule and a kicker, not boxed cards. */
.panel {
    padding: var(--s6) 0;
    border-top: 1px solid var(--border);
}
.panel:first-of-type {
    border-top: 0;
}

.panel-head {
    margin-bottom: var(--s5);
}
.panel-head h2 {
    font-size: 0.98rem;
    position: relative;
    padding-left: var(--s3);
}
/* Accent tick before each section title. */
.panel-head h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0.9em;
    background: var(--accent);
    transform: translateY(-50%);
    border-radius: 1px;
}
.panel-sub {
    margin-top: 6px;
    padding-left: var(--s3);
}

.mode-panel {
    display: none;
}
.mode-panel.active {
    display: block;
    animation: rise 0.35s var(--ease);
}
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ========================= Basic: readout ========================= */
/* The readout is the only elevated, soft-cornered surface. */
.readout {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-panel);
    padding: var(--s7) var(--s6) var(--s6);
    margin-bottom: var(--s5);
    box-shadow: var(--elev);
    overflow: hidden;
}
/* Ruler bezel: major ticks (accent) over minor ticks. */
.readout::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 12px;
    background-image:
        repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 64px),
        repeating-linear-gradient(90deg, var(--border-strong) 0 1px, transparent 1px 16px);
    background-size:
        100% 12px,
        100% 7px;
    background-position:
        left top,
        left top;
    background-repeat: repeat-x, repeat-x;
    opacity: 0.55;
}
.readout-main {
    padding-right: var(--s6);
}
.readout-key {
    font-family: var(--font);
    font-size: clamp(2.6rem, 11vw, 4.6rem);
    font-weight: 680;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--accent);
    text-shadow: none; /* crisp at rest, no standing glow */
    word-break: break-word;
    margin: var(--s3) 0;
    /* Reserve one line so changing the value doesn't change the height. */
    min-height: 1.05em;
    display: flex;
    align-items: center;
    will-change: text-shadow;
}
/* Brief glow on change; no transform or layout shift. */
.readout-key.flash {
    animation: keyping 0.18s var(--ease);
}
@keyframes keyping {
    0% {
        text-shadow: 0 0 9px var(--accent-soft);
    }
    100% {
        text-shadow: 0 0 0 transparent;
    }
}
.readout-meta {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
}

/* Chips: flat bordered tags. */
.chip {
    font-family: var(--font);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 4px 8px;
    border-radius: var(--r-data);
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--border-strong);
}
.chip-ghost {
    color: var(--text-dim);
}

/* Side readouts: hairline-divided rows, NOT a stack of separate boxes. */
.readout-side {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    padding-left: var(--s5);
}
.mini-stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: var(--s3) 0;
    border-bottom: 1px solid var(--hair);
}
.mini-stat:last-child {
    border-bottom: 0;
}
.mini-stat-value {
    font-family: var(--font);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}
.mini-stat-label {
    font-size: 0.64rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-family: var(--font);
}

/* ========================= Charts ========================= */
.chart-wrap {
    position: relative;
    height: 210px;
}
.chart-wrap--tall {
    height: 240px;
}

/* Asymmetric grid: 7/5 and 5/7 column splits. */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    column-gap: var(--s6);
}
.chart-grid > .panel {
    padding-top: var(--s6);
    padding-bottom: var(--s6);
}
.chart-grid > .panel:nth-child(1) {
    grid-column: span 7;
}
.chart-grid > .panel:nth-child(2) {
    grid-column: span 5;
}
.chart-grid > .panel:nth-child(3) {
    grid-column: span 5;
}
.chart-grid > .panel:nth-child(4) {
    grid-column: span 7;
}
/* Vertical hairline between side-by-side charts. */
.chart-grid > .panel:nth-child(2),
.chart-grid > .panel:nth-child(4) {
    border-left: 1px solid var(--border);
    padding-left: var(--s6);
}
.chart-grid > .panel:nth-child(1),
.chart-grid > .panel:nth-child(2) {
    border-top: 1px solid var(--border);
}

/* ========================= Key stream ========================= */
.key-stream {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
}
.key-cap {
    min-width: 44px;
    padding: var(--s3) var(--s3) var(--s2);
    text-align: center;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.86rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border-strong);
    border-radius: var(--r-data);
    color: var(--text);
    animation: pop 0.22s var(--ease);
}
.key-cap.is-wheel {
    color: var(--accent-2);
    border-bottom-color: var(--accent-2);
}
.key-cap small {
    display: block;
    margin-top: 3px;
    font-size: 0.58rem;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 400;
    text-transform: uppercase;
}
@keyframes pop {
    from {
        transform: translateY(-5px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}
.empty-note {
    color: var(--text-faint);
    font-family: var(--font);
    font-size: 0.8rem;
}

/* ========================= Advanced: toolbar ========================= */
/* Stats as a hairline-divided strip. */
.toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s5);
    flex-wrap: wrap;
    padding-bottom: var(--s5);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.stat-strip {
    display: flex;
}
.stat-block {
    padding: 0 var(--s5);
    border-left: 1px solid var(--hair);
}
.stat-block:first-child {
    padding-left: 0;
    border-left: 0;
}
.stat-num {
    font-family: var(--font);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.stat-cap {
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-family: var(--font);
    margin-top: 4px;
}

.toolbar-actions {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
}
.btn {
    font-family: var(--font);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    padding: 9px 14px;
    border-radius: var(--r-data);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.18s var(--ease);
}
.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface);
}
.btn-danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ========================= Log table ========================= */
.panel-head--row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s4);
    flex-wrap: wrap;
}
.log-filters {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
}
.field {
    font-family: var(--font);
    font-size: 0.78rem;
    padding: 8px 11px;
    border-radius: var(--r-data);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    min-width: 150px;
}
.field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.log-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font);
    font-size: 0.78rem;
    min-width: 780px;
}
.log-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg);
    text-align: left;
    padding: var(--s2) var(--s3);
    font-weight: 500;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
}
.log-table td {
    padding: 9px var(--s3);
    border-bottom: 1px solid var(--hair);
    color: var(--text-dim);
}
.log-table td:nth-child(4) {
    color: var(--text);
} /* key stands out */
/* Right-align numeric columns; center modifier flags. */
.log-table th:nth-child(1),
.log-table td:nth-child(1),
.log-table th:nth-child(11),
.log-table td:nth-child(11) {
    text-align: right;
    color: var(--text-faint);
}
.log-table th:nth-child(n + 7):nth-child(-n + 10),
.log-table td:nth-child(n + 7):nth-child(-n + 10) {
    text-align: center;
}
.log-table tbody tr:hover:not(.empty-row) {
    background: var(--surface);
}
.log-table tr.is-wheel td:nth-child(4) {
    color: var(--accent-2);
}
.mod-on {
    color: var(--accent);
}
.mod-off {
    color: var(--text-faint);
    opacity: 0.5;
}
.src-tag {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.src-tag.touch {
    color: var(--accent-2);
}
.empty-row td {
    text-align: center;
    color: var(--text-faint);
    padding: var(--s6);
}

/* ========================= Key heatmap ========================= */
.heatmap {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}
.heat-row {
    display: flex;
    gap: var(--s1);
}
.heat-key {
    flex: 1 1 0;
    min-width: 26px;
    min-height: 36px;
    display: grid;
    place-items: center;
    border-radius: var(--r-data);
    border: 1px solid var(--border);
    /* intensity 0..1 drives the accent fill via a per-key custom property */
    --i: 0;
    background:
        linear-gradient(
            0deg,
            color-mix(in srgb, var(--accent) calc(var(--i) * 100%), transparent),
            color-mix(in srgb, var(--accent) calc(var(--i) * 100%), transparent)
        ),
        var(--surface-2);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.68rem;
    font-weight: 600;
    transition: background 0.3s var(--ease);
    position: relative;
}
.heat-key.hot {
    color: #06231a;
} /* dark text once the fill is bright */
.heat-key.wide {
    flex: 2.2 1 0;
}
.heat-key.space {
    flex: 6 1 0;
}
.heat-count {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.54rem;
    opacity: 0.7;
}
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--s2);
    margin-top: var(--s3);
    font-family: var(--font);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.heatmap-ramp {
    flex: 0 0 140px;
    height: 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: linear-gradient(90deg, var(--surface-2), var(--accent));
}
.heat-extra {
    margin-top: var(--s4);
    padding-top: var(--s3);
    border-top: 1px solid var(--border);
}
.heat-extra-title {
    margin: 0 0 var(--s2);
    font-family: var(--font);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.heat-extra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: var(--s1);
}
.heat-key.heat-key--extra {
    min-height: 34px;
    padding: 0 4px;
    font-size: 0.62rem;
    line-height: 1.1;
}
.heat-key.heat-key--extra > span:first-child {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================= Touch bench ========================= */
/* Touch bench panel. */
.bench {
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    overflow: hidden;
    margin-top: var(--s5);
    background: var(--surface);
}
.bench-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s4) var(--s5);
    cursor: pointer;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.bench.collapsed .bench-toggle {
    border-bottom-color: transparent;
}
.bench-caret {
    transition: transform 0.3s var(--ease);
    color: var(--text-dim);
}
.bench.collapsed .bench-caret {
    transform: rotate(-90deg);
}
.bench-body {
    padding: var(--s5);
}
.bench.collapsed .bench-body {
    display: none;
}
.bench-hint {
    font-size: 0.76rem;
    color: var(--text-dim);
    margin-bottom: var(--s4);
    font-family: var(--font);
    max-width: 60ch;
}
.bench-layout {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s6);
    align-items: center;
}

.vkeyboard {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}
.vkey-row {
    display: flex;
    gap: var(--s1);
    justify-content: stretch;
}
.vkey {
    flex: 1 1 0;
    min-width: 30px;
    min-height: 42px;
    border-radius: var(--r-data);
    border: 1px solid var(--border);
    border-bottom: 2px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition:
        transform 0.06s,
        background 0.12s,
        border-color 0.12s,
        color 0.12s;
    touch-action: manipulation;
}
.vkey.wide {
    flex: 2.2 1 0;
}
.vkey.space {
    flex: 6 1 0;
}
.vkey:active,
.vkey.pressed {
    transform: translateY(2px);
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.wheel-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s3);
}
.wheel {
    width: 116px;
    height: 116px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 50% 36%,
        var(--surface-3),
        var(--surface-2) 58%,
        var(--surface) 100%
    );
    border: 1px solid var(--border-strong);
    position: relative;
    cursor: grab;
    box-shadow:
        inset 0 1px 0 var(--hair),
        inset 0 -8px 20px rgba(0, 0, 0, 0.25);
    touch-action: none;
}
/* Tick marks around the dial. */
.wheel::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: repeating-conic-gradient(var(--border-strong) 0 1deg, transparent 1deg 15deg);
    -webkit-mask: radial-gradient(circle, transparent 46px, #000 46px, #000 52px, transparent 52px);
    mask: radial-gradient(circle, transparent 46px, #000 46px, #000 52px, transparent 52px);
    opacity: 0.6;
}
.wheel:active {
    cursor: grabbing;
}
.wheel-indicator {
    position: absolute;
    top: 12px;
    left: 50%;
    width: 3px;
    height: 22px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
    transform-origin: 50% 46px;
    transform: translateX(-50%) rotate(0deg);
    z-index: 2;
}
.wheel-caption {
    font-family: var(--font);
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ========================= About / SEO content ========================= */
.about {
    margin-top: var(--s7);
    padding-top: var(--s6);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.6;
}
.about-title {
    font-size: 1.1rem;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: var(--s4);
}
.about-title + .faq,
.about-lead + .about-grid {
    margin-top: var(--s5);
}
.about-lead {
    max-width: 72ch;
    margin-bottom: var(--s6);
}
.about strong {
    color: var(--text);
    font-weight: 600;
}
.about code {
    font-family: var(--font);
    font-size: 0.86em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-data);
    padding: 1px 5px;
    color: var(--accent);
}
.about a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}
.about a:hover {
    border-bottom-color: var(--accent);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s6);
    margin-bottom: var(--s7);
}
.about-col h3 {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: var(--s3);
    font-weight: 600;
    position: relative;
    padding-left: var(--s3);
}
.about-col h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0.9em;
    background: var(--accent);
    border-radius: 1px;
}
.about-col ul,
.about-col ol {
    padding-left: var(--s4);
}
.about-col li {
    margin-bottom: var(--s2);
}

/* FAQ: native <details> elements (indexable text). */
.faq {
    border-top: 1px solid var(--border);
    max-width: 80ch;
}
.faq details {
    border-bottom: 1px solid var(--hair);
}
.faq summary {
    cursor: pointer;
    padding: var(--s4) 0;
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--s3);
}
.faq summary::-webkit-details-marker {
    display: none;
}
.faq summary::before {
    content: '+';
    color: var(--accent);
    font-family: var(--font);
    font-size: 1.1rem;
    width: 1ch;
    transition: transform 0.2s var(--ease);
}
.faq details[open] summary::before {
    content: '−';
}
.faq details p {
    padding: 0 0 var(--s4) calc(1ch + var(--s3));
    max-width: 72ch;
}

/* ========================= Footer ========================= */
/* Footer. */
.footer {
    margin-top: var(--s7);
    padding-top: var(--s4);
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-family: var(--font);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s4);
    justify-content: space-between;
}
.footer-nav {
    display: flex;
    gap: var(--s4);
}
.footer-nav a {
    color: var(--text-dim);
    text-decoration: none;
}
.footer-nav a:hover {
    color: var(--accent);
}
.footer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s3);
}
.footer-sep {
    opacity: 0.4;
}

/* ========================= Responsive ========================= */
@media (max-width: 860px) {
    .app {
        padding: var(--s5) var(--s5) 120px;
    }
    .chart-grid {
        grid-template-columns: 1fr;
        column-gap: 0;
    }
    .chart-grid > .panel {
        grid-column: auto !important;
        border-left: 0 !important;
        padding-left: 0 !important;
    }
    .chart-grid > .panel:nth-child(n) {
        border-top: 1px solid var(--border);
    }
    .readout {
        grid-template-columns: 1fr;
    }
    .readout-main {
        padding-right: 0;
        padding-bottom: var(--s5);
        border-bottom: 1px solid var(--border);
        margin-bottom: var(--s5);
    }
    .readout-side {
        border-left: 0;
        padding-left: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--s5);
    }
    .mini-stat {
        flex: 1 1 28%;
        flex-direction: column;
        align-items: flex-start;
        border-bottom: 0;
        padding: 0;
    }
    .bench-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .vkeyboard {
        width: 100%;
    }
    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--s5);
    }
    .footer {
        gap: var(--s3);
    }
}

@media (max-width: 560px) {
    .app {
        padding: var(--s4) var(--s4) 110px;
    }
    .brand-name {
        font-size: 1.04rem;
    }
    .status-pill {
        display: none;
    }
    .mode-tab-sub {
        display: none;
    }
    .mode-switch {
        gap: var(--s5);
    }
    .readout {
        padding: var(--s6) var(--s4) var(--s5);
    }
    .readout-key {
        font-size: clamp(2.2rem, 15vw, 3.2rem);
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .stat-strip {
        justify-content: space-between;
    }
    .stat-block {
        padding: 0 var(--s3);
    }
    .stat-block:first-child {
        padding-left: 0;
    }
    .toolbar-actions .btn {
        flex: 1;
    }
    .vkey {
        min-width: 20px;
        min-height: 38px;
        font-size: 0.7rem;
        padding: 0 1px;
    }
    .wheel {
        width: 100px;
        height: 100px;
    }
    .wheel-indicator {
        transform-origin: 50% 38px;
    }
}

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