:root {
  color-scheme: dark;
  --ink: #10140f;
  --paper: #ead8a6;
  --cream: #fff0bd;
  --green: #56714b;
  --dark-green: #263b2a;
  --blue: #416b78;
  --red: #9b4034;
  --yellow: #d7a43d;
  --brown: #704f36;
  --frame: #292118;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #080a08; color: var(--cream); }
body { font-family: "Courier New", Courier, monospace; image-rendering: pixelated; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
#app { width: min(960px, 100%); margin: 0 auto; padding: 12px; }
.game-shell { border: 5px solid #40311f; background: #171912; box-shadow: 0 0 0 3px #0b0c09; }
.game-top { display: grid; grid-template-columns: minmax(0, 640px) minmax(230px, 1fr); gap: 0; }
.canvas-wrap { background: #000; padding: 8px; display: flex; align-items: center; justify-content: center; min-height: 416px; }
.game-canvas { width: min(100%, 640px); aspect-ratio: 8 / 5; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; border: 2px solid #b9975b; }
.side-panel { min-width: 0; max-height: 416px; overflow-y: auto; padding: 14px; background: var(--paper); color: var(--ink); border-left: 4px solid var(--frame); }
.side-panel h1, .side-panel h2 { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .04em; font-size: 1.28rem; line-height: 1.15; }
.side-panel h2 { font-size: 1rem; }
.copy { white-space: pre-line; line-height: 1.35; margin: 0 0 12px; }
.status-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: #0f130f; border-top: 4px solid var(--frame); }
.status-cell { padding: 8px 6px; border-right: 1px solid #514632; text-align: center; min-width: 0; }
.status-cell:last-child { border-right: 0; }
.status-cell b { display: block; color: var(--yellow); font-size: .72rem; }
.status-cell span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.menu { display: grid; gap: 7px; }
.pixel-button { width: 100%; border: 2px solid #2b2a20; border-radius: 0; background: #f4e7b9; color: #11150e; padding: 8px 9px; text-align: left; box-shadow: inset -2px -2px 0 #a78955, inset 2px 2px 0 #fff7d2; cursor: pointer; min-height: 44px; }
.pixel-button:hover, .pixel-button:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; background: #fff3c7; }
.pixel-button:disabled { opacity: .42; cursor: not-allowed; }
.pixel-button.primary { background: #d7c57f; }
.pixel-button small { display: block; margin-top: 3px; color: #55482f; font-size: .72rem; line-height: 1.15; }
.num { color: var(--red); font-weight: bold; margin-right: 6px; }
.notice { padding: 8px; margin: 0 0 10px; border: 2px solid #73543a; background: #d8c68f; line-height: 1.3; }
.result-list, .log, .records { border: 2px solid #73543a; background: #e3d4a4; padding: 8px; margin: 8px 0 0; max-height: 180px; overflow: auto; }
.result-list p, .log p { margin: 0 0 6px; }
.member { border-bottom: 1px dashed #756445; padding: 8px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.member:last-child { border-bottom: 0; }
.member.dead { color: #774239; }
.member-meta { font-size: .75rem; line-height: 1.25; color: #594d37; }
.meter { height: 10px; border: 1px solid #372f22; background: #b4a67d; margin-top: 4px; }
.meter span { display: block; height: 100%; background: var(--green); }
.meter.danger span { background: var(--red); }
.store-row { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 7px; align-items: center; padding: 6px 0; border-bottom: 1px dashed #765f3c; }
.store-row:last-child { border-bottom: 0; }
.store-row .pixel-button { text-align: center; min-height: 36px; padding: 5px; }
.setup-fields { display: grid; gap: 8px; }
.setup-fields label { display: grid; gap: 3px; font-weight: bold; }
.setup-fields input, .memorial-note { width: 100%; border: 2px solid #3e3527; background: #fff1bf; color: #11150e; border-radius: 0; padding: 8px; }
.route-list { display: grid; gap: 4px; font-size: .78rem; }
.route-item { display: flex; justify-content: space-between; border-bottom: 1px dotted #6f5c3d; padding: 3px 0; }
.route-item.current { color: #8d302a; font-weight: bold; }
.hunt-layout { position: relative; }
.hunt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; }
.hunt-stat { border: 2px solid #594b33; padding: 5px; text-align: center; background: #d9c894; }
.touch-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); gap: 5px; justify-content: center; margin-top: 8px; }
.touch-pad .pixel-button { min-height: 48px; text-align: center; padding: 4px; }
.touch-pad .up { grid-column: 2; }
.touch-pad .left { grid-column: 1; grid-row: 2; }
.touch-pad .shoot { grid-column: 2; grid-row: 2; background: #d6a449; }
.touch-pad .right { grid-column: 3; grid-row: 2; }
.touch-pad .down { grid-column: 2; grid-row: 3; }
.footer-note { font-size: .72rem; color: #a99873; text-align: center; padding: 9px; }
@media (max-width: 760px) {
  #app { padding: 0; }
  .game-shell { border-width: 3px; }
  .game-top { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: auto; padding: 4px; }
  .side-panel { max-height: none; overflow: visible; border-left: 0; border-top: 4px solid var(--frame); }
  .status-bar { grid-template-columns: repeat(3, 1fr); }
  .status-cell:nth-child(3) { border-right: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
