:root{--ink:#17130f;--muted:#6e6455;--paper:#e8d8b8;--panel:#f1e4c9;--red:#a43b2f;--red-dark:#70251f;--gold:#c89a48;--green:#68725e;--line:rgba(47,36,23,.28);--shadow:0 20px 70px rgba(31,22,13,.24)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%}body{color:var(--ink);background:radial-gradient(circle at 12% 8%,#fff8e8 0,transparent 28%),linear-gradient(135deg,#e6d5b3,#cdb58b);font-family:"Noto Serif SC","Songti SC",SimSun,serif;overflow-x:hidden}button,input{font:inherit}button{color:inherit}.grain{position:fixed;inset:0;pointer-events:none;z-index:50;opacity:.1;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");mix-blend-mode:multiply}
.topbar{height:82px;display:flex;align-items:center;justify-content:space-between;padding:0 2rem;border-bottom:1px solid var(--line);background:rgba(236,221,191,.88);backdrop-filter:blur(14px)}.brand{display:flex;flex-direction:column;align-items:flex-start;gap:.2rem;border:0;background:none;cursor:pointer}.brand-cn{font-size:1.5rem;font-weight:900;letter-spacing:.2em}.brand-en{font:700 .75rem Georgia,serif;letter-spacing:.12em;color:var(--muted)}.top-actions{display:flex;gap:.7rem;align-items:center}.text-button,.round-button,.jump-button{border:1px solid var(--line);background:rgba(255,255,255,.2);cursor:pointer;transition:.2s}.text-button{padding:.65rem 1rem;font-size:.875rem;letter-spacing:.08em}.round-button{width:2.25rem;height:2.25rem;border-radius:50%;font:italic 1rem Georgia,serif}.text-button:hover,.round-button:hover,.jump-button:hover{background:var(--ink);color:var(--paper)}
.workspace{min-height:calc(100vh - 82px);display:grid;grid-template-columns:minmax(0,1fr) 410px}.atlas{min-width:0;padding:1.5rem 1.75rem 1rem 2rem;display:flex;flex-direction:column}.map-header{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:.8rem}.eyebrow{margin:0 0 .35rem;color:var(--red);font:700 .75rem/1.2 Georgia,serif;letter-spacing:.18em}h1{margin:0;font-size:clamp(1.5rem,2.1vw,2.2rem);line-height:1.18;letter-spacing:.03em}.map-status{display:flex;align-items:center;gap:.7rem;color:var(--muted);font-size:.8rem}.map-status i{width:1px;height:1rem;background:var(--line)}
.map-stage{position:relative;flex:1;min-height:510px;border:1px solid var(--line);overflow:hidden;box-shadow:inset 0 0 90px rgba(86,62,31,.12);background:linear-gradient(rgba(76,57,31,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(76,57,31,.05) 1px,transparent 1px),radial-gradient(ellipse at center,#ecdfc2 0,#d9c39b 100%);background-size:42px 42px,42px 42px,auto}#menaMap{width:100%;height:100%;min-height:510px;display:block;transition:view-box .6s}.land-shadow path{fill:#6b5435;opacity:.18;transform:translateY(10px)}#menaMap.real-mode .land-shadow{display:none}.countries[hidden]{display:none}.countries path{fill:var(--polity-color,#a44e3b);stroke:#f0dfb8;stroke-width:2;vector-effect:non-scaling-stroke;cursor:pointer;transform-box:fill-box;transform-origin:center;transition:transform .22s ease,fill .28s,filter .22s,opacity .22s}.real-countries path{stroke-width:1.35}.countries path:hover,.countries path.keyboard-focus{transform:translateY(-9px);filter:url(#liftShadow) brightness(1.14)}.countries path.selected{filter:url(#liftShadow) brightness(.92);stroke:#fff0cf;stroke-width:3}.countries path.dimmed{opacity:.21}.countries path.dependent{stroke-dasharray:6 3}.countries path.disputed{fill:url(#hatch) var(--polity-color,#9a694a);stroke-dasharray:5 3}.region-lines{pointer-events:none;opacity:0;transition:opacity .35s .18s}.region-lines.visible{opacity:1}.region-lines line{stroke:#fff1d1;stroke-width:1.5;stroke-dasharray:5 3;vector-effect:non-scaling-stroke}.region-lines text{fill:#fff3d7;font-size:12px;font-weight:700;text-anchor:middle;paint-order:stroke;stroke:#57221e;stroke-width:3px}.map-labels text{fill:#fff0d0;font-size:12px;font-weight:800;letter-spacing:.04em;text-anchor:middle;pointer-events:none;paint-order:stroke;stroke:rgba(67,29,23,.8);stroke-width:3px}.sea-label{position:absolute;color:rgba(60,77,74,.64);text-align:center;letter-spacing:.5em;font-weight:800;pointer-events:none}.sea-label small{display:block;margin-top:.2rem;font:700 .75rem Georgia,serif;letter-spacing:.18em}.mediterranean{top:17%;left:24%;transform:rotate(-5deg)}.red-sea{left:52%;bottom:20%;transform:rotate(67deg);font-size:.8rem}.compass circle{fill:none;stroke:rgba(67,50,31,.55)}.compass path{fill:var(--red);stroke:#efdbb2}.compass text{text-anchor:middle;font:12px Georgia,serif;fill:#4d3d29}.map-hint{position:absolute;top:.9rem;left:.9rem;display:flex;align-items:center;gap:.55rem;padding:.5rem .7rem;background:rgba(239,225,194,.86);border:1px solid var(--line);color:var(--muted);font-size:.8rem}.mouse-icon{width:13px;height:19px;border:1px solid var(--muted);border-radius:8px;position:relative}.mouse-icon:after{content:"";position:absolute;width:2px;height:5px;background:var(--red);top:3px;left:5px}.legend{position:absolute;left:1rem;bottom:.9rem;display:flex;gap:1rem;color:#564936;font-size:.75rem}.legend span{display:flex;align-items:center;gap:.35rem}.swatch{width:14px;height:10px;border:1px solid rgba(76,53,32,.6)}.sovereign{background:linear-gradient(90deg,#9d3b35 0 33%,#315f66 33% 66%,#b07a36 66%)}.dependent{background:transparent;border:2px dashed #6b5435}.contested{background:repeating-linear-gradient(45deg,#a36a46 0 3px,#e3cca1 3px 5px)}
.timeline{height:102px;display:grid;grid-template-columns:112px 44px minmax(220px,1fr) 86px;gap:1rem;align-items:center;border-top:1px solid var(--line);margin-top:.9rem}.year-display{display:flex;align-items:baseline;gap:.45rem}.year-display strong{font:700 2.75rem/.9 Georgia,serif;color:var(--red-dark);font-variant-numeric:tabular-nums}.play-button{width:2.6rem;height:2.6rem;border:0;border-radius:50%;background:var(--red);cursor:pointer;display:grid;place-items:center;box-shadow:0 6px 16px rgba(90,29,24,.28)}.play-button span{width:0;height:0;border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:10px solid #fff;margin-left:3px}.play-button.playing span{width:10px;height:14px;border:0;margin:0;background:linear-gradient(90deg,#fff 0 3px,transparent 3px 7px,#fff 7px 10px)}.range-wrap{position:relative;padding-top:.75rem}input[type=range]{display:block;width:100%;margin:0;appearance:none;background:transparent;cursor:pointer}input[type=range]::-webkit-slider-runnable-track{height:2px;background:linear-gradient(to right,var(--red) var(--progress,0%),rgba(67,49,29,.27) var(--progress,0%))}input[type=range]::-webkit-slider-thumb{appearance:none;width:15px;height:15px;border:3px solid var(--red);background:var(--paper);border-radius:50%;margin-top:-6px}.range-marks{position:relative;height:1rem;margin-top:.55rem;color:var(--muted);font:.75rem Georgia,serif}.range-marks span{position:absolute;left:calc(var(--position)*1%);transform:translateX(-50%);white-space:nowrap}.range-marks span:first-child{transform:none}.range-marks span:last-child{transform:translateX(-100%)}.jump-button{height:2.25rem;font-size:.8rem}
.story-panel{position:relative;padding:2rem 1.8rem;border-left:1px solid var(--line);background:linear-gradient(180deg,rgba(247,237,214,.96),rgba(226,207,170,.97));box-shadow:-13px 0 45px rgba(55,39,21,.08);overflow-y:auto;max-height:calc(100vh - 82px)}.red-rule{width:42px;height:3px;background:var(--red);margin-bottom:1.15rem}.panel-kicker{margin:0 0 .8rem;color:var(--red);font:700 .75rem Georgia,serif;letter-spacing:.14em}.panel-title-row{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;padding-bottom:1.3rem;border-bottom:1px solid var(--line)}.panel-title-row h2{margin:0;font-size:1.55rem;line-height:1.32}.panel-title-row p{margin:.5rem 0 0;color:var(--muted);font-size:.8rem}.wiki-link{color:inherit;text-decoration:underline;text-decoration-color:rgba(164,59,47,.55);text-decoration-thickness:1px;text-underline-offset:3px}.wiki-link:hover{color:var(--red)}.era-badge{flex:none;padding:.35rem .45rem;border:1px solid var(--red);color:var(--red);font-size:.75rem}.facts{display:grid;grid-template-columns:1fr 1fr;margin:1rem 0;border:1px solid var(--line)}.facts div{padding:.75rem;min-height:62px;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}.facts div:nth-child(2n){border-right:0}.facts div:last-child{grid-column:1/-1;border-bottom:0}.facts span{display:block;color:var(--muted);font-size:.75rem;margin-bottom:.35rem}.facts strong{font-size:.875rem;line-height:1.45}.panel-section{margin-top:1.35rem}.panel-section h3{margin:0 0 .7rem;font-size:1rem;letter-spacing:.05em}.panel-section h3 span{color:var(--muted);font:.75rem Georgia,serif;letter-spacing:.1em}.panel-section>p{margin:0;color:#4d4437;font-size:1rem;line-height:1.82}.section-heading{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.section-heading>span{color:var(--muted);font-size:.75rem}.event-list{display:flex;flex-direction:column}.event-card{display:grid;grid-template-columns:46px 1fr 20px;gap:.75rem;padding:.9rem 0;border-bottom:1px solid rgba(55,39,22,.17);color:inherit;text-decoration:none;transition:.2s}.event-card:hover{transform:translateX(4px);color:var(--red)}.event-year{font:700 .9rem Georgia,serif;color:var(--red)}.event-card h4{margin:0 0 .3rem;font-size:.9rem}.event-card p{margin:0;color:var(--muted);font-size:.8rem;line-height:1.5}.event-arrow{align-self:center;font-size:1.1rem}.source-note{margin-top:1.5rem;padding-top:.85rem;border-top:1px solid var(--line);color:var(--muted);font-size:.75rem;line-height:1.65}.source-note strong{display:block;color:var(--red);letter-spacing:.1em;margin-bottom:.3rem}.source-note a{color:var(--red-dark);text-underline-offset:2px}
dialog{width:min(530px,calc(100% - 2rem));padding:2.4rem;border:1px solid var(--line);background:var(--panel);color:var(--ink);box-shadow:var(--shadow)}dialog::backdrop{background:rgba(20,16,12,.7);backdrop-filter:blur(3px)}dialog h2{margin:0 0 1rem;font-size:1.7rem}dialog p:not(.eyebrow){color:#4d4437;line-height:1.8;font-size:1rem}.dialog-close{position:absolute;right:.9rem;top:.6rem;border:0;background:none;font-size:1.6rem;cursor:pointer}.primary-button{margin-top:.6rem;border:0;background:var(--red);color:#fff;padding:.75rem 1.3rem;cursor:pointer}
@media(max-width:1050px){.workspace{grid-template-columns:1fr 350px}.atlas{padding-left:1.2rem;padding-right:1.2rem}.story-panel{padding-left:1.35rem;padding-right:1.35rem}.timeline{grid-template-columns:102px 42px 1fr}.jump-button{display:none}}
@media(max-width:780px){.topbar{height:68px;padding:0 1rem}.brand-cn{font-size:1.2rem}.brand-en{display:none}.workspace{display:block}.atlas{padding:1.1rem .8rem 0}.map-header{align-items:flex-start}.map-status{display:none}.map-stage,#menaMap{min-height:390px}.legend{gap:.5rem;right:.6rem;flex-wrap:wrap}.timeline{grid-template-columns:86px 40px 1fr;height:92px;gap:.55rem}.year-display strong{font-size:2.15rem}.range-marks span:nth-child(even){display:none}.story-panel{max-height:none;border-left:0;border-top:1px solid var(--line);padding:1.7rem 1.3rem 2.5rem}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important}}
.countries path.fallback{stroke-dasharray:2 3;stroke-width:1.8}.swatch.fallback{background:repeating-linear-gradient(90deg,#6d5238 0 3px,transparent 3px 6px)}
.sea-label{z-index:10;color:rgba(60,77,74,.82);text-shadow:0 1px 0 rgba(245,232,202,.78)}.mediterranean{left:59%;top:26%;transform:translate(-50%,-50%) rotate(-5deg)}.red-sea{left:67.5%;top:56.8%;bottom:auto;transform:translate(-50%,-50%) rotate(72deg);letter-spacing:.28em;font-size:.95rem;font-weight:900}.map-labels text.country-label{transform-box:fill-box;transform-origin:center;transition:transform .22s ease}.country-flag{opacity:0;pointer-events:none;transform-box:fill-box;transform-origin:center;transition:opacity .55s ease,transform .55s ease;filter:drop-shadow(0 2px 2px rgba(35,25,15,.28))}.country-flag.active-flag{opacity:1}
#mapStage .mediterranean{left:53%!important;top:29%!important;transform:translate(-50%,-50%) rotate(-5deg)!important}
#mapStage .red-sea{left:67.5%!important;top:56.8%!important;bottom:auto!important;transform:translate(-50%,-50%) rotate(72deg)!important}
#realCountries.updating{visibility:hidden}
#realCountries.updating path{transition:none!important}
.countries path:focus{outline:none}
#menaMap{position:relative;z-index:0}
#mapStage .mediterranean,#mapStage .red-sea{background:rgba(239,225,194,.72);padding:.16rem .25rem;border:1px solid rgba(67,50,31,.2);border-radius:2px}
/* Sidebar follows the document height; scrolling belongs to the page, not a nested panel. */
.story-panel{overflow:visible;max-height:none}
/* Sea names sit on the water area without a label box; positions follow the map projection. */
#mapStage .mediterranean{left:45%!important;top:25%!important;transform:translate(-50%,-50%) rotate(-5deg)!important;background:transparent!important;border:0!important;padding:0!important;border-radius:0!important}
#mapStage .red-sea{left:64%!important;top:50%!important;bottom:auto!important;transform:translate(-50%,-50%) rotate(72deg)!important;background:transparent!important;border:0!important;padding:0!important;border-radius:0!important}
.countries path.detail-static,.countries path.detail-static:hover,.countries path.detail-static.keyboard-focus{transform:var(--source-transform,none)!important;filter:brightness(.96)!important}
.countries path.context{stroke-dasharray:7 3;stroke-width:1.8}
.debug-grid{display:grid;grid-template-columns:1fr 1fr;gap:.8rem 1rem;margin-top:1.2rem}.debug-grid label{display:flex;flex-direction:column;gap:.35rem;color:var(--muted);font-size:.8rem}.debug-grid input[type=range]{width:100%}.debug-range-control{display:grid;grid-template-columns:minmax(0,1fr) 5.1rem;align-items:center;gap:.5rem}.debug-number-input{width:100%;box-sizing:border-box;padding:.28rem .35rem;border:1px solid var(--line);background:rgba(255,255,255,.45);color:var(--ink);font:inherit;font-size:.78rem}.debug-grid input[type=color]{width:100%;height:2.2rem;padding:.15rem;background:var(--paper);border:1px solid var(--line);cursor:pointer}.debug-grid output{font:700 .75rem Georgia,serif;color:var(--red-dark)}.flag-fill-picker{display:flex;align-items:center;gap:.55rem}.flag-fill-picker input[type=color]{flex:1;min-width:0}.flag-debug-preview{display:block;width:70px;height:42px;object-fit:contain;object-position:center;background:var(--paper);border:1px solid var(--line);padding:.15rem}.debug-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.6rem;margin-top:1.3rem}.debug-actions .primary-button,.debug-actions .text-button{margin-top:0}.debug-actions .text-button{padding:.65rem .9rem}.debug-status{min-height:1.2rem;margin:.8rem 0 0!important;color:var(--red-dark)!important;font-size:.8rem!important}@media(max-width:560px){.debug-grid{grid-template-columns:1fr}.debug-actions{align-items:stretch;flex-direction:column}.debug-actions button{width:100%}}
.workspace{height:calc(100vh - 82px);min-height:0;grid-template-rows:minmax(0,1fr)}
.country-flag{filter:none!important}
#flagDebugDialog{max-height:calc(100vh - 2rem);overflow:auto}
/* Desktop rows are fixed to the viewport so historical boundary changes cannot
   alter the map window height. The side panel may still extend naturally. */
@media(min-width:781px){
  .atlas{height:100%;min-height:0;display:grid;grid-template-rows:auto minmax(0,1fr) 102px}
  .map-stage{height:auto;min-height:0;flex:none}
  #menaMap{height:100%;min-height:0}
  .timeline{height:102px;min-height:102px}
}
/* These are the manually aligned, permanent sea-label positions. */
#mapStage .mediterranean{left:45%!important;top:25%!important;transform:translate(-50%,-50%) rotate(-5deg)!important}
#mapStage .red-sea{left:64%!important;top:50%!important;bottom:auto!important;transform:translate(-50%,-50%) rotate(72deg)!important}
@media(max-width:780px){.workspace{height:auto;min-height:0;display:block}.atlas{height:auto;min-height:0;display:flex}.map-stage,#menaMap{min-height:390px;height:auto}}
/* Sea names live inside the SVG so they share the country layer and viewBox. */
.sea-labels{pointer-events:none;overflow:visible}
.sea-labels .sea-label{position:static;display:block;fill:rgba(60,77,74,.82);color:rgba(60,77,74,.82);text-anchor:middle;letter-spacing:.5em;font-weight:800;text-shadow:0 1px 0 rgba(245,232,202,.78);paint-order:stroke;stroke:rgba(245,232,202,.72);stroke-width:2px;vector-effect:non-scaling-stroke}
.sea-labels .sea-main{font-size:16px}
.sea-labels .sea-sub{font:700 11px Georgia,serif;letter-spacing:2px}
.sea-labels .sea-red{letter-spacing:.28em;font-size:15px;font-weight:900}
#menaMap:has(.countries path.selected) .sea-labels{display:none}
/* Country-only flag debugger sits in the detail header, beside the era badge. */
.panel-title-tools{display:flex;flex:none;flex-direction:column;align-items:flex-end;gap:.55rem}
.panel-debug-button{padding:.42rem .65rem;font-size:.72rem;letter-spacing:.05em;white-space:nowrap}
.panel-debug-button[hidden]{display:none}
.debug-current{margin:.75rem 0 0!important;color:var(--red-dark)!important;font-size:.82rem!important;font-weight:700}
/* A fill path is deliberately above the country CSS fill; the important
   inline value is updated by the debugger so the selected colour is visible. */
.country-flag .flag-fill{fill:transparent!important;pointer-events:none}
/* Historical compound records (Aden Protectorate and Ottoman/Turkish core)
   are a single polity. Neighboring paths still provide the external frontier,
   so suppress internal seams between touching source subpaths. */
.countries path.merged-feature{stroke:none!important}
.frontier-overlays,.history-connectors{pointer-events:none;overflow:visible}.frontier-overlays .dispute-hit{fill:transparent;stroke:transparent;pointer-events:all;cursor:pointer;outline:none}.frontier-overlays .dispute-hit:hover,.frontier-overlays .dispute-hit.selected,.frontier-overlays .dispute-hit:focus{fill:rgba(164,59,47,.22);stroke:#54231d;stroke-width:1.5;opacity:.82;vector-effect:non-scaling-stroke}.frontier-overlays .dispute-hit.dimmed{opacity:.28}
.frontier-overlays .frontier-gap{fill:url(#hatch)!important;stroke:#5d3925;stroke-width:1.25;stroke-dasharray:5 3;vector-effect:non-scaling-stroke;opacity:.9}.frontier-overlays .actual-control{stroke:#f0dfb8;stroke-width:1.25;vector-effect:non-scaling-stroke;opacity:.96;pointer-events:none}.frontier-overlays .claim-overlay{stroke:#5d3925;stroke-width:1.1;stroke-dasharray:4 3;vector-effect:non-scaling-stroke;opacity:.92;pointer-events:none}
.history-connectors line{stroke:#17130f;stroke-width:1;vector-effect:non-scaling-stroke;opacity:.88}
.frontier-note{color:var(--red-dark);font-weight:700}
/* Hover reveals the flag only; the country geometry and its label stay put. */
.countries path:hover:not(.detail-static),.countries path.keyboard-focus:not(.detail-static){transform:var(--source-transform,none)!important;filter:brightness(1.14)!important}
/* Keep the map viewport width invariant across schematic and real-boundary
   eras; long period titles must never enlarge the grid item. */
@media(min-width:781px){
  .atlas,.map-header,.map-stage{min-width:0;width:100%;max-width:100%}
  #menaMap{display:block;width:100%;max-width:100%;min-width:0}
}
/* One desktop sizing contract for every era.  The map cell, SVG and header
   all shrink inside the same grid track; no title or historical path can
   create a wider 2011+ or 1830+ window. */
@media(min-width:781px){
  .workspace{grid-template-columns:minmax(0,1fr) 410px;grid-template-rows:minmax(0,1fr);width:100%;max-width:100%;overflow:hidden}
  .atlas{grid-column:1;grid-row:1;overflow:hidden}
  .story-panel{grid-column:2;grid-row:1;min-width:0}
  .map-header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;column-gap:1rem}
  .map-header>div:first-child{min-width:0;overflow:hidden}
  .map-header h1{max-width:100%;overflow-wrap:anywhere}
  .map-stage{min-width:0;max-width:100%;overflow:hidden}
  #menaMap{width:100%;height:100%;aspect-ratio:auto;min-width:0;min-height:0}
}
@media(min-width:781px) and (max-width:1050px){
  .workspace{grid-template-columns:minmax(0,1fr) 350px}
}
@media(max-width:560px){.panel-title-row{gap:.65rem}}

/* Boundary geometry debugger. Source paths stay untouched; only the debug
   copy is rendered in this layer, so importing or transforming a boundary can
   never make the existing map disappear. */
.boundary-debug-layer{pointer-events:none;overflow:visible}
.boundary-debug-layer .boundary-debug-outline{fill:rgba(164,59,47,.18);stroke:#8b2f26;stroke-width:2.2;stroke-dasharray:7 4;vector-effect:non-scaling-stroke;paint-order:stroke;opacity:.8}
.boundary-debug-layer .boundary-debug-transform-preview{fill:rgba(164,59,47,.28);stroke:none!important;stroke-width:0;stroke-dasharray:none;vector-effect:non-scaling-stroke;opacity:.72;pointer-events:none}
.boundary-debug-layer .boundary-debug-saved{fill:rgba(74,105,113,.16);stroke:#315f66;stroke-width:2;stroke-dasharray:8 3;vector-effect:non-scaling-stroke;opacity:.9}
.boundary-debug-layer .boundary-debug-schematic-replacement{fill:rgba(164,59,47,.72);stroke:#54231d;stroke-width:1.5;vector-effect:non-scaling-stroke;paint-order:stroke}.boundary-debug-replaced-source{display:none!important}
.boundary-debug-dialog{width:min(760px,calc(100% - 2rem));max-height:calc(100vh - 2rem);overflow:auto}
.boundary-debug-dialog code{padding:.08rem .25rem;background:rgba(91,57,35,.1);font-size:.85em}
.boundary-debug-import{display:flex;flex-wrap:wrap;gap:.8rem;align-items:center;margin-top:1.1rem;padding:1rem;border:1px solid var(--line);background:rgba(255,255,255,.18)}
.debug-file-label,.debug-select-label{display:flex;flex-direction:column;gap:.4rem;color:var(--muted);font-size:.8rem}
.debug-file-label{position:relative;flex:1 1 220px;min-width:0;flex-direction:row;align-items:center;gap:.65rem;white-space:nowrap}
.debug-file-title{flex:0 0 auto}
.debug-file-button{display:inline-flex;align-items:center;justify-content:center;min-height:2.15rem;padding:.45rem .75rem;border:1px solid var(--line);background:rgba(255,255,255,.42);color:var(--ink);cursor:pointer;white-space:nowrap}
.debug-file-label:hover .debug-file-button,.debug-file-label:focus-within .debug-file-button{background:rgba(255,255,255,.7);border-color:var(--red)}
.debug-file-label input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.boundary-debug-import-actions{display:flex;flex:0 0 auto;gap:.55rem;align-items:center;flex-wrap:wrap}.boundary-debug-import-actions button{white-space:nowrap}
.debug-select-label{margin-top:1rem}.debug-select{width:100%;padding:.65rem;border:1px solid var(--line);background:rgba(255,255,255,.35);color:var(--ink)}
.boundary-debug-grid{margin-top:1rem}.boundary-debug-actions{border-top:1px solid var(--line);padding-top:1rem}
@media(max-width:560px){.boundary-debug-import{flex-direction:column;align-items:stretch}.debug-file-label{justify-content:space-between;flex-basis:auto}.boundary-debug-import-actions{flex-direction:column;align-items:stretch}.boundary-debug-import-actions button{width:100%}}
/* The boundary debugger is a side-panel overlay. Keep the map visible while
   it is open so imported geometry can be compared against the live map. */
#boundaryDebugDialog{position:fixed;inset:82px 0 0 auto;margin:0;width:410px;max-width:410px;height:calc(100vh - 82px);max-height:none;border-top:0;border-right:0;border-bottom:0;border-radius:0;z-index:100}
#boundaryDebugDialog::backdrop{background:transparent!important;backdrop-filter:none!important}
@media(min-width:781px) and (max-width:1050px){#boundaryDebugDialog{width:350px;max-width:350px}}
@media(max-width:780px){#boundaryDebugDialog{inset:68px 0 0;margin:0;width:100vw;max-width:none;height:calc(100vh - 68px);max-height:none;border-left:0}}
