:root {
  --bg: #0f1115;
  --bg-elev: #161922;
  --bg-hover: #1c2030;
  --border: #252a37;
  --border-strong: #353c4f;
  --text: #e7eaf0;
  --text-dim: #9ba1b0;
  --text-muted: #6b7180;
  --accent: #5eb3ff;
  --accent-warm: #ffb46b;
  --ok: #5ee3a1;
  --warn: #ffcc66;
  --bad: #ff7a8a;
  --shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 1px 12px rgba(0,0,0,0.25);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ============ TOP BAR ============ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.brand h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-loc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.top-meta {
  display: flex;
  gap: 28px;
}

.meta-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.meta-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 500;
}

.meta-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.meta-val.ok { color: var(--ok); }
.meta-val.warn { color: var(--warn); }
.meta-val.bad { color: var(--bad); }

/* ============ GRID ============ */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 16px;
  padding: 16px;
  min-height: 0;
  grid-template-areas:
    "weather news    ai     markets"
    "air     civic   reddit markets";
}

.panel-weather { grid-area: weather; }
.panel-ai      { grid-area: ai; }
.panel-news    { grid-area: news; }
.panel-air     { grid-area: air; }
.panel-civic   { grid-area: civic; }
.panel-reddit  { grid-area: reddit; }
.panel-markets { grid-area: markets; }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-head h2 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.panel-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.panel-body {
  flex: 1;
  padding: 16px 20px;
  min-height: 0;
  overflow: hidden;
}

.panel-body.scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.panel-body.scroll::-webkit-scrollbar { width: 6px; }
.panel-body.scroll::-webkit-scrollbar-track { background: transparent; }
.panel-body.scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.loading {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.error {
  color: var(--bad);
  font-size: 13px;
}

/* ============ WEATHER PANEL ============ */
.wx-now {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.wx-temp {
  font-family: var(--font-serif);
  font-size: 88px;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--text);
}

.wx-temp sup {
  font-size: 28px;
  font-weight: 400;
  color: var(--text-dim);
  vertical-align: top;
  margin-left: 2px;
}

.wx-cond {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
}

.wx-desc {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.wx-feel {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.wx-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-bottom: 20px;
}

.wx-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wx-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.wx-stat-val {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.wx-forecast {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.wx-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.wx-day-name {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.wx-day-icon {
  font-size: 18px;
}

.wx-day-hi {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.wx-day-lo {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ============ FEED ITEMS (AI, NEWS, CIVIC) ============ */
.item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms ease;
}

.item:last-child { border-bottom: none; }

.item:hover {
  background: var(--bg-hover);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.item-source {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 500;
}

.item-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.item-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 4px;
}

.item-summary {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  margin-right: 4px;
}

/* News-source lean indicators — purely informational, helps spot diversity */
.item-source.lean-left   { color: #6aa9ff; }
.item-source.lean-cleft  { color: #8fc5ff; }
.item-source.lean-center { color: #c9d0dc; }
.item-source.lean-cright { color: #ffb89a; }
.item-source.lean-right  { color: #ff9a7a; }

/* ============ AIRCRAFT PANEL ============ */
.air-panel-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}

.air-map {
  flex: 1.4;
  min-height: 220px;
  background: #0a0d12;
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Dark filter on the OSM tiles so it matches the dashboard */
.air-map .leaflet-tile-pane {
  filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.85) saturate(0.6);
}

.air-map .leaflet-container {
  background: #0a0d12;
  font-family: var(--font-sans);
}

.air-map .leaflet-control-attribution {
  background: rgba(10, 13, 18, 0.85);
  color: var(--text-muted);
  font-size: 9px;
  padding: 1px 6px;
}

.air-map .leaflet-control-attribution a {
  color: var(--text-dim);
}

.air-map .leaflet-control-zoom a {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border);
}

.air-map .leaflet-control-zoom a:hover {
  background: var(--bg-hover);
}

.air-map .leaflet-popup-content-wrapper,
.air-map .leaflet-popup-tip {
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
}

.air-map .leaflet-popup-content {
  margin: 8px 12px;
  line-height: 1.5;
}

.air-map .leaflet-popup-content strong {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text);
}

.plane-icon {
  background: transparent;
  border: none;
}

.plane-icon svg {
  display: block;
  filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
}

.home-icon {
  background: transparent;
  border: none;
}

.home-icon-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent);
}

.air-list-wrap {
  flex: 1;
  padding: 12px 16px 14px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.air-stats {
  display: flex;
  gap: 20px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.air-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.air-stat-val {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}

.air-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.air-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  min-height: 0;
}

.air-list::-webkit-scrollbar { width: 6px; }
.air-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.aircraft {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.aircraft:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.aircraft.highlighted {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.aircraft-callsign {
  font-weight: 600;
  color: var(--text);
}

.aircraft-alt, .aircraft-spd {
  color: var(--text-dim);
  font-size: 10px;
}

/* ============ BOTTOM TICKER ============ */
.bottom-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.ticker-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}

.ticker {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}

.ticker-track {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  animation: scroll-ticker 120s linear infinite;
  padding-left: 100%;
}

.ticker-track .sep {
  color: var(--accent);
  margin: 0 14px;
}

@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* ============ RESPONSIVE / SMALLER SCREENS ============ */
@media (max-width: 1600px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "weather news"
      "ai      civic"
      "air     reddit"
      "markets markets";
  }
}

/* Phones / tablets (web build): single column, whole-page scroll instead of per-panel. */
@media (max-width: 900px) {
  html, body { height: auto; overflow: auto; }
  .top-bar { flex-wrap: wrap; height: auto; row-gap: 6px; }
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas:
      "weather" "news" "markets" "ai" "air" "civic" "reddit";
    height: auto;
  }
  .panel { min-height: 340px; }
  #air-map { min-height: 240px; }
  .panel-body.scroll { overflow: visible; max-height: none; }
  .modal-inner { width: 92vw; max-width: 92vw; }
}

/* ============ PANEL SEARCH BARS ============ */
.panel-search {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-search input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  outline: none;
  transition: border-color 120ms ease;
}

.panel-search input:focus {
  border-color: var(--accent);
}

.panel-search button {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 6px 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease;
  flex-shrink: 0;
}

.panel-search button:hover {
  background: var(--bg-hover);
}

/* Subreddit search results */
.sub-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.sub-result-info { flex: 1; min-width: 0; }

.sub-result-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-mono);
}

.sub-result-name .nsfw-badge {
  font-size: 9px;
  background: var(--bad);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  font-family: var(--font-sans);
  vertical-align: middle;
}

.sub-result-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sub-result-subs {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.sub-add-btn {
  background: var(--accent);
  border: none;
  border-radius: 5px;
  width: 28px;
  height: 28px;
  color: #0a0e0a;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease;
}

.sub-add-btn:hover { background: #4ea3ef; }
.sub-add-btn.added { background: var(--ok); cursor: default; }

.search-back {
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  padding: 8px 0;
  display: inline-block;
}
.stocks-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: #07090d;
  border-bottom: 1px solid var(--border);
  height: 44px;
  flex-shrink: 0;
  overflow: hidden;
}

.stocks-edit {
  width: 44px;
  height: 44px;
  background: var(--bg-elev);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  flex-shrink: 0;
}

.stocks-edit:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.stocks-track {
  display: flex;
  align-items: center;
  gap: 0;
  height: 100%;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
  -webkit-app-region: drag;  /* drag window from this area */
}

/* Pills inside the drag region should still be clickable */
.stocks-track .stock-pill,
.stocks-track a,
.stocks-track button {
  -webkit-app-region: no-drag;
}

/* Window controls — close/minimize for frameless window */
.window-controls {
  display: flex;
  height: 100%;
  -webkit-app-region: no-drag;
  flex-shrink: 0;
}

.win-btn {
  width: 44px;
  height: 100%;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.win-btn.win-close:hover {
  background: #c92a3a;
  color: #fff;
}

.stocks-loading {
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.stock-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 100%;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}

.stock-symbol {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.stock-price {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.stock-change {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.stock-change.up   { color: var(--ok); }
.stock-change.down { color: var(--bad); }
.stock-change.flat { color: var(--text-muted); }

.stock-stale {
  font-size: 9px;
  color: var(--text-muted);
  margin-left: 4px;
}

.stock-error {
  color: var(--text-muted);
  font-style: italic;
}

/* ============ LOCATION EDIT BUTTON ============ */
.loc-edit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.loc-edit:hover {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ============ MODALS ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 160ms ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-inner {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 24px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-inner.modal-wide {
  width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.modal-inner.modal-wide::-webkit-scrollbar { width: 6px; }
.modal-inner.modal-wide::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  font-family: var(--font-sans);
}

.settings-hint {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  margin-bottom: 8px !important;
}

.settings-hint a {
  color: var(--accent);
  text-decoration: none;
}

.settings-hint code {
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
}

.modal-inner h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.modal-inner p {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 16px;
}

.modal-note {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  margin-top: 12px !important;
  margin-bottom: 16px !important;
  line-height: 1.5;
}

.modal-inner input,
.modal-inner textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease;
}

.modal-inner input:focus,
.modal-inner textarea:focus {
  border-color: var(--accent);
}

.modal-inner textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.btn-primary, .btn-secondary {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0e0a;
  font-weight: 600;
}

.btn-primary:hover {
  background: #4ea3ef;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* ============ READER OVERLAY (Firecrawl) ============ */
.reader {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 160ms ease;
}

.reader-inner {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  width: min(800px, 90vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
}

.reader-source {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.reader-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

.reader-close {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 120ms ease;
}

.reader-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.reader-body {
  padding: 24px 28px 28px;
  overflow-y: auto;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-dim);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.reader-body::-webkit-scrollbar { width: 8px; }
.reader-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.reader-body p { margin-bottom: 1em; }
.reader-body h1, .reader-body h2, .reader-body h3 {
  color: var(--text);
  margin: 1.4em 0 0.5em;
  font-family: var(--font-sans);
  font-weight: 700;
}
.reader-body h2 { font-size: 20px; }
.reader-body h3 { font-size: 17px; }
.reader-body a { color: var(--accent); }
.reader-body img { max-width: 100%; height: auto; border-radius: 6px; margin: 1em 0; }
.reader-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 1em 0;
  color: var(--text);
  font-style: italic;
}
.reader-body ul, .reader-body ol { padding-left: 24px; margin-bottom: 1em; }
.reader-body code {
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.9em;
}

.reader-footer {
  border-top: 1px solid var(--border);
  padding: 12px 28px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.reader-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* Reader: inline media (images / video) */
.reader-media-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.reader-media {
  max-width: 100%;
  max-height: 78vh;
  height: auto;
  border-radius: 8px;
  background: #000;
}
/* Reader: extracted article body (Readability output) */
.reader-article { font-size: 16px; line-height: 1.7; }
.reader-article p { margin-bottom: 1em; }
.reader-article img { max-width: 100%; height: auto; border-radius: 6px; margin: 1em 0; }
.reader-article figure { margin: 1em 0; }
.reader-article figcaption { font-size: 12px; color: var(--text-muted); text-align: center; margin-top: 4px; }
.reader-article h1, .reader-article h2, .reader-article h3 { font-weight: 700; margin: 1em 0 0.4em; line-height: 1.3; }
.reader-article h2 { font-size: 20px; }
.reader-article h3 { font-size: 17px; }
.reader-article a { color: var(--accent); }
.reader-article ul, .reader-article ol { padding-left: 24px; margin-bottom: 1em; }
.reader-article blockquote {
  border-left: 3px solid var(--border);
  padding-left: 14px;
  margin: 1em 0;
  color: var(--text-muted);
}
.reader-article pre { overflow-x: auto; }

/* ============ TOAST NOTIFICATIONS ============ */
.toast-stack {
  position: fixed;
  bottom: 70px;
  right: 24px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 16px;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 260ms ease;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 280ms ease, transform 280ms ease;
}

.toast.fade {
  opacity: 0;
  transform: translateX(20px);
}

.toast-source {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.toast-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============ NEW ITEM HIGHLIGHT ============ */
.item.is-new {
  animation: item-highlight 4s ease;
}

@keyframes item-highlight {
  0%   { background: rgba(94, 179, 255, 0.18); }
  100% { background: transparent; }
}
