:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --panel-2: #f1f3f8;
  --text: #121826;
  --muted: #5b6475;
  --line: #e2e6ee;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef0ff;
  --error: #b42318;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --panel: #131a2c;
    --panel-2: #1a2338;
    --text: #eef1f8;
    --muted: #9aa4b8;
    --line: #26304a;
    --accent: #8b85ff;
    --accent-2: #b38bff;
    --accent-soft: #23295a;
    --error: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }

.page { max-width: 1240px; margin: 0 auto; padding: 8px 20px 24px; }

/* header */
.hero { padding: 22px 0 12px; }
.kicker { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 650; }
.hero h1 {
  margin: 4px 0 8px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 780;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede { max-width: 800px; margin: 0 0 14px; color: var(--muted); font-size: 16px; }
.lede b { color: var(--text); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 560;
  font-size: 14px;
}
.links a:hover { border-color: var(--accent); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 16px 0 16px; overflow-x: auto; }
.tab {
  border: 0;
  background: none;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); margin-bottom: 14px; font-weight: 550; }

/* examples */
.stories { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stories-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.story-list { display: flex; flex-wrap: wrap; gap: 8px; }
.story {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 550;
  box-shadow: var(--shadow);
}
.story:hover { border-color: var(--accent); color: var(--accent); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 22px; align-items: start; }
.side {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 12px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.blurb { margin: 0; font-size: 13.5px; color: var(--muted); min-height: 20px; }
.blurb b { color: var(--text); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 12px; }
.segmented.two { grid-template-columns: 1fr 1fr; }
.segmented button {
  border: 0;
  background: none;
  border-radius: 9px;
  padding: 7px 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
}
.segmented button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.seg-sub { font-size: 11px; font-weight: 500; color: var(--muted); }

.search { display: flex; gap: 8px; }
.search input, .compare-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.search input:focus, .compare-form input:focus { outline: none; border-color: var(--accent); background: var(--panel); }
.primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.primary:hover { filter: brightness(1.08); }
.quiet { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 7px 10px; font-size: 13.5px; font-weight: 550; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-label { font-size: 13px; font-weight: 650; color: var(--muted); margin-right: 2px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.chip:hover, .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* history */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.timeline li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 14px;
  animation: in 0.18s ease-out;
}
.timeline li.empty { display: block; background: none; border: 1px dashed var(--line); color: var(--muted); line-height: 1.5; }
.timeline li.empty b { color: var(--text); }
.timeline img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 6px; flex: none; }
.timeline .icon { width: 38px; text-align: center; font-size: 18px; flex: none; }
.timeline .n {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}
.timeline .text { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }

/* results */
.status { min-height: 48px; margin-bottom: 10px; font-size: 14.5px; }
.status .hint { font-size: 13px; color: var(--muted); }
.status .note { margin-top: 6px; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: var(--accent-soft); }
.error { color: var(--error); font-weight: 600; padding: 6px 0; }
.empty { color: var(--muted); padding: 20px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  animation: in 0.2s ease-out;
}
button.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-pic { position: relative; aspect-ratio: 1 / 1; background: #fff; }
.card-pic img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; }
.rank {
  position: absolute;
  top: 7px;
  left: 7px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.card-text { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 3px; }
.card-name { font-size: 13px; line-height: 1.35; font-weight: 550; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-detail { font-size: 12.5px; color: var(--muted); }
.skeleton .card-pic, .skeleton .line { background: var(--panel-2); animation: pulse 1.1s ease-in-out infinite alternate; }
.skeleton .line { height: 11px; border-radius: 6px; margin: 3px 0; }
.skeleton .line.short { width: 55%; }
@keyframes pulse { from { opacity: 0.55; } to { opacity: 1; } }

.code { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.code summary { cursor: pointer; padding: 11px 14px; font-weight: 600; }
.code-wrap { position: relative; border-top: 1px solid var(--line); }
.code pre, .prose pre { margin: 0; padding: 14px; overflow-x: auto; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy { position: absolute; top: 8px; right: 8px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 3px 10px; font-size: 12.5px; }

/* compare */
.intro { margin: 0 0 12px; max-width: 820px; }
.muted { color: var(--muted); }
.compare-form { margin: 14px 0 18px; display: flex; flex-direction: column; gap: 10px; }
.compare-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); flex: 1; }
.compare-form input { text-transform: none; letter-spacing: 0; font-weight: 450; }
.compare-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.compare-then { display: flex; gap: 10px; align-items: flex-end; }
.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.column { min-width: 0; }
.col-title { font-size: 14px; padding: 4px 2px 10px; }

/* about */
.prose { max-width: 820px; }
.prose h2 { font-size: 19px; margin: 22px 0 8px; }
.prose h2:first-child { margin-top: 4px; }
.prose li { margin: 6px 0; }
.prose pre { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0 6px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .compare-inputs, .columns { grid-template-columns: 1fr; }
  .stories { flex-wrap: nowrap; }
  .story-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .story { white-space: nowrap; flex: none; }
  .stories-label { display: none; }
  .status { scroll-margin-top: 8px; }
}
@media (max-width: 480px) {
  .page { padding: 4px 14px 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .lede { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
