/* Spaceboiler News — sibling visual language to vi.spaceboiler.com */
:root {
  --canvas: #e6e9ef;
  --canvas-soft: #eff1f5;
  --surface: #fff;
  --surface-sub: #f9fafb;
  --panel: #f4f6f9;
  --panel-alt: #eceff4;
  --text: #1d1d1f;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --faint-2: #d1d5db;
  --hairline: #eef0f3;
  --hairline-2: #e4e7ec;
  --accent: #4060f0;
  --accent-hover: #3355d8;
  --accent-tint: #eef2ff;
  --warn: #e8a050;
  --warn-tint: #fef3c7;
  --warn-text: #b45309;
  --info: #0fbf9b;
  --info-tint: #e6fbf5;
  --danger: #dc2626;
  --danger-tint: #fee2e2;
  --on-accent: #fff;
  --scrim: #0f172a52;
  --shadow-card: 0 1px 2px #1018280a, 0 1px 3px #1018280a;
  --shadow-float: 0 4px 8px -2px #1018280f, 0 12px 28px -6px #1018281f;
  --shadow-drawer: -16px 0 48px -12px #1018282e;
  --focus-ring: 0 0 0 3px #4060f038;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --fs-title: 22px;
  --fs-h2: 16px;
  --fs-h3: 14px;
  --fs-body: 13px;
  --fs-sm: 12px;
  --fs-xs: 11px;
  --r-card: 14px;
  --r-control: 10px;
  --r-sm: 6px;
  --r-pill: 999px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --live: #16a34a;
  --live-off: #9ca3af;
  --live-wait: #e8a050;
  --live-err: #dc2626;
}

:root[data-theme="dark"] {
  --canvas: #0b0f19;
  --canvas-soft: #111827;
  --surface: #151c28;
  --surface-sub: #111827;
  --panel: #182234;
  --panel-alt: #283548;
  --text: #f9fafb;
  --text-2: #e5e7eb;
  --muted: #9ca3af;
  --faint: #6b7280;
  --faint-2: #4b5563;
  --hairline: #2a374a;
  --hairline-2: #374151;
  --accent-tint: #4060f02e;
  --warn-tint: #e8a05029;
  --warn-text: #e8a050;
  --info-tint: #0fbf9b29;
  --danger-tint: #dc26262e;
  --scrim: #00000080;
  --shadow-card: 0 1px 2px #0000004d;
  --shadow-float: 0 10px 24px -6px #00000073;
  --shadow-drawer: -16px 0 48px -12px #0009;
  --live-off: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--canvas); color: var(--text); }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  background: var(--canvas);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -40px; z-index: 80;
  background: var(--accent); color: var(--on-accent);
  padding: 8px 12px; border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  min-height: var(--topbar-h);
  padding: 12px 20px 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--hairline-2);
}
.brand { display: flex; flex-direction: column; gap: 0; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-kicker {
  font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.brand-name {
  font-size: var(--fs-title); font-weight: 650; letter-spacing: -0.03em; line-height: 1.1;
}
.brand-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-xs); }

.topbar-right {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
}
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock-tz { font-size: 10px; color: var(--faint); letter-spacing: 0.06em; }
#clock { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-2); }

.live {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--hairline-2);
  background: var(--surface);
  border-radius: var(--r-pill);
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--live-wait);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--live-wait) 25%, transparent);
}
.live[data-state="live"] .live-dot { background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 25%, transparent); }
.live[data-state="paused"] .live-dot,
.live[data-state="idle"] .live-dot { background: var(--live-off); box-shadow: none; }
.live[data-state="error"] .live-dot,
.live[data-state="reconnecting"] .live-dot { background: var(--live-err); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live-err) 20%, transparent); }
.live-label { font-size: var(--fs-xs); color: var(--text-2); min-width: 3.5em; }

.btn {
  appearance: none; border: 1px solid var(--hairline-2); background: var(--surface);
  color: var(--text-2); border-radius: var(--r-control);
  padding: 6px 10px; cursor: pointer; font-size: var(--fs-sm);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { background: var(--panel); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn.ghost { border: 0; background: transparent; padding: 4px 8px; border-radius: var(--r-pill); color: var(--muted); }
.btn.icon {
  width: 32px; height: 32px; padding: 0; display: grid; place-items: center;
  border-radius: var(--r-control);
}
.btn.more { min-width: 160px; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.theme-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: conic-gradient(var(--text) 0 180deg, transparent 180deg 360deg);
  border: 1.5px solid var(--text);
  display: block;
}

.seg {
  display: flex; border: 1px solid var(--hairline-2); border-radius: var(--r-control);
  overflow: hidden; background: var(--surface);
}
.seg-btn {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  padding: 6px 9px; cursor: pointer; font-size: var(--fs-xs); font-weight: 600;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--hairline-2); }
.seg-btn[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent); }
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.toolbar {
  padding: 10px 20px 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 10px;
}
.channels {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin;
}
.chip {
  appearance: none; border: 1px solid var(--hairline-2); background: var(--surface);
  color: var(--text-2); border-radius: var(--r-pill);
  padding: 5px 10px; cursor: pointer; font-size: var(--fs-xs); font-weight: 600;
  white-space: nowrap;
}
.chip:hover { background: var(--panel); }
.chip[aria-pressed="true"] {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.coins { display: flex; gap: 6px; flex-wrap: wrap; }
.coin-custom input, .search input {
  height: 32px; border: 1px solid var(--hairline-2); border-radius: var(--r-control);
  background: var(--surface-sub); padding: 0 10px; min-width: 88px;
}
.search { display: flex; gap: 6px; flex: 1; min-width: 200px; }
.search input { flex: 1; min-width: 160px; }
.coin-custom input:focus, .search input:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }

.main { max-width: 860px; margin: 0 auto; padding: 16px 20px 48px; }
.status-line {
  margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-control);
  background: var(--warn-tint); color: var(--warn-text); font-size: var(--fs-sm);
}
.status-line[data-kind="error"] { background: var(--danger-tint); color: var(--danger); }
.status-line[data-kind="info"] { background: var(--accent-tint); color: var(--accent); }

.feed { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--hairline-2);
  border-radius: var(--r-card); box-shadow: var(--shadow-card);
  padding: 14px 16px 12px; display: grid;
  grid-template-columns: 92px 1fr; gap: 8px 14px;
}
.card.is-new { border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline-2)); }
.card-time { color: var(--muted); }
.card-rel { display: block; font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }
.card-abs { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-2); }
.card-main { min-width: 0; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px;
}
.pill {
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: var(--panel); color: var(--text-2); text-transform: uppercase;
}
.pill.ch { background: var(--accent-tint); color: var(--accent); }
.pill.coin { background: var(--info-tint); color: #0b8f76; }
:root[data-theme="dark"] .pill.coin { color: #7de8d3; }
.pill.new { background: var(--accent); color: var(--on-accent); }
.pill.type { background: var(--panel-alt); }
.source { color: var(--muted); font-size: var(--fs-xs); }
.headline {
  margin: 0; font-size: var(--fs-h3); font-weight: 620; letter-spacing: -0.01em;
  line-height: 1.45; color: var(--text); cursor: pointer;
}
.headline:hover { color: var(--accent); }
.headline-en { margin: 4px 0 0; color: var(--text-2); font-size: var(--fs-body); font-weight: 400; }
.ai-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.ai-label {
  display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs);
  color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.ai-points { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); }
.ai-points li { margin: 3px 0; }
.overview {
  margin-top: 8px; border: 1px solid var(--hairline); border-radius: var(--r-control);
  background: var(--surface-sub);
}
.overview > summary {
  cursor: pointer; list-style: none; padding: 7px 10px;
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.overview > summary::-webkit-details-marker { display: none; }
.overview-body { padding: 0 12px 10px; }
.ov-p { margin: 0 0 8px; color: var(--text-2); }
.ov-src { color: var(--faint); font-size: var(--fs-xs); }
.ov-changes { margin: 8px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.ai-pending {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  font-size: var(--fs-sm); color: var(--warn-text);
}
.ai-notice { margin: 8px 0 0; font-size: 10px; color: var(--faint); }
.card-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn, .text-btn {
  appearance: none; background: none; border: 0; padding: 0;
  color: var(--accent); cursor: pointer; font-size: var(--fs-xs); font-weight: 600;
}
.link-btn:hover, .text-btn:hover { text-decoration: underline; }
.link-btn:focus-visible, .text-btn:focus-visible, .headline:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }

.empty, .skel {
  padding: 28px 16px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--hairline-2); border-radius: var(--r-card);
}
.more-wrap { display: flex; justify-content: center; margin-top: 18px; }
.foot {
  max-width: 860px; margin: 0 auto; padding: 0 20px 40px;
  color: var(--muted); font-size: var(--fs-xs);
}
.foot p { margin: 0; }

.drawer-root { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.drawer {
  position: absolute; top: 0; right: 0; height: 100%; width: min(520px, 100%);
  background: var(--surface); box-shadow: var(--shadow-drawer);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--hairline-2);
}
.drawer-head h2 { margin: 0; font-size: var(--fs-h2); letter-spacing: -0.02em; }
.drawer-body { overflow: auto; padding: 16px 18px 32px; }
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; margin: 12px 0; font-size: var(--fs-sm); }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text-2); word-break: break-word; }
.images { display: grid; gap: 8px; margin-top: 12px; }
.images img { max-width: 100%; border-radius: var(--r-sm); border: 1px solid var(--hairline-2); }

@media (max-width: 720px) {
  .topbar, .toolbar, .main, .foot { padding-left: 14px; padding-right: 14px; }
  .card { grid-template-columns: 1fr; gap: 6px; padding: 12px; }
  .card-time { display: flex; gap: 8px; align-items: baseline; }
  .card-rel { margin: 0; }
  .brand-name { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
