/* SALIENT - the war room. Panels are the dark oak of the map table, buttons are
   khaki card with an inked edge, headings are stencilled, and notes come off the
   typewriter. Phone-first; the wide layout moves the tray to the side. */
:root {
  --desk: #1d150e; --panel: #2a2118; --panel2: #352a1e; --panel3: #43362a;
  --ink: #efe4c8; --dim: #b5a88a; --faint: #7d705c; --edge: #0f0b07;
  --paper: #e2d8ba; --paper2: #cfc3a0; --type: #2a2118;
  --brass: #d6a64a; --red: #b0281e; --olive: #5c6c30;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --sans: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --stencil: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Bold", sans-serif;
  --typewriter: "Courier New", Courier, "Nimbus Mono PS", monospace;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--desk); color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; }
body { font-size: 16px; line-height: 1.4; }
button, input { font: inherit; color: inherit; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--desk); }
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------ buttons: inked card */
.btn {
  appearance: none; cursor: pointer; border: 2px solid var(--edge); border-radius: 4px;
  padding: 10px 16px; min-height: 44px;
  background: linear-gradient(180deg, #5b4b37 0%, #45382a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.18), 0 2px 0 rgba(0, 0, 0, 0.55);
  color: var(--ink); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 700; font-size: 0.92rem;
  transition: filter 0.12s, transform 0.08s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); filter: brightness(1.2); }
.btn:disabled { opacity: 0.38; cursor: default; filter: saturate(0.3); }
.btn.primary {
  background: linear-gradient(180deg, #ecdfb8 0%, #d3c395 100%); color: var(--type);
  box-shadow: inset 0 0 0 2px rgba(42, 33, 24, 0.25), 0 2px 0 rgba(0, 0, 0, 0.55);
}
.btn.big { font-size: 1.08rem; padding: 14px 22px; min-height: 54px; }
.btn.icon { min-width: 44px; padding: 6px 10px; font-size: 1.2rem; }
.btn.on { background: linear-gradient(180deg, #f2e6c2 0%, #d8c48c 100%); color: var(--type); }
.padfocus { outline: 3px solid #fff !important; outline-offset: 2px; box-shadow: 0 0 0 7px rgba(214, 166, 74, 0.55) !important; }
input {
  width: 100%; padding: 12px; border-radius: 4px; border: 2px solid var(--edge);
  background: var(--paper); color: var(--type); font-size: 1.05rem; font-family: var(--typewriter); font-weight: 700;
}
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.note { color: var(--dim); font-size: 0.92rem; font-family: var(--typewriter); }

/* ------------------------------------------------------------ title */
#scr-title { justify-content: flex-end; }
#poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-lockup { position: relative; text-align: center; padding: 0 20px; margin-bottom: 4vh; }
.kicker { text-transform: uppercase; letter-spacing: 0.3em; font-size: 0.72rem; color: var(--dim); font-family: var(--typewriter); font-weight: 700; }
.title-lockup h1 {
  margin: 4px 0 6px; font-family: var(--stencil); font-weight: 400; font-size: clamp(56px, 17vw, 112px); letter-spacing: 0.1em; line-height: 1;
  color: #e9dcb6; padding-left: 0.1em;
  /* a stencil's bridges and a worn inked edge */
  background: repeating-linear-gradient(90deg, #e9dcb6 0 0.52em, transparent 0.52em 0.56em), linear-gradient(180deg, #f3e8c6, #cdbb8a);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #0b0704) drop-shadow(0 0 18px rgba(214, 166, 74, 0.25));
}
.tag { font-family: var(--typewriter); color: var(--ink); opacity: 0.92; max-width: 30em; margin: 0 auto; font-size: 0.95rem; }
.title-menu { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 0 20px calc(22px + var(--safe-b)); max-width: 420px; width: 100%; margin: 0 auto; }
.title-menu .row .btn { flex: 1; }
@media (orientation: landscape) and (max-height: 560px) {
  #scr-title { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .title-lockup { flex: 1; text-align: left; margin: 0 0 22px 4vw; }
  .title-lockup h1 { font-size: clamp(44px, 12vh, 84px); }
  .title-menu { margin: 0; max-width: 340px; }
}
/* a wide screen is a different poster: the words in a dark left column, the
   war table filling everything to the right, full height (js: TITLE_COLUMN) */
@media (min-aspect-ratio: 5/4) and (min-height: 561px) {
  #scr-title { justify-content: center; align-items: flex-start; padding-left: 5vw; }
  .title-lockup { text-align: left; padding: 0; margin: 0 0 4vh; width: min(34vw, 470px); }
  .title-lockup h1 { font-size: clamp(64px, 8.4vw, 124px); margin: 8px 0 12px; }
  .tag { margin: 0; }
  .title-menu { margin: 0; padding: 0 0 calc(12px + var(--safe-b)); width: min(30vw, 400px); }
}

/* ------------------------------------------------------------ pages */
.bar { display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--safe-t)) 12px 8px; background: var(--panel); border-bottom: 2px solid var(--edge); position: sticky; top: 0; z-index: 2; }
.bar h2 { margin: 0; font-size: 1.3rem; letter-spacing: 0.1em; flex: 1; font-family: var(--stencil); font-weight: 400; text-transform: uppercase; }
.page { padding: 12px 16px calc(24px + var(--safe-b)); max-width: 560px; width: 100%; margin: 0 auto; }
.page h3 { margin: 18px 0 8px; font-size: 0.8rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); font-family: var(--typewriter); }
.card { background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; padding: 12px 14px; margin: 12px 0; }
.card h3 { margin-top: 0; }
.seg { display: flex; gap: 8px; }
.seg.wrap { flex-wrap: wrap; }
.seg .btn { flex: 1; padding: 8px 8px; font-size: 0.86rem; }
.seg.maps .btn { flex: 1 1 30%; }
.go-row { margin-top: 22px; display: flex; }
.go-row .btn { flex: 1; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #6b2a22; border: 2px solid var(--edge); }
.dot.on { background: #3fae5c; }

.seats { display: flex; flex-direction: column; gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; padding: 6px 8px; }
.seat .sw { width: 34px; height: 34px; border-radius: 4px; border: 2px solid var(--edge); flex: none; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.2); }
.seat .nm { flex: 1; min-width: 0; }
.seat .nm b { display: block; letter-spacing: 0.06em; text-transform: uppercase; }
.seat .nm small { color: var(--dim); font-family: var(--typewriter); }
.seat .btn { padding: 6px 10px; min-height: 40px; font-size: 0.82rem; }
.seat-count .btn { flex: 1; }

.share { display: flex; gap: 14px; align-items: center; }
.qr { flex: none; width: 132px; height: 132px; background: var(--paper); border-radius: 4px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.bigcode { font-size: 2.2rem; letter-spacing: 0.2em; color: var(--brass); font-family: var(--typewriter); font-weight: 700; margin: 4px 0 8px; }
.code-in { text-transform: uppercase; letter-spacing: 0.3em; font-size: 1.3rem; text-align: center; }
.games { display: flex; flex-direction: column; gap: 8px; }
.game-row { display: flex; align-items: center; gap: 10px; }
.game-row .info { flex: 1; font-size: 0.92rem; }
.game-row .info small { color: var(--dim); display: block; }

/* ------------------------------------------------------------ operations */
.ops { display: flex; flex-direction: column; gap: 12px; }
.op { display: grid; grid-template-columns: 112px 1fr; gap: 12px; background: var(--panel); border: 2px solid var(--edge); border-radius: 6px; padding: 10px; }
.op > img { width: 112px; height: 112px; border-radius: 3px; border: 2px solid var(--edge); background: #5d7a86; display: block; }
.op .num { font-family: var(--typewriter); font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); }
.op h3 { margin: 2px 0 4px; font-family: var(--stencil); font-weight: 400; font-size: 1.25rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.op .obj { font-family: var(--typewriter); font-weight: 700; font-size: 0.84rem; color: var(--ink); margin: 0 0 4px; }
.op .brief { font-size: 0.86rem; color: var(--dim); margin: 0 0 8px; line-height: 1.4; }
.op .foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.op .foot .btn { padding: 6px 14px; min-height: 40px; font-size: 0.86rem; }
.op .medal { font-family: var(--typewriter); font-size: 0.78rem; color: var(--brass); }
.op.locked { opacity: 0.55; }
.op.locked .brief { filter: blur(0.5px); }
.op-sides { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; }
.op-sides span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.74rem; font-family: var(--typewriter); color: var(--dim); }
.op-sides i { width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--edge); display: inline-block; }
@media (max-width: 420px) {
  .op { grid-template-columns: 84px 1fr; gap: 10px; }
  .op > img { width: 84px; height: 84px; }
}
.brief-card .obj { font-family: var(--typewriter); font-weight: 700; background: var(--paper); color: var(--type); border: 2px solid var(--edge); border-radius: 3px; padding: 8px 10px; margin: 10px 0; }

.prose { line-height: 1.55; }
.prose p, .prose li { color: var(--ink); }
.prose .units { display: grid; grid-template-columns: 60px 1fr; gap: 8px 12px; align-items: center; }
.prose .units img { width: 58px; height: 58px; }
.prose .units small { color: var(--dim); font-family: var(--typewriter); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose td, .prose th { border-bottom: 1px solid var(--panel3); padding: 6px 4px; text-align: left; }

/* ------------------------------------------------------------ game */
#scr-game { background: #120d08; }
.gamebar { display: flex; align-items: center; gap: 10px; padding: calc(6px + var(--safe-t)) 10px 6px; background: var(--panel); border-bottom: 2px solid var(--edge); }
.turnchip { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.turnchip i { width: 22px; height: 22px; border-radius: 4px; border: 2px solid var(--edge); flex: none; }
.turnchip span { font-weight: 700; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; text-transform: uppercase; letter-spacing: 0.06em; }
.turnchip small { color: var(--dim); font-family: var(--typewriter); }
.share-strip { flex: 1; height: 16px; display: flex; border: 2px solid var(--edge); border-radius: 3px; overflow: hidden; position: relative; background: var(--edge); gap: 2px; min-width: 60px; }
.share-strip i { display: block; height: 100%; transition: flex-grow 0.4s; }
.share-strip .goal { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; box-shadow: 0 0 4px #fff; }
.game-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#board-wrap { flex: 1; position: relative; min-height: 0; touch-action: none; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.zoom-chip { position: absolute; left: 10px; bottom: 10px; padding: 6px 12px; font-size: 0.78rem; min-height: 0; opacity: 0.92; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); }
.toast {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: min(92%, 440px);
  background: var(--paper); color: var(--type); border: 2px solid var(--edge); border-radius: 3px; padding: 8px 14px;
  font-family: var(--typewriter); font-weight: 700; font-size: 0.88rem; text-align: center; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.toast.bad { background: #f0d2c4; border-color: #5b1611; color: #4a120c; }

#tray { background: var(--panel); border-top: 2px solid var(--edge); padding: 8px 8px calc(8px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; }
.chest { display: flex; flex-direction: column; gap: 2px; padding: 2px 6px; min-height: 48px; }
.chest-main { display: flex; align-items: baseline; gap: 8px; font-size: 1.35rem; font-family: var(--typewriter); }
.chest-main small { font-size: 0.74rem; color: var(--dim); }
.chest-main .arrow { color: var(--dim); font-size: 1rem; }
.chest.broke #c-next { color: #ff7462; }
.chest.broke .chest-line { color: #ffb3a6; }
.chest.none .chest-main { opacity: 0.35; }
.coin { width: 18px; height: 18px; border-radius: 50%; align-self: center; background: radial-gradient(circle at 35% 35%, #fff1c2, #d6a64a 45%, #7e5a12); border: 2px solid var(--edge); }
.chest-line { font-size: 0.82rem; color: var(--dim); min-height: 1.2em; font-family: var(--typewriter); }
.tray-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.btn.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; min-height: 58px; border-radius: 5px; }
.btn.tile small { font-size: 0.66rem; line-height: 1.1; white-space: nowrap; }
.glyph { font-size: 1.3rem; line-height: 1; height: 28px; display: flex; align-items: center; }
.glyph.unit, .glyph.bunker { width: 32px; height: 30px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.btn.tile.on { box-shadow: 0 0 0 3px var(--brass), inset 0 0 12px rgba(255, 240, 200, 0.5); }

@media (min-aspect-ratio: 5/4) {
  .game-body { flex-direction: row; }
  #tray { width: clamp(220px, 26vw, 320px); border-top: 0; border-left: 2px solid var(--edge); padding: 12px 10px calc(12px + var(--safe-b)); justify-content: flex-end; }
  .tray-row { grid-template-columns: repeat(3, 1fr); }
  .btn.tile { min-height: 64px; }
  .chest { margin-bottom: auto; }
  .toast { top: auto; bottom: 10px; font-size: 0.84rem; padding: 6px 12px; }
  .zoom-chip { bottom: auto; top: 10px; }      /* the toast lives at the bottom here */
}

/* ------------------------------------------------------------ the deploy sheet */
.depot h2 { margin-bottom: 2px; }
.depot .sub { margin: 0 0 8px; }
.depot h3 { margin: 12px 0 6px; font-size: 0.74rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--brass); font-family: var(--typewriter); }
.ugrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ucard {
  display: grid; grid-template-columns: 50px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left;
  padding: 6px 8px; min-height: 60px; text-transform: none; letter-spacing: 0; font-weight: 400;
  background: linear-gradient(180deg, #e9ddb8, #d4c69c); color: var(--type);
}
.ucard img { grid-row: 1 / 3; width: 50px; height: 50px; }
.ucard b { font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ucard span { font-family: var(--typewriter); font-size: 0.72rem; font-weight: 700; color: #5a4a36; }
.ucard.why { opacity: 0.5; }
.ublurb { font-family: var(--typewriter); font-size: 0.8rem; color: var(--dim); margin: 8px 0 0; min-height: 2.4em; }

/* ------------------------------------------------------------ overlays */
.modal, .curtain { position: fixed; inset: 0; background: rgba(8, 5, 2, 0.72); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal-card, .curtain-card {
  position: relative; background: var(--panel); border: 3px solid var(--edge); border-radius: 8px; padding: 18px 18px 16px;
  max-width: 460px; width: 100%; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(214, 166, 74, 0.18);
}
.modal-card h2, .curtain-card h2 { margin: 0 0 8px; font-size: 1.45rem; letter-spacing: 0.08em; font-family: var(--stencil); font-weight: 400; text-transform: uppercase; }
.modal-card .close { position: absolute; right: 8px; top: 8px; }
.modal-card .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.modal-card .actions .row { align-items: stretch; }
.modal-card .actions .row .btn { flex: 1; }
.curtain { background: rgba(8, 5, 2, 0.92); }
.curtain-card { text-align: center; }
.curtain-card .btn { width: 100%; margin-top: 14px; }
.stats { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.9rem; font-family: var(--typewriter); }
.stats td, .stats th { padding: 5px 4px; border-bottom: 1px solid var(--panel3); text-align: right; }
.stats td:first-child, .stats th:first-child { text-align: left; }
.stats .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 2px solid var(--edge); vertical-align: -2px; margin-right: 6px; }
.banner-win { text-align: center; }
.banner-win .crown { font-size: 2.4rem; color: var(--brass); }
@media (max-width: 380px) { .ugrid { grid-template-columns: 1fr; } }
