:root {
  color-scheme: dark;
  --bg: #07090d;
  --surface: #0d1117;
  --surface-2: #121821;
  --line: #27303a;
  --line-soft: #1b222b;
  --text: #f2f0e8;
  --muted: #9d9a8f;
  --red: #df3539;
  --red-dark: #7b1f25;
  --gold: #e5c46b;
  --green: #77d9a4;
  --danger: #ff6565;
  --shadow: 0 20px 55px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% -20%, rgba(139, 37, 42, .14), transparent 32rem),
    radial-gradient(circle at 88% 10%, rgba(229, 196, 107, .06), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 9px max(18px, env(safe-area-inset-left)) 9px max(18px, env(safe-area-inset-right));
  border-bottom: 1px solid rgba(223, 53, 57, .55);
  background: rgba(7, 9, 13, .92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: .14em;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(223, 53, 57, .7);
  background: linear-gradient(145deg, #ec4145, #8e171e);
  box-shadow: 0 0 22px rgba(223, 53, 57, .17);
  font-weight: 900;
}

.brand strong { display: block; font-size: 13px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; letter-spacing: .2em; }
.header-tool { color: var(--gold); font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }

.page-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 26px clamp(14px, 3vw, 44px) calc(42px + env(safe-area-inset-bottom));
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow { margin: 0 0 7px; color: var(--red); font: 800 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .22em; }
h1 { margin: 0; font-size: clamp(29px, 4vw, 48px); font-weight: 650; line-height: 1; letter-spacing: .12em; text-transform: uppercase; }
.page-heading p:last-child { max-width: 720px; margin: 11px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.view-badge {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid rgba(119, 217, 164, .28);
  background: rgba(119, 217, 164, .07);
  color: var(--green);
  font-size: 12px;
}

.view-badge span { display: block; margin-bottom: 4px; }
.text-button { padding: 0; border: 0; background: none; color: #fff; cursor: pointer; font-size: 12px; text-decoration: underline; }

.control-panel {
  display: grid;
  grid-template-columns: minmax(170px, 1.05fr) 105px minmax(190px, .9fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 24, 33, .8), rgba(11, 15, 21, .86));
  box-shadow: var(--shadow);
}

.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: #b9b5a8; font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .17em; text-transform: uppercase; }

input, select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid #303944;
  border-radius: 0;
  outline: none;
  background: #080b10;
  color: var(--text);
  padding: 0 12px;
}

input::placeholder { color: #5f646b; }
input:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(223, 53, 57, .1); }
input[readonly] { color: #c3c0b6; background: #0b0e13; }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, #a9a598 50%), linear-gradient(135deg, #a9a598 50%, transparent 50%); background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; padding-right: 32px; }
select:disabled { color: #c3c0b6; cursor: default; opacity: .78; }

.button, .icon-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}

.button:active, .icon-button:active { transform: translateY(1px); }
.button:focus-visible, .icon-button:focus-visible, .zoom-controls button:focus-visible, .mini-icon:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.button-primary { padding: 0 22px; background: var(--red); color: #fff; }
.button-primary:hover { background: #f04448; }
.button-primary.is-placing { border-color: #ff8d8f; background: #5d191d; }
.button-secondary { padding: 0 15px; border-color: #303944; background: #11161d; color: var(--text); }
.button-secondary:hover { border-color: #596675; }
.button-accent { padding: 0 16px; background: #c6232a; color: #fff; }
.button-accent:hover { background: #df3539; }
.button-flag { padding: 0 20px; border-color: rgba(229, 196, 107, .5); background: rgba(229, 196, 107, .1); color: #f3d77e; }
.button-flag:hover { border-color: var(--gold); background: rgba(229, 196, 107, .17); }
.button-flag.is-placing { border-color: #fff0b7; background: #665220; color: #fff8dc; }
.button-zone { padding: 0 18px; border-color: rgba(77, 213, 231, .42); background: rgba(77, 213, 231, .08); color: #8eeaf5; }
.button-zone:hover { border-color: #4dd5e7; background: rgba(77, 213, 231, .14); }
.button-zone.is-placing { border-color: #c6f8ff; background: #18505a; color: #effdff; }
.button-erase { padding: 0 18px; border-color: rgba(255, 101, 101, .28); background: rgba(255, 101, 101, .055); color: #df9a9a; }
.button-erase:hover { border-color: rgba(255, 101, 101, .62); color: #ffb2b2; }
.button-erase.is-placing { border-color: #ffc1c1; background: #68282b; color: #fff2f2; }
.button-danger { padding: 0 14px; border-color: rgba(255, 101, 101, .35); background: rgba(255, 101, 101, .09); color: #ff8585; }
.control-actions { display: flex; gap: 8px; }
.icon-button { width: 44px; flex: 0 0 44px; border-color: #303944; background: transparent; color: var(--muted); font-size: 20px; }

.flag-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) 150px auto minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.flag-tools p { align-self: center; margin: 14px 0 0; color: #8f8b7f; font: 600 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.alliance-actions { display: flex; gap: 7px; }
.alliance-actions .button { flex: 1 1 auto; white-space: nowrap; }

.action-message {
  min-height: 36px;
  padding: 10px 2px 8px;
  color: #bdb9ad;
  font: 600 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.action-message.is-active { color: var(--green); }
.action-message.is-error { color: #ff7c7f; }

.planner-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, 340px); gap: 16px; align-items: stretch; }
.map-card, .roster-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }

.canvas-wrap {
  position: relative;
  height: clamp(440px, 62vh, 690px);
  min-height: 380px;
  overflow: hidden;
  background: #9e835a;
}

#mapCanvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; user-select: none; }
#mapCanvas:active { cursor: grabbing; }
#mapCanvas.is-painting, #mapCanvas.is-painting:active { cursor: crosshair; }

.map-legend {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid rgba(236, 224, 188, .28);
  background: rgba(12, 13, 13, .81);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  color: #eee6d4;
  font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  pointer-events: none;
}

.map-legend strong {
  display: block;
  margin-bottom: 3px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(236, 224, 188, .18);
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .11em;
}

.map-legend span { display: flex; align-items: center; gap: 7px; }
.map-legend i { display: inline-block; width: 11px; height: 11px; border: 1px solid rgba(255, 255, 255, .24); }
.legend-red { background: #a93434; }
.legend-mud { background: #625944; }
.legend-clear { background: #b3986d; }

.tile-overlay {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 13px;
  padding: 7px 9px;
  border: 1px solid rgba(236, 224, 188, .2);
  background: rgba(12, 13, 13, .72);
  color: #d7cfbb;
  font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .08em;
  pointer-events: none;
}

.zoom-controls { position: absolute; right: 10px; bottom: 10px; display: grid; gap: 5px; }
.zoom-controls button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(236, 224, 188, .35);
  border-radius: 0;
  background: rgba(13, 15, 16, .86);
  color: #fff;
  cursor: pointer;
  font-size: 19px;
  font-weight: 800;
}

.zoom-controls button:hover { background: rgba(33, 37, 39, .95); }
.map-help { display: flex; align-items: center; gap: 7px; margin: 0; padding: 11px 14px; border-top: 1px solid var(--line-soft); color: #8f8d84; font-size: 11px; line-height: 1.4; }
.map-help span { color: var(--gold); }

.roster-card { min-height: 100%; padding: 14px; }
.selected-card { margin-bottom: 12px; padding: 12px; border: 1px solid rgba(119, 217, 164, .3); background: rgba(119, 217, 164, .055); }
.selected-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; color: var(--green); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .15em; }
.mini-icon { width: 30px; height: 30px; border: 0; background: transparent; color: #aaa; cursor: pointer; font-size: 19px; }
.selected-name input { height: 40px; font-weight: 750; }
.selected-card code { display: block; margin: 10px 0; color: #f0d783; font-size: 12px; overflow-wrap: anywhere; }
.selected-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.selected-actions .button { min-height: 38px; padding: 0 8px; font-size: 9px; }
.selected-flag-card { border-color: rgba(229, 196, 107, .32); background: rgba(229, 196, 107, .055); }
.selected-flag-card .selected-heading { color: var(--gold); }
.selected-flag-color { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 8px; color: #a9a496; font: 800 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .13em; }
.selected-flag-color select, .selected-flag-color input { height: 38px; }
.flag-assignment { display: block; margin-top: 10px; color: #f3d77e; font: 800 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }

.flag-section { margin-bottom: 12px; padding: 10px; border: 1px solid rgba(229, 196, 107, .22); background: rgba(229, 196, 107, .035); }
.zone-section { border-color: rgba(77, 213, 231, .22); background: rgba(77, 213, 231, .03); }
.zone-section .flag-section-heading strong { color: #8eeaf5; }
.flag-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: #858177; font: 700 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .11em; text-transform: uppercase; }
.flag-section-heading strong { color: var(--gold); }
.flag-list { display: grid; gap: 5px; max-height: 170px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.flag-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 42px; padding: 5px 6px; border: 1px solid var(--line-soft); background: #0a0e13; }
.flag-item.is-selected { border-color: rgba(229, 196, 107, .52); background: rgba(229, 196, 107, .07); }
.flag-swatch { width: 10px; height: 24px; border: 1px solid rgba(255, 255, 255, .32); clip-path: polygon(0 0, 100% 20%, 100% 72%, 0 52%); }
.zone-swatch { height: 12px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.flag-main { min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.flag-name { display: block; overflow: hidden; color: #f1eee4; font-size: 12px; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.flag-location { display: block; margin-top: 2px; color: #858a8f; font: 700 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.flag-delete { width: 30px; height: 30px; border: 0; background: transparent; color: #8c6769; cursor: pointer; font-size: 18px; }
.flag-delete:hover { color: var(--danger); }

.search-field { position: relative; display: block; }
.search-field > span:not(.sr-only) { position: absolute; z-index: 1; top: 50%; left: 12px; color: #777d85; font-size: 20px; transform: translateY(-53%); pointer-events: none; }
.search-field input { padding-left: 36px; }
.roster-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 13px 2px 10px; color: #8f8d85; font: 700 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.roster-summary strong { color: var(--gold); }

.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; padding: 18px; border: 1px solid var(--line-soft); color: var(--muted); text-align: center; }
.empty-hex { display: grid; width: 52px; height: 46px; margin-bottom: 12px; place-items: center; background: #1c242c; color: #6f7b86; font-size: 22px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.empty-state p { margin: 0 0 4px; color: #d7d4ca; font-weight: 700; }
.empty-state span { font-size: 12px; line-height: 1.45; }

.roster-list { display: grid; gap: 7px; max-height: 515px; margin: 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-color: #3b444d #10151b; }
.roster-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; min-height: 50px; padding: 7px 8px 7px 10px; border: 1px solid var(--line-soft); background: #0b0f14; }
.roster-item.is-selected { border-color: rgba(119, 217, 164, .45); background: rgba(119, 217, 164, .055); }
.roster-main { min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.roster-name { display: block; overflow: hidden; color: #eeece5; font-size: 13px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.roster-coord { display: block; margin-top: 2px; color: #858a8f; font: 700 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.roster-copy, .roster-delete { width: 34px; height: 34px; border: 1px solid #2d353e; background: #121820; color: #c7c5bd; cursor: pointer; }
.roster-delete { border-color: transparent; background: transparent; color: #8c6769; font-size: 18px; }
.roster-copy:hover { border-color: #56616c; }
.roster-delete:hover { color: var(--danger); }

.intel-strip { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 12px; margin-top: 14px; }
.intel-strip article { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); background: #0b0f14; }
.intel-strip span { color: var(--gold); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .13em; }
.intel-strip p { margin: 8px 0 0; color: #99968c; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.intel-strip b { color: #d9d4c5; }

.toast { position: fixed; z-index: 50; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: min(370px, calc(100vw - 36px)); padding: 12px 15px; border: 1px solid rgba(119, 217, 164, .45); background: #101a17; box-shadow: 0 15px 45px rgba(0, 0, 0, .45); color: #dff9ea; font-size: 12px; }
.toast.is-error { border-color: rgba(255, 101, 101, .48); background: #201113; color: #ffd6d6; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
[hidden] { display: none !important; }
noscript { display: block; padding: 18px; background: #44171a; color: #fff; text-align: center; }

body.view-mode .editor-only { display: none !important; }
body.view-mode .control-panel { grid-template-columns: minmax(200px, 1fr) 115px auto; }
body.view-mode .control-actions { grid-column: auto; }
body.view-mode .selected-actions { grid-template-columns: 1fr; }
body.view-mode .roster-item { grid-template-columns: minmax(0, 1fr) auto; }

@media (max-width: 1120px) {
  .control-panel { grid-template-columns: minmax(180px, 1fr) 105px minmax(180px, 1fr) auto; }
  .control-actions { grid-column: 1 / -1; }
  .control-actions .button:first-child { margin-left: auto; }
  .planner-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .flag-tools { grid-template-columns: minmax(180px, 1fr) 135px minmax(300px, auto); }
  .flag-tools p { grid-column: 1 / -1; margin-top: 0; }
}

@media (max-width: 860px) {
  .page-shell { padding-top: 20px; }
  .page-heading { align-items: flex-start; }
  h1 { letter-spacing: .075em; }
  .control-panel { grid-template-columns: minmax(0, 1fr) 95px; }
  .member-field { grid-column: 1; }
  #placeButton { grid-column: 2; }
  .control-actions { grid-column: 1 / -1; }
  .flag-tools { grid-template-columns: minmax(0, 1fr) 130px; }
  .alliance-actions { grid-column: 1 / -1; }
  .planner-grid { grid-template-columns: 1fr; }
  .roster-card { min-height: auto; }
  .roster-list { max-height: 420px; }
  .intel-strip { grid-template-columns: 1fr; }
  body.view-mode .control-panel { grid-template-columns: minmax(0, 1fr) 95px; }
  body.view-mode .control-actions { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-header { min-height: 52px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand strong { font-size: 11px; }
  .header-tool { font-size: 9px; }
  .page-shell { padding-inline: 10px; }
  .page-heading { display: block; margin-bottom: 15px; padding-inline: 3px; }
  .page-heading p:last-child { font-size: 12px; }
  .view-badge { margin-top: 13px; }
  h1 { font-size: 28px; line-height: 1.08; }
  .control-panel { grid-template-columns: minmax(0, 1fr) 88px; gap: 9px; padding: 11px; }
  .plan-field { grid-column: 1; }
  .state-field { grid-column: 2; }
  .member-field { grid-column: 1; }
  #placeButton { grid-column: 2; padding-inline: 8px; }
  .control-actions { display: grid; grid-template-columns: 1fr 1fr 42px; width: 100%; }
  .control-actions .button:first-child { margin-left: 0; }
  .button { font-size: 9px; letter-spacing: .045em; }
  .flag-tools { grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; padding-top: 10px; }
  .alliance-field { grid-column: 1; }
  .flag-color-field { grid-column: 2; }
  .alliance-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); }
  .alliance-actions .button { padding-inline: 6px; }
  .flag-tools p { grid-column: 1 / -1; margin: 0; }
  .canvas-wrap { height: clamp(290px, 72vw, 410px); min-height: 290px; }
  .map-legend { top: 8px; left: 8px; gap: 6px; padding: 8px; font-size: 8px; }
  .map-legend strong { max-width: 190px; font-size: 8px; }
  .tile-overlay { top: 8px; right: 8px; }
  .zoom-controls { right: 8px; bottom: 8px; }
  .zoom-controls button { width: 40px; height: 40px; }
  .map-help { font-size: 10px; }
  .roster-card { padding: 10px; }
  .selected-actions .button { font-size: 8px; }
  .toast { right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: calc(100vw - 20px); }
  body.view-mode .control-panel { grid-template-columns: minmax(0, 1fr) 88px; }
  body.view-mode .control-actions { grid-column: 1 / -1; }
}

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

.saved-plan-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px 12px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line, #242b36);
}
.saved-plan-field { min-width: 0; }
.saved-plan-field select { width: 100%; }
.saved-plan-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-plan-tools p { grid-column: 1 / -1; margin: 0; font-size: 10px; opacity: .7; }
@media (max-width: 560px) {
  .saved-plan-tools { grid-template-columns: 1fr; }
  .saved-plan-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .saved-plan-tools p { grid-column: 1; }
}
.shareable-plan-toggle{display:flex;align-items:center;gap:.45rem;min-height:44px;font-weight:700}.shareable-plan-toggle input{width:20px;height:20px}.public-plan-picker{display:flex;flex-wrap:wrap;gap:.6rem;align-items:end;margin-top:.75rem;padding-top:.75rem;border-top:1px solid rgba(255,255,255,.12)}.public-plan-picker .saved-plan-field{flex:1 1 220px}.public-plan-picker .button{min-height:44px}

.assignment-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:8px 0}.assignment-help{margin:8px 0 0;color:var(--muted,#aab2c0);font-size:.82rem;line-height:1.35}.turret-assign[data-assigned="1"]{outline:2px solid rgba(255,255,255,.28)}@media(max-width:520px){.assignment-grid{grid-template-columns:1fr}.assignment-grid .button{width:100%}}

/* v2.8.0 Presentation Mode */
body.presentation-mode .editor-only,
body.presentation-mode .saved-plan-tools,
body.presentation-mode .flag-tools,
body.presentation-mode #copyRosterButton,
body.presentation-mode #shareButton,
body.presentation-mode #newPlanButton,
body.presentation-mode #undoButton,
body.presentation-mode #clearPlanButton,
body.presentation-mode #actionMessage,
body.presentation-mode .map-help,
body.presentation-mode .selected-card,
body.presentation-mode .assignment-tools { display:none !important; }
body.presentation-mode .control-panel { grid-template-columns:minmax(200px,1fr) 115px auto; }
body.presentation-mode #planName, body.presentation-mode #stateNumber { pointer-events:none; }
@media (max-width:700px){ body.presentation-mode .control-panel{grid-template-columns:minmax(0,1fr) 95px;} body.presentation-mode .control-actions{grid-column:1/-1;} }

/* Decode roster integration v3.0.0 */
.decode-import{grid-column:1/-1;display:grid;grid-template-columns:minmax(140px,1fr) minmax(180px,1.4fr) minmax(160px,1fr) auto;gap:10px;align-items:end;padding:12px;border:1px solid rgba(92,169,255,.24);background:rgba(15,28,43,.72);border-radius:12px}.decode-import-heading{grid-column:1/-1;display:flex;gap:10px;justify-content:space-between;flex-wrap:wrap}.decode-import-heading strong{font-size:.78rem;letter-spacing:.09em}.decode-import-heading span,.decode-player-preview span{color:#9aa9b8;font-size:.78rem}.decode-player-preview{min-height:44px;display:flex;flex-direction:column;justify-content:center;gap:2px}.decode-player-preview strong{font-size:.9rem}@media(max-width:720px){.decode-import{grid-template-columns:1fr}.decode-import-heading{grid-column:auto}.decode-import .button{width:100%}}

/* v3.0.1 Last Z site theme polish */
:root {
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --grass: #355d36;
  --grass-deep: #294a2c;
}

.site-header { border-bottom-color: rgba(223,53,57,.7); }
.brand-mark { border-radius: 10px; }
.view-badge,
.control-panel,
.map-card,
.roster-card,
.selected-card,
.flag-section,
.intel-strip article,
.empty-state,
.toast { border-radius: var(--radius-md); }

.control-panel,
.map-card,
.roster-card { overflow: hidden; }

input,
select,
.button,
.icon-button,
.zoom-controls button,
.mini-icon,
.roster-copy,
.roster-delete,
.flag-item,
.roster-item,
.tile-overlay,
.map-legend { border-radius: var(--radius-sm); }

.button-primary,
.button-accent {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 5px 16px rgba(198,35,42,.12);
}
.button-secondary { background: linear-gradient(180deg,#151b23,#0f141b); }
.button-flag { background: linear-gradient(180deg,rgba(229,196,107,.14),rgba(229,196,107,.07)); }
.button-zone { background: linear-gradient(180deg,rgba(77,213,231,.11),rgba(77,213,231,.05)); }

.canvas-wrap {
  background: var(--grass);
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,.035) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 68%, rgba(0,0,0,.055) 0 1px, transparent 1.5px),
    linear-gradient(145deg, var(--grass), var(--grass-deep));
}

.map-help { background: rgba(9,13,18,.72); }
.saved-plan-tools,
.flag-tools { border-top-color: rgba(229,196,107,.13); }
.decode-import { border-radius: var(--radius-md); }
.public-plan-picker { border-top-color: rgba(229,196,107,.13); }

@media (max-width:560px) {
  .control-panel,
  .map-card,
  .roster-card { border-radius: 12px; }
  .button,
  input,
  select { border-radius: 9px; }
}

/* v3.1.0 Command Center layout — matched to Last Z Ultimate Guide */
:root{
  --bg:#071015;
  --surface:#091319;
  --surface-2:#0c171d;
  --line:#27414a;
  --line-soft:#1c3037;
  --text:#fff4e6;
  --muted:#b9b2a7;
  --red:#f06a22;
  --red-dark:#8d3b12;
  --gold:#ff9a3d;
  --green:#7cc18a;
  --danger:#ff5d4f;
  --site-orange:#f47a1f;
  --site-orange-hot:#ff8b2c;
  --site-cyan:#315f6b;
  --shadow:0 18px 48px rgba(0,0,0,.34);
}
body{
  background:
    linear-gradient(rgba(27,57,67,.10) 1px,transparent 1px),
    linear-gradient(90deg,rgba(27,57,67,.10) 1px,transparent 1px),
    radial-gradient(circle at 70% 20%,rgba(244,122,31,.08),transparent 28rem),
    #071015;
  background-size:32px 32px,32px 32px,auto,auto;
}
.site-header{
  min-height:62px;
  border-bottom:1px solid rgba(244,122,31,.42);
  background:rgba(5,10,13,.96);
}
.brand-mark{border-color:#8f4a1c;background:#10171b;color:var(--site-orange);box-shadow:none}
.brand strong{color:#fff4e6}.brand small,.header-tool{color:var(--site-orange)}
.page-shell{
  width:min(1780px,100%);
  display:grid;
  grid-template-columns:minmax(245px,280px) minmax(560px,1fr) minmax(285px,330px);
  grid-template-rows:auto auto minmax(520px,auto);
  gap:12px;
  padding:16px clamp(12px,1.5vw,24px) 28px;
}
.page-heading{grid-column:1/-1;margin:0 0 2px;align-items:center}
.page-heading .eyebrow{color:var(--site-orange)}
h1{font-size:clamp(24px,2.4vw,38px);letter-spacing:.06em}
.page-heading p:last-child{margin-top:7px;font-size:12px}
.view-badge{border-color:rgba(244,122,31,.4);background:rgba(244,122,31,.08);color:#ffd2ad}
.control-panel{
  grid-column:1;grid-row:2/4;
  display:flex;flex-direction:column;align-items:stretch;gap:10px;
  padding:12px;border:1px solid rgba(244,122,31,.38);
  background:linear-gradient(180deg,rgba(12,23,29,.96),rgba(7,16,21,.97));
  box-shadow:none;overflow:visible;
}
.control-panel:before{content:"PLAN CONTROLS";color:var(--site-orange);font-weight:850;font-size:13px;letter-spacing:.08em;margin:2px 0 4px}
.control-panel > *{min-width:0}
.control-actions,.saved-plan-actions,.alliance-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.control-actions .button,.control-actions .icon-button,.saved-plan-actions .button,.alliance-actions .button{width:100%}
.control-actions #copyRosterButton,.control-actions #exportImageButton,.control-actions #presentationButton,.control-actions #shareButton{grid-column:span 2}
.saved-plan-tools,.flag-tools,.decode-import{
  display:flex;flex-direction:column;align-items:stretch;gap:9px;
  padding:12px 0 0;border:0;border-top:1px solid rgba(244,122,31,.24);background:transparent;border-radius:0;
}
.saved-plan-tools:before{content:"SAVE & SHARE";color:var(--site-orange);font-weight:850;font-size:12px;letter-spacing:.07em}
.flag-tools:before{content:"MAP TOOLS";color:var(--site-orange);font-weight:850;font-size:12px;letter-spacing:.07em}
.decode-import-heading{display:flex;flex-direction:column;gap:4px}.decode-import-heading strong{color:var(--site-orange)}
.public-plan-picker{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding-top:9px}.public-plan-picker .field{grid-column:1/-1}
.flag-tools p,.saved-plan-tools p{margin:0;color:#8e9696;font-size:10px;line-height:1.45}
.action-message{grid-column:2;grid-row:2;min-height:38px;padding:9px 12px;border:1px solid rgba(244,122,31,.22);border-radius:9px;background:#091319;color:#c7c0b6}
.planner-grid{display:contents}
.map-card{grid-column:2;grid-row:3;border-color:rgba(244,122,31,.34);background:#091319;box-shadow:none}
.roster-card{grid-column:3;grid-row:2/4;border-color:rgba(244,122,31,.38);background:linear-gradient(180deg,#0b161b,#081116);box-shadow:none}
.roster-card:before{content:"PLAN ASSIGNMENTS";display:block;padding:13px 14px 4px;color:var(--site-orange);font-size:13px;font-weight:850;letter-spacing:.07em}
.canvas-wrap{height:clamp(560px,70vh,820px);min-height:520px;background:#3f6a2e;border-radius:10px 10px 0 0}
.map-help{margin:0;padding:10px 14px;border-top:1px solid rgba(244,122,31,.2);background:#071015;color:#aaa69e}
.map-legend{border-color:rgba(244,122,31,.38);background:rgba(5,13,17,.91)}
.tile-overlay,.zoom-controls button{border-color:rgba(244,122,31,.45);background:#081217;color:#fff0df}
input,select{height:42px;border-color:#29434c;background:#071116;color:#fff4e6}
input:focus,select:focus{border-color:var(--site-orange);box-shadow:0 0 0 2px rgba(244,122,31,.12)}
.field>span{color:#aaa59d;letter-spacing:.11em}
.button,.icon-button{min-height:42px;border-radius:8px}
.button-primary,.button-accent{
  border-color:#ff9a4c;
  background:linear-gradient(180deg,#f57e24,#dc5c12);
  color:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 4px 12px rgba(174,66,10,.18)
}
.button-primary:hover,.button-accent:hover{background:linear-gradient(180deg,#ff9138,#eb6817)}
.button-secondary,.button-flag,.button-zone{
  border-color:#8a4a20;background:linear-gradient(180deg,#101a1f,#091217);color:#fff0df
}
.button-secondary:hover,.button-flag:hover,.button-zone:hover{border-color:var(--site-orange);background:#142129}
.button-danger{border-color:rgba(255,93,79,.55);background:#101417;color:#ff7064}
.icon-button{border-color:#8a4a20;background:#0b151a;color:var(--site-orange)}
.selected-card,.flag-section{border-color:rgba(244,122,31,.28);background:#091419}
.selected-heading,.flag-section-heading strong{color:var(--site-orange)}
.search-field{border-color:#29434c;background:#071116}
.roster-item,.flag-item{border-color:#20353d;background:#081217}
.roster-item:hover,.flag-item:hover{border-color:#8a4a20}
.roster-summary{border-color:rgba(244,122,31,.22)}
.empty-hex{border-color:#8a4a20;color:var(--site-orange)}

@media(max-width:1180px){
  .page-shell{grid-template-columns:minmax(230px,270px) minmax(0,1fr);grid-template-rows:auto auto auto auto}
  .page-heading{grid-column:1/-1}
  .control-panel{grid-column:1;grid-row:2/4}
  .action-message{grid-column:2;grid-row:2}
  .map-card{grid-column:2;grid-row:3}
  .roster-card{grid-column:1/-1;grid-row:4}
  .canvas-wrap{height:clamp(500px,65vh,720px)}
}
@media(max-width:760px){
  .page-shell{display:block;padding:10px 10px 24px}
  .page-heading{margin:6px 2px 12px;align-items:flex-start}
  .page-heading p:last-child{display:none}
  .control-panel,.action-message,.map-card,.roster-card{margin-bottom:10px}
  .control-panel{display:flex;padding:11px}
  .control-actions,.saved-plan-actions,.alliance-actions{grid-template-columns:1fr 1fr}
  .canvas-wrap{height:clamp(360px,105vw,560px);min-height:340px}
  .map-card{overflow:hidden}
  .roster-card:before{padding-top:12px}
}


/* v3.2.0 direct map assignment dialog */
.assign-dialog{border:1px solid rgba(238,133,45,.55);border-radius:16px;padding:0;background:transparent;color:var(--text,#f7f2e8);max-width:min(440px,calc(100% - 28px));width:100%;box-shadow:0 24px 70px rgba(0,0,0,.62)}
.assign-dialog::backdrop{background:rgba(3,7,9,.76);backdrop-filter:blur(3px)}
.assign-dialog-card{margin:0;padding:20px;background:linear-gradient(180deg,#12191d 0%,#0b1114 100%);border-radius:15px}
.assign-dialog-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:10px}
.assign-dialog-head h2{margin:2px 0 0;font-size:1.35rem;color:#fff7eb}
.assign-dialog-head .eyebrow{font-size:.7rem;font-weight:800;letter-spacing:.14em;color:#f39a43}
.assign-dialog-current{margin:0 0 16px;color:#b9b5ad;font-size:.9rem;line-height:1.45}
.assign-dialog-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:18px}
.assign-dialog-actions .button{min-height:44px;border-radius:10px}
.assign-dialog-actions .button-primary{grid-column:1/-1;background:linear-gradient(180deg,#df6f1d,#a8470d);border-color:#f39a43;color:white}
@media(max-width:520px){.assign-dialog-card{padding:16px}.assign-dialog-actions{grid-template-columns:1fr}.assign-dialog-actions .button-primary{grid-column:auto}}

/* v3.4.0 Battle Roster */
.battle-roster{margin-top:12px;padding:12px;border:1px solid rgba(244,122,31,.28);border-radius:10px;background:#091419}
.battle-roster-help{margin:7px 0 10px;color:#9fa4a1;font-size:11px;line-height:1.4}
.battle-roster-columns{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.battle-roster-label{display:block;margin-bottom:6px;color:#f47a1f;font-size:10px;font-weight:850;letter-spacing:.1em}
.battle-player-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;max-height:230px;overflow:auto}
.battle-player{margin:0}.battle-player-button{width:100%;min-height:48px;padding:8px 9px;text-align:left;border:1px solid #29434c;border-radius:8px;background:#071116;color:#fff;cursor:pointer}
.battle-player-button strong,.battle-player-button span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.battle-player-button strong{font-size:12px}.battle-player-button span{margin-top:3px;color:#9ca4a4;font-size:10px}
.battle-player-button:hover{border-color:#f47a1f;background:#101c21}.battle-player.is-placed .battle-player-button{border-color:rgba(244,122,31,.45)}
.battle-roster-empty{padding:9px;border:1px dashed #29434c;border-radius:8px;color:#7f898a;font-size:10px}
@media(max-width:520px){.battle-roster-columns{grid-template-columns:1fr}.battle-player-list{max-height:180px}}

.selected-actions-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.selected-actions-four .button { min-width: 0; }
@media (max-width: 560px) { .selected-actions-four { grid-template-columns: 1fr 1fr; } }

/* v3.7.0 Full-width battlefield layout
   UI-only: does not change map/world geometry, tile math, capital or turret coordinates. */
@media (min-width: 761px) {
  .page-shell {
    width: min(1840px, 100%);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    gap: 12px;
    padding: 16px clamp(12px,1.5vw,24px) 30px;
  }
  .page-heading { grid-column: 1; grid-row: 1; }
  .control-panel {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(12, minmax(0,1fr));
    align-items: start;
    gap: 10px;
    padding: 12px;
    overflow: visible;
  }
  .control-panel:before { grid-column: 1/-1; margin-bottom: 0; }
  .control-panel > .plan-field { grid-column: span 3; }
  .control-panel > .state-field { grid-column: span 2; }
  .control-panel > .member-field { grid-column: span 2; }
  .decode-import {
    grid-column: span 5;
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 9px;
    padding: 10px;
    border: 1px solid rgba(244,122,31,.24);
    border-radius: 10px;
    background: rgba(5,13,17,.35);
  }
  .decode-import-heading,.decode-player-preview { grid-column: 1/-1; }
  #placeButton { grid-column: span 2; align-self: end; }
  .control-actions {
    grid-column: span 5;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 8px;
  }
  .control-actions #copyRosterButton,
  .control-actions #exportImageButton,
  .control-actions #presentationButton,
  .control-actions #shareButton { grid-column: auto; }
  .saved-plan-tools {
    grid-column: span 4;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(244,122,31,.24);
    border-radius: 10px;
    background: rgba(5,13,17,.35);
  }
  .saved-plan-tools:before,.saved-plan-tools > p,.saved-plan-field,.public-plan-picker { grid-column: 1/-1; }
  .saved-plan-actions { grid-column: 1/-1; }
  .flag-tools {
    grid-column: span 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(244,122,31,.24);
    border-radius: 10px;
    background: rgba(5,13,17,.35);
  }
  .flag-tools:before,.flag-tools > p,.alliance-actions { grid-column: 1/-1; }
  .action-message { grid-column: 1; grid-row: 3; }
  .planner-grid { display: contents; }
  .map-card {
    grid-column: 1;
    grid-row: 4;
    width: 100%;
  }
  .canvas-wrap {
    height: clamp(720px, 78vw, 1120px);
    min-height: 720px;
  }
  .roster-card {
    grid-column: 1;
    grid-row: 5;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px;
    padding: 12px;
  }
  .roster-card:before { grid-column: 1/-1; padding: 0 2px 2px; }
  .roster-card > section { margin: 0; align-self: start; }
}

@media (max-width: 760px) {
  .page-shell { padding: 8px 8px 24px; }
  .page-heading { margin: 4px 2px 10px; }
  .control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }
  .control-panel:before { grid-column: 1/-1; }
  .control-panel > .plan-field,
  .control-panel > .state-field { grid-column: span 1; }
  .control-panel > .member-field { grid-column: span 1; }
  .decode-import,
  .control-actions,
  .saved-plan-tools,
  .flag-tools,
  #placeButton { grid-column: 1/-1; }
  .decode-import,
  .saved-plan-tools,
  .flag-tools {
    padding: 10px;
    border: 1px solid rgba(244,122,31,.24);
    border-radius: 10px;
    background: rgba(5,13,17,.35);
  }
  .control-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 7px;
  }
  .control-actions #copyRosterButton,
  .control-actions #exportImageButton,
  .control-actions #presentationButton,
  .control-actions #shareButton { grid-column: auto; }
  .canvas-wrap {
    height: clamp(560px, 145vw, 820px);
    min-height: 560px;
  }
  .map-card { width: 100%; }
  .roster-card { margin-top: 10px; }
}

/* v3.9 objective command deck */
.objective-deck{grid-column:1/-1;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;padding:10px;border:1px solid rgba(244,122,31,.28);border-radius:12px;background:rgba(5,13,17,.42)}
.objective-deck-heading{grid-column:1/-1}.objective-card{position:relative;min-height:178px;padding:12px;border:1px solid rgba(244,122,31,.3);border-radius:10px;background:linear-gradient(180deg,rgba(16,27,31,.96),rgba(7,14,17,.98));overflow:hidden}.turret-settings-card{cursor:pointer}.turret-settings-card:focus,.turret-settings-card:hover{outline:none;border-color:#f47a1f;box-shadow:inset 0 0 0 1px rgba(244,122,31,.18)}
.objective-title{font:800 14px/1.1 var(--font-display,inherit);color:#f4ead4;letter-spacing:.05em}.objective-meta{position:absolute;right:10px;top:45px;width:42%;display:grid;gap:3px}.objective-meta span{font-size:9px;letter-spacing:.12em;color:#8f999b}.objective-meta strong{width:max-content;max-width:100%;padding:5px 7px;border:1px solid rgba(244,122,31,.45);border-radius:5px;color:#ffb12f;background:#17120c;overflow:hidden;text-overflow:ellipsis}.objective-meta b,.objective-meta em{font-size:12px;color:#e8e0d2;font-style:normal}.permanent-label{color:#72cf7b!important;border-color:rgba(114,207,123,.35)!important;background:rgba(25,70,35,.2)!important}
.turret-mini{position:absolute;left:14px;bottom:14px;width:110px;height:110px;border-radius:50%;background:radial-gradient(circle at 50% 50%,#ff6b24 0 7%,#1c2427 8% 24%,#bd6b28 25% 29%,#101619 30% 49%,#7d4b28 50% 54%,#171d20 55% 68%,#090c0e 69%);border:3px solid #3d2b20;box-shadow:0 10px 18px rgba(0,0,0,.45),inset 0 0 0 5px #222a2d}.turret-mini:before{content:"";position:absolute;left:52px;top:47px;width:66px;height:16px;border:3px solid #1a1f21;border-radius:5px;background:linear-gradient(#555d5f,#1b2225);transform:rotate(-22deg);transform-origin:5px 8px;box-shadow:inset 0 0 0 2px #8c572d}.turret-mini:after{content:"";position:absolute;inset:15px;border:3px dashed #a96832;border-radius:50%}.turret-mini i{position:absolute;left:45px;top:45px;width:20px;height:20px;border-radius:50%;background:#ff5b20;box-shadow:0 0 12px #ff5b20}
.capital-mini{position:absolute;left:18px;bottom:12px;width:118px;height:112px;border-radius:38% 38% 24% 24%;background:radial-gradient(circle at 50% 34%,#ff5d22 0 7%,#191f22 8% 18%,transparent 19%),linear-gradient(135deg,#171d20,#3a2b24 48%,#111719 49%);border:4px solid #7b4a28;box-shadow:0 12px 20px rgba(0,0,0,.5),inset 0 0 0 5px #252d30}.capital-mini:before{content:"";position:absolute;left:47px;top:-28px;width:22px;height:48px;background:linear-gradient(90deg,#171d20,#b35d28,#171d20);clip-path:polygon(50% 0,100% 100%,0 100%)}.capital-mini:after{content:"";position:absolute;left:42px;bottom:15px;width:34px;height:34px;border-radius:50%;background:#53b9e7;border:6px solid #11181b;box-shadow:0 0 0 3px #ad6b32}.capital-mini i{position:absolute;width:26px;height:62px;bottom:8px;background:linear-gradient(#2b3235,#111719);border:2px solid #8c572d;clip-path:polygon(50% 0,100% 30%,88% 100%,12% 100%,0 30%)}.capital-mini i:nth-child(1){left:-10px;transform:rotate(-16deg)}.capital-mini i:nth-child(2){right:-10px;transform:rotate(16deg)}.capital-mini i:nth-child(3){left:46px;top:-12px;height:52px;transform:scale(.7)}
@media(max-width:760px){.objective-deck{grid-template-columns:1fr 1fr}.objective-card{min-height:160px}.turret-mini{transform:scale(.78);transform-origin:left bottom}.capital-mini{transform:scale(.76);transform-origin:left bottom}.objective-meta{width:47%;right:7px}.objective-title{font-size:12px}}
@media(max-width:430px){.objective-deck{grid-template-columns:1fr}.objective-card{min-height:150px}.objective-meta{width:52%}}

/* v3.9.1 turret settings deck: match approved command-card layout */
.objective-deck{grid-template-columns:190px repeat(3,minmax(0,1fr)) 150px;align-items:stretch;padding:12px;gap:12px;background:linear-gradient(180deg,rgba(5,13,17,.72),rgba(3,9,12,.92));}
.objective-legend{min-height:178px;padding:12px;border:1px solid rgba(244,122,31,.22);border-radius:10px;background:rgba(5,12,15,.76);display:flex;flex-direction:column;justify-content:center;gap:12px}.objective-legend>div{display:flex;align-items:center;gap:10px;color:#e8e0d2;font-size:12px}.legend-swatch{width:17px;height:17px;border-radius:2px;border:1px solid rgba(255,255,255,.14);display:block}.swatch-unassigned{background:#666f70}.swatch-assigned{background:#c69b42}.swatch-other{background:#2487d5}.swatch-blocked{background:#b83439}.swatch-invalid{background:repeating-linear-gradient(135deg,#555 0 4px,#303638 4px 8px)}
.objective-card{min-height:190px}.objective-add-note{min-height:190px;border:1px dashed #b95b1d;border-radius:10px;background:rgba(7,14,17,.68);color:#f28a32;font:800 13px/1.2 var(--font-display,inherit);letter-spacing:.06em;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;cursor:pointer}.objective-add-note span{font-size:38px;font-weight:300}.objective-add-note:hover,.objective-add-note:focus{outline:none;border-color:#f47a1f;background:rgba(244,122,31,.07)}
@media(max-width:1050px){.objective-deck{grid-template-columns:160px repeat(2,minmax(0,1fr))}.objective-add-note{min-height:150px}.objective-legend{grid-row:span 2}.objective-card{min-height:170px}}
@media(max-width:760px){.objective-deck{grid-template-columns:1fr 1fr}.objective-deck-heading{grid-column:1/-1}.objective-legend{grid-column:1/-1;grid-row:auto;min-height:auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}.objective-card{min-height:168px}.objective-add-note{min-height:168px}}
@media(max-width:430px){.objective-deck{grid-template-columns:1fr}.objective-legend{grid-template-columns:1fr 1fr}.objective-card,.objective-add-note{min-height:160px}}


/* v3.9.2 mobile objective command deck */
.objective-deck{grid-template-columns:190px repeat(4,minmax(220px,1fr)) 150px}
.objective-card{min-width:0}
.capital-settings-card{cursor:default}
@media(max-width:760px){
  .objective-deck{display:flex;align-items:stretch;gap:12px;overflow-x:auto;overflow-y:hidden;padding:12px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain}
  .objective-deck-heading{flex:0 0 100%;min-width:100%}
  .objective-legend{flex:0 0 190px;min-width:190px;display:flex;grid-template-columns:none;justify-content:center;padding:14px;gap:10px}
  .objective-card{flex:0 0 260px;min-width:260px;min-height:218px;scroll-snap-align:start;padding:14px}
  .objective-add-note{flex:0 0 190px;min-width:190px;min-height:218px;scroll-snap-align:start}
  .turret-mini{left:14px;bottom:16px;width:132px;height:132px;transform:none}
  .turret-mini:before{left:62px;top:56px;width:78px;height:18px}
  .turret-mini:after{inset:18px}
  .turret-mini i{left:54px;top:54px;width:23px;height:23px}
  .capital-mini{left:16px;bottom:16px;width:132px;height:126px;transform:none}
  .objective-meta{right:12px;top:48px;width:42%;gap:5px}
  .objective-meta span{font-size:8px}.objective-meta b,.objective-meta em{font-size:11px}
  .objective-title{font-size:13px}
}
@media(max-width:430px){
  .objective-deck{display:flex;grid-template-columns:none}
  .objective-deck-heading{flex-basis:100%;min-width:100%}
  .objective-legend{flex-basis:176px;min-width:176px}
  .objective-card{flex-basis:250px;min-width:250px;min-height:210px}
  .objective-add-note{flex-basis:176px;min-width:176px;min-height:210px}
}

/* v3.9.5 approved turret command cards */
.objective-deck{grid-template-columns:190px repeat(3,minmax(280px,1fr)) 150px!important}
.objective-card{min-height:190px!important}
.turret-card-art{position:absolute;left:10px;bottom:8px;width:58%;height:auto;filter:drop-shadow(0 12px 12px rgba(0,0,0,.55))}
.objective-card .objective-meta{width:38%;right:12px;top:48px}
.objective-edit{position:absolute;right:10px;bottom:10px;width:30px;height:30px;border:1px solid rgba(244,122,31,.35);border-radius:6px;display:grid;place-items:center;color:#e8e0d2;background:#0a1114}
@media(max-width:760px){
 .objective-deck{display:flex!important;grid-template-columns:none!important;overflow-x:auto;gap:12px;padding:12px;scroll-snap-type:x proximity}
 .objective-deck-heading{flex:0 0 100%;min-width:100%}
 .objective-legend{flex:0 0 190px;min-width:190px}
 .objective-card{flex:0 0 300px!important;min-width:300px!important;min-height:200px!important;scroll-snap-align:start}
 .objective-add-note{flex:0 0 180px;min-width:180px;min-height:200px}
 .turret-card-art{width:61%;left:8px;bottom:5px}
 .objective-card .objective-meta{width:37%;right:10px;top:48px}
}
\n\n/* v3.9.6 assignment legend + objective card track */
.objective-deck{
  display:grid!important;
  grid-template-columns:1fr!important;
  overflow:visible!important;
}
.objective-deck-heading{grid-column:1!important;width:100%;min-width:0!important}
.objective-legend{
  grid-column:1!important;
  width:100%;min-width:0!important;min-height:0!important;
  display:grid!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  gap:10px 18px!important;
  padding:12px 16px!important;
  align-items:center!important;
}
.objective-legend>div{min-width:0;justify-content:center;white-space:nowrap}
.objective-cards-track{
  grid-column:1;
  display:grid;
  grid-template-columns:repeat(3,minmax(280px,1fr)) 150px;
  gap:12px;
  width:100%;min-width:0;
}
.objective-cards-track .objective-card{min-width:0!important;width:auto!important;}
.objective-cards-track .objective-add-note{min-width:0!important;width:auto!important;}
@media(max-width:760px){
  .objective-deck{padding:10px!important;overflow:hidden!important}
  .objective-legend{
    grid-template-columns:repeat(5,max-content)!important;
    justify-content:start!important;
    overflow-x:auto!important;
    scrollbar-width:none;
    padding:10px 12px!important;
  }
  .objective-legend::-webkit-scrollbar{display:none}
  .objective-legend>div{justify-content:flex-start}
  .objective-cards-track{
    display:flex;
    gap:12px;
    overflow-x:auto;
    overflow-y:hidden;
    width:100%;
    padding:0 18px 8px 0;
    scroll-padding-right:18px;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-inline:contain;
  }
  .objective-cards-track::after{content:"";flex:0 0 6px}
  .objective-cards-track .objective-card{
    flex:0 0 min(82vw,300px)!important;
    min-width:min(82vw,300px)!important;
    scroll-snap-align:start;
  }
  .objective-cards-track .objective-add-note{
    flex:0 0 min(52vw,190px)!important;
    min-width:min(52vw,190px)!important;
    scroll-snap-align:start;
  }
}
@media(max-width:430px){
  .objective-legend{gap:8px 14px!important}
  .legend-swatch{width:14px;height:14px}
  .objective-legend>div{font-size:10px}
}

/* v3.9.7 HQ assignment deck layout repair */
.objective-deck{
  display:block!important;
  width:100%!important;
  min-width:0!important;
  height:auto!important;
  min-height:0!important;
  overflow:hidden!important;
  padding:14px!important;
  box-sizing:border-box!important;
}
.objective-deck-heading{
  display:flex!important;
  justify-content:space-between!important;
  align-items:center!important;
  width:100%!important;
  min-width:0!important;
  margin:0 0 12px!important;
}
.objective-legend{
  display:flex!important;
  flex-wrap:wrap!important;
  align-items:center!important;
  justify-content:flex-start!important;
  width:100%!important;
  min-width:0!important;
  min-height:0!important;
  height:auto!important;
  gap:10px 24px!important;
  padding:10px 12px!important;
  margin:0 0 12px!important;
  box-sizing:border-box!important;
  overflow:visible!important;
}
.objective-legend>div{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:8px!important;
  min-width:max-content!important;
  white-space:nowrap!important;
  font-size:12px!important;
}
.legend-swatch{flex:0 0 16px!important;width:16px!important;height:16px!important}
.objective-cards-track{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr)) minmax(130px,.48fr)!important;
  gap:12px!important;
  width:100%!important;
  min-width:0!important;
  height:auto!important;
  overflow:visible!important;
  padding:0!important;
  box-sizing:border-box!important;
}
.objective-cards-track .objective-card,
.objective-cards-track .objective-add-note{
  min-width:0!important;
  width:100%!important;
  max-width:none!important;
  min-height:200px!important;
  height:auto!important;
  box-sizing:border-box!important;
}

@media (max-width: 900px){
  .objective-deck{padding:12px!important}
  .objective-legend{gap:9px 16px!important;padding:10px!important}
  .objective-legend>div{font-size:11px!important}
  .objective-cards-track{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:12px!important;
    width:100%!important;
    min-width:0!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:0 20px 10px 0!important;
    scroll-padding:0 20px!important;
    scroll-snap-type:x mandatory!important;
    -webkit-overflow-scrolling:touch!important;
    overscroll-behavior-x:contain!important;
  }
  .objective-cards-track::after{content:""!important;display:block!important;flex:0 0 8px!important}
  .objective-cards-track .objective-card{
    flex:0 0 min(78vw,310px)!important;
    width:min(78vw,310px)!important;
    min-width:min(78vw,310px)!important;
    min-height:205px!important;
    scroll-snap-align:start!important;
  }
  .objective-cards-track .objective-add-note{
    flex:0 0 min(48vw,190px)!important;
    width:min(48vw,190px)!important;
    min-width:min(48vw,190px)!important;
    min-height:205px!important;
    scroll-snap-align:start!important;
  }
}

@media (max-width: 520px){
  .objective-deck-heading{margin-bottom:10px!important}
  .objective-legend{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:9px 12px!important;
    overflow:visible!important;
  }
  .objective-legend>div{min-width:0!important;white-space:normal!important;font-size:11px!important}
  .objective-legend>div:last-child{grid-column:1 / -1!important}
  .objective-cards-track .objective-card{
    flex-basis:82vw!important;
    width:82vw!important;
    min-width:82vw!important;
  }
  .objective-cards-track .objective-add-note{
    flex-basis:54vw!important;
    width:54vw!important;
    min-width:54vw!important;
  }
}

/* v3.9.8 desktop legend: single horizontal row */
@media (min-width: 901px){
  .objective-legend{
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    align-items:center!important;
    gap:12px!important;
    padding:12px 18px!important;
  }
  .objective-legend>div{
    min-width:0!important;
    width:100%!important;
    justify-content:center!important;
    white-space:nowrap!important;
    font-size:12px!important;
  }
}

/* v3.9.10 chunky armored turret card art */
.turret-card-art.armored-card-turret{
  position:absolute!important;
  left:8px!important;
  bottom:5px!important;
  width:62%!important;
  height:auto!important;
  max-height:78%!important;
  overflow:visible!important;
  filter:drop-shadow(0 12px 10px rgba(0,0,0,.7)) drop-shadow(0 0 8px rgba(244,122,31,.12))!important;
}
@media(max-width:900px){
  .turret-card-art.armored-card-turret{width:64%!important;left:8px!important;bottom:6px!important;}
}


/* v3.9.11 photo turret card asset */
.objective-card .turret-card-art.armored-card-turret{
  position:absolute;left:8px;bottom:4px;width:60%;height:76%;object-fit:contain;object-position:left bottom;
  filter:drop-shadow(0 10px 10px rgba(0,0,0,.62));pointer-events:none;
}
@media(max-width:760px){
  .objective-card .turret-card-art.armored-card-turret{left:10px;bottom:8px;width:62%;height:74%;}
}

/* v3.9.12 enlarge approved photo turret art inside HQ assignment cards */
.objective-card .turret-card-art.armored-card-turret{
  left:-4px!important;
  bottom:2px!important;
  width:76%!important;
  height:91%!important;
  max-height:none!important;
  object-fit:contain!important;
  object-position:left bottom!important;
}
.objective-card .objective-meta{
  width:35%!important;
  right:8px!important;
  z-index:3!important;
}
@media(max-width:900px){
  .objective-card .turret-card-art.armored-card-turret{
    left:0!important;
    bottom:4px!important;
    width:74%!important;
    height:88%!important;
  }
  .objective-card .objective-meta{width:36%!important;right:8px!important}
}

/* v3.9.13 compact turret assignment status; keep turret artwork unchanged */
.objective-card .objective-meta strong{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:auto!important;
  max-width:100%!important;
  min-width:0!important;
  padding:3px 5px!important;
  border-radius:4px!important;
  font-size:10px!important;
  line-height:1.05!important;
  letter-spacing:.015em!important;
  white-space:nowrap!important;
  overflow:visible!important;
  text-overflow:clip!important;
}
@media(max-width:900px){
  .objective-card .objective-meta strong{
    padding:3px 4px!important;
    font-size:9px!important;
  }
}

/* v3.9.14 turret card metadata across the top */
.objective-card.turret-settings-card{
  min-height:205px!important;
}
.objective-card.turret-settings-card .objective-meta{
  position:absolute!important;
  left:12px!important;
  right:12px!important;
  top:42px!important;
  width:auto!important;
  display:grid!important;
  grid-template-columns:auto auto auto auto auto 1fr!important;
  align-items:center!important;
  justify-content:start!important;
  column-gap:7px!important;
  row-gap:0!important;
  z-index:4!important;
  white-space:nowrap!important;
}
.objective-card.turret-settings-card .objective-meta span,
.objective-card.turret-settings-card .objective-meta b,
.objective-card.turret-settings-card .objective-meta em,
.objective-card.turret-settings-card .objective-meta strong{
  margin:0!important;
}
.objective-card.turret-settings-card .objective-meta span{
  font-size:8px!important;
  letter-spacing:.09em!important;
}
.objective-card.turret-settings-card .objective-meta strong{
  font-size:9px!important;
  padding:3px 5px!important;
}
.objective-card.turret-settings-card .objective-meta b,
.objective-card.turret-settings-card .objective-meta em{
  font-size:10px!important;
}
.objective-card.turret-settings-card .turret-card-art.armored-card-turret{
  bottom:0!important;
  height:76%!important;
  width:72%!important;
}
@media(max-width:760px){
  .objective-card.turret-settings-card{min-height:220px!important;}
  .objective-card.turret-settings-card .objective-meta{
    left:14px!important;
    right:14px!important;
    top:44px!important;
    grid-template-columns:auto auto auto auto auto auto!important;
    column-gap:8px!important;
  }
  .objective-card.turret-settings-card .turret-card-art.armored-card-turret{
    width:74%!important;
    height:75%!important;
  }
}

/* State Import Pro preview */
.state-import-pro{grid-column:1/-1;border:1px solid rgba(255,111,28,.28);background:linear-gradient(180deg,rgba(255,111,28,.035),rgba(0,0,0,.08));border-radius:18px;padding:18px;margin-top:4px}.state-import-pro .sip-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;border-bottom:1px solid rgba(255,111,28,.22);padding-bottom:14px;margin-bottom:14px}.state-import-pro h3{margin:0;color:#ff7a2b;letter-spacing:.08em}.state-import-pro p{margin:5px 0 0;color:#9b9b9b}.sip-badge{border:1px solid #8a481f;color:#ff9a5a;padding:7px 10px;border-radius:9px;font-size:12px;font-weight:800;white-space:nowrap}.sip-prices{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:14px}.sip-price{background:#0a0d0e;border:1px solid #303536;border-radius:12px;padding:12px}.sip-price span{display:block;color:#c46d3b;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.sip-price strong{font-size:27px;color:#fff}.sip-price small{color:#92999b}.sip-buy{display:grid;grid-template-columns:1fr auto;gap:10px;margin-bottom:15px}.sip-buy input{min-width:0;background:#070a0b;border:1px solid #343a3c;border-radius:10px;padding:13px;color:#fff;font-size:16px}.sip-states-title{font-size:12px;color:#d87740;font-weight:800;letter-spacing:.08em;margin-bottom:8px}.sip-state-list{display:grid;gap:8px}.sip-state{display:flex;align-items:center;justify-content:space-between;gap:10px;background:#090c0d;border:1px solid #2e3335;border-radius:11px;padding:11px 12px}.sip-state strong{color:#fff}.sip-state small{display:block;color:#8d9496;margin-top:2px}.sip-state .button{padding:9px 12px;min-height:0}.sip-note{font-size:11px!important;color:#737b7d!important;margin-top:10px!important}@media(max-width:700px){.sip-prices{grid-template-columns:1fr}.sip-buy{grid-template-columns:1fr}.sip-buy .button{width:100%}.sip-state{align-items:flex-start;flex-direction:column}.sip-state .button{width:100%}.state-import-pro .sip-head{flex-direction:column}}
.sip-info{padding:10px 12px;border:1px solid rgba(255,111,28,.22);border-radius:10px;background:#0a0c0d;font-size:12px!important;color:#aeb3b5!important;margin:0 0 14px!important}.sip-result{min-height:20px;color:#ff9a5a;font-size:12px;font-weight:700;margin:-5px 0 13px}.sip-empty{border:1px dashed #57321d;border-radius:11px;padding:20px;text-align:center;color:#92999b;background:#090b0c}.sip-admin-link{display:inline-flex;margin-top:12px;color:#ff8a43;font-weight:800;text-decoration:none;border:1px solid #63391f;border-radius:9px;padding:9px 12px}

.sip-signin{display:grid;gap:12px;justify-items:center}.sip-signin-button{display:inline-flex;align-items:center;justify-content:center;min-width:150px;text-decoration:none}
.sip-checkout-button{display:inline-flex;margin:8px 0 0 8px;vertical-align:middle}

/* Minimal Pro billing access; preserves the existing planner header layout. */
.header-pro-actions{display:flex;align-items:center;gap:10px}.header-manage-pro{display:inline-flex;min-height:34px;align-items:center;padding:0 10px;border:1px solid rgba(244,122,31,.55);border-radius:7px;background:rgba(244,122,31,.08);color:#ffd2ad;font-size:10px;font-weight:850;letter-spacing:.06em;text-decoration:none;text-transform:uppercase}.header-manage-pro:hover{border-color:var(--site-orange);color:#fff}
@media(max-width:560px){.header-pro-actions{gap:6px}.header-manage-pro{min-height:30px;padding:0 7px;font-size:8px}}
