:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #12192b;
  --muted: #63708a;
  --border: #dce3ed;
  --accent: #3957e8;
  --accent-strong: #2238b7;
  --accent-soft: #e8edff;
  --map-land: #d9e0e7;
  --map-line: #ffffff;
  --shadow: 0 18px 50px rgba(28, 39, 66, 0.12);
  --radius: 8px;
  --politics: #7657e8;
  --disasters: #e13f3f;
  --accidents: #e87821;
  --positive: #19a566;
  --celebrity: #d19a00;
  --technology: #3366d9;
  --sports: #1977e5;
  --health: #df4ca3;
  --business: #087d85;
  --environment: #318147;
  --science: #673bb7;
  --culture: #a8511d;
  --conflict: #b6263c;
  --world: #5b667c;
}

body[data-theme="press"] {
  --bg: #f5f2ec;
  --surface: #fffdfa;
  --surface-soft: #ece7dd;
  --text: #171717;
  --muted: #686053;
  --border: #ddd3c3;
  --accent: #bf2f2f;
  --accent-strong: #8e1d1d;
  --accent-soft: #fbe7e1;
  --map-land: #d8d2c6;
  --shadow: 0 18px 45px rgba(37, 28, 18, 0.13);
}

body[data-theme="night"] {
  color-scheme: dark;
  --bg: #10141f;
  --surface: #171d2a;
  --surface-soft: #202837;
  --text: #edf3ff;
  --muted: #a8b3c8;
  --border: #2b3548;
  --accent: #32d2c8;
  --accent-strong: #9af3dc;
  --accent-soft: #123a42;
  --map-land: #2a3345;
  --map-line: #151b26;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

body[data-theme="earth"] {
  --bg: #f3f7f1;
  --surface: #ffffff;
  --surface-soft: #e5eee4;
  --text: #17231b;
  --muted: #627061;
  --border: #d3dfd2;
  --accent: #277a5c;
  --accent-strong: #155a42;
  --accent-soft: #dff2e9;
  --map-land: #ccd8ce;
  --shadow: 0 18px 50px rgba(29, 65, 48, 0.13);
}

body[data-theme="signal"] {
  color-scheme: dark;
  --bg: #141414;
  --surface: #1f2024;
  --surface-soft: #2b2d34;
  --text: #f4f6fb;
  --muted: #b6bdca;
  --border: #383b45;
  --accent: #f5c542;
  --accent-strong: #ffe28a;
  --accent-soft: #44371c;
  --map-land: #343844;
  --map-line: #1d1f25;
  --shadow: 0 22px 68px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: max-content;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 8px 24px rgba(20, 31, 50, 0.08);
}

.brand strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.05;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1;
}

.search-wrap {
  position: relative;
  width: min(320px, 100%);
}

.search-wrap > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px 0 38px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search-results {
  position: absolute;
  z-index: 80;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search-results button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.search-results button:hover {
  background: var(--surface-soft);
}

.language-control {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 4px 0 10px;
  white-space: nowrap;
}

.language-control > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 3px;
}

.segment {
  border: 0;
  border-radius: 6px;
  background: transparent;
  min-width: 42px;
  height: 34px;
  cursor: pointer;
  color: var(--muted);
}

.segment.active {
  background: var(--accent);
  color: #fff;
}

.theme-select {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  white-space: nowrap;
}

.theme-select select {
  border: 0;
  background: transparent;
  color: var(--text);
  outline: none;
}

.icon-button,
.ghost-button,
.primary-button {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  padding: 0;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.primary-button.loading svg {
  animation: button-spin 800ms linear infinite;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-bar {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0 14px;
  scrollbar-width: thin;
}

.category-button {
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  cursor: pointer;
  min-width: max-content;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.category-button:hover {
  transform: translateY(-1px);
  border-color: var(--category-color);
}

.category-button.active {
  border-color: color-mix(in srgb, var(--category-color) 70%, var(--border));
  background: color-mix(in srgb, var(--category-color) 12%, var(--surface));
}

.category-button svg {
  width: 19px;
  height: 19px;
  color: var(--category-color);
}

.map-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.2vw, 2.4rem);
  line-height: 1.06;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.28rem, 1.7vw, 1.95rem);
  line-height: 1.12;
}

.selection-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 520px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selection-hint svg {
  color: var(--accent);
  flex: 0 0 auto;
}

.map-mode-button {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  cursor: pointer;
}

.map-mode-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.map-mode-button.active svg {
  color: #fff;
}

.map-wrap {
  position: relative;
  padding: 10px 16px 16px;
}

#map {
  position: relative;
  z-index: 0;
  width: 100%;
  height: clamp(360px, 50vw, 650px);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent-soft) 42%, transparent), transparent 36rem),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 58%, transparent), transparent);
  outline: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  overflow: hidden;
}

.leaflet-container {
  z-index: 0;
  background: transparent;
  font: inherit;
}

.leaflet-control-attribution {
  display: none;
}

#map .leaflet-overlay-pane svg {
  pointer-events: auto;
}

#map .leaflet-interactive {
  pointer-events: auto;
  cursor: pointer;
}

.country-tooltip {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(20, 31, 50, 0.12);
  font-weight: 700;
}

.map-tools {
  position: absolute;
  left: 32px;
  bottom: 32px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(20, 31, 50, 0.12);
}

.map-tools button {
  width: 42px;
  height: 40px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.map-tools button:last-child {
  border-bottom: 0;
}

.ad-slot {
  border: 1px dashed color-mix(in srgb, var(--border) 76%, var(--accent));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 78%, var(--accent-soft));
  color: var(--muted);
}

.ad-slot-wide {
  margin: 18px 0 22px;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(80px, auto) 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.ad-slot span {
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0;
}

.ad-slot strong {
  color: var(--text);
}

.ad-card {
  min-height: 260px;
  padding: 18px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.ad-strip {
  display: block;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.ad-strip-media {
  overflow-x: auto;
  scrollbar-width: thin;
}

.ad-strip-map {
  position: relative;
  min-width: 820px;
}

.ad-strip-map img {
  display: block;
  width: 100%;
  height: auto;
}

.ad-hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  border-radius: 4px;
}

.ad-hotspot:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.ad-image-card {
  padding: 0;
  overflow: hidden;
  align-self: start;
  align-content: stretch;
  border-style: solid;
  background: #07122d;
}

.ad-image-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

.ad-image-link img {
  display: block;
  width: 100%;
  max-width: 500px;
  height: auto;
}

.news-section {
  margin-top: 8px;
}

.news-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.news-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

.country-chip {
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 74%, var(--surface));
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 12px;
  cursor: pointer;
  font-weight: 800;
  max-width: 220px;
}

.country-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-chip svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.trust-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 18px;
  color: var(--muted);
}

.trust-strip > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.trust-strip svg {
  color: var(--positive);
  flex: 0 0 auto;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  min-height: 26px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent-strong);
  white-space: nowrap;
}

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

.news-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 410px;
  box-shadow: 0 10px 30px rgba(20, 31, 50, 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.news-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--category-color) 52%, var(--border));
  box-shadow: var(--shadow);
}

.image-wrap {
  position: relative;
  height: 172px;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--category-color) 75%, #111), color-mix(in srgb, var(--surface-soft) 55%, #fff)),
    var(--surface-soft);
}

.image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fallback-art {
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
}

.fallback-art svg {
  width: 58px;
  height: 58px;
}

.news-card-body {
  flex: 1;
  padding: 14px 15px 15px;
  display: flex;
  flex-direction: column;
}

.card-tags {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.source-badge {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--positive) 12%, var(--surface));
  color: var(--positive);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.source-badge svg {
  width: 14px;
  height: 14px;
}

.news-card h3 {
  margin: 10px 0 8px;
  line-height: 1.18;
  font-size: 1.05rem;
}

.news-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.source-line {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-line strong {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 56%;
}

.card-footer {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.skeleton {
  pointer-events: none;
}

.skeleton .image-wrap,
.skeleton-line {
  background: linear-gradient(90deg, var(--surface-soft), color-mix(in srgb, var(--surface-soft) 55%, var(--surface)), var(--surface-soft));
  background-size: 180% 100%;
  animation: shimmer 1.1s infinite linear;
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
  margin: 12px 0;
}

.skeleton-line.short {
  width: 54%;
}

@keyframes shimmer {
  to {
    background-position: -180% 0;
  }
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--text);
  margin: 0 0 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 12, 18, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) 1.1fr;
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.35);
}

.small-modal {
  display: block;
  width: min(620px, 100%);
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.modal-image {
  min-height: 420px;
  background:
    linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 25%, #0f172a)),
    var(--surface-soft);
  background-size: cover;
  background-position: center;
}

.modal-body {
  padding: 34px;
}

.modal-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.modal-body h2 {
  margin-bottom: 14px;
}

.modal-body p {
  color: var(--muted);
  line-height: 1.6;
}

.original-title,
.trust-note {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 52%, var(--surface));
}

.original-title {
  display: grid;
  gap: 5px;
  padding: 12px;
  margin-top: 18px;
}

.original-title strong {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.trust-note {
  padding: 12px;
  margin: -6px 0 22px;
}

.article-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}

.article-facts div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px;
  min-width: 0;
}

.article-facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.article-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0 16px;
  font-weight: 800;
}

.name-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.name-list span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
}

.topbar svg,
.category-bar svg,
.map-tools svg,
.map-mode-button svg,
.news-actions svg,
.trust-strip svg,
.modal-close svg,
.primary-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

@media (max-width: 1100px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-wrap {
    width: min(100%, 420px);
  }

  .news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 14px;
  }

  .map-panel-head,
  .news-heading,
  .trust-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .news-actions,
  .news-actions button {
    width: 100%;
  }

  .news-actions button {
    justify-content: center;
  }

  #map {
    height: 440px;
  }

  .ad-slot-wide {
    grid-template-columns: 1fr;
  }

  .ad-strip-media {
    margin: 0;
  }

  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-card {
    grid-template-columns: 1fr;
  }

  .modal-image {
    min-height: 260px;
  }

  .article-facts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .search-wrap,
  .language-control,
  .theme-select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .language-control,
  .theme-select {
    justify-content: space-between;
  }

  .category-button {
    height: 42px;
    padding: 0 12px;
  }

  .map-panel-head,
  .modal-body {
    padding: 20px;
  }

  .map-wrap {
    padding: 0 10px 10px;
  }

  #map {
    height: 360px;
  }

  .map-tools {
    left: 20px;
    bottom: 20px;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .news-card {
    min-height: 0;
  }
}
