
  :root {
    --ui-font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    --bg: #f4f2ec; --card: #faf9f5; --soft: #eeece5; --line: #deded5; --edge: #cecec3;
    --ui-text: #202322; --ui-muted: #70756e;
    --blue: #202322; --blue-deep: #202322; --green: #4f9a62; --green-deep: #2f7743;
    --gold: #748775; --gold-deep: #566d57; --red: #cf4934; --ui-focus: #d94730;
    --accent: #202322; --accent-deep: #202322;   /* follows the world colour */
    --ink: #202322; --hot: #e9492f; --hot-deep: #b93320; --fill: #86a98a;
    --hair: rgba(32,35,34,.15); --lift: 0 1px 2px rgba(32,35,34,.10), 0 5px 14px rgba(32,35,34,.08); --press: 0 1px 2px rgba(32,35,34,.12);
    --ui-ease: cubic-bezier(.2,.7,.2,1); --ui-pop: cubic-bezier(.3,1.5,.5,1); --ui-fast: 160ms; --ui-med: 240ms;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
  body { background: var(--bg); color: var(--ui-text); font: 15px/1.5 var(--ui-font); -webkit-font-smoothing: antialiased; }
  button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  button:focus, canvas:focus, select:focus { outline: none; }
  body.keyboard-input button:focus-visible, body.keyboard-input #board:focus-visible, body.keyboard-input select:focus-visible, body.keyboard-input textarea:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
  svg { display: block; }
  #board { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; cursor: grab; }
  body.aiming #board { cursor: grabbing; }

  /* ─── Chrome: light cards with a hairline edge and a soft lift; only the primary action is solid vermilion ─── */
  .surface { background: var(--card); border: 1px solid var(--hair); border-radius: 16px; box-shadow: var(--lift); }
  /* Every action is an icon button; its name lives in the accessible label and tooltip. */
  .btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 56px; height: 56px; padding: 0;
    border: 1px solid var(--hair); border-radius: 16px; background: #fff; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums;
    box-shadow: var(--lift); transition: transform 70ms, box-shadow 70ms, background-color var(--ui-fast), filter var(--ui-fast); }
  .btn svg { flex: none; width: 26px; height: 26px; }
  .btn:enabled:hover { background: var(--soft); }
  .btn:enabled:active { transform: translateY(1px); box-shadow: var(--press); }
  .btn:disabled { opacity: .3; cursor: default; }
  .btn.go { width: 96px; height: 72px; border-radius: 20px; border-color: transparent; background: var(--hot); color: #fff; box-shadow: 0 3px 0 var(--hot-deep), var(--lift); }
  .btn.go:enabled:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--hot-deep); }
  .btn.go svg { width: 34px; height: 34px; }
  .btn.go:enabled:hover { background: var(--hot); filter: brightness(1.06); }
  .btn.small { width: 44px; height: 44px; border-radius: 13px; box-shadow: var(--lift); }
  .btn.small svg { width: 22px; height: 22px; }
  .btn.small:enabled:active { transform: translateY(1px); box-shadow: var(--press); }
  .num { flex: none; min-width: 36px; height: 36px; padding: 0 8px; display: grid; place-items: center; border-radius: 11px;
    background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

  /* HUD: controls on the left, the goal meter in the middle, status on the right. */
  #hud { position: fixed; inset: max(12px, env(safe-area-inset-top)) 14px auto; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: start; gap: 12px; z-index: 2; pointer-events: none; }
  #controls { justify-self: start; display: flex; gap: 10px; pointer-events: auto; }
  #controls .btn { width: 52px; height: 52px; background: var(--card); box-shadow: var(--lift); }
  #controls .btn:enabled:hover { background: #fff; }
  #controls .btn:enabled:active { transform: translateY(1px); box-shadow: var(--press); }
  /* While a finger aims, one cancel target takes the exact place of the two controls: drag onto it and let go, or tap it with another finger. */
  #controls { position: relative; }
  #controls #aim-cancel { position: absolute; inset: 0; display: none; width: auto; height: auto; border: 2px solid var(--hot); background: #fff; color: var(--hot); box-shadow: var(--lift); }
  #controls #aim-cancel svg { width: 32px; height: 32px; }
  body.aiming.touch-aim #controls #aim-cancel { display: inline-flex; }
  body.aiming.touch-aim #menu, body.aiming.touch-aim #restart { visibility: hidden; }
  #controls #aim-cancel.hot { background: var(--hot); color: #fff; transform: scale(1.08); }
  #coverage { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; width: 460px; max-width: 100%; min-width: 0; height: 60px;
    padding: 0 16px; font-variant-numeric: tabular-nums; }
  #cov-now { min-width: 2.5em; transform-origin: left center; font-weight: 800; font-size: 28px; line-height: 1; color: var(--ink); }
  .cov-goal { position: absolute; left: calc(var(--goal, 0) * 1%); top: 0; transform: translateX(-100%); display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--ui-muted); }
  .cov-goal svg { width: 12px; height: 12px; color: var(--hot); }
  #cov-track { position: relative; height: 38px; min-width: 0; }
  #cov-bar { position: absolute; inset: 20px 0 4px; overflow: hidden; background: #e9e6dd; border: 1px solid var(--hair); border-radius: 10px; }   /* one rounded clip for track and fill */
  #cov-fill { position: absolute; inset: 0 auto 0 0; width: 0; max-width: 100%;
    background: var(--fill); transition: width 420ms var(--ui-ease), background-color var(--ui-med); }
  #cov-tick { position: absolute; top: 16px; height: 22px; width: 2px; margin-left: -1px; background: var(--hot); border-radius: 1px; }
  #coverage.reached #cov-fill { background: var(--green); }
  #coverage.reached .cov-goal, #coverage.reached .cov-goal svg { color: var(--green-deep); }
  #coverage.reached #cov-tick { background: var(--green-deep); }
  #coverage.bump #cov-now { animation: bump 460ms var(--ui-pop); }
  @keyframes bump { 30% { transform: scale(1.22); } }
  #status { justify-self: end; display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 14px 0 7px; white-space: nowrap; }
  #lives { display: flex; gap: 2px; }
  #lives svg { width: 28px; height: 28px; }
  #lives .lost { animation: lost 560ms var(--ui-ease); }
  @keyframes lost { 0% { opacity: .25; } 45% { opacity: 1; transform: scale(.8); } }
  #lives .gain { animation: gain 520ms var(--ui-pop); }
  @keyframes gain { from { transform: scale(.2); } }
  #turns { display: flex; align-items: center; gap: 6px; }
  #pace { display: flex; }
  #pace svg { width: 21px; height: 21px; }
  #shots { font-size: 17px; font-variant-numeric: tabular-nums; font-weight: 800; }
  #shots b { font-weight: 800; font-size: 23px; } #shots span { color: var(--ui-muted); }

  #toast { position: fixed; top: 86px; left: 50%; transform: translate(-50%, 0);
    max-width: calc(100% - 28px); width: max-content; padding: 10px 18px; font-size: 15px; font-weight: 800; text-align: center;
    color: #fff; background: var(--ink); border: 0; border-radius: 999px;
    box-shadow: 0 3px 0 rgba(32,35,34,.25); word-break: keep-all;
    pointer-events: none; z-index: 3; transition: opacity var(--ui-med) var(--ui-ease), transform var(--ui-med) var(--ui-ease); }
  #toast.hidden { opacity: 0; transform: translate(-50%, -10px) scale(.94); }
  #toast:not(.hidden).obscured, body.aiming #toast:not(.hidden) { opacity: .25; }

  /* ─── Panels ─── */
  #overlay { position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(32,35,34,.5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: fade-in var(--ui-med) var(--ui-ease); }
  #overlay[hidden] { display: none; }
  @keyframes fade-in { from { opacity: 0; } }
  .panel { position: relative; width: min(380px, 100%); max-height: calc(100dvh - 38px); overflow: auto; padding: 26px 22px; text-align: center;
    background: var(--card); border: 1px solid var(--hair); border-radius: 22px;
    box-shadow: 0 24px 60px rgba(32,35,34,.30); animation: panel-in 320ms var(--ui-pop); }
  .panel.wide { width: min(820px, 100%); }
  @keyframes panel-in { from { opacity: 0; transform: translateY(18px); } }
  h1 { font-size: 24px; font-weight: 800; line-height: 1.25; margin: 0 0 14px; letter-spacing: -.03em; word-break: keep-all; text-wrap: balance; }
  .action-row { display: flex; align-items: center; justify-content: center; gap: 12px; padding-bottom: 4px; }
  /* Panel menus: the primary action spans the row, labelled secondary actions share the row beneath it. */
  .menu { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; padding-bottom: 4px; }
  .menu .btn { width: auto; min-width: 0; height: 52px; padding: 0 5px; gap: 6px; border-radius: 15px; font-size: 15px; line-height: 1.2; white-space: nowrap; }
  .menu .btn svg { width: 19px; height: 19px; }
  .menu .btn span { overflow: hidden; text-overflow: ellipsis; }
  .menu .btn.go { grid-column: 1 / -1; width: auto; height: 64px; gap: 10px; border-radius: 18px; font-size: 22px; }
  .menu .btn.go svg { width: 28px; height: 28px; }
  @media (max-width: 420px) { .menu[style*="cols:3"] .btn:not(.go) svg { display: none; } }
  .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 6px; text-align: left; }
  .panel-head h1 { margin: 0; }

  /* result */
  .result-stars { display: flex; justify-content: center; align-items: flex-end; gap: 4px; margin: 0 0 10px; }
  .result-stars svg { width: 62px; height: 62px; }
  .result-stars svg:nth-child(1) { transform: rotate(-8deg); } .result-stars svg:nth-child(3) { transform: rotate(8deg); }
  .result-stars svg:nth-child(2) { width: 82px; height: 82px; margin-bottom: 8px; }
  .result-stars .on { animation: star-in 520ms var(--ui-pop) backwards; }
  .result-stars .on:nth-child(2) { animation-delay: 180ms; } .result-stars .on:nth-child(3) { animation-delay: 360ms; }
  @keyframes star-in { from { opacity: 0; transform: scale(.2) rotate(-40deg); } }
  .result-icon { display: grid; place-items: center; margin: 0 0 18px; }
  .result-icon svg { width: 84px; height: 84px; animation: lost 560ms var(--ui-ease); }
  .stats { display: flex; justify-content: center; margin: 0 0 20px; font-size: 18px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
  .stats span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; background: var(--soft); }
  .stats svg { width: 20px; height: 20px; color: var(--ink); }

  /* stage sheet */
  .panel.sheet { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; }
  .sheet-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 13px 22px; border-bottom: 1px solid var(--hair); }
  .sheet-head h1 { margin: 0 auto 0 0; }
  .star-total { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .star-total svg { width: 22px; height: 22px; }
  .sheet-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 22px 2px; background: var(--soft); }
  .chapter-head { margin: 0 0 14px; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
  .stage-grid { display: grid; align-items: start; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 16px 12px; margin: 0 0 26px; }
  .stage-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; padding: 6px 6px 8px;
    background: var(--card); border: 1px solid var(--hair); border-radius: 14px; box-shadow: var(--lift); text-align: center;
    transition: transform 90ms, box-shadow 90ms; }
  .stage-tile:enabled:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(32,35,34,.16); }
  .stage-tile:enabled:active { transform: translateY(1px); box-shadow: var(--press); }
  .stage-tile[aria-current="true"] { border-color: var(--hot); box-shadow: 0 0 0 2px var(--hot), var(--lift); background: #fff; }
  .tile-thumb { position: relative; display: block; width: 100%; }
  .stage-tile svg.thumb { width: 100%; height: auto; border-radius: 8px; background: var(--bg); }
  .tile-num { position: absolute; top: -9px; left: -9px; z-index: 1; min-width: 28px; height: 28px; padding: 0 7px; display: grid; place-items: center;
    border-radius: 14px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .stage-tile[aria-current="true"] .tile-num { background: var(--hot); }
  .tile-boss { position: absolute; top: -9px; right: -9px; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 14px; background: var(--ink); color: #f2b024; }
  .tile-boss svg { width: 17px; height: 17px; }
  .stage-tile:disabled .tile-boss { background: #a3a79e; color: #e6e3da; }
  .tile-stars { display: flex; gap: 1px; margin-top: auto; }
  .tile-stars svg { width: 18px; height: 18px; }
  .tile-lock { position: absolute; inset: 0; display: grid; place-items: center; }
  .tile-lock svg { width: 30px; height: 30px; color: #8d9189; }
  .stage-tile:disabled { cursor: default; background: #e6e3da; border-color: transparent; box-shadow: none; }
  .stage-tile:disabled svg.thumb { opacity: .4; filter: grayscale(.8); }
  .stage-tile:disabled .tile-num { background: #a3a79e; }
  .stage-tile:disabled .tile-stars { display: none; }

  /* pause */
  .settings { margin-top: 18px; border-top: 1px solid var(--line); }
  .setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 54px; font-size: 16px; font-weight: 800; text-align: left; }
  .setting + .setting { border-top: 1px solid var(--line); }
  .setting:last-child { margin-bottom: -12px; }
  label.setting { cursor: pointer; }
  .switch { position: relative; flex: none; width: 56px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: var(--edge);
    transition: background-color var(--ui-fast); }
  .switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; box-shadow: var(--press);
    transition: transform var(--ui-fast) var(--ui-ease); }
  .switch[aria-checked="true"] { background: var(--green); }
  .switch[aria-checked="true"] i { transform: translateX(24px); }
  .language-control { display: flex; align-items: center; gap: 8px; font-weight: 800; }
  .language-control svg { flex: none; width: 24px; height: 24px; }
  .language-control select { max-width: 180px; min-height: 44px; padding: 5px 34px 5px 12px; border: 1px solid var(--hair); border-radius: 12px; appearance: none; -webkit-appearance: none;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 12 8%27%3E%3Cpath d=%27M1.5 1.5 6 6l4.5-4.5%27 fill=%27none%27 stroke=%27%23202322%27 stroke-width=%272.2%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27/%3E%3C/svg%3E") right 12px center / 12px 8px no-repeat; color: var(--ink); font: inherit; font-size: 15px; font-weight: 700; }
  .setting .language-control { width: 100%; justify-content: space-between; }
  .setting .language-control svg { display: none; }

  /* tutorial */
  .panel.tutorial { width: min(430px, 100%); }
  .panel.tutorial.steps h1 { padding-right: 44px; text-align: left; }   /* clears the skip button */
  .panel-close { position: absolute; top: 14px; right: 14px; }
  .lesson { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .lesson-visual { position: relative; width: 100%; max-width: 340px; }
  .lesson canvas { display: block; width: 100%; height: auto; border: 1px solid var(--hair); border-radius: 14px; background: var(--soft); }
  .lesson > span { font-size: 16px; font-weight: 650; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }
  html:lang(ja) .lesson > span, html:lang(zh-Hans) .lesson > span { word-break: normal; }
  .lesson-motion { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border: 1px solid var(--hair); border-radius: 12px; background: #fff; color: var(--ink); font-size: 14px; }
  .lesson-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; padding-bottom: 4px; }
  .lesson-steps { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 44px; gap: 12px; }
  .lesson-steps > .btn { position: absolute; left: 0; }
  .lesson-foot .lesson-forward { flex: 1 1 100%; width: auto; min-width: 0; height: 46px; padding: 0 16px; border-radius: 12px; gap: 8px; font-size: 17px; box-shadow: 0 2px 0 var(--hot-deep), var(--press); }
  .lesson-foot .lesson-forward svg { width: 18px; height: 18px; }
  .share-status { min-height: 1.4em; margin: 12px 0 0; color: var(--ui-muted); font-size: 13px; }
  .share-status:empty { min-height: 0; margin: 0; }
  .dots { display: flex; gap: 6px; align-items: center; }
  .dots i { width: 10px; height: 10px; border-radius: 5px; background: var(--edge); transition: width var(--ui-med) var(--ui-ease), background-color var(--ui-med); }
  .dots i.on { width: 26px; background: var(--hot); }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

  @media (max-width: 1099px) {   /* side clusters keep their width; the meter takes what is left */
    #hud { grid-template-columns: auto minmax(0, 1fr) auto; }
    #coverage { justify-self: center; }
  }
  @media (max-width: 719px) {
    #hud { inset-inline: 8px; grid-template-columns: auto minmax(0, 1fr); gap: 10px 8px; }
    #coverage { grid-row: 2; grid-column: 1 / -1; width: 100%; }
    #toast { top: 136px; }
    #controls { gap: 8px; }
    #controls .btn, #status { height: 48px; } #controls .btn { width: 48px; }
    #status { gap: 10px; padding: 0 12px 0 6px; }
    .num { min-width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
    .stage-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sheet-head { padding-left: 18px; } .sheet-body { padding-inline: 18px; }
  }
  @media (max-width: 479px) {
    #status { gap: 8px; }
    #lives svg { width: 22px; height: 22px; } #pace svg { width: 15px; height: 15px; }
    #shots { font-size: 14px; } #shots b { font-size: 18px; }
    #overlay { padding: 12px; }
    .panel { padding: 22px 16px; }
    .panel.tutorial h1 { font-size: 22px; }
    .lesson > span { font-size: 15px; }
    .result-stars svg { width: 56px; height: 56px; } .result-stars svg:nth-child(2) { width: 74px; height: 74px; }
  }
  @media (max-width: 359px) {
    #controls .btn { width: 44px; }
    #status { gap: 6px; padding: 0 9px 0 5px; }
    #pace { display: none; }   /* the shot count still shows the par */
    #lives svg { width: 20px; height: 20px; }
    .btn.go { width: 84px; }
    .action-row { gap: 8px; } .action-row .btn:not(.go) { width: 50px; height: 50px; }
  }
  @media (max-height: 500px) {
    #hud { top: 8px; grid-template-columns: auto minmax(0, 1fr) auto; }
    #coverage { grid-row: auto; grid-column: auto; width: 460px; height: 46px; }
    #cov-now { font-size: 24px; }
    #controls .btn, #status { height: 46px; } #controls .btn { width: 46px; }
    .num { min-width: 30px; height: 30px; }
    .panel { padding: 16px 18px; max-height: calc(100dvh - 26px); }
    h1 { font-size: 20px; margin-bottom: 8px; }
    .btn.go { height: 60px; } .menu .btn { height: 46px; } .menu .btn.go { height: 54px; font-size: 20px; }
    .panel.tutorial { width: min(600px, 100%); }
    .tutorial .lesson { flex-direction: row; text-align: left; gap: 14px; }
    .tutorial .lesson-visual { flex: 0 0 170px; }
    .lesson-foot { flex-wrap: nowrap; gap: 16px; margin-top: 10px; }
    .lesson-steps { width: auto; gap: 10px; }
    .lesson-steps > .btn { position: static; }
    .lesson-foot .lesson-forward { flex: 1; height: 46px; }
    .result-stars svg { width: 48px; height: 48px; } .result-stars svg:nth-child(2) { width: 62px; height: 62px; margin-bottom: 4px; }
    .result-icon { margin-bottom: 10px; } .result-icon svg { width: 64px; height: 64px; }
    .stats { margin-bottom: 12px; }
    .settings { margin-top: 14px; } .setting { min-height: 46px; }
    .stage-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .sheet-head { padding-block: 8px 9px; }
    #toast { top: 64px; padding: 6px 14px; font-size: 13px; }
  }

  /* Tall screens: the board is turned to fill the phone, with controls and status on top and the goal meter docked below. */
  body.tall #hud { top: max(var(--tall-top, 12px), env(safe-area-inset-top)); grid-template-columns: auto minmax(0, 1fr); }
  body.tall #coverage { position: fixed; left: 8px; right: 8px; bottom: max(var(--tall-bottom, 12px), env(safe-area-inset-bottom)); justify-self: stretch; width: auto; max-width: 560px; height: 58px; margin-inline: auto;
    padding: 0 16px; pointer-events: none; }
  body.tall #cov-now { font-size: 30px; }
  body.tall #toast { top: calc(max(var(--tall-top, 12px), env(safe-area-inset-top)) + 62px); }

  /* Wide screens, desktop or landscape phone: the board takes the full height. Controls and status stack in a left rail; the goal meter stands in a right rail.
     The rails hug the board instead of the screen edges, and their contents grow with the rail. */
  body.side { --rail: clamp(72px, calc((100vw - 150vh) / 2 - 14px), 150px); }
  body.side #hud { inset: 0 auto 0 50%; width: min(100vw, calc(150vh + 2 * var(--rail) + 56px)); transform: translateX(-50%); grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail); grid-template-rows: auto minmax(0, 1fr); gap: 10px 0;
    padding: 8px max(8px, env(safe-area-inset-right)) 11px max(8px, env(safe-area-inset-left)); }
  body.side #controls { grid-area: 1 / 1; justify-self: stretch; flex-wrap: wrap; gap: 8px; }   /* side by side once the rail has room for two */
  body.side #controls .btn { flex: 1 1 48px; width: auto; height: clamp(48px, calc(var(--rail) * .6), 62px); }
  body.side #status { grid-area: 2 / 1; justify-self: stretch; align-self: start; flex-direction: column; gap: 7px; height: auto; padding: 8px 4px 9px; }
  body.side #lives svg { width: min(34px, calc((var(--rail) - 16px) / 3)); height: min(34px, calc((var(--rail) - 16px) / 3)); }
  body.side #turns { flex-direction: column; gap: 1px; }
  body.side #pace svg { width: clamp(17px, calc(var(--rail) * .17), 24px); height: clamp(17px, calc(var(--rail) * .17), 24px); }
  body.side #coverage { --cov-axis: calc(var(--rail) * .4); --cov-width: clamp(18px, calc(var(--rail) * .25), 28px); grid-area: 1 / 3 / 3 / 4; justify-self: stretch; align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 14px; width: auto; height: auto; padding: 10px 0 14px; background: transparent; border: 0; box-shadow: none; }
  body.side #cov-now { align-self: flex-start; width: calc(var(--cov-axis) * 2); min-width: 0; display: flex; justify-content: center; white-space: nowrap; font-size: clamp(24px, calc(var(--rail) * .3), 40px); transform-origin: center; }
  body.side #cov-track { flex: 1; align-self: flex-start; margin-left: calc(var(--cov-axis) - var(--cov-width) / 2); width: var(--cov-width); height: auto; }
  body.side #cov-bar { inset: 0; border-radius: 9px; background: rgba(32,35,34,.06); border-color: rgba(32,35,34,.13); }
  body.side #cov-fill { inset: auto 0 0 0; width: 100% !important; height: calc(var(--cov, 0) * 1%); transition: height 420ms var(--ui-ease), background-color var(--ui-med); }
  body.side #cov-tick { left: -4px !important; right: 0; top: auto; bottom: calc(var(--goal, 0) * 1%); width: auto; height: 2px; margin: 0 0 -1px; }
  body.side .cov-goal { left: calc(100% + 2px); top: auto; bottom: clamp(8px, calc(var(--goal, 0) * 1%), calc(100% - 8px)); transform: translateY(50%); font-size: clamp(12px, calc(var(--rail) * .13), 17px); gap: 0; padding: 3px 0; border-radius: 4px; background: var(--bg); line-height: 1.1; color: var(--hot-deep); }
  body.side .cov-goal svg { display: none; }
  body.side #toast { top: 10px; }

  body.reduced .panel, body.reduced #overlay, body.reduced .result-stars .on, body.reduced .result-icon svg, body.reduced #lives .lost, body.reduced #lives .gain, body.reduced #coverage.bump #cov-now { animation: none; }
  body.reduced #cov-fill, body.reduced #toast, body.reduced .dots i, body.reduced .switch, body.reduced .switch i { transition: none; }

  /* Home: a title screen with the real board as its showpiece. */
  body.home-mode { background: var(--bg); }
  body.home-mode > #board, body.home-mode > #hud, body.home-mode > #toast { visibility: hidden; }
  body.home-mode #overlay { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.home-mode #overlay.home-screen { padding: 0; overflow: auto; background: var(--bg); }
  .panel.home-panel { position: relative; width: 100%; height: 100%; max-height: none; min-height: 340px; padding: 0; border: 0; border-radius: 0; overflow: hidden; text-align: left; background: transparent; box-shadow: none; animation: none; color: var(--ink); }
  .home-layout { position: relative; overflow: clip; min-height: 100%; display: flex; align-items: center; justify-content: center;
    padding: max(24px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); }
  .home-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: clamp(22px,5vh,44px); width: min(360px,100%); }
  .home-title { margin: 0; font-size: clamp(60px,7.4vw,112px); line-height: .98; letter-spacing: -.065em; font-weight: 800; color: var(--ink); white-space: nowrap;
    -webkit-text-stroke: 10px #f4f2ec; paint-order: stroke fill; }
  .home-title span { color: var(--hot); -webkit-text-stroke: 0; }
  .home-actions { width: 100%; }
  .home-menu { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .home-menu .btn { width: auto; min-width: 0; height: 62px; padding: 0 12px; border-radius: 18px; font-size: 19px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
  .home-menu .btn svg { width: 24px; height: 24px; }
  .home-menu .home-start { grid-column: 1 / -1; height: 74px; padding: 0 24px; gap: 14px; border-radius: 18px; font-size: 28px; }
  .home-menu .home-start svg { width: 26px; height: 26px; }
  .home-start-copy { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 20px; text-align: left; }
  .home-stage { flex: none; padding-left: 20px; border-left: 1px solid rgba(255,255,255,.32); font-size: 14px; font-weight: 600; line-height: 24px; color: #fff; font-variant-numeric: tabular-nums; }
  .home-language { position: absolute; z-index: 2; top: max(14px,env(safe-area-inset-top)); right: max(16px,env(safe-area-inset-right)); }
  .home-language .language-control { width: max-content; }
  .home-language .language-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .home-language select { min-width: 0; box-shadow: var(--lift); }
  /* The real board fills the screen behind the menu; its walls are drawn pale there so the title stays the darkest shape. */
  .home-art { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
  .home-art canvas { display: block; width: 100%; height: 100%; object-fit: cover; background: #f4f2ec; }
  @media (max-width: 700px), (max-height: 540px) {
    .panel.home-panel { min-height: 0; }
    .home-title { font-size: clamp(52px,14vw,68px); }
    .home-menu { gap: 12px; }
    .home-menu .btn { height: 56px; font-size: 18px; }
    .home-menu .home-start { height: 68px; padding-inline: 22px; font-size: 26px; }
    .home-language { top: max(10px,env(safe-area-inset-top)); right: max(12px,env(safe-area-inset-right)); }
  }
  @media (max-width: 359px) {
    .home-menu .btn { font-size: 16px; gap: 7px; }
    .home-menu .home-start { padding-inline: 18px; font-size: 24px; gap: 10px; }
    .home-start-copy { gap: 12px; }
    .home-stage { padding-left: 12px; font-size: 13px; }
  }
  @media (max-height: 540px) {
    .home-content { gap: 16px; width: min(440px,100%); }
    .home-title { font-size: clamp(40px,13vh,56px); -webkit-text-stroke-width: 8px; }
    .home-menu .btn { height: 48px; }
    .home-menu .home-start { height: 60px; font-size: 25px; }
  }


.home-title{font-family:Georgia,serif!important;font-size:clamp(48px,7vw,104px)!important;letter-spacing:-.05em!important;text-transform:none!important}.home-title small{display:block;font:15px system-ui;letter-spacing:.13em;color:#87978c;margin-top:17px;text-transform:uppercase}.home-content{min-width:0}.home-title span{color:#da7961!important}
#launcher{position:fixed;left:50%;bottom:10px;transform:translateX(-50%);display:flex;align-items:center;justify-content:center;gap:14px;padding:10px 16px;border:1px solid #dedacb;border-radius:15px;background:#faf6e9f2;box-shadow:0 5px 20px #4d604013;z-index:3;width:max-content;max-width:calc(100vw - 20px);color:#6c7b6d}#launcher[hidden]{display:none}#launcher label{display:grid;grid-template-columns:40px 40px;align-items:center;font-size:9px;gap:3px;color:#8a9789}#launcher label input{grid-column:1/-1;width:115px;accent-color:#8da897}#launcher output{font-size:10px;font-weight:700;color:#637f73;text-align:right}#launcher button{font-size:11px;background:#e2ebdd;border:1px solid #cad6bf;border-radius:9px;padding:10px 14px}#launcher #launch{background:#d7876f;color:white;border-color:#cd7c63;font-weight:700}#launcher button:disabled{opacity:.45;cursor:default}#launcher .key-note{font-size:8px;line-height:1.7;color:#9ca58f}.source-credit{position:fixed;bottom:3px;right:8px;font:6px system-ui;color:#8a9583;z-index:1}.source-credit a{color:inherit;text-underline-offset:2px}@media(max-width:600px){#launcher{gap:9px;padding:8px 10px;bottom:8px}#launcher .key-note{display:none}#launcher label{grid-template-columns:35px 35px;font-size:8px}#launcher label input{width:84px}#launcher button{padding:9px 10px;font-size:10px}.home-title{font-size:clamp(43px,12vw,70px)!important}.home-title small{font-size:12px;margin-top:12px}.source-credit{font-size:5px}}button:focus-visible,input:focus-visible{outline:3px solid #c5926a;outline-offset:3px}

#launcher #angle{width:115px;padding:4px 7px;border:1px solid #d9decb;border-radius:6px;background:#fffcf4;color:#687c6b;font:12px system-ui}@media(max-width:600px){#launcher #angle{width:84px}}
