* { box-sizing: border-box; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: #0a0a0f;
  color: #f0f0f5;
  -webkit-text-size-adjust: 100%;
}
header {
  padding: 14px 20px;
  border-bottom: 1px solid #23232e;
  background: rgba(10, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
header h1 { margin: 0; font-size: 20px; font-weight: 600; }
.header-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.header-spacer { flex: 1; }

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: inherit;
}
.brand-logo { width: 26px; height: 26px; }
.brand-name {
  font-family: "Space Grotesk", -apple-system, sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  background: linear-gradient(120deg, #4a9eff, #a855f7, #ff5a5a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

#run-select {
  background: #13131a; color: #f0f0f5; border: 1px solid #23232e;
  border-radius: 10px; padding: 6px 12px; font-size: 13px;
  cursor: pointer; font-family: inherit;
  max-width: 100%;
  transition: border-color 0.15s;
}
#run-select:hover { border-color: #a855f7; }

.user-menu-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.user-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: #13131a;
  border: 1px solid #23232e;
  border-radius: 999px;
  font-size: 12px;
  color: #8b8b99;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.user-badge:hover { border-color: #a855f7; color: #e8e8ea; }
.user-badge[aria-expanded="true"] { border-color: #a855f7; color: #e8e8ea; }
.user-badge.hidden { display: none; }
.user-badge #user-email {
  max-width: 200px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.user-caret { flex-shrink: 0; opacity: 0.7; transition: transform 0.15s; }
.user-badge[aria-expanded="true"] .user-caret { transform: rotate(180deg); }

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: #13131a;
  border: 1px solid #2a2a38;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-menu.hidden { display: none; }
.user-menu-item {
  background: transparent;
  color: #e8e8ea;
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.user-menu-item:hover { background: #1c1c28; color: #a855f7; }
.user-menu-divider {
  height: 1px; background: #2a2a38;
  margin: 4px 2px;
}

/* Generic modal overlay for profile / whats-new / how-it-works */
#modal.hidden, #modal-backdrop.hidden { display: none !important; }
#modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
}
.modal-panel {
  background: #13131a;
  border: 1px solid #2a2a38;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 12px 24px;
  border-bottom: 1px solid #23232e;
}
.modal-title {
  font-size: 18px; font-weight: 700; margin: 0;
  font-family: "Space Grotesk", -apple-system, sans-serif;
  letter-spacing: -0.01em;
}
.modal-close {
  background: transparent; border: 0; color: #8a8f9c;
  font-size: 24px; line-height: 1;
  padding: 0 4px; cursor: pointer;
  transition: color 0.12s;
}
.modal-close:hover { color: #fff; }
.modal-body {
  padding: 16px 24px 24px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
  color: #d8d8e0;
}
.modal-body h3 {
  font-size: 14px; color: #e8e8ea; font-weight: 700;
  margin: 18px 0 6px 0;
  letter-spacing: -0.005em;
}
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin: 0 0 10px 0; color: #c0c0c8; }
.modal-body ul { margin: 4px 0 10px 0; padding-left: 22px; color: #c0c0c8; }
.modal-body li { margin-bottom: 4px; }
.modal-body strong { color: #e8e8ea; }
.modal-body code {
  background: #1c1c28; padding: 1px 6px; border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px;
}
.modal-body .kicker {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.12);
  padding: 2px 8px; border-radius: 999px;
  margin-right: 6px; vertical-align: middle;
}
.changelog-date {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: #8a8f9c; font-weight: 700;
  margin: 18px 0 4px 0;
}
.changelog-date:first-child { margin-top: 0; }
.modal-profile-email {
  font-size: 13px; color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  padding: 10px 14px; border-radius: 8px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  margin-bottom: 10px;
  word-break: break-all;
}
.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid #23232e;
  margin-bottom: 14px;
}
.admin-tab {
  background: transparent; border: 0; color: #8a8f9c;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.admin-tab:hover { color: #d8d8e0; }
.admin-tab.active { color: #e8e8ea; border-bottom-color: #a855f7; }
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 12.5px; color: #d8d8e0;
}
.admin-table th, .admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #23232e;
  text-align: left; vertical-align: top;
}
.admin-table th {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #8a8f9c;
}
.admin-table tbody tr:hover { background: #181822; }
.admin-tag {
  display: inline-block;
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #8a8f9c; background: #1c1c28;
  padding: 1px 6px; border-radius: 4px;
  margin-left: 4px; vertical-align: middle;
}
.role-pill {
  display: inline-block;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px;
}
.role-admin { color: #a855f7; background: rgba(168, 85, 247, 0.12); }
.role-user  { color: #8a8f9c; background: #1c1c28; }
.admin-footnote {
  margin-top: 12px;
  color: #8a8f9c; font-size: 11.5px;
}
.header-btn {
  background: #13131a; color: #f0f0f5; border: 1px solid #23232e;
  border-radius: 999px; padding: 5px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.header-btn:hover { border-color: #a855f7; color: #a855f7; }
.header-btn:hover { border-color: #4a9eff; color: #4a9eff; }

/* Version pill — teal glow, used in the user menu next to "What's new" and
   as a per-entry badge in the changelog modal. */
.version-pill {
  display: inline-block; padding: 1px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: rgba(94, 234, 212, 0.14); color: #5eead4;
  vertical-align: middle;
}
.user-menu-item .version-pill { margin-left: 8px; }
.changelog-entry { display: flex; align-items: center; gap: 10px; margin: 20px 0 8px; }
.changelog-entry .version-pill { font-size: 12px; padding: 2px 10px; }
.changelog-entry .changelog-date { margin: 0; }

/* Panel loading placeholder — one class, one animation, reused across every
   panel container while new data is in flight. Intentionally generic: no
   skeleton mimicry of the real layout, just a calm pulsing grey block. */
.panel-loading {
  height: 120px; border-radius: 8px; margin: 8px 0;
  background: linear-gradient(90deg, #17171f 0%, #1d1d26 50%, #17171f 100%);
  background-size: 200% 100%;
  animation: panel-loading-pulse 1.4s ease-in-out infinite;
}
@keyframes panel-loading-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Region switcher — toggles between US and Ireland datasets */
.region-switch {
  display: inline-flex; gap: 2px; padding: 2px;
  background: #13131a; border: 1px solid #23232e; border-radius: 999px;
}
.region-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #8a8f9c; border: 0;
  border-radius: 999px; padding: 4px 10px;
  font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.region-btn:hover { color: #f0f0f5; }
.region-btn[aria-pressed="true"] {
  background: #23232e; color: #f0f0f5;
}
.region-flag {
  display: block; width: 18px; height: 12px;
  border-radius: 2px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.region-label { letter-spacing: 0.04em; }
@media (max-width: 480px) {
  .region-label { display: none; }
  .region-btn { padding: 4px 8px; }
}

/* Sources drawer specifics */
#sources-chart-wrap {
  display: flex; gap: 8px; margin-bottom: 14px;
  border-radius: 4px; overflow: hidden; height: 24px;
}
.sources-bar-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #0f1115;
  min-width: 36px; cursor: pointer;
  transition: filter 0.1s;
}
.sources-bar-seg:hover { filter: brightness(1.15); }
.sources-bar-seg.dim { opacity: 0.3; }
.sources-totals {
  display: flex; gap: 14px; font-size: 12px; color: #8a8f9c;
  margin-bottom: 14px;
}
.sources-totals .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: middle;
}
#sources-filter {
  width: 100%; background: #1c2230; color: #e8e8ea;
  border: 1px solid #2a3040; border-radius: 4px;
  padding: 7px 10px; font-size: 13px; font-family: inherit;
  margin-bottom: 10px; box-sizing: border-box;
}
#sources-filter:focus { outline: none; border-color: #4a9eff; }
.source-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid #1f2330;
}
.source-row:first-child { border-top: none; }
.source-lean-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.source-lean-dot.liberal { background: #4a9eff; }
.source-lean-dot.conservative { background: #ff5a5a; }
.source-lean-dot.neutral { background: #9aa0ac; }
.source-name { flex: 1; font-size: 13px; }
.source-name a { color: inherit; text-decoration: none; }
.source-name a:hover { color: #4a9eff; }
.source-count {
  font-size: 11px; color: #8a8f9c;
  background: #1c2230; padding: 2px 8px; border-radius: 10px;
  min-width: 28px; text-align: center;
}
.source-count.zero { color: #ff5a5a; background: #2a1a1a; }
.meta { color: #8a8f9c; font-size: 12px; margin-top: 4px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.panel {
  background: #161a23;
  border: 1px solid #1f2330;
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 24px;
  position: relative;
}
/* Section header: clear visual separation from the content below.
   Space Grotesk display font, larger size, tighter letter-spacing.
   A subtle gradient underline divides header from body. */
.panel h2 {
  font-family: "Space Grotesk", -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #f0f0f5;
  margin: 0 0 6px 0;
}
.panel .hint {
  color: #8a8f9c;
  font-size: 12px;
  line-height: 1.45;
  margin: 0 0 16px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid #1f2330;
}
.chart-filters {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.chart-filter-btn {
  background: #1c2230; color: #8a8f9c;
  border: 1px solid #2a3040; border-radius: 16px;
  padding: 5px 14px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.chart-filter-btn:hover { border-color: #4a9eff; }
.chart-filter-btn.active.liberal      { background: #4a9eff; color: #0f1115; border-color: #4a9eff; }
.chart-filter-btn.active.neutral      { background: #9aa0ac; color: #0f1115; border-color: #9aa0ac; }
.chart-filter-btn.active.conservative { background: #ff5a5a; color: #0f1115; border-color: #ff5a5a; }

/* Topic coverage histogram — custom HTML bars. Desktop: label | bar | total on
   a single row. Mobile: label + total on top line, full-width bar underneath. */
#topic-chart-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-row {
  display: grid;
  grid-template-columns: minmax(0, 260px) 1fr 44px;
  column-gap: 14px;
  align-items: center;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.tc-row:hover { background: #1c2230; }
.tc-label {
  font-size: 13px; color: #e8e8ea; font-weight: 500;
  word-break: break-word; line-height: 1.3;
  min-width: 0;
}
.tc-bar {
  display: flex;
  height: 16px;
  border-radius: 4px;
  overflow: hidden;
  background: #1a1e26;
}
.tc-seg.lib { background: #4a9eff; }
.tc-seg.neu { background: #9aa0ac; }
.tc-seg.con { background: #ff5a5a; }
.tc-total {
  font-size: 12px; font-weight: 700;
  color: #8a8f9c;
  text-align: right;
}

@media (max-width: 640px) {
  .tc-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label total"
      "bar   bar";
    column-gap: 8px;
    row-gap: 6px;
    padding: 10px;
  }
  .tc-label { grid-area: label; font-size: 13px; }
  .tc-bar   { grid-area: bar; height: 14px; }
  .tc-total { grid-area: total; align-self: center; }
}
#cloud { width: 100%; height: 400px; background: #0f1115; border-radius: 4px; }
#topic-list .topic {
  border-top: 1px solid #1f2330;
  padding: 12px 8px;
  margin-left: -8px;
  margin-right: -8px;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 4px;
}
#topic-list .topic:hover { background: #1c2230; }
#topic-list .topic:first-child { border-top: none; }
.topic-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.topic-summary { color: #8a8f9c; font-size: 12px; margin-top: 2px; }
.topic-counts { font-size: 11px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.lib { color: #4a9eff; }
.con { color: #ff5a5a; }
.neu { color: #9aa0ac; }

.topic-sort {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.topic-sort-label { font-size: 11px; color: #8a8f9c; }
.topic-sort-btn {
  background: #1c2230; color: #8a8f9c;
  border: 1px solid #2a3040; border-radius: 16px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.topic-sort-btn:hover { border-color: #a855f7; color: #e8e8ea; }
.topic-sort-btn.active { background: #a855f7; color: #0f1115; border-color: #a855f7; }

.gap-badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  white-space: nowrap;
}
.gap-badge.balanced  { background: #2a2d36; color: #9aa0ac; }
.gap-badge.lib       { background: #1a3a5c; color: #4a9eff; }
.gap-badge.con       { background: #4a1a1a; color: #ff5a5a; }

/* Recurring-phrase trends panel */
.trends-meta {
  font-size: 11px; color: #8a8f9c; margin-bottom: 8px;
}
.trend-row {
  padding: 10px 8px;
  margin-left: -8px; margin-right: -8px;
  border-top: 1px solid #1f2330;
  border-radius: 4px;
}
.trend-row:first-of-type { border-top: none; }
.trend-phrase {
  font-size: 13px; font-weight: 600; color: #e8e8ea;
  word-break: break-word;
}
.trend-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 6px 12px; margin-top: 4px; font-size: 11px;
}
.trend-runs { color: #a855f7; font-weight: 600; }
.trend-counts { color: #8a8f9c; }
.trend-freq { color: #8a8f9c; }

/* Phrase-history badge inside the drawer subtitle */
.trend-badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
  margin-left: 6px;
  white-space: nowrap;
}
.trend-badge.new       { background: #3d3a1a; color: #f5d77a; }
.trend-badge.recurring { background: #2a1a3a; color: #a855f7; }

/* Silent-side panel ("What one side isn't covering") — tile grid with
   diverging bar design. Conservative side on the left, liberal on the right,
   divider in the middle. Bars extend outward from the divider; the "silent"
   side is rendered as an empty track with "— silent —" text. */

.silent-axis {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 4px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b6b78;
}
.silent-axis-label.silent-axis-con { text-align: right; color: #9a4a4a; }
.silent-axis-label.silent-axis-lib { text-align: left;  color: #4a7a9a; }
.silent-axis-divider { width: 1px; height: 14px; background: #3a3a48; }

#silent-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
#silent-list .silent-axis {
  grid-column: 1 / -1;   /* axis legend spans full width above the tiles */
}

.silent-row {
  padding: 14px 16px;
  background: #13161d;
  border: 1px solid #1f2330;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.silent-row:hover {
  background: #171b24;
  border-color: #2a3040;
  transform: translateY(-1px);
}
.silent-row.con-silent:hover { border-color: rgba(74,158,255,0.45); }
.silent-row.lib-silent:hover { border-color: rgba(255,90,90,0.45); }

.silent-topic { font-size: 14px; font-weight: 600; color: #e8e8ea; word-break: break-word; }
.silent-summary {
  color: #8a8f9c; font-size: 12px; margin-top: 4px; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.silent-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: auto;      /* push the bar to the bottom of the tile when summaries are short */
  padding-top: 12px;
  min-height: 28px;
}
.silent-divider {
  width: 2px; height: 28px;
  background: linear-gradient(to bottom, transparent 0%, #3a3a48 20%, #3a3a48 80%, transparent 100%);
}

.silent-side {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  min-width: 0;
}
.silent-side-con { justify-content: flex-end; }
.silent-side-lib { justify-content: flex-start; }

.silent-fill {
  height: 14px;
  border-radius: 3px;
  flex-shrink: 1;
  min-width: 0;
  background: linear-gradient(90deg, rgba(255,90,90,0.15), rgba(255,90,90,0.7));
}
.silent-fill.lib {
  background: linear-gradient(90deg, rgba(74,158,255,0.7), rgba(74,158,255,0.15));
}
.silent-fill.con {
  /* conservative fill grows leftward toward the divider, so invert the gradient direction */
  background: linear-gradient(270deg, rgba(255,90,90,0.7), rgba(255,90,90,0.15));
}

.silent-count {
  font-size: 13px; font-weight: 700;
  min-width: 24px; text-align: center;
  flex-shrink: 0;
}
.silent-count.lib { color: #4a9eff; }
.silent-count.con { color: #ff5a5a; }

.silent-empty {
  font-size: 11px; font-style: italic; color: #5a5a66;
  letter-spacing: 0.02em;
}

.silent-neutral {
  font-size: 10px; color: #6b6b78;
  margin-top: 6px; text-align: center;
}

@media (max-width: 520px) {
  .silent-bar { gap: 4px; }
  .silent-count { font-size: 12px; min-width: 18px; }
  .silent-fill { height: 12px; }
}

/* Top drivers card in topic drawer */
.top-drivers {
  padding: 10px 12px;
  background: #1c2230; border-radius: 6px;
  margin-bottom: 12px;
}
.top-drivers-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: #8a8f9c; margin-bottom: 6px;
}
.top-drivers-list {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.driver-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.driver-chip.liberal      { background: #1a3a5c; color: #4a9eff; }
.driver-chip.conservative { background: #4a1a1a; color: #ff5a5a; }
.driver-chip.neutral      { background: #2a2d36; color: #9aa0ac; }
.driver-chip .driver-count {
  font-weight: 400; font-size: 10px; opacity: 0.8;
}
.driver-more { font-size: 10px; color: #8a8f9c; }

/* Framing pairs — tile grid of concept cards, each showing the L/C phrasing
   side-by-side. Card layout puts liberal phrase on top, a "vs" divider, and
   conservative phrase underneath — the vertical split keeps both phrases
   readable even when they're long. */

#pairs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
}

.pair-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: #10131a;
  border: 1px solid #2a3040;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}
.pair-card:hover {
  background: #161a24;
  border-color: #3a4050;
  transform: translateY(-1px);
}

.pair-concept {
  font-size: 10px; color: #8b8b99;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.pair-contrast {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}
.pair-phrase {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 0;
  flex: 1 1 0;          /* equal split between liberal (left) and conservative (right) */
}
.pair-phrase.lib { background: rgba(74, 158, 255, 0.12); border: 1px solid rgba(74, 158, 255, 0.25); }
.pair-phrase.con { background: rgba(255, 90, 90, 0.10); border: 1px solid rgba(255, 90, 90, 0.22); }
.pair-text {
  font-size: 13px; font-weight: 600;
  word-break: break-word;
  min-width: 0;
  line-height: 1.3;
}
.pair-phrase.lib .pair-text { color: #4a9eff; }
.pair-phrase.con .pair-text { color: #ff5a5a; }
.pair-freq {
  font-size: 10px; color: #8a8f9c; font-weight: 600;
  letter-spacing: 0.04em;
}
.pair-vs {
  align-self: center;
  color: #5a5a66;
  font-style: italic; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.08em;
  flex-shrink: 0;
}
.pair-topic {
  font-size: 11px; color: #8a8f9c;
  font-style: italic;
  margin-top: auto;           /* stick the topic line to the bottom so cards align */
  padding-top: 8px;
  border-top: 1px dashed #23232e;
}


#cloud canvas { cursor: pointer; }

/* Drawer */
.hidden { display: none !important; }
#drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: #161a23;
  border-left: 1px solid #1f2330;
  z-index: 60;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}
.drawer-header {
  padding: 14px 16px;
  border-bottom: 1px solid #1f2330;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px;
}
.drawer-title { font-size: 15px; font-weight: 600; word-break: break-word; }
.drawer-sub { font-size: 11px; color: #8a8f9c; margin-top: 4px; }
#drawer-close {
  background: none; border: none; color: #8a8f9c;
  font-size: 28px; cursor: pointer; padding: 0 4px; line-height: 1;
  flex-shrink: 0;
}
#drawer-close:hover { color: #fff; }
.drawer-body {
  padding: 12px 16px 20px 16px;
  overflow-y: auto; flex: 1;
  -webkit-overflow-scrolling: touch;
}
.headline {
  display: block;
  padding: 12px 0;
  border-top: 1px solid #1f2330;
  text-decoration: none;
  color: inherit;
}
.headline:first-child { border-top: none; }
.headline:hover .headline-title { color: #4a9eff; text-decoration: underline; }
.headline-meta {
  font-size: 11px;
  color: #8a8f9c;
  margin-bottom: 4px;
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
}
.headline-lean-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}
.headline-date {
  color: #8a8f9c; font-size: 11px;
}
.headline-date::before { content: "·"; margin-right: 6px; color: #3a3f4c; }
.headline-lean-tag.liberal { background: #1a3a5c; color: #4a9eff; }
.headline-lean-tag.conservative { background: #4a1a1a; color: #ff5a5a; }
.headline-lean-tag.neutral { background: #2a2d36; color: #9aa0ac; }
.headline-title { font-size: 13px; line-height: 1.4; color: #e8e8ea; word-break: break-word; }
.headline-summary { font-size: 12px; line-height: 1.45; color: #8a8f9c; margin-top: 4px; word-break: break-word; }
.headline-mark { background: #3d3a1a; color: #f5d77a; padding: 0 2px; border-radius: 2px; }

/* ---- Responsive ---- */

@media (min-width: 768px) {
  header { padding: 20px 28px; }
  header h1 { font-size: 22px; }
  main { padding: 24px 28px; }
  .panel { padding: 24px 28px; }
  .panel h2 { font-size: 22px; }
  .hint { font-size: 13px; }
  #cloud { height: 480px; }
  .drawer-header { padding: 18px 22px; }
  .drawer-body { padding: 14px 22px 22px 22px; }
}

@media (max-width: 480px) {
  header h1 { font-size: 17px; }
  .header-row { gap: 8px; }
  #run-select { font-size: 12px; padding: 5px 8px; }
  .meta { font-size: 11px; }
  main { padding: 10px; }
  .panel { padding: 16px 14px; margin-bottom: 14px; border-radius: 10px; }
  .panel h2 { font-size: 17px; }
  .panel .hint { padding-bottom: 12px; margin-bottom: 12px; }
  /* Mobile portrait: let the cloud use up to 65% of viewport height (capped)
     so words have room to breathe. In landscape, viewport height drops and
     the cap naturally shortens the cloud. */
  #cloud { height: min(65vh, 560px); min-height: 360px; }
  .topic-name { font-size: 13px; }
  .topic-summary { font-size: 11px; }
  .topic-counts { font-size: 10px; }
  .drawer { width: 100vw; border-left: none; }
  .drawer-title { font-size: 14px; }
  .headline-title { font-size: 13px; }
  .headline-summary { font-size: 11px; }
}
