:root {
  --accent: #e8662a;
  --bg: #f6f6ef;
  --page: #f6f6ef;
  --outer: #fff;
  --text: #000;
  --muted: #828282;
  --visited: #828282;
  --dead: #8f8f8f;
  --quote: #fff7d6;
  --ok: #2b7a2b;
  --bad: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b18;
    --page: #1b1b18;
    --outer: #111;
    --text: #dedcd3;
    --muted: #8d8b84;
    --visited: #77756f;
    --dead: #7a7871;
    --quote: #2c2a1f;
    --ok: #7bc47b;
    --bad: #f08a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--outer);
  color: var(--text);
  font: 10pt Verdana, Geneva, sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#page {
  width: 85%;
  max-width: 1100px;
  margin: 8px auto;
  background: var(--page);
}

#top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  background: var(--accent);
  color: #000;
  line-height: 1.6;
}
.logo {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px solid #fff;
  color: #fff;
  font-weight: bold;
  text-align: center;
  line-height: 18px;
}
#top nav { flex: 1; display: flex; flex-wrap: wrap; column-gap: 10px; }
#top .name { font-weight: bold; }
.me { flex: none; }

#status {
  padding: 6px 10px;
  background: var(--quote);
  border-bottom: 1px solid var(--accent);
}

main { padding: 8px 0 12px; min-height: 60vh; }

/* Story lists */
.stories { list-style: none; margin: 0; padding: 0; }
.story { display: grid; grid-template-columns: 2.4em 14px 1fr; column-gap: 4px; padding: 2px 4px 5px 0; }
.rank { text-align: right; color: var(--muted); }
.vote { width: 10px; height: 10px; margin-top: 4px; border: none; padding: 0; background: none; cursor: pointer; }
.vote::before { content: ""; display: block; border: 5px solid transparent; border-bottom: 8px solid var(--muted); border-top: 0; }
.vote.voted { visibility: hidden; }
.title { font-size: 10pt; }
.story.pinned { margin-bottom: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--accent); }
.story.pinned .title a { font-weight: bold; }
.title a.visited, .title a:visited { color: var(--visited); }
.site, .sub { font-size: 7pt; color: var(--muted); }
.sub { grid-column: 3; }
.sub a:hover { text-decoration: underline; }
.more { display: inline-block; margin: 8px 0 0 calc(2.4em + 22px); color: var(--muted); }
.empty { padding: 12px 20px; color: var(--muted); }

/* Item page */
.item-head { padding: 0 8px 0 0; }
.item-head .story { padding-bottom: 6px; }
.item-text { margin: 4px 0 12px calc(2.4em + 22px); max-width: 70ch; }
.comments { margin-top: 12px; }
.comment { padding: 0 8px 12px calc(var(--depth) * 40px + 8px); }
.comment .head { font-size: 8pt; color: var(--muted); }
.comment .body { max-width: 75ch; margin-top: 3px; }
.comment .body p, .item-text p { margin: 0 0 8px; }
.comment.dead .body { color: var(--dead); }
.comment.collapsed .body { display: none; }
.toggle { border: none; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.edited-link { text-decoration: underline; }
.original { margin-top: 6px; padding: 6px 8px; background: var(--quote); border-left: 3px solid var(--accent); }
.original .label { font-size: 8pt; color: var(--muted); margin-bottom: 4px; }

/* Profile, article, forms */
.profile { border-collapse: collapse; margin: 4px 12px; }
.profile td { padding: 3px 12px 3px 0; vertical-align: top; color: var(--muted); }
.profile td + td { color: var(--text); max-width: 60ch; }
.profile p { margin: 0 0 8px; }
.profile a { text-decoration: underline; }
.segmented { display: inline-flex; border: 1px solid var(--muted); }
.segmented button {
  min-width: 3.5em; padding: 3px 10px; border: none; background: none; color: var(--text);
  font: inherit; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: #000; }

.article { max-width: 70ch; margin: 0 auto; padding: 8px 16px 0; font-size: 11pt; line-height: 1.6; }
.article h1 { font-size: 16pt; margin: 8px 0 2px; }
.article .site { font-size: 9pt; }
.article p { margin: 0 0 14px; white-space: pre-line; }
.article .back { font-size: 9pt; text-decoration: underline; color: var(--muted); }

.panel { max-width: 60ch; margin: 4px 16px; }
.panel h2 { font-size: 11pt; margin: 4px 0 8px; }
.panel p { margin: 0 0 10px; }
.answer-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.answer-form input {
  flex: 1 1 16em; min-width: 0; padding: 5px 6px; font: inherit;
  background: var(--outer); color: var(--text); border: 1px solid var(--muted);
}
.btn {
  padding: 5px 12px; font: inherit; cursor: pointer;
  background: var(--outer); color: var(--text); border: 1px solid var(--muted);
}
.btn:hover { border-color: var(--accent); }
.result.ok { color: var(--ok); }
.result.bad { color: var(--bad); }
.panel h3 { font-size: 10pt; margin: 16px 0 6px; }
.btn.small { padding: 2px 8px; font-size: 8pt; }
.facts { list-style: none; margin: 0 0 14px; padding: 0; }
.fact { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--muted) 25%, transparent); }
.fact.found::before { content: "\2713"; color: var(--ok); font-weight: bold; }
.fact .unknown { color: var(--muted); }
.fact .where { flex-basis: 100%; padding: 4px 8px; background: var(--quote); border-left: 3px solid var(--accent); }
#status.banned { background: #b3261e; color: #fff; border-color: #b3261e; }
#status.banned a { color: #fff; }
.warn { font-size: 8pt; color: var(--muted); }
.confirm { margin: 8px 0 12px; padding: 8px 10px; border: 1px solid var(--bad); }
.confirm p { margin: 0 0 8px; }
.confirm .btn + .btn { margin-left: 6px; }
.btn.danger { background: #b3261e; color: #fff; border-color: #b3261e; }
#toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(92vw, 36em); padding: 10px 14px; background: var(--quote); color: var(--text);
  border: 1px solid var(--accent); box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
  padding-right: 40px;
}
.toast-close {
  position: absolute; top: 2px; right: 2px; width: 32px; height: 32px;
  border: none; background: none; color: var(--muted); font-size: 16pt; line-height: 1; cursor: pointer;
}

footer {
  margin: 0 4px; padding: 10px 0 14px; border-top: 2px solid var(--accent);
  text-align: center; font-size: 8pt; color: var(--muted);
}
footer p { margin: 8px 0 0; }
#search { margin-top: 10px; }
#search input { width: 14em; max-width: 60vw; padding: 3px 5px; font: inherit; background: var(--outer); color: var(--text); border: 1px solid var(--muted); }
.search-head { color: var(--muted); }
footer .credit, .result a { text-decoration: underline; }

@media (max-width: 750px) {
  #page { width: 100%; margin: 0; }
  .story { grid-template-columns: 1.8em 14px 1fr; }
  .comment { padding-left: calc(var(--depth) * 14px + 8px); }
  .item-text, .more { margin-left: 12px; }
  .title { font-size: 11pt; }
  .sub, .site { font-size: 8pt; }
  .panel { margin: 4px 12px; }
  input { font-size: 16px; } /* stops iOS zooming into inputs */
}

/* Evidence grid */
.grid-wrap { overflow-x: auto; margin: 6px 0 14px; }
.grid { border-collapse: collapse; }
.grid th, .grid td { padding: 2px; text-align: center; font-size: 8pt; }
.grid thead th { color: var(--muted); font-weight: normal; min-width: 3.4em; }
.grid tbody th { text-align: left; padding-right: 10px; font-weight: normal; }
.grid tbody th a { text-decoration: underline; }
.grid tr.out th a { text-decoration: line-through; color: var(--muted); }
.cell {
  width: 36px; height: 30px; padding: 0; font: inherit; font-size: 11pt; cursor: pointer;
  background: var(--outer); color: var(--muted); border: 1px solid color-mix(in srgb, var(--muted) 50%, transparent);
}
.cell.m-y { color: var(--ok); border-color: var(--ok); font-weight: bold; }
.cell.m-n { color: var(--bad); border-color: var(--bad); font-weight: bold; }
.fact q { font-style: italic; }
.fact .src { color: var(--muted); font-size: 8pt; }

/* Result */
.score { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.score div { padding: 8px 6px; border: 1px solid color-mix(in srgb, var(--muted) 40%, transparent); text-align: center; }
.score span { display: block; font-size: 7pt; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.score b { display: block; margin-top: 2px; }
.share-text { margin: 0 0 8px; padding: 8px; background: var(--quote); font: inherit; font-size: 9pt; white-space: pre-wrap; }
.copied { font-size: 8pt; color: var(--ok); }
.reveal { padding-left: 1.2em; }
.reveal li { margin-bottom: 6px; }
.reveal a { text-decoration: underline; }
