/* ============================================================
   CIVICATION – SORT (MODERNE) SPILLVERSJON
   Mål:
   - Ekte sorte paneler + hvit/nøytral tekst med høy kontrast
   - Beholder alle selektorer/struktur fra gammel fil
   - Flate, rene flater (ingen glossy gradients), ett samlet aksentfarge
============================================================ */

/* ------------------------------------------------------------
   DESIGN TOKENS (kompatible med gammel fil)
------------------------------------------------------------ */

:root{
  /* Tekst */
  --ink: #ffffff;        /* main text / tall / overskrifter */
  --ink2:#f2f3f5;        /* brødtekst — solid, aldri gjennomsiktig grå */
  --ink3:#9aa3ad;        /* meta/labels — dempet, men solid (ikke grå) */
  --civi-font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --civi-text-xs: clamp(12.5px, 0.74rem + 0.12vw, 13.5px);
  --civi-text-sm: clamp(13.5px, 0.80rem + 0.18vw, 14.5px);
  --civi-text-base: clamp(15.8px, 0.93rem + 0.22vw, 16.6px);
  --civi-text-md: clamp(16.5px, 0.98rem + 0.28vw, 18px);
  --civi-text-lg: clamp(18px, 1.05rem + 0.45vw, 20px);
  --civi-text-xl: clamp(20px, 1.15rem + 0.85vw, 24px);
  --civi-text-title: clamp(24px, 1.32rem + 1.65vw, 30px);
  --civi-leading-tight: 1.18;
  --civi-leading-base: 1.52;
  --civi-leading-relaxed: 1.6;
  --civi-label-tracking: 0.045em;

  /* Bakoverkompatible aliaser for eksisterende Civication-regler. */
  --civi-font-base: var(--civi-text-base);
  --civi-font-small: var(--civi-text-sm);
  --civi-font-meta: var(--civi-text-xs);
  --civi-font-card-title: var(--civi-text-lg);
  --civi-line-base: var(--civi-leading-base);

  /* Linjer/borders */
  --line:  rgba(255,255,255,0.14);
  --line2: rgba(255,255,255,0.10);

  /* Kort/flater — ekte sort, ikke blågrå glass */
  --card:  rgba(17,17,19,0.97);
  --card2: rgba(24,24,27,0.97);

  /* Dybde */
  --shadow: 0 10px 24px rgba(0,0,0,0.48);

  /* Radius/layout */
  --radius: 16px;
  --footer-h: 64px;

  /* Ekstra tokens (nye, men trygge) */
  --bg: #050506;
  --glass: rgba(10,10,11,0.82);
  --glass2: rgba(10,10,11,0.90);
  --ring: rgba(214,170,58,0.55);

  --btn-bg: rgba(255,255,255,0.06);
  --btn-bg-hover: rgba(255,255,255,0.10);
  --btn-border: rgba(255,255,255,0.14);

  --btn-primary-bg: #ffffff;
  --btn-primary-ink: #000000;
  --btn-primary-border: #ffffff;

  --card1: var(--card);
  --ink1: var(--ink);

  /* Samlet aksentfarge — erstatter regnbue-aksentene i refresh/dashboard/mini-lagene */
  --civi-accent: #d6aa3a;
  --civi-accent-soft: rgba(214,170,58,0.16);
  --civi-accent-border: rgba(214,170,58,0.34);

  /* iOS/Safari kontrollfarger */
  color-scheme: dark;
}

html, body{
  height:100%;
}

*{
  box-sizing:border-box;
  -webkit-tap-highlight-color: transparent;
}

body.civi-app{
  margin:0;
  min-height:100%;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;

  color:var(--ink);
  font-family: var(--civi-font-sans);
  font-size: var(--civi-font-base);
  line-height: var(--civi-line-base);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background:var(--bg);
}

/* Lenker – holdt nøytral og lesbar */
a{
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.25);
}
a:hover{
  text-decoration-color: rgba(255,255,255,0.45);
}

/* Fokus – tastatur/tilgjengelighet */
:focus-visible{
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ------------------------------------------------------------
   TOPBAR
------------------------------------------------------------ */

.topbar{
  position:sticky;
  top:0;
  z-index:80;

  padding:12px 16px;
  display:flex;
  justify-content:space-between;
  align-items:center;

  background: var(--glass);
  border-bottom:1px solid var(--line);
}

/* Glass-effekt der støttet */
@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  .topbar{
    background: rgba(8,8,9,0.7);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

.app-title{
  font-weight:900;
  letter-spacing:0.2px;
}

.back-link{
  font-weight:700;
  font-size: var(--civi-text-sm);
  color:var(--ink);
  opacity:0.9;
}
.back-link:hover{
  opacity:1;
}

/* ------------------------------------------------------------
   MAP LAYER
------------------------------------------------------------ */

#civiMapWorld{
  position:fixed;
  inset:0;
  z-index:0;
  overflow:hidden;
  background:transparent;
}

#civiMapWorld svg{
  position:relative;
  z-index:1;
  width:100%;
  height:100%;
  display:block;
}

/* Standardkartet ligger bak Civication-panelene. Tones ned slik at
   panelene eier oppmerksomheten (kartetiketter skal ikke skinne gjennom
   mellom boksene); kartmodus er ufiltrert. */
body.civi-app:not(.civi-mapmode) #civiMapWorld > svg,
body.civi-app:not(.civi-mapmode) #civiMapWorld .civi-map-base-canvas,
body.civi-app:not(.civi-mapmode) #civiMapWorld .civi-map-places-canvas,
body.civi-app:not(.civi-mapmode) #civiMapWorld .civi-three-canvas{
  filter:brightness(0.58) saturate(0.82) contrast(1.02);
}

/* ------------------------------------------------------------
   PANELS
------------------------------------------------------------ */

.civi-world{
  position:relative;
  min-height:100%;
}

.civi-panels{
  position:relative;
  z-index:10;

  max-width:960px;
  margin:0 auto;

  padding:20px 16px;
  padding-bottom:calc(var(--footer-h) + 24px);

  display:flex;
  flex-direction:column;
  gap:20px;
}

.civi-panels > section{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;

  box-shadow:var(--shadow);
}

.civi-panels h2{
  margin:0 0 12px 0;
  font-size: var(--civi-text-xl);
  line-height: var(--civi-leading-tight);
  font-weight: 800;
  letter-spacing:-0.01em;
}

/* ------------------------------------------------------------
   CAPITAL
------------------------------------------------------------ */

.capital-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.capital-item{
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:12px;
  padding:10px;
}

.capital-label{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:0.6px;
  opacity:0.72;
  color: var(--ink2);
}

.capital-value{
  font-size:20px;
  font-weight:900;
}

/* ------------------------------------------------------------
   PSYCHE
------------------------------------------------------------ */

.psyche-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.psyche-item{
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:12px;
  padding:10px;
}

.psyche-item.highlight{
  grid-column:span 2;
}

.psyche-label{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:0.6px;
  opacity:0.72;
  color: var(--ink2);
}

.psyche-value{
  font-size:18px;
  font-weight:800;
}

/* ------------------------------------------------------------
   MODAL
------------------------------------------------------------ */

.civi-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.6);
  display:flex;
  justify-content:center;
  align-items:center;
  z-index:1000;
}

.civi-modal-content{
  width:900px;
  max-width:95%;
  max-height:85vh;
  overflow-y:auto;

  background: var(--card2);
  border:1px solid rgba(255,255,255,0.14);
  border-radius:16px;
  padding:20px;

  box-shadow: 0 18px 44px rgba(0,0,0,0.55);
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  .civi-modal-content{
    background: rgba(24,24,27,0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}

/* Innebygd nabolagsvelger.
   Når #districtModal åpnes inni en seksjons-popup (civi-section-popup) skal den
   oppføre seg som et panel i popupens innholdsområde – ikke som et eget fixed
   overlegg som ender opp bak popupen. Popupens egen body håndterer scroll. */
.civi-modal.is-embedded{
  position:static;
  inset:auto;
  display:block;
  z-index:auto;
  background:transparent;
}

.civi-modal.is-embedded .civi-modal-content{
  width:100%;
  max-width:100%;
  max-height:none;
  overflow:visible;
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
  -webkit-backdrop-filter:none;
  backdrop-filter:none;
}

.district-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:14px;
}

.district-card{
  background: rgba(255,255,255,0.04);
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
}

.district-card.locked{
  opacity:0.6;
}

.district-card button{
  width:100%;
  margin-top:10px;
  padding:10px;
  border:none;
  border-radius:10px;

  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  font-weight:800;
  cursor:pointer;
}
.district-card button:hover{
  filter: brightness(0.95);
}

/* ------------------------------------------------------------
   FOOTER
------------------------------------------------------------ */

.civi-footer{
  position:fixed;
  left:0;
  right:0;
  bottom:0;

  height:var(--footer-h);
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;

  background: var(--glass2);
  border-top:1px solid var(--line);
  z-index:90;
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  .civi-footer{
    background: rgba(8,8,9,0.72);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }
}

.civi-btn{
  padding:10px 14px;
  border-radius:10px;
  border:1px solid var(--btn-border);
  background:var(--btn-bg);
  color: var(--ink);
  font-weight:800;
  cursor:pointer;

  transition: background-color 140ms ease, transform 120ms ease, border-color 140ms ease, opacity 140ms ease;
}

.civi-btn:hover{
  background: var(--btn-bg-hover);
  border-color: rgba(255,255,255,0.20);
}

.civi-btn:active{
  transform: translateY(1px);
}

.civi-btn.primary{
  background: var(--btn-primary-bg);
  color: var(--btn-primary-ink);
  border-color: var(--btn-primary-border);
}

.civi-btn.primary:hover{
  filter: brightness(0.96);
}

/* ------------------------------------------------------------
   MAP MODE
------------------------------------------------------------ */

body.civi-mapmode .civi-panels{
  opacity:0;
  visibility:hidden;
  pointer-events:none;
}

/* ------------------------------------------------------------
   TRACK HUD (beholdt, fungerer i dark)
------------------------------------------------------------ */

.civi-track-hud{
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: var(--civi-text-sm);
}

.civi-track-title{
  font-weight: 700;
  opacity: 0.85;
  margin-bottom: 4px;
}

.civi-track-tags{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.civi-track-tags span{
  background: rgba(255,255,255,0.10);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: var(--civi-text-xs);
}

/* ------------------------------------------------------------
   RESPONSIV FINPUSS (ikke bryter layout)
------------------------------------------------------------ */

@media (max-width: 520px){
  .civi-panels{
    padding:16px 12px;
    padding-bottom:calc(var(--footer-h) + 18px);
  }

  .civi-panels > section{
    padding:14px;
  }

  .civi-panels h2{
    font-size:19px;
  }
}

@media (prefers-reduced-motion: reduce){
  .civi-btn{
    transition:none;
  }
}

/* ------------------------------------------------------------
   WORKDAY PANEL
------------------------------------------------------------ */

#civiWorkdayPanel{
  min-height: 120px;
}

.civi-workday{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.civi-workday-top{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:12px;
}

.civi-workday-clock,
.civi-workday-meta,
.civi-workday-card{
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:12px;
  padding:12px;
}

.civi-workday-time{
  font-size:28px;
  font-weight:900;
  letter-spacing:0.5px;
}

.civi-workday-label{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:0.6px;
  opacity:0.72;
  color:var(--ink2);
  margin-bottom:6px;
}

.civi-workday-sub{
  font-size:13px;
  color:var(--ink2);
  opacity:0.82;
  margin-top:4px;
}

.civi-workday-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding:4px 0;
}

.civi-workday-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.civi-workday-big{
  font-size:22px;
  font-weight:900;
}

.civi-workday-task-title{
  font-size:16px;
  font-weight:800;
  margin-bottom:6px;
}

.civi-workday-task-desc{
  font-size:15px;
  color:var(--ink2);
}

.civi-workday-empty{
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:12px;
  padding:14px;
}

@media (max-width: 700px){
  .civi-workday-top{
    grid-template-columns:1fr;
  }

  .civi-workday-grid{
    grid-template-columns:1fr;
  }
}

/* ------------------------------------------------------------
   TASK MODAL
------------------------------------------------------------ */

.civi-modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:9999;
}

.civi-modal.is-open{
  display:block;
}

.civi-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.6);
  backdrop-filter:blur(2px);
}

.civi-modal-card{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:min(720px, calc(100vw - 24px));
  max-height:calc(100vh - 24px);
  overflow:auto;
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:16px;
  box-shadow:0 20px 60px rgba(0,0,0,0.35);
}

.civi-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid var(--line2);
}

.civi-modal-close{
  border:1px solid var(--line2);
  background:var(--card1);
  color:var(--ink1);
  border-radius:10px;
  min-width:40px;
  height:40px;
  cursor:pointer;
}

.civi-modal-body{
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* NextAction — den eneste aktive svarflaten (CivicationNextActionUI). */
.civi-next-action-card{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.civi-next-action-subject{
  margin:0;
  font-size:18px;
}
.civi-next-action-meta{
  font-size:13px;
}
.civi-next-action-body p{
  margin:0 0 6px;
}
.civi-next-action-sub{
  margin:0;
  font-size:13px;
}
.civi-next-action-choices{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:4px;
}
.civi-next-action-empty{
  margin:0;
}

/* Innboks: aktiv fasehandling håndteres i NextAction, ikke inline. */
.civi-inbox-card-next-action{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}
.civi-inbox-handled-note{
  font-size:13px;
}

.civi-task-meta{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.civi-task-box{
  background:var(--card1);
  border:1px solid var(--line2);
  border-radius:12px;
  padding:12px;
}

.civi-task-kicker{
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:0.6px;
  color:var(--ink2);
  opacity:0.8;
  margin-bottom:6px;
}

.civi-task-title{
  font-size:20px;
  font-weight:900;
}

.civi-task-desc{
  font-size:15px;
  color:var(--ink2);
}

.civi-task-list{
  margin:0;
  padding-left:18px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.civi-task-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.civi-task-open-btn{
  margin-top:10px;
  border:1px solid var(--line2);
  background:var(--card1);
  color:var(--ink1);
  border-radius:10px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:700;
}

@media (max-width: 700px){
  .civi-task-meta{
    grid-template-columns:1fr;
  }
}

/* ------------------------------------------------------------
   TOAST
------------------------------------------------------------ */

#toast{
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30000;
  width: min(92vw, 760px);
  display: none;
  padding: 18px 56px 18px 18px;
  border-radius: 18px;
  background: rgba(14,14,16,0.97);
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  color: #fff;
}

#toast .toast-close{
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

#toast .toast-body{
  font-size: var(--civi-text-lg);
  line-height: var(--civi-leading-relaxed);
  font-weight: 600;
  white-space: pre-wrap;
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  #toast{
    background: rgba(12,12,13,0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}

@media (max-width: 640px){
  #toast{
    width: min(94vw, 760px);
    padding: 18px 54px 18px 16px;
  }

  #toast .toast-body{
    font-size: var(--civi-text-md);
  }
}

.civi-choice-consequence{
  margin-top:8px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(111,181,124,0.45);
  background:rgba(111,181,124,0.12);
  font-size:14px;
  color:var(--ink);
  font-weight:700;
}

.civi-event-card{
  border:1px solid var(--line2);
  border-radius:12px;
  padding:12px;
  background:rgba(255,255,255,0.03);
}
.civi-event-kicker{font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--ink2);margin-bottom:4px;}
.civi-event-title{font-weight:800;margin-bottom:6px;}
.civi-event-meta{display:flex;flex-direction:column;gap:2px;color:var(--ink2);font-size:14px;margin-bottom:8px;}
.civi-event-body{line-height:1.45;}
.civi-event-next{margin-top:10px;font-weight:700;}
.civi-event-choices{display:flex;flex-direction:column;gap:8px;margin-top:10px;}
.civi-event-card.is-milestone{border-color:rgba(214,170,58,.4);background:rgba(214,170,58,.08);}
.civi-event-card.is-workday{border-color:rgba(127,167,214,.4);}
.civi-event-feedback{margin-top:10px;}

/* Civication Map v2.1 legend + readability */
.civi-map-legend{position:absolute;left:14px;bottom:82px;z-index:3;max-width:min(280px,58vw);border:1px solid rgba(255,255,255,.16);border-radius:12px;background:rgba(15,22,30,.76);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);color:#fff}
.civi-map-legend-toggle{width:100%;padding:8px 10px;background:transparent;border:0;color:#fff;font-weight:800;text-align:left;font-size:13px;letter-spacing:.03em}
.civi-map-legend-body{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:0 10px 10px}
.civi-map-legend.is-collapsed .civi-map-legend-body{display:none}
.civi-map-legend-body span{display:block;padding:6px 8px;border-radius:8px;border:1px solid rgba(255,255,255,.12);font-size:12px}
.civi-map-legend-body [data-kind="work"]{background:rgba(159,181,206,.22)}
.civi-map-legend-body [data-kind="housing"]{background:rgba(220,191,151,.2)}
.civi-map-legend-body [data-kind="store"]{background:rgba(131,174,222,.2)}
.civi-map-legend-body [data-kind="debate"]{background:rgba(197,160,232,.2)}
.civi-map-legend-body [data-kind="leisure"]{background:rgba(134,190,143,.22)}
.civi-map-legend-body [data-kind="power"]{background:rgba(241,206,145,.2)}
@media (max-width:740px){.civi-map-legend{left:10px;bottom:128px;max-width:66vw}.civi-map-legend-body{grid-template-columns:1fr;font-size:12px}}

/* Civication Map v2.3 – Oslo-proporsjoner label readability */
#civiMapWorld .civi-map-label{
  paint-order:stroke;
  stroke:rgba(0,0,0,.58);
  stroke-width:2.4px;
  letter-spacing:.3px;
  font-family:"Inter","Segoe UI",system-ui,-apple-system,sans-serif;
  text-shadow:0 2px 8px rgba(0,0,0,.45);
}
#civiMapWorld .civi-map-label-river{
  fill:#e8f7ff;
  font-size:18px;
}
#civiMapWorld .civi-map-label-water,
#civiMapWorld .civi-map-label-terrain{
  font-size:20px;
}
@media (min-width: 768px){
  #civiMapWorld .civi-map-label{font-size:18px;}
}

.civi-map-landmark{opacity:.98}
.civi-map-building-shadow{fill:rgba(0,0,0,.28)}
.civi-map-landmark-label{
  fill:#f5f7fb;
  font-size:12px;
  font-weight:800;
  text-anchor:middle;
  letter-spacing:.01em;
  stroke:rgba(0,0,0,.66);
  stroke-width:2;
  paint-order:stroke;
  opacity:.9;
}
.civi-map-building-window{fill:rgba(226,240,252,.75)}

/* Civication Map v2.5 – fasader, vinduer og takformer */
.civi-map-building-roof{fill:rgba(84,98,114,.95);stroke:rgba(18,24,32,.9);stroke-width:.8}
.civi-map-building-door{fill:rgba(52,40,34,.92);stroke:rgba(16,16,18,.75);stroke-width:.6}
.civi-map-building-detail{stroke:rgba(222,232,240,.55);stroke-width:.8;stroke-linecap:round}
.civi-map-ridge-line{stroke:rgba(209,228,205,.7);stroke-width:1.1;stroke-linecap:round}
.civi-map-loading-bay{fill:rgba(182,194,205,.7);stroke:rgba(43,52,58,.85);stroke-width:.7}
.civi-map-awning{fill:none;stroke:rgba(230,214,177,.82);stroke-width:1.2;stroke-linecap:round}
.civi-map-chimney{fill:rgba(79,54,48,.95)}
.civi-map-rail{stroke:rgba(150,166,176,.68);stroke-width:1}
.civi-map-tree{fill:rgba(111,158,103,.92)}

/* Civication Map v2.6 – bykropp og dybdelag */
#civiMapWorld .civi-map-district-shadow{fill:rgba(8,12,17,.26)}
#civiMapWorld .civi-map-district-edge{fill:none;stroke:rgba(255,255,255,.12);stroke-width:1}
#civiMapWorld .civi-map-urban-core{fill:none;stroke:rgba(255,228,190,.28);stroke-width:1.4}
#civiMapWorld .civi-map-shoreline{fill:none;stroke:rgba(208,235,255,.28);stroke-width:2;stroke-linecap:round}
#civiMapWorld .civi-map-fjord-line{fill:none;stroke:rgba(145,194,226,.22);stroke-width:1.3;stroke-linecap:round}
#civiMapWorld .civi-map-harbor-edge{fill:none;stroke:rgba(220,240,255,.34);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
#civiMapWorld .civi-map-quay-line{fill:none;stroke:rgba(173,208,233,.3);stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round}
#civiMapWorld .civi-map-terrain-line{fill:none;stroke:rgba(201,223,190,.24);stroke-width:1.2;stroke-linecap:round}
#civiMapWorld .civi-map-corridor-glow{fill:none;stroke:rgba(242,246,255,.14);stroke-linecap:round}
#civiMapWorld .civi-map-street-axis-glow{fill:none;stroke:rgba(247,251,255,.12);stroke-width:4.2;stroke-linecap:round}
#civiMapWorld .civi-map-street-axis{fill:none;stroke:rgba(216,229,240,.34);stroke-width:1.35;stroke-linecap:round}
#civiMapWorld .civi-map-urban-spine{fill:none;stroke:rgba(224,238,248,.4);stroke-width:1.55;stroke-linecap:round}
#civiMapWorld .civi-map-core-structure{fill:rgba(217,235,251,.05);stroke:rgba(224,238,251,.24);stroke-width:1.2}
#civiMapWorld .civi-map-river-bank{fill:none;stroke:rgba(222,244,255,.34);stroke-width:10.2;stroke-linecap:round;opacity:.55}
#civiMapWorld .civi-map-label-river{opacity:.78;letter-spacing:.01em}


#civiMapWorld .civi-map-urban-texture{fill:rgba(40,52,62,.16);stroke:rgba(226,237,247,.15);stroke-width:.45}
#civiMapWorld .civi-map-core-block{fill:rgba(52,66,78,.2);stroke:rgba(240,218,186,.2)}
#civiMapWorld .civi-map-industrial-yard{fill:rgba(61,70,78,.18);stroke:rgba(211,223,233,.16);stroke-width:.5}
#civiMapWorld .civi-map-villa-texture{fill:rgba(51,61,70,.13);stroke:rgba(219,228,236,.13)}
#civiMapWorld .civi-map-green-texture{fill:none;stroke:rgba(176,203,174,.2);stroke-width:.9;stroke-linecap:round}
#civiMapWorld .civi-map-function-hint{opacity:.35;stroke-width:1.1;fill-opacity:.35;stroke-linecap:round}

/* Civication Map v2.7 – atmosfære, dybde og mykere bykropp */
#civiMapWorld #civi-map-districts polygon{stroke-linejoin:round}
#civiMapWorld .civi-map-grain{mix-blend-mode:soft-light;opacity:.38;pointer-events:none}
#civiMapWorld .civi-map-vignette{pointer-events:none}
#civiMapWorld .civi-map-core-glow{pointer-events:none}
#civiMapWorld .civi-map-fjord-base{filter:drop-shadow(0 -2px 6px rgba(8,20,30,.35))}
@media (prefers-reduced-motion: reduce){
  #civiMapWorld .civi-map-grain{display:none}
}

.civi-inbox-subheading{
  margin: 12px 2px 8px;
  font-size: var(--civi-font-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.civi-map-fortress-aperture{fill:rgba(39,45,52,.88)}


.civi-test-mode {
  border: 1px solid rgba(75, 128, 255, 0.35);
  background: rgba(10, 18, 38, 0.92);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.civi-test-mode h2 { margin-top: 0; }
.civi-test-mode label { display: block; margin-bottom: 6px; font-weight: 700; }
.civi-test-mode select {
  width: 100%;
  max-width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.civi-test-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.civi-test-actions button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.civi-test-status {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}
.civi-test-status div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 6px;
}
.civi-test-status span { opacity: 0.72; }
.civi-test-message { margin: 0 0 4px; color: #bcd2ff; }

/* Civication testmodus: synlig knapp + flytende testpanel */
.civi-test-button {
  border: 1px solid rgba(75, 128, 255, 0.55);
  background: rgba(20, 36, 74, 0.95);
  color: #dce8ff;
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 10px;
}
.civi-test-button.is-active {
  background: rgba(75, 128, 255, 0.9);
  color: #fff;
}
.civi-test-mode.civi-test-floating {
  position: fixed;
  top: 64px;
  right: 16px;
  width: min(440px, 94vw);
  max-height: 82vh;
  overflow: auto;
  z-index: 4000;
  color: #e9f0ff;
}
.civi-test-mode.is-hidden { display: none; }
.civi-test-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.civi-test-close {
  border: 0;
  background: transparent;
  color: #cdd9ff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.civi-test-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 10px 0;
}
.civi-test-search,
.civi-test-filter {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 14, 30, 0.9);
  color: #e9f0ff;
}
.civi-test-roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 38vh;
  overflow: auto;
  margin-bottom: 10px;
}
.civi-test-role {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 20, 42, 0.9);
  color: #e9f0ff;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}
.civi-test-role.is-selected {
  border-color: rgba(75, 128, 255, 0.95);
  background: rgba(33, 56, 116, 0.95);
}
.civi-test-role-title { font-weight: 700; font-size: 0.92rem; }
.civi-test-role-meta { font-size: 0.74rem; opacity: 0.72; }
.civi-test-empty { opacity: 0.7; margin: 4px 0; }
.civi-test-startpoint { margin: 6px 0 10px; }
.civi-test-startpoint-label { font-weight: 700; margin-bottom: 6px; }
.civi-test-weeks { display: flex; flex-wrap: wrap; gap: 12px; }
.civi-test-week { display: flex; align-items: center; gap: 6px; font-weight: 500; }

/* ------------------------------------------------------------
   CIVICATION v2 — MIN DAG / LIFE STORY
------------------------------------------------------------ */
#civiLifestoryPanel{
  display:flex;
  flex-direction:column;
  gap:12px;
  max-width:100%;
  min-width:0;
  overflow-x:hidden;
}

.civi-lifestory-status{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  min-width:0;
}

.civi-lifestory-status-chip,
.civi-lifestory-scene,
.civi-lifestory-konsekvens,
.civi-lifestory-summary,
.civi-lifestory-panels > section{
  background:var(--card2);
  border:1px solid var(--line2);
  border-radius:14px;
}

.civi-lifestory-status-chip{
  padding:8px 10px;
}

.civi-lifestory-status-chip small,
.civi-lifestory-section-label,
.civi-lifestory-kicker,
.civi-lifestory-choice small{
  display:block;
  color:var(--ink3);
  font-size:var(--civi-font-meta);
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}

.civi-lifestory-status-chip strong{
  display:block;
  font-size:15px;
}

.civi-lifestory-scene,
.civi-lifestory-konsekvens,
.civi-lifestory-summary{
  min-width:0;
  max-width:100%;
  padding:14px;
  overflow-wrap:anywhere;
}

.civi-lifestory-scene{
  display:flex;
  flex-direction:column;
}

.civi-lifestory-kicker{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.civi-lifestory-kicker span,
.civi-thread-badge,
.civi-lifestory-delta{
  border:1px solid var(--line2);
  border-radius:999px;
  background:rgba(255,255,255,.06);
  padding:3px 8px;
}

.civi-lifestory-scene h3,
.civi-lifestory-summary h3{
  margin:8px 0;
  font-size:24px;
  line-height:1.2;
}

.civi-lifestory-scene p,
.civi-lifestory-konsekvens p,
.civi-lifestory-summary p{
  margin:8px 0 12px;
  color:var(--ink2);
}

.civi-lifestory-threadline{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px;
  min-width:0;
  margin:10px 0 12px;
  color:var(--ink2);
}

.civi-lifestory-choices,
.civi-lifestory-actions,
.civi-lifestory-deltas{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.civi-lifestory-choices{
  flex-direction:column;
  width:100%;
  max-width:100%;
  min-width:0;
}

.civi-lifestory-choice{
  box-sizing:border-box;
  width:100%;
  max-width:100%;
  min-width:0;
  min-height:48px;
  text-align:left;
  padding:12px 14px;
  border-radius:13px;
  border:1px solid var(--btn-border);
  background:var(--btn-bg);
  color:var(--ink);
  font:inherit;
  font-weight:850;
  cursor:pointer;
  white-space:normal;
  overflow-wrap:anywhere;
}

.civi-lifestory-choice:hover{
  background:var(--btn-bg-hover);
  border-color:var(--civi-accent-border);
}

.civi-lifestory-konsekvens{
  border-color:var(--civi-accent-border);
  background:linear-gradient(180deg,var(--civi-accent-soft),rgba(255,255,255,.04));
}

.civi-lifestory-delta{
  color:var(--ink2);
  font-size:14px;
  font-weight:800;
}

.civi-lifestory-delta.is-positive{ border-color:rgba(74,222,128,.35); }
.civi-lifestory-delta.is-negative{ border-color:rgba(248,113,113,.38); }

.civi-lifestory-panels{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  min-width:0;
  max-width:100%;
}

.civi-lifestory-panels > section{
  min-width:0;
  padding:10px;
  overflow-wrap:anywhere;
}

.civi-lifestory-panels h4,
.civi-lifestory-summary h4{
  margin:0 0 8px;
  font-size:15px;
}

.civi-lifestory-panels ul,
.civi-lifestory-summary ul{
  margin:0;
  padding-left:18px;
}

.civi-thread-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:5px 0;
}

.civi-thread-row.is-completed,
.civi-thread-row.is-dormant{
  opacity:.72;
}

.civi-thread-badge{
  white-space:nowrap;
  font-size:12px;
  font-weight:900;
}

.civi-thread-badge.is-active{ border-color:rgba(96,165,250,.45); }
.civi-thread-badge.is-escalated{ border-color:rgba(248,113,113,.55); color:#fecaca; }
.civi-thread-badge.is-completed{ border-color:rgba(74,222,128,.40); }
.civi-thread-badge.is-dormant{ border-color:rgba(148,163,184,.35); color:#cbd5e1; }

@media (max-width: 1100px){
  .civi-lifestory-scene{
    flex-direction:column;
  }
  .civi-lifestory-choices{
    flex-direction:column;
    align-items:stretch;
  }
  .civi-lifestory-panels{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 720px){
  .topbar{ align-items:flex-start; gap:8px; }
  .civi-lifestory-status{ grid-template-columns:repeat(2,minmax(0,1fr)); }
  .civi-lifestory-panels{ grid-template-columns:1fr; }
  .civi-lifestory-scene h3,
  .civi-lifestory-summary h3{ font-size:21px; }
}
