/* v13.27 Interface, responsive-layout, performance, and accessibility pass */
:root{
  --left-panel-width:clamp(276px,18vw,336px);
  --right-panel-width:clamp(304px,21vw,372px);
  --type-micro:.625rem;
  --type-small:.6875rem;
  --type-body:.75rem;
  --focus-ring:#f4d77f;
}

html{font-size:16px;text-size-adjust:100%;-webkit-text-size-adjust:100%}
body{line-height:1.45}
button,input,select,textarea{min-height:34px}
button{font-size:var(--type-small)}
.panel{scrollbar-gutter:stable}.panel.left{width:var(--left-panel-width)}.panel.right{width:var(--right-panel-width)}
.panel label,.admin-shell label,.section-heading,.territory-section-title{font-size:var(--type-micro)}
.panel p,.dossier p,.muted,.admin-tip{font-size:var(--type-small)}
.result small,.intel span,.system-label small,.tag,.chip,.coord-note,.route-hierarchy-key span,.legend span,.map-help{font-size:.5625rem}
.dossier p,.territory-dossier .territory-summary,.planet-summary{font-size:var(--type-body);line-height:1.62}
.system-label{font-size:.6875rem;line-height:1.3;contain:layout style;will-change:transform}
.system-label.selected{font-size:.8125rem}
.legend,.breadcrumb,.map-help{left:calc(var(--left-panel-width) + 32px)}
.legend{right:calc(var(--right-panel-width) + 32px)}
.admin-shell,.travel-shell,.character-directory-shell,.history-comparison-shell{overscroll-behavior:contain}
.admin-pane,.travel-body,.character-directory-body,.history-comparison-body{padding:clamp(14px,2vw,22px)}
.editor-grid>div{min-width:0}

:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:2px solid var(--focus-ring)!important;
  outline-offset:2px;
  box-shadow:0 0 0 4px rgba(244,215,127,.16)!important;
}
.skip-link{z-index:1000;padding:10px 14px;font-size:.75rem}
.skip-link-dossier{left:188px}
#map:focus-visible{outline:3px solid var(--focus-ring)!important;outline-offset:-3px}
.panel:focus-visible{outline-offset:-2px}
.panel-cap{min-height:34px;height:auto;padding-block:7px}
.panel-collapse{min-width:34px;min-height:34px}

body.high-contrast{--muted:#aeb7bd;--line:#65717a;--gold:#f0cf79;--text:#fff}
body.high-contrast .panel,body.high-contrast .modal>div{background:#05070a;backdrop-filter:none}
body.high-contrast .system-label{color:#fff;text-shadow:0 1px 2px #000,0 0 6px #000,0 0 9px #000}
body.high-contrast input,body.high-contrast select,body.high-contrast textarea{border-color:#78858d}

@media(min-width:1600px){
  :root{--left-panel-width:clamp(320px,19vw,372px);--right-panel-width:clamp(344px,21vw,410px)}
  .panel section{padding:15px}
  .dossier{padding:19px}
  .admin-shell{width:min(1280px,94vw)}
}

@media(max-width:1100px){
  :root{--left-panel-width:260px;--right-panel-width:288px}
  .command-button{min-width:38px;padding-inline:8px}
  .command-button .cmd-label{display:none}
  .command-bar{padding-inline:12px}
  .admin-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}
  .editor-grid.three{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:760px){
  :root{--left-panel-width:100%;--right-panel-width:100%}
  #app-shell{grid-template-rows:62px minmax(0,1fr) 22px}
  .command-bar{gap:8px;padding:0 8px}
  .brand-lockup{min-width:0}.brand-copy{min-width:0}.brand-lockup h1{font-size:.75rem;white-space:nowrap}.brand-subline{display:none}
  .header-actions{min-width:0;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:none}.header-actions::-webkit-scrollbar{display:none}
  .command-cluster{flex:0 0 auto}.command-button{display:inline-grid!important;min-width:40px;min-height:40px;padding:7px}
  .command-view{display:flex!important}
  #leftPanelBtn,#rightPanelBtn{display:inline-grid!important}
  #fullscreenMapBtn,#topViewBtn{display:none!important}
  .panel,.panel.left,.panel.right{top:auto;left:8px!important;right:8px!important;bottom:8px;width:auto;height:min(48dvh,440px);border:1px solid var(--line);transition:transform .2s ease,opacity .2s ease}
  .panel.left.collapsed,.panel.right.collapsed{transform:translateY(calc(100% + 18px));opacity:0}
  .legend,.breadcrumb,.map-help{display:none}
  .admin-shell,.travel-shell,.character-directory-shell,.history-comparison-shell{width:100%;max-width:none;max-height:100dvh;border-inline:0}
  .modal{padding:0;align-items:stretch}
  .editor-toolbar{top:38px;overflow-x:auto;flex-wrap:nowrap}
  .admin-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}
  .editor-grid.three,.campaign-update-grid,.campaign-builder-metadata,.history-comparison-changes,.character-directory-list{grid-template-columns:1fr!important}
  .editor-grid.three>div:last-child{grid-column:auto}
  .dossier-actions,.intel,.territory-stats,.fleet-kpis,.installation-kpis,.front-kpis,.operation-kpis,.supply-kpis{grid-template-columns:1fr 1fr}
  footer span:first-child{display:none}footer{justify-content:center;padding-inline:8px;text-align:center}
}

@media(max-width:480px){
  .brand-lockup h1{font-size:.6875rem}.regency-mark{display:none}
  .command-primary #frontsBtn,.command-primary #operationsBtn{display:none!important}
  .panel{left:4px!important;right:4px!important;bottom:4px;height:min(54dvh,470px)}
  .admin-tabs{grid-template-columns:1fr 1fr}
  .dossier-actions,.intel,.territory-stats,.fleet-kpis,.installation-kpis,.front-kpis,.operation-kpis,.supply-kpis{grid-template-columns:1fr}
}

@media(pointer:coarse){
  button,input,select,summary{min-height:44px}
  input[type=checkbox],input[type=radio]{min-width:22px;min-height:22px}
  .filter-grid button,.micro{min-height:40px}
}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
}
