/* Game-first layout. Each state has one primary action per device. */
:root { --z-world: 0; --z-hud: 1; --z-controls: 2; --z-overlay: 3; --z-modal: 4; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body { min-height: 100vh; min-height: 100dvh; }
.shell { width: min(642px, calc(100% - 48px)); }
.site-header { height: 60px; }
main { padding: 28px 0 0; }
.game-layout { grid-template-columns: 1fr; gap: 20px; }
.intro { position: relative; top: auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -.05em; white-space: nowrap; }
summary { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 44px; padding: 0 8px; color: var(--muted); font-size: .75rem; cursor: pointer; list-style: none; touch-action: manipulation; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font: .85rem var(--mono); }
details[open] > summary::after { content: '−'; }
summary:hover { color: var(--ink); }
summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button, summary { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.help { min-width: 0; max-width: 300px; }
.help-copy { padding: 8px 0 16px; color: var(--muted); font-size: .8rem; line-height: 1.9; overflow-wrap: anywhere; }
.help-copy p { margin: 0 0 10px; }
.mobile-hint { display: none; }
.play-area { width: 100%; }
.scoreboard { grid-template-columns: 1fr 1fr auto; border: 0; border-bottom: 1px solid var(--line); }
.stat { padding: 0 16px 16px 0; border: 0; }
.label { font-size: .7rem; letter-spacing: .04em; }
.value { margin-top: 4px; font-size: 1.7rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.action-group { display: flex; align-items: center; }
.game-button { min-height: 44px; min-width: 72px; padding: 0 14px; border: 1px solid var(--line); background: transparent; font-size: .75rem; letter-spacing: 0; }
.game-state { min-height: 0; justify-content: flex-start; gap: 12px; padding: 10px 0 0; border: 0; font-size: .65rem; }
.game-controls { position: relative; display: flex; justify-content: space-between; min-height: 58px; padding: 6px 0; gap: 8px; border: 0; background: transparent; }
.difficulty-group { gap: 12px; }
.control-label { font-size: .65rem; letter-spacing: .04em; }
.difficulty-list { gap: 2px; }
.difficulty-button { min-height: 36px; height: auto; min-width: 54px; padding: 0 10px; border: 1px solid transparent; font-family: var(--sans); font-size: .75rem; letter-spacing: 0; }
.difficulty-button:last-child { border: 1px solid transparent; }
.difficulty-button[aria-pressed="true"] { border-color: var(--ink); }
.difficulty-button:disabled:not([aria-pressed="true"]) { opacity: .5; }
.appearance > summary { padding-right: 0; }
.skin-controls { position: absolute; top: 100%; left: 0; right: 0; z-index: var(--z-overlay); display: flex; align-items: center; flex-wrap: wrap; padding: 16px; gap: 12px; min-height: 0; border: 1px solid var(--line); background: var(--panel); }
.skin-group { padding: 0; gap: 12px; flex-wrap: wrap; }
.skin-list { flex-wrap: wrap; gap: 4px; }
.skin-button { min-height: 44px; min-width: 60px; padding: 0 12px; border: 1px solid var(--line); font-size: .7rem; letter-spacing: .02em; }
.skin-button:last-child { border-right: 1px solid var(--line); }
.redeem-button { min-height: 44px; min-width: 78px; padding: 0 8px; border: 0; background: transparent; font-family: var(--sans); font-size: .75rem; letter-spacing: 0; }
.board-wrap { box-sizing: content-box; z-index: var(--z-world); isolation: isolate; }
.board-wrap canvas { position: relative; z-index: var(--z-world); pointer-events: none; }
.start-screen, .message { z-index: var(--z-overlay); padding: 24px; pointer-events: none; background: rgb(11 12 12 / .84); }
.start-copy, .message-copy { pointer-events: auto; }
.start-button { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; min-width: 172px; padding: 0 20px; font-family: var(--sans); font-size: .85rem; letter-spacing: .04em; }
.start-button:hover { background: #fff; }
.start-copy p { font-size: .65rem; line-height: 1.9; color: var(--muted); }
.pause-overlay { top: 50%; left: 50%; z-index: var(--z-overlay); min-width: 160px; padding: 18px 20px 10px; text-align: center; transform: translate(-50%, -50%); pointer-events: auto; }
.pause-overlay strong { font-family: var(--sans); font-size: 1rem; letter-spacing: .02em; }
.pause-overlay span { font-size: .6rem; }
.secondary-button { min-height: 44px; margin-top: 8px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font-size: .75rem; cursor: pointer; touch-action: manipulation; }
.secondary-button:hover { color: var(--ink); }
.message-title { font-size: 1.8rem; }
.message-text:empty { display: none; }
.message .start-button { margin-top: 20px; }
.game-over-stats { margin-top: 20px; }
.game-over-stat span { font-family: var(--sans); letter-spacing: 0; }
.modal { z-index: var(--z-modal); }
.touch-controls { position: relative; z-index: var(--z-controls); grid-template-columns: 1fr 1fr; align-items: center; gap: 16px; margin-top: 18px; padding-bottom: max(24px, calc(16px + env(safe-area-inset-bottom))); touch-action: manipulation; }
.direction, .skill-button, .func-button, .difficulty-button, .skin-button, .redeem-button, .game-button, .start-button { touch-action: manipulation; }
.skill-controls { display: grid; grid-template-columns: repeat(2, 1fr); justify-items: center; gap: 8px; width: 100%; }
.skill-button { display: grid; width: clamp(56px, 16.4vw, 64px); height: clamp(56px, 16.4vw, 64px); place-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); cursor: pointer; font-family: var(--sans); font-size: .75rem; text-align: center; -webkit-tap-highlight-color: transparent; }
.skill-button strong { font: .55rem var(--mono); }
.skill-button strong:empty { display: none; }
.skill-button[data-state="active"] { border-color: var(--ink); background: var(--panel-hover); }
.skill-button[data-state="cooldown"] { color: var(--muted); }
.func-button { grid-column: 1 / -1; display: grid; width: 72px; min-height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 22px; background: transparent; color: var(--ink); cursor: pointer; font-size: .75rem; }
.func-button:enabled:hover, .func-button:enabled:active { border-color: var(--ink); }
.site-footer { margin-top: 28px; padding: 18px 0 max(24px, calc(16px + env(safe-area-inset-bottom))); }
[data-debug-ui-hitbox="true"] button { outline: 1px dashed var(--ink); outline-offset: -1px; }
@media (max-width: 760px) {
  .shell { width: min(642px, calc(100% - 32px)); }
  .site-header { height: 52px; }
  main { padding-top: 20px; }
  .game-layout { gap: 16px; }
  h1 { font-size: 1.7rem; padding-top: 6px; }
  .desktop-hint { display: none; }
  .pause-overlay .desktop-hint { display: none; }
  .mobile-hint { display: block; }
  .help { max-width: 220px; }
  .help-copy { font-size: .7rem; }
  .stat { padding: 0 12px 12px 0; }
  .value { font-size: 1.5rem; }
  .game-controls { grid-template-columns: none; }
  .difficulty-group { gap: 8px; }
  .difficulty-button { min-height: 44px; min-width: 48px; padding: 0 8px; }
  #pause-button { display: none; }
  .direction-grid { grid-template-columns: repeat(3, clamp(44px, 13.4vw, 52px)); gap: 5px; }
  .direction { width: clamp(44px, 13.4vw, 52px); height: 48px; }
  .touch-controls { gap: 12px; }
  .site-footer { margin-top: 12px; }
}
