:root {
  --bg: #07080b;
  --panel: rgba(13, 17, 23, 0.9);
  --line: #262d36;
  --text: #e8ecf2;
  --muted: #8b949e;
  --faint: #5d6570;
  --accent: var(--shareabl-accent, #ff3d8b);
  --sans: Geist, Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --top: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.shade {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 45%, rgba(7, 8, 11, 0.86) 30%, rgba(7, 8, 11, 0.55) 75%, rgba(7, 8, 11, 0.4));
  transition: opacity 0.6s;
}
body:not([data-view='home']) .shade {
  opacity: 0.0;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--top);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-left));
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 650; letter-spacing: -0.01em; text-decoration: none; font-size: 17px;
}
.brand svg { width: 26px; height: 26px; color: var(--accent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 60%, transparent)); }
.top nav { display: flex; gap: 6px; }
.top nav button {
  background: rgba(13, 17, 23, 0.7); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; color: var(--muted); backdrop-filter: blur(8px);
}
.top nav button:hover { color: var(--text); border-color: #3a434e; }
body[data-view='crawl'] .top nav { display: none; }

/* ─── Home ────────────────────────────────────────────────────────────────── */
/* The scroll container is the full width, so a wheel or swipe anywhere on the
   page scrolls it; .home-col holds the reading column in the middle. */
.home {
  position: relative; z-index: 5;
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column;
  padding: calc(var(--top) + 24px) 20px 72px;
}
.home-col {
  width: 100%; max-width: 760px; margin: auto;
  display: flex; flex-direction: column; align-items: stretch;
}
.kicker {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  margin: 0 0 22px; padding: 6px 12px 6px 10px;
  font: 500 12px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #c9d1d9;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(13, 17, 23, 0.75);
}
.kicker b { color: var(--accent); font-weight: 700; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
h1 {
  margin: 0; font-weight: 650; letter-spacing: -0.045em; line-height: 0.98;
  font-size: clamp(2.6rem, 8vw, 5rem);
}
h1 em { display: block; font-style: normal; color: var(--accent); }
.lede { margin: 22px 0 28px; max-width: 590px; color: #aeb6c0; font-size: clamp(1rem, 2.4vw, 1.12rem); }

.ask {
  display: flex; gap: 10px; align-items: stretch;
  padding: 8px; border-radius: 18px;
  background: rgba(13, 17, 23, 0.92); border: 1px solid #2d3540;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ask:focus-within { border-color: color-mix(in srgb, var(--accent) 70%, #2d3540); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 20px 60px rgba(0, 0, 0, 0.5); }
.ask textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent;
  padding: 10px 10px; font-size: 17px; line-height: 1.4; min-height: 52px;
}
.ask textarea::placeholder { color: var(--faint); }
.go {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 0 18px; min-height: 48px;
  background: var(--accent); color: #fff; font-weight: 650; font-size: 15px; white-space: nowrap;
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform 0.12s, filter 0.12s;
}
.go:hover { filter: brightness(1.08); }
.go:active { transform: translateY(1px); }
.go svg { width: 20px; height: 20px; }
.ghost {
  border: 1px solid var(--line); background: rgba(13, 17, 23, 0.8); border-radius: 12px;
  padding: 0 16px; min-height: 44px; font-weight: 550; font-size: 14px; color: #c9d1d9;
}
.ghost:hover { border-color: #3a434e; color: var(--text); }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; padding: 6px 0; }

.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.examples button {
  border: 1px solid var(--line); background: rgba(13, 17, 23, 0.7); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; color: #aeb6c0; backdrop-filter: blur(6px);
}
.examples button:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

.crit-link {
  margin-top: 30px; align-self: flex-start; text-align: left;
  border: 0; background: none; padding: 0; color: var(--muted);
}
.crit-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.crit-chips span {
  font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 6px 8px; border-radius: 6px; background: rgba(22, 27, 34, 0.9); border: 1px solid var(--line); color: #c9d1d9;
}
.crit-cta { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.crit-link:hover .crit-cta { color: var(--text); }

.foot { margin-top: 44px; font-size: 12px; color: var(--faint); }

/* ─── HUD ─────────────────────────────────────────────────────────────────── */
.hud {
  position: fixed; top: var(--top); left: 0; right: 0; z-index: 10;
  padding: 0 16px 10px; pointer-events: none;
  background: linear-gradient(rgba(7, 8, 11, 0.92), rgba(7, 8, 11, 0.7) 70%, transparent);
}
.counters {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  max-width: 960px; margin: 0 auto;
}
.counters div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.counters span { font: 500 10.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.counters b { font: 500 clamp(1.3rem, 4.6vw, 2.2rem)/1.1 var(--mono); font-variant-numeric: tabular-nums; color: #7fdcff; }
.counters b.hot, .tally b.hot { color: var(--accent); }
.status {
  max-width: 960px; margin: 8px auto 0; font: 400 12px/1.4 var(--mono); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body[data-view='results'] .hud { background: rgba(7, 8, 11, 0.94); }

/* ─── Judge ───────────────────────────────────────────────────────────────── */
.judge {
  position: fixed; z-index: 10; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 660px; margin: 0 auto;
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  padding: 14px 16px; border-radius: 18px;
  background: rgba(16, 9, 16, 0.92);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 18%, transparent), 0 20px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}
.judge-face { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.judge-face svg {
  width: 62px; height: 62px; padding: 12px; border-radius: 50%;
  color: #fff; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 50%, #000));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08), 0 0 28px color-mix(in srgb, var(--accent) 70%, transparent);
}
.judge-face span { font: 600 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #f3d6e6; }
.judge-q { margin: 0 0 8px; font-weight: 600; font-size: 15px; }
.judge-row { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center; }
.tally { display: flex; flex-direction: column; gap: 3px; }
.tally span { font: 500 10px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tally b { font: 500 24px/1 var(--mono); font-variant-numeric: tabular-nums; }
.judge-now { min-width: 0; }
.verdict {
  display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px;
  padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: land 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.verdict.keep { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
@keyframes land { from { transform: scale(0.92); opacity: 0; } }
.verdict-tag { grid-row: span 2; align-self: center; font: 700 10px/1 var(--mono); letter-spacing: 0.08em; padding: 5px 6px; border-radius: 5px; background: #30363d; color: #9198a1; }
.verdict.keep .verdict-tag { background: var(--accent); color: #fff; }
.verdict b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verdict-what { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #3a2a36; }
.dots i.kept { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ─── Results ─────────────────────────────────────────────────────────────── */
.results {
  position: fixed; inset: 0; z-index: 8; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(rgba(7, 8, 11, 0.5), rgba(7, 8, 11, 0.9) 260px, rgba(7, 8, 11, 0.96));
  animation: rise 0.45s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.results-inner { max-width: 680px; margin: 0 auto; padding: calc(var(--top) + 96px) 16px calc(48px + env(safe-area-inset-bottom)); }
.r-need { margin: 0 0 18px; color: #aeb6c0; font-size: 15px; }
.r-kicker { margin: 0; font: 500 13px/1 var(--mono); color: var(--muted); }
.r-title { margin: 6px 0 6px; font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 650; letter-spacing: -0.04em; line-height: 1; }
.r-meta { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.r-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.r-item { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); overflow: hidden; }
.r-head {
  width: 100%; border: 0; background: none; text-align: left; padding: 12px 14px;
  display: grid; grid-template-columns: 26px 26px 1fr auto; column-gap: 10px; row-gap: 3px; align-items: center;
}
.r-head:hover { background: rgba(255, 255, 255, 0.02); }
.r-n { font: 500 13px/1 var(--mono); color: var(--accent); }
.r-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.r-name { min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.r-name b { font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-owner { font-size: 13px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-score {
  font: 600 15px/1 var(--mono); padding: 6px 8px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: color-mix(in srgb, var(--accent) 60%, #fff);
}
.r-what { grid-column: 3 / 5; font-size: 14px; color: var(--muted); }
.r-more { padding: 2px 14px 14px 50px; }
.r-why { margin: 0 0 12px; font-size: 15px; color: #e6c3d6; }
.r-bars { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 5px; }
.r-bars li { display: grid; grid-template-columns: 100px 1fr 22px; gap: 10px; align-items: center; font-size: 12.5px; color: #aeb6c0; }
.r-bars li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-bars i { height: 6px; border-radius: 3px; background: #1d232b; position: relative; overflow: hidden; }
.r-bars i::after { content: ''; position: absolute; inset: 0; width: calc(var(--v) * 100%); background: var(--accent); border-radius: 3px; }
.r-bars b { font: 500 12px/1 var(--mono); text-align: right; }
.r-stats { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.r-open { font-size: 14px; font-weight: 600; color: #7fb6ff; text-decoration: none; }
.r-open:hover { text-decoration: underline; }
.r-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 18px; }
.r-skipped { border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 14px; }
.r-skipped summary { cursor: pointer; }
.r-skipped ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.r-skipped a { color: #c9d1d9; }
.r-skip-why { color: #b98aa6; }
.r-crit { margin: 18px 0 0; font-size: 12.5px; color: var(--faint); }

/* ─── Sheets ──────────────────────────────────────────────────────────────── */
.sheet {
  width: min(600px, calc(100% - 20px)); max-height: min(88svh, 900px);
  padding: 0; border: 1px solid #30363d; border-radius: 18px;
  background: #0d1117; color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.sheet::backdrop { background: rgba(3, 4, 6, 0.7); backdrop-filter: blur(4px); }
.sheet form { padding: 20px; }
.sheet h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.sheet-lede { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.sheet-lede a { color: #7fb6ff; }
.sheet-small { width: min(440px, calc(100% - 20px)); }
.sheet input[type='text'] {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #30363d; background: #010409;
  font-family: var(--mono); font-size: 14px; outline: 0;
}
.sheet input[type='text']:focus { border-color: var(--accent); }
.sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.sheet-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.sheet-foot .link { margin-right: auto; }

.crit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: crit; }
.crit {
  display: grid; grid-template-columns: 1fr auto auto; gap: 6px 8px; align-items: center;
  padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: #010409;
  transition: opacity 0.15s;
}
.crit.off { opacity: 0.5; }
.crit-name {
  min-width: 0; border: 0; background: transparent; outline: 0; font-weight: 650; font-size: 15px; padding: 4px 2px;
}
.crit-name:focus, .crit-q:focus { box-shadow: inset 0 -1px 0 var(--accent); }
.crit-q {
  grid-column: 1 / -1; resize: vertical; border: 0; background: transparent; outline: 0;
  font-size: 13px; color: #aeb6c0; padding: 2px; line-height: 1.4; min-height: 38px;
}
.crit-weight { grid-row: 1; grid-column: 2; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.crit-weight button {
  border: 0; background: transparent; padding: 5px 8px; font: 500 12px/1 var(--mono); color: var(--muted);
}
.crit-weight button + button { border-left: 1px solid var(--line); }
.crit-weight button[aria-pressed='true'] { background: var(--accent); color: #fff; }
.crit-weight button:first-child[aria-pressed='true'] { background: #30363d; color: var(--text); }
.crit-del { grid-row: 1; grid-column: 3; border: 0; background: none; color: var(--faint); font-size: 20px; line-height: 1; padding: 2px 6px; }
.crit-del:hover { color: var(--text); }

.noscript { position: fixed; inset: auto 0 40% 0; text-align: center; z-index: 30; }

@media (max-width: 560px) {
  :root { --top: 52px; }
  .ask { flex-direction: column; }
  .go { min-height: 50px; }
  .judge { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
  .judge-face { flex-direction: row; gap: 10px; }
  .judge-face svg { width: 36px; height: 36px; padding: 7px; }
  .judge-q { font-size: 14px; }
  .r-more { padding-left: 14px; }
  .r-bars li { grid-template-columns: 88px 1fr 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse, .verdict, .results { animation: none; }
}
