:root {
  --bg: #0e1014;
  --bg-2: #14171d;
  --bg-3: #1b1f27;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #e9e9ec;
  --text-2: #a7abb5;
  --text-3: #6f7480;
  --accent: #e8d5a3;
  --accent-2: #c9b27a;
  --accent-ink: #1a1508;
  --ok: #7fd3a1;
  --warn: #f0b36b;
  --err: #f28b82;
  --radius: 14px;
  --radius-s: 9px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(232, 213, 163, 0.08), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; flex: none; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 0 10px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-name { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: 0.01em; }
.brand-name em { font-style: italic; font-weight: 500; color: var(--accent); }
.nav-btn, .ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 14px; color: var(--text-2); font-size: 13px; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.nav-btn:hover, .ghost:hover { color: var(--text); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.03); }
.nav-btn svg, .ghost svg { width: 16px; height: 16px; }

.hero { text-align: center; padding: 56px 0 28px; max-width: 760px; margin: 0 auto; }
.eyebrow { margin: 0 0 14px; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); }
.headline { margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.01em; }
.hl { font-style: italic; color: var(--accent); }
.lede { margin: 18px auto 0; color: var(--text-2); font-size: 16px; max-width: 600px; }
.results-mode .hero { display: none; }

.searchbar {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  margin: 18px auto 0; max-width: 900px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 8px 8px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .2s, box-shadow .2s;
}
.searchbar:focus-within { border-color: rgba(232, 213, 163, .55); box-shadow: 0 10px 40px rgba(0,0,0,.35), 0 0 0 4px rgba(232,213,163,.10); }
.searchbar-icon { color: var(--text-3); }
.searchbar input {
  background: transparent; border: 0; outline: 0; color: var(--text);
  font: inherit; font-size: 16px; min-width: 0; padding: 10px 4px;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.period { display: flex; gap: 2px; background: var(--bg-3); border-radius: 999px; padding: 3px; }
.period label { position: relative; }
.period input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.period span {
  display: block; padding: 7px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s;
}
.period input:checked + span { background: rgba(255,255,255,.10); color: var(--text); }
.go {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  padding: 11px 18px; font-weight: 600; font-size: 14px;
  transition: transform .12s, filter .15s;
}
.go:hover { filter: brightness(1.05); }
.go:active { transform: scale(.98); }
.go[disabled] { opacity: .6; cursor: progress; }
.go svg { width: 16px; height: 16px; }

.trending { max-width: 900px; margin: 22px auto 0; }
.trending-head { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.trending-head svg { width: 14px; height: 14px; color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; color: var(--text-2); text-align: left;
  transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chips.small .chip { padding: 5px 10px; font-size: 12.5px; cursor: default; }
.chip .lang { font-family: var(--mono); font-size: 10px; color: var(--accent-2); }

.results { margin-top: 34px; }
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.results-label { margin: 0; font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.results-query { margin: 4px 0 0; font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.15; }
.results-meta { margin: 6px 0 0; color: var(--text-3); font-size: 13px; }

.steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  font-size: 12.5px; color: var(--text-3); background: var(--bg-2);
}
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.step.active { color: var(--text); border-color: rgba(232,213,163,.4); }
.step.active .dot { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
.step.done { color: var(--text-2); }
.step.done .dot { background: var(--ok); }
.step.error .dot { background: var(--err); }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1 } 50% { transform: scale(.6); opacity: .5 } }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin-top: 20px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.briefing, .panel {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head svg { width: 16px; height: 16px; color: var(--accent); }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.badge { margin-left: auto; font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-3); }
.badge.live { color: var(--accent); background: rgba(232,213,163,.12); }
.badge.ok { color: var(--ok); background: rgba(127,211,161,.12); }
.badge.err { color: var(--err); background: rgba(242,139,130,.12); }

.briefing-body { font-size: 15.5px; line-height: 1.7; min-height: 120px; }
.briefing-body h2 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 22px 0 8px; color: var(--text); }
.briefing-body h2:first-child { margin-top: 2px; }
.briefing-body p { margin: 0 0 12px; }
.briefing-body ul { margin: 0 0 12px; padding-left: 20px; }
.briefing-body li { margin: 0 0 7px; }
.briefing-body strong { font-weight: 600; color: #fff; }
.briefing-body em { font-style: italic; color: var(--text-2); }
.cite {
  display: inline-block; font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 3px 6px; margin: 0 2px; border-radius: 6px; vertical-align: 2px;
  background: rgba(232,213,163,.14); color: var(--accent); text-decoration: none;
  border: 1px solid rgba(232,213,163,.18);
}
.cite:hover { background: rgba(232,213,163,.26); }
.cursor { display: inline-block; width: 8px; height: 17px; background: var(--accent); vertical-align: -3px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }
.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.05), rgba(255,255,255,.12), rgba(255,255,255,.05)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0 } }

.intent { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }

.articles-section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.count { font-family: var(--mono); font-weight: 400; color: var(--text-3); margin-left: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--text-3); }
.filter.on { border-color: rgba(232,213,163,.5); color: var(--accent); }

.articles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.art {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; position: relative; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.art:hover { border-color: var(--line-2); transform: translateY(-2px); }
.art-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.art-rank { font-family: var(--mono); font-size: 11px; color: var(--accent); background: rgba(232,213,163,.12); padding: 2px 7px; border-radius: 6px; }
.art-source { font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-date { margin-left: auto; white-space: nowrap; }
.art-title { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.3; color: var(--text); }
.art-summary { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.art-img { width: calc(100% + 32px); margin: -16px -16px 0; aspect-ratio: 16/7; object-fit: cover; background: var(--bg-3); display: block; }
.art-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.rel { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.rel i { display: inline-block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.rel i b { display: block; height: 100%; background: var(--accent); }
.art .ext { position: absolute; top: 14px; right: 14px; width: 14px; height: 14px; color: var(--text-3); opacity: 0; transition: opacity .15s; }
.art:hover .ext { opacity: 1; }
.art.hidden { display: none; }

.empty { margin: 40px auto; max-width: 520px; text-align: center; color: var(--text-2); }
.empty svg { width: 28px; height: 28px; color: var(--warn); }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw);
  background: var(--bg-2); border-left: 1px solid var(--line-2);
  transform: translateX(100%); transition: transform .22s ease; z-index: 30;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 20px; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-2); }
.history { list-style: none; margin: 0; padding: 10px; overflow: auto; }
.history li button {
  width: 100%; text-align: left; background: transparent; border: 0; border-radius: var(--radius-s);
  padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.history li button:hover { background: rgba(255,255,255,.04); }
.history .hq { font-weight: 500; color: var(--text); }
.history .hm { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.history .none { padding: 20px 12px; color: var(--text-3); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.scrim.on { opacity: 1; pointer-events: auto; }

.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 11.5px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 10px 16px; font-size: 13px; opacity: 0; transition: .2s; z-index: 40; pointer-events: none;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .shell { padding: 0 14px 40px; }
  .searchbar { grid-template-columns: auto 1fr; grid-template-rows: auto auto; border-radius: 22px; padding: 10px 12px; }
  .period { grid-column: 1 / -1; justify-content: space-between; }
  .go { grid-column: 1 / -1; justify-content: center; }
  .hero { padding: 30px 0 16px; }
}
