:root {
  --ink: oklch(21% 0.045 225);
  --ink-soft: oklch(25% 0.05 223);
  --ink-lift: oklch(31% 0.055 220);
  --paper: oklch(97.5% 0.008 220);
  --paper-dim: oklch(83% 0.025 220);
  --paper-muted: oklch(68% 0.03 220);
  --surface: oklch(99% 0.004 220);
  --surface-muted: oklch(94.5% 0.015 220);
  --acid: oklch(78% 0.16 75);
  --acid-deep: oklch(52% 0.14 70);
  --coral: oklch(63% 0.17 28);
  --sky: oklch(68% 0.12 220);
  --line: oklch(40% 0.04 220);
  --line-dark: oklch(88.5% 0.025 220);
  --line-dark-strong: oklch(76% 0.035 220);
  --text-muted: oklch(52% 0.03 220);
  --text-subtle: oklch(62% 0.03 220);
  --dark-border: oklch(43% 0.045 220);
  --dark-subtle: oklch(72% 0.03 220);
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", "Roboto Mono", "PingFang SC", "Hiragino Sans GB", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--paper);
  color-scheme: light;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select { font: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid oklch(58% 0.14 70 / 0.38);
  outline-offset: 2px;
}

.noise { display: none; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 264px;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 22px 22px;
  color: var(--paper);
  background: var(--ink);
  overflow: hidden;
}

.sidebar::after {
  position: absolute;
  top: 17%;
  right: -78px;
  width: 190px;
  height: 190px;
  border: 1px solid oklch(78% 0.16 75 / 0.18);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 30px oklch(78% 0.16 75 / 0.04), 0 0 0 62px oklch(78% 0.16 75 / 0.025);
}

.brand-lockup { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 28px;
  height: 28px;
  padding: 5px;
  border: 1px solid oklch(78% 0.16 75 / 0.68);
  border-radius: 50%;
}

.brand-mark span { display: block; width: 5px; border-radius: 3px 3px 0 0; background: var(--acid); }
.brand-mark span:nth-child(1) { height: 8px; opacity: 0.5; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 17px; opacity: 0.75; }

.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand-kicker { margin-top: 1px; color: var(--paper-muted); font-size: 11px; line-height: 1.35; }

.rail-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 58px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.status-dot {
  display: block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--paper-muted);
  box-shadow: 0 0 0 4px oklch(68% 0.03 220 / 0.14);
}

.status-dot.is-live {
  background: var(--acid);
  box-shadow: 0 0 0 4px oklch(78% 0.16 75 / 0.14), 0 0 16px oklch(78% 0.16 75 / 0.4);
}

.status-dot.is-error {
  background: var(--coral);
  box-shadow: 0 0 0 4px oklch(63% 0.17 28 / 0.14);
}

.rail-status strong { display: block; margin-top: 2px; color: var(--paper); font-size: 12px; font-weight: 600; }

.eyebrow {
  display: block;
  color: var(--paper-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.accent-eyebrow { color: var(--acid-deep); }

.mode-nav { position: relative; z-index: 1; display: grid; gap: 7px; margin-top: 26px; }

.mode-button {
  display: grid;
  grid-template-columns: 30px 1fr 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 70px;
  padding: 11px 10px;
  color: var(--paper-muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 9px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.mode-button:hover,
.mode-button.is-active {
  color: var(--paper);
  background: oklch(78% 0.16 75 / 0.09);
  border-color: oklch(78% 0.16 75 / 0.25);
}

.mode-number { align-self: start; padding-top: 2px; color: var(--acid); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.mode-button strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.35; }
.mode-button small { display: block; margin-top: 3px; color: var(--paper-muted); font-size: 12px; line-height: 1.4; }
.mode-button:hover small, .mode-button.is-active small { color: var(--dark-subtle); }
.mode-arrow { align-self: start; padding-top: 1px; color: var(--acid); font-size: 16px; opacity: 0; transform: translate(-3px, 2px); transition: opacity 160ms ease, transform 160ms ease; }
.mode-button:hover .mode-arrow, .mode-button.is-active .mode-arrow { opacity: 1; transform: translate(0, 0); }

.rail-note { position: relative; z-index: 1; max-width: 174px; margin-top: auto; padding-bottom: 30px; }
.rail-note p { margin: 8px 0 0; color: var(--dark-subtle); font-size: 14px; line-height: 1.55; }

.sidebar-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--paper-muted); font-size: 11px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.live-pulse { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.version-label { color: oklch(53% 0.03 220); white-space: nowrap; }
.text-button { padding: 0; color: var(--paper-muted); background: none; border: 0; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--acid); }

.main-panel { flex: 1; min-width: 0; padding: 0 clamp(24px, 4.4vw, 64px) 60px; background: var(--paper); }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 70px; border-bottom: 1px solid var(--line-dark); }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 12px; }
.breadcrumb i { color: var(--acid-deep); font-style: normal; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.last-fetch { color: var(--text-subtle); font-size: 12px; }
.preview-badge { padding: 4px 8px; color: var(--ink); background: var(--acid); border-radius: 4px; font-size: 11px; font-weight: 700; }
.icon-button { display: inline-grid; width: 30px; height: 30px; place-items: center; padding: 0; color: var(--ink); background: transparent; border: 1px solid var(--line-dark-strong); border-radius: 50%; font-size: 14px; transition: color 160ms ease, background 160ms ease, border-color 160ms ease; }
.icon-button:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }

.intro-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; align-items: end; padding: 58px 0 42px; }
.intro-copy { max-width: 720px; }
.intro-copy h1 { margin: 13px 0 18px; color: var(--ink); font-family: var(--display); font-size: clamp(42px, 5.2vw, 64px); font-weight: 750; letter-spacing: -0.055em; line-height: 1.08; text-wrap: balance; }
.intro-copy h1 em, .help-modal h2 em { color: var(--acid-deep); font-style: normal; }
.intro-copy p { max-width: 520px; margin: 0; color: var(--text-muted); font-size: 17px; line-height: 1.65; }
.intro-aside { display: flex; align-items: center; gap: 15px; padding-bottom: 5px; }
.intro-aside p { margin: 0; color: var(--text-subtle); font-family: var(--mono); font-size: 10px; line-height: 1.9; }
.intro-aside p span { display: inline-block; width: 22px; color: var(--coral); }
.measurement-mark { position: relative; flex: 0 0 76px; height: 76px; border: 1px solid oklch(78% 0.025 220); border-radius: 50%; }
.measurement-ring { position: absolute; inset: 11px; border: 1px dashed oklch(65% 0.035 220); border-radius: 50%; }
.measurement-core { position: absolute; top: 28px; left: 28px; width: 18px; height: 18px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 7px oklch(63% 0.17 28 / 0.16); }
.measurement-cross::before, .measurement-cross::after { position: absolute; top: 37px; left: 7px; width: 60px; height: 1px; background: oklch(78% 0.025 220); content: ""; }
.measurement-cross::after { top: 7px; left: 37px; width: 1px; height: 60px; }

.research-card { position: relative; padding: 30px 32px 28px; color: var(--paper); background: var(--ink-soft); border: 1px solid var(--dark-border); border-radius: 14px; }
.research-card::before { position: absolute; top: -1px; left: 24px; width: 86px; height: 3px; background: var(--acid); border-radius: 0 0 3px 3px; content: ""; }
.card-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.card-topline h2 { margin: 7px 0 0; color: var(--paper); font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.25; }
.step-stamp { color: var(--paper-muted); font-size: 11px; }
.step-stamp b { color: var(--acid); font-weight: 700; }

.seed-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 25px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.seed-tab { padding: 8px 11px; color: var(--paper-muted); background: transparent; border: 1px solid transparent; border-radius: 7px; font-size: 13px; line-height: 1.25; transition: color 160ms ease, background 160ms ease, border-color 160ms ease; }
.seed-tab:hover, .seed-tab.is-active { color: var(--acid); background: oklch(78% 0.16 75 / 0.11); border-color: oklch(78% 0.16 75 / 0.34); }

.seed-input-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(230px, 0.7fr); gap: 20px; margin-top: 22px; }
.seed-field-wrap, .url-field-wrap { min-width: 0; }
.field-label { display: block; margin-bottom: 8px; color: var(--paper-dim); font-size: 12px; font-weight: 600; line-height: 1.4; }
.seed-input, .text-input, .month-input, .mini-control input, .mini-control select { width: 100%; color: var(--paper); background: transparent; border: 1px solid var(--dark-border); border-radius: 7px; outline: 0; transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.seed-input { min-height: 122px; padding: 13px 14px; resize: vertical; color: var(--paper); background: oklch(18% 0.04 222 / 0.2); font-size: 17px; line-height: 1.55; }
.seed-input::placeholder { color: oklch(67% 0.03 220); opacity: 1; }
.text-input { height: 42px; padding: 0 12px; color: var(--paper); font-size: 13px; }
.text-input::placeholder { color: oklch(67% 0.03 220); }
.text-input:focus, .seed-input:focus, .month-input:focus, .mini-control input:focus, .mini-control select:focus { border-color: var(--acid); background-color: oklch(78% 0.16 75 / 0.045); box-shadow: 0 0 0 3px oklch(78% 0.16 75 / 0.12); }
.field-hint { display: block; margin-top: 7px; color: oklch(68% 0.03 220); font-size: 12px; line-height: 1.45; }
.select-input { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--acid) 50%), linear-gradient(135deg, var(--acid) 50%, transparent 50%); background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; }
.select-input option, .mini-control select option { color: var(--ink); background: var(--surface); }
.is-hidden { display: none !important; }

.context-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.control-field { min-width: 0; }
.range-row { display: grid; grid-template-columns: minmax(165px, 1fr) auto minmax(164px, auto) auto; align-items: end; gap: 20px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.range-copy .field-hint { max-width: 190px; }
.month-fields { display: flex; align-items: center; gap: 9px; }
.month-input { width: 139px; height: 42px; padding: 0 11px; color: var(--paper); color-scheme: dark; font-size: 13px; }
.range-arrow { color: var(--acid); font-size: 18px; }
.toggle-control { display: inline-flex; align-items: center; gap: 9px; padding-bottom: 11px; color: var(--paper-dim); font-size: 12px; white-space: nowrap; }
.toggle-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track { position: relative; display: inline-block; width: 34px; height: 19px; border: 1px solid oklch(57% 0.035 220); border-radius: 11px; transition: border-color 160ms ease, background 160ms ease; }
.toggle-track span { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: oklch(68% 0.03 220); transition: left 160ms ease, background 160ms ease; }
.toggle-control input:checked + .toggle-track { border-color: var(--acid); background: oklch(78% 0.16 75 / 0.14); }
.toggle-control input:checked + .toggle-track span { left: 18px; background: var(--acid); }
.run-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 22px; min-width: 154px; min-height: 42px; padding: 10px 13px 10px 15px; color: var(--ink); background: var(--acid); border: 1px solid var(--acid); border-radius: 8px; font-size: 14px; font-weight: 700; line-height: 1.25; transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.run-button:hover { background: oklch(84% 0.13 78); border-color: oklch(84% 0.13 78); box-shadow: 0 8px 20px oklch(78% 0.16 75 / 0.18); transform: translateY(-1px); }
.run-button:disabled { color: oklch(38% 0.03 70); background: oklch(48% 0.07 70); border-color: oklch(48% 0.07 70); box-shadow: none; transform: none; }
.run-icon { font-size: 16px; font-weight: 400; line-height: 1; }
.form-error { margin-top: 14px; padding: 10px 12px; color: oklch(91% 0.045 28); background: oklch(63% 0.17 28 / 0.14); border: 1px solid oklch(63% 0.17 28 / 0.52); border-radius: 7px; font-size: 13px; line-height: 1.45; }

.results-section { margin-top: 64px; }
.results-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.results-heading-row h2 { margin: 7px 0 0; color: var(--ink); font-family: var(--display); font-size: 34px; font-weight: 750; letter-spacing: -0.045em; line-height: 1.2; }
.result-meta { color: var(--text-subtle); font-size: 12px; text-align: right; }
.results-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 24px; padding: 14px; background: var(--surface); border: 1px solid var(--line-dark); border-radius: 11px; }
.filter-pair { display: flex; align-items: end; gap: 9px; }
.search-box { display: flex; align-items: center; gap: 8px; width: 178px; min-height: 40px; padding: 0 9px; background: var(--surface-muted); border: 1px solid var(--line-dark); border-radius: 7px; }
.exclude-box .search-glyph { color: var(--text-subtle); }
.search-glyph { color: var(--coral); font-size: 21px; line-height: 1; transform: translateY(-1px); }
.search-box input { min-width: 0; flex: 1; height: 28px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.search-box input::placeholder { color: var(--text-subtle); }
kbd { padding: 2px 5px; color: var(--text-subtle); background: var(--surface); border: 1px solid oklch(80% 0.025 220); border-radius: 4px; font-family: var(--mono); font-size: 10px; }
.toolbar-controls { display: flex; align-items: end; gap: 9px; }
.mini-control { min-width: 102px; }
.mini-control span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 11px; font-weight: 600; line-height: 1.25; }
.mini-control input, .mini-control select { height: 38px; padding: 0 10px; color: var(--ink); background: var(--surface); border-color: var(--line-dark-strong); font-size: 13px; }
.mini-control select { appearance: none; padding-right: 27px; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 13px) 16px, calc(100% - 8px) 16px; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; }
.sort-control { min-width: 102px; }
.sort-direction { width: 38px; height: 38px; padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line-dark-strong); border-radius: 7px; font-size: 15px; transition: color 160ms ease, background 160ms ease, border-color 160ms ease; }
.sort-direction:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.export-button { height: 40px; padding: 0 13px; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); border-radius: 7px; font-size: 13px; font-weight: 650; transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease; }
.export-button:hover:not(:disabled) { color: var(--ink); background: var(--acid); border-color: var(--acid); transform: translateY(-1px); }
.export-button:disabled { color: oklch(61% 0.025 220); background: oklch(91% 0.018 220); border-color: oklch(91% 0.018 220); }

.result-frame { min-height: 320px; margin-top: 14px; background: var(--surface); border: 1px solid var(--line-dark); border-radius: 11px; overflow: hidden; }
.empty-state { display: grid; justify-items: center; padding: 78px 20px; text-align: center; }
.empty-state h3 { margin: 14px 0 8px; color: var(--ink); font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.25; }
.empty-state p { max-width: 340px; margin: 0; color: var(--text-muted); font-size: 15px; line-height: 1.6; }
.empty-orbit { position: relative; width: 62px; height: 62px; margin-bottom: 12px; border: 1px solid oklch(72% 0.03 220); border-radius: 50%; }
.empty-orbit::before, .empty-orbit::after { position: absolute; inset: 10px; border: 1px dashed oklch(77% 0.025 220); border-radius: 50%; content: ""; }
.empty-orbit::after { inset: 25px; border: 0; background: var(--coral); box-shadow: 0 0 0 7px oklch(63% 0.17 28 / 0.12); }
.empty-orbit span { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--acid-deep); }
.empty-orbit span:nth-child(1) { top: 8px; left: 15px; }
.empty-orbit span:nth-child(2) { top: 42px; left: 49px; }
.empty-orbit span:nth-child(3) { top: 27px; left: 2px; }
.table-wrap { overflow-x: auto; }
.results-table { width: 100%; min-width: 900px; border-collapse: collapse; table-layout: fixed; }
.results-table th { padding: 14px 15px; color: var(--text-muted); border-bottom: 1px solid var(--line-dark); font-size: 11px; font-weight: 650; letter-spacing: 0.02em; line-height: 1.35; text-align: left; }
.results-table td { padding: 16px 15px; border-bottom: 1px solid oklch(92% 0.02 220); vertical-align: middle; }
.results-table tbody tr { animation: row-in 180ms both; transition: background 160ms ease; }
.results-table tbody tr:hover { background: oklch(78% 0.16 75 / 0.14); }
.index-col { width: 48px; }
.volume-col { width: 138px; }
.trend-col { width: 158px; }
.bid-col { width: 145px; }
.variants-col { width: 88px; }
.results-table th span { color: oklch(68% 0.03 220); }
.row-index { color: var(--text-subtle); font-family: var(--mono); font-size: 11px; }
.keyword-cell { overflow: hidden; color: var(--ink); font-family: var(--body); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.keyword-cell small { display: block; margin-top: 4px; color: var(--text-subtle); font-family: var(--body); font-size: 11px; font-weight: 400; line-height: 1.35; }
.volume-number { color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 650; }
.volume-number.is-empty { color: oklch(65% 0.025 220); font-weight: 400; }
.sparkline { display: block; width: 126px; height: 30px; }
.sparkline polyline { fill: none; stroke: var(--sky); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.sparkline circle { fill: var(--coral); }
.competition-wrap { display: flex; align-items: center; gap: 8px; }
.competition-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.competition-chip::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.competition-chip.low { color: #4e865a; background: rgba(78, 134, 90, 0.12); }
.competition-chip.medium { color: #a27336; background: rgba(162, 115, 54, 0.12); }
.competition-chip.high { color: #b85d4d; background: rgba(184, 93, 77, 0.12); }
.competition-chip.unknown { color: #7e8c84; background: rgba(126, 140, 132, 0.12); }
.competition-index { color: var(--text-subtle); font-family: var(--mono); font-size: 10px; }
.bid-value { color: var(--text-muted); font-family: var(--mono); font-size: 12px; }
.bid-value.is-empty { color: oklch(65% 0.025 220); }
.variant-count { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 12px; }
.variant-count b { color: var(--coral); font-weight: 700; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 15px; color: var(--text-subtle); font-size: 11px; }
.table-footer-right { color: oklch(68% 0.03 220); }

.page-footer { display: flex; justify-content: space-between; gap: 15px; margin-top: 22px; color: var(--text-subtle); font-size: 11px; }
.page-footer b { color: var(--coral); font-weight: 700; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(390px, calc(100vw - 44px)); padding: 12px 14px; color: var(--paper); background: var(--ink); border: 1px solid oklch(78% 0.16 75 / 0.52); border-radius: 8px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2); font-size: 13px; line-height: 1.45; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { border-color: oklch(63% 0.17 28 / 0.76); }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: oklch(21% 0.045 225 / 0.78); backdrop-filter: blur(8px); }
.help-modal { position: relative; width: min(520px, 100%); padding: 36px; color: var(--paper); background: var(--ink-soft); border: 1px solid var(--dark-border); border-radius: 14px; }
.help-modal::before { position: absolute; top: -1px; left: 24px; width: 82px; height: 3px; background: var(--acid); border-radius: 0 0 3px 3px; content: ""; }
.help-modal .modal-close { position: absolute; top: 16px; right: 16px; color: var(--paper); border-color: oklch(92% 0.015 220 / 0.38); }
.help-modal .modal-close:hover { color: var(--ink); background: var(--acid); border-color: var(--acid); }
.help-modal h2 { margin: 13px 0 26px; font-family: var(--display); font-size: 38px; font-weight: 750; letter-spacing: -0.055em; line-height: 1.12; }
.help-list { border-top: 1px solid var(--line); }
.help-list p { margin: 0; padding: 15px 0; color: var(--paper-dim); border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.6; }
.help-list b { color: var(--acid); font-weight: 700; }
.login-modal > p { max-width: 360px; margin: -8px 0 23px; color: var(--paper-dim); font-size: 15px; line-height: 1.6; }
.login-modal form { padding-top: 20px; border-top: 1px solid var(--line); }
.login-modal .text-input { display: block; margin-bottom: 4px; }
.login-button { margin-top: 17px; }

.reveal { animation: none; }
.reveal-1, .reveal-2, .reveal-3 { animation-delay: 0ms; }

@keyframes row-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1180px) {
  .sidebar { flex-basis: 238px; padding-right: 18px; padding-left: 18px; }
  .main-panel { padding-right: 32px; padding-left: 32px; }
  .range-row { grid-template-columns: 1fr auto; }
  .toggle-control { justify-self: start; }
  .run-button { justify-self: end; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-controls { justify-content: flex-end; flex-wrap: wrap; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: relative; display: block; min-height: auto; padding: 20px 20px 16px; }
  .sidebar::after { top: -58px; right: 10%; width: 132px; height: 132px; }
  .rail-status { position: absolute; top: 19px; right: 20px; margin: 0; padding: 0; border: 0; }
  .rail-status .eyebrow, .rail-status strong { display: none; }
  .mode-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 23px; }
  .mode-button { min-height: 56px; padding: 9px 10px; }
  .mode-button small { display: none; }
  .mode-button strong { font-size: 14px; }
  .mode-arrow { display: none; }
  .rail-note { display: none; }
  .sidebar-footer { margin-top: 8px; }
  .main-panel { padding-right: 20px; padding-left: 20px; }
  .topbar { min-height: 59px; }
  .intro-grid { grid-template-columns: 1fr; padding: 48px 0 34px; }
  .intro-aside { display: none; }
  .intro-copy h1 { font-size: clamp(42px, 11vw, 58px); }
  .intro-copy p { max-width: 540px; font-size: 16px; }
  .research-card { padding: 26px 20px 21px; }
  .seed-input-layout { grid-template-columns: 1fr; }
  .context-grid { grid-template-columns: 1fr; gap: 16px; }
  .range-row { grid-template-columns: 1fr; gap: 16px; }
  .month-fields { justify-content: flex-start; }
  .run-button { justify-self: stretch; width: 100%; }
  .results-section { margin-top: 52px; }
  .results-heading-row { align-items: start; flex-direction: column; gap: 8px; }
  .result-meta { text-align: left; }
  .toolbar-controls { align-items: end; justify-content: flex-start; }
  .filter-pair { width: 100%; }
  .search-box { width: 100%; }
  .result-frame { overflow-x: auto; }
  .page-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .topbar-actions { gap: 8px; }
  .last-fetch { display: none; }
  .breadcrumb { font-size: 11px; }
  .intro-copy h1 { font-size: 41px; }
  .card-topline h2 { font-size: 24px; }
  .seed-tabs { gap: 5px; }
  .seed-tab { padding: 7px 9px; font-size: 12px; }
  .month-fields { justify-content: space-between; }
  .month-input { width: 45%; }
  .toolbar-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-control, .sort-control { min-width: 0; }
  .sort-direction { width: 100%; }
  .export-button { width: 100%; }
  .help-modal { padding: 31px 23px; }
  .help-modal h2 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
