:root {
  color-scheme: dark;
  --paper: #f2dfb8;
  --ink: #24170f;
  --bg: #140f0b;
  --panel: #241812;
  --panel2: #302015;
  --line: #6f4c2f;
  --gold: #d89d45;
  --red: #b95b4e;
  --green: #7fbd78;
  --blue: #6fa5b8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, #372315, #140f0b 45%, #090706);
  color: var(--paper);
  font: 16px/1.45 system-ui, -apple-system, Segoe UI, sans-serif;
}
.shell { max-width: 1180px; margin: 0 auto; padding: 28px; }
.hero {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(48,32,21,.95), rgba(22,15,10,.95));
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.eyebrow { margin: 0 0 8px; color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; }
.hero h1 { margin: 0; font-size: clamp(42px, 8vw, 84px); line-height: .92; }
.lede { max-width: 780px; font-size: 20px; }
.disclosure { max-width: 900px; color: #d9bd91; }
.status {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.status div, .mapcard, .boardcard, .receiptcard {
  border: 1px solid var(--line);
  background: rgba(36,24,18,.92);
  border-radius: 18px;
  padding: 16px;
}
.status span { display: block; color: #caa878; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.status strong { font-size: 24px; }
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.mapcard h2, .receiptcard h2 { margin-top: 0; }
.map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.map button {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1b120d;
  color: var(--paper);
  font-weight: 800;
  cursor: default;
}
.map button:disabled { opacity: 1; }
.map button.current { outline: 3px solid var(--gold); }
.map button.filed { background: #24301e; border-color: var(--green); }
.map button.locked { opacity: .45; cursor: not-allowed; }
.hint { color: #d6bc93; font-size: 14px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.controls button, #copyBtn, .dpad button {
  border: 1px solid var(--gold);
  background: #3d2818;
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.boardcard { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.board {
  width: min(100%, 560px);
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: 18px;
  background: #120c08;
  border: 1px solid #7a5638;
}
.cell {
  aspect-ratio: 1;
  border-radius: 8px;
  min-width: 32px;
  display: grid;
  place-items: center;
  position: relative;
}
.wall { background: #4d3526; box-shadow: inset 0 0 0 2px #23150e; }
.floor { background: #24160f; }
.goal { background: radial-gradient(circle, #e0b35c 0 28%, #372415 30% 100%); }
.box { background: linear-gradient(135deg, #b77b39, #754524); box-shadow: inset 0 0 0 3px #e0b35c; }
.box.goal { background: linear-gradient(135deg, #89a760, #47692f); }
.player { background: var(--blue); box-shadow: 0 0 0 4px rgba(111,165,184,.25); }
.player::after { content: "@"; color: #081015; font-weight: 900; }
.door { background: #2c1b12; border: 2px dashed var(--gold); }
.stamp { background: #27401e; }
.stamp::after { content: "FILED"; font-size: 10px; color: #d6f1c0; font-weight: 900; transform: rotate(-8deg); }
.message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: #1b120d;
  color: #f6d58c;
  font-weight: 800;
  width: min(100%, 560px);
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 8px;
  justify-content: center;
}
#moveUp { grid-area: up; }
#moveLeft { grid-area: left; }
#moveDown { grid-area: down; }
#moveRight { grid-area: right; }
.dpad button { min-height: 52px; border-radius: 14px; font-size: 24px; line-height: 1; }
.receiptcard { margin-top: 18px; }
.receiptcard pre {
  white-space: pre-wrap;
  background: #0d0805;
  border-radius: 12px;
  padding: 12px;
  color: #e8cf9f;
}
.status, .mapcard, .receiptcard {
  display: none;
}
.after-first-push .status {
  display: grid;
}
.after-first-push .mapcard, .after-first-push .receiptcard {
  display: block;
}
@media (max-width: 800px) {
  .shell { padding: 16px; }
  .layout { grid-template-columns: 1fr; }
  .status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cell { min-width: 24px; }
}
