:root {
  color-scheme: dark;
  --bg: #11120f;
  --paper: #211d17;
  --paper-2: #322818;
  --ink: #f0dfbc;
  --muted: #ad9870;
  --line: #6c5635;
  --bronze: #c99548;
  --jade: #5fd0aa;
  --red: #e05c4f;
  --blue: #72a7df;
  --black: #080807;
  --panel-radius: 8px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 220, 150, 0.06), transparent 30%),
    repeating-linear-gradient(0deg, rgba(255, 230, 170, 0.024) 0 1px, transparent 1px 8px),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(201, 149, 72, 0.75);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 232, 170, 0.12), transparent 45%),
    linear-gradient(180deg, #4a3923, #2c2116);
  color: var(--ink);
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 245, 205, 0.12), 0 8px 18px rgba(0, 0, 0, 0.18);
}

button:hover {
  border-color: var(--jade);
  color: white;
}

button:disabled {
  opacity: 0.48;
  cursor: default;
}

button.reward-claim-wait:disabled {
  opacity: 0.72;
  border-color: rgba(255, 211, 126, 0.55);
  color: #ffd27a;
  background:
    linear-gradient(180deg, rgba(255, 211, 126, 0.1), transparent 45%),
    linear-gradient(180deg, #3d3528, #241f19);
}

button.reward-claim-ready {
  border-color: var(--jade);
  color: #d7fff2;
  background:
    linear-gradient(180deg, rgba(215, 255, 242, 0.18), transparent 45%),
    linear-gradient(180deg, #26634e, #15392d);
  box-shadow: inset 0 1px 0 rgba(255, 245, 205, 0.16), 0 10px 24px rgba(95, 208, 170, 0.22);
}

.dev-tools {
  grid-column: 1 / -1;
  border: 1px dashed rgba(255, 211, 126, 0.38);
  border-radius: 6px;
  padding: 6px;
  background: rgba(12, 10, 8, 0.62);
}

.dev-tools summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 6px;
}

.dev-tools button {
  width: calc(50% - 4px);
  min-height: 30px;
  margin-top: 4px;
  padding: 5px 8px;
  opacity: 0.86;
}

input {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(173, 152, 112, 0.65);
  border-radius: 6px;
  background: #16130f;
  color: var(--ink);
  padding: 7px 9px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top-bar,
.log-bar {
  border-color: rgba(108, 86, 53, 0.85);
  background: rgba(27, 23, 17, 0.96);
}

.top-bar {
  display: none !important;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 16px 96px 16px 22px;
  border-bottom: 1px solid rgba(108, 86, 53, 0.85);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  letter-spacing: 0;
  color: #fff0ca;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

h2 {
  font-size: 14px;
  color: var(--bronze);
  margin-bottom: 10px;
}

#seasonLine {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.top-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-stats span,
.tag {
  border: 1px solid rgba(201, 149, 72, 0.5);
  border-radius: 999px;
  padding: 5px 9px;
  color: #f8e7c4;
  background: rgba(61, 48, 31, 0.72);
  font-size: 12px;
}

.top-stats .version-badge {
  border-color: rgba(114, 167, 223, 0.42);
  color: rgba(215, 235, 255, 0.82);
  background: rgba(31, 49, 67, 0.72);
  font-variant-numeric: tabular-nums;
}

.screen-version-watermark {
  position: fixed !important;
  right: 14px !important;
  bottom: 10px !important;
  z-index: 10000000 !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  font-family: var(--font-mono, "SF Mono", Monaco, Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: rgba(220, 240, 255, 0.95);
  background: rgba(10, 16, 26, 0.94);
  border: 1px solid rgba(80, 160, 240, 0.55);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  user-select: none;
  white-space: nowrap;
  isolation: isolate;
}

.screen-fps-watermark {
  position: fixed !important;
  right: 14px !important;
  top: 10px !important;
  z-index: 10000001 !important;
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  font-family: var(--font-mono, "SF Mono", Monaco, Consolas, monospace);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  color: #4ade80;
  background: rgba(10, 16, 26, 0.94);
  border: 1px solid rgba(74, 222, 128, 0.6);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  user-select: none;
  white-space: nowrap;
  isolation: isolate;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.screen-fps-watermark.fps-warn {
  color: #facc15 !important;
  border-color: rgba(250, 204, 21, 0.7) !important;
}

.screen-fps-watermark.fps-crit {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
}

.audio-control-wrap {
  position: relative;
  min-width: 116px;
}

.audio-settings {
  position: relative;
  z-index: 20;
}

.audio-settings summary {
  list-style: none;
  min-height: 28px;
  border: 1px solid rgba(95, 208, 170, 0.45);
  border-radius: 999px;
  padding: 5px 10px;
  color: #d7fff2;
  background: rgba(32, 53, 45, 0.76);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.audio-settings summary::-webkit-details-marker {
  display: none;
}

.audio-settings-body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 224px;
  display: grid;
  gap: 9px;
  border: 1px solid rgba(95, 208, 170, 0.42);
  border-radius: 8px;
  padding: 10px;
  background: rgba(18, 17, 14, 0.96);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
}

.audio-settings-body label {
  display: grid;
  gap: 5px;
  color: #dcc79f;
  font-size: 12px;
  font-weight: 800;
}

.audio-settings-body .audio-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-settings-body input[type="range"] {
  width: 100%;
  min-height: 22px;
  padding: 0;
  accent-color: var(--jade);
}

.audio-settings-body input[type="checkbox"] {
  width: auto;
  min-height: 0;
  accent-color: var(--jade);
}

.audio-settings-body select {
  width: 100%;
  min-height: 28px;
  border: 1px solid rgba(95, 208, 170, 0.38);
  border-radius: 4px;
  padding: 4px 7px;
  color: #d7fff2;
  background: rgba(7, 18, 17, 0.9);
  font: inherit;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
  align-items: start;
}

.stage-panel {
  position: relative;
  align-self: start;
  min-width: 0;
  height: auto;
  container-type: inline-size;
  --stage-ui-scale: 1;
  border: 1px solid rgba(108, 86, 53, 0.9);
  border-radius: var(--panel-radius);
  overflow: hidden;
  background: #0b0a08;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

#gameCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 3;
  min-height: 0;
  display: block;
  image-rendering: auto;
  contain: paint;
  transform: translateZ(0);
}

.main-menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 46px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(9, 8, 6, 0.08), rgba(9, 8, 6, 0.56) 45%, rgba(9, 8, 6, 0.9)),
    url("../assets/art/ui-v2/campaign-command-map-v2.webp?v=ui-unification-20261002-v23") center / cover no-repeat,
    linear-gradient(90deg, rgba(9, 8, 6, 0.22), rgba(9, 8, 6, 0.66) 45%, rgba(9, 8, 6, 0.88));
}

.operations-terminal {
  width: min(940px, 100%);
  max-height: calc(100% - 12px);
  margin-left: auto;
  overflow: auto;
  border: 1px solid rgba(95, 208, 170, 0.68);
  border-radius: 10px;
  padding: 22px;
  color: #f8e7c4;
  background:
    linear-gradient(135deg, rgba(17, 35, 36, 0.97), rgba(15, 14, 12, 0.98)),
    var(--paper);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(161, 255, 230, 0.1);
}

.operations-header,
.operations-section-heading,
.research-card-head,
.research-card footer,
.inventory-grid article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.operations-header h2,
.operations-section-heading h3,
.loadout-slot h4 {
  margin: 0;
  color: #fff2cf;
}

.operations-header h2 { font-size: clamp(25px, 4vw, 40px); }
.operations-header p,
.operations-section-heading p { margin: 7px 0 0; color: #bcd8d0; }

.operations-progress-strip,
.operations-role-tabs,
.operations-tabs {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.operations-progress-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.operations-progress-strip span {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(95, 208, 170, 0.25);
  border-radius: 6px;
  padding: 9px 11px;
  color: #9fbcb5;
  background: rgba(0, 0, 0, 0.22);
  font-size: 12px;
}
.operations-progress-strip strong { color: #e6fff7; font-size: 14px; }

.operations-role-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.operations-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.operations-role-tabs button[aria-current="true"],
.operations-tabs button[aria-current="page"] {
  border-color: #5fd0aa;
  color: white;
  background: linear-gradient(180deg, rgba(95, 208, 170, 0.3), rgba(22, 54, 45, 0.9));
}

.operations-message {
  margin: 12px 0 0;
  border: 1px solid rgba(108, 223, 255, 0.4);
  border-radius: 6px;
  padding: 9px 11px;
  color: #d7f5ff;
  background: rgba(7, 35, 46, 0.65);
}
.operations-message[data-tone="support"] { border-color: rgba(95, 208, 170, 0.62); color: #d7fff2; }
.operations-message[data-tone="warning"] { border-color: rgba(255, 183, 77, 0.62); color: #ffe0aa; }
.operations-message[data-tone="danger"] { border-color: rgba(224, 92, 79, 0.68); color: #ffd3ce; }

.operations-body { margin-top: 16px; }
.operations-section-heading { margin-bottom: 12px; }
.research-grid,
.inventory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.research-card,
.inventory-grid article,
.loadout-slot {
  border: 1px solid rgba(173, 152, 112, 0.28);
  border-radius: 7px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.23);
}
.reward-media {
  position: relative;
  min-height: 148px;
  margin: -12px -12px 12px;
  overflow: hidden;
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid rgba(255, 183, 77, 0.34);
  background: #090c0e;
}
.reward-media--compact { min-height: 84px; margin: -8px -8px 4px; }
.reward-media img { width: 100%; height: 100%; min-height: inherit; display: block; object-fit: cover; transition: filter 260ms ease, transform 260ms ease, opacity 260ms ease; }
.reward-media[data-owned="false"] img { filter: grayscale(1) contrast(1.08) brightness(0.42); opacity: 0.72; }
.reward-media[data-owned="true"] img { filter: saturate(1.08) contrast(1.04); }
.reward-media[data-owned="true"]:hover img { transform: scale(1.035); }
.reward-lock,
.reward-owned-mark {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font: 900 17px/1 sans-serif;
  backdrop-filter: blur(8px);
}
.reward-lock { color: #d8d8d8; border: 1px solid rgba(255,255,255,.46); background: rgba(4,6,8,.78); box-shadow: 0 8px 24px rgba(0,0,0,.55); }
.reward-lock::before { content: ""; position: absolute; width: 12px; height: 10px; top: 5px; border: 2px solid currentColor; border-bottom: 0; border-radius: 8px 8px 0 0; }
.reward-lock { font-size: 0; }
.reward-lock::after { content: ""; width: 14px; height: 12px; margin-top: 8px; border-radius: 2px; background: currentColor; }
.reward-owned-mark { color: #071612; border: 1px solid #8ff3d2; background: #74d8b7; box-shadow: 0 0 24px rgba(95,208,170,.45); }
.reward-distance { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-top: 9px; color: #ffcf82; font-size: 12px; }
.reward-distance span { color: #9fbcb5; text-align: right; }
.research-card[data-state="active"] { border-color: rgba(95, 208, 170, 0.74); }
.research-card[data-state="completed"] { border-color: rgba(201, 149, 72, 0.62); }
.research-card[data-state="locked"] { border-color: rgba(255,255,255,.12); }
.research-card-head span { color: #5fd0aa; font-weight: 900; }
.research-card-head strong { flex: 1; }
.research-card-head em,
.inventory-grid em { color: #bcd8d0; font-size: 11px; font-style: normal; }
.research-card p,
.inventory-grid p { margin: 10px 0 6px; color: #e7dcc6; line-height: 1.45; }
.research-card small,
.inventory-grid small { color: #9c927e; line-height: 1.45; }
.research-progress { height: 6px; margin: 11px 0; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.08); }
.research-progress i { display: block; height: 100%; background: linear-gradient(90deg, #3c9f86, #87f0ce); }
.research-card footer span { color: #c6b998; font-size: 12px; }

.loadout-grid { display: grid; gap: 10px; }
.loadout-slot { display: grid; grid-template-columns: 140px repeat(3, minmax(0, 1fr)); gap: 9px; align-items: stretch; }
.loadout-slot h4 { align-self: center; }
.loadout-choice { display: grid; gap: 6px; text-align: left; }
.loadout-choice[data-selected="true"] { border-color: #5fd0aa; box-shadow: inset 0 0 18px rgba(95, 208, 170, 0.12); }
.loadout-choice span { color: #d8ccb3; font-size: 12px; line-height: 1.4; }
.loadout-choice small { color: #9c927e; line-height: 1.35; }
.loadout-choice:disabled { opacity: 0.68; }
.inventory-grid article[data-owned="false"] { border-color: rgba(255,255,255,.13); }

.leaderboard-terminal {
  width: min(920px, 100%);
  max-height: calc(100% - 12px);
  margin-left: auto;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(108, 223, 255, 0.48);
  border-radius: 10px;
  color: #f8e7c4;
  background: linear-gradient(145deg, rgba(7, 19, 28, 0.98), rgba(11, 34, 45, 0.96));
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58);
}

.leaderboard-header,
.leaderboard-footer,
.leaderboard-tabs { display: flex; align-items: center; }
.leaderboard-header { justify-content: space-between; gap: 20px; }
.leaderboard-header h2,
.leaderboard-header p { margin: 0; }
.leaderboard-header h2 { font-size: clamp(26px, 4vw, 44px); }
.leaderboard-header > div > p:last-child { color: #bcd8d0; margin-top: 6px; }
.leaderboard-tabs { gap: 8px; flex-wrap: wrap; }
.leaderboard-tabs button[aria-current="page"] { color: #061116; background: #6cdfff; border-color: #6cdfff; }

.leaderboard-own-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 18px;
  padding: 14px 16px;
  border-left: 3px solid #6cdfff;
  background: rgba(72, 203, 224, 0.08);
}
.leaderboard-own-card strong { grid-row: span 2; align-self: center; font-size: 30px; color: #6cdfff; }
.leaderboard-own-card small { color: #9fbcb5; }
.leaderboard-table { display: grid; border: 1px solid rgba(255, 255, 255, 0.1); }
.leaderboard-row { display: grid; grid-template-columns: 72px minmax(160px, 1fr) 100px 100px; min-height: 42px; align-items: center; padding: 0 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.leaderboard-row:last-child { border-bottom: 0; }
.leaderboard-row-head { min-height: 34px; color: #9fbcb5; background: rgba(255, 255, 255, 0.04); font-size: 12px; }
.leaderboard-row[data-viewer="true"] { background: rgba(255, 183, 77, 0.13); box-shadow: inset 3px 0 #ffb74d; }
.leaderboard-row > :nth-child(3) { color: #6cdfff; }
.leaderboard-divider { padding: 8px 14px; color: #ffcf82; background: rgba(255, 183, 77, 0.07); font-size: 12px; letter-spacing: 0.12em; }
.leaderboard-empty { min-height: 150px; display: grid; place-items: center; gap: 12px; padding: 28px; color: #9fbcb5; border: 1px dashed rgba(255, 255, 255, 0.15); text-align: center; }
.leaderboard-empty[data-tone="danger"] { color: #ffd3ce; }
.leaderboard-footer { justify-content: space-between; gap: 12px; color: #9fbcb5; font-size: 12px; }

.retention-terminal {
  width: min(960px, 100%);
  max-height: calc(100% - 12px);
  margin-left: auto;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(255, 183, 77, 0.58);
  border-radius: 10px;
  color: #f8e7c4;
  background:
    linear-gradient(90deg, rgba(24, 16, 10, 0.98) 0%, rgba(18, 18, 16, 0.94) 42%, rgba(10, 20, 21, 0.76) 72%, rgba(10, 13, 16, 0.84) 100%),
    url("../assets/art/antibody-front-season-terminal-v1.webp?v=batch-l-20260811") center / cover no-repeat;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.58);
}
.retention-header,
.retention-footer,
.retention-tabs { display: flex; align-items: center; }
.retention-header { justify-content: space-between; gap: 20px; }
.retention-header h2,
.retention-header p { margin: 0; }
.retention-header h2 { font-size: clamp(26px, 4vw, 42px); }
.retention-header > div > p:last-child { margin-top: 6px; color: #cdbf9d; }
.retention-tabs { gap: 8px; flex-wrap: wrap; }
.retention-tabs button[aria-current="page"] { border-color: #ffb74d; color: #211305; background: #ffb74d; }
.retention-season-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.retention-season-summary > div { display: grid; gap: 5px; padding: 13px; border: 1px solid rgba(255, 183, 77, 0.24); background: rgba(0, 0, 0, 0.22); }
.retention-season-summary span,
.retention-season-summary small { color: #b9ae95; }
.retention-season-summary strong { color: #ffe0aa; font-size: 20px; }
.retention-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.retention-track article,
.retention-card-grid article,
.retention-collection article { display: grid; gap: 7px; min-width: 0; padding: 12px; border: 1px solid rgba(173, 152, 112, 0.3); border-radius: 7px; background: rgba(0, 0, 0, 0.24); }
.retention-track article[data-earned="true"],
.retention-card-grid article[data-complete="true"] { border-color: rgba(95, 208, 170, 0.68); box-shadow: inset 0 0 20px rgba(95, 208, 170, 0.08); }
.retention-track span,
.retention-card-grid span,
.retention-collection span { color: #ffb74d; font-size: 11px; letter-spacing: 0.07em; }
.retention-track small,
.retention-card-grid small,
.retention-collection small { color: #a99e87; overflow-wrap: anywhere; }
.retention-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.retention-card-grid p { min-height: 2.8em; margin: 0; color: #d8ccb3; line-height: 1.4; }
.retention-card-grid article > div { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.retention-card-grid article > div i { display: block; width: var(--progress); height: 100%; background: linear-gradient(90deg, #c57b2a, #87f0ce); }
.retention-collection { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.retention-collection-showcase { position: relative; min-height: 170px; margin: 0; overflow: hidden; border: 1px solid rgba(255, 183, 77, 0.32); border-radius: 8px; background: linear-gradient(135deg, #14110d, #071315); }
.retention-collection-showcase img { display: block; width: 100%; height: clamp(170px, 28vw, 300px); object-fit: cover; object-position: center; }
.retention-collection-showcase figcaption { position: absolute; inset: auto 0 0; padding: 18px 14px 10px; color: #e7dcc6; background: linear-gradient(transparent, rgba(5, 7, 7, 0.92)); font-size: 12px; }
.retention-empty { min-height: 160px; display: grid; place-items: center; gap: 12px; padding: 28px; border: 1px dashed rgba(255, 255, 255, 0.15); color: #b9ae95; text-align: center; }
.retention-empty[data-tone="danger"] { color: #ffd3ce; }
.retention-footer { justify-content: space-between; gap: 12px; color: #a99e87; font-size: 12px; }
.retention-report { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-left: 3px solid #5fd0aa; background: rgba(95, 208, 170, 0.08); }

@media (max-width: 760px) {
  .main-menu { place-items: start center; }
  .operations-terminal { max-height: none; margin: 0 auto; padding: 15px; }
  .leaderboard-terminal { max-height: none; margin: 0 auto; padding: 14px; }
  .retention-terminal { max-height: none; margin: 0 auto; padding: 14px; }
  .leaderboard-header { align-items: flex-start; }
  .leaderboard-header > button { flex: 0 0 auto; }
  .leaderboard-row { grid-template-columns: 50px minmax(112px, 1fr) 68px 68px; padding: 0 8px; font-size: 12px; }
  .leaderboard-footer { align-items: flex-start; flex-wrap: wrap; }
  .retention-header { align-items: flex-start; }
  .retention-season-summary,
  .retention-card-grid,
  .retention-collection { grid-template-columns: 1fr; }
  .retention-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .retention-footer { align-items: flex-start; flex-wrap: wrap; }
  .operations-header { align-items: flex-start; }
  .operations-progress-strip { grid-template-columns: 1fr; }
  .research-grid,
  .inventory-grid { grid-template-columns: 1fr; }
  .loadout-slot { grid-template-columns: 1fr; }
  .operations-section-heading { align-items: flex-start; flex-direction: column; }
}

.main-menu[hidden] {
  display: none;
}

.menu-frame {
  width: min(760px, 100%);
  margin-left: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: end;
  border: 1px solid rgba(201, 149, 72, 0.68);
  border-radius: 8px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(49, 40, 29, 0.94), rgba(18, 16, 13, 0.94)),
    var(--paper);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 241, 200, 0.08);
}

.menu-copy {
  grid-column: 1 / -1;
}

.eyebrow {
  color: var(--jade);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.menu-copy h2 {
  margin: 0;
  color: #fff2cf;
  font-size: 48px;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.menu-lede {
  width: min(520px, 100%);
  margin-top: 14px;
  color: #dcc79f;
  font-size: 15px;
  line-height: 1.7;
}

.menu-actions {
  display: grid;
  gap: 10px;
}

.menu-actions button {
  min-height: 46px;
  text-align: left;
  padding-inline: 16px;
}

.menu-actions .primary-action {
  border-color: rgba(95, 208, 170, 0.82);
  background:
    linear-gradient(180deg, rgba(121, 238, 199, 0.22), transparent 48%),
    linear-gradient(180deg, #38634f, #1d2f28);
  color: white;
}

.run-login-label {
  color: #f8e7c4;
  font-size: 13px;
  font-weight: 800;
}

.menu-actions #runAccessCodeInput {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(95, 208, 170, 0.62);
  border-radius: 6px;
  padding: 0 14px;
  background: rgba(4, 10, 12, 0.78);
  color: #ffffff;
  outline: none;
}

.menu-actions #runAccessCodeInput:focus {
  border-color: #7eeee0;
  box-shadow: 0 0 0 3px rgba(95, 208, 170, 0.16);
}

.run-login-status {
  min-height: 38px;
  margin: 0;
  color: #bcd8d0;
  font-size: 12px;
  line-height: 1.55;
}

.run-login-status[data-tone="danger"] { color: #ff9d91; }
.run-login-status[data-tone="warning"] { color: #ffd27a; }

.menu-dossier {
  display: grid;
  gap: 8px;
  align-self: stretch;
}

.menu-dossier div {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(173, 152, 112, 0.24);
  border-radius: 6px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.menu-dossier span {
  color: var(--muted);
  font-size: 12px;
}

.menu-dossier strong {
  color: #f8e7c4;
  font-size: 13px;
}

.matchmaking-stats {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  border: 1px solid rgba(95, 208, 170, 0.42);
  border-radius: 7px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(25, 70, 82, 0.28), rgba(0, 0, 0, 0.28)),
    rgba(5, 10, 13, 0.48);
  box-shadow: inset 0 1px 0 rgba(161, 255, 230, 0.1);
}

.matchmaking-stats.compact {
  margin-top: 8px;
  padding: 8px;
}

.matchmaking-stats[data-tone="warning"] {
  border-color: rgba(255, 210, 122, 0.55);
}

.matchmaking-stats[data-tone="danger"] {
  border-color: rgba(224, 92, 79, 0.68);
}

.matchmaking-stats-head,
.matchmaking-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.matchmaking-stats-head span,
.matchmaking-stat-row span {
  color: var(--muted);
  font-size: 12px;
}

.matchmaking-stats-head strong {
  color: var(--jade);
  font-size: 13px;
}

.matchmaking-stats[data-tone="warning"] .matchmaking-stats-head strong,
.matchmaking-stat-row[data-tone="warning"] strong {
  color: #ffd27a;
}

.matchmaking-stats[data-tone="danger"] .matchmaking-stats-head strong,
.matchmaking-stat-row[data-tone="danger"] strong {
  color: #ffd3ce;
}

.matchmaking-stats p {
  margin: 0;
  color: #d8c99f;
  font-size: 12px;
  line-height: 1.55;
}

.matchmaking-stats-refresh {
  justify-self: start;
  min-height: 26px;
  border: 1px solid rgba(95, 208, 170, 0.55);
  border-radius: 5px;
  background: rgba(19, 76, 75, 0.32);
  color: var(--jade);
  font-size: 11px;
  padding: 3px 10px;
}

.matchmaking-stats-refresh:disabled {
  border-color: rgba(140, 148, 145, 0.32);
  background: rgba(20, 24, 24, 0.3);
  color: var(--muted);
  cursor: default;
}

.matchmaking-stat-grid,
.matchmaking-admin {
  display: grid;
  gap: 6px;
}

.matchmaking-admin {
  border-top: 1px solid rgba(95, 208, 170, 0.2);
  padding-top: 7px;
}

.matchmaking-stat-row {
  border: 1px solid rgba(173, 152, 112, 0.2);
  border-radius: 5px;
  padding: 7px 8px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 12px;
}

.matchmaking-stat-row strong {
  color: var(--jade);
  text-align: right;
}

.overlay-hint {
  position: absolute;
  left: calc(14px * var(--stage-ui-scale, 1));
  bottom: calc(14px * var(--stage-ui-scale, 1));
  max-width: min(calc(560px * var(--stage-ui-scale, 1)), calc(100% - 28px));
  color: #fff6db;
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
  font-size: calc(13px * var(--stage-ui-scale, 1));
}

.app-shell[data-mode="battle"] .overlay-hint {
  bottom: calc(112px * var(--stage-ui-scale, 1));
}

.game-cutin-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  isolation: isolate;
  will-change: transform, opacity;
  transform: translateZ(0);
  visibility: hidden;
  opacity: 0;
  --cutin-skew: -15deg;
  --cutin-counter-skew: 15deg;
  --cutin-band-height: clamp(112px, calc(178px * var(--stage-ui-scale, 1)), 188px);
  --cutin-image-left: clamp(28px, calc(64px * var(--stage-ui-scale, 1)), 96px);
  --cutin-image-width: clamp(150px, 34vw, calc(410px * var(--stage-ui-scale, 1)));
  --cutin-image-aspect: 16 / 9;
  --cutin-neon: #00d2ff;
  --cutin-hot: #ff9b24;
  --cutin-band-bg: rgba(5, 15, 25, 0.9);
}

.game-cutin-overlay[hidden] {
  display: block;
  visibility: hidden;
  opacity: 0;
}

.game-cutin-overlay.is-active {
  visibility: visible;
  opacity: 1;
}

.game-cutin-backdrop {
  display: none !important;
}

.game-cutin-grid {
  display: none !important;
}

.game-cutin-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 14%;
  height: var(--cutin-band-height);
  transform: translateY(-50%);
  overflow: visible;
  background: var(--cutin-band-bg, rgba(8, 14, 22, 0.94));
  border-top: 2px solid var(--cutin-neon, #00d2ff);
  border-bottom: 2px solid var(--cutin-neon, #00d2ff);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
  will-change: transform, opacity;
  contain: layout paint;
  opacity: 0;
  pointer-events: none;
}

.game-cutin-band::before,
.game-cutin-band::after {
  display: none !important;
}

.game-cutin-overlay.is-active .game-cutin-band {
  animation: game-cutin-band-timeline 1100ms cubic-bezier(0.16, 0.98, 0.18, 1) both;
}

.game-cutin-speed-lines {
  display: none !important;
}

.game-cutin-image-clip {
  position: absolute;
  z-index: 3;
  left: var(--cutin-image-left);
  top: 50%;
  width: var(--cutin-image-width);
  aspect-ratio: var(--cutin-image-aspect);
  max-height: none;
  height: auto;
  transform: translateY(-50%);
  overflow: visible;
  border-left: 2px solid rgba(255, 255, 255, 0.72);
  border-right: 2px solid var(--cutin-neon, #00d2ff);
  background: transparent;
  display: grid;
  place-items: center;
}

.game-cutin-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.game-cutin-title {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: calc(var(--cutin-image-left) + var(--cutin-image-width) + 24px);
  right: clamp(20px, calc(48px * var(--stage-ui-scale, 1)), 64px);
  width: auto;
  min-width: 0;
  overflow: visible;
  transform: translateY(-50%);
  display: grid;
  gap: 4px;
  justify-items: end;
  padding: 0;
  color: #f4fdff;
  text-align: right;
}

.game-cutin-title span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font: 900 calc(18px * var(--stage-ui-scale, 1)) / 1.1 "Courier New", monospace;
  letter-spacing: 0.5px;
  color: #f4fdff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}

.game-cutin-overlay.is-active .game-cutin-title span {
  animation: none;
}

.game-cutin-title small {
  display: block;
  padding: 3px 8px 3px;
  color: #87ecff;
  font: 800 calc(9px * var(--stage-ui-scale, 1)) / 1 "Courier New", monospace;
  letter-spacing: 0.5px;
  background: rgba(0, 20, 34, 0.72);
  border: 1px solid rgba(0, 210, 255, 0.72);
}

.game-cutin-overlay[data-cutin="drone"] {
  --cutin-image-aspect: 16 / 9;
}

.game-cutin-overlay[data-cutin="c4"],
.game-cutin-overlay[data-cutin="destroy"],
.game-cutin-overlay[data-cutin="infantry_destroyed"],
.game-cutin-overlay[data-cutin="minelayer_destroyed"],
.game-cutin-overlay[data-cutin="minelayer_deploy"] {
  --cutin-neon: var(--cutin-hot);
  --cutin-band-bg: rgba(24, 10, 4, 0.94);
}

.game-cutin-overlay[data-cutin="base_repair_complete"] {
  --cutin-neon: #5fd0aa;
  --cutin-band-bg: rgba(5, 24, 20, 0.94);
}

.game-cutin-overlay[data-cutin="c4"] .game-cutin-band,
.game-cutin-overlay[data-cutin="destroy"] .game-cutin-band,
.game-cutin-overlay[data-cutin="infantry_destroyed"] .game-cutin-band,
.game-cutin-overlay[data-cutin="minelayer_destroyed"] .game-cutin-band,
.game-cutin-overlay[data-cutin="minelayer_deploy"] .game-cutin-band {
  border-top-color: rgba(255, 140, 43, 0.95);
  border-bottom-color: rgba(255, 140, 43, 0.95);
}

.game-cutin-overlay[data-cutin="c4"] .game-cutin-image-clip,
.game-cutin-overlay[data-cutin="destroy"] .game-cutin-image-clip,
.game-cutin-overlay[data-cutin="infantry_destroyed"] .game-cutin-image-clip,
.game-cutin-overlay[data-cutin="minelayer_destroyed"] .game-cutin-image-clip,
.game-cutin-overlay[data-cutin="minelayer_deploy"] .game-cutin-image-clip {
  border-right-color: rgba(255, 140, 43, 0.95);
}

.game-cutin-overlay[data-cutin="c4"] .game-cutin-title span,
.game-cutin-overlay[data-cutin="destroy"] .game-cutin-title span,
.game-cutin-overlay[data-cutin="infantry_destroyed"] .game-cutin-title span,
.game-cutin-overlay[data-cutin="minelayer_destroyed"] .game-cutin-title span,
.game-cutin-overlay[data-cutin="minelayer_deploy"] .game-cutin-title span {
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}

.game-cutin-overlay[data-cutin="c4"] .game-cutin-title small,
.game-cutin-overlay[data-cutin="destroy"] .game-cutin-title small,
.game-cutin-overlay[data-cutin="infantry_destroyed"] .game-cutin-title small,
.game-cutin-overlay[data-cutin="minelayer_destroyed"] .game-cutin-title small,
.game-cutin-overlay[data-cutin="minelayer_deploy"] .game-cutin-title small {
  color: #ffd696;
  border-color: rgba(255, 140, 43, 0.74);
}

.game-cutin-overlay[data-cutin="base_repair_complete"] .game-cutin-band {
  border-top-color: rgba(95, 208, 170, 0.95);
  border-bottom-color: rgba(95, 208, 170, 0.95);
}

.game-cutin-overlay[data-cutin="base_repair_complete"] .game-cutin-image-clip {
  border-right-color: rgba(95, 208, 170, 0.95);
}

@keyframes game-cutin-band-timeline {
  0% {
    opacity: 0;
    transform: translateY(-50%);
  }
  10% {
    opacity: 1;
    transform: translateY(-50%);
  }
  82% {
    opacity: 1;
    transform: translateY(-50%);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%);
  }
}

@media (max-width: 720px) {
  .game-cutin-overlay {
    --cutin-band-height: clamp(44px, 10vh, 56px);
    --cutin-image-left: 14px;
    --cutin-image-width: min(26vw, 92px);
  }

  .game-cutin-band {
    left: 0;
    right: 0;
    top: 12%;
  }

  .game-cutin-title {
    left: calc(var(--cutin-image-left) + var(--cutin-image-width) + 12px);
    right: 14px;
    width: auto;
  }

  .game-cutin-title span {
    font-size: max(12px, calc(14px * var(--stage-ui-scale, 1)));
  }

  .game-cutin-title small {
    font-size: max(8px, calc(8px * var(--stage-ui-scale, 1)));
    padding: 2px 6px;
  }
}

.battle-hud {
  position: absolute;
  left: var(--battle-hud-left, 50%);
  bottom: var(--battle-hud-bottom, calc(16px * var(--stage-ui-scale, 1)));
  z-index: 6;
  width: 610px;
  max-width: none;
  height: 66px;
  min-height: 66px;
  max-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 136px;
  gap: 10px;
  align-items: stretch;
  padding: 6px 8px;
  color: #f0dfbc;
  pointer-events: none;
  contain: layout style;
  will-change: transform;
  opacity: 0;
  transform: translate(-50%, 12px) scale(var(--battle-hud-scale, var(--stage-ui-scale, 1)));
  transform-origin: bottom center;
  transition: opacity 160ms ease, transform 160ms ease;
  background: none !important;
  border: 0;
  box-shadow: none !important;
}

.battle-hud.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(var(--battle-hud-scale, var(--stage-ui-scale, 1)));
}

.battle-hud.is-visible.is-compact {
  opacity: 0.84;
}

.battle-hud.is-compact {
  height: 54px;
  min-height: 54px;
  max-height: 54px;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.94fr) 102px;
  gap: 6px;
  padding: 4px 6px;
  background: none !important;
  box-shadow: none !important;
}

.battle-hud::before,
.battle-hud::after {
  display: none;
}

.battle-hud::after {
  inset: auto 16px 8px 16px;
  border-top: 0;
  border-bottom: 1px solid rgba(108, 223, 255, 0.18);
}

.battle-hud-vitals,
.battle-hud-weapon,
.battle-hud-support {
  position: relative;
  min-width: 0;
  background: linear-gradient(180deg, rgba(14, 16, 14, 0.56), rgba(5, 7, 7, 0.18)) !important;
  border: 0;
  border-left: 1px solid rgba(240, 223, 188, 0.18);
  box-shadow: none;
}

.battle-hud-vitals {
  height: 52px;
  display: grid;
  grid-template-rows: 17px 14px 14px;
  gap: 2px;
  padding: 4px 8px;
}

.battle-hud.is-compact .battle-hud-vitals {
  height: 44px;
  grid-template-columns: 1fr;
  grid-template-rows: 14px 12px 12px;
  gap: 1px;
  padding: 3px 6px;
}

.battle-hud-id {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.battle-hud-id > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.battle-hud-id .battle-hud-role {
  flex: 0 0 auto;
  margin-top: 0;
}

.battle-hud-equipment-badges {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  pointer-events: auto;
  z-index: 10;
  max-width: 580px;
}

.battle-hud-equipment-badges:empty {
  display: none;
}

.battle-hud-equipment-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 6px;
  border-radius: 3px;
  background: rgba(14, 28, 44, 0.92);
  border: 1px solid rgba(80, 180, 240, 0.45);
  color: #a4d2f0;
  font: 700 9px/1.2 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease-out;
}

[lang="en"] .battle-hud-equipment-chip,
[data-lang="en"] .battle-hud-equipment-chip {
  max-width: 220px;
  font-size: 8.5px;
}

.battle-hud.is-compact .battle-hud-equipment-badges {
  bottom: calc(100% + 3px);
  gap: 3px;
}

.battle-hud.is-compact .battle-hud-equipment-chip {
  padding: 1px 4px;
  font-size: 8px;
  max-width: 110px;
}

[lang="en"] .battle-hud.is-compact .battle-hud-equipment-chip,
[data-lang="en"] .battle-hud.is-compact .battle-hud-equipment-chip {
  max-width: 150px;
  font-size: 7.5px;
}

.battle-hud-equipment-chip.is-active {
  border-color: #ffd54f;
  background: rgba(45, 35, 10, 0.92);
  color: #fff9c4;
  box-shadow: 0 0 8px rgba(255, 213, 79, 0.6);
  animation: hudChipPulse 0.8s ease-in-out infinite alternate;
}

@keyframes hudChipPulse {
  from { box-shadow: 0 0 4px rgba(255, 213, 79, 0.4); }
  to { box-shadow: 0 0 10px rgba(255, 213, 79, 0.85); }
}

.battle-hud-unit-no {
  display: inline;
  width: auto;
  height: auto;
  color: rgba(240, 200, 95, 0.62);
  font: 800 9px/1 "Courier New", monospace;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
}

.battle-hud.is-compact .battle-hud-unit-no {
  width: auto;
  height: auto;
  font-size: 8px;
}

.battle-hud-name {
  display: block;
  overflow: hidden;
  color: #ffffff;
  max-width: 92px;
  font-size: 12px;
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-hud.is-compact .battle-hud-name {
  font-size: 12px;
}

.battle-hud-role {
  display: block;
  margin-top: 3px;
  color: #72d7df;
  font: 800 9px/1 "Courier New", monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

.battle-hud.is-compact .battle-hud-role {
  display: none;
}

.battle-hud-row {
  display: grid;
  grid-template-columns: 12px 24px minmax(0, 1fr) 42px;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.battle-hud.is-compact .battle-hud-row {
  grid-template-columns: 0 minmax(52px, 1fr) 46px;
  gap: 6px;
}

.battle-hud-row-icon {
  display: grid;
  place-items: center;
  width: 10px;
  height: 10px;
  color: #72d7df;
  font: 900 10px/1 "Courier New", monospace;
  border: 0;
  background: none !important;
}

.battle-hud.is-compact .battle-hud-row-icon {
  display: none;
}

.battle-hud-row-label {
  color: rgba(240, 223, 188, 0.68);
  font: 800 13px/1 "Courier New", monospace;
}

.battle-hud.is-compact .battle-hud-row-label {
  font-size: 11px;
}

.battle-hud-infantry-actions {
  position: absolute;
  right: 8px;
  top: 4px;
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.battle-hud-infantry-actions[hidden] {
  display: none;
}

/* English labels need their own baseline, not the player's name row. */
[lang="en"] .battle-hud,
[data-lang="en"] .battle-hud {
  width: 630px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 144px;
  height: 86px;
  min-height: 86px;
  max-height: 86px;
}
[lang="en"] .battle-hud .battle-hud-vitals,
[data-lang="en"] .battle-hud .battle-hud-vitals {
  height: 72px;
  padding-bottom: 23px;
}
[lang="en"] .battle-hud .battle-hud-infantry-actions,
[data-lang="en"] .battle-hud .battle-hud-infantry-actions {
  top: auto;
  bottom: 3px;
  left: 6px;
  right: 6px;
}
[lang="en"] .battle-hud.is-compact,
[data-lang="en"] .battle-hud.is-compact {
  height: 74px;
  min-height: 74px;
  max-height: 74px;
}
[lang="en"] .battle-hud.is-compact .battle-hud-vitals,
[data-lang="en"] .battle-hud.is-compact .battle-hud-vitals {
  height: 64px;
}
[lang="en"] .dev-tools button,
[data-lang="en"] .dev-tools button {
  width: auto;
  min-width: max-content;
  white-space: nowrap;
}

.battle-hud-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 74px;
  padding: 2px 4px;
  color: #f0dfbc;
  font: 900 10px/1 "Courier New", monospace;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(240, 200, 95, 0.34);
  box-shadow: none;
}

[lang="en"] .battle-hud-action-chip,
[data-lang="en"] .battle-hud-action-chip {
  max-width: 130px;
}

.battle-hud-action-chip kbd {
  display: grid;
  place-items: center;
  min-width: 14px;
  height: 13px;
  color: #07121a;
  font: 900 10px/1 "Courier New", monospace;
  background: #f0c85f;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.battle-hud-action-chip em {
  overflow: hidden;
  max-width: 72px;
  font-style: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

[lang="en"] .battle-hud-action-chip em,
[data-lang="en"] .battle-hud-action-chip em {
  max-width: 110px;
}

.battle-hud-action-chip small {
  display: none;
  overflow: hidden;
  max-width: 170px;
  color: rgba(183, 224, 232, 0.78);
  font: 700 8px/1 "Courier New", monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-hud-action-chip[data-state="active"] {
  color: #ffe08a;
  border-color: rgba(255, 211, 106, 0.82);
  box-shadow: none;
}

.battle-hud-action-chip[data-state="disabled"] {
  color: #6f91a0;
  border-color: rgba(111, 145, 160, 0.34);
  filter: saturate(0.65);
}

.battle-hud.is-compact .battle-hud-infantry-actions {
  gap: 4px;
}

.battle-hud.is-compact .battle-hud-action-chip {
  padding: 2px 5px;
  font-size: 8px;
}

.battle-hud.is-compact .battle-hud-action-chip kbd {
  min-width: 14px;
  height: 13px;
  font-size: 8px;
}

.battle-hud.is-compact .battle-hud-action-chip small {
  max-width: 120px;
  font-size: 7px;
}

.battle-hud.is-compact .battle-hud-action-chip em {
  max-width: 58px;
}

[lang="en"] .battle-hud.is-compact .battle-hud-action-chip,
[data-lang="en"] .battle-hud.is-compact .battle-hud-action-chip {
  max-width: 105px;
}

[lang="en"] .battle-hud.is-compact .battle-hud-action-chip em,
[data-lang="en"] .battle-hud.is-compact .battle-hud-action-chip em {
  max-width: 85px;
}

.battle-hud-meter {
  position: relative;
  height: 3px;
  overflow: hidden;
  background: rgba(240, 223, 188, 0.12);
  border: 1px solid rgba(240, 223, 188, 0.18);
}

.battle-hud.is-compact .battle-hud-meter {
  height: 3px;
}

.battle-hud-meter-fill {
  display: block;
  width: 0%;
  height: 100%;
  transition: width 120ms linear;
  box-shadow: none;
}

.battle-hud-meter-hp .battle-hud-meter-fill {
  color: #d7fff2;
  background: #72d7df;
}

.battle-hud-meter-mov .battle-hud-meter-fill {
  color: #72d7df;
  background: #72d7df;
}

.battle-hud-value,
.battle-hud-ammo-value {
  color: #f5fbff;
  font: 800 10px/1 "Courier New", monospace;
  text-align: right;
  white-space: nowrap;
}

.battle-hud-weapon {
  height: 48px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 5px 8px;
}

.battle-hud.is-compact .battle-hud-weapon {
  height: 44px;
  gap: 5px;
  padding: 4px 6px;
}

.battle-hud-weapon-title {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #f0c85f;
  font: 900 10px/1 "Courier New", monospace;
  white-space: nowrap;
}

.battle-hud.is-compact .battle-hud-weapon-title {
  font-size: 11px;
}

.battle-hud-weapon-title > span:last-child {
  display: grid;
  gap: 4px;
}

.battle-hud.is-compact .battle-hud-fallback {
  display: none;
}

.battle-hud-fallback {
  color: #72d7df;
  font: 900 10px/1 "Courier New", monospace;
  font-style: normal;
  letter-spacing: 0;
  text-shadow: none;
}

.battle-hud-fallback[data-ready="1"] {
  color: #ffe08a;
  text-shadow: none;
}

.battle-hud-fallback[hidden] {
  display: none;
}

.battle-hud-crosshair,
.battle-hud-support-icon {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 0;
}

.battle-hud-crosshair::before,
.battle-hud-crosshair::after,
.battle-hud-support-icon::before,
.battle-hud-support-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.battle-hud-crosshair::before,
.battle-hud-support-icon::before {
  left: 50%;
  top: -5px;
  width: 2px;
  height: 34px;
  transform: translateX(-50%);
}

.battle-hud-crosshair::after,
.battle-hud-support-icon::after {
  top: 50%;
  left: -5px;
  width: 34px;
  height: 2px;
  transform: translateY(-50%);
}

.battle-hud-crosshair::before,
.battle-hud-crosshair::after,
.battle-hud-support-icon::before,
.battle-hud-support-icon::after {
  display: none;
}

.battle-hud-ammo-cells {
  display: grid;
  grid-template-columns: repeat(var(--battle-hud-ammo-columns, 12), 4px);
  gap: 2px;
  align-items: end;
  min-width: 0;
}

.battle-hud.is-compact .battle-hud-ammo-cells {
  grid-template-columns: repeat(var(--battle-hud-ammo-columns, 12), 3px);
  gap: 2px;
}

.battle-hud-ammo-cell {
  position: relative;
  width: 4px;
  height: 10px;
  opacity: 0.34;
  filter: saturate(0.72);
  transition: opacity 120ms linear, filter 120ms linear;
}

.battle-hud.is-compact .battle-hud-ammo-cell {
  width: 3px;
  height: 10px;
}

.battle-hud-ammo-cell::before {
  content: "";
  position: absolute;
  inset: 3px 2px 2px;
  background: linear-gradient(180deg, #ffd47a 0 18%, #d58b3b 18% 82%, #7c5528 82% 100%);
  box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.28) inset;
}

.battle-hud-ammo-cell.is-active {
  opacity: 1;
  filter: saturate(1.22);
}

.battle-hud-ammo-cell.is-active::before {
  box-shadow: 0 0 0 1px rgba(255, 220, 150, 0.64) inset;
}

.battle-hud-support {
  width: 100%;
  min-width: 0;
  height: 48px;
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 5px;
  align-items: center;
  justify-items: center;
  padding: 5px 6px;
  color: #72d7df;
  font: 900 11px/1.3 "Courier New", monospace;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  border-left-color: rgba(114, 215, 223, 0.44);
}

.battle-hud.is-compact .battle-hud-support {
  width: 100%;
  min-width: 0;
  height: 44px;
  grid-template-columns: 10px 1fr;
  gap: 4px;
  padding: 4px 5px;
  font-size: 9px;
}

.battle-hud.is-compact .battle-hud-support-icon,
.battle-hud.is-compact .battle-hud-crosshair {
  width: 10px;
  height: 10px;
}

.battle-hud.is-compact .battle-hud-support-icon::before,
.battle-hud.is-compact .battle-hud-crosshair::before {
  top: -4px;
  height: 26px;
}

.battle-hud.is-compact .battle-hud-support-icon::after,
.battle-hud.is-compact .battle-hud-crosshair::after {
  left: -4px;
  width: 26px;
}

.battle-hud-support span:last-child {
  display: grid;
  gap: 4px;
}

.battle-hud-support strong {
  max-width: 100%;
  overflow: hidden;
  font: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-hud-support em {
  max-width: 100%;
  overflow: hidden;
  color: #8ff7ff;
  font: 800 8.5px/1 "Courier New", monospace;
  font-style: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-hud-support:hover,
.battle-hud-support:focus-visible {
  color: #c9fbff;
  background: rgba(114, 215, 223, 0.08);
  outline: none;
  box-shadow: none;
}

.battle-hud[aria-hidden="true"] .battle-hud-support {
  pointer-events: none;
}

.battle-support-dock {
  position: absolute;
  right: max(16px, calc((100% - 720px) / 2 + 10px));
  bottom: calc(112px * var(--stage-ui-scale, 1));
  z-index: 7;
  width: min(392px, calc(100% - 46px));
  display: grid;
  gap: 10px;
  padding: 12px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(var(--stage-ui-scale, 1));
  transform-origin: bottom right;
  transition: opacity 140ms ease, transform 140ms ease;
  background: linear-gradient(180deg, rgba(11, 13, 12, 0.9), rgba(5, 7, 7, 0.72));
  border: 0;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
}

.battle-support-dock.is-visible {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(var(--stage-ui-scale, 1));
}

.battle-support-dock-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  min-width: 0;
}

.battle-support-dock-head strong {
  color: #fff1c8;
  font-size: 14px;
  white-space: nowrap;
}

.battle-support-dock-head span {
  overflow: hidden;
  color: rgba(240, 223, 188, 0.62);
  font: 800 10px/1.2 "Courier New", monospace;
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-support-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.battle-support-option {
  min-height: 42px;
  padding: 8px 7px;
  color: var(--support-color, #72d7df);
  font: 900 12px/1 "Courier New", monospace;
  text-align: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--support-color, #72d7df) 36%, transparent);
  box-shadow: none;
}

.battle-support-option small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: rgba(240, 223, 188, 0.64);
  font: 800 9px/1 "Courier New", monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.battle-support-option.is-active {
  color: #fff0c6;
  background: rgba(240, 200, 95, 0.08);
  border-color: rgba(255, 210, 122, 0.82);
  box-shadow: none;
}

.battle-support-option:hover,
.battle-support-option:focus-visible,
.battle-support-cancel:hover,
.battle-support-cancel:focus-visible {
  color: #fff1c8;
  background: rgba(114, 215, 223, 0.08);
  outline: none;
}

.battle-support-cancel {
  min-height: 32px;
  color: #ffd7ca;
  font: 900 11px/1 "Courier New", monospace;
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(240, 223, 188, 0.18);
  text-align: left;
}

.battle-support-cancel[hidden] {
  display: none;
}

.side-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.app-shell[data-mode="menu"] {
  grid-template-rows: auto 1fr;
}

.app-shell[data-mode="menu"] .play-layout {
  grid-template-columns: 1fr;
  min-height: calc(100vh - 86px);
}

.app-shell[data-mode="menu"] .side-panel,
.app-shell[data-mode="menu"] .log-bar {
  display: none;
}

.app-shell[data-mode="strategy"] .panel-room,
.app-shell[data-mode="strategy"] .panel-comms,
.app-shell[data-mode="reward"] .panel-room,
.app-shell[data-mode="reward"] .panel-comms {
  display: none;
}

.app-shell[data-mode="lobby"] .side-panel,
.app-shell[data-mode="lobby"] .log-bar {
  display: none;
}

.app-shell[data-mode="lobby"] .stage-panel {
  width: min(960px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  border-color: rgba(95, 208, 170, 0.62);
}

.app-shell[data-mode="lobby"] .play-layout {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-shell[data-mode="battle"],
.app-shell[data-mode="support"],
.app-shell[data-mode="reward"],
.app-shell[data-mode="tutorial"] {
  grid-template-rows: auto 1fr;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.app-shell[data-mode="battle"] .play-layout,
.app-shell[data-mode="support"] .play-layout,
.app-shell[data-mode="reward"] .play-layout,
.app-shell[data-mode="tutorial"] .play-layout {
  grid-template-columns: 1fr;
  padding: 10px 12px;
  min-height: 0;
  height: 100%;
  align-items: start;
  justify-items: center;
  overflow: hidden;
}

.app-shell[data-mode="battle"] .top-bar,
.app-shell[data-mode="support"] .top-bar,
.app-shell[data-mode="reward"] .top-bar,
.app-shell[data-mode="tutorial"] .top-bar {
  padding: 8px 16px;
}

.app-shell[data-mode="battle"] h1,
.app-shell[data-mode="support"] h1,
.app-shell[data-mode="reward"] h1,
.app-shell[data-mode="tutorial"] h1 {
  font-size: 23px;
}

.app-shell[data-mode="battle"] #seasonLine,
.app-shell[data-mode="support"] #seasonLine,
.app-shell[data-mode="reward"] #seasonLine,
.app-shell[data-mode="tutorial"] #seasonLine {
  font-size: 12px;
}

.app-shell[data-mode="battle"] .side-panel,
.app-shell[data-mode="support"] .side-panel,
.app-shell[data-mode="tutorial"] .side-panel {
  display: none;
}

.app-shell[data-dev="1"][data-mode="battle"] .side-panel {
  display: block;
  position: fixed;
  right: 8px;
  top: 80px;
  width: 104px;
  z-index: 8;
  pointer-events: none;
}

.app-shell[data-dev="1"][data-mode="battle"] .panel-room,
.app-shell[data-dev="1"][data-mode="battle"] .panel-objective,
.app-shell[data-dev="1"][data-mode="battle"] .panel-comms,
.app-shell[data-dev="1"][data-mode="battle"] .panel-actions > h2,
.app-shell[data-dev="1"][data-mode="battle"] #actionPanel > button {
  display: none;
}

.app-shell[data-dev="1"][data-mode="battle"] .panel-actions,
.app-shell[data-dev="1"][data-mode="battle"] #actionPanel {
  padding: 0;
  border: 0;
  background: transparent;
}

.app-shell[data-dev="1"][data-mode="battle"] .dev-tools {
  pointer-events: auto;
  padding: 6px;
  border: 1px solid rgba(201, 149, 72, 0.48);
  border-radius: 6px;
  background: rgba(13, 13, 10, 0.74);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.app-shell[data-dev="1"][data-mode="battle"] .dev-tools summary {
  font-size: 10px;
}

.app-shell[data-mode="battle"] .stage-panel,
.app-shell[data-mode="support"] .stage-panel,
.app-shell[data-mode="reward"] .stage-panel,
.app-shell[data-mode="tutorial"] .stage-panel {
  width: min(calc(100vw - 24px), calc((100vh - 92px) * 1.6667));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 92px);
  border-color: rgba(95, 208, 170, 0.42);
}

.app-shell[data-mode="battle"] .log-bar,
.app-shell[data-mode="support"] .log-bar,
.app-shell[data-mode="reward"] .log-bar,
.app-shell[data-mode="tutorial"] .log-bar {
  display: none;
}

.app-shell[data-mode="reward"] .play-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  justify-items: stretch;
}

.app-shell[data-mode="reward"] .stage-panel {
  width: min(100%, calc((100vh - 92px) * 1.6667));
  justify-self: center;
}

.app-shell[data-mode="reward"] .side-panel {
  display: grid;
  max-height: calc(100vh - 92px);
  overflow: hidden;
}

@media (max-width: 760px) {
  .app-shell[data-mode="reward"] {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .app-shell[data-mode="reward"] .top-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .app-shell[data-mode="reward"] .top-stats {
    justify-content: flex-start;
    width: 100%;
  }

  .app-shell[data-mode="reward"] .play-layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }

  .app-shell[data-mode="reward"] .stage-panel {
    width: 100%;
    max-height: none;
  }

  .app-shell[data-mode="reward"] .side-panel {
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .battle-hud {
    bottom: var(--battle-hud-bottom, calc(9px * var(--stage-ui-scale, 1)));
  }

  .battle-support-dock {
    right: 0;
    bottom: calc(205px * var(--stage-ui-scale, 1));
    width: 100%;
  }

  .battle-support-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell[data-mode="battle"] .overlay-hint {
    bottom: calc(188px * var(--stage-ui-scale, 1));
  }
}

.panel-block {
  border: 1px solid rgba(108, 86, 53, 0.72);
  border-radius: var(--panel-radius);
  padding: 14px;
  background: linear-gradient(180deg, rgba(49, 40, 29, 0.92), rgba(28, 23, 17, 0.92));
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.join-room-input {
  grid-column: span 2;
  text-transform: uppercase;
}

.display-name-input {
  grid-column: span 2;
}

.wide-action {
  grid-column: 1 / -1;
}

.profile-error {
  margin: 0;
  color: #ffd3ce;
  font-size: 12px;
  font-weight: 800;
}

.seat-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.seat-roster-hint {
  border: 1px solid color-mix(in srgb, var(--seat-team-color, var(--jade)) 55%, transparent);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--seat-team-color, #d7fff2);
  background:
    linear-gradient(90deg, var(--seat-team-soft, rgba(5, 26, 31, 0.42)), transparent),
    rgba(0, 0, 0, 0.22);
  font-size: 12px;
  font-weight: 800;
}

.seat-row,
.status-row,
.event-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(173, 152, 112, 0.24);
  border-radius: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.16);
  font-size: 12px;
}

.seat-card-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(42px, auto);
  gap: 10px;
  min-height: 56px;
  overflow: hidden;
  background:
    linear-gradient(90deg, var(--seat-team-soft, rgba(0, 210, 255, 0.08)), transparent 58%),
    rgba(0, 0, 0, 0.22);
  border-color: color-mix(in srgb, var(--seat-team-border, rgba(95, 208, 170, 0.45)) 72%, transparent);
  padding: 9px 10px 9px 12px;
}

.seat-card-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--seat-team-color, var(--jade));
  opacity: 0.8;
}

.seat-card-row[data-selected="1"] {
  border-color: color-mix(in srgb, var(--seat-team-color, #d7fff2) 84%, white);
  box-shadow:
    inset 0 0 18px color-mix(in srgb, var(--seat-team-color, var(--jade)) 18%, transparent),
    0 0 14px color-mix(in srgb, var(--seat-team-color, var(--jade)) 12%, transparent);
}

.seat-card-unit-code {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  align-self: center;
  border: 1px solid color-mix(in srgb, var(--seat-team-color, var(--jade)) 72%, white);
  border-radius: 6px;
  color: var(--seat-team-color, var(--jade));
  background: rgba(0, 0, 0, 0.24);
  font-weight: 900;
}

.seat-card-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.seat-card-name,
.seat-card-role {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.seat-card-role {
  color: var(--seat-team-text, #d7fff2);
  font-weight: 800;
}

.seat-card-name {
  color: var(--sand);
  font-size: 11px;
  font-weight: 700;
  opacity: 0.86;
}

.seat-card-state {
  align-self: center;
  justify-self: end;
  min-width: 38px;
  border: 1px solid color-mix(in srgb, var(--seat-team-border, rgba(95, 208, 170, 0.45)) 70%, transparent);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--seat-team-text, #f8e7c4);
  background: rgba(0, 0, 0, 0.24);
  font-size: 10px;
  text-align: center;
}

.status-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--jade);
  text-align: right;
}

.status-row[data-side="red"] {
  border-color: rgba(224, 92, 79, 0.65);
  background: rgba(94, 28, 22, 0.28);
}

.status-row[data-side="red"] strong {
  color: #ffd3ce;
}

.status-row[data-side="black"] {
  border-color: rgba(213, 196, 162, 0.55);
  background: rgba(14, 14, 13, 0.34);
}

.status-row[data-side="black"] strong {
  color: #f0dfbc;
}

.status-row[data-tone="warning"] {
  border-color: rgba(255, 210, 122, 0.58);
  background: rgba(110, 76, 14, 0.26);
}

.status-row[data-tone="warning"] strong {
  color: #ffd27a;
}

.status-row[data-tone="danger"] {
  border-color: rgba(224, 92, 79, 0.65);
  background: rgba(94, 28, 22, 0.28);
}

.status-row[data-tone="danger"] strong {
  color: #ffd3ce;
}

.status-row[data-tone="support"] {
  border-color: rgba(95, 208, 170, 0.35);
}

.log-bar {
  min-height: 84px;
  border-top: 1px solid rgba(108, 86, 53, 0.85);
  padding: 9px 14px;
}

.event-log {
  display: grid;
  gap: 5px;
  max-height: 72px;
  overflow: hidden;
  color: #d9c7a4;
  font-size: 12px;
}

.event-row {
  justify-content: flex-start;
}

.event-row[data-tone="danger"] {
  border-color: rgba(224, 92, 79, 0.6);
  color: #ffd3ce;
}

.event-row[data-tone="support"] {
  border-color: rgba(95, 208, 170, 0.55);
  color: #d7fff2;
}

@media (max-width: 1000px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .menu-frame {
    grid-template-columns: 1fr;
  }

  .main-menu {
    padding: 20px;
  }

  .menu-copy h2 {
    font-size: 38px;
  }
}

.docs60-static-qa-badge {
  position: fixed;
  z-index: 100000;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  padding: 7px 12px;
  border: 1px solid rgba(244, 177, 59, 0.9);
  border-radius: 3px;
  background: rgba(12, 15, 17, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  color: #f4b13b;
  font: 700 11px/1.35 var(--font-ui, system-ui, sans-serif);
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}
