:root {
  --bg: #071510;
  --panel: rgba(10, 42, 32, .92);
  --line: rgba(212, 177, 90, .45);
  --gold: #d4b15a;
  --neon: #3dff9a;
  --text: #f3ffe8;
  --muted: #b7d7c4;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { background: radial-gradient(70% 40% at 50% -10%, #146b45 0%, transparent 55%), var(--bg); }
#book { height: 100%; max-width: 480px; margin: 0 auto; position: relative; }
.screen {
  position: absolute; inset: 0 0 calc(68px + var(--safe-b)) 0;
  padding: calc(12px + var(--safe-t)) 14px 12px;
  display: flex; flex-direction: column; gap: 10px; overflow: auto;
}
.hidden { display: none !important; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { margin: 0; color: var(--gold); letter-spacing: .14em; font-size: .78rem; }
h1, h2 { margin: 0; font-size: 1.2rem; }
.mini { width: 28px; height: 28px; object-fit: contain; }
.tag { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.35; white-space: pre-line; }
.list { display: flex; flex-direction: column; gap: 8px; }
.card {
  text-align: left; width: 100%; padding: 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer;
}
.card strong { display: block; }
.card span { color: var(--muted); font-size: .8rem; }
.card:disabled { opacity: .45; cursor: default; }
.board {
  display: grid; gap: 3px; width: min(100%, 360px); margin: 0 auto;
  aspect-ratio: 1;
}
.cell {
  border-radius: 6px; background: #0c241b; border: 1px solid rgba(61, 255, 154, .12);
  display: grid; place-items: center; position: relative; min-width: 0;
}
.cell img { width: 70%; height: 70%; object-fit: contain; }
.cell.wall { background: #04110c; border-color: transparent; }
.cell.veil { background: repeating-linear-gradient(135deg, #2a1240, #2a1240 4px, #12081c 4px, #12081c 8px); }
.cell.door { background: #3a2a08; }
.cell.beam { box-shadow: inset 0 0 0 2px rgba(61, 255, 154, .85); }
.cell.seen { box-shadow: inset 0 0 0 2px rgba(255, 90, 70, .8); }
.cell.you { outline: 2px solid var(--gold); }
.cell.shadow-you { outline: 2px solid #c9a6ff; }
.mode, .btn, .pad button {
  border: 0; border-radius: 14px; padding: 10px 14px; font: inherit; font-weight: 700; cursor: pointer;
}
.mode { background: var(--gold); color: #071510; }
.mode.shadow { background: #c9a6ff; color: #1a0d28; }
.pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pad button { background: #123528; color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { color: #ffb4c0; }
.kit { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kit article { padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.kit img { width: 42px; height: 42px; object-fit: contain; }
.tog {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 14px;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
}
.dock {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + var(--safe-b)); background: rgba(5, 18, 13, .96);
  border-top: 1px solid var(--line); z-index: 8;
}
.dock button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .58rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dock button img { width: 18px; height: 18px; object-fit: contain; }
.dock button.on { color: var(--gold); }
