:root {
  --bg: #070c11;
  --panel: #0f161f;
  --panel2: #161f2a;
  --line: #2b3540;
  --text: #e8edf0;
  --muted: #b3bcc5;
  --accent: #a0bfda;
  --accent2: #97c7ed;
  --danger: #f48d85;
  --ok: #a0cead;
  --font: "Segoe UI", Arial, sans-serif;
  --head: "Marcellus SC", "Barlow Semi Condensed", Georgia, serif;
}
html,
body {
  font-size: 16px;
}
button,
select,
input[type="text"],
input[type="number"] {
  font-size: 14px;
}
button {
  padding: 10px 14px;
  min-height: 38px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #1c2836, #141d29);
  transition:
    background 0.16s,
    border-color 0.16s,
    transform 0.16s;
}
button:hover:not(:disabled) {
  background: #263545;
  border-color: #8b9dad;
}
button:focus-visible,
.faction-card:focus-visible,
.node:focus-visible {
  outline: 2px solid #aeceea;
  outline-offset: 4px;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button.primary {
  background: linear-gradient(145deg, #aec6db, #7f9eb9);
  border-color: #b4cfe6;
  color: #1c1a17;
  font-weight: 700;
}
button.primary:hover:not(:disabled) {
  background: #b6d1e8;
}
button.small {
  font-size: 13px;
  min-height: 32px;
  padding: 5px 10px;
}
select,
input[type="text"],
input[type="number"] {
  background: #0a1119;
  padding: 9px;
  border-color: #455466;
}
h2 {
  font-size: 24px;
  letter-spacing: 0.025em;
}
h3 {
  font-size: 16px;
  letter-spacing: 0.025em;
}
.muted {
  line-height: 1.5;
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.27em;
  color: #a6bdd0;
}
small {
  font-size: 13px;
}
.pill,
.props,
.unit-card .props,
.entry .opts,
.problems,
.shop-item .desc {
  font-size: 14px;
  line-height: 1.55;
}
.stat {
  width: 44px;
  padding: 5px 0;
  background: #0b121b;
}
.stat span {
  font-size: 12px;
  letter-spacing: 0;
}
.stat b {
  font-size: 18px;
}
.statline {
  gap: 4px;
}
.statline .stat {
  width: 38px;
  flex: 1;
}
.unit-card .head b {
  font-size: 15px;
}
.unit-card,
.entry {
  padding: 14px;
  background: linear-gradient(135deg, #18232e, #101924);
  border-color: #2d3744;
}
.unit-card .head,
.entry .head {
  flex-wrap: wrap;
}
.unit-card .stats {
  margin: 10px 0;
}
.unit-card .stats .stat {
  flex: 1;
  max-width: 65px;
}
.panel {
  background: rgba(12, 19, 28, 0.94);
  border-color: #2d3743;
  padding: 16px;
}
.page {
  padding: 22px 30px;
  gap: 18px;
}
.topbar {
  flex-wrap: wrap;
  padding-bottom: 16px;
}
.topbar h2 {
  margin: 0;
}
.screen:not(#screen-menu):not(#screen-battle) {
  background:
    linear-gradient(100deg, rgba(7, 12, 17, 0.98), rgba(7, 12, 17, 0.88)),
    url("../assets/title-battle.webp") center/cover;
}
.tip {
  background: rgba(7, 13, 21, 0.97);
  border-color: #617488;
  font-size: 14px;
  max-width: 340px;
  box-shadow: 0 12px 36px #0008;
}
.tip b {
  color: #b5d0e8;
}
kbd {
  font-size: 12px;
  background: #1d2937;
  border-color: #56687c;
}
/* The title screen is the first scene of the game. */
#screen-menu {
  align-items: flex-start;
  justify-content: center;
  isolation: isolate;
  padding: 60px clamp(30px, 7vw, 130px);
  overflow: auto;
  background: #070b11;
}
.menu-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("../assets/title-battle.webp") center/cover;
}
.menu-art:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(4, 8, 13, 0.92),
      rgba(5, 10, 16, 0.7) 32%,
      rgba(5, 10, 16, 0.1) 69%
    ),
    linear-gradient(0deg, #05090f 0%, transparent 40%);
}
.menu-content {
  width: min(470px, 100%);
  position: relative;
  animation: arrival 0.8s ease both;
}
#screen-menu h1 {
  font-size: clamp(84px, 10vw, 156px);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: 0.04em;
  color: #cfdfed;
  text-shadow: 0 3px 25px #0008;
  margin: 20px 0 0 -4px;
}
#screen-menu .sub {
  font-size: 15px;
  letter-spacing: 0.38em;
  color: #b5ccdf;
  margin: 4px 0 28px;
}
.menu-intro {
  font-family: Georgia, serif;
  font-size: 24px;
  color: #d7dde2;
}
#screen-menu .menu {
  width: 100%;
  margin-top: 28px;
  gap: 10px;
}
#screen-menu .menu > button {
  text-align: left;
  padding: 16px 20px;
  background: rgba(12, 20, 29, 0.86);
  border-color: #66727a66;
  min-height: 68px;
  position: relative;
}
#screen-menu .menu > button:hover {
  background: rgba(32, 44, 57, 0.97);
  border-color: #9eb3c6;
}
#screen-menu .menu > button.primary {
  background: linear-gradient(110deg, #afc9e0, #85a3bd);
  border-color: #b6cfe5;
  color: #13171b;
  box-shadow: 0 10px 40px #0005;
}
#screen-menu .menu > button.primary:hover {
  background: #b6d0e7;
}
#screen-menu .menu button span {
  display: block;
  font-family: var(--head);
  font-size: 18px;
  letter-spacing: 0.02em;
}
#screen-menu .menu button small {
  display: block;
  color: #b7c0c7;
  margin-top: 5px;
  font-weight: 400;
  letter-spacing: 0;
}
#screen-menu .menu button.primary small {
  color: #403b30;
}
#screen-menu .menu button b {
  position: absolute;
  right: 20px;
  top: 22px;
  font-size: 26px;
  font-weight: 400;
}
.menu-utilities {
  display: flex;
  gap: 20px;
  margin-top: 4px;
}
.menu-utilities button {
  background: none;
  border: 0;
  padding: 8px 0;
  color: #b9c1c9;
  min-height: 40px;
}
#screen-menu .credit {
  left: clamp(30px, 7vw, 130px);
  bottom: 20px;
  text-align: left;
  padding: 0;
  max-width: unset;
  font-size: 12px;
  color: #9eacb8;
}
.menu-caption {
  position: absolute;
  right: 5vw;
  bottom: 9vh;
  max-width: 270px;
  color: #cdd4da;
}
.menu-caption span {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: #9bb9d3;
}
.menu-caption p {
  font-family: Georgia, serif;
  font-style: italic;
  line-height: 1.45;
  margin-top: 10px;
  font-size: 20px;
}
/* Army and campaign screens. */
.factions {
  gap: 16px;
  margin: 18px 0 24px;
}
.faction-card {
  padding: 0;
  overflow: hidden;
  background: #0f1821;
  border-color: #435363;
  text-align: left;
}
.faction-card:hover {
  border-color: #a6c2db;
}
.faction-card.on {
  background: #202a35;
  border-color: #acc9e2;
  box-shadow: inset 0 -3px #a2bed6;
}
.faction-card .sym {
  display: none;
}
.faction-card .name,
.faction-card .tag {
  padding: 0 14px;
}
.faction-card .name {
  font-size: 16px;
  margin: 16px 0 8px;
}
.faction-card .tag {
  font-size: 14px;
  padding-bottom: 18px;
}
.faction-art {
  height: clamp(125px, 22vh, 260px);
  background-image: url("../assets/faction-portraits.webp");
  background-size: 500% auto;
  background-repeat: no-repeat;
  border-bottom: 1px solid #536170;
  position: relative;
}
.faction-art:after {
  content: "";
  position: absolute;
  inset: 65% 0 0;
  background: linear-gradient(0deg, #0f1821, transparent);
}
.faction-art.f0 {
  background-position: 0% 18%;
}
.faction-art.f1 {
  background-position: 25% 18%;
}
.faction-art.f2 {
  background-position: 50% 18%;
}
.faction-art.f3 {
  background-position: 75% 18%;
}
.faction-art.f4 {
  background-position: 100% 18%;
}
.faction-card.on .faction-art:before {
  content: "SELECTED";
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 0.12em;
  background: #a2bed6;
  color: #13171b;
  padding: 5px 7px;
  font-weight: 700;
}
.commander-card {
  display: flex;
  gap: 14px;
}
.mini-portrait {
  width: 54px;
  min-width: 54px;
  height: 70px;
  border: 1px solid #627183;
  border-radius: 3px;
  background-image: url("../assets/faction-portraits.webp");
  background-size: 500% auto;
  background-repeat: no-repeat;
}
.unit-portrait {
  height: 145px;
  margin: -10px -10px 14px;
  background-image: url("../assets/faction-portraits.webp");
  background-size: 500% auto;
  position: relative;
  border-bottom: 1px solid #5c6d7d;
}
.unit-portrait:after {
  content: "";
  position: absolute;
  inset: 50% 0 0;
  background: linear-gradient(0deg, #0f161f, transparent);
}
.unit-portrait span {
  position: absolute;
  bottom: 8px;
  left: 12px;
  z-index: 1;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #afc4d6;
}
.unit-card .unit-family {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.unit-role {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #abbbc9;
}
.entry .opts {
  gap: 10px;
}
.entry .opts label {
  flex-wrap: wrap;
}
#builder-list {
  min-width: 330px;
}
#camp-map {
  background:
    linear-gradient(#0b1724df, #09101be8),
    url("../assets/title-battle.webp") center/cover;
  border-color: #465567;
}
#camp-map svg {
  max-width: none;
}
.node .lbl {
  font-size: 14px;
  fill: #cad2d9;
}
.node.avail circle {
  filter: drop-shadow(0 0 7px #e3bc6770);
}
#camp-side {
  width: 360px;
}
#camp-log {
  font-size: 14px !important;
  height: 170px !important;
}
.roster .entry .head {
  font-size: 15px;
}
.campaign-heading {
  padding: 22px 24px 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(#0a111b 80%, transparent);
}
.campaign-heading h3 {
  font-size: 22px;
  margin: 0 0 6px;
}
.campaign-heading p {
  font-size: 14px;
  color: #bdc9d2;
}
.shop-item {
  padding: 14px;
}
.shop-item .desc {
  font-size: 15px;
}
.rules {
  max-width: 1100px;
  font-size: 16px;
}
.rules table {
  font-size: 15px;
}
.rules td,
.rules th {
  padding: 9px;
}
.rules li {
  margin: 7px 0 7px 22px;
}
/* A wide battlefield with the chronicle tucked away until requested. */
#battle-top {
  height: auto;
  min-height: 58px;
  padding: 9px 18px;
  gap: 15px;
  background: #0c131c;
}
#battle-top .phase {
  font-size: 16px;
  letter-spacing: 0.04em;
}
#battle-top .who {
  font-size: 14px;
  padding: 5px 10px;
  background: #1c3243;
}
#battle-turn,
#battle-score {
  font-size: 14px;
}
#phase-track {
  height: 38px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 2px;
  background: #090f17;
  border-bottom: 1px solid #2f3b48;
  flex-shrink: 0;
}
.phase-step {
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 9px 26px;
  color: #8093a5;
  border-bottom: 2px solid transparent;
  display: flex;
  gap: 10px;
}
.phase-step b {
  font-size: 11px;
  color: #6e8498;
}
.phase-step.current {
  color: #c0d4e6;
  border-color: #9ebbd4;
  background: #22272f;
}
.phase-step.current b {
  color: #9ebbd4;
}
#battle-main {
  overflow: hidden;
}
#battle-left {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(#121b26, #0b121b);
  border-color: #313d49;
}
#battle-left .unitinfo {
  padding: 14px 14px 10px;
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}
#battle-left .actions {
  font-size: 14px;
  line-height: 1.45;
  max-height: 48%;
  overflow: auto;
  padding: 12px;
  gap: 8px;
  background: #091019;
}
#battle-left .actions button {
  font-size: 14px;
  line-height: 1.25;
}
.unitinfo .props {
  font-size: 13px;
  line-height: 1.5;
  margin: 10px 0;
}
.unitinfo .statline {
  margin: 12px 0;
}
#battle-canvas-wrap {
  background: #0e151c;
  overflow: hidden;
  min-height: 260px;
}
#battle-canvas {
  touch-action: none;
}
#battle-right {
  display: none;
  width: 290px;
  flex-shrink: 0;
  background: #0d1520;
  border-color: #3c4b5d;
}
#screen-battle.is-deploy #battle-right,
#screen-battle.log-open #battle-right {
  display: flex;
}
.dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #3c4b5d;
  font-size: 14px;
  color: #b3c9dc;
}
#screen-battle.is-deploy #close-log {
  display: none;
}
#deploy-tray {
  padding: 12px;
}
#deploy-tray > h3 {
  display: none;
}
#deploy-tray > p {
  font-size: 14px;
  margin-bottom: 14px;
}
.tray-unit {
  padding: 12px;
  font-size: 14px;
}
.tray-unit b {
  display: block;
  margin-bottom: 4px;
}
.tray-unit.on {
  background: #24313e;
  border-color: #a6c2db;
}
.tray-unit.placed {
  opacity: 0.8;
}
#battle-log {
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
}
#battle-log .l {
  padding: 8px 0;
  border-color: #202b39;
}
.die {
  height: 23px;
  width: 23px;
  font-size: 13px;
}
#battle-hint {
  left: 14px;
  bottom: 12px;
  max-width: calc(100% - 28px);
  font-size: 14px;
  line-height: 1.45;
  padding: 9px 13px;
  background: rgba(7, 14, 21, 0.94);
  border-color: #647584;
  z-index: 3;
  box-shadow: 0 3px 20px #0003;
}
#battle-toggles {
  right: 14px;
  top: 12px;
  z-index: 5;
}
#battle-toggles button {
  background: #0d1928ef;
  border-color: #526477;
}
#battle-toggles button.primary {
  color: #b8d3ea;
  border-color: #a5bed4;
  background: #3a362d;
}
#phase-banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  background: linear-gradient(
    90deg,
    transparent,
    #0c1724ed 15%,
    #0c1724ed 85%,
    transparent
  );
  padding: 18px 54px;
  white-space: nowrap;
  border-block: 1px solid #d9b77b88;
}
#phase-banner.show {
  animation: phase-reveal 2.8s ease both;
}
#phase-banner b {
  font-family: var(--head);
  font-size: 25px;
  color: #bbd3e9;
  display: block;
}
#phase-banner small {
  color: #d4dee6;
  font-size: 14px;
  display: block;
  margin-top: 7px;
}
#army-strip {
  height: 96px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: #0c141d;
  border-top: 1px solid #3d4d5f;
  flex-shrink: 0;
}
.army-strip-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #b0c7db;
  min-width: 90px;
}
.army-strip-label span {
  font-size: 13px;
  letter-spacing: 0;
  color: #9eadbc;
  display: block;
  margin-top: 6px;
}
#battle-roster {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  height: 100%;
  padding: 1px 3px;
}
.regiment {
  display: flex;
  align-items: center;
  text-align: left;
  min-width: 170px;
  max-width: 215px;
  gap: 9px;
  padding: 6px 10px;
  background: #15212e;
  border-color: #415064;
}
.regiment .mini-portrait {
  height: 50px;
  width: 38px;
  min-width: 38px;
}
.regiment strong {
  font-size: 13px;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 142px;
}
.regiment small {
  font-size: 12px;
  color: #bbcad8;
  display: block;
  margin: 3px 0;
}
.regiment.selected {
  border-color: #b8d1e8;
  background: #2c3541;
}
.regiment.spent {
  opacity: 0.6;
}
.regiment.fleeing {
  border-color: #c97b72;
}
.regiment-text {
  min-width: 0;
  flex: 1;
}
.strength-bar {
  height: 3px;
  background: #485564;
}
.strength-bar i {
  height: 100%;
  display: block;
  background: #9bc6e5;
}
#target-preview {
  position: absolute;
  left: 14px;
  top: 12px;
  z-index: 4;
  background: #0b1726f5;
  border: 1px solid #6d8192;
  max-width: 285px;
  padding: 12px;
  pointer-events: none;
  display: none;
  box-shadow: 0 8px 30px #0006;
  font-size: 14px;
  line-height: 1.5;
}
#target-preview strong {
  color: #bbd3e7;
  display: block;
  font-size: 16px;
}
#target-preview .forecast-row {
  display: flex;
  gap: 20px;
  padding: 8px 0;
}
#target-preview .forecast-row b {
  font-size: 23px;
  display: block;
  color: #d1e0ed;
}
#target-preview small {
  font-size: 12px;
  color: #b7c7d4;
}
.order-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.order-buttons button {
  flex: 1;
  text-align: center !important;
  padding: 8px 6px;
}
.selection-empty .eyebrow {
  margin: 8px 0 15px;
  letter-spacing: 0.16em;
}
.selection-empty h3 {
  font-size: 23px;
  margin: 0 0 12px;
}
.selection-empty p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.guide-tip {
  padding: 12px;
  background: #1f2a34;
  border-left: 2px solid #a2bbd0;
  color: #ccd4db;
  font-size: 14px;
  line-height: 1.55;
}
.terrain-key {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 12px;
}
.terrain-key span {
  border: 1px solid #46546a;
  padding: 5px 6px;
}
/* Engagement resolution stays on the battlefield. */
#engagement-panel {
  position: absolute;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  width: min(650px, calc(100% - 28px));
  background: linear-gradient(135deg, #142235f7, #0b1624fa);
  border: 1px solid #93acc1;
  box-shadow: 0 12px 60px #0009;
  padding: 18px;
  z-index: 4;
  max-height: 60%;
  overflow: auto;
}
#engagement-panel[hidden] {
  display: none;
}
.engagement-kicker {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #9fb6c9;
  text-transform: uppercase;
}
.engagement-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 8px 0 10px;
}
.engagement-head h3 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0;
  line-height: 1.4;
}
.engagement-head button {
  flex-shrink: 0;
}
.clash-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  text-align: center;
  padding: 8px 0 12px;
}
.clash-score .score-side {
  font-size: 13px;
  line-height: 1.35;
  color: #b9cddd;
}
.clash-score .score-side strong {
  display: block;
  font-family: var(--head);
  font-size: 33px;
  color: #add5f4;
}
.clash-score .score-side.enemy strong {
  color: #eda6a0;
}
.clash-score .vs {
  font-family: Georgia, serif;
  color: #9dacb9;
  font-style: italic;
}
.combat-casualties {
  font-size: 15px;
  line-height: 1.55;
  color: #d9dfe4;
}
.combat-casualties span {
  display: inline-block;
  margin-right: 12px;
}
.combat-details {
  font-size: 13px;
  line-height: 1.5;
  margin-top: 10px;
  color: #b9c8d6;
}
.combat-details summary {
  cursor: pointer;
  color: #b3c6d7;
  margin-bottom: 10px;
}
.combat-details .atk {
  margin: 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #394b60;
}
.combat-details .die {
  width: 22px;
  height: 22px;
  font-size: 12px;
}
.engagement-choice {
  padding: 12px;
  margin: 6px 0;
  border: 1px solid #60738a;
  background: #192633;
  width: 100%;
  text-align: left;
}
.engagement-choice.on {
  border-color: #a2c1db;
  background: #2d3542;
}
.engagement-choice small {
  display: block;
  color: #c0cbd4;
  margin-top: 4px;
}
.engagement-choice strong {
  font-size: 15px;
}
.combat-instruction {
  font-size: 14px;
  color: #becbd6;
  line-height: 1.5;
}
.engagement-summary {
  font-size: 14px;
  line-height: 1.5;
}
.engagement-summary .ok {
  color: #a4d9b1;
}
.engagement-summary .danger {
  color: #ffaba1;
}
.modal-bg {
  background: rgba(3, 7, 13, 0.78);
  backdrop-filter: blur(5px);
}
.modal {
  background: linear-gradient(135deg, #151f2c, #0c141e);
  border-color: #8191a0;
  padding: 28px;
  max-height: 88dvh;
  box-shadow: 0 30px 100px #000a;
}
.modal .text {
  font-size: 16px;
  color: #d0dae2;
}
.modal .choices button {
  padding: 14px;
  font-size: 15px;
}
.modal h2 {
  font-size: 25px;
}
.modal label.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid #323e4a;
}
.modal label.setting select {
  max-width: 180px;
}
.modal .guide-step {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #2b3a49;
}
.guide-step > span {
  font-family: var(--head);
  font-size: 25px;
  color: #9db9d2;
}
.guide-step p {
  color: #bccbd8;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
}
.guide-step b {
  font-size: 17px;
}
.modal .choices {
  margin-top: 20px;
}
.result-big {
  font-size: 54px;
  margin: 20px 0;
}
.result-table {
  font-size: 14px;
}
.result-table td,
.result-table th {
  padding: 10px 6px;
}
.modal .result-art {
  height: 150px;
  margin: -28px -28px 24px;
  background:
    linear-gradient(0deg, #141e2b, transparent),
    url("../assets/title-battle.webp") 70% 45% / cover;
}
.modal .briefing-factions {
  display: flex;
  gap: 16px;
  margin: 18px 0;
}
.briefing-factions .mini-portrait {
  width: 80px;
  min-width: 80px;
  height: 110px;
}
.modal .briefing-factions p {
  font-size: 14px;
  color: #bfd0df;
  margin-top: 6px;
}
.notice {
  padding: 12px;
  margin: 14px 0;
  background: #222d3b;
  border-left: 2px solid #a1bdd5;
  font-size: 14px;
  line-height: 1.5;
}
@keyframes arrival {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes phase-reveal {
  0%,
  100% {
    opacity: 0;
  }
  16%,
  70% {
    opacity: 1;
  }
}
@media (min-width: 1700px) {
  #battle-left {
    width: 295px;
  }
  #battle-right {
    width: 320px;
  }
  #battle-left .unitinfo {
    font-size: 16px;
  }
  .unitinfo .props {
    font-size: 14px;
  }
  .unit-portrait {
    height: 180px;
  }
  .regiment {
    min-width: 195px;
  }
}
@media (max-width: 1100px) {
  #battle-left {
    width: 235px;
  }
  #battle-right {
    width: 250px;
  }
  #battle-top {
    gap: 9px;
    padding: 8px 12px;
  }
  #battle-score {
    display: none;
  }
  .page {
    padding: 18px;
  }
  .factions {
    gap: 10px;
  }
  .faction-card .name {
    font-size: 14px;
  }
  .faction-card .tag {
    font-size: 13px;
  }
  .unit-portrait {
    height: 115px;
  }
  .menu-caption {
    display: none;
  }
  #army-strip {
    padding: 10px;
    gap: 8px;
  }
  .army-strip-label {
    display: none;
  }
  #battle-top .who {
    font-size: 13px;
    max-width: 230px;
  }
  .phase-step {
    padding: 9px 15px;
  }
}
@media (max-width: 760px) {
  html,
  body {
    overflow: auto;
    min-height: 100%;
  }
  .screen {
    position: relative;
    min-height: 100dvh;
    overflow: auto;
  }
  .screen:not(.active) {
    display: none;
  }
  #screen-menu {
    padding: 65px 25px 75px;
    min-height: 100dvh;
  }
  #screen-menu .credit {
    position: relative;
    left: auto;
    bottom: auto;
    margin-top: 32px;
    font-size: 12px;
    line-height: 1.55;
  }
  .menu-content {
    width: min(440px, 100%);
  }
  #screen-menu h1 {
    font-size: 100px;
  }
  .menu-art {
    background-position: 64% center;
  }
  .menu-art:after {
    background:
      linear-gradient(90deg, #07101bea, #07101b99),
      linear-gradient(0deg, #070d15, transparent);
  }
  #screen-menu .sub {
    font-size: 13px;
    letter-spacing: 0.25em;
  }
  .page {
    padding: 18px 14px;
    overflow: visible;
  }
  .page .body {
    flex-direction: column;
    overflow: visible !important;
  }
  .factions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .faction-art {
    height: 180px;
  }
  .faction-card .name {
    font-size: 16px;
  }
  .faction-card .tag {
    font-size: 14px;
  }
  #builder-list,
  #camp-side {
    width: 100% !important;
    min-width: 0;
  }
  .panel {
    overflow: visible;
  }
  .unit-card .head {
    font-size: 14px;
  }
  #setup-commanders .unit-card {
    width: 100% !important;
  }
  #camp-map {
    min-height: 430px;
    height: 58vh;
    flex: none;
    overflow: auto;
  }
  #camp-log {
    overflow: auto;
  }
  .topbar {
    gap: 10px;
  }
  .topbar h2 {
    width: 100%;
    font-size: 21px;
  }
  .topbar button {
    flex: 1;
  }
  .topbar .spacer {
    display: none;
  }
  #battle-top {
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
  }
  #battle-top .phase {
    font-size: 14px;
  }
  #battle-top .who {
    order: 5;
    max-width: none;
    flex: 1;
    text-align: center;
  }
  #battle-top .spacer {
    display: none;
  }
  #battle-turn {
    margin-left: auto;
  }
  #battle-top button {
    font-size: 12px;
    min-height: 32px;
  }
  #phase-track {
    height: 36px;
  }
  .phase-step {
    font-size: 12px;
    padding: 8px 10px;
    gap: 6px;
  }
  #battle-main {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    flex: none;
  }
  #battle-canvas-wrap {
    order: 0;
    width: 100%;
    flex: none;
    height: 58vh;
    min-height: 350px;
  }
  #battle-left {
    order: 2;
    width: 100%;
    flex-direction: row;
    min-height: 250px;
    max-height: none;
    border-top: 1px solid #43586b;
  }
  #battle-left .unitinfo {
    width: 48%;
    flex: none;
    max-height: 430px;
  }
  #battle-left .actions {
    width: 52%;
    max-height: 430px;
    border-left: 1px solid #3f5064;
  }
  #battle-left .actions .muted {
    font-size: 13px;
  }
  .unit-portrait {
    height: 95px;
  }
  #battle-right {
    order: 1;
    width: 100%;
    max-height: 380px;
    overflow: auto;
  }
  #deploy-tray {
    display: block;
  }
  #battle-hint {
    font-size: 12px;
    padding: 7px 10px;
    bottom: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
  }
  #battle-toggles {
    right: 8px;
    top: 8px;
    gap: 4px;
  }
  #battle-toggles button {
    font-size: 12px;
    padding: 4px 6px;
  }
  #army-strip {
    height: 92px;
    order: 4;
  }
  #toggle-log {
    max-width: 85px;
    font-size: 12px;
    padding: 8px;
  }
  #engagement-panel {
    max-height: 70%;
    bottom: 54px;
    padding: 12px;
  }
  .engagement-head h3 {
    font-size: 15px;
  }
  .engagement-head {
    gap: 8px;
  }
  .engagement-head button {
    font-size: 12px;
    max-width: 125px;
  }
  #target-preview {
    top: 48px;
    left: 8px;
    width: 225px;
    font-size: 12px;
    padding: 8px;
  }
  #target-preview strong {
    font-size: 14px;
  }
  #target-preview .forecast-row b {
    font-size: 18px;
  }
  #phase-banner {
    top: 24%;
    padding: 12px 25px;
  }
  #phase-banner b {
    font-size: 20px;
  }
  #phase-banner small {
    font-size: 12px;
  }
  .modal {
    padding: 20px;
  }
  .modal h2 {
    font-size: 22px;
  }
  .modal .result-art {
    margin: -20px -20px 18px;
  }
  .modal label.setting {
    font-size: 14px;
  }
  .modal label.setting select {
    max-width: 145px;
  }
  .rules {
    font-size: 15px;
  }
  .rules table {
    font-size: 13px;
  }
  .entry .opts {
    grid-template-columns: 1fr;
  }
  .faction-card {
    min-width: 0;
  }
  .unitinfo .statline {
    flex-wrap: wrap;
  }
  .unitinfo .statline .stat {
    min-width: 28px;
  }
  .unitinfo .stat span {
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
  #phase-banner.show {
    opacity: 0;
  }
}
body.reduce-motion *,
body.reduce-motion *:before,
body.reduce-motion *:after {
  animation: none !important;
  transition: none !important;
}
body.reduce-motion #phase-banner.show {
  display: none;
}

/* Trail of Death map: a parchment chart drawn on canvas, with real buttons over reachable stops */
.trail-map {
  position: relative;
  margin: 6px auto 18px;
}
.trail-map canvas {
  display: block;
}
.trail-map .node.avail {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.trail-map .node.avail:hover {
  background: transparent;
}
.trail-map .node.avail:focus-visible {
  outline: 3px solid #93bde2;
  outline-offset: 2px;
}
#screen-campaign .topbar {
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  #screen-campaign .page {
    overflow-x: hidden;
  }
  #screen-campaign .body {
    min-width: 0;
  }
  #camp-map {
    width: 100%;
  }
}
/* the map carries its own act cartouche; the heading keeps only the instruction */
#camp-map .campaign-heading {
  position: static;
  background: none;
  padding: 14px 20px 2px;
}
#camp-map .campaign-heading .eyebrow,
#camp-map .campaign-heading h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
#camp-map .campaign-heading p {
  margin: 0;
}
