/* finesse · product · warm charcoal + muted gold · game stage + thumb controls · original pixel art · feedback-only motion */
:root {
  color-scheme: dark;
  --page: #171613;
  --panel: #211f1a;
  --panel-2: #2c2923;
  --ink: #eee9dd;
  --muted: #b8b1a2;
  --soft: #969080;
  --accent: #d5b277;
  --accent-dark: #211b12;
  --accent-soft: #d5b2771a;
  --border: #e6dcc21c;
  --stage: #0b0c0b;
  --cover: #0b0c0bc7;
  --danger: #edb7a7;
  --shadow: #0b0c0b66;
  --focus: #e5c994;
  --font: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: clip; }
body { background: var(--page); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.6; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: none; user-select: none; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible, a:focus-visible, #screen:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
button { transition: background 120ms ease, transform 120ms ease; }
button:active, button.is-held { transform: translateY(1px); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.game-layout, .page-footer { width: min(100% - 24px, 1200px); margin-inline: auto; }
.identity { display: flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; pointer-events: auto; }
.home-arrow { width: 14px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.identity img { image-rendering: pixelated; border-radius: 4px; }
.identity strong { font-size: 15px; font-weight: 650; letter-spacing: .04em; }
.subtitle { font-size: 11px; color: var(--muted); padding-left: 8px; border-left: 1px solid var(--border); }
.game-layout { display: block; margin-top: 8px; }
.player { min-width: 0; padding: 0 12px 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 55px -30px var(--shadow); }
.player-toolbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 8px; }
.status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.toolbar-actions { display: flex; gap: 4px; }
.toolbar-actions button { display: flex; gap: 5px; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; background: transparent; border: 0; padding: 8px 10px; font-size: 12px; color: var(--muted); border-radius: 7px; white-space: nowrap; }
.toolbar-actions button:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); }
.toolbar-actions svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#sound[aria-pressed="false"] { color: var(--soft); text-decoration: line-through; }
.play-deck { display: grid; grid-template-columns: minmax(144px, 1fr) minmax(0, 720px) minmax(160px, 1fr); grid-template-areas: "move screen actions"; gap: 16px; align-items: end; }
.screen-wrap { grid-area: screen; position: relative; width: min(100%, calc((100svh - 120px) * .75), 720px); aspect-ratio: 3 / 4; margin: 0 auto; background: var(--stage); overflow: clip; }
#screen { width: 100%; height: 100%; outline-offset: -2px; }
#screen canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.launch-cover { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: var(--stage); }
.cover-art { position: absolute; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: .3; }
.cover-content { position: relative; width: 100%; padding: 24px 18px; background: var(--cover); }
.cover-label { color: var(--accent); font-size: 11px; letter-spacing: .3em; }
h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.35; letter-spacing: .2em; margin: 20px 0 12px; font-weight: 650; overflow-wrap: anywhere; min-width: 0; }
h1 span { display: block; font-size: .43em; letter-spacing: .4em; color: var(--accent); margin-top: 6px; }
.cover-content p { font-size: 13px; color: var(--muted); margin: 0 0 28px; }
.start-button { display: flex; justify-content: space-between; align-items: center; gap: 45px; margin: 0 auto; background: var(--accent); color: var(--accent-dark); padding: 13px 23px; border: 0; border-radius: 8px; min-height: 48px; font-size: 15px; font-weight: 650; white-space: nowrap; }
.start-button:hover { filter: brightness(1.08); }
.start-note { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; }
.player-footnote { display: none; }
.move-controls { grid-area: move; justify-self: center; padding-bottom: 12px; }
.action-controls { grid-area: actions; justify-self: center; width: 100%; max-width: 160px; padding-bottom: 12px; }
.control-caption { display: block; margin-top: 12px; text-align: center; color: var(--muted); font-size: 11px; white-space: nowrap; }
.control-caption kbd { margin-left: 5px; }
.dpad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; }
.pad { display: grid; place-items: center; padding: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
.pad:hover:not(:disabled), .pad.is-held { background: var(--accent-dark); border-color: var(--accent); color: var(--accent); }
.pad svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.up { grid-area: 1 / 2; }.left { grid-area: 2 / 1; }.right { grid-area: 2 / 3; }.down { grid-area: 3 / 2; }
.dpad-center { grid-area: 2 / 2; place-self: center; width: 5px; height: 5px; border-radius: 50%; background: var(--soft); }
.action-cluster { position: relative; width: 100%; height: 116px; }
.action-button { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--border); border-radius: 50%; background: var(--panel-2); color: var(--ink); padding: 0; font-size: 12px; }
.action-button svg, .softkeys svg, .special-controls svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.action-button:hover:not(:disabled), .action-button.is-held { border-color: var(--accent); background: var(--accent-dark); }
.hook { width: 60px; height: 60px; top: 0; left: 0; }
.fire { width: 88px; height: 88px; bottom: 0; right: 0; border: 0; background: var(--accent); color: var(--accent-dark); font-size: 16px; font-weight: 650; box-shadow: 0 5px 12px -4px var(--shadow); }
.fire svg { width: 26px; height: 26px; }
.fire small { font-size: 11px; font-weight: 400; }
.fire:hover:not(:disabled), .fire.is-held { background: var(--focus); color: var(--accent-dark); }
kbd { font-family: var(--font); font-size: 10px; color: var(--soft); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-weight: 400; white-space: nowrap; }
.utility-controls { position: relative; display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 4px; }
.softkeys, .special-controls { display: flex; gap: 8px; }
.utility-controls button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; background: transparent; border-radius: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.utility-controls svg { width: 16px; height: 16px; }
.utility-controls button:hover, .utility-controls button.is-held { border-color: var(--accent); }
.page-footer { display: flex; justify-content: space-between; gap: 16px; color: var(--soft); font-size: 11px; padding: 22px 0 20px; }
.page-footer a:hover { color: var(--accent); }
.error-panel { position: absolute; inset: 0; z-index: 3; padding: 26px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; background: var(--cover); }
.error-panel strong { color: var(--danger); }
.error-panel p { overflow-wrap: anywhere; font-size: 12px; color: var(--muted); }
.error-panel button { min-height: 44px; padding: 9px 20px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); }
.player:fullscreen { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; background: var(--page); border: 0; border-radius: 0; padding: 0 12px 6px; }
@media (max-width: 860px) {
  .game-layout { width: 100%; margin-top: 0; }
  .player, .player:fullscreen { padding: 0 0 max(4px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; }
  .player-toolbar { padding-inline: 12px; }
  .toolbar-actions button span { display: none; }
  .play-deck { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "screen screen" "move actions"; gap: 8px; }
  .move-controls, .action-controls { padding-bottom: 0; }
  .control-caption { display: none; }
  .screen-wrap { width: min(100%, calc((100svh - 254px - max(4px, env(safe-area-inset-bottom))) * .75)); }
  .utility-controls { margin-inline: 12px; }
  .page-footer { display: none; }
}
@media (max-width: 380px) {
  .player-toolbar { padding-inline: 8px; }
  .toolbar-actions { gap: 0; }
  .action-controls { max-width: 148px; }
  .hook { width: 56px; height: 56px; }
  .fire { width: 84px; height: 84px; }
  .softkeys button { padding-inline: 8px; }
  .softkeys kbd { display: none; }
}
@media (max-width: 860px) and (orientation: portrait) {
  .player, .player:fullscreen { display: flex; flex-direction: column; min-height: 100svh; min-height: 100dvh; }
  .player-toolbar, .utility-controls { flex-shrink: 0; }
  .play-deck { flex: 1; grid-template-rows: auto 140px; align-content: space-between; }
  .utility-controls { display: grid; grid-template-columns: 2fr 3fr; gap: 0; }
  .softkeys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
  .special-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
  .utility-controls button { flex-direction: column; min-width: 0; min-height: 48px; padding: 4px 2px; gap: 2px; font-size: 11px; }
  .utility-controls kbd { display: none; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .page-footer { display: none; }
  .game-layout { width: 100%; margin-top: 0; }
  .player, .player:fullscreen { position: relative; min-height: 100svh; padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; }
  .player-toolbar { position: absolute; top: 4px; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); z-index: 1; min-height: 44px; pointer-events: none; }
  .toolbar-actions { pointer-events: auto; }
  .toolbar-actions button span { display: none; }
  .player-toolbar { padding: 0; }
  .play-deck { grid-template-columns: minmax(144px, 1fr) auto minmax(160px, 1fr); grid-template-areas: "move screen actions"; min-height: calc(100svh - max(6px, env(safe-area-inset-top)) - max(6px, env(safe-area-inset-bottom))); gap: 12px; }
  .screen-wrap { width: min(calc((100svh - max(6px, env(safe-area-inset-top)) - max(6px, env(safe-area-inset-bottom))) * .75), calc(100vw - 368px)); align-self: center; }
  .move-controls, .action-controls { padding-bottom: 56px; }
  .utility-controls { position: absolute; bottom: max(4px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); margin: 0; padding: 0; border: 0; pointer-events: none; }
  .softkeys, .special-controls { pointer-events: auto; }
  .utility-controls kbd { display: none; }
  .special-controls { gap: 4px; }
  .special-controls button { flex-direction: column; min-width: 44px; padding: 4px; gap: 0; font-size: 11px; }
  .player-footnote, .control-caption { display: none; }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 700px) {
  .softkeys { align-self: end; }
  .special-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 144px; gap: 2px; }
  .special-controls button { flex-direction: column; }
  .action-controls { padding-bottom: 56px; }
}
@media (max-width: 420px) { .subtitle { display: none; } }
@media (prefers-reduced-motion: reduce) { button { transition: none; } }
