﻿:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #191c20;
  --panel2: #20242a;
  --text: #eef1f4;
  --muted: #a6adb8;
  --weak: #7b8491;
  --line: rgba(238, 241, 244, 0.12);
  --green: #5bd38b;
  --red: #ff6f7d;
  --cyan: #8ecae6;
  --gold: #e8c468;
  --hover: rgba(255, 255, 255, 0.055);
  --quiet: rgba(255, 255, 255, 0.035);
  
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  --backdrop: none;
  --border-glow: rgba(142, 202, 230, 0.08);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel2: #eef1f4;
  --text: #1f2933;
  --muted: #5f6b7a;
  --weak: #8792a0;
  --line: rgba(31, 41, 51, 0.12);
  --green: #16875a;
  --red: #c24155;
  --cyan: #2f80a7;
  --gold: #a06a18;
  --hover: rgba(31, 41, 51, 0.045);
  --quiet: rgba(31, 41, 51, 0.03);
  
  --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
  --backdrop: none;
  --border-glow: rgba(47, 128, 167, 0.08);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f5f6f8;
    --panel: #ffffff;
    --panel2: #eef1f4;
    --text: #1f2933;
    --muted: #5f6b7a;
    --weak: #8792a0;
    --line: rgba(31, 41, 51, 0.12);
    --green: #16875a;
    --red: #c24155;
    --cyan: #2f80a7;
    --gold: #a06a18;
    --hover: rgba(31, 41, 51, 0.045);
    --quiet: rgba(31, 41, 51, 0.03);
    
    --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
    --backdrop: none;
    --border-glow: rgba(47, 128, 167, 0.08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, var(--bg), color-mix(in srgb, var(--bg) 92%, var(--panel2)));
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
  transition: background-color 0.4s ease, color 0.4s ease;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  user-select: text;
  -webkit-user-select: text;
}

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: var(--text);
  border: 0;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  user-select: none;
  -webkit-user-select: none;
}

.feed,
.feed-item,
.feed-title,
.feed-summary,
.feed-source,
.fear-copy,
.ai-summary-bullet,
.ai-summary-line,
.ai-situation-card,
.ai-situation-headline,
.ai-brief-panel,
.ai-world-section,
.threat-incidents,
.threat-meta,
.threat-breakdown,
.driver-list,
.region-news-list,
.event-tooltip,
.maplibregl-popup-content {
  user-select: text;
  -webkit-user-select: text;
}

.headline,
.control-card,
.side-panel-card,
.feed-panel,
.feed-panel *,
.control-card *,
.side-panel-card *,
.driver-list *,
.threat-incidents *,
.ai-brief-panel *,
.ai-world-section *,
.ai-situation-card *,
.region-tooltip *,
.event-tooltip * {
  user-select: text;
  -webkit-user-select: text;
}

.map-controls,
.map-layer-actions,
.segmented,
.source-filter,
.feed-pager {
  user-select: none;
  -webkit-user-select: none;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.content {
  padding: 10px 12px 16px;
  display: grid;
  gap: 10px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(0, 1.7fr) minmax(320px, 0.72fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.map-col {
  grid-column: 1;
  grid-row: 1;
}

.left-col {
  grid-column: 2;
  grid-row: 1;
}

.right-col {
  grid-column: 3;
  grid-row: 1;
}

.map-col, .left-col, .right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-col {
  z-index: 1;
  isolation: isolate;
}

.left-col {
  position: relative;
  z-index: 5;
  isolation: isolate;
}

.map-col,
.right-col {
  position: sticky;
  top: 10px;
}

.headline {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: 
    linear-gradient(135deg, var(--border-glow), transparent 52%),
    var(--panel);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eyebrow {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  text-shadow: none;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(19px, 2vw, 25px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#openFocusBtn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--quiet);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

#openFocusBtn:hover {
  background: var(--hover);
  border-color: color-mix(in srgb, var(--cyan), var(--line) 55%);
}

.mini-map-container {
  position: relative;
  width: 100%;
  height: clamp(260px, 32vh, 390px);
  min-height: 260px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--quiet);
  contain: layout paint;
  isolation: isolate;
}

.mini-map-container::after {
  content: "© OpenStreetMap";
  position: absolute;
  left: 8px;
  bottom: 6px;
  z-index: 125;
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(9, 13, 16, 0.58);
  color: rgba(239, 243, 246, 0.64);
  font-size: 10px;
  font-weight: 750;
  pointer-events: none;
}

.mini-map-container.maplibre-active-container::after {
  display: none;
}

.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  contain: layout paint;
  isolation: isolate;
}

.map-viewport.dragging {
  cursor: grabbing;
}

.map-viewport.maplibre-active {
  cursor: default;
}

.mini-map-title {
  position: static;
  font-size: 10px;
}

.map-card {
  position: relative;
}

#mapTiles,
#mapMarkers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#mapTiles {
  background: #0f171d;
  contain: layout paint;
  will-change: transform;
  pointer-events: none;
}

#mapMarkers {
  z-index: 2;
  contain: layout paint;
}

.map-viewport.maplibre-active #mapTiles,
.map-viewport.maplibre-active #mapMarkers {
  display: none;
}

.maplibregl-map {
  font: inherit;
  overflow: hidden;
  contain: layout paint;
  isolation: isolate;
}

.maplibregl-control-container {
  font-family: inherit;
}

.mini-map-container .maplibregl-canvas-container,
.mini-map-container .maplibregl-marker,
.mini-map-container .maplibregl-popup {
  z-index: auto;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-radius: 7px !important;
  background: rgba(13, 18, 22, 0.84) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24) !important;
}

.maplibregl-ctrl-group button {
  background-color: transparent !important;
  filter: invert(1) grayscale(1);
}

.maplibregl-ctrl-attrib {
  background: rgba(255, 255, 255, 0.78) !important;
  color: rgba(28, 35, 43, 0.72) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
  color: rgba(28, 35, 43, 0.78) !important;
}

.geo-map-popup .maplibregl-popup-content {
  border: 1px solid rgba(18, 24, 31, 0.14);
  border-radius: 10px;
  background: rgba(250, 252, 255, 0.97);
  color: #17202b;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  padding: 10px;
  font: inherit;
}

.region-map-popup .maplibregl-popup-content {
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(18, 24, 31, 0.14);
  border-radius: 12px;
  background: rgba(250, 252, 255, 0.97);
  color: #17202b;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  padding: 12px;
  font: inherit;
}

.geo-map-popup .maplibregl-popup-tip {
  border-top-color: rgba(250, 252, 255, 0.97) !important;
  border-bottom-color: rgba(250, 252, 255, 0.97) !important;
}

.region-map-popup .maplibregl-popup-tip {
  border-top-color: rgba(250, 252, 255, 0.97) !important;
  border-bottom-color: rgba(250, 252, 255, 0.97) !important;
}

.geo-map-popup .event-tooltip-title,
.region-map-popup .region-tooltip-title {
  color: #0f6f91;
}

.geo-map-popup .event-tooltip-meta,
.region-map-popup .region-tooltip-meta,
.region-map-popup .region-news-row span {
  color: #607083;
}

.geo-map-popup .event-tooltip-body,
.region-map-popup .region-tooltip-body,
.region-map-popup .region-news-row strong {
  color: #17202b;
}

.geo-map-popup .event-tooltip-hint {
  color: #0f6f91;
}

.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0.92;
  filter: saturate(0.96) contrast(0.98) brightness(0.9);
  transform: translateZ(0);
}

.map-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 120;
  display: grid;
  gap: 5px;
  pointer-events: auto;
}

.map-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(13, 18, 22, 0.84);
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.map-controls button:hover {
  background: color-mix(in srgb, var(--cyan) 18%, var(--panel));
  border-color: color-mix(in srgb, var(--cyan) 50%, var(--line));
}

.map-hotspot {
  position: absolute;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 6px 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  outline: none;
  z-index: 2;
  transform: translate(-50%, -50%);
  will-change: transform;
  contain: layout paint;
}

.maplibre-hotspot {
  pointer-events: auto;
}

.maplibre-hotspot .region-tooltip {
  pointer-events: none;
}

.map-hotspot:hover,
.map-hotspot:focus,
.map-hotspot:focus-within {
  z-index: 80;
}

.map-hotspot:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 61, 94, 0.28), 0 0 var(--hotspot-glow, 18px) var(--red);
}

.geo-event-marker {
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: var(--cyan);
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.geo-event-marker.major { background: var(--red); }
.geo-event-marker.high { background: #ff9f5f; }
.geo-event-marker.medium { background: var(--gold); }
.geo-event-marker.low { background: var(--cyan); }

.event-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(280px, 58vw);
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(13, 18, 22, 0.94);
  color: var(--text);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 95;
}

.geo-event-marker:hover,
.geo-event-marker:focus {
  z-index: 88;
}

.geo-event-marker:hover .event-tooltip,
.geo-event-marker:focus .event-tooltip {
  opacity: 1;
  visibility: visible;
}

.event-tooltip-title {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.event-tooltip-meta {
  margin-top: 5px;
  color: var(--weak);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.event-tooltip-body {
  margin-top: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.42;
}

.event-tooltip-hint {
  margin-top: 7px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.map-hotspot-ring {
  position: absolute;
  left: -100%;
  top: -100%;
  width: 300%;
  height: 300%;
  border: 1px solid var(--red);
  border-radius: 50%;
  opacity: 0.34;
  pointer-events: none;
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .map-hotspot,
  .map-hotspot-ring {
    animation: none !important;
  }
}

.region-tooltip {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  width: min(320px, 62vw);
  max-height: 190px;
  overflow: auto;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(13, 18, 22, 0.94);
  color: var(--text);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
  padding: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.region-tooltip.left {
  left: auto;
  right: 50%;
  transform: translateX(8px);
}

.region-tooltip.right {
  left: 50%;
  right: auto;
  transform: translateX(-8px);
}

.region-tooltip.above {
  top: auto;
  bottom: calc(100% + 20px);
}

.map-hotspot:hover .region-tooltip,
.map-hotspot:focus .region-tooltip {
  opacity: 1;
  visibility: visible;
}

.region-tooltip-title {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.region-tooltip-meta {
  margin: -2px 0 8px;
  color: var(--weak);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.region-tooltip-body {
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.region-news-list {
  display: grid;
  gap: 6px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.region-news-row {
  display: grid;
  gap: 2px;
}

.region-news-row span {
  color: var(--weak);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.region-news-row strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 780;
  line-height: 1.34;
}

.map-layer-panel {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 78%, var(--bg));
  padding: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.map-layer-head {
  margin: 0;
}

.map-layer-toggle {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: 0;
  text-align: left;
}

.map-layer-toggle strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.map-layer-toggle span {
  min-width: 0;
  color: var(--weak);
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-layer-toggle em {
  color: var(--cyan);
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.map-layer-body {
  margin-top: 6px;
}

.map-layer-body[hidden] {
  display: none;
}

.map-layer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 7px;
}

.map-layer-actions button {
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 70%, var(--panel));
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.map-layer-actions button:hover {
  color: var(--text);
  background: var(--hover);
}

.map-layer-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding-right: 2px;
}

.map-layer-group {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-layer-option {
  min-width: 0;
  height: 26px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 6px;
  font-size: 10px;
  font-weight: 820;
}

.map-layer-option.active {
  border-color: color-mix(in srgb, var(--cyan) 48%, var(--line));
  background: color-mix(in srgb, var(--cyan) 10%, transparent);
  color: var(--text);
}

.layer-check {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
}

.map-layer-option.active .layer-check {
  background: var(--cyan);
  border-color: var(--cyan);
}

.layer-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.map-layer-option strong {
  color: var(--weak);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

:root[data-theme="light"] .region-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .region-tooltip {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.1);
  }
}

.hero-meta {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.control-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.control-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 6px;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: var(--quiet);
  border: 1px solid var(--line);
}
.segmented > * {
  flex: 1;
  min-width: min-content;
}

:root[data-theme="light"] .segmented {
  background: rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .segmented {
    background: rgba(0, 0, 0, 0.05);
  }
}

.segmented button {
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.segmented button:hover {
  background: var(--hover);
  color: var(--text);
}

.segmented button.active {
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}

.refresh {
  height: 44px;
  border-radius: 14px;
  background: var(--cyan);
  color: #10202a;
  font-weight: 800;
  font-size: 14px;
  box-shadow: none;
}

.refresh:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.refresh.loading {
  opacity: 0.7;
  pointer-events: none;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

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

.fear-gauge {
  min-height: 96px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--quiet), transparent);
  padding: 12px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.dial {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(from -120deg, var(--green) 0deg, var(--gold) 115deg, var(--red) 240deg, transparent 240deg 360deg);
  position: relative;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 1s ease;
}

.dial::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
}

.dial-value {
  position: relative;
  z-index: 1;
  font-size: 21px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
}

.fear-copy span {
  display: block;
  color: var(--weak);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fear-copy strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 900;
}

.fear-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.fear-copy p .fear-formula-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.42;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-card-head .control-title {
  margin-bottom: 0;
}

#aiCard #aiSummaryWindow {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}

#aiCard #aiSummaryContent {
  margin-top: 4px;
}

.ai-summary-updated {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--weak);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.threat-card {
  gap: 10px;
}

.threat-card.threat-state-major {
  border-color: color-mix(in srgb, var(--red) 62%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--red) 13%, transparent), transparent 42%),
    var(--panel);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 18%, transparent), 0 14px 34px rgba(0, 0, 0, 0.28);
}

.threat-card.threat-state-high {
  border-color: color-mix(in srgb, var(--gold) 52%, var(--line));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent 40%),
    var(--panel);
}

.threat-card.threat-state-major .control-title,
.threat-card.threat-state-major .threat-score small {
  color: color-mix(in srgb, var(--red) 84%, var(--text));
}

.threat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 28px;
}

.threat-head strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: 0;
}

.threat-score {
  min-width: 70px;
  display: grid;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}

.threat-score span {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 950;
}

.threat-score small {
  margin-top: 3px;
  color: var(--weak);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.threat-meter {
  height: 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--quiet);
  overflow: hidden;
}

.threat-meter span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  transition: width 0.32s ease, background-color 0.32s ease;
}

.threat-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.42;
  font-variant-numeric: tabular-nums;
}

.threat-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.threat-chip {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--quiet);
  padding: 6px;
}

.threat-chip span,
.threat-incident span {
  display: block;
  color: var(--weak);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threat-chip strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.threat-chip.major { border-color: color-mix(in srgb, var(--red), var(--line) 48%); }
.threat-chip.high { border-color: color-mix(in srgb, #ff9f5f, var(--line) 52%); }
.threat-chip.medium { border-color: color-mix(in srgb, var(--gold), var(--line) 55%); }
.threat-chip.low { border-color: color-mix(in srgb, var(--green), var(--line) 62%); }

.threat-incidents {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow: auto;
}

.threat-ai-block {
  border: 1px solid color-mix(in srgb, var(--cyan) 30%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--cyan) 8%, transparent);
  padding: 8px;
}

.threat-ai-block span {
  display: block;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.threat-ai-block p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.45;
}

.threat-ai-block ul {
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.threat-ai-block ul.muted {
  color: var(--weak);
}

.threat-ai-subtitle {
  margin-top: 7px;
  color: var(--weak);
  font-size: 10px;
  font-weight: 900;
}

.threat-incident {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.threat-incident strong {
  display: -webkit-box;
  margin-top: 3px;
  color: var(--text);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.38;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.threat-incident em {
  display: block;
  margin-top: 3px;
  color: var(--cyan);
  font-size: 10px;
  font-style: normal;
  font-weight: 820;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threat-empty {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--weak);
  font-size: 12px;
  font-weight: 760;
}

.ai-summary-bullet {
  display: flex;
  gap: 8px;
  margin: 9px 0;
}

.ai-summary-bullet > span {
  color: var(--cyan);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.5;
}

.ai-summary-bullet > div,
.ai-summary-line {
  color: var(--text);
  font-size: 13px;
  line-height: 1.58;
  font-weight: 520;
}

.ai-summary-line {
  margin-bottom: 8px;
}

.ai-situation-headline {
  margin: 8px 0 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 900;
}

.ai-situation-list {
  display: grid;
  gap: 8px;
}

.ai-situation-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: var(--quiet);
  padding: 9px 10px;
}

.ai-situation-card.high {
  border-left-color: var(--red);
}

.ai-situation-card.medium {
  border-left-color: var(--gold);
}

.ai-situation-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.ai-situation-top strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.25;
}

.ai-situation-top span {
  flex: 0 0 auto;
  color: var(--weak);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.ai-situation-card p {
  margin: 7px 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.48;
  font-weight: 650;
}

.ai-situation-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 7px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ai-situation-row b {
  color: var(--weak);
  font-weight: 900;
}

.ai-brief-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--quiet);
  padding: 8px 9px;
}

.ai-brief-stance {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.52;
  font-weight: 680;
}

.ai-brief-grid {
  display: grid;
  gap: 8px;
}

.ai-brief-grid > div {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.ai-brief-grid b {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.ai-brief-grid ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.48;
}

.ai-brief-grid li + li {
  margin-top: 3px;
}

.ai-brief-confidence {
  margin-top: 8px;
  color: var(--weak);
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.ai-world-grid {
  display: grid;
  gap: 6px;
}

.ai-world-section {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.ai-world-section span {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.ai-world-section strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  line-height: 1.32;
  font-weight: 900;
}

.ai-world-section p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  font-weight: 620;
}

.ai-world-watch {
  border-top: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--gold) 70%, var(--line));
  margin-top: 6px;
  padding: 7px 0 0 9px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 8%, transparent), transparent 70%);
}

.ai-world-watch b {
  display: block;
  margin-bottom: 5px;
  color: color-mix(in srgb, var(--gold) 86%, var(--text));
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.ai-world-watch ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.48;
}

.status-cell {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--quiet);
  transition: background 0.3s ease;
}

.status-cell:hover {
  background: var(--hover);
}

.status-cell span {
  display: block;
  color: var(--weak);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-cell strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.markets {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
  overflow: hidden;
}

.market-ticker {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--quiet);
  padding: 6px;
  mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}

.market-track {
  display: flex;
  gap: 8px;
  width: max-content;
  animation: marketMarquee 34s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

.market-ticker:hover .market-track {
  animation-play-state: paused;
}

.market {
  flex: 0 0 168px;
  min-width: 168px;
  min-height: 54px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--quiet);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: default;
}

.market:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  background: var(--hover);
  border-color: color-mix(in srgb, var(--line) 65%, var(--cyan));
}

.market .label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  grid-column: 1 / 2;
}

.market .price {
  margin-top: 3px;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  grid-column: 1 / 2;
}

.market .change {
  margin-top: 0;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--quiet);
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  align-self: center;
}

.market .volume {
  margin-top: 4px;
  color: var(--weak);
  font-size: 9px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}

@keyframes marketMarquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(calc(-50% - 4px), 0, 0); }
}

.up { color: var(--green); }
.down { color: var(--red); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.feed-panel, .side-panel-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: var(--backdrop);
  -webkit-backdrop-filter: var(--backdrop);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.side-panel {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 10px;
}

.section-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--quiet);
}

.section-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.source-health {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--bg));
  min-width: 0;
}

.source-health-main {
  flex: 0 0 auto;
  display: grid;
  gap: 1px;
}

.source-health-main strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.source-health-main span {
  color: var(--weak);
  font-size: 10px;
  font-weight: 820;
}

.source-health-cats {
  min-width: 0;
  display: flex;
  gap: 5px;
  overflow: auto;
  scrollbar-width: thin;
}

.source-health-cats span {
  flex: 0 0 auto;
  height: 23px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--quiet);
  color: var(--muted);
  padding: 0 7px;
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.filter-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  width: min(280px, 55vw);
  min-width: 160px;
  height: 34px;
  padding: 0 32px 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.feed-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.translate-feed-btn {
  flex: 0 0 auto;
  height: 34px;
  min-width: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 78%, var(--panel));
  color: var(--muted);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.translate-feed-btn:hover {
  color: var(--text);
  background: var(--quiet);
}

.translate-feed-btn.active {
  color: var(--cyan);
  border-color: color-mix(in srgb, var(--cyan) 52%, var(--line));
  background: color-mix(in srgb, var(--cyan) 12%, var(--panel));
}

.translate-feed-btn:disabled {
  cursor: progress;
  color: var(--weak);
  opacity: 0.78;
}

.source-filter {
  position: relative;
  flex: 1 1 min(300px, 48vw);
  width: min(300px, 48vw);
  min-width: 0;
  max-width: 100%;
  z-index: 40;
}

.source-filter-button {
  width: 100%;
  min-width: 0;
  height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 78%, var(--panel));
  color: var(--text);
  padding: 0 8px 0 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.source-filter-button span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.source-filter-count {
  min-width: 24px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--cyan) 18%, transparent);
  color: var(--cyan);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.source-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(430px, 62vh);
  display: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, #000);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  padding: 6px;
  z-index: 80;
}

.source-filter.open .source-filter-menu {
  display: grid;
  gap: 3px;
}

.source-option {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.source-option.is-quiet {
  opacity: 0.62;
}

.source-option.is-live .source-check {
  border-color: color-mix(in srgb, var(--green) 60%, var(--line));
}

.source-option.is-live .source-check::after {
  background: var(--green);
}

.source-option span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-option strong {
  font-weight: 800;
}

.source-option em {
  margin-left: 7px;
  color: var(--weak);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}

.source-option:hover {
  background: var(--quiet);
  color: var(--text);
}

.source-option.active {
  color: var(--text);
  background: color-mix(in srgb, var(--cyan) 10%, transparent);
}

.source-check {
  width: 13px;
  height: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
}

.source-option.active .source-check {
  border-color: color-mix(in srgb, var(--cyan) 72%, var(--line));
  background: var(--cyan);
  box-shadow: inset 0 0 0 3px var(--panel);
}

.feed {
  display: grid;
  contain: layout paint;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.12s ease;
  contain: layout paint;
}

.feed-item:last-child { border-bottom: 0; }

.feed-item:hover { 
  background: var(--quiet); 
}

.feed-item.feed-priority-major {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--red) 14%, transparent), transparent 46%),
    color-mix(in srgb, var(--panel2) 58%, transparent);
}

.feed-item.feed-priority-high {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--gold) 10%, transparent), transparent 44%),
    color-mix(in srgb, var(--panel2) 40%, transparent);
}

.feed-item::before {
  content: "";
  position: absolute;
  left: 98px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
  transition: left 0.2s ease;
}

.feed-item.feed-priority-major::before {
  width: 4px;
  background: var(--red);
  box-shadow: 0 0 14px color-mix(in srgb, var(--red) 46%, transparent);
}

.feed-item.feed-priority-high::before {
  width: 3px;
  background: var(--gold);
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 34%, transparent);
}

.feed-item:hover::before {
  background: var(--cyan);
  opacity: 0.65;
}

.feed-item.new-item {
  animation: none;
}

.feed-time {
  color: var(--weak);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  align-self: center;
  font-variant-numeric: tabular-nums;
}

.feed-body { min-width: 0; }

.feed-pager {
  min-height: 42px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: color-mix(in srgb, var(--panel2) 62%, transparent);
}

.feed-pager-meta {
  color: var(--weak);
  font-size: 11px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.feed-pager-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.feed-pager button {
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 72%, var(--panel));
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.feed-pager button:hover:not(:disabled),
.feed-pager button.active {
  color: var(--text);
  background: color-mix(in srgb, var(--cyan) 16%, var(--panel));
  border-color: color-mix(in srgb, var(--cyan) 48%, var(--line));
}

.feed-pager button:disabled {
  cursor: default;
  opacity: 0.42;
}

@media (max-width: 600px) {
  .feed-pager {
    align-items: stretch;
    flex-direction: column;
    padding: 8px 10px;
  }

  .feed-pager-controls {
    width: 100%;
    justify-content: space-between;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .feed-pager-controls::-webkit-scrollbar {
    display: none;
  }

  .feed-pager button {
    flex: 0 0 auto;
  }
}

.feed-source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-category {
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--cyan) 28%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--cyan) 10%, transparent);
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.source-category.muted {
  border-color: var(--line);
  background: transparent;
  color: var(--weak);
}

.priority-badge {
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.03em;
}

.priority-badge.major {
  border: 1px solid color-mix(in srgb, var(--red) 58%, var(--line));
  background: color-mix(in srgb, var(--red) 16%, transparent);
  color: color-mix(in srgb, var(--red) 86%, var(--text));
}

.priority-badge.high {
  border: 1px solid color-mix(in srgb, var(--gold) 54%, var(--line));
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  color: color-mix(in srgb, var(--gold) 78%, var(--text));
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.feed-title {
  font-size: 16px;
  line-height: 1.36;
  font-weight: 700;
  color: var(--text);
  transition: color 0.2s ease;
}

.feed-item:hover .feed-title {
  color: color-mix(in srgb, var(--text) 80%, var(--cyan));
}

.feed-summary {
  max-width: 900px;
  margin-top: 6px;
  color: var(--weak);
  font-size: 13px;
  line-height: 1.5;
}

.side-panel-card {
  padding: 14px;
}

.brief-title {
  margin: 0 0 10px 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.driver-list {
  display: grid;
  gap: 0;
}

.driver {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s ease, padding 0.2s ease;
  contain: layout paint;
}

.driver:hover {
  background: var(--quiet);
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 6px;
}

.driver:last-child { border-bottom: 0; }

.driver strong {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 14px;
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.warn { color: var(--gold) !important; }

@media (max-width: 760px) {
  .main-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .map-col,
  .left-col,
  .right-col {
    grid-column: auto;
    grid-row: auto;
  }
  .map-col, .left-col, .right-col { display: contents; }
  .headline, .feed-panel, #settingsCard, #threatCard, #aiCard, #keywordsPanel, #mapCard {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .headline { order: 1; }
  #keywordsPanel { order: 2; }
  #mapCard { order: 3; }
  .feed-panel { order: 4; }
  #settingsCard { order: 5; }
  #threatCard { order: 6; }
  #aiCard { order: 7; }
}

@media (max-width: 1180px) {
  .headline-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .content { 
    padding: env(safe-area-inset-top, 8px) 6px env(safe-area-inset-bottom, 8px); 
    gap: 8px;
  }
  .headline-top { grid-template-columns: minmax(0, 1fr); }
  .markets {
    display: flex;
    gap: 6px;
  }
  .market {
    flex-basis: 132px;
    min-width: 132px;
    min-height: 58px;
    padding: 6px;
  }
  .market .price {
    font-size: 13px;
  }
  .market .label { font-size: 9px; }
  .market .change { font-size: 10px; padding: 1px 3px; }
  .market .volume { display: none; }
  .left-col, .right-col { gap: 8px; }
  
  .headline, .control-card, .feed-panel, .side-panel-card { 
    padding: 10px; 
    border-radius: 12px;
  }
  .headline { order: 1; }
  #keywordsPanel { order: 2; }
  #mapCard { order: 3; }
  .feed-panel { order: 4; }
  #settingsCard { order: 5; }
  #threatCard { order: 6; }
  #aiCard { order: 7; }
  /* Make segmented controls wrap if needed */
  .segmented { 
    flex-wrap: wrap; 
    justify-content: flex-start;
  }
  .segmented button {
    flex: 1 1 auto;
    text-align: center;
    padding: 5px 8px;
    font-size: 12px;
  }
  .map-layer-list {
    grid-template-columns: minmax(0, 1fr);
    max-height: 220px;
  }
  .map-layer-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .map-layer-actions button {
    min-width: 0;
    padding: 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* Stack AI Summary title and window selector */
  #aiCard > div:first-child {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  #aiSummaryWindow {
    width: 100%;
  }

  .hero-meta { margin-top: 8px; flex-direction: column; align-items: flex-start; }
  
  .feed-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
  }
  .feed-item::before { display: none; }
  .feed-item:hover { transform: none; background: var(--quiet); }
  
  .time-badge { margin-bottom: 4px; }
  .status-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  
  .fear-gauge { flex-direction: column; align-items: center; text-align: center; }
  
  .section-head {
    padding: 10px;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px;
  }
  .feed-actions { width: 100%; justify-content: stretch; min-width: 0; }
  .translate-feed-btn { min-width: 74px; }
  .source-filter { max-width: 100% !important; width: 100%; min-width: 0; }
  .source-filter-menu { left: auto; right: 0; width: min(100%, calc(100vw - 24px)); max-width: calc(100vw - 24px); }
}

/* Focus Mode CSS */
.is-focus-mode {
  overflow: hidden;
}

#focusOverlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 8%, rgba(46, 91, 112, 0.18), transparent 36%),
    #0f1215;
  color: #f3f5f7;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 0, 0) scale(1.012);
  transform-origin: center;
  transition:
    opacity 360ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 360ms;
  will-change: opacity, transform;
  contain: layout paint;
}

#focusOverlay.focus-overlay-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    opacity 360ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s;
}

#focusOverlay.focus-overlay-closing {
  opacity: 0;
  visibility: visible;
  pointer-events: none;
  transform: translate3d(0, 0, 0) scale(1.006);
}

.focus-topbar {
  position: absolute;
  top: 22px;
  left: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 10;
  opacity: 0;
  transform: translate3d(0, -8px, 0);
  transition:
    opacity 420ms cubic-bezier(0.22, 1, 0.36, 1) 80ms,
    transform 520ms cubic-bezier(0.22, 1, 0.36, 1) 80ms;
  will-change: opacity, transform;
}

#focusOverlay.focus-overlay-visible .focus-topbar {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.focus-brand {
  color: rgba(243, 245, 247, 0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#exitFocusBtn {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(243, 245, 247, 0.18);
  border-radius: 8px;
  background: rgba(243, 245, 247, 0.06);
  color: #f3f5f7;
  font-size: 13px;
  font-weight: 800;
}

#exitFocusBtn:hover {
  background: rgba(243, 245, 247, 0.11);
}

#focusNewsContainer {
  position: relative;
  width: min(1160px, calc(100vw - 56px));
  height: min(76vh, 720px);
  margin: 0 auto;
  display: grid;
  place-items: center;
  text-align: center;
}

.focus-news {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: grid;
  justify-items: center;
  opacity: 0;
  transform: translate3d(-50%, calc(-50% + 18px), 0) scale(0.985);
  animation: focusFadeIn 760ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity, transform;
  backface-visibility: hidden;
  contain: layout paint;
}

.focus-news.fade-out {
  animation: focusFadeOut 360ms cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

.focus-news-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: rgba(243, 245, 247, 0.64);
  font-size: clamp(13px, 1.4vw, 18px);
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.focus-news-title {
  max-width: 1080px;
  margin: 0 auto;
  color: #f7f8fa;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0;
  text-wrap: balance;
}

.focus-news-summary {
  max-width: 900px;
  margin: 26px auto 0;
  color: rgba(243, 245, 247, 0.72);
  font-size: clamp(16px, 1.7vw, 24px);
  line-height: 1.55;
  font-weight: 500;
}

@keyframes focusFadeIn {
  from { opacity: 0; transform: translate3d(-50%, calc(-50% + 18px), 0) scale(0.985); }
  to { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1); }
}

@keyframes focusFadeOut {
  from { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1); }
  to { opacity: 0; transform: translate3d(-50%, calc(-50% - 12px), 0) scale(0.992); }
}

@media (max-width: 760px) {
  .brand-row { align-items: flex-start; }
  #openFocusBtn { min-height: 28px; padding: 0 10px; }
  .focus-topbar { top: 14px; left: 14px; right: 14px; }
  #focusNewsContainer { width: calc(100vw - 28px); height: 76vh; }
  .focus-news-title { font-size: clamp(28px, 9vw, 46px); }
  .focus-news-summary { font-size: 16px; }
}
@media (max-width: 600px) { .section-head { flex-wrap: wrap; gap: 12px; } }

@media (max-width: 600px) {
  .section-head { flex-wrap: wrap !important; gap: 10px !important; }
  .section-head h2 { width: 100%; }
  .feed-actions {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  .translate-feed-btn {
    min-width: 64px;
    padding-inline: 10px;
  }
  .source-filter {
    width: 100%;
    min-width: 0;
  }
  .source-filter-button {
    min-width: 0;
  }
  .source-filter-menu {
    left: auto;
    right: 0;
    width: min(100%, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }
}

/* Professional terminal visual pass */
:root {
  --bg: #0b0f12;
  --panel: #11171b;
  --panel2: #151c21;
  --text: #e7ecef;
  --muted: #9aa7b0;
  --weak: #687680;
  --line: rgba(211, 222, 229, 0.095);
  --green: #43b982;
  --red: #d95d6a;
  --cyan: #5fa8c2;
  --gold: #c9a84a;
  --hover: rgba(226, 236, 242, 0.055);
  --quiet: rgba(226, 236, 242, 0.032);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.025), 0 12px 28px rgba(0, 0, 0, 0.18);
  --border-glow: rgba(95, 168, 194, 0.055);
  --radius: 8px;
}

:root[data-theme="light"] {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --panel2: #e9eef1;
  --text: #202a31;
  --muted: #5e6b73;
  --weak: #7f8b93;
  --line: rgba(32, 42, 49, 0.105);
  --green: #18805a;
  --red: #b94353;
  --cyan: #2c7891;
  --gold: #98711f;
  --hover: rgba(32, 42, 49, 0.045);
  --quiet: rgba(32, 42, 49, 0.028);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 24px rgba(31, 41, 51, 0.07);
}

body {
  background: var(--bg);
}

.content {
  padding: 8px 10px 14px;
  gap: 8px;
}

.main-layout {
  gap: 8px;
}

.map-col,
.left-col,
.right-col,
.side-panel {
  gap: 8px;
}

.headline,
.control-card,
.feed-panel,
.side-panel-card {
  border-radius: var(--radius);
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.headline {
  padding: 9px 10px;
  gap: 8px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 94%, var(--cyan)), var(--panel));
}

.control-card {
  padding: 10px;
  gap: 8px;
}

.side-panel-card {
  padding: 10px;
}

.mini-map-container,
.market-ticker,
.market,
.segmented,
.filter-select,
.source-filter-button,
.source-filter-menu,
.translate-feed-btn,
.fear-gauge,
#openFocusBtn,
#exitFocusBtn {
  border-radius: var(--radius);
}

.market-ticker {
  padding: 4px;
  background: color-mix(in srgb, var(--panel2) 70%, transparent);
}

.market-track {
  gap: 6px;
}

.market {
  flex-basis: 154px;
  min-width: 154px;
  min-height: 48px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
}

.market:hover {
  transform: none;
  box-shadow: none;
  background: var(--hover);
}

.market .label {
  font-size: 9px;
  letter-spacing: 0.06em;
}

.market .price {
  font-size: 14px;
}

.market .change {
  font-size: 10px;
  border-radius: 4px;
}

.section-head {
  padding: 9px 12px;
  background: color-mix(in srgb, var(--panel2) 76%, transparent);
}

.section-head h2,
.control-title,
.brief-title {
  letter-spacing: 0.08em;
}

.filter-select,
.source-filter-button,
.translate-feed-btn {
  height: 30px;
  background: color-mix(in srgb, var(--bg) 76%, var(--panel));
}

.segmented {
  padding: 3px;
  gap: 3px;
  background: color-mix(in srgb, var(--bg) 70%, var(--panel));
}

.segmented button {
  height: 25px;
  font-size: 12px;
}

.segmented button.active {
  background: color-mix(in srgb, var(--cyan) 26%, var(--panel2));
  color: var(--text);
}

.feed-item {
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
}

.feed-item:hover {
  background: color-mix(in srgb, var(--cyan) 7%, transparent);
  transform: none;
}

.feed-item::before {
  left: 84px;
  width: 1px;
}

.feed-item:hover::before {
  left: 84px;
}

.feed-time {
  font-size: 12px;
}

.feed-source {
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.feed-title {
  font-size: 15px;
  line-height: 1.32;
  font-weight: 680;
}

.feed-summary {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.driver {
  padding: 7px 0;
}

.fear-gauge {
  min-height: 82px;
  padding: 10px;
}

.dial {
  width: 62px;
  height: 62px;
}

.dial-value {
  font-size: 18px;
}

@media (max-width: 760px) {
  .headline,
  .control-card,
  .feed-panel,
  .side-panel-card {
    border-radius: var(--radius);
  }

  .feed-item {
    padding: 9px 10px;
  }
}

/* Fluid editorial pass */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --motion-fast: 140ms;
  --motion-med: 260ms;
  --surface-lift: 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 34px rgba(0, 0, 0, 0.2);
}

html {
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 88%, #172026) 0, var(--bg) 280px),
    var(--bg);
}

.content {
  position: relative;
}

.headline,
.control-card,
.feed-panel,
.side-panel-card {
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-med) var(--ease-out);
}

.control-card:hover,
.side-panel-card:hover,
.feed-panel:hover,
.headline:hover {
  border-color: color-mix(in srgb, var(--line) 72%, var(--text));
  box-shadow: var(--surface-lift);
}

.keywords-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.keywords-head .brief-title {
  margin: 0;
}

#keywordsWindow,
#aiSummaryWindow {
  background: color-mix(in srgb, var(--bg) 72%, var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
}

.mini-map-container {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel2) 80%, transparent), color-mix(in srgb, var(--bg) 70%, transparent));
}

.map-hotspot {
  animation: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--red), transparent 70%);
  transition:
    transform var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);
  will-change: transform;
}

.map-hotspot:hover,
.map-hotspot:focus,
.map-hotspot:focus-within {
  transform: translate(-50%, -50%) scale(1.28);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red), transparent 82%), 0 0 18px color-mix(in srgb, var(--red), transparent 56%);
}

.map-hotspot-ring {
  display: none;
}

.region-tooltip {
  border-radius: var(--radius);
  transform: translate(-50%, 6px);
  transition:
    opacity var(--motion-med) var(--ease-out),
    transform var(--motion-med) var(--ease-out),
    visibility var(--motion-med) var(--ease-out);
}

.region-tooltip.left {
  transform: translate(8px, 6px);
}

.region-tooltip.right {
  transform: translate(-8px, 6px);
}

.map-hotspot:hover .region-tooltip,
.map-hotspot:focus .region-tooltip {
  transform: translate(-50%, 0);
}

.map-hotspot:hover .region-tooltip.left,
.map-hotspot:focus .region-tooltip.left {
  transform: translate(8px, 0);
}

.map-hotspot:hover .region-tooltip.right,
.map-hotspot:focus .region-tooltip.right {
  transform: translate(-8px, 0);
}

.market-track {
  animation-duration: 46s;
}

.market {
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-out);
}

.market:hover {
  transform: translateY(-1px);
}

.source-filter-menu {
  transform-origin: top right;
  opacity: 0;
  transform: translateY(-4px) scale(0.985);
  transition:
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}

.source-filter.open .source-filter-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.feed {
  content-visibility: visible;
}

.feed-item {
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
}

.feed-item:hover {
  transform: none;
}

.feed-item.new-item {
  animation: none;
}

.dot {
  box-shadow: none;
}

@media (max-width: 760px) {
  .content {
    padding-inline: 8px;
  }

  .market-track {
    animation-duration: 38s;
  }
}

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

/* Lower-density dashboard pass: keep the timeline scannable and avoid text walls. */
.main-layout {
  grid-template-columns: minmax(340px, 0.74fr) minmax(0, 1.78fr) minmax(310px, 0.68fr);
  gap: 12px;
}

.map-col,
.left-col,
.right-col {
  gap: 12px;
}

.control-card,
.side-panel-card,
.feed-panel,
.headline {
  border-radius: 8px;
}

.control-title,
.section-head h2,
.mini-map-title {
  letter-spacing: 0;
}

.feed-item {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 18px;
  padding: 16px 18px;
}

.feed-item::before {
  left: 94px;
}

.feed-source {
  max-width: 100%;
  gap: 6px;
  margin-bottom: 6px;
  overflow: hidden;
  white-space: nowrap;
}

.feed-source > span:not(.dot) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-title {
  font-size: 17px;
  line-height: 1.34;
  font-weight: 820;
}

.feed-summary {
  display: -webkit-box;
  max-width: 780px;
  margin-top: 5px;
  color: color-mix(in srgb, var(--muted) 86%, transparent);
  font-size: 12px;
  line-height: 1.42;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.threat-card {
  gap: 12px;
}

.threat-meta {
  display: none;
}

.threat-incidents {
  max-height: 178px;
  gap: 8px;
}

.threat-ai-block {
  padding: 9px;
}

.threat-ai-block p {
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.38;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.threat-ai-block ul {
  margin-top: 5px;
  font-size: 11px;
}

.threat-ai-block li {
  margin: 2px 0;
}

.threat-incident strong {
  font-size: 12px;
  line-height: 1.34;
  -webkit-line-clamp: 1;
}

.ai-situation-headline {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.32;
}

.ai-brief-panel {
  gap: 8px;
}

.ai-brief-stance,
.ai-world-section p,
.ai-world-watch li {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-brief-stance {
  -webkit-line-clamp: 2;
}

.ai-world-grid {
  gap: 7px;
}

.ai-world-section {
  padding: 9px;
}

.ai-world-section p {
  -webkit-line-clamp: 2;
}

.ai-world-watch li {
  -webkit-line-clamp: 1;
}

.keyword-list li,
.region-news-item,
.fear-driver,
.driver-list li {
  line-height: 1.35;
}

@media (max-width: 980px) {
  .feed-summary {
    -webkit-line-clamp: 1;
  }
}

