:root {
  color-scheme: light;
  --bg: #f8faf9;
  --text: #1f2933;
  --muted: #6b7280;
  --faint: #8b95a1;
  --line: #d9e0e7;
  --line-soft: #e9edf1;
  --surface: #ffffff;
  --surface-tint: #fbfcfd;
  --accent: #0f766e;
  --accent-soft: #dff3ee;
  --indigo: #4338ca;
  --indigo-soft: #e6e7ff;
  --amber: #a16207;
  --amber-soft: #fff3d7;
  --rose: #be123c;
  --rose-soft: #ffe4ec;
  --radius: 7px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), transparent 170px),
    var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 54px;
  padding: 10px max(18px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(248, 250, 249, 0.94);
  backdrop-filter: blur(12px);
}

.brand,
.nav-links,
.button,
.segmented,
.feed-actions,
.item-topline,
.meta,
.tag-pill,
.toggle-control,
.filter-hint,
.thread-head,
.comment-actions,
.score-control,
.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 9px;
  min-width: 0;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
}

.brand img {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.nav-links {
  justify-content: center;
  gap: 14px;
}

.nav-links a,
.button {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav-links a:hover,
.button:hover {
  color: var(--accent);
}

.button {
  min-height: 34px;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  padding: 0 8px;
}

.button-primary {
  color: var(--accent);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

main {
  width: min(1120px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: end;
  padding: 6px 0 22px;
}

.eyebrow,
.statusline,
.source,
.why,
.meta,
.editor-row span,
.mini-list {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  color: #111827;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.lede {
  margin: 0;
  color: #4b5563;
  font-size: 15px;
}

.statusline {
  margin: 8px 0 0;
  font-size: 13px;
}

h2 {
  margin-bottom: 10px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--faint);
}

.searchbar input,
.submit-form input,
.submit-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.searchbar input {
  background: transparent;
}

.searchbar input:focus,
.submit-form input:focus,
.submit-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.workspace {
  display: block;
}

.sidebar {
  padding: 12px 0 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.sidebar h2 {
  display: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill {
  min-height: 31px;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: #4b5563;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
}

.tag-pill span:last-child {
  color: var(--faint);
  font-weight: 700;
}

.tag-pill:hover,
.tag-pill.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #0b5f59;
}

.feed-column {
  min-width: 0;
}

.feed-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 0 8px;
}

.feed-summary {
  min-width: 160px;
}

.feed-toolbar h2 {
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  text-transform: none;
}

.feed-stats {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.feed-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-control {
  min-height: 30px;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.toggle-control input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.segmented {
  gap: 2px;
}

.segment {
  min-height: 30px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 750;
}

.segment:hover,
.segment.active {
  background: #111827;
  color: #ffffff;
}

.export-button {
  min-height: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  padding: 0 10px;
  white-space: nowrap;
}

.export-button:not(:disabled):hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.filter-hint {
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  padding-top: 8px;
  font-size: 13px;
}

.link-button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
  font-weight: 760;
}

.link-button:hover {
  color: #0b5f59;
}

.feed-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 36px;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  padding: 15px 14px 14px 10px;
}

.feed-item:last-child {
  border-bottom: 1px solid var(--line);
}

.feed-item:hover .item-title {
  color: var(--accent);
}

.score-control {
  align-items: center;
  flex-direction: column;
  gap: 6px;
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
  padding-top: 2px;
}

.rank-number {
  min-width: 34px;
  color: #334155;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9aa3af;
  font-size: 11px;
  font-weight: 850;
}

.icon-button:hover,
.icon-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.score {
  min-width: 32px;
  color: #4b5563;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  text-align: center;
}

.item-main {
  min-width: 0;
}

.item-heading {
  margin: 5px 0 0;
  font-size: 18px;
  line-height: 1.32;
  letter-spacing: 0;
}

.item-title {
  color: #111827;
  font-weight: 820;
}

.item-topline {
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 740;
}

.item-topline .badge {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
}

.item-topline .badge.indigo {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.item-topline .badge.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.why {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin: 8px 0 9px;
  color: #374151;
  font-size: 13.5px;
  line-height: 1.55;
}

.meta {
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.4;
}

.meta span::after {
  margin-left: 6px;
  color: #c0c7cf;
  content: "·";
}

.meta span:last-child::after {
  content: "";
}

.meta .badge {
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-weight: 760;
}

.meta .badge.indigo {
  color: var(--indigo);
}

.meta .badge.amber {
  color: var(--amber);
}

.save-button {
  justify-self: end;
  margin-top: 0;
}

.save-button.active {
  background: var(--amber-soft);
  color: var(--amber);
}

.thread-panel {
  margin-top: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}

.thread-head {
  justify-content: space-between;
  gap: 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 780;
}

.thread-head span:first-child {
  color: #4b5563;
}

.comment-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.comment-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.comment-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 11px;
  font-weight: 900;
}

.comment-body {
  min-width: 0;
  border-left: 3px solid var(--line-soft);
  padding-left: 9px;
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
  color: var(--faint);
  font-size: 12px;
}

.comment-meta strong {
  color: #374151;
}

.comment-body p,
.thread-empty {
  margin: 3px 0 0;
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.comment-actions {
  gap: 8px;
  margin-top: 4px;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.comment-form textarea {
  width: 100%;
  min-height: 42px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-tint);
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}

.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.comment-submit {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  padding: 0 12px;
}

.rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  padding-top: 26px;
}

.panel {
  border-top: 1px solid var(--line-soft);
  padding-top: 13px;
}

.editor-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 7px 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.avatar.alt {
  background: #e6e7ff;
  color: var(--indigo);
}

.avatar.warm {
  background: #fff3d7;
  color: var(--amber);
}

.editor-row strong,
.editor-row span {
  display: block;
}

.editor-row strong {
  font-size: 13px;
}

.editor-row span {
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.mini-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.empty-state {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.submit-dialog {
  width: min(460px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
}

.submit-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
}

.submit-form {
  display: grid;
  gap: 14px;
}

.dialog-head,
.dialog-actions {
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  text-transform: none;
}

.submit-form label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-size: 14px;
  font-weight: 750;
}

.dialog-actions .button {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 12px;
}

.dialog-actions .button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding-inline: 16px;
  }

  .nav-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 13px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  main {
    width: min(100vw - 28px, 980px);
    padding-top: 22px;
  }

  .masthead {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  h1 {
    font-size: 29px;
  }

  .rail {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 560px) {
  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .feed-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .feed-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .filter-hint {
    align-items: flex-start;
    flex-direction: column;
  }

  .feed-item {
    grid-template-columns: 44px minmax(0, 1fr) 28px;
    gap: 10px;
    padding: 13px 10px 12px 8px;
  }

  .rank-number {
    min-width: 28px;
  }

  .why {
    -webkit-line-clamp: 3;
  }

  .item-heading {
    font-size: 16px;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .comment-submit {
    justify-self: start;
  }
}
