:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202329; background: #f7f8fa; font-synthesis: none; line-height: 1.55;
  --border: #dfe2e7; --muted: #626974; --orange: #b84608; --orange-soft: #fff5ed; --focus: #155eef;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled, input:disabled { cursor: wait; }
svg { flex-shrink: 0; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Native controls and visible focus preserve keyboard operation (WCAG 2.1.1, 2.4.7). */
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, canvas:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button:active:not(:focus-visible) { transform: scale(.98); }
[hidden] { display: none !important; }
.skip { position: absolute; left: 20px; top: -80px; z-index: 10; background: #fff; padding: 12px 18px; border: 2px solid var(--focus); border-radius: 6px; }
.skip:focus { top: 10px; }
.header { min-height: 68px; padding: 10px max(24px, calc((100vw - 1360px) / 2)); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.header-brand, .header-actions { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 750; letter-spacing: -.6px; text-decoration: none; }
.brand > span { width: 34px; height: 34px; position: relative; display: grid; place-content: center; border: 1px solid #f0cfb8; border-radius: 7px; color: var(--orange); background: var(--orange-soft); font-size: 22px; }
.brand-arrow { position: absolute; left: 17px; top: -4px; font-size: 31px; }
.brand-divider { width: 1px; height: 23px; background: var(--border); }
.product-name { color: var(--muted); font-size: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-size: 12px; font-weight: 550; text-decoration: none; }
.back-link svg { width: 17px; height: 17px; }
.header nav { display: flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 6px; }
.header nav a { display: grid; place-items: center; min-width: 38px; min-height: 34px; padding: 5px 9px; border-radius: 3px; color: var(--muted); font-size: 12px; font-weight: 650; text-decoration: none; }
.header nav a[aria-current] { color: #9b3904; background: var(--orange-soft); }
main { max-width: 1408px; margin: auto; padding: 30px 24px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.intro > div { min-width: 0; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 10px; font-weight: 750; letter-spacing: 1.6px; }
h1 { margin: 0 0 9px; font-size: clamp(27px, 3vw, 36px); font-weight: 650; line-height: 1.18; letter-spacing: -1.2px; text-wrap: balance; }
.lead { max-width: 720px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.desktop-badge { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; padding-bottom: 3px; color: var(--muted); font-size: 11px; }
.desktop-badge svg { width: 18px; height: 18px; }
.layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 20px; align-items: start; }
.workspace { display: grid; gap: 16px; min-width: 0; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.section-title { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 14px; }
.step { display: grid; place-items: center; min-width: 25px; height: 25px; padding: 3px 5px; border: 1px solid #efcfb8; border-radius: 5px; background: var(--orange-soft); color: var(--orange); font-size: 10px; font-weight: 750; }
h2 { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.4; letter-spacing: -.3px; text-wrap: balance; }
h3 { margin: 0 0 7px; font-size: 14px; font-weight: 650; }
p { margin: 0 0 15px; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.75; }
.small { font-size: 12px; }
.installation-picker { padding: 18px 14px 15px; margin-top: 18px; border: 1px dashed #c8cdd5; border-radius: 7px; background: #fafbfc; }
.folder-icon { display: block; width: 31px; height: 31px; margin-bottom: 12px; color: var(--orange); }
.installation-name { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.installation-picker .muted { margin-bottom: 14px; font-size: 11px; }
input[type=file] { display: block; width: 100%; max-width: 100%; min-height: 44px; color: var(--muted); font-size: 11px; }
input::file-selector-button { min-height: 40px; padding: 10px 12px; margin-right: 8px; border: 1px solid #c7cdd6; border-radius: 5px; background: #fff; color: #292e35; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
/* Keep native file selection and its Tab/Enter behavior; expose its focus on the
   localized visible label instead of the browser's untranslated button (2.1.1/2.4.7). */
.installation-control { position: relative; clear: both; }
.installation-control input[type=file] { position: absolute; width: 1px; height: 1px; min-height: 0; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.installation-control label { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 12px; border: 1px solid #c7cdd6; border-radius: 5px; background: #fff; color: #292e35; font-size: 12px; font-weight: 650; cursor: pointer; }
.installation-control input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 4px; }
.installation-control input:disabled + label { cursor: wait; color: var(--muted); background: #f2f4f7; }
.file-summary { margin: 9px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.disclosure { margin-top: 14px; border-top: 1px solid var(--border); font-size: 12px; }
.disclosure summary { min-height: 44px; padding: 13px 2px; color: #49515d; font-size: 11px; font-weight: 600; cursor: pointer; }
.disclosure summary::marker { color: #737c89; }
.disclosure-content { padding: 1px 2px 14px; }
.manual-folders { margin-top: 10px; border-top: 0; }
.manual-folders .disclosure-content { padding-bottom: 0; }
.folder { padding: 12px; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 6px; }
.folder label { display: flex; align-items: center; gap: 6px 9px; flex-wrap: wrap; margin-bottom: 10px; }
.folder label strong { font: 650 13px ui-monospace, SFMono-Regular, Consolas, monospace; }
.folder label span { color: var(--muted); font-size: 11px; }
.rules { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.import-summary { display: flex; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding-top: 16px; margin: 4px 0 9px; border-top: 1px solid var(--border); font-size: 11px; }
.import-summary strong { font-weight: 600; font-variant-numeric: tabular-nums; }
#missing { margin: 0 0 6px; font-size: 11px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { min-height: 42px; padding: 10px 14px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; line-height: 1.45; font-weight: 650; }
.primary { background: var(--orange); color: #fff; }
.secondary { background: #fff; border-color: #c7cdd6 !important; color: #333942; }
.quiet { padding-inline: 0 !important; background: transparent; color: #626974; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: #b42318; border-color: #edb4ae !important; }
.privacy { display: flex; align-items: flex-start; gap: 8px; padding-top: 15px; margin: 7px 0 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; line-height: 1.65; }
.privacy svg { width: 16px; height: 16px; margin-top: 2px; }
.server-card { padding: 18px 20px 14px; }
.server-heading { display: flex; align-items: center; gap: 12px; }
.server-mark { display: grid; place-items: center; width: 43px; height: 43px; flex-shrink: 0; border: 1px solid #ebd4bf; border-radius: 6px; background: #fff8f1; color: #aa602e; }
.server-mark svg { width: 29px; height: 29px; }
.overline { margin: 0 0 2px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: 1px; }
.server-state { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); background: #fafbfc; font-size: 10px; font-weight: 600; }
.server-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.server-state[data-state=ready] { background: #f0f9f3; border-color: #cbe5d3; color: #25633b; }
.server-state[data-state=unavailable], .server-state[data-state=stale], .server-state[data-state=full] { color: #86521b; background: #fff8ed; border-color: #ead8bd; }
.server-details { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.server-stats { display: flex; gap: 32px; margin: 0; }
.server-stats dt { color: var(--muted); font-size: 10px; }
.server-stats dd { margin: 3px 0 0; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.server-actions { margin-left: auto; }
.server-actions .primary { min-width: 175px; }
.server-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.runtime { padding: 18px 20px; }
.runtime-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.runtime-toolbar .section-title { margin: 0; }
.runtime-toolbar .actions { margin-left: auto; }
.viewport { position: relative; display: grid; place-items: center; aspect-ratio: 16/9; overflow: hidden; margin: 16px 0 0; border: 1px solid #e1e4e8; border-radius: 6px; background-color: #f7f8fa; background-image: linear-gradient(#e9ecf0 1px, transparent 1px), linear-gradient(90deg, #e9ecf0 1px, transparent 1px); background-size: 40px 40px; }
#empty { max-width: 360px; padding: 22px; text-align: center; }
.empty-emblem { display: flex; align-items: baseline; justify-content: center; gap: 5px; margin-bottom: 18px; color: #78818d; font-size: clamp(32px, 3vw, 48px); line-height: 1; font-weight: 750; letter-spacing: -2.8px; }
.empty-emblem strong { color: #b84608; font-weight: 750; }
.empty-emblem svg { width: 30px; height: 30px; align-self: center; margin-left: 9px; color: #b5bbc4; stroke-width: 1; }
#empty h3 { margin-bottom: 6px; font-size: 14px; }
#empty p { margin: 0; color: var(--muted); font-size: 12px; }
.key-hint { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 22px; }
.key-hint > span { display: flex; gap: 3px; }
kbd { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #d5d9df; border-bottom-width: 2px; border-radius: 4px; background: #fff; color: #78818d; font-family: inherit; font-size: 9px; }
.viewport-corner { position: absolute; width: 15px; height: 15px; pointer-events: none; color: #c4cbd3; }
.corner-top { top: 13px; left: 13px; border-top: 1px solid; border-left: 1px solid; }
.corner-bottom { right: 13px; bottom: 13px; border-right: 1px solid; border-bottom: 1px solid; }
canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: #111; object-fit: contain; }
:root .engine-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #111; }
.viewport:fullscreen { width: 100%; max-width: none; height: 100%; margin: 0; border: 0; border-radius: 0; aspect-ratio: auto; background: #111; }
.play-hint { display: none; margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.practice-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.practice-label { font-size: 12px; font-weight: 600; }
.practice-row p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.practice-row .actions { flex-shrink: 0; }
.status-box { margin: 16px 0 0; padding-left: 11px; border-left: 2px solid #c0c7d0; }
.status-label { font-size: 12px; font-weight: 650; }
.status-box p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.status-box[data-state=ready] { border-color: var(--orange); }
.status-box[data-state=error] { border-color: #b42318; }
.error { padding: 12px; margin: 16px 0 0; border: 1px solid #f0bbb4; border-radius: 6px; color: #912018; background: #fff5f3; font-size: 12px; overflow-wrap: anywhere; }
.diagnostics { margin-top: 16px; }
.diagnostics summary { color: #626974; }
.diagnostics .actions { margin-top: 10px; }
.diagnostics .muted { max-width: 560px; margin-bottom: 0; }
.proof dl { margin: 0; }
.proof dl > div + div { margin-top: 10px; }
.proof dt { color: var(--muted); }
.proof dd { margin: 2px 0 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.help { margin-top: 30px; padding: 24px 0 0; border-top: 1px solid var(--border); }
.help h2 { font-size: 13px; }
.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px; margin-top: 18px; }
.help-grid > div { position: relative; padding-left: 30px; }
.help-number { position: absolute; top: 2px; left: 0; color: #626974; font-size: 10px; font-variant-numeric: tabular-nums; }
.help h3 { margin-bottom: 5px; font-size: 12px; }
.help p { max-width: 370px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
footer { max-width: 1408px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 24px 24px; margin: auto; color: var(--muted); font-size: 10px; }
footer > span { color: #3b424d; font-size: 12px; font-weight: 650; }
footer > span > span { margin-left: 4px; color: var(--muted); font-weight: 400; }
footer p { margin: 0; }
footer a { display: inline-flex; align-items: center; min-height: 32px; text-underline-offset: 3px; }
/* Running sessions put the game first. Stop restores the lobby; visible controls
   and Escape instructions preserve a clear way out (WCAG 2.1.2 / 4.1.3). */
body[data-playing=true] .header { min-height: 58px; padding-top: 6px; padding-bottom: 6px; }
body[data-playing=true] main { max-width: 1760px; padding: 12px 20px 20px; }
body[data-playing=true] .intro { margin: 0 0 12px; }
body[data-playing=true] .intro h1 { margin: 0; font-size: 19px; line-height: 1.4; letter-spacing: -.4px; }
body[data-playing=true] .intro .eyebrow,
body[data-playing=true] .intro .lead,
body[data-playing=true] .intro .desktop-badge,
body[data-playing=true] .setup,
body[data-playing=true] .server-card,
body[data-playing=true] .practice-row,
body[data-playing=true] .diagnostics,
body[data-playing=true] .proof,
body[data-playing=true] .help,
body[data-playing=true] footer { display: none; }
body[data-playing=true] .layout, body[data-playing=true] .workspace { display: block; }
body[data-playing=true] .runtime { padding: 14px 16px; }
body[data-playing=true] .runtime .step, body[data-playing=true] .viewport-corner { display: none; }
body[data-playing=true] .viewport { width: min(100%, calc((100dvh - 220px) * 16 / 9)); min-width: 240px; margin: 12px auto 0; border-color: #25282d; background: #111; }
body[data-playing=true] .viewport:fullscreen { width: 100%; height: 100%; margin: 0; }
body[data-playing=true] .play-hint { display: block; text-align: center; }
body[data-playing=true] .status-box { margin-top: 14px; }
@media (hover: hover) and (pointer: fine) {
  .primary:hover { background: #983906; }
  .secondary:hover, input::file-selector-button:hover, .installation-control input:not(:disabled) + label:hover { background: #f5f6f8; }
  .quiet:hover, .back-link:hover { color: #202329; }
  .header nav a:hover { background: #f1f3f6; }
  .disclosure summary:hover { color: #202329; }
}
@media (max-width: 1100px) {
  .desktop-badge { display: none; }
  .layout { grid-template-columns: 290px minmax(0, 1fr); gap: 16px; }
  .panel { padding: 18px; }
  .server-actions .primary { min-width: 0; }
  .server-stats { gap: 24px; }
  .practice-row { align-items: flex-start; flex-direction: column; gap: 10px; }
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .help-grid { gap: 24px; }
  .installation-picker { padding: 18px; }
  .folder-icon { float: left; margin-right: 12px; }
  .installation-picker input { clear: both; }
  .practice-row { align-items: center; flex-direction: row; }
}
@media (max-width: 560px) {
  .header { padding: 10px 16px; gap: 12px; }
  .header-brand { gap: 11px; }
  .brand { gap: 8px; font-size: 18px; }
  .product-name { font-size: 12px; }
  .back-link { display: none; }
  .header nav a { min-width: 34px; padding-inline: 7px; }
  main { padding: 24px 16px; }
  .intro { margin-bottom: 20px; }
  h1 { font-size: 29px; letter-spacing: -.9px; }
  .lead { font-size: 12px; }
  .panel { padding: 16px; }
  .server-heading { gap: 9px; flex-wrap: wrap; }
  .server-heading > div { flex: 1; }
  .server-heading h2 { font-size: 15px; }
  .server-state { max-width: 100%; margin-left: 0; }
  .server-details { flex-wrap: wrap; gap: 14px; }
  .server-actions { width: 100%; }
  .server-actions .primary { width: 100%; }
  .runtime-toolbar { align-items: flex-start; }
  .runtime-toolbar .actions:has(button:not([hidden])) { width: 100%; }
  .runtime-toolbar .actions button { flex: 1 1 auto; }
  .viewport { aspect-ratio: 4/3; background-size: 30px 30px; }
  #empty { padding: 18px; }
  .empty-emblem { margin-bottom: 12px; }
  .empty-emblem svg { width: 24px; height: 24px; }
  .key-hint { margin-top: 14px; }
  .practice-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .practice-row .actions { width: 100%; }
  .practice-row button { width: 100%; }
  .help { margin-top: 24px; padding-top: 22px; }
  .help-grid { grid-template-columns: 1fr; gap: 20px; }
  footer { padding: 0 16px 18px; flex-wrap: wrap; gap: 4px 12px; }
  footer p { width: 100%; order: 1; }
  body[data-playing=true] main { padding: 12px 10px; }
  body[data-playing=true] .runtime { padding: 12px; }
  body[data-playing=true] .viewport { width: 100%; min-width: 0; aspect-ratio: 16/9; }
  body[data-playing=true] .intro h1 { font-size: 17px; }
}
@media (max-height: 580px) and (min-width: 561px) {
  body[data-playing=true] .header { display: none; }
  body[data-playing=true] .intro { margin-bottom: 8px; }
  body[data-playing=true] main { padding-top: 8px; }
  body[data-playing=true] .viewport { width: min(100%, calc((100dvh - 145px) * 16 / 9)); }
  body[data-playing=true] .viewport:fullscreen { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  button:active { transform: none; }
}
