.arcade {
  --panel: #252e3c;
  --edge: #465160;
  --quiet: #b5c0ce;
  --amber: #edc27a;
  min-height: 100svh;
  background: radial-gradient(ellipse at 20% 18%, #2a3442 0, transparent 57%), #202733;
}
.glyphs, .sr-game { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(100%); }
.glyph { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.arcade-wrap { width: min(1240px, calc(100% - clamp(40px, 9vw, 152px))); margin-inline: auto; }
.arcade-header { background: #1d2430; border-bottom: 1px solid var(--line); }
.arcade-nav, .arcade-tools, .arcade-brand, .arcade-language, .exit-game { display: flex; align-items: center; }
.arcade-nav { justify-content: space-between; min-height: 66px; }
.arcade-brand { gap: 14px; color: #dce3ea; font-size: 1rem; font-weight: 620; letter-spacing: -.025em; }
.arcade-brand .brand-mark { width: 34px; }
.brand-slash { font-size: 1.1rem; color: #798797; font-weight: 320; }
.arcade-tools { gap: 18px; }
#sound, .drive-btn, .action-btn { cursor: pointer; }
#sound { display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--quiet); width: 40px; height: 40px; }
#sound:hover, #sound[aria-pressed="true"] { color: var(--mint); background: #b7d89412; }
#sound .glyph { width: 19px; }
.arcade-language { gap: 3px; padding: 3px; border: 1px solid #414b58; border-radius: 5px; }
.arcade-language a { font: 600 .69rem/1 var(--font-mono); padding: 6px 7px; border-radius: 2px; color: var(--quiet); }
.arcade-language [aria-current] { color: #1a2530; background: var(--green); }
.exit-game { gap: 8px; padding: 4px 0 4px 20px; border-left: 1px solid var(--edge); color: #d7dfe7; font-size: .81rem; font-weight: 550; }
.exit-game .glyph { width: 15px; }
.exit-game:hover, .arcade-language a:hover:not([aria-current]) { color: var(--mint); }
.game { padding-bottom: 40px; }
.game-intro { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: clamp(24px, 4vh, 48px) 0; }
.game-intro h1 { font-size: clamp(3rem, 5.6vw, 5.1rem); letter-spacing: -.072em; line-height: 1; font-weight: 625; }
.game-intro h1 span { color: var(--green); }
.game-intro p { color: var(--muted); font-size: clamp(.9rem, 1.12vw, 1.04rem); line-height: 1.5; max-width: 33ch; }
.console-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(235px, 23vw, 310px); grid-template-rows: auto 1fr; grid-template-areas: "stage plan" "stage drive"; gap: 16px 20px; align-items: start; }
.board-panel, .auxiliary { border: 1px solid #414c5a; background: var(--panel); border-radius: 10px; }
.board-panel { grid-area: stage; overflow: hidden; min-width: 0; }
.board-header, .hall-heading, .board-status, .board-footer, .load-counter, .action-btn { display: flex; align-items: center; }
.board-header, .board-footer { justify-content: space-between; gap: 12px; padding-inline: clamp(14px, 1.9vw, 25px); }
.board-header { min-height: 57px; border-bottom: 1px solid #485361; background: #2a3342; }
.hall-heading { gap: 14px; min-width: 0; }
.hall-id { flex-shrink: 0; border: 1px solid #687963; border-radius: 3px; background: #b7d8940c; color: var(--green); padding: 5px 7px; font: 600 .66rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.hall-id b { font-weight: inherit; }
.hall-heading h2 { font-size: clamp(.98rem, 1.55vw, 1.2rem); font-weight: 610; letter-spacing: -.035em; line-height: 1.15; }
.board-status { gap: 7px; color: #ccd5dd; font: 500 .69rem/1 var(--font-mono); white-space: nowrap; }
.board-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px #b7d89444; }
[data-phase="lost"] .board-status i, [data-phase="paused"] .board-status i { background: var(--amber); }
.board-surface { position: relative; isolation: isolate; background-color: #1b222d; background-image: radial-gradient(circle, #586b7838 .8px, transparent 1px), radial-gradient(ellipse at center, #2a3542 0, #1b232e 76%); background-size: 15px 15px, 100% 100%; }
.game-canvas { width: 100%; height: auto; display: block; aspect-ratio: 1.60; max-height: clamp(365px, calc(100svh - 298px), 590px); }
.stage-corners { position: absolute; inset: 13px; pointer-events: none; opacity: .65; }
.stage-corners i { position: absolute; width: 8px; height: 8px; border-color: #8998a5; border-style: solid; }
.stage-corners i:nth-child(1) { top: 0; left: 0; border-width: 1px 0 0 1px; }
.stage-corners i:nth-child(2) { top: 0; right: 0; border-width: 1px 1px 0 0; }
.stage-corners i:nth-child(3) { bottom: 0; left: 0; border-width: 0 0 1px 1px; }
.stage-corners i:nth-child(4) { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.stage-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; min-height: 28px; padding: 4px 20px 8px; background: #1b222d; }
.stage-legend span { display: inline-flex; align-items: center; gap: 5px; color: #bac4cd; font: 500 .64rem/1 var(--font-mono); }
.stage-legend .glyph { width: 15px; height: 15px; color: var(--green); }
.stage-legend [data-legend="parcel"] .glyph, .dispatch-note[data-kind="parcel"] .glyph { color: var(--amber); }
.stage-legend [data-legend="dock"] .glyph, .dispatch-note[data-kind="dock"] .glyph { color: #91ddd2; }
.stage-legend [data-legend="belt"] .glyph { color: #93ccf1; }
.stage-legend [data-legend="forklift"] .glyph { color: #f2a866; }
.stage-legend [data-legend="gate"] .glyph, .dispatch-note[data-kind="gate"] .glyph { color: #c5a5e7; }
.dispatch-note { position: absolute; left: 20px; top: 15px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 40px); padding: 5px 8px; border: 1px solid #8ca1a936; border-radius: 3px; color: #e5ebe6; background: #202937ee; font: 540 .68rem/1.25 var(--font-mono); pointer-events: none; }
.dispatch-note .glyph { width: 14px; height: 14px; flex-shrink: 0; }
.board-message { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); width: max-content; max-width: 87%; padding: 15px 23px; text-align: center; color: var(--text); background: #1e2733f5; border: 1px solid #74816f; box-shadow: 0 5px 28px #151b26a6; border-radius: 7px; }
.board-message strong, .board-message span { display: block; }
.board-message strong { font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.3; letter-spacing: -.035em; }
.board-message span { margin-top: 4px; color: var(--quiet); font-size: .86rem; line-height: 1.5; }
.board-message[hidden] { display: none; }
.board-footer { min-height: 77px; background: #28313f; border-top: 1px solid var(--edge); }
.load-counter { gap: 12px; }
.load-icon { color: var(--amber); display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid #655e51; border-radius: 5px; background: #c6a76a09; }
.load-icon .glyph { width: 23px; height: 23px; }
.counter-label { display: block; font: 550 .62rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .085em; color: var(--quiet); }
.load-counter p { margin-top: 3px; color: #97a5b5; font: 520 .9rem/1 var(--font-mono); }
.load-counter b { color: var(--text); font-size: 1.12rem; font-weight: 650; }
.run-counters, .cargo-counter > div { display: flex; align-items: center; }
.run-counters { gap: clamp(12px, 2.1vw, 30px); }
.cargo-counter { padding-left: clamp(12px, 1.8vw, 24px); border-left: 1px solid #515d6a; }
.cargo-counter > div { gap: 4px; margin-top: 4px; font: 560 .83rem/1.1 var(--font-mono); }
.cargo-counter i { width: 9px; height: 9px; border: 1px solid #a8997c; border-radius: 1px; }
.cargo-counter i:first-of-type { margin-left: 2px; }
.cargo-counter i.is-loaded { background: var(--amber); border-color: var(--amber); }
.action-btn { justify-content: center; min-height: 43px; min-width: 145px; gap: 9px; padding: 10px 17px; border: 1px solid transparent; background: var(--green); border-radius: 5px; color: #202b27; font-size: .86rem; font-weight: 700; }
.action-btn .glyph { width: 16px; height: 16px; }
.action-btn:hover { background: var(--mint); }
[data-phase="running"] .action-btn { color: #e0e9de; background: #313d44; border-color: #67766b; }
[data-phase="running"] .action-btn:hover { background: #3d494c; }
.auxiliary { padding: clamp(18px, 1.75vw, 25px); }
.auxiliary h2 { font-size: 1.13rem; font-weight: 620; letter-spacing: -.035em; line-height: 1.3; }
.plan-panel { grid-area: plan; }
.shift-plan { list-style: none; padding: 0; margin: 16px 0 0; }
.shift-stop { position: relative; color: #bec8d4; }
.hall-selector { position: relative; display: grid; grid-template-columns: 30px 1fr 16px; align-items: center; gap: 13px; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 4px; background: transparent; text-align: left; color: inherit; }
.hall-selector:enabled { cursor: pointer; }
.hall-selector:enabled:hover { background: #b7d89410; color: var(--mint); }
.hall-selector:disabled { opacity: 1; }
.shift-stop:not(:last-child)::after { content: ''; position: absolute; left: 14.5px; top: calc(50% + 16px); height: calc(100% - 32px); border-left: 1px dashed #65717e; }
.stop-index { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 4px; border: 1px solid #4d5b6a; background: #293340; color: #b1becd; font: 530 .75rem/1 var(--font-mono); }
.stop-name { font-weight: 560; font-size: .9rem; letter-spacing: -.012em; line-height: 1.2; }
.stop-name small { display: block; margin-top: 4px; font: 450 .68rem/1.2 var(--font-mono); color: #aab7c6; }
.stop-state { color: #8492a0; }
.stop-state .glyph { width: 14px; height: 14px; }
.shift-stop[aria-current] .stop-index { border-color: var(--green); background: var(--green); color: #222d29; }
.shift-stop[aria-current] .stop-name, .shift-stop[aria-current] .stop-state, .shift-stop.is-done .stop-state { color: var(--mint); }
.drive-panel { grid-area: drive; }
.keys-copy { color: var(--quiet); font-size: .79rem; margin: 6px 0 12px; }
.drive-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.drive-btn { min-height: 39px; display: flex; justify-content: center; align-items: center; gap: 9px; color: #d8e3db; border: 1px solid #52606c; border-bottom-width: 2px; background: #303b49; border-radius: 5px; touch-action: manipulation; user-select: none; }
.drive-btn:hover { border-color: #9cba90; background: #3b474d; }
.drive-btn:active, .drive-btn.is-pressed { color: #202a25; background: var(--green); border-color: var(--green); }
.drive-btn .glyph { width: 20px; height: 20px; }
.drive-btn[data-dir="left"] .glyph { transform: rotate(-90deg); }
.drive-btn[data-dir="down"] .glyph { transform: rotate(180deg); }
.drive-btn[data-dir="right"] .glyph { transform: rotate(90deg); }
.drive-btn kbd { font: 500 .73rem/1 var(--font-mono); opacity: .8; }
.wait-btn { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 40px; margin-top: 7px; padding: 5px; background: #3a3630; border: 1px solid #8c795f; border-radius: 5px; color: #f1d5a5; font-size: .78rem; cursor: pointer; touch-action: manipulation; }
.wait-btn:disabled { opacity: .65; cursor: default; }
.wait-btn.is-queued, .wait-btn:enabled:hover { color: #2b2720; background: var(--amber); }
.wait-btn .glyph { width: 16px; height: 16px; }
.wait-btn kbd { font: 500 .7rem/1 var(--font-mono); padding: 3px 4px; border-radius: 2px; border: 1px solid currentColor; }
.key-pause { display: flex; align-items: center; justify-content: space-between; color: var(--quiet); font-size: .78rem; margin: 11px 0 0; }
.key-pause kbd { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #4e5b68; border-radius: 3px; padding: 2px 6px; font: 480 .67rem/1.4 var(--font-mono); }
.key-pause .glyph { width: 13px; height: 13px; }
.drive-help { border-top: 1px solid #44505e; margin-top: 16px; padding-top: 14px; color: var(--quiet); font-size: .8rem; line-height: 1.5; }
.touch-hint { display: none; }
.arcade [hidden] { display: none; }
@media (pointer: coarse) {
  .keyboard-hint, .drive-btn kbd, .wait-btn kbd, .key-pause { display: none; }
  .touch-hint { display: inline; }
}
@media (min-width: 781px) and (max-height: 790px) {
  .arcade-nav { min-height: 56px; }
  .game-intro { padding: 21px 0; }
  .game-intro h1 { font-size: clamp(3rem, 5.2vw, 4rem); }
  .board-header { min-height: 49px; }
  .board-footer { min-height: 65px; }
  .game-canvas { max-height: clamp(320px, calc(100svh - 325px), 590px); }
  .auxiliary { padding-block: 16px; }
  .shift-plan { margin-top: 10px; }
}
@media (max-width: 780px) {
  .arcade-wrap { width: min(650px, calc(100% - 32px)); }
  .console-layout { grid-template-columns: minmax(0, 1fr) minmax(0,1fr); grid-template-rows: auto auto; grid-template-areas: "stage stage" "drive plan"; gap: 14px; }
  .game-intro { gap: 18px; }
  .game-intro p { font-size: .86rem; max-width: 28ch; }
  .game-canvas { max-height: none; }
}
@media (max-width: 560px) {
  .arcade-nav { min-height: 52px; }
  .arcade-tools { gap: 7px; }
  .arcade-brand { gap: 8px; font-size: .87rem; }
  .arcade-brand .brand-mark { width: 29px; }
  .exit-game { padding: 4px 0 4px 10px; font-size: .73rem; gap: 4px; }
  .arcade-language a { padding: 7px 5px; }
  #sound { width: 36px; }
  .game-intro { display: block; padding: 18px 0 15px; }
  .game-intro h1 { font-size: clamp(2.6rem, 10.6vw, 3.3rem); }
  .game-intro p { margin-top: 7px; max-width: 50ch; font-size: .81rem; line-height: 1.4; }
  .console-layout { display: flex; flex-direction: column; gap: 12px; }
  .console-layout > * { width: 100%; }
  .board-panel { order: 0; }
  .drive-panel { order: 1; }
  .plan-panel { order: 2; }
  .game-canvas { aspect-ratio: 1.35; }
  .stage-legend { min-height: 22px; padding: 3px 9px 6px; gap: 4px 9px; }
  .stage-legend span { font-size: .57rem; }
  .stage-legend .glyph { width: 12px; height: 12px; }
  .stage-corners { inset: 7px; }
  .board-header { min-height: 43px; gap: 6px; padding: 7px 10px; }
  .hall-heading { gap: 7px; }
  .hall-heading h2 { font-size: .91rem; }
  .hall-id { font-size: .59rem; padding: 5px; }
  .board-status { font-size: .59rem; gap: 4px; }
  .board-status i { width: 5px; height: 5px; }
  .board-footer { min-height: 61px; }
  .dispatch-note { left: 8px; top: 6px; font-size: .6rem; max-width: calc(100% - 16px); padding: 3px 5px; }
  .run-counters { gap: 8px; }
  .cargo-counter { padding-left: 8px; }
  .cargo-counter i { display: none; }
  .game:not([data-hall-number="1"]) .load-icon { display: none; }
  .action-btn { min-width: auto; padding-inline: 12px; }
  .load-counter { gap: 8px; }
  .load-icon { width: 30px; height: 32px; }
  .load-icon .glyph { width: 18px; }
  .auxiliary { padding: 15px; }
  .drive-panel { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; }
  .drive-panel h2 { align-self: end; }
  .keys-copy { margin: 0; align-self: start; font-size: .7rem; }
  .drive-pad { grid-column: 2; grid-row: 1 / 3; }
  .drive-btn { min-height: 44px; }
  .wait-btn { grid-column: 2; min-height: 44px; margin-top: 1px; }
  .key-pause { display: none; }
  .drive-help { grid-column: 1 / -1; font-size: .76rem; margin: 8px 0 0; padding-top: 8px; }
  .shift-plan { margin: 8px 0 0; }
}
@media (max-width: 365px) {
  .arcade-wrap { width: calc(100% - 20px); }
  .arcade-tools { gap: 3px; }
  .brand-slash { display: none; }
  .drive-panel { column-gap: 8px; }
}
