:root {
  color-scheme: dark;
  --ink: #f4f1df;
  --night: #071827;
  --blue: #6598aa;
  --blue-deep: #355d70;
  --red: #ac685b;
  --red-deep: #704037;
  --amber: #c6a25e;
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

#game-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  min-height: 100%;
  overflow: hidden;
  background: #77b9c9;
  isolation: isolate;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 4;
  top: max(7px, env(safe-area-inset-top));
  left: max(8px, env(safe-area-inset-left));
  right: max(8px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: minmax(130px, 230px) 1fr minmax(130px, 230px);
  align-items: start;
  gap: 12px;
  pointer-events: none;
}

.hud-card {
  min-width: 0;
  padding: 7px 9px 8px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 9px;
  background: rgba(5, 18, 29, 0.69);
  box-shadow: 0 4px 18px rgba(3, 11, 18, 0.18);
  backdrop-filter: blur(5px);
}

.hud-card--blue {
  border-left: 3px solid var(--blue);
}

.hud-card--red {
  border-right: 3px solid var(--red);
}

.hud-name {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.hud-card--red .hud-name {
  text-align: right;
}

.meter-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.73);
  font-size: 8px;
  font-weight: 800;
}

.hud-card--red .meter-row {
  grid-template-columns: 1fr 38px;
}

.hud-card--red .meter-row span {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.hud-card--red .meter {
  grid-column: 1;
  grid-row: 1;
}

.meter {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.meter i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 150ms linear;
}

.hud-card--red .meter i {
  margin-left: auto;
  background: var(--red);
}

.hud-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding-top: 1px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.icon-button {
  width: 29px;
  height: 29px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 7px;
  background: rgba(5, 18, 29, 0.62);
  pointer-events: auto;
}

.controls {
  position: absolute;
  z-index: 5;
  bottom: max(13px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, var(--button-size));
  gap: 8px;
  pointer-events: none;
  --button-size: clamp(58px, 8.8vw, 72px);
}

.controls--left {
  left: max(12px, env(safe-area-inset-left));
}

.controls--right {
  right: max(12px, env(safe-area-inset-right));
}

.control {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--button-size);
  height: var(--button-size);
  padding: 0;
  border: 2px solid currentColor;
  border-radius: 11px;
  background: rgba(18, 29, 34, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 10px rgba(1, 10, 17, 0.2);
  color: var(--blue);
  pointer-events: auto;
  touch-action: none;
  transition: transform 60ms ease, background 60ms ease, filter 60ms ease;
}

.control--red {
  color: var(--red);
}

.control--roll {
  border-style: dashed;
}

.control--fire {
  color: var(--amber);
  border-color: var(--amber);
  background: rgba(52, 28, 8, 0.72);
}

.control.is-active {
  transform: translateY(2px) scale(0.94);
  background: currentColor;
  color: #071827;
  filter: brightness(1.12);
}

.control.is-cooling {
  filter: saturate(0.25) brightness(0.7);
}

.control-icon {
  font-family: system-ui, sans-serif;
  font-size: clamp(23px, 3.5vw, 29px);
  font-weight: 900;
  line-height: 0.9;
}

.control-label {
  margin-top: 4px;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.overlay {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(14, 56, 73, 0.48), rgba(2, 12, 20, 0.86));
  backdrop-filter: blur(5px);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.overlay--hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.briefing-card {
  width: min(480px, 88vw);
  padding: 25px 28px 22px;
  border: 1px solid rgba(255, 255, 255, 0.29);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(9, 31, 47, 0.96), rgba(4, 17, 28, 0.96));
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  text-align: center;
}

.briefing-card--compact {
  width: min(380px, 84vw);
}

.eyebrow {
  color: var(--amber);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.briefing-card h1,
.briefing-card h2 {
  margin: 5px 0 8px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(38px, 8vw, 62px);
  font-style: italic;
  letter-spacing: 0.045em;
  line-height: 0.95;
  text-shadow: 4px 4px 0 rgba(55, 169, 255, 0.4), -3px -2px 0 rgba(255, 90, 82, 0.27);
}

.briefing-card h2 {
  font-size: clamp(32px, 7vw, 52px);
}

.briefing-card p {
  margin: 0 auto 13px;
  max-width: 390px;
  color: rgba(255, 255, 255, 0.72);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

.pilot-key {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 12px 0 15px;
  font-size: 9px;
  font-weight: 800;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
}

.dot--blue {
  background: var(--blue);
  box-shadow: 0 0 10px var(--blue);
}

.dot--red {
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
}

.primary-button {
  min-width: 210px;
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid #ffe1a4;
  border-radius: 11px;
  background: var(--amber);
  box-shadow: 0 5px 0 #a8650d, 0 10px 25px rgba(0, 0, 0, 0.32);
  color: #1b1c16;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.1em;
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #a8650d;
}

.mode-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-buttons .primary-button {
  min-width: 0;
  min-height: 54px;
  padding-inline: 12px;
}

.mode-buttons .primary-button span {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: 0.08em;
  opacity: 0.68;
}

.primary-button--secondary {
  border-color: rgba(255, 255, 255, 0.45);
  background: #263f4b;
  box-shadow: 0 5px 0 #13252e, 0 10px 25px rgba(0, 0, 0, 0.32);
  color: #e8e5d5;
}

#game-shell.is-single-player .controls--right {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.briefing-card small {
  display: block;
  margin-top: 13px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 8px;
}

.rotate-prompt {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--night);
  text-align: center;
}

.rotate-prompt strong {
  font-size: 15px;
  letter-spacing: 0.1em;
}

.rotate-prompt span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.phone-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 86px;
  margin-bottom: 14px;
  border: 3px solid var(--amber);
  border-radius: 10px;
  color: var(--amber);
  font-family: system-ui, sans-serif;
  font-size: 31px;
  animation: tilt 1.8s ease-in-out infinite;
}

@keyframes tilt {
  0%, 28% { transform: rotate(0deg); }
  72%, 100% { transform: rotate(90deg); }
}

@media (orientation: portrait) {
  .rotate-prompt {
    display: flex;
  }
}

@media (max-height: 390px) {
  .controls {
    --button-size: clamp(52px, 16vh, 62px);
    gap: 6px;
  }

  .control {
    border-radius: 15px;
  }

  .hud {
    top: max(4px, env(safe-area-inset-top));
  }

  .hud-card {
    padding: 5px 7px 6px;
  }

  .briefing-card {
    padding: 18px 24px 16px;
  }

  .briefing-card h1 {
    font-size: 42px;
  }

  .briefing-card p {
    font-size: 11px;
  }
}

@media (max-width: 680px) and (orientation: landscape) {
  .hud {
    grid-template-columns: 118px 1fr 118px;
  }

  .hud-center > span {
    display: none;
  }
}

/* Orders at Dawn campaign shell */
:root {
  --ink: #eee9d6;
  --night: #101820;
  --blue: #7192a3;
  --blue-deep: #3c5968;
  --red: #a96c5d;
  --red-deep: #70463d;
  --amber: #c2a56a;
  --paper-muted: rgba(238, 233, 214, 0.66);
  --panel: rgba(16, 24, 32, 0.97);
  --panel-raised: #18242d;
}

.hud-card,
.icon-button,
.control {
  border-radius: 3px;
}

.control {
  box-shadow: inset 0 0 0 1px rgba(238, 233, 214, 0.05), 0 3px 8px rgba(0, 0, 0, 0.24);
}

.overlay {
  padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  background:
    linear-gradient(rgba(10, 18, 24, 0.78), rgba(10, 18, 24, 0.92)),
    repeating-linear-gradient(115deg, transparent 0 28px, rgba(194, 165, 106, 0.035) 29px 30px);
  backdrop-filter: blur(3px) saturate(0.7);
}

.briefing-card {
  border-color: rgba(194, 165, 106, 0.5);
  border-radius: 3px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.025), transparent 35%),
    linear-gradient(145deg, rgba(24, 36, 45, 0.985), rgba(11, 18, 24, 0.985));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.58), inset 0 0 0 1px rgba(238, 233, 214, 0.035);
}

.briefing-card h1,
.briefing-card h2 {
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-style: normal;
  letter-spacing: 0.09em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.campaign-card {
  position: relative;
  width: min(760px, 96vw);
  max-height: calc(100dvh - 16px);
  padding: 14px 18px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
  scrollbar-color: var(--amber) rgba(255, 255, 255, 0.06);
  text-align: left;
}

.campaign-card::before,
.campaign-card::after {
  position: absolute;
  top: 5px;
  width: 34px;
  height: 2px;
  background: var(--amber);
  content: "";
}

.campaign-card::before {
  left: 5px;
}

.campaign-card::after {
  right: 5px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: minmax(260px, auto) 1fr;
  align-items: end;
  gap: 3px 18px;
  padding: 0 4px 9px;
  border-bottom: 1px solid rgba(194, 165, 106, 0.35);
}

.brand-lockup .eyebrow {
  grid-column: 1 / -1;
}

.brand-lockup h1 {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: clamp(31px, 5vw, 45px);
  line-height: 0.88;
}

.brand-lockup h1 span {
  color: var(--amber);
}

.brand-lockup p,
.campaign-card .brand-lockup p {
  margin: 0 0 1px auto;
  color: var(--paper-muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: right;
  text-transform: uppercase;
}

.onboarding-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 9px 4px 11px;
  padding: 0;
  list-style: none;
}

.onboarding-progress li {
  position: relative;
  padding-top: 8px;
  border-top: 1px solid rgba(238, 233, 214, 0.18);
  color: rgba(238, 233, 214, 0.38);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-align: center;
}

.onboarding-progress li::before {
  position: absolute;
  top: -4px;
  left: calc(50% - 4px);
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  background: var(--panel-raised);
  content: "";
  transform: rotate(45deg);
}

.onboarding-progress li.is-active {
  border-color: var(--amber);
  color: var(--amber);
}

.onboarding-progress li.is-active::before {
  background: var(--amber);
}

.onboarding-progress li.is-complete {
  border-color: var(--blue);
  color: var(--blue);
}

.onboarding-step {
  min-height: 154px;
  padding: 1px 4px 0;
  text-align: left;
}

.onboarding-step--hidden {
  display: none !important;
}

.onboarding-step h2,
.campaign-card .onboarding-step h2 {
  margin: 2px 0 5px;
  color: var(--ink);
  font-size: clamp(20px, 3.5vw, 29px);
  line-height: 1;
}

.onboarding-step > p,
.campaign-card .onboarding-step > p {
  max-width: 620px;
  margin: 0 0 10px;
  color: var(--paper-muted);
  font-size: 11px;
  line-height: 1.35;
}

.dispatch-stamp {
  display: inline-block;
  margin-bottom: 3px;
  padding: 3px 6px;
  border: 1px solid rgba(194, 165, 106, 0.55);
  color: var(--amber);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.18em;
  transform: rotate(-1deg);
}

.identity-slip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 9px 0 11px;
  padding: 8px 11px;
  border: 1px solid rgba(238, 233, 214, 0.18);
  border-left: 3px solid var(--amber);
  background: rgba(238, 233, 214, 0.045);
}

.identity-slip span,
.identity-slip small {
  color: var(--paper-muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.identity-slip strong {
  color: var(--ink);
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 18px;
  letter-spacing: 0.13em;
}

.identity-slip small,
.campaign-card .identity-slip small {
  margin: 0;
  text-align: right;
}

.selection-grid {
  display: grid;
  gap: 8px;
  margin: 8px 0 7px;
}

.selection-grid--factions {
  grid-template-columns: 1fr 1fr;
}

.selection-grid--roles {
  grid-template-columns: repeat(4, 1fr);
}

.selection-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 90px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 9px 11px;
  border: 1px solid rgba(238, 233, 214, 0.19);
  border-radius: 2px;
  background: rgba(238, 233, 214, 0.035);
  color: var(--ink);
  text-align: left;
  touch-action: manipulation;
}

.selection-card--allies {
  border-left: 3px solid var(--blue);
}

.selection-card--axis {
  border-left: 3px solid var(--red);
}

.selection-card strong {
  margin: 3px 0;
  font-family: "Arial Narrow", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0.09em;
}

.selection-card small,
.campaign-card .selection-card small {
  margin: 0;
  color: var(--paper-muted);
  font-size: 7px;
  line-height: 1.25;
}

.selection-code,
.role-mark {
  color: var(--amber);
  font-size: 15px;
  font-weight: 900;
}

.selection-card.is-selected {
  border-color: var(--amber);
  background: rgba(194, 165, 106, 0.11);
}

.selection-card.is-locked {
  opacity: 0.42;
  filter: saturate(0.25);
}

.selection-card.is-locked::after {
  position: absolute;
  top: 5px;
  right: 6px;
  color: var(--paper-muted);
  content: "LOCKED";
  font-size: 6px;
  letter-spacing: 0.13em;
}

.primary-button {
  min-height: 42px;
  border: 1px solid #d2ba87;
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 3px 0 #76633e, 0 8px 22px rgba(0, 0, 0, 0.28);
  font-size: 10px;
  touch-action: manipulation;
}

.primary-button--secondary {
  border-color: rgba(238, 233, 214, 0.34);
  background: #263640;
  box-shadow: 0 3px 0 #111b22, 0 8px 22px rgba(0, 0, 0, 0.28);
}

.text-button {
  min-height: 27px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: rgba(238, 233, 214, 0.56);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.13em;
  touch-action: manipulation;
}

.mission-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.35fr);
  gap: 13px;
}

.frontline-map {
  position: relative;
  min-height: 166px;
  overflow: hidden;
  border: 1px solid rgba(194, 165, 106, 0.38);
  background: linear-gradient(145deg, #24333b, #151f26);
}

.map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(238, 233, 214, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238, 233, 214, 0.24) 1px, transparent 1px);
  background-size: 28px 28px;
  transform: rotate(-5deg) scale(1.12);
}

.frontline {
  position: absolute;
  top: -18%;
  left: 54%;
  width: 2px;
  height: 145%;
  border-left: 2px dashed var(--red);
  box-shadow: 0 0 0 2px rgba(16, 24, 32, 0.65);
  transform: rotate(19deg);
}

.map-point {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

.map-point--friendly {
  bottom: 28%;
  left: 24%;
  background: var(--blue);
}

.map-point--objective {
  top: 29%;
  right: 20%;
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(169, 108, 93, 0.17);
}

.frontline-map b {
  position: absolute;
  right: 8px;
  bottom: 7px;
  color: rgba(238, 233, 214, 0.68);
  font-size: 7px;
  letter-spacing: 0.13em;
}

.mission-order {
  min-width: 0;
  padding: 2px 0;
}

.campaign-card .mission-order h2 {
  margin-bottom: 8px;
}

.mission-order dl {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
  gap: 6px;
  margin: 0 0 8px;
}

.mission-order dl div {
  min-width: 0;
  padding: 6px 7px;
  border-top: 1px solid rgba(194, 165, 106, 0.35);
  background: rgba(238, 233, 214, 0.035);
}

.mission-order dt {
  color: var(--amber);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.mission-order dd {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 8px;
  font-weight: 800;
  text-overflow: ellipsis;
}

.campaign-card .mission-order p {
  margin: 0;
  color: var(--paper-muted);
  font-size: 9px;
  line-height: 1.35;
}

.mission-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.mission-actions .primary-button {
  min-width: 180px;
}

#launch-step {
  text-align: center;
}

#launch-step > p {
  max-width: none;
  text-align: center;
}

#launch-step > .text-button {
  margin-top: 4px;
}

.campaign-card button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

@media (hover: hover) {
  .selection-card:not(.is-locked):hover {
    border-color: var(--amber);
    background: rgba(194, 165, 106, 0.09);
  }

  .text-button:hover {
    color: var(--ink);
  }
}

@media (max-width: 680px) and (orientation: landscape) {
  .campaign-card {
    padding-inline: 12px;
  }

  .selection-grid--roles {
    grid-template-columns: repeat(2, 1fr);
  }

  .selection-grid--roles .selection-card {
    min-height: 54px;
  }

  .mission-layout {
    grid-template-columns: minmax(160px, 0.8fr) minmax(250px, 1.4fr);
  }
}

@media (max-height: 420px) {
  .campaign-card {
    padding-block: 9px 10px;
  }

  .brand-lockup {
    padding-bottom: 6px;
  }

  .brand-lockup h1 {
    font-size: 31px;
  }

  .onboarding-progress {
    margin-block: 7px 8px;
  }

  .onboarding-step {
    min-height: 132px;
  }

  .selection-card {
    min-height: 65px;
    padding-block: 6px;
  }

  .selection-card strong {
    font-size: 13px;
  }

  .frontline-map {
    min-height: 135px;
  }

  .briefing-card.campaign-card {
    padding: 9px 14px 10px;
  }

  .campaign-card .onboarding-step h2 {
    font-size: 21px;
  }
}

@media (max-height: 350px) {
  .brand-lockup {
    grid-template-columns: 1fr;
  }

  .brand-lockup h1 {
    font-size: 25px;
  }

  .brand-lockup p {
    display: none;
  }

  .onboarding-progress {
    margin-block: 5px 6px;
  }

  .onboarding-progress li {
    padding-top: 6px;
    font-size: 6px;
  }

  .onboarding-step {
    min-height: 116px;
  }

  .frontline-map {
    min-height: 112px;
  }

  .identity-slip {
    margin-block: 6px;
    padding-block: 5px;
  }
}

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