@font-face
{
    font-family: Chakra;
    src: url("./fonts/chakra-petch-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face
{
    font-family: Chakra;
    src: url("./fonts/chakra-petch-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face
{
    font-family: Chakra;
    src: url("./fonts/chakra-petch-latin-700-normal.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face
{
    font-family: Plex;
    src: url("./fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face
{
    font-family: Plex;
    src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face
{
    font-family: Plex;
    src: url("./fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
:root
{
    color-scheme: dark;
    --ink: #080b18;
    --panel: #111a33;
    --cyan: #37e6f5;
    --coral: #ff536b;
    --gold: #ffc857;
    --white: #f4f7ff;
    --gray: #a8b3cf;
    --grid: #2a3858;
    font-family: Chakra, sans-serif;
    color: var(--white);
    background: var(--ink);
    font-synthesis: none;
    scroll-behavior: smooth;
}
*
{
    box-sizing: border-box;
}
body
{
    margin: 0;
}
button, input, textarea
{
    font: inherit;
}
button, a, #passage
{
    -webkit-tap-highlight-color: transparent;
}
button, a
{
    touch-action: manipulation;
}
button
{
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--grid);
    border-radius: 6px;
    color: var(--white);
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: border-color 160ms, background 160ms;
}
button:hover:not(:disabled)
{
    border-color: var(--cyan);
    background: #19304a;
}
button:disabled
{
    opacity: .4;
    cursor: not-allowed;
}
:focus-visible
{
    outline: 2px solid var(--cyan);
    outline-offset: 4px;
}
a
{
    color: inherit;
    text-decoration: none;
}
a:hover
{
    color: var(--cyan);
}
[hidden]
{
    display: none !important;
}
svg.icon
{
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}
.header
{
    height: 64px;
    border-bottom: 1px solid var(--grid);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    max-width: 1504px;
    margin: auto;
}
.brand
{
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: 1px;
}
.brand small
{
    display: block;
    color: var(--gray);
    font-size: 10px;
    letter-spacing: .5px;
    font-weight: 500;
    margin-top: 5px;
}
.brand-mark
{
    width: 30px;
    height: 26px;
    transform: skew(-14deg);
    background: conic-gradient(var(--white) 25%, transparent 0 50%, var(--cyan) 0 75%, transparent 0) 0 0 / 14px 14px;
    border-bottom: 3px solid var(--cyan);
}
nav
{
    display: flex;
    gap: 32px;
    align-items: center;
    margin-left: auto;
    font-size: 13px;
}
nav a
{
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-race
{
    color: var(--cyan);
}
.local-status
{
    border-left: 1px solid var(--grid);
    padding-left: 24px;
    font: 10px Plex, monospace;
    letter-spacing: 1px;
}
.local-status small
{
    display: block;
    color: var(--gray);
    font-size: 9px;
    letter-spacing: 0;
    margin-top: 5px;
}
.local-status i, .live-dot
{
    display: inline-block;
    width: 5px;
    height: 5px;
    background: var(--cyan);
    border-radius: 100%;
    vertical-align: middle;
    margin-right: 7px;
}
main
{
    max-width: 1504px;
    padding: 0 32px;
    margin: auto;
}
section
{
    scroll-margin-top: 24px;
}
.intro
{
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 40px 0 32px;
    gap: 24px;
}
.eyebrow
{
    margin: 0 0 12px;
    font: 10px Plex, monospace;
    letter-spacing: 2px;
    color: var(--gray);
}
h1
{
    margin: 0;
    font-size: clamp(40px, 4.8vw, 72px);
    line-height: 1.05;
    letter-spacing: -2px;
    font-weight: 700;
}
h1 em
{
    color: var(--coral);
    font-style: normal;
}
.intro-note
{
    color: var(--gray);
    font-size: 13px;
    line-height: 1.8;
    margin: 0 0 3px;
}
.intro-note span
{
    color: var(--white);
    display: block;
}
.race-toolbar
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
}
#difficulties
{
    display: flex;
    border: 1px solid var(--grid);
    border-radius: 6px;
    padding: 4px;
    gap: 4px;
    background: #0c1225;
}
#difficulties button
{
    border-color: transparent;
    color: var(--gray);
    padding: 8px 18px;
}
#difficulties small
{
    font: 10px Plex, monospace;
}
#difficulties button[aria-pressed="true"]
{
    background: var(--cyan);
    color: var(--ink);
}
.quiet
{
    border-color: transparent;
    color: var(--gray);
}
.cockpit
{
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 24px;
}
.clipped
{
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    background: var(--panel);
}
.track-panel
{
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 480px;
    position: relative;
    background: #0d152b;
    border: 1px solid var(--grid);
}
.panel-top
{
    display: flex;
    justify-content: space-between;
    font: 9px Plex, monospace;
    letter-spacing: 1px;
    padding: 24px 24px 0;
    color: var(--gray);
}
.panel-top > span:first-child
{
    color: var(--white);
}
.canvas-wrap
{
    position: relative;
    flex: 1;
    min-height: 300px;
}
#track
{
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
#countdown
{
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    font: 700 88px Chakra, sans-serif;
    color: var(--coral);
    text-shadow: 0 4px 24px #080b18;
}
#countdown:not(:empty)
{
    background: #080b1866;
}
.count-tick
{
    animation: countdown 160ms ease-out;
}
@keyframes countdown
{
    from { opacity: .3; transform: scale(1.12); }
    to { opacity: 1; transform: scale(1); }
}
.position
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--grid);
}
#position
{
    font-size: 18px;
    font-weight: 600;
}
#percent
{
    font: 18px Plex, monospace;
    color: var(--cyan);
}
#percent small
{
    font-size: 8px;
    color: var(--gray);
}
.track-bottom
{
    padding: 0 24px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font: 8px Plex, monospace;
    letter-spacing: .4px;
    color: var(--gray);
}
.cyan-line, .gold-line
{
    width: 12px;
    height: 3px;
    background: var(--cyan);
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}
.gold-line
{
    background: var(--gold);
}
.target-tag
{
    margin-left: auto;
    font-size: 7px;
}
.console-panel
{
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--grid);
}
.stats
{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 0 24px;
    gap: 16px;
}
.stats > div
{
    border-right: 1px solid var(--grid);
    min-width: 0;
}
.stats > div:last-child
{
    border: 0;
}
.stats span
{
    font: 10px Plex, monospace;
    color: var(--gray);
    letter-spacing: 1px;
}
.stats strong
{
    display: block;
    font: 500 clamp(25px, 3vw, 42px) Plex, monospace;
    letter-spacing: -2px;
    margin: 8px 0 5px;
}
.stats strong span
{
    color: var(--white);
    font-size: 17px;
    letter-spacing: -1px;
}
#wpm
{
    color: var(--cyan);
}
.stats small
{
    color: var(--gray);
    font: 8px Plex, monospace;
    letter-spacing: .5px;
}
.passage-heading
{
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font: 9px Plex, monospace;
    letter-spacing: .5px;
    border-top: 1px solid var(--grid);
    padding: 20px 0 16px;
}
#passage
{
    font: 400 27px/1.7 Plex, monospace;
    color: var(--gray);
    overflow-y: auto;
    height: 230px;
    min-height: 230px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    scrollbar-width: thin;
    scrollbar-color: var(--grid) transparent;
    cursor: text;
    padding: 0 4px 16px 0;
}
#passage .correct
{
    color: var(--cyan);
}
#passage .caret
{
    color: var(--white);
    border-bottom: 3px solid var(--cyan);
    animation: caret 800ms steps(2) infinite;
}
#passage .wrong
{
    color: var(--white);
    background: #a82d43;
    border-bottom: 3px solid var(--coral);
    animation: nudge 120ms linear;
    display: inline-block;
}
@keyframes caret
{
    50% { border-bottom-color: transparent; }
}
@keyframes nudge
{
    50% { transform: translateX(2px); }
}
.native-input
{
    position: fixed;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: .01;
    font-size: 16px;
}
.race-status
{
    font: 10px/1.5 Plex, monospace;
    color: var(--gray);
    padding: 18px 0 16px;
    min-height: 49px;
}
.race-status.error
{
    color: var(--coral);
}
.controls
{
    display: flex;
    gap: 12px;
    margin-top: auto;
}
.primary
{
    background: var(--cyan);
    border-color: var(--cyan);
    color: var(--ink);
    font-weight: 700;
    min-width: 136px;
}
.primary:hover:not(:disabled)
{
    background: #9af6ff;
    color: var(--ink);
}
.secondary
{
    color: var(--gray);
    background: #0d152a;
}
.tap
{
    display: none;
}
.honesty
{
    color: var(--gray);
    font: 9px/1.7 Plex, monospace;
    display: flex;
    gap: 8px;
    margin: 20px 0 0;
}
.honesty > span:first-child
{
    color: var(--cyan);
}
.keyboard-note
{
    margin-left: auto;
    font-size: 8px;
    letter-spacing: 1px;
}
.lower
{
    padding-top: 64px;
}
.section-heading
{
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 32px;
}
h2
{
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -1px;
    margin: 0;
    line-height: 1.25;
}
h2 span
{
    color: var(--cyan);
}
.section-heading p:not(.eyebrow), .briefing-label
{
    font: 10px/1.7 Plex, monospace;
    color: var(--gray);
    max-width: 340px;
    margin: 0;
}
.record-grid
{
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 24px;
}
.subheading
{
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font: 10px Plex, monospace;
    padding-bottom: 20px;
}
.subheading span
{
    font-size: 8px;
    color: var(--gray);
}
.table-wrap
{
    overflow-x: auto;
}
table
{
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font: 11px Plex, monospace;
}
td, th
{
    padding: 16px 8px;
    border-top: 1px solid var(--grid);
}
th
{
    font-size: 9px;
    color: var(--gray);
    font-weight: 400;
}
td:first-child
{
    color: var(--white);
}
td:not(:first-child)
{
    color: var(--gold);
}
.empty, #recent
{
    font: 10px/1.9 Plex, monospace;
    color: var(--gray);
}
.empty
{
    margin: 12px 8px;
}
#recent
{
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    max-height: 340px;
    overflow-y: auto;
}
#recent li
{
    border-top: 1px solid var(--grid);
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
#recent strong
{
    color: var(--white);
    font-weight: 500;
}
#recent small
{
    color: var(--gold);
}
.danger
{
    color: var(--coral);
    border-color: #813345;
    font-size: 12px;
}
.steps
{
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}
.steps article
{
    display: flex;
    gap: 16px;
    padding: 0 16px 8px 0;
    border-right: 1px solid var(--grid);
}
.steps article:last-child
{
    border-right: 0;
}
.steps b
{
    color: var(--coral);
    font: 500 32px Chakra, sans-serif;
    line-height: 1;
}
.steps h3
{
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}
.steps p
{
    margin: 0;
    font-size: 12px;
    color: var(--gray);
    line-height: 1.8;
}
.scoring
{
    display: flex;
    gap: 32px;
    padding: 24px;
    margin-top: 32px;
    border: 1px solid var(--grid);
    font: 10px/1.9 Plex, monospace;
    color: var(--gray);
}
.scoring > span
{
    color: var(--cyan);
    white-space: nowrap;
}
.scoring p
{
    margin: 0;
}
.scoring strong
{
    color: var(--white);
    font-weight: 400;
}
footer
{
    max-width: 1440px;
    margin: 64px auto 0;
    padding: 28px 32px;
    border-top: 1px solid var(--grid);
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font: 9px/1.8 Plex, monospace;
    gap: 24px;
}
footer > div
{
    display: flex;
    gap: 16px;
}
footer strong
{
    color: var(--white);
    font: 600 12px/1.8 Chakra, sans-serif;
    letter-spacing: 1px;
}
footer a
{
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.results
{
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    padding: 32px;
    margin-top: 32px;
    gap: 32px;
    animation: reveal 220ms ease-out;
}
@keyframes reveal
{
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.result-summary > p:not(.eyebrow)
{
    font: 11px/1.9 Plex, monospace;
    color: var(--gray);
}
.result-summary > p.gold, .gold
{
    color: var(--gold);
}
.result-actions
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 24px;
}
.result-actions button
{
    font-size: 11px;
    padding: 10px 8px;
    min-width: 0;
}
#share-card
{
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    align-self: center;
    border: 1px solid var(--grid);
}
.feedback
{
    min-height: 20px;
}
#copy-fallback
{
    width: 100%;
    min-height: 100px;
    background: var(--ink);
    color: var(--white);
    border: 1px solid var(--cyan);
    padding: 12px;
    font: 11px/1.7 Plex, monospace;
}
.new-record
{
    animation: record 400ms ease-out;
}
@keyframes record
{
    from { background: #ffc85733; }
    to { background: transparent; }
}
@media (min-width: 1400px)
{
    .track-panel { min-height: 530px; }
    #passage { height: 280px; min-height: 280px; }
}
@media (max-width: 1000px)
{
    .local-status { display: none; }
    .intro-note { font-size: 11px; }
    .target-tag, .keyboard-note { display: none; }
    #difficulties button { padding: 8px 12px; }
    .console-panel { padding: 20px; }
    .stats { gap: 10px; }
    .steps { gap: 16px; }
    footer, footer > div { flex-wrap: wrap; }
}
@media (max-width: 760px)
{
    #race { position: relative; }
    .header { height: 56px; padding: 0 16px; gap: 12px; }
    .brand { font-size: 13px; gap: 8px; letter-spacing: .5px; }
    .brand-mark { width: 24px; height: 22px; background-size: 11px 11px; }
    .brand small { font-size: 8px; }
    nav { font-size: 11px; }
    .nav-race, .nav-records { display: none; }
    main { padding: 0 16px; }
    .intro { padding: 20px 0 16px; display: block; }
    .eyebrow { font-size: 8px; letter-spacing: 1.6px; margin-bottom: 12px; }
    h1 { font-size: 36px; letter-spacing: -1.5px; }
    .intro-note { font-size: 11px; margin-top: 12px; line-height: 1.65; }
    .intro-note span { display: none; }
    .race-toolbar { flex-wrap: wrap; gap: 8px; padding-bottom: 12px; }
    #difficulties { width: 100%; padding: 3px; gap: 3px; }
    #difficulties button { flex: 1; flex-direction: column; font-size: 13px; gap: 3px; padding: 6px 2px; min-height: 48px; }
    #difficulties small { font-size: 8px; }
    #next { position: absolute; top: 3px; right: 0; min-height: 44px; font-size: 10px; padding: 4px 0 4px 12px; }
    .cockpit { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .track-panel { min-height: 0; }
    .panel-top { padding: 16px 16px 0; font-size: 8px; letter-spacing: .2px; }
    .canvas-wrap { height: 168px; min-height: 168px; flex: none; }
    .position { padding: 12px 16px; }
    #position { font-size: 15px; }
    #percent { font-size: 15px; }
    #percent small { font-size: 7px; }
    .track-bottom { display: none; }
    .console-panel { padding: 16px; }
    .stats { padding-bottom: 16px; gap: 12px; }
    .stats span { font-size: 8px; }
    .stats strong { font-size: 25px; letter-spacing: -1.5px; margin: 6px 0 3px; }
    .stats strong span { font-size: 12px; }
    .stats small { display: none; }
    .passage-heading { padding: 16px 0 12px; font-size: 8px; }
    #passage { font-size: 19px; line-height: 1.65; height: 96px; min-height: 96px; }
    .race-status { padding: 14px 0; font-size: 8px; min-height: 40px; }
    .controls { flex-wrap: wrap; gap: 8px; }
    .controls > button { flex: 1; font-size: 12px; padding: 10px; min-width: 0; }
    .controls .tap { display: flex; flex-basis: 100%; border-color: var(--grid); }
    .honesty { font-size: 8px; margin-top: 12px; }
    .lower { padding-top: 40px; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 24px; }
    h2 { font-size: 28px; }
    .section-heading p:not(.eyebrow) { font-size: 9px; }
    .record-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
    table { font-size: 10px; }
    td, th { padding: 16px 4px; }
    th { font-size: 8px; }
    .steps { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .steps article { border-right: 0; border-bottom: 1px solid var(--grid); padding-bottom: 24px; gap: 24px; }
    .steps b { font-size: 36px; }
    .steps h3 { font-size: 18px; }
    .scoring { flex-direction: column; padding: 16px; gap: 12px; font-size: 9px; }
    footer { flex-direction: column; margin-top: 40px; padding: 24px 16px; gap: 12px; font-size: 8px; }
    footer > div { flex-direction: column; gap: 8px; }
    .results { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
    .result-actions { margin-top: 16px; }
    .result-actions button { min-height: 44px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce)
{
    *, *::before, *::after
    {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
