@font-face {
  font-family: 'Cinzel';
  src: url('./assets/fonts/Cinzel.ttf') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Source Sans 3';
  src: url('./assets/fonts/SourceSans3.ttf') format('truetype');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2d2117;
  --ink-soft: #594331;
  --ink-faint: #7a6249;
  --parchment: #ead7ad;
  --parchment-strong: #f2e2bc;
  --parchment-deep: #d9bd82;
  --panel: rgba(237, 215, 168, 0.94);
  --panel-solid: #ead7ad;
  --panel-dark: #3a2a1e;
  --indigo: #263f68;
  --indigo-deep: #182a48;
  --indigo-soft: #536f9d;
  --terracotta: #b65334;
  --terracotta-deep: #803722;
  --brass: #c69a3a;
  --brass-light: #e4c96f;
  --sand: #d6b06f;
  --success: #4f7442;
  --danger: #963927;
  --shadow: rgba(43, 29, 19, 0.34);
  --line: rgba(91, 62, 36, 0.45);
  --line-strong: rgba(63, 41, 25, 0.72);
  --focus: #f3d979;
  --serif: 'Cinzel', 'Palatino Linotype', Palatino, serif;
  --body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #c99d60;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.42;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  background: #cfa66a;
  cursor: crosshair;
  touch-action: none;
}

#app,
#modal-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#app button,
#app input,
#app select,
#app summary,
#app a,
#app [role='button'],
#modal-root button,
#modal-root input,
#modal-root select {
  pointer-events: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript-panel {
  position: fixed;
  inset: 2rem auto auto 2rem;
  max-width: 34rem;
  padding: 2rem;
  background: var(--panel-solid);
  border: 2px solid var(--brass);
  z-index: 10;
}

.screen {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screen > * {
  pointer-events: auto;
}

.panel {
  background:
    linear-gradient(135deg, rgba(255, 239, 195, 0.58), rgba(224, 191, 130, 0.2) 52%, rgba(159, 107, 58, 0.1)),
    var(--panel);
  border: 1px solid rgba(198, 154, 58, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(73, 47, 27, 0.34),
    0 14px 34px rgba(37, 24, 15, 0.28);
}

.panel-dark {
  color: #efdfba;
  background: linear-gradient(135deg, rgba(74, 51, 32, 0.96), rgba(42, 30, 22, 0.96));
  border-color: rgba(198, 154, 58, 0.55);
}

.engraved {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 238, 190, 0.6), 0 -1px 0 rgba(76, 49, 29, 0.2);
}

.kicker {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
}

.rule {
  height: 1px;
  margin: 0.8rem 0;
  background: linear-gradient(90deg, transparent, rgba(128, 82, 39, 0.72), transparent);
}

.button,
button.button {
  min-height: 2.45rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(42, 28, 18, 0.62);
  border-radius: 3px;
  background: linear-gradient(#eed9a8, #caa561);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.38), 0 2px 0 rgba(50, 32, 20, 0.4);
  font-family: var(--serif);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  filter: brightness(1.06);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 1px 0 rgba(50, 32, 20, 0.4);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: saturate(0.45);
}

.button.primary {
  color: #f2e6c5;
  background: linear-gradient(#345586, var(--indigo-deep));
  border-color: #101b30;
}

.button.danger {
  color: #f8dfc7;
  background: linear-gradient(#bc6242, var(--terracotta-deep));
  border-color: #552313;
}

.button.quiet {
  background: rgba(235, 213, 164, 0.72);
  box-shadow: none;
}

.button.small {
  min-height: 1.9rem;
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
}

.button.square {
  width: 2.35rem;
  min-width: 2.35rem;
  padding: 0.35rem;
}

.hotkey {
  display: inline-grid;
  place-items: center;
  min-width: 1.35em;
  height: 1.35em;
  margin-right: 0.45em;
  padding: 0 0.2em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--body);
  font-size: 0.78em;
  font-weight: 800;
  opacity: 0.82;
}

/* Title */

.title-screen {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: clamp(1rem, 4vw, 4rem);
}

.title-panel {
  width: min(31rem, calc(100vw - 2rem));
  margin-top: clamp(0.5rem, 6vh, 4rem);
  padding: clamp(1.2rem, 3vw, 2.1rem);
}

.title-panel h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5.2vw, 4.8rem);
  line-height: 0.96;
}

.title-panel .subtitle {
  margin: 0.9rem 0 1.1rem;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  color: var(--ink-soft);
}

.title-menu {
  display: grid;
  gap: 0.55rem;
  max-width: 23rem;
}

.title-notes {
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.save-summary {
  margin: 0.5rem 0 0.8rem;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--brass);
  background: rgba(255, 239, 198, 0.42);
  font-size: 0.94rem;
}

/* Shared campaign/camp chrome */

.management-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.8rem 0.8rem 8.6rem;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 4rem;
  padding: 0.55rem 0.8rem;
}

.topbar h2,
.topbar h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  white-space: nowrap;
}

.topbar .spacer {
  flex: 1;
}

.resource-strip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  font-weight: 700;
}

.resource {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.48rem;
  border: 1px solid rgba(86, 57, 34, 0.38);
  background: rgba(255, 239, 198, 0.45);
}

.resource::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: inset 0 0 0 1px rgba(58, 36, 20, 0.4);
}

.resource.water::before { background: #477383; }
.resource.relic::before { background: #74598b; }

.campaign-main {
  display: grid;
  grid-template-columns: minmax(25rem, 1fr) minmax(18rem, 23rem);
  gap: 0.8rem;
  min-height: 0;
  overflow: hidden;
}

.mission-map-panel {
  position: relative;
  min-height: 25rem;
  overflow: hidden;
}

.mission-map-panel svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-label {
  position: absolute;
  top: 1rem;
  left: 1rem;
  max-width: 12.5rem;
  color: rgba(60, 40, 24, 0.78);
}

.map-label h3 {
  margin: 0 0 0.25rem;
}

.map-label p {
  margin: 0;
  font-size: 0.95rem;
}

.mission-node {
  position: absolute;
  width: 8.4rem;
  min-height: 4.4rem;
  padding: 0.55rem 0.6rem;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(82, 53, 31, 0.6);
  border-radius: 4px;
  background: linear-gradient(#ecd8aa, #cfa96c);
  box-shadow: 0 6px 16px rgba(42, 27, 17, 0.22), inset 0 0 0 1px rgba(255, 239, 190, 0.35);
  cursor: pointer;
  text-align: left;
}

.mission-node strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.78rem;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mission-node span {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.mission-node.locked {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.57;
}

.mission-node.complete {
  border-color: var(--success);
}

.mission-node.selected {
  border-color: var(--brass-light);
  box-shadow: 0 0 0 3px rgba(228, 201, 111, 0.38), 0 8px 20px rgba(42, 27, 17, 0.26);
}

.campaign-side,
.camp-column,
.debrief-panel {
  min-height: 0;
  overflow: auto;
  scrollbar-color: rgba(111, 73, 42, 0.55) rgba(230, 207, 154, 0.4);
}

.campaign-side-inner {
  padding: 1rem;
}

.campaign-side h3,
.camp-column h3,
.debrief-panel h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.objective-list,
.log-list,
.roster-list,
.recruit-list,
.store-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.objective-list li {
  padding: 0.48rem 0.55rem;
  border: 1px solid rgba(97, 66, 39, 0.28);
  background: rgba(255, 239, 198, 0.35);
}

.objective-list li.done {
  border-color: rgba(79, 116, 66, 0.6);
  background: rgba(108, 139, 78, 0.16);
}

.log-list {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.log-list li {
  padding-left: 0.6rem;
  border-left: 2px solid rgba(198, 154, 58, 0.46);
}

.bottom-actions {
  position: absolute;
  left: 0.8rem;
  right: 392px;
  bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 5.5rem;
  padding: 0.75rem;
  z-index: 5;
}

.bottom-actions .summary {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* Camp */

.camp-main {
  display: grid;
  grid-template-columns: minmax(15rem, 19rem) minmax(20rem, 1fr) minmax(17rem, 21rem);
  gap: 0.8rem;
  min-height: 0;
  overflow: hidden;
}

.camp-column {
  padding: 0.9rem;
}

.roster-button {
  width: 100%;
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(84, 55, 33, 0.34);
  background: rgba(255, 239, 198, 0.38);
  text-align: left;
  cursor: pointer;
}

.roster-button.selected {
  border-color: var(--brass);
  background: rgba(255, 239, 198, 0.72);
  box-shadow: inset 3px 0 0 var(--brass);
}

.roster-button strong,
.recruit-card strong {
  display: block;
  font-family: var(--serif);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roster-button span,
.recruit-card span {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.wound-mark {
  color: var(--danger);
  font-weight: 800;
}

.unit-sheet {
  display: grid;
  gap: 0.8rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(4.2rem, 1fr));
  gap: 0.45rem;
}

.stat {
  padding: 0.48rem;
  border: 1px solid rgba(83, 56, 34, 0.28);
  background: rgba(255, 239, 198, 0.38);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 1.15rem;
}

.stat span {
  display: block;
  color: var(--ink-faint);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.ability-card,
.equipment-row,
.recruit-card,
.store-card,
.promotion-card {
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(91, 62, 36, 0.3);
  background: rgba(255, 239, 198, 0.34);
}

.ability-card strong,
.equipment-row strong,
.store-card strong,
.promotion-card strong {
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ability-card p,
.equipment-row p,
.recruit-card p,
.store-card p,
.promotion-card p {
  margin: 0.28rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.camp-actions-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

select,
input[type='range'] {
  accent-color: var(--brass);
}

select {
  min-height: 2.2rem;
  border: 1px solid rgba(68, 45, 27, 0.5);
  background: #f0dfb5;
  color: var(--ink);
}

/* Battle HUD */

.battle-screen {
  pointer-events: none;
}

.battle-screen > * {
  pointer-events: auto;
}

.initiative-bar {
  position: absolute;
  top: 0.6rem;
  left: 0.7rem;
  right: 0.7rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  min-height: 4.2rem;
  padding: 0.5rem 0.7rem;
}

.battle-title-block {
  min-width: 12rem;
}

.battle-title-block h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.1;
}

.battle-title-block .round-line {
  margin-top: 0.22rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  white-space: nowrap;
}

.initiative-strip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  padding: 0.2rem;
  scrollbar-width: thin;
}

.initiative-chip {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid rgba(58, 38, 23, 0.55);
  border-radius: 50%;
  color: #f2e3bc;
  background: var(--indigo);
  font-family: var(--serif);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.initiative-chip.enemy {
  background: var(--terracotta);
}

.initiative-chip.current {
  border-color: var(--brass-light);
  box-shadow: 0 0 0 3px rgba(228, 201, 111, 0.32);
}

.initiative-chip.spent {
  filter: grayscale(0.6);
  opacity: 0.48;
}

.initiative-chip .hp-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 50%;
  background: var(--success);
  border: 1px solid rgba(36, 24, 16, 0.6);
}

.initiative-chip .hp-dot.low { background: var(--danger); }
.initiative-chip .hp-dot.mid { background: #b98231; }

.hud-buttons {
  display: flex;
  gap: 0.4rem;
}

.unit-sidebar {
  position: absolute;
  overscroll-behavior: contain;
  top: 5.4rem;
  bottom: 8.8rem;
  left: 0.7rem;
  width: 16.2rem;
  overflow-y: auto;
  padding: 0.75rem;
  scrollbar-width: thin;
}

.unit-sidebar .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.unit-card h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.1;
}

.unit-card .epithet {
  margin: 0.18rem 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.meter-stack {
  display: grid;
  gap: 0.4rem;
  margin: 0.65rem 0;
}

.meter-line {
  display: grid;
  grid-template-columns: 4.2rem 1fr 2.6rem;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
}

.meter {
  height: 0.55rem;
  border: 1px solid rgba(55, 36, 22, 0.45);
  background: rgba(66, 43, 26, 0.22);
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--success);
}

.meter.morale > span { background: var(--brass); }
.meter.low > span { background: var(--danger); }
.meter.mid > span { background: #b98231; }

.terrain-inspector,
.wave-intel,
.battle-log {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.terrain-inspector h3,
.wave-intel h3,
.battle-log h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.terrain-inspector p,
.wave-intel p {
  margin: 0.2rem 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.battle-log ol {
  display: grid;
  gap: 0.32rem;
  margin: 0;
  padding: 0 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 0.83rem;
}

.command-panel {
  position: absolute;
  left: 0.7rem;
  right: 392px;
  bottom: 0.7rem;
  min-height: 7.45rem;
  display: grid;
  grid-template-columns: minmax(12rem, 0.95fr) minmax(15rem, 1.3fr) auto;
  gap: 0.75rem;
  align-items: stretch;
  padding: 0.7rem;
}

.command-section {
  min-width: 0;
}

.command-section h2,
.command-section h3 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.command-copy {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.91rem;
}

.modifier-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.45rem;
}

.modifier {
  padding: 0.12rem 0.38rem;
  border: 1px solid rgba(78, 52, 31, 0.32);
  background: rgba(255, 239, 198, 0.42);
  font-size: 0.78rem;
  font-weight: 700;
}

.modifier.good { color: #345f31; }
.modifier.bad { color: #883422; }

.command-actions {
  display: flex;
  align-content: flex-start;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.42rem;
  flex-wrap: wrap;
  max-width: 30rem;
}

.command-actions .button {
  min-height: 2.25rem;
}

.command-hints {
  grid-column: 1 / -1;
  margin: -0.25rem 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-box {
  border-left: 3px solid var(--terracotta);
  padding-left: 0.6rem;
}

.enemy-intent {
  margin-top: 0.35rem;
  color: var(--terracotta-deep);
  font-size: 0.86rem;
  font-weight: 700;
}

/* Debrief */

.debrief-screen {
  padding: 0.8rem;
}

.debrief-panel {
  width: min(29rem, calc(100vw - 1.6rem));
  max-height: calc(100vh - 9.5rem);
  padding: 1rem;
}

.debrief-panel h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.debrief-panel .reason {
  margin: 0.4rem 0 0.8rem;
  color: var(--ink-soft);
}

.debrief-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.replay-controls {
  position: absolute;
  left: 0.8rem;
  right: 392px;
  bottom: 0.75rem;
  display: grid;
  grid-template-columns: auto auto auto minmax(8rem, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  min-height: 4.9rem;
  padding: 0.7rem;
}

.replay-controls input[type='range'] {
  width: 100%;
}

.replay-label {
  font-size: 0.84rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Menus and modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(40, 27, 18, 0.48);
  pointer-events: auto;
  z-index: 30;
}

.modal {
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(44rem, calc(100vh - 2rem));
  overflow: auto;
  padding: 1.2rem;
}

.modal h2 {
  margin: 0 0 0.7rem;
  font-size: 1.45rem;
}

.modal .close-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.difficulty-card {
  min-height: 9rem;
  padding: 0.8rem;
  text-align: left;
  background: rgba(255, 239, 198, 0.38);
  border: 1px solid rgba(91, 62, 36, 0.38);
  cursor: pointer;
}

.difficulty-card strong {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.difficulty-card span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1.2rem;
}

.help-grid h3 {
  margin: 0 0 0.35rem;
}

.key-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
}

.key-table th,
.key-table td {
  padding: 0.28rem 0.3rem;
  border-bottom: 1px solid rgba(91, 62, 36, 0.22);
  text-align: left;
}

.key-table th {
  width: 8.5rem;
  font-family: var(--serif);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Small states */

.badge {
  display: inline-block;
  padding: 0.12rem 0.42rem;
  border: 1px solid rgba(75, 49, 30, 0.42);
  background: rgba(255, 239, 198, 0.4);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.enemy { color: #762c1d; }
.badge.player { color: var(--indigo); }
.badge.success { color: #3d6336; }
.badge.warn { color: #89351f; }

.empty-note {
  color: var(--ink-faint);
  font-style: italic;
}

/* Responsive behaviour */

@media (max-width: 1050px) {
  .campaign-main,
  .camp-main {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .mission-map-panel {
    min-height: 28rem;
  }

  .unit-sidebar {
    width: 14.5rem;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .title-screen {
    padding: 0.7rem;
  }

  .title-panel {
    margin-top: 0;
    padding: 1rem;
  }

  .management-screen {
    padding: 0.5rem 0.5rem 8rem;
    overflow-y: auto;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .topbar h2,
  .topbar h1 {
    width: 100%;
  }

  .mission-node {
    width: 7.2rem;
    font-size: 0.85rem;
  }

  .initiative-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 3.8rem;
  }

  .battle-title-block {
    display: none;
  }

  .initiative-strip {
    min-width: 0;
  }

  .unit-sidebar {
    top: 4.7rem;
    bottom: auto;
    left: 0.5rem;
    width: min(15rem, calc(100vw - 1rem));
    max-height: 27vh;
    padding: 0.55rem;
    opacity: 0.94;
  }

  .command-panel {
    left: 0.45rem;
    right: 0.45rem;
    bottom: 2rem;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    max-height: 42vh;
    overflow-y: auto;
    padding: 0.55rem;
  }

  .command-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .command-hints {
    white-space: normal;
  }

  .bottom-actions,
  .replay-controls {
    left: 0.45rem;
    right: 0.45rem;
    bottom: 2rem;
    min-height: 4.7rem;
  }

  .replay-controls {
    grid-template-columns: auto auto auto;
  }

  .replay-controls input[type='range'],
  .replay-label {
    grid-column: 1 / -1;
  }

  .difficulty-grid,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .debrief-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 430px) {
  .title-panel h1 {
    font-size: 2.05rem;
  }

  .mission-node {
    width: 6.6rem;
    min-height: 4.1rem;
    padding: 0.42rem;
  }

  .mission-node strong {
    font-size: 0.67rem;
  }

  .mission-node span {
    font-size: 0.68rem;
  }

  .resource-strip {
    font-size: 0.86rem;
  }

  .button {
    padding: 0.48rem 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
