:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f1eee9;
  --text: #1d1b19;
  --muted: #6d6760;
  --border: #e4dfd8;
  --accent: #e8572a;
  --accent-ink: #ffffff;
  --ok: #1f8a5b;
  --ok-bg: #e6f4ec;
  --warn: #a15c07;
  --warn-bg: #fdf1dc;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --li: #0a66c2;
  --x: #111111;
  --rd: #ff4500;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 25, .05), 0 4px 16px rgba(29, 27, 25, .04);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1e1c1a;
    --surface-2: #272522;
    --text: #f1ede8;
    --muted: #a39c93;
    --border: #34312d;
    --ok-bg: #16301f;
    --ok: #5fd39b;
    --warn-bg: #33270f;
    --warn: #f0b45a;
    --bad-bg: #3a1714;
    --bad: #ff8a80;
    --x: #f1ede8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(16px, calc((100vw - 880px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; inset: 8px 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: skewX(-20deg) rotate(-8deg); border-radius: 2px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 7px; font: inherit; cursor: pointer; }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

main { max-width: 880px; margin: 0 auto; padding: 24px 16px 80px; }
.view { display: grid; gap: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.composer { display: grid; gap: 16px; }
h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; }

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.wrap { flex-wrap: wrap; }
.gap { gap: 12px; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.seg { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 7px; font: inherit; font-weight: 550; cursor: pointer; }
.seg.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.project { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.project input { width: 150px; }

.hint { margin: -4px 0 0; color: var(--muted); font-size: 14px; }

input[type="text"], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.55; }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.drop {
  border: 1.5px dashed var(--border); border-radius: 12px; padding: 16px; cursor: pointer;
  display: grid; transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus, .drop.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); outline: none; }
#drop-empty { display: grid; gap: 2px; text-align: center; color: var(--muted); font-size: 14px; }
#drop-empty strong { color: var(--text); font-weight: 600; }
#drop-filled { display: flex; gap: 14px; align-items: center; }
#preview { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.drop-meta { display: grid; gap: 4px; font-size: 14px; min-width: 0; }
#file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chips { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; align-items: center; }
.chips legend { float: left; margin-right: 6px; color: var(--muted); font-size: 13px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 14px; user-select: none; }
.chip input:checked + span { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

.subreddit { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.subreddit input { width: 160px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; }
.track { width: 38px; height: 22px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

button { font: inherit; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
.primary:hover { filter: brightness(1.05); }
.primary:disabled, .ghost:disabled { opacity: .55; cursor: progress; }
.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.ghost:hover { background: var(--surface-2); }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; justify-self: start; }

.status { padding: 12px 16px; border-radius: 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.status.info { background: var(--surface-2); }
.status.error { background: var(--bad-bg); color: var(--bad); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

#review { display: grid; gap: 16px; }
.badge { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.issue-group { margin-top: 14px; }
.issue-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.issue-group ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.issue-group.bad h3 { color: var(--bad); }
.fix-from { text-decoration: line-through; color: var(--muted); }
.fix-why { color: var(--muted); font-size: 13px; }

.meta { display: grid; gap: 10px; margin: 16px 0 0; }
.meta div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.meta dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.meta dd { margin: 0; }
@media (max-width: 600px) { .meta div { grid-template-columns: 1fr; gap: 2px; } }

.posts { display: grid; gap: 16px; }
.post { display: grid; gap: 10px; }
.post header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.post.is-off { opacity: .45; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; color: #fff; }
.pill.li { background: var(--li); }
.pill.x { background: var(--x); color: var(--bg); }
.pill.rd { background: var(--rd); }
.count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--bad); font-weight: 600; }
.inline { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }
.inline input { width: 160px; padding: 6px 10px; }

.results, .history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.results li, .history li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.history li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.state { font-size: 13px; font-weight: 600; }
.state.posted { color: var(--ok); }
.state.failed, .state.not { color: var(--bad); }
.snippet { color: var(--muted); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 32px; }
a { color: var(--accent); }

.seg { white-space: nowrap; }
.composer > .row:first-child { flex-wrap: wrap; gap: 12px; }
@media (max-width: 480px) {
  .segmented { width: 100%; }
  .seg { flex: 1; padding: 8px 6px; }
  .project, .project input { width: 100%; }
  .project input { flex: 1; }
}

/* ---------- landing ---------- */
.hero { padding: 28px 4px 8px; display: grid; gap: 12px; }
.eyebrow { margin: 0; color: var(--accent); font-weight: 650; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(32px, 6vw, 48px); line-height: 1.05; letter-spacing: -.03em; font-weight: 750; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); font-size: 17px; max-width: 60ch; text-wrap: pretty; }
.steps { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 700; }
.cc { font-size: 14px; color: var(--muted); padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; }
.cc strong { color: var(--text); margin-right: 4px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; color: var(--text); }
.lock { max-width: 420px; margin: 48px auto; display: grid; gap: 12px; }
.lock form { margin: 0; }
.lock input { flex: 1; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }

.small { padding: 6px 12px; font-size: 14px; }
.brand { display: grid; gap: 8px; padding: 14px; background: var(--surface-2); border-radius: 12px; }
.brand label { font-size: 14px; color: var(--muted); }
#sources a { word-break: break-all; }
