/* Little Wars (1913)
 * The floor is the subject, so the floor gets the room. Everything else is
 * the book: laid paper, sepia ink, and figures set in a typewriter face
 * because every rule in Wells is a measurement.
 */

:root {
  --baize: #6E8B52;
  --baize-deep: #4A6337;
  --paper: #E4DAC2;
  --paper-2: #D6C9AC;
  --ink: #2E2A22;
  --ink-soft: #5E5344;
  --lead-red: #A8322B;
  --lead-blue: #2C4C7A;
  --brass: #8A6420;
  --rule: rgba(46, 42, 34, 0.28);

  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --figure: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--baize-deep);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
}

/* ----------------------------------------------------------------- shell */

#shell {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: 100vh;
  height: 100dvh;
}

#floor {
  position: relative;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 250, 230, 0.10), transparent 60%),
    var(--baize-deep);
  overflow: hidden;
}

#field {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

/* Standing over the table: the camera controls sit on the floor itself,
   bottom-left, where they are out of the way of the fighting. */
#camera {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(30, 40, 24, 0.55);
  padding: 5px 9px 5px 5px;
  border: 1px solid rgba(232, 224, 206, 0.22);
}

#camera button {
  min-width: 34px;
  padding: 6px 8px;
  font-size: 13px;
  letter-spacing: 0.06em;
  background: rgba(232, 224, 206, 0.92);
  color: var(--ink);
}

#camera button:hover { background: #fff; }
#camera button:disabled { opacity: 0.38; cursor: default; }
#camera button:disabled:hover { background: rgba(232, 224, 206, 0.92); }

#zoomRead {
  font-family: var(--figure);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: rgba(232, 224, 206, 0.85);
  padding-left: 4px;
  min-width: 96px;
}

/* ---------------------------------------------------------------- column */

#orders {
  background: var(--paper);
  border-left: 3px double var(--rule);
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}

h1 {
  font-family: var(--display);
  font-size: 27px;
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
}

h1 small {
  display: block;
  font-family: var(--figure);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 5px;
}

h2 {
  font-family: var(--figure);
  font-size: 10.5px;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--rule);
}

.strength {
  display: grid;
  gap: 3px;
  font-family: var(--figure);
  font-size: 12.5px;
}

.strength div { padding-left: 12px; position: relative; }

.strength div::before {
  content: "";
  position: absolute;
  left: 0; top: 0.52em;
  width: 7px; height: 7px;
}

#sideRed::before { background: var(--lead-red); }
#sideBlue::before { background: var(--lead-blue); }

#moveNo {
  font-family: var(--figure);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

#selName { font-weight: 600; }
#selNote { font-size: 14.5px; color: var(--ink-soft); margin-top: 2px; }

#guns {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--figure);
  font-size: 11.5px;
}

#guns .gun { padding-left: 12px; position: relative; }
#guns .gun::before {
  content: "";
  position: absolute; left: 0; top: 0.5em;
  width: 6px; height: 6px; border-radius: 50%;
}
#guns .red::before { background: var(--lead-red); }
#guns .blue::before { background: var(--lead-blue); }
#guns .gone { opacity: 0.45; text-decoration: line-through; }

/* The rule currently in force, set as a footnote from the book. */
#ruleNow {
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
  border-left: 3px solid var(--brass);
  padding: 5px 0 5px 10px;
  background: rgba(138, 100, 32, 0.07);
}

#logWrap { flex: 1 1 auto; min-height: 90px; overflow: hidden; display: flex; flex-direction: column; }

#log {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  font-size: 13.5px;
  flex: 1 1 auto;
}

#log li {
  padding: 4px 0 4px 30px;
  border-bottom: 1px solid rgba(46, 42, 34, 0.12);
  position: relative;
}

#log .mv {
  position: absolute;
  left: 0;
  font-family: var(--figure);
  font-size: 11px;
  color: var(--brass);
}

/* --------------------------------------------------------------- buttons */

.row { display: flex; gap: 7px; flex-wrap: wrap; }

button {
  font-family: var(--figure);
  font-size: 11.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  padding: 9px 12px;
  color: var(--paper);
  background: var(--ink);
  border: none;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}

button:hover { background: #45402F; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
button.ghost:hover { background: rgba(46, 42, 34, 0.08); }

button.wide { flex: 1 1 auto; }

.row.begin { margin-top: 20px; }

.figures {
  font-family: var(--figure);
  font-size: 13px;
}

/* --------------------------------------------------------------- dialogs */

dialog-ish, .sheet {
  position: fixed;
  inset: 0;
  background: rgba(30, 40, 24, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.sheet[hidden] { display: none; }

.card {
  background: var(--paper);
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px 28px;
  border: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.card h2 { margin-top: 18px; }
.card p { font-size: 15px; }
.card p.lead { font-size: 16.5px; }

label {
  display: block;
  font-family: var(--figure);
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 14px 0 4px;
}

select {
  width: 100%;
  font-family: var(--body);
  font-size: 15px;
  padding: 8px 9px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--ink);
}

select:focus-visible { outline: 3px solid var(--brass); outline-offset: 1px; }

#blurb {
  font-size: 14.5px;
  font-style: italic;
  color: var(--ink-soft);
  margin: 10px 0 0;
  min-height: 3.2em;
}

.credit {
  font-family: var(--figure);
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}

.card ul { font-size: 14.5px; padding-left: 18px; }
.card li { margin-bottom: 5px; }

kbd {
  font-family: var(--figure);
  font-size: 11px;
  background: var(--ink);
  color: var(--paper);
  padding: 1px 5px;
}

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

@media (max-width: 860px) {
  body { overflow: auto; }

  #shell {
    grid-template-columns: 1fr;
    grid-template-rows: 62vh auto;
    height: auto;
  }

  #orders {
    border-left: none;
    border-top: 3px double var(--rule);
    overflow: visible;
  }

  #logWrap { max-height: 240px; }
  h1 { font-size: 23px; }
  #camera { left: 8px; bottom: 8px; padding: 4px 7px 4px 4px; }
  #zoomRead { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
