:root {
  --bg: #15130f;
  --panel: #221e18;
  --panel-2: #2d271f;
  --ink: #efe6d2;
  --muted: #b3a68b;
  --gold: #d9b45a;
  --red: #d0533f;
  --blue: #5b8fd9;
  --green: #6fbf6a;
  --line: #4a4033;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body { display: flex; justify-content: center; }
button { font: inherit; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; min-height: 40px; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: #6b4b1f; border-color: var(--gold); }
button.on { background: #2d4a6b; border-color: var(--blue); }
button.ghost { background: transparent; min-height: 32px; padding: 2px 10px; }
[hidden] { display: none !important; }

#app { position: relative; width: 100%; max-width: 560px; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
#title { font-weight: bold; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status { flex: 1; text-align: right; color: var(--muted); font-size: 14px; white-space: nowrap; }
#boardWrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#board { display: block; touch-action: manipulation; image-rendering: auto; }
#banner { position: absolute; left: 8px; right: 8px; top: 40%; text-align: center; padding: 10px; font-size: 18px; color: var(--gold);
  background: rgba(10, 8, 6, 0.85); border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold); pointer-events: none; }

#panel { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
#unitInfo { min-height: 40px; font-size: 14px; line-height: 1.35; }
#unitInfo .name { color: var(--gold); font-weight: bold; }
#unitInfo .muted, .muted { color: var(--muted); }
#options { display: flex; flex-wrap: wrap; gap: 6px; }
#options button { min-height: 32px; padding: 4px 10px; font-size: 14px; }
#options button.chosen { border-color: var(--red); background: #4a241d; }
#tallies { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
#tallies button { flex: none; min-height: 30px; padding: 3px 9px; font-size: 13px; border-color: #6b5a2e; }
.partyCard { margin: 10px auto; }
.partyCard .sheet { max-height: 46vh; }
#actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#actions button { padding: 8px 4px; font-size: 15px; }

.overlay { position: absolute; inset: 0; z-index: 10; }
.overlay .hint { position: absolute; bottom: 10px; right: 14px; font-size: 12px; color: var(--muted); }
.talk { display: flex; align-items: flex-end; background: linear-gradient(transparent 45%, rgba(0, 0, 0, 0.55)); cursor: pointer; }
.talkBox { display: flex; gap: 12px; align-items: flex-start; margin: 0 10px 34px; padding: 12px; width: 100%;
  background: rgba(24, 20, 15, 0.96); border: 1px solid var(--gold); border-radius: 10px; }
.talkBox .face { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.talkBox .face[src=""], .talkBox .face:not([src]) { display: none; }
.speaker { color: var(--gold); font-weight: bold; margin-bottom: 4px; }
.text { font-size: 17px; line-height: 1.4; }
.narration .text { font-style: italic; color: #e7dcc4; }

.full { background: rgba(8, 7, 5, 0.94); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; cursor: pointer; overflow-y: auto; }
.cardBox { max-width: 440px; width: 100%; text-align: center; }
.cardBox .sheet { max-width: 100%; max-height: 62vh; border-radius: 8px; border: 1px solid var(--line); }
.cardHeader { color: var(--gold); font-size: 19px; margin-top: 10px; }
.cardText { margin-top: 6px; line-height: 1.4; }
.cardRule { margin-top: 8px; color: #e8a790; font-size: 15px; line-height: 1.35; }
.scene { justify-content: flex-end; padding: 0; }
.scene .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sceneText { position: relative; margin: 0 10px 18px; padding: 12px; width: calc(100% - 20px); background: rgba(10, 8, 6, 0.86);
  border: 1px solid var(--line); border-radius: 10px; }
.screen { cursor: default; justify-content: flex-start; }
.screen .screenBox { margin: auto 0; }   /* centred when it fits, scrollable from the top when it does not */
.screenBox { max-width: 460px; width: 100%; line-height: 1.45; }
.screenBox h1 { color: var(--gold); margin: 6px 0 10px; font-size: 30px; }
.screenBox h2 { color: var(--gold); margin: 4px 0 8px; font-size: 22px; }
.screenBox .kicker { color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.screenBox .art { width: 100%; max-height: 34vh; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.screenBox ul { padding-left: 18px; margin: 6px 0; }
.screenBox .buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.screenBox .buttons button, .screenBox .buttons a { flex: 1; }
.company { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 8px 0; }
.company div { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.company img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
a.cta { display: inline-block; text-align: center; text-decoration: none; color: var(--ink); background: #6b4b1f;
  border: 1px solid var(--gold); border-radius: 8px; padding: 10px 12px; }
.deploy { display: flex; align-items: flex-end; pointer-events: none; }
.deployBox { pointer-events: auto; margin: 0 10px 10px; padding: 12px; width: 100%; background: rgba(24, 20, 15, 0.96);
  border: 1px solid var(--gold); border-radius: 10px; font-size: 14px; }
.squads { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.squads .sq0 { color: #8fb6ff; } .squads .sq1 { color: #7fe6c9; }
.deployBox button { width: 100%; }
