/* Strategic World page (task-47, round 3 overhaul). Map-first living world with eight real-data
   layers, territory dossier and NPC/event/notification intelligence. CSP-safe classes only. */
.world-app h1 { margin: 0; }
.world-app { --w-bg: #06141a; --w-panel: linear-gradient(160deg, rgba(13,34,41,.97), rgba(5,18,24,.98)); --w-edge: rgba(153,178,174,.28); --w-amber: #d9ac6c; --w-muted: #a9bbb6; --w-ink: #e8ede6; position: relative; display: grid; gap: .7rem; color: var(--w-ink); }
.world-app *, .world-app *::before, .world-app *::after { box-sizing: border-box; }
.world-app :focus-visible { outline: 3px solid var(--w-amber); outline-offset: 2px; }
.world-app p, .world-app h2, .world-app h3, .world-app h4, .world-app ul { margin: 0; }
.world-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.world-sr:not(:empty) { position: fixed; left: 50%; top: 4.2rem; transform: translateX(-50%); z-index: 90; width: max-content; max-width: min(34rem, calc(100vw - 1rem)); padding: .45rem .8rem; border: 1px solid var(--w-edge); border-left: 3px solid var(--w-amber); background: #0b2229; font-size: .78rem; clip-path: none; height: auto; overflow: visible; }
[role="alert"].world-sr:not(:empty) { border-left-color: #ff9a91; }
.world-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .6rem 1rem; padding: .8rem .9rem; border: 1px solid var(--w-edge); border-radius: 4px; background: var(--w-panel); position: relative; overflow: hidden; }
.world-head::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--w-amber), rgba(217,172,108,0)); }
.world-kicker { color: var(--w-amber); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; }
.world-title { font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.1; }
.world-sub { color: var(--w-muted); font-size: .76rem; line-height: 1.5; max-width: 74ch; margin-top: .25rem !important; }
.world-head__chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.world-chip { display: inline-flex; align-items: center; min-height: 2rem; padding: .18rem .6rem; border: 1px solid var(--w-edge); border-radius: 999px; background: rgba(6,24,30,.7); font-size: .68rem; color: #dfe7e0; }
.world-layout { display: grid; grid-template-columns: minmax(0,1fr) 24rem; gap: .7rem; align-items: start; }
/* Map */
.world-mappanel { min-width: 0; border: 1px solid var(--w-edge); border-radius: 4px; background: var(--w-panel); overflow: hidden; }
.world-panelhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .7rem; padding: .5rem .7rem; border-bottom: 1px solid rgba(153,178,174,.18); }
.world-paneltitle { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--w-amber); }
.world-panelnote { color: var(--w-muted); font-size: .68rem; }
.world-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; padding: .4rem .55rem; border-bottom: 1px solid rgba(153,178,174,.14); }
.world-layers { display: flex; flex-wrap: wrap; gap: .2rem; }
.world-layer { min-height: 2rem; padding: .15rem .5rem; border: 1px solid var(--w-edge); border-radius: 999px; background: rgba(6,24,30,.8); color: #dfe7e0; font-size: .64rem; letter-spacing: .03em; cursor: pointer; }
.world-layer[aria-pressed="true"] { border-color: var(--w-amber); color: var(--w-amber); background: rgba(217,172,108,.14); }
.world-zoom { display: flex; gap: .2rem; }
.world-zoombtn { min-width: 44px; min-height: 2.75rem; padding: 0 .5rem; border: 1px solid var(--w-edge); border-radius: 3px; background: rgba(6,24,30,.8); color: var(--w-ink); font-size: .78rem; cursor: pointer; }
.world-viewport { position: relative; width: 100%; aspect-ratio: 1200 / 700; overflow: hidden; background: radial-gradient(120% 100% at 50% 30%, #0f2a32 0%, #06141a 62%, #041016 100%); touch-action: none; cursor: grab; }
.world-svg { display: block; width: 100%; height: 100%; }
.world-shape { fill: #24464a; fill-opacity: .47; stroke: #adc6db; stroke-width: 1.4; vector-effect: non-scaling-stroke; transition: fill .18s ease, stroke .18s ease; }
.world-province { cursor: pointer; }
.world-province:focus-visible .world-shape, .world-province--selected .world-shape { stroke: var(--w-amber); stroke-width: 2.6; }
.world-label { fill: #f0f6ff; font-size: 11px; font-family: inherit; letter-spacing: .03em; pointer-events: none; paint-order: stroke; stroke: #07111f; stroke-width: 3px; }
.world-site-dot { fill: #d9ac6c; }
.world-route { stroke: rgba(143,208,200,.55); stroke-width: 1.2; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
/* Political */
.world-svg[data-layer="political"] .world-province[data-status="player"] .world-shape { fill: #2f6a4f; }
.world-svg[data-layer="political"] .world-province[data-status="neutral"] .world-shape { fill: #3a4a50; }
.world-svg[data-layer="political"] .world-province[data-status="npc"] .world-shape { fill: #6b3b3b; }
.world-svg[data-layer="political"] .world-province[data-status="contested"] .world-shape { fill: #6d5a2f; }
.world-svg[data-layer="political"] .world-province[data-status="disputed"] .world-shape { fill: #6d5a2f; }
.world-svg[data-layer="political"] .world-province[data-status="occupied"] .world-shape { fill: #5d3a5a; }
.world-svg[data-layer="political"] .world-province[data-status="disabled"] .world-shape { fill: #303a3e; opacity: .6; }
.world-svg[data-layer="political"] .world-province[data-status="unreported"] .world-shape { fill: #22343a; }
/* Threat */
.world-svg[data-layer="threat"] .world-province[data-danger="calm"] .world-shape { fill: #24443a; }
.world-svg[data-layer="threat"] .world-province[data-danger="uneasy"] .world-shape { fill: #4a5a32; }
.world-svg[data-layer="threat"] .world-province[data-danger="threatened"] .world-shape { fill: #6b4b2a; }
.world-svg[data-layer="threat"] .world-province[data-danger="critical"] .world-shape { fill: #7a3030; }
.world-svg[data-layer="threat"] .world-province[data-danger="siege"] .world-shape { fill: #8a1f2a; }
.world-svg[data-layer="threat"] .world-province[data-danger="unreported"] .world-shape { fill: #22343a; }
/* Exploration */
.world-svg[data-layer="exploration"] .world-province[data-exploration="mapped"] .world-shape { fill: #2f665f; }
.world-svg[data-layer="exploration"] .world-province[data-exploration="partially-scouted"] .world-shape { fill: #485f52; }
.world-svg[data-layer="exploration"] .world-province[data-exploration="uncharted"] .world-shape { fill: #26383f; }
.world-svg[data-layer="exploration"] .world-province[data-exploration="not-reported"] .world-shape { fill: #22343a; }
/* Resources */
.world-svg[data-layer="resources"] .world-province[data-resource="materials"] .world-shape { fill: #6b5b3a; }
.world-svg[data-layer="resources"] .world-province[data-resource="food"] .world-shape { fill: #3f6b46; }
.world-svg[data-layer="resources"] .world-province[data-resource="water"] .world-shape { fill: #2f5f78; }
.world-svg[data-layer="resources"] .world-province[data-resource="energy"] .world-shape { fill: #7a6226; }
.world-svg[data-layer="resources"] .world-province[data-resource="technology"] .world-shape { fill: #4a4b7a; }
.world-svg[data-layer="resources"] .world-province[data-resource="other"] .world-shape { fill: #4d4a45; }
.world-svg[data-layer="resources"] .world-province[data-resource="unreported"] .world-shape { fill: #22343a; }
/* Population, diplomatic, trade, military */
.world-svg[data-layer="population"] .world-province[data-population="low"] .world-shape { fill: #2c4249; }
.world-svg[data-layer="population"] .world-province[data-population="mid"] .world-shape { fill: #3d5b55; }
.world-svg[data-layer="population"] .world-province[data-population="high"] .world-shape { fill: #54705d; }
.world-svg[data-layer="population"] .world-province[data-population="unreported"] .world-shape { fill: #22343a; opacity: .65; }
.world-svg[data-layer="diplomatic"] .world-province[data-diplomatic="player"] .world-shape { fill: #2f6a4f; }
.world-svg[data-layer="diplomatic"] .world-province[data-diplomatic="neutral"] .world-shape { fill: #3d4448; }
.world-svg[data-layer="diplomatic"] .world-province[data-diplomatic="npc"] .world-shape { fill: #6b3b3b; }
.world-svg[data-layer="diplomatic"] .world-province[data-diplomatic="contested"] .world-shape { fill: #6d5a2f; }
.world-svg[data-layer="diplomatic"] .world-province[data-diplomatic="unreported"] .world-shape { fill: #22343a; opacity: .65; }
.world-svg[data-layer="trade"] .world-province[data-trade="none"] .world-shape { fill: #2b3f45; }
.world-svg[data-layer="trade"] .world-province[data-trade="routes"] .world-shape { fill: #2f665f; }
.world-svg[data-layer="trade"] .world-province[data-trade="unreported"] .world-shape { fill: #22343a; opacity: .65; }
.world-svg[data-layer="military"] .world-province[data-military="low"] .world-shape { fill: #2c4249; }
.world-svg[data-layer="military"] .world-province[data-military="mid"] .world-shape { fill: #5d4b2c; }
.world-svg[data-layer="military"] .world-province[data-military="high"] .world-shape { fill: #6d3230; }
.world-svg[data-layer="military"] .world-province[data-military="unreported"] .world-shape { fill: #22343a; opacity: .65; }
.world-legend { display: grid; gap: .3rem; padding: .5rem .7rem; border-top: 1px solid rgba(153,178,174,.16); }
.world-legend__title { color: var(--w-amber); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; }
.world-legend__items { display: flex; flex-wrap: wrap; gap: .25rem .8rem; }
.world-legend__item { display: inline-flex; align-items: center; gap: .3rem; color: var(--w-muted); font-size: .64rem; }
.world-legend__item::before { content: ""; width: .55rem; height: .55rem; border-radius: 2px; background: #3a4a50; }
.world-legend__item--player::before { background: #2f6a4f; }
.world-legend__item--neutral::before { background: #3a4a50; }
.world-legend__item--npc::before { background: #6b3b3b; }
.world-legend__item--contested::before { background: #6d5a2f; }
.world-legend__item--disputed::before { background: #6d5a2f; }
.world-legend__item--occupied::before { background: #5d3a5a; }
.world-legend__item--disabled::before { background: #303a3e; }
.world-legend__item--unreported::before { background: #22343a; }
.world-legend__item--calm::before { background: #24443a; }
.world-legend__item--uneasy::before { background: #4a5a32; }
.world-legend__item--threatened::before { background: #6b4b2a; }
.world-legend__item--critical::before { background: #7a3030; }
.world-legend__item--siege::before { background: #8a1f2a; }
.world-legend__item--materials::before { background: #6b5b3a; }
.world-legend__item--food::before { background: #3f6b46; }
.world-legend__item--water::before { background: #2f5f78; }
.world-legend__item--energy::before { background: #7a6226; }
.world-legend__item--technology::before { background: #4a4b7a; }
.world-legend__item--other::before { background: #4d4a45; }
.world-legend__item--mapped::before { background: #2f665f; }
.world-legend__item--partially-scouted::before { background: #485f52; }
.world-legend__item--uncharted::before { background: #26383f; }
.world-legend__item--low::before { background: #2c4249; }
.world-legend__item--mid::before { background: #3d5b55; }
.world-legend__item--high::before { background: #54705d; }
.world-legend__item--none::before { background: #2b3f45; }
.world-legend__item--routes::before { background: #2f665f; }
.world-legend__note { color: #efca77; font-size: .64rem; }
.world-province-list { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: .5rem .7rem .7rem; margin: 0; border-top: 1px solid rgba(153,178,174,.14); }
.world-province-btn { display: grid; gap: .1rem; min-height: 2.75rem; padding: .3rem .55rem; border: 1px solid rgba(153,178,174,.22); border-radius: 3px; background: rgba(4,17,23,.5); color: var(--w-ink); text-align: left; cursor: pointer; }
.world-province-btn:hover, .world-province-btn:focus-visible { border-color: rgba(217,172,108,.55); }
.world-province-btn--selected { border-color: var(--w-amber); background: rgba(217,172,108,.12); }
.world-province-btn__name { font-size: .74rem; font-weight: 700; }
.world-province-btn__meta { color: var(--w-muted); font-size: .6rem; }
/* Side panels */
.world-side { display: grid; gap: .5rem; min-width: 0; }
.world-panel { border: 1px solid var(--w-edge); border-radius: 4px; background: var(--w-panel); overflow: hidden; }
.world-panelbody { display: grid; gap: .45rem; padding: .55rem .65rem .7rem; max-height: 26rem; overflow-y: auto; scrollbar-width: thin; }
.world-facts { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .25rem .5rem; }
.world-fact { display: grid; gap: .05rem; padding: .3rem .4rem; border: 1px solid rgba(153,178,174,.16); border-radius: 3px; background: rgba(4,17,23,.4); }
.world-fact__label { color: var(--w-muted); font-size: .56rem; letter-spacing: .1em; text-transform: uppercase; }
.world-fact__value { color: #f0eee5; font-size: .74rem; overflow-wrap: anywhere; }
.world-subhead { color: var(--w-amber); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; margin-top: .2rem !important; }
.world-hint { color: var(--w-muted); font-size: .7rem; line-height: 1.45; }
.world-state { color: var(--w-muted); font-size: .76rem; padding: .3rem 0; }
.world-state--error { color: #ff9a91; }
.world-actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.world-action { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: .3rem .65rem; border: 1px solid rgba(217,172,108,.45); border-radius: 3px; background: rgba(217,172,108,.1); color: #f0dbab; font-size: .72rem; text-decoration: none; cursor: pointer; }
.world-action--ghost { background: transparent; }
.world-action:disabled { opacity: .5; cursor: not-allowed; }
.world-close { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--w-edge); border-radius: 3px; background: transparent; color: var(--w-ink); font-size: 1.2rem; cursor: pointer; }
.world-panel:not(.world-panel--open) .world-close { display: none; }
.world-faction, .world-event, .world-notification { display: grid; gap: .2rem; padding: .4rem .5rem; border: 1px solid rgba(153,178,174,.18); border-left: 2px solid rgba(217,172,108,.5); border-radius: 3px; background: rgba(4,17,23,.42); }
.world-faction__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem; }
.world-faction h4, .world-event h4 { font-size: .78rem; color: #f0eee5; }
.world-pill { display: inline-flex; align-items: center; min-height: 1.3rem; padding: 0 .4rem; border: 1px solid currentColor; border-radius: 999px; color: #efca77; font-size: .56rem; }
.world-pill--ok { color: #9ac998; }
.world-form { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.world-input { min-height: 2.75rem; max-width: 8rem; padding: .25rem .45rem; border: 1px solid var(--w-edge); border-radius: 3px; background: rgba(4,17,23,.7); color: var(--w-ink); font-size: .74rem; }
.world-input--sm { max-width: 4.5rem; }
.world-offers { display: grid; gap: .3rem; }
.world-offer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; padding: .25rem .35rem; border: 1px solid rgba(153,178,174,.14); border-radius: 3px; }
.world-notification__title { font-size: .74rem; font-weight: 700; }
.world-notification--read { opacity: .62; }
/* Territory dossier: right rail on desktop, bottom sheet on mobile */
.world-panel--open .world-panelbody { max-height: none; }
@media (max-width: 1100px) { .world-layout { grid-template-columns: minmax(0,1fr) 20rem; } }
@media (max-width: 900px) {
  .world-layout { grid-template-columns: minmax(0,1fr); }
  .world-panel { position: fixed; inset: auto 0 0 0; z-index: 80; max-height: 80dvh; border-radius: 8px 8px 0 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .world-panel:not(.world-panel--open) { display: none; }
  .world-panel--open { display: grid; grid-template-rows: auto minmax(0,1fr); }
  .world-panel::backdrop { background: rgba(2,9,12,.6); }
  .world-panelbody { max-height: 66dvh; }
  .world-facts { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  .world-head { padding: .6rem .65rem; }
  .world-title { font-size: 1.25rem; }
  .world-sub { font-size: .7rem; }
  .world-toolbar { padding: .35rem .4rem; }
  .world-layer { font-size: .6rem; padding: .12rem .42rem; }
  .world-legend__item { font-size: .58rem; }
  .world-label { font-size: 10px; }
  .world-province-list { max-height: 14rem; overflow-y: auto; }
  .world-facts { grid-template-columns: minmax(0,1fr); }
  .world-panelbody { padding: .5rem .55rem .8rem; }
}
@media (max-width: 390px) {
  .world-app { gap: .5rem; }
  .world-province-btn { min-width: 44px; }
  .world-input { max-width: 7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .world-app, .world-app * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .world-province .world-shape { fill: Canvas; stroke: CanvasText; }
  .world-province--selected .world-shape { stroke: Highlight; stroke-width: 3; }
  .world-panel, .world-layer, .world-action, .world-province-btn, .world-input, .world-head, .world-mappanel, .world-fact { border: 1px solid CanvasText; }
  .world-layer[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .world-label { fill: CanvasText; stroke: Canvas; }
}
@media print { .world-svg { display: none; } }

/* Minimum touch targets for strategic map controls (mobile-first, 2026-11-06). */
.world-layer { min-width: 44px; min-height: 44px; }
.world-zoombtn { min-width: 44px; min-height: 44px; }
.world-close { min-width: 44px; min-height: 44px; }
.world-province-btn { min-height: 44px; }
@media (max-width: 600px) { .world-layer { padding: .25rem .5rem; font-size: .62rem; } .world-layers { gap: .25rem; } }

/* Forced colors: keep province boundaries and selected state perceivable without colour. */
@media (forced-colors: active) {
  .world-shape { stroke: CanvasText; stroke-width: 2; }
  .world-province:focus-visible .world-shape, .world-province--selected .world-shape { stroke: Highlight; stroke-width: 3; }
  .world-hit { forced-color-adjust: none; }
}

.world-label--status { font-size: 8px; fill: rgba(232,237,230,.55); letter-spacing: .04em; }
@media (forced-colors: active) { .world-province { outline: 2px solid CanvasText; outline-offset: -2px; } }

/* Forced colors and decorative SVG hardening (a11y follow-up). */
[data-world-province] { border: 1px solid transparent; }
@media (forced-colors: active) {
  [data-world-province] { border-color: CanvasText; forced-color-adjust: auto; }
}

/* Accessible route heading retains the existing compact title spacing. */
.world-app h1{margin:0}
