/* Redesign (Designer mockups a1, b, c): flat cream UI, one task per screen.
   Loaded after style.css and tokens.css; selectors are body-prefixed to win over style.css. */
body { background: var(--cream); color: var(--ink); font-size: 15px; line-height: 1.4; }
body .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
body .group-label, body label { color: var(--ink); }
body .form-note, body .muted { color: var(--ink-2); }
body .primary { min-height: 52px; border-radius: var(--radius-btn); font-size: 16px; font-weight: 700; color: var(--ink); background: var(--lime); padding: 0 20px; justify-content: center; gap: 10px; }
body .primary span { font-size: 18px; line-height: 1; }
body .primary.big { min-height: 60px; font-size: 18px; justify-content: space-between; }
body .secondary { border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; min-height: 44px; }
body .secondary:hover:not(:disabled) { background: #f0f1e8; }
body .surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
body .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
body .iconbtn { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0; }
body svg { flex: none; }
body .iconbtn svg, body .tile-icon svg, body .stepper svg, body .help-button svg, body .tabbar svg, body .text-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
body .text-link { border: 0; background: none; padding: 8px 4px; color: var(--accent-text); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
body .seg { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--seg); }
body .seg > button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 600; padding: 0 4px; box-shadow: none; }
body .seg > button[aria-pressed="true"], body .seg > button.selected { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
body .seg.ondark { background: #1d221e; }
body .seg.ondark > button { color: var(--d-text-2); }
body .seg.ondark > button[aria-pressed="true"] { background: #3a433b; color: var(--d-text); box-shadow: none; }

/* Header + tab bar */
body .header { max-width: 1160px; padding: 10px 16px; min-height: 56px; border-bottom: 0; }
body .brand { font-size: 21px; letter-spacing: -.02em; }
body .brand-dot { display: none; }
body .header-right { gap: 10px; }
body .help-button { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); padding: 8px 4px; }
body .icon-button { width: 36px; height: 36px; font-size: 17px; border-color: var(--line); }
body .connection { font-size: 0; gap: 0; }
body .connection i { width: 8px; height: 8px; }
body .tabbar button { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; background: transparent; }
body .tabbar button.selected { color: var(--ink); background: transparent; }
body .tabbar .pill { display: inline-flex; width: 40px; height: 28px; align-items: center; justify-content: center; border-radius: 14px; margin: 0; }
body .tabbar button.selected .pill { background: var(--lime-soft); }
body .tabbar #nav-avatar { display: inline-flex; margin: 0; }
body .tabbar #nav-avatar .avatar-icon { width: 20px; height: 20px; }
@media (max-width: 760px) {
  body .header { position: relative; }
  body:not([data-view="room"]):not([data-view="login"]):not([data-view="loading"]) main { padding-bottom: 84px; }
  body .tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; gap: 0; background: var(--cream); border-top: 1px solid var(--line); }
  body[data-view="room"] .tabbar { display: none; }
  body .tabbar button { flex: 1; flex-direction: column; gap: 4px; padding: 6px 0; font-size: 12px; border-radius: 0; }
  body .tabbar button:hover { background: transparent; }
  body .tabbar .pill { width: 56px; height: 30px; border-radius: 15px; }
}

/* a1: home */
body main { padding: 0 16px; }
body #home-view { max-width: 560px; margin: 0 auto; }
body #home-view .home-hero { padding: 10px 0 18px; }
body #home-view .home-hero h1 { margin: 8px 0 0; font-size: 32px; line-height: 1.06; font-weight: 800; letter-spacing: -.035em; color: var(--ink); }
body #home-view .home-layout { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin: 0; grid-template-columns: none; }
body #home-view .play-card { background: var(--dark); color: var(--d-text); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
body #home-view .play-card .eyebrow { color: var(--d-text-2); }
body #home-view .play-card h2 { margin: 6px 0 0; font-size: 24px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; color: var(--d-text); max-width: 11ch; }
body .play-card-head { display: flex; justify-content: space-between; gap: 12px; }
body #home-view .play-card .group-label { color: var(--d-text-2); font-size: 14px; display: block; margin-bottom: 8px; }
body #home-view .play-card .practice-level-setting { display: block; padding: 0; border: 0; background: none; }
body #home-view .play-card .primary { margin: 2px 0 0; }
body .mini-board { flex: none; width: 104px; height: 104px; padding: 6px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border: 1px solid #424a3e; border-radius: 12px; background: var(--board); }
body .mini-board i { position: relative; border-radius: 7px; background: var(--cell); border: 1px solid var(--cell-line); }
body .mini-board i::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; }
body .mini-board i.l::after { background: #b8f36b; } body .mini-board i.v::after { background: #a99aff; }
body .mini-board i.ring { border-color: var(--lime); box-shadow: 0 0 0 2px var(--lime); }
body .home-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
body .home-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); color: var(--ink); min-height: 120px; }
body .home-tile strong { margin-top: 12px; font-size: 16px; font-weight: 700; }
body .home-tile small { font-size: 14px; color: var(--ink-2); }
body .tile-icon { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: #e8eadf; color: var(--ink); flex: none; }
body .tile-icon.lime { background: var(--lime-soft); }
body #home-view #open-local-home { align-self: flex-start; }
body #home-view .practice-resume { width: 100%; margin: 0 0 12px; }

/* Sub-screens: one task per screen (b, join, same-phone setup). */
body #home-view .subscreen { display: none; }
body #home-view[data-sub="setup"] #setup-panel,
body #home-view[data-sub="join"] #join-panel,
body #home-view[data-sub="league"] #league-panel,
body #home-view[data-sub="local"] #local-setup { display: block; }
body #home-view[data-sub="setup"] .home-hero, body #home-view[data-sub="join"] .home-hero, body #home-view[data-sub="league"] .home-hero, body #home-view[data-sub="local"] .home-hero,
body #home-view[data-sub="setup"] .home-layout > :not(#setup-panel),
body #home-view[data-sub="join"] .home-layout > :not(#join-panel),
body #home-view[data-sub="league"] .home-layout > :not(#league-panel),
body #home-view[data-sub="local"] .home-layout,
body #home-view[data-sub] .practice-resume { display: none; }
body #home-view[data-sub=""] .home-layout > .subscreen { display: none; }
body #home-view .subscreen { background: transparent; border: 0; padding: 0; margin: 0; }
body #league-panel > p { color: var(--ink-2); line-height: 1.55; }
body #league-panel > button { margin: 10px 10px 0 0; min-height: 44px; }
body .league-tabs { display: flex; gap: 4px; padding: 0 0 12px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
body .league-tabs button { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 5px; font-size: 13px; color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: 12px; }
body .league-tabs button[aria-selected="true"] { color: var(--ink); background: var(--lime-soft); border-color: var(--lime); font-weight: 700; }
body .league-tabs button:focus-visible, body .home-mode-tabs button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
body .home-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
body .home-mode-tabs button { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; }
body .home-mode-tabs button[aria-selected="true"] { background: var(--dark); color: var(--d-text); }
body .home-mode-panel { display: flex; flex-direction: column; gap: 12px; }
body #home-online-panel .home-tiles { grid-template-columns: 1fr 1fr; }
body #open-league { grid-column: 1 / -1; min-height: 98px; }
body #open-local-home.home-tile { width: 100%; min-height: 94px; }
body #home-view[data-sub=""] .practice-resume { display: block; }
body #home-view[data-sub=""] .practice-resume[hidden] { display: none; }
  body #league-champions section { padding: 16px 0; border-bottom: 1px solid var(--line); }
  body #league-champions p { overflow-wrap: anywhere; }
  body #leaders-table .leader-player small { display: block; font-size: 10px; }
body .sub-top { display: flex; align-items: center; gap: 14px; min-height: 56px; margin-bottom: 8px; }
body .sub-top h2, body #home-view .subscreen .sub-top h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }

/* b: room setup */
body #home-view #create-room-form > .group-label, body #home-view .clock-settings > .group-label { display: block; margin: 6px 0 8px; color: var(--ink); font-size: 14px; font-weight: 600; }
body #home-view .size-picker.seg { display: flex; gap: 3px; margin-bottom: 14px; }
body #home-view .size-picker.seg button { min-height: 44px; height: auto; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 15px; font-weight: 600; box-shadow: none; }
body #home-view .size-picker.seg button.selected { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
body #home-view .clock-settings { padding: 0; border: 0; background: none; margin: 0; }
body #home-view .tempo-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
body #home-view .tempo-picker button { min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 6px; }
body #home-view .tempo-picker button strong { font-size: 16px; font-weight: 700; color: var(--ink); }
body #home-view .tempo-picker button span { font-size: 14px; color: var(--ink-2); }
body #home-view .tempo-picker button.selected { background: var(--lime-soft); border: 2px solid var(--ink); box-shadow: none; }
body #home-view .clock-card { padding: 4px 16px; margin-bottom: 12px; }
body #home-view .clock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
body #home-view .clock-row + .clock-row { border-top: 1px solid var(--line); }
body #home-view .clock-row > label { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
body #home-view .stepper { display: flex; align-items: center; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
body #home-view .stepper button { width: 40px; height: 40px; border: 0; background: none; color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; }
body #home-view .stepper .unit-input { display: flex; align-items: baseline; gap: 3px; border: 0; background: none; padding: 0; min-width: 0; }
body #home-view .stepper input { width: 34px; border: 0; background: none; padding: 0; text-align: right; font-size: 16px; font-weight: 700; color: var(--ink); -moz-appearance: textfield; appearance: textfield; }
body #home-view .stepper input::-webkit-inner-spin-button, body #home-view .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
body #home-view .stepper .unit-input > span { font-size: 16px; font-weight: 700; color: var(--ink); }
body #home-view .increment-settings { display: flex; padding: 0; border: 0; background: none; margin: 0; }
body #home-view .increment-toggle { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; cursor: pointer; }
body #home-view .increment-toggle > span { display: flex; flex-direction: column; }
body #home-view .increment-toggle strong { font-size: 16px; font-weight: 600; color: var(--ink); }
body #home-view .increment-toggle small { font-size: 14px; color: var(--ink-2); }
body input.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; margin: 0; flex: none; border-radius: 14px; background: #cfd3c6; position: relative; border: 0; cursor: pointer; }
body input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; }
body input.switch:checked { background: var(--ink); }
body input.switch:checked::after { left: 21px; background: var(--lime); }
body input.switch:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
body #home-view .custom-clock { border-top: 1px solid var(--line); padding: 10px 0 12px; }
body #home-view .custom-clock summary { font-size: 14px; font-weight: 600; color: var(--accent-text); cursor: pointer; }
body #home-view .custom-clock .time-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 6px; }
body #home-view .info-card { display: flex; gap: 14px; padding: 16px; margin-bottom: 12px; }
body #home-view .info-card strong { font-size: 16px; font-weight: 700; }
body #home-view .info-card p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
body #home-view .info-card b { color: var(--ink); }
body .sticky-cta { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 12px 16px 10px; background: var(--cream); border-top: 1px solid var(--line); }
body .sticky-cta .form-note { margin: 8px 0 0; text-align: center; font-size: 13px; }
@media (max-width: 760px) { body #home-view .sticky-cta { bottom: calc(64px + env(safe-area-inset-bottom)); } }
body #home-view .offline-shortcut { display: block; margin: 12px auto 0; width: auto; }
/* join + same-phone setup */
body #home-view .join-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
body #home-view .join-form input { height: 56px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 16px; font-size: 22px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
body #home-view #local-setup .muted { margin: 0 0 14px; }
body #home-view #local-setup select, body #home-view #local-setup input { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }

@media (min-width: 761px) {
  body .header { padding: 18px 24px; }
  body #home-view .home-hero h1 { font-size: 40px; }
  body .sticky-cta { margin: 0; border-radius: 16px; border: 0; }
}

/* Overrides of older home rules (style.css #home-view …) that the new structure replaces. */
body #home-view .play-card { border: 0; overflow: visible; }
body #home-view .play-card small { color: var(--d-text-2) !important; }
body #home-view .size-picker.seg { display: grid; grid-template-columns: repeat(5, 1fr); flex-wrap: nowrap; }
body #home-view .size-picker.seg button { flex: none; }
body #home-view .increment-settings { display: flex; grid-template-columns: none; background: none; border: 0; padding: 0; margin: 0; border-radius: 0; }
body #home-view .clock-row + .clock-row.increment-settings { border-top: 1px solid var(--line); }
body #home-view .increment-toggle small { color: var(--ink-2) !important; font-size: 14px; margin-top: 0; }
body #home-view .increment-toggle input.switch { width: 46px; height: 28px; accent-color: auto; }
body #home-view .stepper .unit-input > span { color: var(--ink) !important; }
body #home-view .stepper .unit-input input { min-height: 0; }
body #home-view .custom-clock .unit-input { background: var(--surface); }

/* c: host lobby. body[data-lobby="1"] while an online room has no game yet. */
body[data-lobby="1"] .match-motto, body[data-lobby="1"] .match-header, body[data-lobby="1"] #display-controls { display: none; }
body #room-panel .lobby-top { display: none; }
body[data-lobby="1"] #room-view { max-width: 560px; margin: 0 auto; }
body[data-lobby="1"] #match-layout { display: block; }
body[data-lobby="1"] #room-panel { display: flex; flex-direction: column; gap: 12px; padding: 0 0 8px; background: none; border: 0; box-shadow: none; }
body[data-lobby="1"] #room-panel .lobby-top { display: flex; margin: 0; }
body[data-lobby="1"] #room-panel .lobby-top h2 { flex: 1; }
body[data-lobby="1"] #room-panel #leave { width: auto; min-height: 40px; margin: 0; padding: 0 4px; border: 0; background: none; color: #a1321f; font-size: 15px; font-weight: 700; }
body[data-lobby="1"] #room-panel > .panel-tag, body[data-lobby="1"] #room-hint, body[data-lobby="1"] #invite-tools > summary,
body[data-lobby="1"] #invite-tools > label, body[data-lobby="1"] #invite-tools > .form-note { display: none; }
body[data-lobby="1"] #invite-link { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
body[data-lobby="1"] #room-panel .room-heading { display: block; margin: 0 0 -12px; padding: 18px 20px 4px; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; }
body[data-lobby="1"] #room-code-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--ink-2); }
body[data-lobby="1"] #room-code { margin: 4px 0 0; font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: .04em; color: var(--ink); }
body[data-lobby="1"] #invite-tools { display: block; margin: 0; padding: 12px 20px 16px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); }
body[data-lobby="1"] #invite-tools .invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
body[data-lobby="1"] #invite-tools .invite-actions .secondary { min-height: 46px; font-size: 16px; font-weight: 700; gap: 8px; padding: 0 10px; }
body[data-lobby="1"] #invite-tools .invite-actions svg, body #room-panel .invite-actions svg, body #room-panel #copy-code svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body[data-lobby="1"] #share { background: var(--lime); border-color: var(--lime); }
body[data-lobby="1"] #copy { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 2px 0; text-decoration: none; font-size: 15px; }
body #room-settings.room-settings-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; background: none; }
body #room-settings .chip { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink); }
body[data-lobby="1"] .lobby-players-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 -12px; padding: 14px 16px 10px; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; font-size: 17px; font-weight: 700; color: var(--ink); }
body .lobby-players-heading #players-count { font-size: 15px; font-weight: 600; color: var(--ink-2); }
body[data-lobby="1"] #players { margin: 0; padding: 0 16px 6px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); gap: 0; display: block; }
body[data-lobby="1"] #players .player-row { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 0; margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
body[data-lobby="1"] #players .player-avatar { width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--player); color: var(--ink); border: 0; }
body[data-lobby="1"] #players .player-avatar .avatar-icon { width: 20px; height: 20px; color: var(--ink); --tile: var(--player); }
body[data-lobby="1"] #players .player-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
body .player-name .player-me { font-weight: 500; color: var(--ink-2); }
body[data-lobby="1"] #players .player-badge { font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-2); background: none; padding: 0; }
body[data-lobby="1"] #players .player-row.empty { display: none; }
body[data-lobby="1"] #players .player-report { min-height: 36px; padding: 0 10px; font-size: 13px; }
body[data-lobby="1"] #players .local-player { flex-wrap: wrap; }
body[data-lobby="1"] #players .local-player-controls { flex-basis: 100%; display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; }
body[data-lobby="1"] #local-management { margin: 0; padding: 14px 16px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
body #local-management-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--ink); }
body #local-management-heading #local-free { font-size: 14px; font-weight: 500; color: var(--ink-2); }
body[data-lobby="1"] #local-management > .form-note { display: none; }
body[data-lobby="1"] .local-add-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
body[data-lobby="1"] .local-add-row label { font-size: 0; margin: 0; }
body[data-lobby="1"] .local-add-row input, body[data-lobby="1"] .local-add-row select { width: 100%; min-height: 48px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 15px; padding: 0 12px; color: var(--ink); }
body[data-lobby="1"] .local-add-row .secondary { min-height: 48px; font-size: 15px; font-weight: 700; padding: 0 12px; }
body[data-lobby="1"] #color-selection, body[data-lobby="1"] #turn-order-panel { margin: 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
body[data-lobby="1"] #color-selection h3, body[data-lobby="1"] #turn-order-panel h3 { margin: 0 0 4px; font-size: 16px; color: var(--ink); }
body[data-lobby="1"] #room-ranking-note, body[data-lobby="1"] #room-note { margin: 0; font-size: 13px; color: var(--ink-2); text-align: center; }
body[data-lobby="1"] #start { position: sticky; bottom: 12px; z-index: 5; min-height: 60px; font-size: 18px; justify-content: center; box-shadow: 0 0 0 12px var(--cream); }
body[data-lobby="1"] #start:disabled { opacity: 1; background: #dfe6d3; color: var(--ink-2); }
/* Mockups b and c: sub-screens have their own top bar (back + title) instead of the brand header. */
@media (max-width: 760px) {
  body[data-view="home"][data-sub="setup"] .header, body[data-view="home"][data-sub="join"] .header, body[data-view="home"][data-sub="league"] .header,
  body[data-view="home"][data-sub="local"] .header, body[data-view="room"][data-lobby="1"] .header { display: none; }
  body[data-view="home"][data-sub="setup"] .tabbar, body[data-view="home"][data-sub="join"] .tabbar, body[data-view="home"][data-sub="league"] .tabbar, body[data-view="home"][data-sub="local"] .tabbar { display: none; }
  body[data-view="home"][data-sub="setup"] .sticky-cta { bottom: 0; }
  body[data-sub="setup"] main, body[data-sub="join"] main, body[data-sub="league"] main, body[data-sub="local"] main { padding-bottom: 0; }
}

/* d1–d3: in-game. Dark, flat: top bar, slim player chips, board, turn bar, legend. */
body #game-top { display: flex; align-items: center; gap: 8px; min-height: 52px; margin: 0 0 10px; }
body #game-top .iconbtn { border-color: #3c4438; background: var(--dark-2); color: var(--d-text); width: 40px; height: 40px; }
body #game-top .iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
body #game-more svg circle { fill: currentColor; stroke: none; }
body #game-top .game-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.2; }
body #game-top .game-title strong { font-size: 17px; font-weight: 700; color: var(--d-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body #game-top .game-title small { font-size: 13px; color: var(--d-text-2); }
body #game-top .game-connection { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 11px; color: var(--d-text-2); white-space: nowrap; }
body #game-top .game-connection[hidden] { display: none; }
body #game-top .game-connection i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff9478; }
body #game-top .game-connection.online i { background: var(--lime); }
body #game-top .game-sound { position: relative; font-size: 18px; }
body #game-top .game-sound .sound-slash { left: 18px; top: 6px; }
@media (min-width: 761px) { body #game-top .game-connection, body #game-top .game-sound { display: none; } }
body #game-top #pause-controls { display: contents; }
body #game-top #pause-controls[hidden] { display: none !important; }
body #game-top .pause-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body #pause-game .icon-play { display: none; }
body #pause-controls.is-paused #pause-game .icon-pause { display: none; }
body #pause-controls.is-paused #pause-game .icon-play { display: inline; fill: currentColor; }
body #pause-controls.is-paused #pause-game { background: var(--lime); color: var(--ink); border-color: var(--lime); }
body #pause-game:disabled { opacity: .5; }
body #arena .arena-top { display: none; }
body #arena { background: var(--dark); color: var(--d-text); box-shadow: none; }
body #scoreboard.scoreboard { display: grid; grid-template-columns: repeat(var(--chips, 4), minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
body #scoreboard[data-count="2"] { --chips: 2; } body #scoreboard[data-count="3"] { --chips: 3; }
body #scoreboard[data-count="5"], body #scoreboard[data-count="6"] { --chips: 3; }
body #scoreboard .score { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "dot name name" "value value clock"; align-items: center; column-gap: 6px; row-gap: 2px; min-height: 58px; padding: 8px 9px; opacity: 1; border: 1px solid transparent; border-radius: 12px; background: var(--dark-2); color: var(--d-text); }
body #scoreboard .score.active { border: 2px solid var(--player); padding: 7px 8px; background: #343c35; }
body #scoreboard .score-dot { grid-area: dot; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: var(--player); color: var(--ink); box-shadow: none; --tile: var(--player); }
body #scoreboard .score-dot .avatar-icon { width: 15px; height: 15px; }
body #scoreboard .score-name { grid-area: name; display: block; min-width: 0; font-size: 15px; font-weight: 700; color: var(--d-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body #scoreboard .score.me .score-name { display: flex; align-items: center; gap: 4px; }
body #scoreboard .score-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body #scoreboard .score-self { flex: none; padding: 1px 4px; border-radius: 4px; background: var(--lime); color: var(--ink); font-size: 10px; line-height: 1.4; font-weight: 800; }
body #scoreboard .score-name small:not(.score-detail) { display: none; }
body #scoreboard .score-value { grid-area: value; margin: 0; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--d-text-2); white-space: nowrap; }
body #scoreboard .score-clock { grid-area: clock; justify-self: end; padding-left: 4px !important; display: block; margin: 0; padding: 0; border: 0; background: none; font-size: 15px; font-weight: 700; color: var(--d-text); font-variant-numeric: tabular-nums; }
body #scoreboard .score:not(.active) .score-clock { color: var(--d-text-2); }
body #scoreboard .score-clock.urgent { color: #ff9478; }
body #arena .board { background: var(--board); border-color: #424a3e; border-radius: 16px; }
body .chain-celebration { position: absolute; z-index: 6; top: 12%; left: 50%; transform: translateX(-50%); padding: 8px 12px; border: 1px solid var(--lime); border-radius: 10px; background: var(--dark); color: var(--d-text); font-size: 14px; font-weight: 800; white-space: nowrap; pointer-events: none; }
body .chain-celebration[hidden] { display: none; }
body #board.chain-shake { animation: chain-shake 300ms ease-out; }
@keyframes chain-shake { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(3px); } 60% { transform: translateX(-2px); } }
@media (prefers-reduced-motion: reduce) { body #board.chain-shake { animation: none; } }
body #arena .arena-bottom { display: flex; align-items: center; gap: 14px; margin: 12px 0 0; padding: 14px 16px; border-radius: 16px; background: var(--dark-2); border: 0; }
body #arena .arena-bottom .turn-dot { width: 14px; height: 14px; flex: none; border-radius: 50%; }
body #arena .turn-copy { flex: 1; min-width: 0; }
body #arena .arena-bottom strong#turn-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.25; color: var(--d-text); }
body #arena .arena-bottom span#turn-detail { display: block; margin-top: 2px; font-size: 14px; line-height: 1.35; color: var(--d-text-2) !important; }
body #arena .timer { display: flex; flex-direction: column; align-items: flex-end; margin: 0; padding: 0; border: 0; background: none; min-width: 0; }
body #arena .timer strong#turn-seconds { font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -.02em; color: var(--d-text); font-variant-numeric: tabular-nums; }
body #arena .timer #turn-timer-label { font-size: 13px; color: var(--d-text-2); margin-top: 4px; }
body #arena .timer.urgent strong#turn-seconds { color: #ff9478; }
body #arena .timer .timer-held { display: none; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--d-text-2); }
body #arena .timer-held svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
body #arena.chain-held .timer strong#turn-seconds, body #arena.chain-held .timer #turn-timer-label { display: none; }
body #arena.chain-held .timer .timer-held { display: inline-flex; }
body #arena .board-legend { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 2px 0; font-size: 13px; color: var(--d-text-2); }
body #arena .board-legend #clock-label { display: none; }
body #arena .board-legend .text-link { padding: 4px 0; color: var(--d-text-2); text-decoration: none; font-size: 13px; font-weight: 500; }
body #arena .board-tools { margin: 8px 0 0; display: flex; gap: 10px; align-items: center; }
body #arena .board-tools .secondary { min-height: 36px; padding: 0 12px; font-size: 13px; background: var(--dark-2); color: var(--d-text); border-color: #3c4438; }
body #arena .board-tools span { font-size: 12px; color: var(--d-text-2); }
/* Phones: the game owns the whole screen (mockup d1–d3). */
@media (max-width: 760px) {
  body[data-view="room"]:not([data-lobby="1"]) { background: var(--dark); }
  body[data-view="room"]:not([data-lobby="1"]) .header,
  body[data-view="room"]:not([data-lobby="1"]) .match-motto,
  body[data-view="room"]:not([data-lobby="1"]) .match-header { display: none; }
  body[data-view="room"]:not([data-lobby="1"]) main { padding: 0; }
  body[data-view="room"] #arena:not([hidden]) { border-radius: 0; padding: 8px 12px 16px; scroll-margin-top: 0; }
  body[data-view="room"]:not([data-lobby="1"]) .side { padding: 0 12px 24px; background: var(--dark); }
  body[data-view="room"]:not([data-lobby="1"]) #room-panel, body[data-view="room"]:not([data-lobby="1"]) .practice-panel { background: var(--cream); }
  body[data-view="room"]:not([data-lobby="1"]) #display-controls { display: none; }
  body[data-view="room"][data-sheet="display"] #display-controls { display: block; position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow: auto; margin: 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); border: 0; border-radius: 24px 24px 0 0; background: var(--cream); color: var(--ink); box-shadow: 0 0 0 100vmax rgba(24, 28, 25, .55); }
}
body #display-controls .sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
body #display-close { display: none; }
@media (max-width: 760px) { body[data-sheet="display"] #display-close { display: inline-flex; } }
@media (min-width: 761px) { body #game-more { display: none; } }
body #arena .board-legend { border-top: 0; padding-top: 0; }

/* e1–e3: first-game tour, full screen over the first game. */
body .tutorial-screen { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; max-width: none; width: auto; margin: 0; padding: calc(12px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: var(--cream); color: var(--ink); overflow-y: auto; box-shadow: none; transform: none; }
body .tutorial-screen > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
body .tut-top { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
body .tut-top .eyebrow { color: var(--ink); }
body .tut-skip { border: 0; background: none; padding: 6px 2px; font-size: 16px; font-weight: 700; color: var(--ink); }
body .tut-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; margin-bottom: 14px; }
body .tut-progress i { height: 4px; border-radius: 2px; background: #dcdfd2; }
body .tut-progress i.done { background: var(--ink); }
body .tut-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 16px; border-radius: 22px; background: var(--dark); }
body .tut-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; width: min(100%, 300px); padding: 10px; border: 1px solid #424a3e; border-radius: 14px; background: var(--board); }
body .tut-cell { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: 1px solid var(--cell-line); border-radius: 9px; background: var(--cell); padding: 0; }
body button.tut-cell { cursor: pointer; }
body .tut-cell.target::after { content: ""; position: absolute; inset: -5px; border: 2px dashed var(--lime); border-radius: 12px; pointer-events: none; }
body .tut-cell.target:focus-visible { outline: 2px solid var(--d-text); outline-offset: 5px; }
body .tut-dot { width: 3px; height: 3px; border-radius: 50%; background: #57604e; }
body .tut-orb { position: relative; width: 70%; aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 -3px 0 #00000014; }
body .tut-orb.critical { box-shadow: inset 0 -3px 0 #00000014, 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent); }
body .tut-orb.tutorial-triggered { animation: tutorial-split 320ms ease-out forwards; }
@keyframes tutorial-split { 0% { transform: scale(1); opacity: 1; } 45% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(.15); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { body .tut-orb.tutorial-triggered { animation: none; } }
body .tut-orb i { position: absolute; width: 15%; height: 15%; border-radius: 50%; background: #253027; transform: translate(-50%, -50%); }
body .tut-burst { position: absolute; inset: -4px; border: 2px solid var(--c); border-radius: 50%; box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 18%, transparent); }
body .tut-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; font-size: 14px; font-weight: 600; color: var(--d-text-2); }
body .tut-legend > span { display: inline-flex; align-items: center; gap: 6px; }
body .tut-legend .tut-orb { width: 20px; }
body .tut-mark-target { width: 18px; height: 18px; border: 2px dashed var(--lime); border-radius: 5px; }
body .tut-mark-burst { width: 18px; height: 18px; border: 2px solid var(--lime); border-radius: 50%; }
body .tutorial-screen h2 { margin: 18px auto 6px; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
body .tutorial-screen #tutorial-text { margin: 0 auto; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
body .tut-actions { margin-top: auto !important; padding-top: 16px; }
body .tut-actions .primary { min-height: 56px; justify-content: center; }
body .tut-actions .form-note { margin: 10px 0 0; text-align: center; font-size: 13px; }

/* Match end: the restored portrait and saying lead; scores and analysis remain reachable below. */
body #arena { position: relative; }
body #result.result-sheet { position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; display: flex; flex-direction: column; gap: 12px; padding: 10px 20px 20px; border: 0; border-radius: 24px 24px 0 0; background: var(--cream); color: var(--ink); text-align: left; box-shadow: 0 -1px 0 var(--line); }
body #result.result-sheet[hidden] { display: none; }
body #result .sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: #c9ccbf; margin: 0 auto 4px; }
body #result .result-head { display: flex; align-items: center; gap: 14px; }
body #result .result-avatar { width: 56px; height: 56px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 16px; background: var(--player, var(--lime)); color: var(--ink); --tile: var(--player); }
body #result .result-avatar .avatar-icon { width: 30px; height: 30px; }
body #result .eyebrow { color: var(--ink-2); }
body #result h2#winner { margin: 2px 0 0; font-size: 28px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
body #result .result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
body #result .result-stats > div { display: flex; flex-direction: column-reverse; padding: 12px 14px; }
body #result .result-stats > div + div { border-left: 1px solid var(--line); }
body #result .result-stats dd { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
body #result .result-stats dt { font-size: 14px; color: var(--ink-2); }
body #result #result-description { margin: -4px 0 0; font-size: 13px; line-height: 1.4; color: var(--ink-2); }
body #result .result-proverb { display: flex; align-items: center; gap: 14px; margin: 0; padding: 12px 14px; border-radius: 16px; background: #e8eadf; }
body #result .result-proverb .master-portrait { width: 60%; max-width: 230px; height: auto; aspect-ratio: 5 / 6; flex: none; margin: 0 auto; border-radius: 12px; object-fit: cover; }
body.hide-portraits #result .result-proverb .master-portrait, body #result .result-proverb .master-portrait:not([src]) { display: none; }
body #result .result-proverb blockquote { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink); quotes: "“" "”"; }
body #result .result-proverb blockquote::before { content: open-quote; } body #result .result-proverb blockquote::after { content: close-quote; }
body #result .result-proverb cite { display: block; margin-top: 4px; font-size: 13px; font-style: normal; color: var(--ink-2); }
body #result .result-difficulty { display: grid; gap: 8px; }
body #result .result-difficulty[hidden] { display: none; }
body #result .result-difficulty > span { font-size: 14px; font-weight: 700; }
body #result .result-difficulty .level-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
body #result .result-difficulty button { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 14px; }
body #result .result-difficulty button[aria-pressed="true"] { border-color: var(--dark); background: var(--lime-soft); font-weight: 700; }
body #result #again { min-height: 56px; justify-content: center; gap: 10px; margin: 0; max-width: none; }
body #result #again svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
body #result .result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body #result .result-actions .secondary { min-height: 50px; width: 100%; max-width: none; margin: 0; font-size: 16px; font-weight: 700; border-color: var(--line); }
body #result .result-actions .secondary[hidden] + .secondary { grid-column: 1 / -1; }
body #result .replay-availability { margin: -4px 0 0; font-size: 12px; color: var(--ink-2); }
body #result .replay-availability:empty { display: none; }
@media (max-width: 760px) {
  body #result.result-sheet { position: fixed; z-index: 50; max-height: 86vh; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}
body #result.result-sheet { align-items: stretch; justify-content: flex-start; }
body #result.result-sheet > * { max-width: none; }
body #result .result-actions button { margin-top: 0; }

/* Restore the large, airy v16 cards without changing the board or result controls. */
body #result.result-sheet { position: fixed; z-index: 50; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; gap: 0; padding: 10px 24px max(28px, env(safe-area-inset-bottom)); background: #f4f4ec; box-shadow: 0 -1px 0 #e2e5d8; }
body #result .sheet-handle { width: 36px; background: #d3d6c9; margin: 0 auto 18px; }
body #result .result-head { flex-direction: column; text-align: center; gap: 12px; }
body #result .result-avatar { width: 24px; height: 24px; border-radius: 0; background: #5e7d3a; clip-path: none;
  -webkit-mask: var(--thin-star) center / contain no-repeat; mask: var(--thin-star) center / contain no-repeat;
  --thin-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M12 2v20M2 12h20M4.9 4.9l14.2 14.2M19.1 4.9 4.9 19.1'/%3E%3C/svg%3E"); }
body #result .result-avatar > * { display: none; }
body #result .eyebrow { font-size: 10px; font-weight: 600; letter-spacing: .2em; color: var(--ink-2); }
body #result h2#winner { margin: 8px 0 0; font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
body #result #result-description { margin: 12px 0 24px; font-size: 13px; line-height: 1.5; color: var(--ink-2); text-align: center; }
body #result .result-proverb { flex-direction: column; gap: 0; margin: 0; padding: 0; background: none; text-align: center; }
body #result .result-proverb blockquote { margin: 24px 0 10px; font-size: 18px; font-weight: 500; line-height: 1.5; letter-spacing: 0; color: #38472e; }
body #result .result-proverb cite { font-size: 13px; font-style: normal; line-height: 1.5; color: #5b6057; }
body #result #again { align-self: center; width: 100%; max-width: 315px; min-height: 50px; margin: 28px auto 0; border-radius: 12px; background: #cdeea0; box-shadow: none; font-size: 16px; font-weight: 600; gap: 8px; }
body #result #again svg { width: 18px; height: 18px; stroke-width: 1.8; }
body #result .result-stats { margin: 28px 0 0; padding-top: 18px; border: 0; border-top: 1px solid #e2e5d8; border-radius: 0; background: none; }
body #result .result-stats > div { align-items: center; padding: 0 6px; text-align: center; gap: 2px; }
body #result .result-stats > div + div { border-left: 0; }
body #result .result-stats dd { font-size: 18px; font-weight: 600; letter-spacing: 0; }
body #result .result-stats dt { font-size: 12px; }
body #result .result-difficulty { margin-top: 20px; }
body #result .result-actions { margin-top: 18px; gap: 8px; }
body #result .result-actions .secondary { min-height: 44px; border: 0; background: none; color: var(--accent-text); font-size: 14px; font-weight: 600; }
body #result .result-actions .secondary:hover:not(:disabled) { background: #ebeddf; }
body #result .replay-availability { margin: 8px 0 0; text-align: center; }
body #result #result-league-rating { margin: 20px 0 0; flex-shrink: 0; }
body #result.result-sheet > * { flex-shrink: 0; }

/* Separate skill pools, sharing the existing period tabs. */
.rating-pool-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; max-width: 700px; margin: 20px 0; }
.rating-pool-tabs button { min-height: 70px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 16px; text-align: left; background: var(--surface); color: var(--ink); font-size: 17px; font-weight: 750; }
.rating-pool-tabs small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; }
.rating-pool-tabs button[aria-selected="true"] { background: var(--dark); color: var(--cream,#f2f1e9); border-color: var(--dark); }
.rating-pool-tabs button[aria-selected="true"] small { color: var(--lime); }
.rating-explainer { margin: 22px 0 32px; max-width: 760px; color: var(--ink-2); }
.rating-explainer summary { padding: 12px 0; cursor: pointer; font-weight: 700; color: var(--ink); }
.rating-explainer p { font-size: 14px; line-height: 1.65; }
.profile-ratings { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.profile-ratings section { padding: 14px; background: var(--cream,#f2f1e9); border-radius: 14px; min-width: 0; }
.profile-ratings h3 { margin: 0 0 7px; font-size: 15px; }
.profile-ratings p { margin: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
#result-league-rating { font-size: 14px; line-height: 1.6; padding: 12px 14px; background: var(--lime-soft); border-radius: 12px; }
@media (max-width: 380px) { .profile-ratings { grid-template-columns: 1fr; } }

/* Shared selection and navigation treatments across search, standings and profile. */
.league-mode-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.league-mode-tabs button { border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--surface); color: var(--ink); padding: 12px; min-height: 64px; font-weight: 700; text-align: left; }
.league-mode-tabs small { display: block; margin-top: 4px; font-weight: 400; font-size: 12px; }
.league-mode-tabs [aria-selected="true"] { background: var(--dark); color: var(--cream); border-color: var(--dark); }
.league-mode-tabs [aria-selected="true"] small { color: var(--lime); }
.league-mode-tabs button:focus-visible, .rating-pool-tabs button:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; }
body :is(.sub-back,.back-button) { min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-btn); color: var(--ink); background: var(--surface); }
body footer a, body footer a:visited { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.match-fill-status { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--lime-soft); color: var(--ink); font-variant-numeric: tabular-nums; }
#open-league-note { grid-column: 1 / -1; margin: 0; }
.training-card { padding: 22px; margin: 14px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.training-card h3 { margin: 8px 0 16px; font-size: 20px; }
.training-card progress { display: block; width: 100%; height: 12px; margin: 12px 0 6px; accent-color: #567536; }
.training-card small { color: var(--ink-2); }
.training-card details { font-size: 13px; line-height: 1.6; }
.training-card summary { min-height: 44px; cursor: pointer; padding: 12px 0; font-weight: 600; }
.training-badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 16px 0; }
.training-badges li { border: 1px dashed var(--line); color: var(--ink-2); padding: 6px 10px; border-radius: 20px; font-size: 12px; }
.training-badges li.earned { border-style: solid; background: var(--lime-soft); color: var(--ink); }
.training-receipt { padding: 14px; border-radius: 12px; background: var(--lime-soft); color: var(--ink); font-size: 14px; line-height: 1.5; }
.result-placements { text-align: left; margin: 14px 0; padding-left: 28px; line-height: 1.8; font-size: 14px; }
#arena > .toast { position: static; transform: none; max-width: none; margin: 10px 0; box-shadow: none; text-align: left; border-color: #637452; }
#master-placement-note { color: var(--ink); font-size: 13px; line-height: 1.5; background: var(--lime-soft); padding: 10px; margin: -10px 0 16px; border-radius: 10px; }
@media (max-width: 480px) {
  .rating-pool-tabs { gap: 6px; }
  .rating-pool-tabs button { padding: 10px 8px; font-size: 13px; min-height: 66px; border-radius: 12px; }
  .rating-pool-tabs small { font-size: 11px; }
  .training-card { padding: 18px; }
}
