:root {
  --paper: #ece2c9;
  --paper2: #e3d7ba;
  --paper3: #f2ead6;
  --ink: #2f2a20;
  --ink2: #5a5240;
  --ink3: #857a63;
  --olive: #6f6a45;
  --red: #9b3a26;
  --rule: rgba(60, 52, 38, .22);
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #cfc3a4;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  overscroll-behavior: none;
}

body { display: grid; place-items: center; }

.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  max-height: 920px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 80% at 50% 0%, #f3ead6 0%, var(--paper) 45%, #e4d8ba 100%);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(60, 52, 38, .18), 0 18px 50px rgba(40, 34, 22, .35);
}

/* ---------------- head ---------------- */

.head {
  flex: 0 0 auto;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(#f1e8d3, #ebe0c6);
  position: relative;
  z-index: 3;
}

.headline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.mark {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .16em;
  font-weight: 700;
}

.mission, .medals {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink2);
  white-space: nowrap;
}

.medals { color: var(--ink); }
.medals b { color: var(--red); }

.roll {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px 6px;
}

.roll li {
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: .02em;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
  border-bottom: 1px dotted rgba(90, 82, 64, .28);
  padding-bottom: 1px;
}

.roll li .r {
  font-size: 11px;
  color: var(--ink3);
  flex: 0 0 auto;
}

.roll li .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roll li.dead .n, .roll li.dead .r { text-decoration: line-through; color: rgba(60, 52, 38, .45); }
.roll li.dead { position: relative; }
.roll li.dead::after {
  content: '';
  position: absolute; left: 0; right: 0; top: 52%;
  height: 1px; background: rgba(155, 58, 38, .65);
}

/* ---------------- map ---------------- */

.mapwrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--paper);
}

#sheet {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.objbar {
  position: absolute;
  left: 12px; right: 12px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  background: rgba(242, 234, 214, .80);
  border-top: 1px solid rgba(60, 52, 38, .45);
  border-bottom: 1px solid rgba(60, 52, 38, .2);
  font-size: 11px;
  letter-spacing: .04em;
}

.objkind {
  color: var(--ink);
  border-left: 2px solid var(--ink);
  padding: 0 0 0 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

.objtext { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.objprog { font-variant-numeric: tabular-nums; color: var(--ink2); }
.objbar.done .objkind { border-left-color: var(--olive); color: var(--olive); }
.objbar.hot { animation: hot 1.2s linear infinite; }
@keyframes hot { 50% { border-color: rgba(155, 58, 38, .7); } }

/* ---------------- orders ---------------- */

.orders {
  flex: 0 0 auto;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--rule);
  background: linear-gradient(#ece1c7, #e6dabd);
  position: relative;
  z-index: 3;
}

.selrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.who { flex: 1 1 auto; min-width: 0; }
.who b {
  display: block;
  font-size: 13px;
  letter-spacing: .02em;
  font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who span { font-size: 11px; color: var(--ink2); display: block; }
.who .wounded { color: var(--red); }

.next {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 96px;
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  background: var(--paper3);
  border: 1px solid rgba(60, 52, 38, .45);
  border-radius: 2px;
  letter-spacing: .04em;
}
.next:active { background: #d9cdae; }

.acts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.act {
  min-height: 60px;
  padding: 6px 6px 5px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(#f5edd9, #e8ddc1);
  border: 1px solid rgba(60, 52, 38, .5);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 1px 2px rgba(50, 42, 28, .1);
}
.act b { font-size: 14px; letter-spacing: .02em; }
.act span { font-size: 11px; line-height: 1.25; color: var(--ink2); }
.act.armed {
  background: var(--ink);
  color: var(--paper3);
  border-color: var(--ink);
}
.act.armed span { color: #d8ccb0; }
.act:disabled, .act.off { opacity: .45; }
.act:active { transform: translateY(1px); }

.hint {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink2);
  min-height: 15px;
}
.hint em { font-style: normal; color: var(--red); }

.foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 0 12px 5px;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink3);
  background: #e6dabd;
}

/* ---------------- veils ---------------- */

.veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(40, 34, 23, .58);
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: auto;
  animation: fade .18s ease-out;
}
.veil[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.card {
  width: 100%;
  max-width: 390px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 105, 80, .05) 0 1px, transparent 1px 26px),
    linear-gradient(#f6eeda, #eee3c7);
  border: 1px solid rgba(50, 42, 28, .55);
  box-shadow: 0 10px 26px rgba(30, 25, 16, .35), 0 0 0 4px rgba(240, 232, 210, .25);
  padding: 18px 16px 14px;
  position: relative;
  max-height: calc(100dvh - 28px);
  overflow: auto;
}

.card::before {
  content: '';
  position: absolute;
  top: -9px; left: 30%; width: 40%; height: 18px;
  background: rgba(214, 198, 160, .75);
  border: 1px solid rgba(120, 105, 80, .2);
  transform: rotate(-1.2deg);
}

.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--ink3);
}

.card h1, .card h2 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: .01em;
  margin: 0 0 8px;
  line-height: 1.1;
}
.card h1 { font-size: 26px; }
.card h2 { font-size: 23px; }

.briefText {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.45;
  margin: 0 0 8px;
  color: #3c362a;
}

.briefMeta { font-size: 11px; color: var(--ink2); margin: 0 0 10px; letter-spacing: .03em; }

.names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 7px 0;
  margin-bottom: 12px;
  font-size: 11px;
}
.names div { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.names .r { color: var(--ink3); }
.names .s { text-decoration: underline dotted rgba(90, 82, 64, .4); }

.go {
  width: 100%;
  min-height: 50px;
  font: inherit;
  font-size: 14px;
  letter-spacing: .06em;
  background: var(--ink);
  color: var(--paper3);
  border: 1px solid var(--ink);
  border-radius: 2px;
}
.go:active { background: #443c2c; }
.go:disabled { opacity: .5; }

.fine {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink3);
  text-align: center;
  letter-spacing: .03em;
}

/* ---------------- roll call ---------------- */

.rollcard { min-height: 300px; display: flex; flex-direction: column; }

.readout {
  flex: 1 1 auto;
  border-top: 1px solid var(--rule);
  margin: 4px 0 12px;
  padding-top: 8px;
  min-height: 120px;
}

.entry {
  padding: 7px 0 8px;
  border-bottom: 1px dotted rgba(90, 82, 64, .3);
  animation: rise .28s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }

.entry .nm {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .01em;
}
.entry .nm small {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink3);
  margin-right: 5px;
}
.entry .how {
  font-size: 11px;
  letter-spacing: .05em;
  color: var(--red);
  margin: 2px 0 4px;
}
.entry .say {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.4;
  color: #3d3729;
}
.entry.alive .how { color: var(--olive); }

.empty { font-family: var(--serif); font-size: 16px; color: var(--ink2); padding: 10px 0; }

/* ---------------- board ---------------- */

.medalrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: 12px;
}
.medalrow .pips { display: flex; gap: 3px; }
.pip { width: 11px; height: 11px; border: 1px solid var(--ink); transform: rotate(45deg); }
.pip.full { background: var(--red); border-color: var(--red); }

.promo {
  border: 1px dashed rgba(90, 82, 64, .5);
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink2);
}
.promo b { color: var(--ink); font-size: 12px; }
.promo .newman {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  margin-top: 3px;
}

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

.ledgerveil {
  background: rgba(30, 26, 17, .78);
  place-items: start center;
  padding: 0;
  display: block;
  overflow-y: auto;
}

.ledger {
  width: 100%;
  max-width: 430px;
  min-height: 100%;
  background:
    radial-gradient(140% 60% at 50% 0%, #f7efdb, #e9ddbe 70%, #e0d3b2);
  padding: 26px 20px 34px;
  position: relative;
}

.ledger h1 {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: .04em;
  margin: 0;
  line-height: 1;
}
.ledger .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: #4a4335;
  margin: 8px 0 4px;
}
.ledger .rule-t { border: 0; border-top: 2px solid var(--ink); margin: 12px 0 3px; }
.ledger .rule-h { border: 0; border-top: 1px solid rgba(47, 42, 32, .45); margin: 2px 0 14px; }

.ledger .totals {
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink2);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ledger .m { margin: 0 0 13px; break-inside: avoid; }
.ledger .mhead {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--ink2);
}
.ledger .mhead .num {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: 0;
}
.ledger .mhead .out { margin-left: auto; letter-spacing: .06em; }
.ledger .mhead .out.won { color: var(--olive); }
.ledger .mhead .out.lost { color: var(--red); }

.ledger .dead {
  margin: 3px 0 0 16px;
  font-size: 12px;
  line-height: 1.45;
}
.ledger .dead .dn { font-family: var(--serif); font-size: 14px; color: var(--red); }
.ledger .dead .dl { color: #4c4536; font-size: 11.5px; font-family: var(--serif); }
.ledger .none { margin: 3px 0 0 16px; font-size: 11px; color: var(--ink3); letter-spacing: .04em; }

.ledger .stamp {
  margin: 26px auto 8px;
  width: 190px;
  text-align: center;
  border: 3px double rgba(155, 58, 38, .75);
  color: rgba(155, 58, 38, .8);
  padding: 7px 4px;
  transform: rotate(-4deg);
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: .18em;
}

.ledger .signoff {
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 22px;
  color: #3e382b;
}
.ledger .again {
  margin-top: 20px;
  width: 100%;
  min-height: 50px;
  font: inherit;
  font-size: 13px;
  letter-spacing: .06em;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.ledger .again:active { background: rgba(47, 42, 32, .08); }

/* ---------------- wide screens: a sheet on the desk ---------------- */

@media (min-width: 700px) {
  body {
    background:
      radial-gradient(75% 60% at 50% 12%, rgba(255, 255, 255, .10) 0%, transparent 60%),
      radial-gradient(120% 90% at 50% 0%, #4d5849 0%, #3c463d 52%, #262d27 100%);
  }

  .app {
    width: 520px;
    max-width: 520px;
    height: calc(100dvh - 56px);
    max-height: 900px;
    box-shadow:
      0 0 0 1px rgba(18, 16, 10, .55),
      0 2px 0 rgba(255, 255, 255, .18) inset,
      0 26px 60px rgba(0, 0, 0, .45),
      0 8px 20px rgba(0, 0, 0, .32);
  }

  .ledger { max-width: 520px; }
  .foot { font-size: 12px; }
}

@media (max-height: 740px) {
  .act { min-height: 54px; }
  .head { padding-top: 6px; padding-bottom: 4px; }
  .roll li { font-size: 11px; }
  .foot { display: none; }
}
