/* Two materials and no third: the map is paper, everything around it is the
   painted steel of a command track with one amber lamp over the message pad. */
:root {
  --steel: #23281f;
  --steel-lit: #2f362a;
  --steel-edge: #151810;
  --paper: #c6bf9e;
  --pad: #ddd6bd;
  --pad-rule: rgba(60,54,34,0.20);
  --amber: #f0a93c;
  --grease: #e9c33c;
  --blue: #23508a;
  --blue-lit: #6f9bd6;
  --red: #8f2b23;
  --red-lit: #d4776a;
  --ink: #e8e4d4;
  --ink-dim: #9ba28d;
  --ink-dark: #22261c;
  --display: "DejaVu Sans Condensed", "TeX Gyre Heros Cn", "Liberation Sans Narrow", "Arial Narrow", system-ui, sans-serif;
  --mono: ui-monospace, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--steel-edge);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ---- masthead ---------------------------------------------------------- */
#masthead {
  display: flex; align-items: stretch; gap: 0;
  background: linear-gradient(180deg, var(--steel-lit), var(--steel));
  border-bottom: 2px solid var(--steel-edge);
  flex: 0 0 auto;
}
#masthead .title {
  font-family: var(--display);
  font-size: 20px; font-weight: 700; letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 10px 16px 8px; color: var(--ink);
  border-right: 1px solid var(--steel-edge);
  white-space: nowrap;
}
#masthead .title span { color: var(--amber); }
.slot { padding: 8px 14px; border-right: 1px solid var(--steel-edge); min-width: 0; }
.slot .k {
  font-family: var(--display); font-size: 10px; letter-spacing: 0.20em;
  text-transform: uppercase; color: var(--ink-dim); display: block;
}
.slot .v { font-size: 14px; color: var(--ink); white-space: nowrap; }
.grow { flex: 1 1 auto; }

.tally { display: flex; align-items: center; gap: 10px; }
.tally b { font-weight: 700; font-size: 15px; }
.tally .b { color: var(--blue-lit); }
.tally .r { color: var(--red-lit); }
.bar { height: 6px; background: var(--red); border: 1px solid var(--steel-edge); width: 150px; }
.bar i { display: block; height: 100%; background: var(--blue); }

/* ---- main ------------------------------------------------------------- */
main { flex: 1 1 auto; display: flex; min-height: 0; }
#board { position: relative; flex: 1 1 auto; min-width: 0; background: #6f6a52; }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

#camctl {
  position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px;
  background: rgba(21,24,16,0.78); padding: 4px; border: 1px solid var(--steel-edge);
}
#camctl button { width: 30px; height: 28px; }
#scale {
  position: absolute; left: 12px; bottom: 12px; font-size: 10px; letter-spacing: 0.14em;
  color: var(--ink-dark); background: rgba(198,191,158,0.82); padding: 3px 8px;
  border: 1px solid rgba(34,38,28,0.5); text-transform: uppercase;
}


/* ---- left field-information sidebar ----------------------------------- */
#intel {
  flex: 0 0 250px; min-width: 220px; overflow-y: auto;
  background: linear-gradient(180deg,#1d221a,#252b20);
  border-right: 2px solid var(--steel-edge); color: var(--ink-dim);
  box-shadow: inset -18px 0 30px -28px var(--amber);
}
.intel-title { font-family:var(--display); color:var(--amber); font-size:12px; font-weight:700;
  letter-spacing:.22em; text-transform:uppercase; padding:12px; border-bottom:1px solid var(--steel-edge); }
#intel section { padding:10px 12px; border-bottom:1px solid rgba(0,0,0,.32); }
#intel h2 { margin:0 0 6px; font-family:var(--display); font-size:10px; color:var(--ink);
  letter-spacing:.18em; text-transform:uppercase; }
#intel p,#intel ol { margin:0; font-size:11px; line-height:1.55; }
#intel b { color:var(--ink); }
#intel ol { padding-left:18px; }
.intel-foot { padding:12px; color:#777e6d; font-size:10px; line-height:1.6; letter-spacing:.1em; }
.ver { color:var(--ink-dim); font-size:10px; letter-spacing:.08em; margin-left:7px; font-weight:400; }

/* ---- the message pad --------------------------------------------------- */
#pad {
  flex: 0 0 336px; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  background: var(--steel); border-left: 2px solid var(--steel-edge);
  box-shadow: inset 0 24px 40px -28px var(--amber);
}
.padhead {
  flex: 0 0 auto;
  font-family: var(--display); font-size: 11px; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--amber);
  padding: 9px 12px 7px; border-bottom: 1px solid var(--steel-edge);
  display: flex; justify-content: space-between; align-items: baseline;
}
.padhead small { color: var(--ink-dim); letter-spacing: 0.12em; }

#card {
  background: var(--pad); color: var(--ink-dark);
  margin: 10px; padding: 0; flex: 0 1 auto; overflow: auto; max-height: 62%;
  background-image: repeating-linear-gradient(180deg, transparent 0 25px, var(--pad-rule) 25px 26px);
  border: 1px solid #8d8768;
  box-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
#card .cardhead {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 10px 4px; border-bottom: 1px solid #8d8768;
  font-family: var(--display); letter-spacing: 0.16em; text-transform: uppercase;
}
#card .cardhead b { font-size: 15px; }
#card .cardhead span { font-size: 11px; color: #5c5741; }
#card .body { padding: 6px 10px 10px; }
#card .line { display: flex; justify-content: space-between; height: 26px; align-items: center; }
#card .line em { font-style: normal; color: #5c5741; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; }
#card .line b { font-weight: 700; }
#card .empty { padding: 18px 12px; color: #5c5741; font-size: 12px; line-height: 1.5; }

.pick { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 10px 8px; }
.pick button {
  flex: 1 1 auto; font-size: 11px; padding: 5px 6px;
  background: #b3ab8a; color: var(--ink-dark); border: 1px solid #7d775b;
}
.pick button[aria-pressed="true"] { background: var(--ink-dark); color: var(--pad); border-color: #12140e; }
.picklabel {
  padding: 6px 10px 0; font-family: var(--display); font-size: 10px;
  letter-spacing: 0.20em; text-transform: uppercase; color: #5c5741;
}

#roster { overflow: auto; flex: 1 1 110px; min-height: 82px; border-top: 1px solid var(--steel-edge); }
.rrow {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  border-bottom: 1px solid rgba(21,24,16,0.6); cursor: pointer; width: 100%;
  background: none; color: var(--ink); text-align: left; font-family: var(--mono); font-size: 12px;
}
.rrow:hover { background: var(--steel-lit); }
.rrow[aria-selected="true"] { background: #3b432f; box-shadow: inset 3px 0 0 var(--grease); }
.rrow .tag { width: 34px; color: var(--amber); }
.rrow .nm { flex: 1 1 auto; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .st { font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--ink-dim); }
.rrow.hurt .tag { color: var(--red-lit); }

#net { flex: 0 0 24%; min-height: 76px; overflow: auto; border-top: 1px solid var(--steel-edge); padding: 6px 10px; }
#net div { font-size: 11px; line-height: 1.45; color: var(--ink-dim); margin-bottom: 2px; }
#net div.kill { color: var(--amber); }
#net div.arty { color: #cfc08a; }
#net div.end { color: #fff; }

/* ---- deck -------------------------------------------------------------- */
#deck {
  flex: 0 0 auto; display: flex; gap: 6px; padding: 8px 10px;
  background: linear-gradient(180deg, var(--steel), var(--steel-lit));
  border-top: 2px solid var(--steel-edge); align-items: center; flex-wrap: wrap;
}
button {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  background: #39412e; color: var(--ink); border: 1px solid var(--steel-edge);
  padding: 8px 14px; cursor: pointer;
}
button:hover:not(:disabled) { background: #4a5439; }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
button.go { background: var(--amber); color: #1b1d12; font-weight: 700; border-color: #7c5410; }
button.go:hover:not(:disabled) { background: #ffc158; }

/* ---- dialogs ----------------------------------------------------------- */
#veil {
  position: fixed; inset: 0; background: rgba(10,12,8,0.78);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40;
}
#veil[hidden] { display: none; }
.sheetbox {
  background: var(--pad); color: var(--ink-dark); max-width: 620px; width: 100%;
  max-height: 92vh; overflow: auto; border: 1px solid #6d6750;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
}
.sheetbox h1 {
  font-family: var(--display); font-size: 26px; letter-spacing: 0.20em; text-transform: uppercase;
  margin: 0; padding: 16px 20px 10px; border-bottom: 2px solid var(--ink-dark);
}
.sheetbox h2 {
  font-family: var(--display); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  margin: 16px 20px 6px; color: #5c5741;
}
.sheetbox p { margin: 0 20px 10px; line-height: 1.55; font-size: 13px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 8px; }
.opts button {
  background: #b3ab8a; color: var(--ink-dark); border: 1px solid #7d775b;
  font-size: 12px; padding: 8px 12px;
}
.opts button[aria-pressed="true"] { background: var(--ink-dark); color: var(--pad); }
.sheetfoot { padding: 12px 20px 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.verdict { font-family: var(--display); font-size: 30px; letter-spacing: 0.10em; text-transform: uppercase; }
table.scores { width: calc(100% - 40px); margin: 4px 20px 12px; border-collapse: collapse; font-size: 13px; }
table.scores th, table.scores td { text-align: right; padding: 4px 6px; border-bottom: 1px solid rgba(60,54,34,0.25); }
table.scores th:first-child, table.scores td:first-child { text-align: left; }

@media (max-width: 1100px) {
  #intel { flex-basis: 205px; min-width: 190px; }
}
@media (max-width: 860px) {
  #intel { display:none; }
  main { flex-direction: column; }
  #pad { flex: 0 0 52%; border-left: none; border-top: 2px solid var(--steel-edge); }
  #card { max-height: 46%; }
  #net { flex: 0 0 20%; min-height: 60px; }
  #masthead .title { font-size: 15px; padding: 8px 10px 6px; letter-spacing: 0.14em; }
  .slot { padding: 6px 8px; }
  .bar { width: 84px; }
  #net { flex: 0 0 26%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
