/* Typhoon of Steel — the operations desk.
   Everything around the sheet is canvas and blackout; the map is the only lit
   surface on the page, and the contact board is set like a message pad. */

:root {
  --black: #14170f;
  --canvas: #232720;
  --canvas-2: #2c3128;
  --paper: #e8dcc0;
  --ink: #2b2418;
  --brass: #b08a3c;
  --brass-dim: #7d6229;
  --signal: #a53a2c;
  --us: #6f9e7e;
  --ja: #c98a80;
  --line: rgba(232, 220, 192, 0.16);
  --display: "DejaVu Sans Condensed", "Liberation Sans Narrow", "TeX Gyre Heros Cn", "Arial Narrow", Arial, sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--black);
  color: var(--paper);
  font-family: var(--body);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

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

/* ------------------------------------------------------------------ bar */

#bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #2c3128 0%, #1d211a 100%);
  border-bottom: 2px solid var(--brass-dim);
  flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }

.mark {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
}

.sub {
  font-family: var(--pad);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--brass);
  text-transform: uppercase;
}

.readout {
  display: flex;
  gap: 16px;
  flex: 1;
  font-family: var(--pad);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: rgba(232, 220, 192, 0.82);
  flex-wrap: wrap;
}

.readout span { white-space: nowrap; }
.readout #phase { color: var(--brass); }

.acts { display: flex; gap: 8px; }

button {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 700;
  border-radius: 2px;
  border: 1px solid var(--brass-dim);
  background: transparent;
  color: var(--paper);
  padding: 8px 12px;
  cursor: pointer;
}

button:hover { border-color: var(--brass); color: var(--brass); }
button:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
button.primary { background: var(--brass); color: #17190f; border-color: var(--brass); }
button.primary:hover { background: #c99e48; color: #17190f; }
button.primary:disabled { background: #4a4534; border-color: #4a4534; color: #8b8474; cursor: default; }
button.ghost { border-color: var(--line); }

/* ----------------------------------------------------------------- body */

main {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 288px;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--canvas);
  border-right: 1px solid var(--line);
  padding: 12px 14px 20px;
  overflow-y: auto;
}

#right { border-right: none; border-left: 1px solid var(--line); }

.panel h3 {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 4px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

/* The canvas is taken out of the flow: sized in pixels from its box, it can
   otherwise outgrow that box and lay itself over the ledger. */
#board { position: relative; background: #0f120d; min-height: 320px; overflow: hidden; }
#map { position: absolute; top: 0; left: 0; touch-action: none; cursor: crosshair; }

.chip {
  position: absolute;
  display: none;
  padding: 3px 7px;
  background: rgba(20, 23, 15, 0.92);
  border: 1px solid var(--brass-dim);
  color: var(--paper);
  font-family: var(--pad);
  font-size: 11px;
  pointer-events: none;
  white-space: nowrap;
}

.chip.on { display: block; }

/* ------------------------------------------------------------ unit card */

.unit-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.unit-head strong { font-family: var(--display); font-size: 15px; letter-spacing: 0.05em; }

.tag {
  font-family: var(--pad);
  font-size: 10px;
  padding: 1px 5px;
  border: 1px solid currentColor;
}
.tag.us { color: var(--us); }
.tag.ja { color: var(--ja); }

.grid {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 3px 8px;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.grid .k { font-family: var(--pad); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(232, 220, 192, 0.55); padding-top: 2px; }
.grid .v { color: var(--paper); }

.orders { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.order { padding: 7px 9px; font-size: 11px; }
.order.on { background: var(--brass); color: #17190f; border-color: var(--brass); }
.order.off { opacity: 0.35; cursor: default; }
.order.off:hover { border-color: var(--brass-dim); color: var(--paper); }

.discipline { border-top: 1px solid var(--line); padding-top: 10px; }
.label {
  display: block;
  font-family: var(--pad);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 220, 192, 0.5);
  margin-bottom: 6px;
}

.pill { padding: 6px 10px; font-size: 11px; margin: 0 5px 5px 0; }
.pill.on { background: var(--brass); color: #17190f; border-color: var(--brass); }

.hint, .fine { font-size: 11.5px; color: rgba(232, 220, 192, 0.55); line-height: 1.45; }
.fine { font-family: var(--pad); font-size: 10.5px; }
.message { min-height: 18px; font-size: 12px; color: var(--brass); margin-top: 10px; }

/* --------------------------------------------------- the contact board */

.contact {
  display: block;
  width: 100%;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--pad);
  border: none;
  border-left: 3px solid var(--signal);
  border-bottom: 1px solid var(--line);
  background: rgba(165, 58, 44, 0.08);
  padding: 7px 9px;
  margin-bottom: 5px;
  border-radius: 0;
}
.contact:hover { background: rgba(165, 58, 44, 0.18); color: var(--paper); border-left-color: var(--signal); }
.contact strong { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.contact .meta { display: block; font-size: 10.5px; color: rgba(232, 220, 192, 0.6); margin-top: 2px; }
.contact.stale { border-left-style: dashed; opacity: 0.78; }
.contact.seen { border-left-width: 4px; }

.strip { margin-top: 16px; }
.disc-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--pad);
  font-size: 11px;
  padding: 5px 7px;
  margin-bottom: 3px;
  border: 1px solid var(--line);
  border-radius: 0;
}
.disc-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disc-row .od { color: var(--brass); }
.disc-row.hold .od { color: #8fa4b4; }
.disc-row.free .od { color: var(--signal); }
.disc-row.on { border-color: var(--brass); }
.disc-row .seen-mark { color: var(--signal); font-size: 10px; }

/* -------------------------------------------------------------- ledger */

footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  background: #1a1e16;
  border-top: 1px solid var(--brass-dim);
  max-height: 116px;
  overflow: hidden;
}

#ledger { max-height: 116px; overflow-y: auto; padding: 8px 16px; }

.entry {
  display: flex;
  gap: 10px;
  font-family: var(--pad);
  font-size: 11.5px;
  padding: 2px 0;
  color: rgba(232, 220, 192, 0.78);
}
.entry .turn { color: var(--brass-dim); min-width: 30px; }
.entry.opfire .txt, .entry.fire .txt { color: #d9a08c; }
.entry.kill .txt, .entry.breach .txt { color: var(--signal); }
.entry.morale .txt { color: #c9b06a; }
.entry.naval .txt, .entry.call .txt { color: #86a8bd; }
.entry.verdict .txt { color: var(--brass); font-weight: 700; }

/* --------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 8, 0.86);
  padding: 20px;
  overflow-y: auto;
}
.modal.open { display: flex; }

.card {
  background: var(--canvas);
  border: 1px solid var(--brass-dim);
  border-top: 4px solid var(--brass);
  max-width: 720px;
  width: 100%;
  padding: 26px 28px 22px;
  max-height: 92vh;
  overflow-y: auto;
}

.title {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.lede { font-size: 13.5px; line-height: 1.5; color: rgba(232, 220, 192, 0.8); margin: 0 0 18px; }

.choices { display: grid; gap: 8px; margin-bottom: 16px; }

.choice {
  display: block;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  padding: 11px 13px;
  border-color: var(--line);
}
.choice strong { display: block; font-family: var(--display); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
.choice .meta { display: block; font-family: var(--pad); font-size: 10.5px; color: var(--brass); margin: 3px 0 4px; }
.choice .blurb { display: block; font-size: 12px; line-height: 1.45; color: rgba(232, 220, 192, 0.62); }
.choice.on { border-color: var(--brass); background: rgba(176, 138, 60, 0.12); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.row.end { justify-content: flex-end; margin-top: 16px; margin-bottom: 6px; }
.row .label { margin: 0 4px 0 0; }

/* -------------------------------------------------------------- narrow */

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: minmax(300px, 56vh) auto auto; }
  #board { order: -1; min-height: 300px; }
  .panel { border: none; border-top: 1px solid var(--line); max-height: none; }
  #bar { gap: 10px; padding: 8px 12px; }
  .mark { font-size: 17px; }
  .readout { font-size: 11px; gap: 10px; }
  footer, #ledger { max-height: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
