:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --line: #DEDBD2;
  --ink: #1B1D21;
  --ink-2: #3A3D44;
  --muted: #5B5E66;
  --favor: #1F5FA8;
  --favor-bg: #F3F7FC;
  --favor-line: #9DB7D8;
  --against: #A04A17;
  --against-bg: #FCF5F0;
  --against-line: #DDB397;
  --stands-bg: #F4F5F9;
  --stands-ink: #353C5C;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--favor); }
a:hover { color: #163F70; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 640px) { .wrap { padding-left: 24px; padding-right: 24px; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.brand-name { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; color: var(--ink); text-decoration: none; }
.brand-tag { font-size: 13px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: #EFEDE6; padding: 4px; border-radius: 10px; }
.tabs[hidden] { display: none; }
.header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.btn-suggest { min-height: 40px; padding: 0 12px; border: 1px dashed #C9C5BA; border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px; cursor: pointer; }
.btn-suggest:hover { background: #EFEDE6; }
.add-country { max-width: 560px; }
.add-debate { max-width: 860px; }
.topic-choice { display: flex; flex-wrap: wrap; gap: 12px; }
.topic-choice > label { flex: 1 1 260px; }
.topic-choice > label[hidden] { display: none; }
.form select { min-height: 44px; padding: 0 10px; border: 1px solid #C9C5BA; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 400; background: #fff; color: var(--ink); }
.two-sides { display: flex; flex-wrap: wrap; gap: 12px; }
.two-sides > label { flex: 1 1 260px; padding: 12px; border-radius: 8px; }
.favor-box { background: var(--favor-bg); border: 1px dashed var(--favor-line); color: var(--favor); }
.against-box { background: var(--against-bg); border: 1px dashed var(--against-line); color: var(--against); }
.start-debate { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.start-debate > .btn { align-self: flex-start; }
.card.pending { border-style: dashed; opacity: .92; }
.waiting { align-self: flex-start; padding: 2px 10px; border-radius: 999px; background: #FFF1CC; color: #6E4F00; font-size: 12px; font-weight: 600; }
.reason.pending > span:first-child { color: var(--ink-2); }
.flash { padding: 12px 16px; border-radius: 8px; background: #E3F1E7; border: 1px solid #B9DCC3; color: #1E5A32; font-size: 14px; }
.flash[hidden] { display: none; }
.pending-note { margin: 0; padding: 10px 14px; border-radius: 8px; background: #FFF9E8; border: 1px solid #EBD58F; color: #6E4F00; font-size: 14px; }

.tab { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.tab[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Main */
.main { padding-top: 32px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 40px; }
.notice { padding: 12px 16px; border-radius: 8px; background: #FFF7E6; border: 1px solid #EBD7A8; color: #6B4E12; font-size: 14px; }
.topic { display: flex; flex-direction: column; gap: 20px; }
.topic-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.topic-head h1 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 32px; font-weight: 600; }
.empty { padding: 24px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }

/* Statement card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card-row { display: flex; flex-wrap: wrap; }
.cell { min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.cell-statement { flex: 1 1 240px; background: var(--surface-2); gap: 8px; }
.cell-side { flex: 1.6 1 300px; border-left: 1px solid var(--line); }
@media (max-width: 860px) { .cell-side { border-left: 0; border-top: 1px solid var(--line); } }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.statement-text { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.35; }
.statement-context { margin: 0; font-size: 13px; color: var(--muted); }
.side-label { font-size: 13px; font-weight: 600; }
.side-favor .side-label { color: var(--favor); }
.side-against .side-label { color: var(--against); }
.reasons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; }
.reason { display: flex; flex-direction: column; gap: 6px; }
.reason-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.no-reasons { font-size: 14px; color: var(--muted); }

/* Tags */
.tag { min-height: 28px; padding: 2px 10px; border: 0; border-radius: 999px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.tag-fallacy    { background: #FBE5E3; color: #8E2620; }
.tag-overclaims { background: #FCE8D6; color: #7A3A0C; }
.tag-evidence   { background: #FFF1CC; color: #6E4F00; }
.tag-value      { background: #E8EAF2; color: #353C5C; }
.tag-strong     { background: #E3F1E7; color: #1E5A32; }
.tag-box { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.tag-box b { font-weight: 600; }

/* Buttons */
.btn { min-height: 44px; padding: 0 18px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn-dark { border: 0; background: var(--ink); color: #fff; }
.btn-dark:disabled { background: #E4E2DC; color: #6A6D74; cursor: wait; }
.btn-plain { border: 1px solid #C9C5BA; background: var(--surface); color: var(--ink); }
.btn-add { align-self: flex-start; min-height: 40px; padding: 0 14px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.side-favor .btn-add { border: 1px dashed var(--favor-line); background: var(--favor-bg); color: var(--favor); }
.side-against .btn-add { border: 1px dashed var(--against-line); background: var(--against-bg); color: var(--against); }
.link-btn { align-self: flex-start; min-height: 36px; padding: 0; border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.side-favor .link-btn { color: var(--favor); }
.side-against .link-btn { color: var(--against); }
.btn-propose { align-self: flex-start; }

/* Where the debate stands */
.stands { border-top: 1px solid var(--line); background: var(--stands-bg); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.stands-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.stands-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--stands-ink); }
.stands-status { padding: 2px 10px; border-radius: 999px; background: var(--surface); border: 1px solid #C9CDDD; color: var(--stands-ink); font-size: 12px; font-weight: 600; }
.stands-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; font-size: 14px; }
.stands-grid div { display: flex; flex-direction: column; gap: 2px; }
.stands-grid span:first-child { font-size: 12px; font-weight: 600; color: var(--muted); }
.stands-basis { font-size: 12px; color: var(--muted); }

/* Forms */
.form { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.form h3 { margin: 0; font-size: 17px; }
.form p { margin: 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.form label .muted { font-weight: 400; }
.form textarea, .form input { width: 100%; padding: 10px 12px; border: 1px solid #C9C5BA; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 400; background: #fff; color: var(--ink); }
.form textarea { resize: vertical; }
.form input { min-height: 44px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-msg { font-size: 14px; }
.form-msg.ok { color: #1E5A32; }
.form-msg.err { color: #8E2620; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-top: 20px; padding-bottom: 40px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* Country page and topics as collapsible rows */
#content { display: flex; flex-direction: column; gap: 20px; }
.country-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.country-head h1 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 36px; font-weight: 600; line-height: 1.15; }
.country-head .sub { margin: 0; font-size: 14px; color: var(--muted); }
.topic-list { display: flex; flex-direction: column; gap: 12px; }

details.topic { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
details.topic[open] { box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.topic-summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 18px 20px; min-height: 64px; }
.topic-summary::-webkit-details-marker { display: none; }
.topic-summary:hover { background: #FBFAF7; }
.topic-summary:focus-visible { outline: 2px solid var(--favor); outline-offset: -2px; }
details.topic[open] > .topic-summary { border-bottom: 1px solid var(--line); background: #FBFAF7; }
.topic-title { margin: 0; flex: 1 1 auto; min-width: 0; font-family: 'Fraunces', Georgia, serif; font-size: 21px; font-weight: 600; line-height: 1.25; }
.topic-count { flex: none; padding: 3px 10px; border-radius: 999px; background: #EFEDE6; color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chev { order: 3; flex: none; width: 9px; height: 9px; margin: 0 4px 4px 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.topic[open] .chev { transform: rotate(-135deg); margin-bottom: -4px; }
.topic-summary .waiting { flex: none; }
.topic-body { display: flex; flex-direction: column; gap: 16px; padding: 20px; background: #F9F8F5; }
.topic-body > .card { box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.topic-body > .empty { margin: 0; }
.topic-body > .btn-propose { align-self: flex-start; }
@media (max-width: 640px) {
  .country-head h1 { font-size: 30px; }
  .topic-summary { padding: 16px; gap: 10px; flex-wrap: wrap; }
  .topic-title { font-size: 19px; flex-basis: calc(100% - 40px); }
  .topic-body { padding: 14px; }
}

/* Empty helper slots shouldn't add spacing */
.main > div:empty { display: none; }
.main { gap: 28px; }

details.topic:not([open]) > .topic-body { display: none; }
details.topic[open] { background: #F9F8F5; }
.topic-summary { background: var(--surface); }

/* Form labels: keep hints like "(optional)" on the same line as the label */
.form label { display: block; }
.form label > input, .form label > textarea, .form label > select { display: block; margin-top: 6px; }
.form label > .muted { font-weight: 400; }
.two-sides > label { display: block; }
details.topic:not([open])::details-content { display: none; }
details.topic { display: flex; flex-direction: column; }
@media (max-width: 640px) { .topic-summary .chev { margin-left: auto; } }

/* ---------- Front page ---------- */
.as-link { display: inline-flex; align-items: center; text-decoration: none; }
.btn-dark.as-link, .btn-dark.as-link:hover { color: #fff; }
.btn-plain.as-link, .btn-plain.as-link:hover { color: var(--ink); }
.hero { padding: 24px 0 8px; display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.hero-kicker { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hero-title { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 48px; font-weight: 600; line-height: 1.08; }
.hero-lead { margin: 0; font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.hero-stats { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; font-size: 15px; color: var(--muted); }
.hero-stats b { color: var(--ink); font-size: 20px; font-weight: 600; }

.home-section { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; border-top: 1px solid var(--line); }
.home-section > h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 28px; font-weight: 600; }
.home-section > p { margin: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps h3 { margin: 0; font-size: 17px; font-weight: 600; }
.steps p { margin: 0; font-size: 14px; color: var(--ink-2); }
.step-n { width: 30px; height: 30px; border-radius: 999px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }

.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.country-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.country-card h3 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; }
.country-card h3 a { color: var(--ink); text-decoration: none; }
.country-card h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.country-card > p { margin: 0; }
.topic-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.topic-links li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 9px 0; border-top: 1px solid #ECEAE4; }
.topic-links a { font-weight: 500; }
.card-link { margin-top: auto; padding-top: 6px; font-size: 14px; font-weight: 600; text-decoration: none; }
.card-link:hover { text-decoration: underline; }

.latest { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.latest a { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.latest a:hover { border-color: #C9C5BA; background: #FFFEFB; }
.latest .crumb { font-size: 13px; color: var(--muted); }
.latest-text { font-size: 17px; font-weight: 600; line-height: 1.35; }
.latest-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-favor, .pill-against { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-favor { background: var(--favor-bg); color: var(--favor); border: 1px solid #D3E0F0; }
.pill-against { background: var(--against-bg); color: var(--against); border: 1px solid #F0D9C8; }

.fair-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; }
.fair-list li { font-size: 15px; color: var(--ink-2); line-height: 1.55; }
.fair-list b { color: var(--ink); }
@media (max-width: 640px) {
  .hero-title { font-size: 34px; }
  .hero-lead { font-size: 16px; }
  .home-section > h2 { font-size: 24px; }
}

/* ---------- Site nav ---------- */
.site-nav { display: flex; gap: 4px; margin-left: 8px; }
.site-nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.site-nav a:hover { background: #EFEDE6; color: var(--ink); }
.site-nav a[aria-current="page"] { background: #EFEDE6; color: var(--ink); }
.home-about p { margin: 0; color: var(--ink-2); }

/* ---------- About ---------- */
.about { max-width: 820px; display: flex; flex-direction: column; gap: 32px; }
.about-head { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; }
.about-title { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 44px; font-weight: 600; line-height: 1.1; }
.about-section { display: flex; flex-direction: column; gap: 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.about-section h2 { margin: 0; font-family: 'Fraunces', Georgia, serif; font-size: 26px; font-weight: 600; }
.about-section > p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); }
.about-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.about-list li { font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.about-list b { color: var(--ink); }
.about-cta { padding-top: 8px; }
@media (max-width: 640px) { .about-title { font-size: 34px; } .site-nav { margin-left: 0; } }

/* AI tone-check warning inside forms */
.ai-warn { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 10px; background: #FFF9E8; border: 1px solid #EBD58F; color: var(--ink); }
.ai-warn-title { font-weight: 600; color: #6E4F00; }
.ai-warn-row { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid #F1E3B5; font-size: 14px; }
.ai-warn-row:first-of-type { border-top: 0; padding-top: 0; }
.ai-suggest { padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid #F1E3B5; }
.ai-warn .btn-small { align-self: flex-start; min-height: 34px; padding: 0 12px; border: 1px solid #C9C5BA; border-radius: 6px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.ai-warn p { margin: 0; }

/* About: notes, fallacies, sources, disclaimer */
.note-defs, .fallacy-list { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.note-def, .fallacy { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 6px 16px; align-items: baseline; padding: 10px 0; border-top: 1px solid #ECEAE4; }
.note-def dt, .fallacy dt { margin: 0; font-weight: 600; }
.note-def dd, .fallacy dd { margin: 0; color: var(--ink-2); line-height: 1.55; }
.note-def .tag { cursor: default; }
@media (max-width: 640px) { .note-def, .fallacy { grid-template-columns: 1fr; } }
.sources { padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.sources-title { margin: 0 0 8px; font-weight: 600; }
.sources ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.footer-disclaimer { flex-basis: 100%; margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; max-width: 820px; }
.about-section { scroll-margin-top: 16px; }

.instructions { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.instructions summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
.instructions pre { margin: 0; padding: 0 16px 16px; white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

.hero-topics { margin: 0; font-size: 15px; color: var(--muted); }

/* Follow (browser only) */
.follow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.follow-btn { min-height: 34px; padding: 0 12px; border: 1px solid #C9C5BA; border-radius: 999px; background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.follow-btn:hover { border-color: var(--ink-2); }
.follow-btn.is-on { background: #FFF6DA; border-color: #E3C77A; color: #6E4F00; }
.news-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #E3F1E7; color: #1E5A32; font-size: 12px; font-weight: 600; }
.new-pill { padding: 0 7px; border-radius: 999px; background: #1E5A32; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; }
.reason.is-new > span:first-child { background: #F2F9F4; box-shadow: 0 0 0 4px #F2F9F4; border-radius: 4px; }
.following-list .news-badge { align-self: flex-start; }
.topic-summary .news-badge { flex: none; }
.site-nav a[hidden] { display: none; }
