:root {
  color-scheme: dark;
  --bg: #1a1612;
  --panel: rgba(28, 24, 20, 0.94);
  --line: #a68456;
  --text: #f3e6cf;
  --dim: #cbbda6;
  --amber: #f0a202;
  --blue: #8eb6e6;
  --danger: #e15a45;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  user-select: none;
}
#view { width: 100%; height: 100%; display: block; touch-action: none; }
#topbar, #bar, #banner, #minimap, #pan, #help, #end, #toast { position: absolute; z-index: 2; }
#topbar {
  top: 0; left: 0; right: 0;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  padding: 8px 10px env(safe-area-inset-top);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; min-width: 180px; }
.brand strong { letter-spacing: 0.14em; font-size: 18px; }
.brand span, .stat { color: var(--dim); font-size: 14px; }
.stat b { color: var(--amber); font-size: 22px; font-variant-numeric: tabular-nums; }
#clock, #cap { font-variant-numeric: tabular-nums; font-size: 18px; color: var(--text); }
button {
  min-height: 44px;
  padding: 8px 10px;
  background: #3a3228;
  color: var(--text);
  border: 1px solid #8d7048;
  font: inherit;
  letter-spacing: 0.03em;
}
button.on { background: var(--amber); color: #1a1612; border-color: #f6d48a; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#minimap {
  top: 64px; left: 10px;
  width: min(28vw, 168px); height: min(28vw, 168px);
  border: 1px solid var(--line);
  background: #241c16;
  touch-action: none;
}
#pan {
  top: 244px; left: 10px;
  display: grid;
  grid-template-columns: 44px 44px 44px;
  gap: 4px;
  width: 140px;
}
#pan button { min-height: 40px; padding: 0; }
#banner {
  top: 62px; left: 50%; transform: translateX(-50%);
  max-width: min(640px, calc(100% - 200px));
  margin: 0; padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
}
#toast {
  left: 50%; bottom: 168px; transform: translateX(-50%);
  min-height: 0; color: var(--amber); font-size: 16px;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
#bar {
  left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
  max-height: 42vh;
  overflow: auto;
}
.row, #design, #bodies, #props, #weapons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#readout { flex: 1; min-width: 180px; color: var(--dim); }
#queue { display: flex; gap: 4px; }
.slot {
  width: 36px; height: 14px;
  border: 1px solid #8d7048;
  background: #241c16;
  position: relative;
}
.slot span { display: block; height: 100%; background: var(--blue); }
#help, #end {
  inset: 0;
  background: rgba(12, 10, 8, 0.72);
  display: grid;
  place-items: center;
  z-index: 5;
  padding: 16px;
}
.sheet {
  width: min(640px, 100%);
  background: #241c16;
  border: 1px solid var(--line);
  padding: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.sheet h2 { font-family: Impact, "Arial Black", sans-serif; letter-spacing: 0.08em; margin: 0 0 8px; }
.sheet p { line-height: 1.4; color: var(--dim); }
[hidden] { display: none !important; }
@media (max-width: 800px) {
  #banner { left: 10px; right: 10px; transform: none; max-width: none; top: auto; bottom: auto; }
  #minimap { width: 112px; height: 112px; top: 108px; }
  #pan { top: 228px; }
  .brand span { display: none; }
}
@media (max-height: 700px) {
  #minimap { width: 96px; height: 96px; }
  #pan { top: 176px; }
}
