:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d1d1b;
  --soft: #55554f;
  --muted: #68685f;
  --rule: #dddcd4;
  --field: #7d7c73;
  --accent: #a2421f;
  --tag-bg: #efe9dc;
  --tag-ink: #6b5428;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --panel: #1d1f23;
    --ink: #e6e4de;
    --soft: #b5b3ab;
    --muted: #9a988f;
    --rule: #2c2e33;
    --field: #74767c;
    --accent: #f08a5d;
    --tag-bg: #2a2620;
    --tag-ink: #d8bf8a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--accent);
  border-radius: 6px;
  z-index: 10;
}
.skip:focus { top: 8px; }

.top {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
.brand { font-weight: 700; color: var(--accent); text-decoration: none; font-size: 17px; }
.top nav { display: flex; gap: 14px; flex-wrap: wrap; }
.top nav a { color: var(--soft); text-decoration: none; }
.top nav a[aria-current="page"], .top nav a:hover { color: var(--ink); text-decoration: underline; }

main { max-width: 900px; margin: 0 auto; padding: 16px 20px 48px; }
h1 { font-size: 18px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 22px 0 8px; }
h3 { font-size: 15px; }

.stories { list-style: none; margin: 0; padding: 0; }
.story { display: flex; gap: 12px; padding: 7px 0; }
.score {
  min-width: 2.6em;
  text-align: right;
  font: 600 13px/1.9 var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.title { color: var(--ink); text-decoration: none; font-weight: 600; margin-right: 4px; }
.title:visited { color: var(--soft); }
.title:hover { text-decoration: underline; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  vertical-align: middle;
  font: 11px/1.6 var(--mono);
  padding: 0 7px;
  margin-right: 3px;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-ink);
  text-decoration: none;
}
.domain {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  vertical-align: middle;
  font: 12px var(--mono);
  color: var(--muted);
  text-decoration: none;
}
.meta { font-size: 12.5px; color: var(--muted); }
.meta a { color: var(--muted); }
.handle { color: var(--soft); }

.pager { display: flex; gap: 18px; margin-top: 18px; font-size: 14px; }
.empty { color: var(--muted); }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1;
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.search button {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
}
.hint { font-size: 12px; color: var(--muted); }
.hint code { font-family: var(--mono); margin-right: 6px; }

.tags th { text-align: left; font-size: 12px; color: var(--muted); padding: 0 14px 6px 0; }
.tags td { padding: 4px 14px 4px 0; color: var(--soft); }

.posts { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.post-item h2 { font-size: 17px; margin: 0 0 2px; }
.post-item h2 a { text-decoration: none; }
.post-item h2 a:hover { text-decoration: underline; }
.post-item p { margin: 4px 0 0; color: var(--soft); }
.post-item .meta { margin-top: 0; }

.post h1 { font-size: 24px; margin-bottom: 4px; }
.prose { max-width: 70ch; line-height: 1.6; }
.prose h2 { font-size: 19px; margin: 28px 0 8px; }
.prose h3, .prose h4, .prose h5, .prose h6 { font-size: 16px; margin: 22px 0 6px; }
.prose a { color: var(--accent); }
.prose img { max-width: 100%; height: auto; }
.prose pre { overflow-x: auto; padding: 12px 14px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; }
.prose code { font-family: var(--mono); font-size: 0.92em; }
.prose blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--rule); color: var(--soft); }
.prose table { border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 4px 8px; text-align: left; }
.back { margin-top: 28px; }

.account { margin-left: auto; display: flex; align-items: baseline; gap: 10px; font-size: 14px; }
.account form { display: inline; }
.account a { color: var(--soft); }
.who { color: var(--ink); font-weight: 600; }
button.linkish { font: inherit; color: var(--soft); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

button.primary, button.secondary {
  font: inherit;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
}
button.primary { background: var(--accent); color: var(--bg); border: 1px solid var(--accent); font-weight: 600; }
button.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--field); }

.login, .signup, .go { max-width: 32rem; }
.login label { display: block; font-weight: 600; margin-bottom: 4px; }
.login input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.signup { margin-top: 18px; }
.lead { max-width: 60ch; }
.form-error { color: var(--ink); border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--panel); max-width: 60ch; }
.notice, .check { max-width: 60ch; border-left: 3px solid var(--accent); padding: 8px 12px; background: var(--panel); }

.combo { position: relative; }
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--field);
  border-radius: 8px;
}
.suggest li { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; border-radius: 5px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--tag-bg); }
.suggest img { border-radius: 50%; }
.suggest .name { color: var(--ink); font-weight: 600; }
.suggest .handle { color: var(--muted); }

/* Voting */
.score { display: flex; flex-direction: column; align-items: flex-end; }
.vote { margin: 0; }
.vote button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.vote button:hover { border-color: var(--field); }
.vote button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* Story and comment actions */
.story-text { margin: 4px 0 8px 46px; }
.item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 14px;
  font-size: 13px;
  color: var(--muted);
}
.item-actions > a, .item-actions summary, .item-actions .linkish {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--soft);
}
.item-actions summary { cursor: pointer; text-decoration: underline; }
.item-actions details[open] { flex-basis: 100%; }
.item-actions details form { margin: 6px 0 4px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; }
.item-actions details p { margin: 0 0 8px; }
.inline { display: inline; margin: 0; }
.edited { align-self: center; font-style: italic; }
.flagged { flex-basis: 100%; margin: 0; color: var(--accent); }
.flag fieldset { border: 0; margin: 0 0 8px; padding: 0; }
.flag legend { padding: 0; margin-bottom: 4px; font-weight: 600; color: var(--ink); }
.flag label { display: flex; align-items: center; gap: 6px; min-height: 28px; color: var(--ink); }
main > .item-actions { margin: 0 0 8px 46px; }

/* Comments */
.comments { margin-top: 24px; }
.comments h2 { font-size: 16px; }
.thread { list-style: none; margin: 0; padding: 0; }
.thread .thread { margin-left: 18px; padding-left: 12px; border-left: 2px solid var(--rule); }
.comment { padding: 8px 0; }
.comment .prose p { margin: 4px 0; }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.comment-head a { display: inline-flex; align-items: center; min-height: 24px; }
.comment-head .age { color: var(--muted); }
.deleted { color: var(--muted); margin: 4px 0; }

/* Forms */
.post-form, .comment-form { display: flex; flex-direction: column; gap: 6px; max-width: 42rem; margin-bottom: 18px; }
.post-form > label, .comment-form > label { font-weight: 600; margin-top: 8px; }
.post-form input[type="text"], .post-form input[type="url"], .post-form textarea, .comment-form textarea {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.post-form button, .comment-form button { align-self: flex-start; margin-top: 8px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.tags-pick { border: 1px solid var(--rule); border-radius: 6px; margin: 10px 0 0; padding: 8px 12px; }
.tags-pick legend { font-weight: 600; padding: 0 4px; }
.tags-pick label { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 14px; }
.post-form .check-line { display: flex; align-items: center; gap: 8px; min-height: 30px; font-weight: 400; }

/* Profile */
.profile-comments { list-style: none; margin: 0; padding: 0; }
.profile-comments li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.profile-comments .meta { margin: 0; }
.profile-comments .meta a { display: inline-flex; align-items: center; min-height: 24px; }

/* Moderation */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 11.5px;
  border: 1px solid var(--field);
  border-radius: 10px;
  color: var(--soft);
  text-decoration: none;
  vertical-align: middle;
}
a.badge:hover { border-color: var(--accent); }
.mod-status { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--panel); max-width: 60ch; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 16px; border-bottom: 1px solid var(--rule); }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--soft); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
.tabs .count { font: 12px var(--mono); color: var(--muted); }
.queue, .plain, .modlog { list-style: none; margin: 0; padding: 0; }
.queue-row { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.queue-row h2 { font-size: 15px; margin: 0 0 4px; }
.excerpt { margin: 4px 0; color: var(--soft); max-width: 70ch; white-space: pre-line; }
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}
.plain li, .modlog li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.plain li p, .modlog li p { margin: 2px 0; }
.modlog .reason { color: var(--ink); }
.review-item { padding: 8px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--panel); max-width: 70ch; }
.review-item h2 { font-size: 16px; margin: 4px 0; }
.revision { white-space: pre-wrap; font: 13px var(--mono); background: var(--panel); padding: 8px; border-radius: 6px; }
.mod-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0 24px; }
.mod-actions h3, .post-form h3 { font-size: 15px; margin: 8px 0 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: 8px; }
.inline-form input[type="text"] { font: inherit; padding: 4px 8px; border: 1px solid var(--field); border-radius: 6px; background: var(--panel); color: var(--ink); }
.verdict { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--field); background: var(--panel); max-width: 70ch; }
.verdict p { margin: 2px 0; }
