:root {
    color-scheme: light;
    --ink: #203b32;
    --muted: #63766b;
    --paper: #f4f6f1;
    --surface: #ffffff;
    --line: #d7dfd7;
    --land: #a9c0a2;
    --coast: #d8bd84;
    --sea: #b6d0ce;
    --blocked: #b6b7b0;
    --accent: #b85e43;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; line-height: 1.5; }
a { color: inherit; }
button, input, select { font: inherit; }
.app-shell { min-height: 100vh; }
.topbar { min-height: 64px; padding: 0 32px; display: flex; align-items: center; gap: 28px; background: var(--ink); color: #f7f8f4; }
.brand { font-family: Georgia, "Times New Roman", serif; font-size: 20px; text-decoration: none; }
.topbar-link { color: #dce6df; font-size: 14px; text-decoration: none; }
.topbar-link:hover, .topbar-link:focus-visible { color: #fff; text-decoration: underline; }
.topbar-note { margin-left: auto; color: #c0cec5; font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.page-content, .editor-page { width: min(1200px, calc(100% - 48px)); margin: 0 auto; }
.page-content { padding: 52px 0 80px; }
.page-intro, .editor-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { margin-bottom: 8px; font-size: 38px; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 22px; }
h3 { margin-bottom: 4px; font-size: 16px; }
.intro-copy { margin-bottom: 0; color: var(--muted); }
.template-count { margin: 0 0 2px; display: flex; align-items: baseline; gap: 9px; color: var(--muted); font-size: 13px; }
.template-count strong { color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 28px; font-weight: 500; }
.create-section, .saved-section { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.section-heading { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; }
.create-form { display: flex; gap: 10px; max-width: 640px; }
.create-form input, .region-form input[type="text"], .region-form select { min-height: 44px; width: 100%; padding: 9px 12px; border: 1px solid #bbc8be; border-radius: 4px; background: var(--surface); color: var(--ink); }
.create-form input:focus, .region-form input[type="text"]:focus, .region-form select:focus { border-color: #52745c; outline: 3px solid #dce8dd; }
.button { min-height: 42px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 4px; font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover, .button-primary:focus-visible { background: #315c4a; }
.button-secondary { border-color: #bfcac1; background: transparent; color: var(--ink); }
.button-secondary:hover, .button-secondary:focus-visible { border-color: var(--ink); background: #eaf0e9; }
.template-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.template-row { min-height: 88px; padding: 16px 4px; display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.template-mark { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #a8bbaa; border-radius: 4px; background: #e4ece3; color: #315c4a; font-family: Georgia, "Times New Roman", serif; font-size: 21px; }
.template-info { min-width: 0; flex: 1; }
.template-info h3 a { text-decoration: none; }
.template-info h3 a:hover, .template-info h3 a:focus-visible { color: var(--accent); text-decoration: underline; }
.template-info p { margin: 0; color: var(--muted); font-size: 13px; }
.empty-state { margin: 0; padding: 24px 0; color: var(--muted); }
.messages { margin: 20px 0 0; padding: 0; list-style: none; }
.message { padding: 10px 14px; border-left: 3px solid #52745c; background: #e8efe7; color: var(--ink); font-size: 14px; }
.message + .message { margin-top: 6px; }
.message-error { border-color: var(--accent); background: #f6e9e4; }
.editor-page { padding: 34px 0 64px; }
.editor-intro { margin-bottom: 24px; align-items: center; }
.editor-intro > div { min-width: 0; max-width: 100%; }
.editor-intro h1 { font-size: 32px; overflow-wrap: anywhere; }
.editor-wizard { margin-bottom: 22px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.wizard-steps { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); list-style: none; border-bottom: 1px solid var(--line); }
.wizard-steps li { min-width: 0; }
.wizard-steps button { width: 100%; min-height: 83px; padding: 13px 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; cursor: pointer; }
.wizard-steps button:hover:not(:disabled) { background: #f0f5ed; color: var(--ink); }
.wizard-steps button[aria-current="step"] { border-bottom-color: var(--accent); background: #eef3ea; color: var(--ink); }
.wizard-steps button:disabled { cursor: not-allowed; opacity: .5; }
.wizard-steps button:focus-visible { position: relative; outline: 3px solid #8da98e; outline-offset: -3px; }
.wizard-step-number { width: 27px; height: 27px; flex: 0 0 auto; display: inline-grid; place-items: center; border: 1px solid #bccabd; border-radius: 50%; font-size: 13px; }
.wizard-steps button[aria-current="step"] .wizard-step-number { border-color: var(--ink); background: var(--ink); color: white; }
.wizard-actions { padding: 13px 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.wizard-actions p { margin: 0 0 0 6px; flex: 1 1 240px; color: var(--muted); font-size: 12px; }
.wizard-actions p.save-error { color: #8b3e2c; font-weight: 700; }
.wizard-step-intro { margin: 0 0 20px; }
.wizard-step-intro h2 { margin-bottom: 9px; }
.wizard-step-intro > p:not(.eyebrow) { max-width: 980px; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.wizard-step-intro > .wizard-pending, .wizard-pending { padding: 10px 12px; border-left: 3px solid #c39a43; background: #fff7e6; color: #72522f; font-size: 12px; }
.wizard-resume { padding: 11px 13px; border-left: 3px solid #52745c; background: #e8efe7; font-size: 13px; }
.wizard-resume a { font-weight: 700; }
.editor-layout.wizard-overview-layout { grid-template-columns: 1fr; }
.wizard-overview { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.wizard-overview h3 { font-size: 18px; }
.wizard-overview-count, #wizard-overview-count { color: var(--muted); font-size: 13px; }
.wizard-overview-scroll { margin-top: 16px; max-height: 430px; overflow: auto; }
.wizard-overview-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.wizard-overview-table th { position: sticky; top: 0; padding: 10px 8px; background: #eef3ea; color: var(--ink); }
.wizard-overview-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.overview-region-button { padding: 3px 0; border: 0; background: transparent; color: var(--ink); font-weight: 700; text-align: left; cursor: pointer; }
.overview-region-button:hover, .overview-region-button:focus-visible { color: var(--accent); text-decoration: underline; }
.region-field-group > label { display: block; margin: 15px 0 6px; font-size: 13px; font-weight: 700; }
.region-selection-panel { padding: 18px; border-bottom: 1px solid var(--line); }
.region-selection-panel h2 { margin: 0 0 14px; font-size: 20px; }
.region-selection-panel > label:not(.layer-toggle) { display: block; margin-top: 12px; font-size: 13px; font-weight: 700; }
.region-selection-panel select, .region-selection-panel input[type="search"] { display: block; width: 100%; min-height: 38px; margin-top: 6px; padding: 7px 9px; border: 1px solid #bbc8be; border-radius: 4px; background: white; font: inherit; }
.selection-multi { margin-top: 13px; padding: 9px 11px; border: 1px solid #bbc8be; border-radius: 4px; background: #f4f7ef; font-size: 14px; font-weight: 700; }
.selection-summary { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.selection-clear { border: 0; background: transparent; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
.selection-clear:disabled { opacity: .5; cursor: default; }
.selection-chosen { max-height: 150px; overflow: auto; margin: 10px 0 0; padding: 0; list-style: none; }
.selection-chosen li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; margin: 4px 0; background: #fff0e7; border-left: 3px solid var(--accent); border-radius: 3px; font-size: 13px; }
.selection-chosen span { overflow-wrap: anywhere; }
.selection-remove { flex: 0 0 28px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 22px; }
.selection-region-list { max-height: 235px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 4px; }
.selection-list-item { width: 100%; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; border-bottom: 1px solid var(--line); background: white; color: var(--ink); text-align: left; cursor: pointer; font-size: 13px; }
.selection-list-item:last-child { border-bottom: 0; }
.selection-list-item[aria-pressed="true"] { background: #fff0e7; box-shadow: inset 3px 0 var(--accent); font-weight: 700; }
.selection-list-item:hover, .selection-list-item:focus-visible { background: #edf3e9; }
.selection-list-item small { flex-shrink: 0; color: var(--muted); font-size: 11px; font-weight: 400; }
.selection-list-item span { min-width: 0; overflow-wrap: anywhere; }
.selection-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.selection-toolbar .field-note { flex: 1 1 280px; margin: 0; }
.selection-analysis-settings { margin-top: 8px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; }
.selection-analysis-settings summary { color: var(--muted); cursor: pointer; font-weight: 700; }
.selection-analysis-settings .import-options { margin-top: 14px; }
.selection-hit-parts path { fill: transparent; stroke: none; pointer-events: none; }
.selected-region-summary { margin: 8px 0 12px; font-size: 14px; overflow-wrap: anywhere; }
#test-map-svg:not([data-editor-step="5"]) .supply-marker { pointer-events: none; cursor: default; }
#test-map-svg.is-saving { pointer-events: none; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .75fr); align-items: start; gap: 20px; }
.map-panel, .inspector { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.panel-heading { min-height: 72px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-heading .eyebrow { margin-bottom: 2px; }
.panel-heading h2 { font-size: 20px; }
.map-dimension { color: var(--muted); font-size: 12px; }
.map-frame { padding: 14px; background: #f8faf7; }
.test-map { width: 100%; height: auto; aspect-ratio: 760 / 460; display: block; border: 1px solid #d4dfd8; border-radius: 4px; background: #e7f0ee; }
.test-map .water { fill: #e7f0ee; }
.test-map .region-label { fill: var(--ink); font: 600 20px Georgia, serif; text-anchor: middle; pointer-events: none; }
.test-map .region-caption { fill: #50665b; font: 12px Arial, sans-serif; text-anchor: middle; pointer-events: none; }
.test-map .sea-decoration { fill: none; stroke: #9bbcb8; stroke-width: 2; stroke-linecap: round; opacity: .75; pointer-events: none; }
.map-region { fill-rule: evenodd; stroke: none; cursor: pointer; transition: fill 150ms ease; }
.map-region.terrain-land { fill: var(--land); }
.map-region.terrain-coast { fill: var(--coast); }
.map-region.terrain-sea { fill: var(--sea); }
.map-region.terrain-blocked { fill: url(#blocked-region-hatch) #b6b7b0; }
.map-region:hover, .map-region:focus { filter: brightness(1.08); outline: none; }
.map-decoration, [data-layer="symbols"] { pointer-events: none; }
.map-borders { fill: none; stroke: #425f54; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.selected-region-outline { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.supply-marker { pointer-events: all; cursor: grab; touch-action: none; user-select: none; }
.supply-marker.is-dragging { cursor: grabbing; }
.supply-marker.invalid-position .sc-star { fill: #78302f; }
.supply-marker:focus-visible .sc-star-halo, .supply-marker.is-dragging .sc-star-halo { stroke: #ffe5a1; stroke-width: 7; }
.sc-star-halo { fill: none; stroke: #fff; stroke-width: 5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sc-star { fill: var(--sc-fill, #efc14f); stroke: #27303b; stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.supply-marker text { fill: #fff; font: 700 10px Arial, sans-serif; text-anchor: middle; dominant-baseline: central; }
.supply-marker[hidden] { display: none; }
.imported-map-stage { position: relative; width: 100%; overflow: hidden; border: 1px solid #d4dfd8; border-radius: 4px; background: #fff; }
.imported-map-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.imported-map-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.imported-map-svg .map-region { fill-opacity: 1; }
.unassigned-area { fill: url(#unassigned-hatch); stroke: #b85e43; stroke-width: .75; vector-effect: non-scaling-stroke; }
.swatch-unassigned { background: repeating-linear-gradient(135deg,#fff0e7 0 4px,#b85e43 4px 6px); }
.map-layer-controls { padding: 10px 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.layer-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.layer-toggle input { accent-color: var(--accent); }
.layer-opacity { display: inline-flex; align-items: center; gap: 7px; }
.layer-opacity input { width: 100px; accent-color: var(--accent); }
.layer-opacity output { min-width: 34px; font-variant-numeric: tabular-nums; }
.sc-position-tools { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #f8faf7; }
.sc-position-tools .field-note { margin: 0 0 9px; }
.sc-position-tools .button { min-height: 34px; padding: 5px 8px; font-size: 12px; white-space: normal; }
.sc-position-tools #sc-position-status { margin: 9px 0 0; }
.geometry-warning { color: #814c30; background: #fff4e8; }
.geometry-diagnostics { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 13px; }
.geometry-diagnostics summary { font-weight: 700; cursor: pointer; }
.geometry-diagnostics ul { margin-bottom: 0; padding-left: 20px; }
.geometry-diagnostics li + li { margin-top: 4px; }
.candidate-shape { cursor: pointer; }
.candidate-shape:hover, .candidate-shape:focus-visible { stroke: #78302f; stroke-width: 2; outline: none; }
.candidate-shape[aria-pressed="true"] { stroke: #78302f; stroke-width: 2.5; }
.candidate-select[aria-pressed="true"] { background: #fff0e7; border-color: #78302f; }
.geometry-assignment-summary { margin: 10px 0; padding: 12px 14px 12px 28px; border: 1px solid #c6d4dc; border-radius: 4px; background: #f0f5f7; font-size: 13px; overflow-wrap: anywhere; }
.geometry-assignment-summary li + li { margin-top: 7px; }
.geometry-operation-form .geometry-assignment-summary { max-height: 200px; overflow-y: auto; }
.geometry-inline-error { padding: 12px; color: #78302f; background: #fff0e7; border-left: 3px solid #78302f; }
.geometry-review-page[aria-busy="true"] .map-panel { pointer-events: none; }
.target-region-outline { stroke: #246a97; stroke-width: 2.5; stroke-dasharray: 5 3; }
.preview-supply-marker { pointer-events: none; cursor: default; }
.geometry-operation-panel { position: static; }
.geometry-operation-form label:not(.checkbox-row):not(.replace-confirmation) { margin: 13px 0 5px; display: block; font-size: 13px; font-weight: 700; }
.geometry-operation-form select { font-size: 13px; }
.geometry-conflicts { margin-top: 13px; padding: 10px; border-left: 3px solid #c39a43; background: #fff8e8; }
.geometry-conflicts .replace-confirmation { margin: 15px 0 0; font-size: 12px; }
.geometry-conflicts .replace-confirmation input { min-width: 17px; }
.geometry-operation-form .checkbox-row { align-items: start; font-size: 12px; }
.geometry-operation-form .checkbox-row input { flex: 0 0 auto; }
.island-filter-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.island-filter-controls > label:first-child { display: inline-flex; align-items: center; gap: 9px; }
.island-filter-controls input[type="number"] { width: 105px; min-height: 36px; padding: 6px 9px; border: 1px solid #bbc8be; border-radius: 4px; }
.geometry-candidate-list { max-height: 340px; margin: 16px 0 0; padding: 0; overflow: auto; list-style: none; }
.geometry-candidate-row { padding: 9px 0; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); font-size: 12px; }
.geometry-candidate-row .button { min-height: 32px; max-width: 45%; padding: 5px 9px; overflow-wrap: anywhere; white-space: normal; font-size: 11px; }
.geometry-operation-history { padding-left: 20px; font-size: 13px; overflow-wrap: anywhere; }
.geometry-operation-history li + li { margin-top: 6px; }
.geometry-parts-heading { margin: 20px 0 0; }
.geometry-accept-section .geometry-warning { padding: 12px; font-size: 13px; overflow-wrap: anywhere; }
.geometry-final-actions { margin-top: 15px; display: flex; flex-wrap: wrap; align-items: end; gap: 14px 22px; }
.geometry-final-actions .replace-confirmation { max-width: 550px; font-size: 13px; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.imported-region-label { fill: var(--ink); font: 700 18px Arial, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.adaptive-region-label { dominant-baseline: central; stroke-width: .16em; }
.adaptive-region-label.is-abbreviated { fill: #152d24; stroke-width: .22em; }
.adaptive-region-label:focus-visible { outline: 2px solid #276781; outline-offset: 2px; }
.map-label-tooltip { position: fixed; z-index: 10000; max-width: min(28rem, calc(100vw - 24px)); padding: .45rem .65rem; border-radius: .4rem; background: #172d25; color: #fff; box-shadow: 0 2px 8px #0004; pointer-events: none; overflow-wrap: anywhere; }
.map-label-tooltip[hidden] { display: none; }
.map-unit-label { text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: .16em; stroke-linejoin: round; pointer-events: none; }
.map-legend { padding: 12px 17px 15px; display: flex; flex-wrap: wrap; gap: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 13px; height: 13px; border: 1px solid #81988a; border-radius: 2px; }
.legend-star { width: 20px; height: 20px; overflow: visible; }
.swatch-land { background: var(--land); }
.swatch-coast { background: var(--coast); }
.swatch-sea { background: var(--sea); }
.swatch-blocked { background: repeating-linear-gradient(135deg, #b6b7b0 0 5px, #969b92 5px 6px); border-color: #777f74; }
.region-conflict { padding: 10px 12px; border-left: 3px solid #a45236; background: #fff0e7; color: #7c3725; }
.legend-center { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 8px; font-style: normal; font-weight: 700; }
.inspector { position: sticky; top: 16px; }
@media (min-width: 761px) {
    /* Keep a tall sticky editor usable while the separate connections panel grows. */
    #wizard-map-layout > .inspector {
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
        scrollbar-gutter: stable;
    }
}
.inspector-heading { min-height: 72px; }
.inspector-empty { min-height: 190px; padding: 26px 22px; display: grid; align-content: center; justify-items: start; color: var(--muted); }
.inspector-empty p { max-width: 240px; margin: 14px 0 0; font-size: 14px; }
.selection-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #b9c9bc; border-radius: 50%; color: #52745c; font-size: 22px; }
.region-form { padding: 18px; }
.region-form > label:not(.checkbox-row) { margin: 15px 0 6px; display: block; color: var(--ink); font-size: 13px; font-weight: 700; }
.region-id-line { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.region-id-line code { margin-left: 5px; color: var(--ink); font-size: 12px; }
.checkbox-row { margin-top: 16px; display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; }
.checkbox-row input { width: 17px; height: 17px; accent-color: #52745c; }
.checkbox-row input:disabled + span { color: #89968d; }
.field-note { margin: 13px 0 0; color: var(--muted); font-size: 12px; }
.save-button { width: 100%; margin-top: 18px; }
.inspector-footnote { margin: 0; padding: 13px 18px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.image-import-section { margin-top: 22px; padding: 22px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.image-import-section .section-heading { margin-bottom: 10px; }
.import-intro { max-width: 820px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.image-import-form { display: grid; gap: 16px; }
.import-file-field label, .image-import-form label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 13px; font-weight: 700; }
.import-file-field input[type="file"] { width: 100%; padding: 10px; border: 1px dashed #9fb1a4; border-radius: 4px; background: #f8faf7; }
.import-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.import-options input[type="range"] { width: 100%; accent-color: #52745c; }
.import-options input[type="number"] { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #bbc8be; border-radius: 4px; }
.import-options output { margin-left: 6px; color: var(--accent); font-variant-numeric: tabular-nums; }
.image-import-form > .button { justify-self: start; }
.import-review-page > .import-warning { margin: 0 0 20px; padding: 12px 15px; border-left: 3px solid #c39a43; background: #f7f0df; color: #594b2b; font-size: 14px; }
.reanalyze-form { margin: 0 0 20px; padding: 15px 18px; display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)) auto; align-items: end; gap: 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.reanalyze-form label { margin-bottom: 5px; display: block; color: var(--ink); font-size: 12px; font-weight: 700; }
.reanalyze-form input[type="range"] { width: 100%; accent-color: #52745c; }
.reanalyze-form input[type="number"] { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid #bbc8be; border-radius: 4px; }
.reanalyze-form output { margin-left: 5px; color: var(--accent); font-variant-numeric: tabular-nums; }
.import-detail-note, .reanalyze-form > .import-boundary-settings { grid-column: 1 / -1; }
.import-boundary-settings { padding: 12px; border: 1px solid var(--line); border-radius: 4px; }
.import-boundary-settings summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.import-boundary-settings > label { margin-top: 12px; }
.import-boundary-settings input { max-width: 220px; padding: 8px; border: 1px solid #bbc8be; border-radius: 4px; }
.import-boundary-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.import-boundary-fields input { width: 100%; }
.import-diagnostics { margin-bottom: 20px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.import-diagnostics dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 12px; }
.import-diagnostics dt { color: var(--muted); font-size: 12px; }
.import-diagnostics dd { margin: 4px 0 0; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.import-detail-limited { margin: 12px 0 0; padding: 9px 12px; border-left: 3px solid #c39a43; background: #f7f0df; font-size: 13px; }
.import-review-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .85fr); align-items: start; gap: 20px; }
.import-review-layout > * { min-width: 0; }
.preview-map-frame { padding: 14px; background: #f8faf7; }
.import-preview-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.import-view-switch, .import-zoom-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.import-preview-toolbar .button { padding: 7px 10px; font-size: 12px; }
.import-view-switch [aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.import-zoom-tools output { min-width: 48px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.import-label-toggle { display: flex; align-items: center; gap: 4px; margin-right: 5px; font-size: 12px; cursor: pointer; }
.import-label-toggle input { accent-color: var(--accent); }
.import-preview-viewport { max-height: 640px; overflow: auto; overscroll-behavior: contain; }
.import-preview-stage { position: relative; width: 100%; overflow: hidden; border: 1px solid #d4dfd8; border-radius: 4px; background: #fff; }
.import-preview-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.import-diagnostic-raster { image-rendering: pixelated; }
.import-preview-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.preview-region { fill-opacity: 1; stroke: none; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity 120ms ease; }
.preview-region:hover, .preview-region:focus { stroke: var(--accent); stroke-width: 3; outline: none; }
.preview-region.is-excluded { fill: url(#import-unassigned-hatch); fill-opacity: 1; stroke-dasharray: 5 4; }
.import-unassigned-area { fill: url(#import-unassigned-hatch); stroke: #b85e43; stroke-width: .75; vector-effect: non-scaling-stroke; }
.import-shared-borders { fill: none; stroke: #34433b; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.import-boundary-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.import-outside-boundary { fill: #687269; fill-opacity: .35; }
.import-boundary-outline { fill: none; stroke: #a75831; stroke-width: 1; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; }
.preview-region-label { fill: #172d25; font: 700 13px Arial, sans-serif; text-anchor: middle; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.preview-help { margin: 0; padding: 10px 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.import-region-list { position: static; }
.detected-region-list { max-height: 360px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.detected-region-row { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.detected-region-row label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.detected-region-row input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--accent); }
.detected-swatch { width: 14px; height: 14px; flex: 0 0 auto; border: 1px solid #65786d; border-radius: 3px; background: var(--region-color); }
.detected-region-name { min-width: 0; flex: 1; font-size: 13px; font-weight: 700; }
.detected-region-meta { margin: 3px 0 0 40px; display: block; color: var(--muted); font-size: 11px; }
.detected-region-row.is-excluded .detected-region-name { color: #8a918c; text-decoration: line-through; }
.accept-import-controls { padding: 16px; border-top: 1px solid var(--line); }
.replace-confirmation { margin-bottom: 12px; display: flex !important; align-items: start; gap: 8px; color: #7a3e2e !important; line-height: 1.4; }
.replace-confirmation input { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--accent); }
.import-review-page .message-error { margin: 0 0 16px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.connection-inspector { padding: 16px 18px; border-top: 1px solid var(--line); background: #f8faf7; }
.connection-inspector > summary, .connection-edit-section > summary { cursor: pointer; font-size: 14px; font-weight: 700; }
.connection-inspector label:not(.connection-key):not(.replace-confirmation) { display: block; margin: 12px 0 5px; font-size: 12px; font-weight: 700; }
.connection-inspector select, .connection-inspector input[type="text"] { width: 100%; min-height: 36px; padding: 6px 9px; border: 1px solid #bbc8be; border-radius: 4px; background: #fff; font-size: 12px; }
.connection-inspector h3 { margin: 13px 0 7px; font-size: 13px; }
.connection-layer-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 12px 0; font-size: 12px; }
.connection-key { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.connection-key::before { content: ""; width: 21px; height: 0; border-top: 3px solid; }
.connection-key-geographic::before { border-color: #ab5b19; border-top-style: dashed; }
.connection-key-army::before { border-color: #81378d; border-top-style: dotted; }
.connection-key-fleet::before { border-color: #146fb2; }
.connection-key input { accent-color: var(--accent); }
.connection-lists { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.connection-lists ul, .connection-diagnostics ul { margin: 0; padding-left: 16px; font-size: 12px; }
.connection-lists li + li, .connection-diagnostics li + li { margin-top: 5px; }
.connection-region-button { padding: 2px 0; border: 0; background: transparent; color: #2b6150; text-align: left; text-decoration: underline; font: inherit; cursor: pointer; }
.connection-region-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.connection-edit-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.connection-edit-form { display: grid; grid-template-columns: minmax(100px,1fr) minmax(160px,2fr); align-items: center; gap: 6px 12px; margin: 12px 0; }
.connection-edit-form label { margin: 0 !important; }
.connection-edit-form .field-note, .connection-edit-form .button { grid-column: 1 / -1; }
.connection-edit-form .button { justify-self: start; }
.connection-override-list { padding-left: 16px; font-size: 12px; }
.connection-coast-row { display: flex; gap: 12px; align-items: end; }
.connection-coast-row label { flex: 1; }
.connection-coast-row .connection-region-button { flex-shrink: 0; margin-bottom: 15px; font-size: 12px; }
.connection-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.connection-inspector .button { min-height: 36px; padding: 6px 10px; font-size: 12px; white-space: normal; }
.connection-confirmation { margin-top: 15px; padding: 12px; border: 1px solid #a5bbb1; background: #fff; }
.connection-confirmation ul { padding-left: 18px; font-size: 12px; }
.connection-confirmation li + li { margin-top: 7px; }
.connection-confirmation .replace-confirmation { margin-top: 12px; font-size: 12px; }
.connection-diagnostics { padding-top: 10px; }
#connection-conflicts { color: #8c3f32; }
.connection-outline { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.connection-outline-geographic { stroke: #ab5b19; stroke-width: 6; stroke-dasharray: 10 5; }
.connection-outline-army { stroke: #81378d; stroke-width: 3.8; stroke-dasharray: 1 6; }
.connection-outline-fleet, .connection-outline-fleet-coast { stroke: #146fb2; stroke-width: 2.3; }
.connection-outline-source-coast { stroke: #053e64; stroke-width: 4; }
.connection-outline-component { stroke: #bf6714; stroke-width: 6; }
.connection-outline-proposal-0 { stroke: #a84b2c; stroke-width: 5; }
.connection-outline-proposal-1 { stroke: #277494; stroke-width: 5; }
.connection-outline-proposal-2 { stroke: #713983; stroke-width: 5; }
.connection-outline-proposal-3 { stroke: #41743e; stroke-width: 5; }
.connection-outline-proposal-4 { stroke: #916422; stroke-width: 5; }
.connection-outline-proposal-5 { stroke: #b33169; stroke-width: 5; }
.connection-proposal-color-0 { color: #a84b2c; }
.connection-proposal-color-1 { color: #277494; }
.connection-proposal-color-2 { color: #713983; }
.connection-proposal-color-3 { color: #41743e; }
.connection-proposal-color-4 { color: #916422; }
.connection-proposal-color-5 { color: #b33169; }

.map-completion { margin: 20px 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.map-completion .section-heading { margin-bottom: 12px; align-items: start; gap: 12px; }
.map-completion h2 { margin: 0; }
.map-completion h3 { margin: 0 0 10px; font-size: 14px; }
.map-completion > p { font-size: 13px; line-height: 1.6; }
.completion-badge { flex-shrink: 0; padding: 6px 10px; border-radius: 20px; background: #f0e8d9; color: #795320; font-size: 12px; font-weight: 700; }
.completion-badge.is-complete { background: #e2f0e6; color: #20583b; }
.completion-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.completion-results > section { padding: 14px; border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.completion-results ul, .completion-coast-proposals ul { margin: 0; padding-left: 18px; font-size: 12px; }
.completion-results li + li, .completion-coast-proposals li + li { margin-top: 9px; }
.completion-errors h3 { color: #8c3f32; }
.completion-warnings h3 { color: #795320; }
.completion-issue-button { display: block; width: 100%; padding: 4px 0; border: 0; background: transparent; font: inherit; color: #79382d; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.completion-warnings .completion-issue-button { color: #795320; }
.completion-issue-button:hover { text-decoration: underline; }
.completion-issue-button[aria-pressed="true"] { font-weight: 700; }
.completion-issue-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.completion-issue-location { display: block; margin-top: 4px; color: #2b6150; font-size: 11px; text-decoration: underline; }
.completion-coast-proposals { margin: 18px 0; padding: 14px; border-left: 3px solid #277494; background: #f2f7fa; }
.completion-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0 10px; }
.completion-actions .button { white-space: normal; }
.completion-map-layer { pointer-events: none; }
.completion-problem-path { fill: #df674029; stroke: #af3c25; stroke-width: 4; stroke-dasharray: 7 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.completion-problem-warning { fill: #bd932125; stroke: #9b7515; }
.completion-proposal-path { fill: none; stroke: #146fb2; stroke-width: 6; stroke-dasharray: none; }

@media (max-width: 760px) {
    .wizard-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .wizard-steps button { min-height: 62px; padding: 10px; }
    .wizard-actions p { flex-basis: 100%; margin-left: 0; }
    .topbar { min-height: 58px; padding: 0 18px; gap: 18px; }
    .page-content, .editor-page { width: min(100% - 32px, 640px); }
    .page-content { padding-top: 34px; }
    .page-intro, .editor-intro { align-items: start; }
    h1 { font-size: 32px; }
    .editor-layout { grid-template-columns: 1fr; }
    .import-review-layout { grid-template-columns: 1fr; }
    .import-options { grid-template-columns: 1fr; }
    .reanalyze-form { grid-template-columns: 1fr; }
    .import-boundary-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .import-diagnostics dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inspector { position: static; }
    .connection-lists { grid-template-columns: 1fr; }
    .connection-edit-form { grid-template-columns: 1fr; }
    .connection-edit-form .field-note, .connection-edit-form .button { grid-column: 1; }
    .completion-results { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .wizard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wizard-actions .button { min-height: 38px; padding: 7px 10px; font-size: 12px; }
    .topbar-note { font-size: 9px; }
    .topbar-link { font-size: 12px; }
    .create-form { align-items: stretch; flex-direction: column; }
    .template-row { gap: 10px; }
    .template-mark { width: 36px; height: 36px; }
    .template-row .button { padding: 8px 10px; font-size: 12px; }
    .editor-intro { flex-direction: column; }
    .map-frame { padding: 8px; }
}

.map-layout-tools { margin-top: 18px; padding-top: 12px; border-top: 1px solid #d6dfd5; }
.map-layout-tools summary { cursor: pointer; font-weight: 700; }
.map-layout-tools label { display: block; font-size: 12px; font-weight: 650; margin: 12px 0 5px; }
.map-layout-tools button { margin-top: 8px; }
.is-placing-layout, .is-placing-layout .map-region { cursor: crosshair; }
.is-placing-sc, .is-placing-sc .map-region, .is-placing-sc [data-supply-for] { cursor: crosshair; }
.map-coast-label { fill: #314e63; font-weight: 600; pointer-events: none; }
.map-layout-tools .coast-merge-source { display: flex; align-items: center; gap: 8px; }
.map-layout-tools .coast-merge-source input { width: auto; min-height: auto; margin: 0; }

.beta-badge { padding: .15rem .45rem; border: 1px solid currentColor; border-radius: .4rem; font-size: .72rem; opacity: .75; white-space: nowrap; }
