:root {
  color-scheme: dark;
  --bg: #17191a;
  --panel: #222427;
  --raised: #292b2e;
  --line: #434446;
  --paper: #f2eee1;
  --muted: #b5b3a9;
  --soft: #8c8d87;
  --gold: #e8b966;
  --violet: #bc9ae2;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --display: "Barlow Condensed", "Arial Narrow", Impact, Haettenschweiler, sans-serif;
  --sans: "DM Sans", "Segoe UI", Arial, sans-serif;
  --map-header-height: 58px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0; min-height: 100vh; background-color: var(--bg); color: var(--paper);
  background-image: radial-gradient(ellipse at 67% -35%, #5b50322b, transparent 65%),
    repeating-linear-gradient(103deg, transparent 0 3px, #f0d0a603 3px 4px);
  font: 15px/1.45 var(--sans);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, a { touch-action: manipulation; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.skip { position: fixed; z-index: 50; top: -120px; left: 16px; padding: 12px; background: var(--paper); color: var(--bg); }
.skip:focus { top: 12px; }
.masthead { border-bottom: 1px solid #3e403e; background: #191a1aec; }
.mast-inner, .shell { max-width: 1544px; margin: auto; padding-inline: clamp(18px, 4vw, 72px); }
.mast-inner { min-height: 76px; display: flex; align-items: center; gap: clamp(20px,4vw,75px); }
.brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; color: var(--paper); font-family: var(--display); font-size: 35px; font-weight: 900; letter-spacing: -1.8px; line-height: 1; }
.brand-point { color: var(--gold); }
.brand-mark { width: 31px; height: 26px; position: relative; margin-right: 11px; transform: skew(-11deg); overflow: hidden; }
.brand-mark i { position: absolute; left: 4px; height: 7px; background: var(--gold); transform: skew(-23deg); width: 22px; }
.brand-mark i:nth-child(1) { top: 2px; width: 25px; }
.brand-mark i:nth-child(2) { top: 11px; width: 18px; }
.brand-mark i:nth-child(3) { top: 20px; width: 11px; }
.main-nav { display: flex; align-self: stretch; gap: 18px; }
.main-nav button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 3px 4px 0; font-weight: 600; }
.main-nav button[aria-current="page"] { border-color: var(--gold); color: var(--paper); }
.main-nav button:hover, .text-button:hover { color: var(--gold); }
.user-nav { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-label, .eyebrow, .mini-label, .preview-caption, .count-tag, .tag, .clock, .stat-label {
  font-family: var(--mono); font-size: 10px; line-height: 1.4; font-weight: 600; letter-spacing: .075em;
}
.header-label { color: var(--muted); }
.avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; color: var(--owner, var(--gold)); background: color-mix(in srgb, var(--owner, var(--gold)) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--owner, var(--gold)) 42%, var(--line)); font-weight: 700; }
.identity-name { font-size: 13px; font-weight: 650; }
.text-button { border: 0; background: none; color: var(--muted); padding: 6px 3px; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.shell { padding-bottom: 38px; outline: none; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: clamp(24px,4vh,46px) 0 22px; }
.eyebrow, .mini-label { color: var(--gold); display: inline-flex; align-items: center; gap: 9px; letter-spacing: .12em; }
.eyebrow { margin-bottom: 6px; }
.eyebrow i { width: 6px; height: 6px; display: inline-block; background: var(--gold); transform: rotate(45deg); }
h1 { font: 800 clamp(40px,4.15vw,66px)/1.02 var(--display); letter-spacing: -.035em; }
h1 span { color: var(--gold); }
h2 { font: 750 clamp(28px,2.45vw,42px)/1.08 var(--display); letter-spacing: -.025em; }
h3 { font-size: 17px; line-height: 1.22; }
.wallet { display: flex; border-left: 1px solid var(--line); align-items: center; gap: clamp(15px,2.5vw,38px); padding: 4px 0 4px 19px; }
.wallet-item { display: grid; gap: 1px; }
.wallet-item b { font: 700 21px/1.2 var(--mono); color: var(--paper); }
.wallet-item small, .stat-label { font: 600 10px/1.35 var(--mono); color: var(--muted); letter-spacing: .035em; text-transform: uppercase; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; border: 1px solid #69664b; background: #333226; color: #f3e4ad; padding: 10px 14px; }
.notice[data-level="error"] { background: #392d29; border-color: #906e5b; color: #f7d6bf; }
.notice button { padding: 3px 6px; color: inherit; background: none; border: 0; text-decoration: underline; }
.loading { margin-top: 54px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.loading i { width: 10px; height: 10px; background: var(--gold); transform: rotate(45deg); }
.login-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(296px, 31%); gap: 18px; align-items: start; }
.preview-map { position: relative; isolation: isolate; overflow: hidden; min-height: clamp(420px, 57vh, 650px); border: 1px solid #635e50; align-self: stretch; background: #254748 url("/assets/terreno-territorial.png") center / cover no-repeat; }
.preview-map::before { content: ""; position: absolute; z-index: 0; inset: 0; pointer-events: none; background: linear-gradient(180deg, #11161429, transparent 26%, transparent 62%, #0c11168a); }
.map-frame { pointer-events: none; position: absolute; z-index: 1; inset: 12px; border: 1px solid #eee5c554; clip-path: polygon(0 0, 24px 0, 24px 2px, 2px 2px, 2px 24px, 0 24px, 0 0, 100% 0, 100% 24px, calc(100% - 2px) 24px, calc(100% - 2px) 2px, calc(100% - 24px) 2px, calc(100% - 24px) 0, 100% 0, 100% 100%, calc(100% - 24px) 100%, calc(100% - 24px) calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) calc(100% - 24px), 100% calc(100% - 24px), 100% 100%, 0 100%, 0 calc(100% - 24px), 2px calc(100% - 24px), 2px calc(100% - 2px), 24px calc(100% - 2px), 24px 100%, 0 100%); }
.cartography { position: absolute; right: 21px; top: 20px; color: #fff7da; font: 700 10px/1 var(--mono); text-shadow: 0 1px 3px #171a1bea; display: grid; justify-items: center; gap: 3px; pointer-events: none; z-index: 2; }
.cartography i { width: 10px; height: 22px; background: linear-gradient(90deg,#f6ead2 50%,#66675e 50%); clip-path: polygon(50% 0,100% 100%,50% 76%,0 100%); }
.preview-caption { position: absolute; bottom: 24px; left: 25px; display: flex; align-items: center; gap: 10px; letter-spacing: .15em; color: #fff3d5; text-shadow: 0 1px 4px #131514; }
.caption-rule, .line { display: inline-block; width: 27px; height: 2px; background: currentColor; }
.line { width: 18px; }
.login-card, .territory-card, .panel, .report-card { background: var(--panel); border: 1px solid var(--line); }
.login-card { padding: clamp(23px, 3.1vw, 47px); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin: 15px 0 21px; }
.login-card form { display: grid; gap: 8px; }
label { color: var(--paper); font-size: 13px; font-weight: 600; }
input:not([type="checkbox"]):not([type="range"]), select { min-height: 40px; padding: 8px 10px; color: var(--paper); background: #191b1d; border: 1px solid #565855; border-radius: 2px; }
input::placeholder { color: #94958f; }
.login-card form > label:not(:first-child) { margin-top: 7px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 40px; padding: 9px 15px; border-radius: 2px; font-size: 13px; font-weight: 750; }
.primary { background: var(--gold); color: #211f19; border: 1px solid var(--gold); }
.primary:not(:disabled):hover { background: #f3cd87; }
.secondary { background: #2c2e2e; color: var(--paper); border: 1px solid #5e605a; }
.secondary:not(:disabled):hover, .chip:hover { border-color: var(--gold); }
.wide { width: 100%; }
.login-card .primary { margin-top: 13px; justify-content: space-between; }
.quick-login { border-top: 1px solid var(--line); margin-top: 25px; padding-top: 17px; }
.quick-login p { color: var(--muted); font-size: 13px; margin-bottom: 9px; }
.quick-login > div, .owner-line, .button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #535552; border-radius: 15px; background: transparent; color: var(--paper); padding: 4px 12px; min-height: 30px; font-size: 13px; }
.swatch { width: 8px; height: 8px; background: var(--owner, var(--soft)); display: inline-block; flex: none; transform: rotate(45deg); }
.violet { --owner: var(--violet); } .gold { --owner: var(--gold); }
.masthead:has(.main-nav:not([hidden])) { position: sticky; z-index: 9; top: 0; background: #222; border-color: #51514a; }
.masthead:has(.main-nav:not([hidden])) .mast-inner {
  max-width: none; min-height: var(--map-header-height); padding-inline: clamp(15px, 2vw, 32px); gap: clamp(16px, 3.5vw, 59px);
}
.masthead:has(.main-nav:not([hidden])) .brand {
  font-family: "Archivo Black", var(--sans); font-size: clamp(25px, 2.55vw, 43px); font-weight: 900; letter-spacing: -.025em;
}
.masthead:has(.main-nav:not([hidden])) :is(.brand-mark, .brand-point) { display: none; }
.main-nav { position: relative; gap: clamp(12px, 2.55vw, 43px); }
.main-nav::before { content: ""; position: absolute; inset: 23% auto 23% 0; border-left: 1px solid #787870; }
.main-nav button { margin-block: 0 4px; padding-inline: clamp(8px, 1.15vw, 19px); border-bottom-width: 3px; font-size: clamp(14px, 1.46vw, 24px); }
.main-nav button:first-child { margin-left: clamp(13px, 2.5vw, 42px); }
.main-nav button[aria-current="page"] { border-color: var(--paper); font-weight: 750; }
.user-nav .map-cash {
  display: inline-flex; align-items: baseline; gap: .55em; border-inline-start: 1px solid #787870;
  padding-inline-start: clamp(10px, 1.5vw, 25px); white-space: nowrap; font-size: clamp(13px, 1.5vw, 25px);
}
.shell:has(#game-screen:not([hidden]) #map-page:not([hidden])) { position: relative; max-width: none; padding: 0; }
#game-screen:has(#map-page:not([hidden])) > .page-title {
  position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.shell:has(#game-screen:not([hidden]) #map-page:not([hidden])) > .notice {
  position: absolute; z-index: 8; inset: 12px auto auto 50%; width: max-content; max-width: calc(100% - 28px);
  margin: 0; transform: translateX(-50%); border-radius: 6px; box-shadow: 0 6px 20px #0006;
}
.map-layout { position: relative; isolation: isolate; }
.map-panel { min-width: 0; }
.map-art {
  position: relative; isolation: isolate; overflow: hidden; width: 100%; aspect-ratio: 1672 / 941;
  max-height: calc(100dvh - var(--map-header-height) - 1px); background: #17393c;
}
.map-viewport { position: absolute; inset: 0; overflow: auto; scrollbar-width: none; }
.map-viewport:focus-visible { outline: 2px solid var(--paper); outline-offset: -3px; }
.map-scene {
  position: relative; isolation: isolate; width: var(--map-zoom, 100%); aspect-ratio: 1672 / 941;
  background: #254748 url("/assets/terreno-territorial.png") 0 0 / 100% 100% no-repeat;
}
#map-canvas, .map-zones, .map-pins { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-area {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  clip-path: var(--territory-shape); pointer-events: auto; background: transparent;
}
.map-area:hover { background: #fff9e319; }
.map-area:focus-visible { background: #fff9e352; outline: 0; }
.map-label {
  position: absolute; top: var(--y); left: var(--x); transform: translate(-50%, -50%); display: grid;
  justify-items: center; gap: 4px; width: max-content; max-width: 39%; text-align: center; color: #fff9ed;
  font-family: var(--sans); line-height: 1.1; text-shadow: 0 1px 2px #1d1b16, 0 2px 10px #0f1710dc;
}
.map-label strong { font-size: clamp(14px, 2.18vw, 39px); font-weight: 900; letter-spacing: -.02em; }
.label-owner { font-size: clamp(11px, 1.3vw, 23px); font-weight: 550; }
.label-status {
  color: #fcf1d5; background: #242722f0; border: 1px solid #ede0bf; border-radius: 30px;
  padding: .15em .65em .22em; font: 750 clamp(10px, 1.25vw, 22px)/1.1 var(--sans); white-space: nowrap;
}
.label-status .clock, .territory-status .clock { color: inherit; font: inherit; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.map-controls { position: absolute; top: clamp(10px, 1.5vw, 25px); left: clamp(10px, 1.5vw, 25px); z-index: 2; display: grid; gap: 7px; }
.map-controls button {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: #f9eed5;
  border: 1px solid #e9dbbfbf; border-radius: 8px; background: #262825f5; font: 550 25px/1 var(--sans);
}
.map-controls button:not(:disabled):hover { background: #4b4940; }
.map-art > .cartography { display: none; }
.map-legend {
  position: absolute; z-index: 2; inset: auto auto clamp(11px, 1.55vw, 25px) clamp(11px, 1.55vw, 25px); display: grid;
  gap: 7px; max-width: min(260px, 36%); padding: 10px 11px; color: #fff9ed; background: #222627f2;
  border: 1px solid #f4e8cc66; border-radius: 11px; box-shadow: 0 4px 14px #1117;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: clamp(11px, 1.05vw, 18px); line-height: 1.16; }
.legend-item b { font-weight: 500; }
.legend-item .swatch { width: 1.5em; height: 1.18em; transform: none; border-radius: 4px; }
.map-index { position: absolute; z-index: 4; inset: auto auto 12px 12px; display: flex; flex-wrap: wrap; gap: 4px; }
.map-index:not(:focus-within, [data-has-unmapped="true"]) {
  width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.index-entry {
  display: flex; align-items: center; gap: 8px; border: 1px solid #f4e8cc66; border-radius: 6px;
  padding: 7px 10px; color: var(--paper); background: #252827; text-align: left;
}
.index-entry strong, .index-entry small { display: block; }
.index-entry small { color: var(--muted); }
.index-entry[aria-pressed="true"] { border-color: var(--owner); }
.territory-card {
  position: absolute; z-index: 3; inset: auto clamp(14px, 1.15vw, 24px) clamp(15px, 3.15vw, 54px) auto;
  width: clamp(255px, 22vw, 370px); max-height: calc(100% - 30px); overflow: auto; min-width: 0;
  padding: clamp(14px, 1.19vw, 20px); scroll-margin-block-start: calc(var(--map-header-height) + 8px);
  border-color: #f4e8cc5e; border-radius: 15px; color: #fff9ed; background: #222626f5;
  box-shadow: 0 7px 18px #14201b59;
}
.territory-head .mini-label { display: none; }
.territory-head h2 { margin: 0 0 6px; font: 850 clamp(22px, 2.07vw, 35px)/1.09 var(--sans); letter-spacing: -.03em; }
.territory-meta {
  display: grid; justify-content: start; grid-template-columns: auto 1fr; gap: 5px .4em; margin: 0;
  font-size: clamp(14px, 1.32vw, 23px); line-height: 1.32;
}
.territory-meta dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.territory-meta dd { margin: 0; }
.territory-group:not(:has(.swatch)), .territory-group .swatch { display: none; }
.territory-group dd::before { content: "· "; }
.territory-status { grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.territory-toggle {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: .45em; margin-top: clamp(12px, 1.1vw, 19px);
  min-height: 43px; border: 1px solid #f8edd4; border-radius: 8px; background: #f5ead3; padding: 8px 12px;
  color: #202424; font: 800 clamp(14px, 1.45vw, 24px)/1.18 var(--sans); text-align: center;
}
.territory-toggle:not(:disabled):hover { background: #fff4da; border-color: #fff4da; }
.territory-card[data-expanded="true"] #territory-details { margin-top: 14px; border-top: 1px solid #f4e8cc31; }
.owner-line { gap: 7px; color: var(--muted); font-size: 13px; }
.owner-line strong { color: var(--paper); }
.territory-body { padding-block-start: 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.stat { display: grid; gap: 3px; }
.stat strong { color: var(--paper); font: 700 16px/1.25 var(--mono); }
.control-block { margin-top: 14px; }
.control-block p, .help, .empty { color: var(--muted); font-size: 13px; }
.control-block h3 { margin-bottom: 5px; }
.control-block form, .control-block > .wide { margin-top: 9px; }
.slider-row { display: grid; align-items: center; grid-template-columns: 1fr 49px; gap: 10px; }
.slider-row output { font: 650 14px var(--mono); text-align: right; color: var(--gold); }
input[type="range"] { width: 100%; accent-color: var(--gold); min-height: 31px; cursor: pointer; }
.control-block .button-row { margin-top: 8px; }
.control-block .button-row > button { flex: 1 1 auto; }
.territory-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.contest { margin-bottom: 14px; border-left: 3px solid var(--gold); padding: 10px 12px; background: #373226; }
.contest strong, .contest span { display: block; }
.contest strong { font-size: 14px; } .contest span { font-size: 12px; color: var(--muted); }
.clock { font-variant-numeric: tabular-nums; color: var(--gold); }
.checklist { border: 0; margin: 8px 0 11px; padding: 0; display: grid; gap: 5px; max-height: 220px; overflow: auto; }
.checklist label { cursor: pointer; padding: 7px; border: 1px solid var(--line); display: flex; align-items: center; gap: 8px; min-height: 40px; }
input[type="checkbox"] { accent-color: var(--gold); }
.checklist small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.panel { min-width: 0; padding: clamp(15px,2vw,28px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.section-head h2, .report-card h2 { font-size: clamp(25px,2.3vw,36px); }
.count-tag, .tag { display: inline-block; color: var(--muted); border: 1px solid var(--line); padding: 3px 7px; white-space: nowrap; }
.army-layout { display: grid; grid-template-columns: minmax(0,1.24fr) minmax(280px,1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 16px; }
.unit-row, .catalog-row, .queue-row { border-top: 1px solid var(--line); padding: 13px 0; }
.unit-row:last-child, .catalog-row:last-child, .queue-row:last-child { padding-bottom: 0; }
.row-title, .catalog-row, .queue-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.unit-stats { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
.unit-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.unit-controls label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 11px; }
.unit-controls select { width: 100%; min-width: 0; font-size: 12px; }
.catalog-row > div { min-width: 0; } .catalog-row > button { flex: none; }
.catalog-row strong, .queue-row strong { display: block; font-size: 14px; }
.catalog-row small, .queue-row small { color: var(--muted); font-size: 12px; }
.report-card { padding: 19px 22px; border-left: 3px solid var(--gold); }
.report-card + .report-card { margin-top: 13px; }
.report-card h2 { margin: 5px 0; } .report-card p { margin-top: 5px; color: var(--muted); }
.report-card details { margin: 13px 0; }
.report-card summary { cursor: pointer; color: var(--gold); font-size: 13px; font-weight: 650; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12px; margin-top: 9px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 6px; } th { color: var(--muted); }
.empty { padding: 10px 0; }
.help { margin-top: 6px; }
@media (min-width: 961px) and (min-aspect-ratio: 2 / 1) {
  .map-viewport { scrollbar-width: thin; scrollbar-color: #d8c8aa85 #233d3e; }
  @supports (width: calc(100cqh * (125% / 100%))) {
    .map-viewport {
      container-type: size;
      background: #184045 url("/assets/terreno-territorial.png") right bottom / 400vw auto no-repeat;
    }
    .map-scene {
      width: calc(min(100cqw, 177.68cqh) * (var(--map-zoom, 100%) / 100%));
      mask-image: linear-gradient(to right, #000 calc(100% - 18px), transparent);
    }
  }
}
@media (max-width: 960px) {
  .map-art { max-height: none; }
  .map-index { position: relative; inset: auto; padding-inline: 10px; }
  .map-index:not(:focus-within, [data-has-unmapped="true"]) { position: absolute; padding: 0; }
  .territory-card {
    position: static; width: auto; max-height: none; margin: 12px 16px 24px; border-radius: 12px;
  }
}
@media (max-width: 900px) {
  .mast-inner { gap: 24px; }
  .login-grid { grid-template-columns: minmax(0,1fr) minmax(270px,34%); gap: 12px; }
  .unit-controls { grid-template-columns: 1fr; }
}
@media (max-width: 710px) {
  .mast-inner { min-height: 62px; display: flex; flex-wrap: wrap; column-gap: 15px; row-gap: 0; }
  .brand { font-size: 29px; } .brand-mark { transform: scale(.83) skew(-11deg); margin-right: 6px; }
  .masthead:has(.main-nav:not([hidden])) .mast-inner { padding-top: 8px; column-gap: 10px; row-gap: 0; }
  .main-nav { order: 3; width: 100%; min-height: 39px; gap: 9px; }
  .main-nav::before { display: none; }
  .main-nav button, .main-nav button:first-child { font-size: 13px; margin: 0; padding-inline: 10px; }
  .main-nav button:first-child { padding-inline-start: 4px; }
  .user-nav { gap: 7px; }
  .page-title { align-items: flex-start; gap: 12px; margin: 22px 0 14px; }
  .wallet { padding: 3px 0 3px 9px; gap: 11px; align-self: center; }
  .wallet-item small { font-size: 8px; } .wallet-item b { font-size: 15px; }
  .login-grid, .army-layout { grid-template-columns: minmax(0,1fr); }
  .preview-map { min-height: 0; aspect-ratio: 2.1; }
  .login-card { padding: 21px; }
  .login-card h2 { margin: 8px 0 13px; }
  .map-controls { inset: 7px auto auto 7px; gap: 4px; }
  .map-controls button { width: 34px; height: 34px; font-size: 21px; border-radius: 6px; }
  .map-legend { inset: auto auto 7px 7px; padding: 4px 6px; gap: 4px; border-radius: 6px; }
  .legend-item { gap: 5px; font-size: 10px; }
  .legend-item .swatch { width: 1em; height: .9em; border-radius: 2px; }
  .map-label { gap: 2px; }
  .map-label strong { font-size: clamp(10px, 2.85vw, 20px); }
  .label-owner { font-size: clamp(9px, 2vw, 14px); }
  .label-status { font-size: clamp(9px, 2vw, 14px); }
  .territory-card { margin-inline: 10px; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .unit-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .mast-inner, .shell { padding-inline: 13px; } .header-label { font-size: 8px; letter-spacing: .035em; }
  h1 { font-size: 36px; } .eyebrow { font-size: 8.5px; }
  .wallet { gap: 8px; } .wallet-item { max-width: 49px; }
  .masthead:has(.main-nav:not([hidden])) .avatar { display: none; }
  .identity-name { max-width: 87px; overflow: hidden; text-overflow: ellipsis; }
  .army-layout .unit-controls { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) { button { transition: background-color .15s, border-color .15s, color .15s; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#map-page { max-width: 1920px; margin: auto; padding: 0 clamp(14px, 2.2vw, 38px) 25px; }
.atlas-toolbar { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 22px; padding: 19px 0 17px; }
.atlas-heading h2 { font: 730 clamp(23px, 2.1vw, 37px)/1.04 var(--sans); letter-spacing: -.045em; }
.atlas-heading p { margin-top: 5px; font: 500 11px/1.3 var(--mono); color: #c3beb2; }
.atlas-tools { display: flex; gap: 7px; align-items: center; }
.atlas-tool, #atlas-query { min-height: 39px; border: 1px solid #4a4c45; border-radius: 7px; color: #e4e2d5; background: #262925; }
.atlas-tool { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 5px 12px; font-size: 13px; white-space: nowrap; }
.atlas-tool[aria-pressed="true"] { color: #f2d698; border-color: #877349; background: #332f24; }
.outline-key { display: inline-block; width: 15px; height: 12px; border: 1px dashed currentColor; border-radius: 40% 53% 35% 46%; transform: rotate(-14deg); }
.atlas-finder { position: relative; }
#atlas-query { width: clamp(190px, 21vw, 330px); padding: 7px 12px 7px 37px; font-size: 13px; }
.atlas-search-icon { position: absolute; left: 13px; top: 12px; width: 12px; height: 12px; border: 1.5px solid #b8b7a9; border-radius: 50%; }
.atlas-search-icon::after { position: absolute; content: ''; width: 7px; height: 1.5px; background: #b8b7a9; bottom: -2px; right: -5px; transform: rotate(45deg); }
.atlas-results { position: absolute; z-index: 8; top: calc(100% + 5px); right: 0; width: max(100%, 275px); max-height: 350px; overflow: auto; border: 1px solid #626056; border-radius: 8px; background: #242724; box-shadow: 0 10px 26px #0009; }
.atlas-result { display: grid; width: 100%; gap: 1px; text-align: left; border: 0; border-bottom: 1px solid #393c35; padding: 8px 12px; background: transparent; color: var(--paper); font-size: 13px; }
.atlas-result small, .atlas-results p { color: var(--muted); font-size: 11px; }
.atlas-results p { padding: 10px 12px; }
.atlas-result:hover, .atlas-result:focus-visible { background: #3c3c30; }
#map-page .map-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(270px, 23vw, 355px); gap: 14px; align-items: start; }
#map-page .map-panel { overflow: hidden; border: 1px solid #505348; border-radius: 9px; background: #222622; }
.atlas-map-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 14px; padding: 10px 13px; }
.atlas-map-foot > span { font: 500 10px var(--mono); color: #b4b6a8; }
.atlas-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.atlas-legend .legend-item { gap: 5px; font-size: 11px; }
.atlas-legend .swatch { display: inline-block; width: 11px; height: 9px; border-radius: 2px; }
#map-page .territory-card { position: static; width: 100%; max-height: calc(100dvh - 160px); min-height: 0; padding: clamp(15px, 1.35vw, 23px); margin: 0; border-radius: 9px; border-color: #505348; background: #222622; box-shadow: none; }
.atlas-region { display: flex; align-items: center; gap: 8px; font: 600 10px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #d8c696; }
.atlas-region i { width: 5px; height: 5px; transform: rotate(45deg); background: #d9bd7f; }
#map-page .territory-head h2 { margin: 8px 0 10px; font-size: clamp(24px, 2.1vw, 34px); }
#map-page .territory-meta { font-size: 13px; color: #dfdfd3; }
#map-page .territory-status { color: var(--muted); font-size: 12px; }
#map-page .territory-toggle { margin-top: 15px; min-height: 37px; padding: 7px 11px; border-radius: 6px; background: #ece0c5; font-size: 14px; justify-content: space-between; }
.atlas-local-bonus { display: grid; gap: 2px; margin-top: 14px; border-left: 2px solid #d7b668; padding: 4px 10px; background: #ad955a12; }
.atlas-local-bonus strong { font-size: 15px; color: #f3d79a; }
.atlas-local-bonus span, .atlas-unaffiliated, .member-rule { font-size: 12px; color: #c3c4b8; }
.atlas-members, .atlas-unaffiliated { margin-top: 17px; border-top: 1px solid #44483f; padding-top: 13px; }
.members-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; text-align: left; padding: 0 0 5px; color: var(--paper); }
.members-toggle small, .members-toggle strong { display: block; }
.members-toggle small { margin-bottom: 2px; font: 600 10px/1.5 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #bcbcaf; }
.members-toggle strong { font-size: 17px; }
.members-count { display: flex; align-items: center; gap: 11px; color: #d3c6a3; font: 600 12px var(--mono); }
.members-count b { font: 400 20px var(--sans); }
.member-list { max-height: min(31vh, 245px); margin-top: 4px; overflow: auto; scrollbar-color: #66695e transparent; scrollbar-width: thin; }
.member-list button { display: grid; grid-template-columns: 8px 1fr auto; gap: 7px; align-items: center; min-height: 32px; width: 100%; padding: 5px 6px; color: var(--paper); background: transparent; border: 0; border-bottom: 1px solid #373b35; text-align: left; font-size: 12px; }
.member-list button:hover, .member-list button[aria-pressed="true"] { background: #393c34; }
.member-list i { width: 6px; height: 6px; border-radius: 50%; background: var(--owner); }
.member-list small { color: #b5b8aa; font-size: 10px; }
.member-rule { margin: 9px 0 1px; font-size: 11px; }
@media (max-width: 820px) {
  #map-page .map-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #map-page .territory-card { max-height: none; }
}
@media (max-width: 620px) {
  #map-page { padding: 0 9px 18px; }
  .atlas-toolbar { display: grid; gap: 9px; padding: 12px 0 10px; }
  .atlas-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .atlas-heading h2 { font-size: 22px; }
  .atlas-heading p { font-size: 9px; }
  .atlas-tools { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 4px; }
  #atlas-query { width: 100%; font-size: 12px; padding-left: 27px; }
  .atlas-search-icon { left: 8px; }
  .atlas-tool { padding-inline: 7px; gap: 4px; font-size: 11px; }
  .atlas-results { right: auto; left: 0; width: min(310px, calc(100vw - 24px)); }
  .atlas-map-foot { padding: 7px 9px; }
  .atlas-legend { gap: 5px 9px; }
  .atlas-map-foot > span { font-size: 9px; }
}
