:root {
  color-scheme: dark;
  --bg: #090a0c;
  --panel: #111317;
  --panel-soft: #15171b;
  --line: #292d34;
  --text: #f5f7fa;
  --muted: #9298a3;
  --blue: #5d9dff;
  --blue-soft: #152844;
  --red: #ff646b;
  --red-soft: #3a1c22;
  --yellow: #f1d64b;
  --radius: 20px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Noto Sans TC", sans-serif;
  line-height: 1.5;
}

.is-localizing .shell { visibility: hidden; }

.legal-shell { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 72px; }
.legal-shell > .brand { margin-bottom: 72px; }
.legal-shell h1 { margin-bottom: 12px; font-size: clamp(42px, 7vw, 72px); }
.legal-shell section { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.legal-shell section h2 { font-size: 24px; }
.legal-shell section p { color: #d9dde4; }
.legal-shell a:not(.brand) { color: var(--yellow); }

button, select { font: inherit; }

a { color: inherit; }

.shell {
  width: min(1360px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.topbar, .topic-head, .section-heading, .post-meta, .post-footer, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { gap: 24px; padding-bottom: 42px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.language-switch { display: inline-flex; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel); }
.language-link { border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: 11px; font-weight: 750; text-decoration: none; transition: .2s ease; }
.language-link:hover, .language-link.is-active { background: var(--text); color: var(--bg); }
.language-link[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--text);
  color: var(--bg);
  font-size: 18px;
  font-weight: 900;
}

.brand-dot { color: var(--yellow); }

.topbar-meta, .muted { color: var(--muted); font-size: 13px; }
.topbar-meta { display: inline-flex; align-items: center; gap: 8px; }
.live-dot, .side-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #43d798; }
.topbar-meta .live-dot { background: var(--yellow); }

.intro { max-width: 700px; padding: 24px 0 38px; }
.eyebrow { margin: 0 0 10px; color: var(--yellow); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(44px, 7vw, 88px); line-height: .98; letter-spacing: -.075em; }
h2 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 38px); line-height: 1.1; letter-spacing: -.055em; }
h3 { margin: 5px 0 0; font-size: clamp(23px, 2.4vw, 32px); line-height: 1.1; letter-spacing: -.055em; }
.intro-copy { max-width: 540px; margin-bottom: 0; color: var(--muted); font-size: 17px; }

.topic-nav { overflow-x: auto; padding: 0 0 34px; }
.topic-list { display: flex; min-width: max-content; gap: 10px; }
.topic-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: .2s ease;
}
.topic-chip:hover, .topic-chip.is-selected { border-color: var(--text); color: var(--text); background: var(--panel-soft); }
.topic-loading { padding: 10px 0; color: var(--muted); font-size: 13px; }

.topic-head { align-items: flex-start; gap: 24px; border-top: 1px solid var(--line); padding: 30px 0 24px; }
.topic-heading-copy { min-width: 0; }
.topic-head .eyebrow { color: var(--muted); }
.topic-head h2 { margin-bottom: 8px; }
.topic-controls { display: flex; flex: none; align-items: center; gap: 10px; }
.observation-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.observation-badge, .language-verification { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--muted); font-size: 10px; font-weight: 750; }
.observation-badge { border-color: #4d4828; background: #17160f; color: #e8d866; }
.language-verification.is-verified { border-color: #315843; background: #102019; color: #8dd8b1; }
.window-control { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.window-control select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel); color: var(--text); }
.refresh-button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; background: var(--panel-soft); color: var(--text); cursor: pointer; }
.refresh-button:hover { border-color: var(--text); }

.alert { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel); color: var(--muted); font-size: 13px; }
.threads-auth { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0 0 18px; border: 1px solid #625a2c; border-radius: 16px; padding: 20px; background: #191812; }
.threads-auth[hidden] { display: none; }
.threads-auth h2 { margin-bottom: 8px; font-size: clamp(20px, 2.4vw, 28px); }
.threads-auth p:last-child { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.threads-auth-actions { display: flex; flex: none; gap: 8px; }
.auth-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid var(--yellow); border-radius: 12px; padding: 10px 16px; background: var(--yellow); color: var(--bg); font-weight: 800; text-decoration: none; }
.auth-button[hidden] { display: none; }
.auth-button-secondary { border-color: var(--line); background: transparent; color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; background: var(--panel); }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 4px; font-size: 24px; letter-spacing: -.04em; }
.quality-note { margin: -2px 0 18px; color: var(--muted); font-size: 12px; }
.stat-status { background: #101216; }
.ratio-panel { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--panel); }
.ratio-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.ratio-side { display: flex; align-items: baseline; gap: 9px; color: var(--muted); font-size: 12px; }
.ratio-side strong { color: var(--text); font-size: 22px; letter-spacing: -.04em; }
.ratio-side-b { justify-content: flex-end; text-align: right; }
.ratio-track { display: flex; height: 10px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: var(--line); }
.ratio-bar { width: 0; transition: width .25s ease; }
.ratio-bar-a { background: var(--blue); }
.ratio-bar-b { background: var(--red); }
.ratio-track.is-empty .ratio-bar { width: 0 !important; }
.ratio-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.observation-summary { margin: 18px 0 0; border: 1px solid #3b414a; border-radius: var(--radius); padding: 24px; background: linear-gradient(135deg, #171a20, var(--panel) 62%); }
.observation-summary[hidden] { display: none; }
.observation-summary h2 { max-width: 760px; font-size: clamp(23px, 3vw, 34px); }
.observation-summary-text { max-width: 920px; margin: 14px 0 0; color: #dfe3ea; font-size: 15px; line-height: 1.75; white-space: pre-wrap; }
.collection-audit { margin: -4px 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); font-size: 12px; }
.collection-audit summary { padding: 12px 14px; color: var(--text); cursor: pointer; }
.collection-audit summary span { margin-left: 8px; color: var(--muted); }
.collection-audit > div { border-top: 1px solid var(--line); padding: 14px; }
.collection-audit p { margin-bottom: 12px; }
.collection-audit h4 { margin: 14px 0 6px; color: var(--text); font-size: 12px; }
.collection-audit ul { margin: 0; padding-left: 20px; }
.collection-audit code { color: var(--yellow); }
.system-audit { margin-top: 0; }
.system-audit ul { display: grid; gap: 7px; }
.system-audit strong { color: var(--text); }
.audit-posts { display: grid; gap: 8px; padding-left: 0 !important; list-style: none; }
.audit-post { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel-soft); }
.audit-post p { margin: 8px 0; color: var(--text); white-space: pre-wrap; }
.audit-post small { color: var(--muted); }

.participation-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 28px 0 18px;
  border: 1px solid #514b28;
  border-radius: 16px;
  padding: 20px;
  background: linear-gradient(120deg, #181711, var(--panel));
}
.arguments-intro { margin-top: 36px; }
.section-copy { max-width: 620px; margin-bottom: 0; text-align: right; }
.participation-strip h2 { margin-bottom: 8px; font-size: clamp(21px, 2.3vw, 30px); }
.participation-strip p:not(.eyebrow, .contribution-feedback) { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.participation-status { display: grid; min-width: min(380px, 100%); gap: 8px; }
.seed-summary { display: grid; gap: 3px; border: 1px solid #4e492a; border-radius: 10px; padding: 10px 12px; background: #11120f; }
.seed-summary span { color: var(--yellow); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.seed-summary strong { color: #e6e2c8; font-size: 12px; font-weight: 650; }
.contribution-feedback { max-width: 380px; margin: 0; border: 1px solid #35634f; border-radius: 10px; padding: 10px 12px; background: #10241c; color: #9ee5c3; font-size: 12px; }

.walls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.wall { min-height: 470px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.wall.is-empty { min-height: 0; }
.wall-a { box-shadow: inset 0 3px 0 var(--blue); }
.wall-b { box-shadow: inset 0 3px 0 var(--red); }
.wall-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 26px 24px 18px; }
.side-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.wall-a .side-dot { background: var(--blue); }
.wall-b .side-dot { background: var(--red); }
.wall-count { color: var(--muted); font-size: 12px; }
.wall-definition { min-height: 45px; margin: 0; padding: 0 24px 18px; color: var(--muted); font-size: 13px; }
.wall-participation { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 16px; }
.contribute-button { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; background: transparent; color: var(--text); font-weight: 750; cursor: pointer; transition: .2s ease; }
.contribute-a:hover { border-color: var(--blue); background: var(--blue-soft); color: #acd0ff; }
.contribute-b:hover { border-color: var(--red); background: var(--red-soft); color: #ffb0b4; }
.post-stack { display: grid; gap: 10px; padding: 16px; }
.post-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--panel-soft); }
.post-a { border-color: #294b78; }
.post-b { border-color: #713137; }
.post-meta { gap: 12px; color: var(--muted); font-size: 11px; }
.post-card p { margin: 13px 0 14px; color: #e2e6ec; font-size: 14px; white-space: pre-wrap; }
.classification-chip { display: inline-flex; margin-top: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; color: var(--muted); font-size: 10px; font-weight: 800; }
.classification-mixed { border-color: #665c31; color: #eadc75; }
.classification-unclear { border-color: #4a4f58; color: #bec4ce; }
.classification-irrelevant { border-color: #693339; color: #ff9da2; }
.post-footer { justify-content: flex-end; }
.post-footer span { color: var(--muted); font-size: 11px; }
.post-footer a { color: var(--muted); font-size: 11px; text-decoration: none; }
.post-footer a:hover { color: var(--text); }
.argument-card p { font-size: 16px; font-weight: 700; }
.contribution-card { background: #18191d; box-shadow: inset 3px 0 0 var(--yellow); }
.contribution-badge { color: var(--yellow); font-weight: 800; }
.editorial-seed-card, .contribution-card { padding: 11px; background: #141619; }
.editorial-seed-badge { color: #d8c65e; font-weight: 800; }
.threads-source-frame { overflow: hidden; border: 1px solid #34373e; border-radius: 12px; background: #08090b; }
.source-frame-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #2d3036; padding: 9px 11px; background: #101115; }
.source-frame-heading span { color: var(--text); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.source-frame-heading small { color: var(--muted); font-size: 9px; }
.threads-embed-shell { display: grid; min-height: 132px; padding: 8px; place-items: center; }
.threads-embed-shell iframe { width: 100% !important; max-width: 100% !important; margin: 0 auto !important; border-radius: 10px !important; }
.threads-embed-shell .threads-embed-placeholder { width: 100% !important; min-width: 0 !important; max-width: 100% !important; margin: 0 !important; border: 0 !important; background: transparent !important; }
.threads-embed-fallback { display: grid; min-height: 116px; place-content: center; gap: 7px; padding: 20px; color: var(--text); text-align: center; text-decoration: none; }
.threads-embed-fallback span, .threads-embed-fallback small { color: var(--muted); font-size: 10px; }
.threads-embed-fallback strong { font-size: 13px; }
.dotch-analysis { margin-top: 10px; border: 1px solid #3b3d45; border-radius: 11px; padding: 13px; background: #191a1f; }
.post-a .dotch-analysis { border-color: #294b78; background: linear-gradient(135deg, rgb(42 81 135 / .17), #17191e 46%); }
.post-b .dotch-analysis { border-color: #713137; background: linear-gradient(135deg, rgb(139 48 58 / .17), #191719 46%); }
.analysis-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.analysis-heading span { color: var(--yellow); font-size: 10px; font-weight: 850; letter-spacing: .12em; }
.analysis-heading small { color: var(--muted); font-size: 9px; }
.post-card .analysis-copy { margin: 10px 0 11px; color: #e5e7ec; font-size: 13px; line-height: 1.65; }
.seed-reason { display: flex; align-items: baseline; gap: 9px; margin: 0; border-top: 1px solid #30323a; padding-top: 10px; color: var(--muted); font-size: 10px; }
.seed-reason span { flex: none; color: var(--muted); }
.seed-reason strong { color: #c7cad1; font-weight: 650; }
.contribution-footer { gap: 12px; justify-content: space-between; }
.empty-state { margin: 16px; border: 1px dashed var(--line); border-radius: 14px; padding: 32px 20px; color: var(--muted); font-size: 13px; text-align: center; }
.wall.is-empty .empty-state { display: grid; min-height: 132px; place-items: center; line-height: 1.7; }

.unclassified-section, .timeline-section, .history-section { margin-top: 64px; }
.section-heading { align-items: flex-end; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 0; }
.unclassified-copy { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.unclassified-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.unclassified-list .post-card { min-height: 170px; }
.unclassified-toggle { display: block; width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 11px; padding: 11px 14px; background: var(--panel-soft); color: var(--text); font-weight: 750; cursor: pointer; }
.unclassified-toggle:hover { border-color: var(--text); }

.timeline { display: flex; align-items: end; gap: 8px; min-height: 180px; border-bottom: 1px solid var(--line); padding: 20px 10px 0; overflow-x: auto; }
.timeline-item { display: flex; min-width: 48px; height: 150px; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 10px; }
.timeline-bar { display: flex; width: 28px; min-height: 8px; align-items: flex-start; justify-content: center; border-radius: 7px 7px 2px 2px; background: var(--yellow); color: var(--bg); transition: height .25s ease; }
.timeline-bar span { padding-top: 4px; font-size: 10px; font-weight: 800; }

.history-snapshots { display: flex; gap: 12px; overflow-x: auto; padding: 2px 0 10px; }
.history-snapshot { min-width: 210px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--panel); }
.history-snapshot header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.history-snapshot time { color: var(--text); font-size: 12px; font-weight: 700; }
.history-volume { color: var(--muted); font-size: 11px; text-align: right; }
.history-volume strong { display: block; color: var(--yellow); font-size: 20px; line-height: 1; }
.history-ratio { display: flex; height: 8px; margin: 14px 0 8px; overflow: hidden; border-radius: 999px; background: var(--line); }
.history-ratio-a { background: var(--blue); }
.history-ratio-b { background: var(--red); }
.history-ratio.is-empty span { width: 0 !important; }
.history-ratio-labels { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.history-ratio-labels strong { color: var(--text); }
.history-status { margin: 10px 0 0; color: var(--muted); font-size: 10px; }

.methodology-section { margin-top: 64px; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; background: var(--panel); }
.methodology-section h2 { font-size: clamp(24px, 3vw, 34px); }
.methodology-section p:not(.eyebrow) { max-width: 920px; color: var(--muted); font-size: 13px; }
.methodology-section .disclaimer { margin: 20px 0 0; border-top: 1px solid var(--line); padding-top: 18px; color: var(--text); font-weight: 750; }
.footer { margin-top: 70px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--muted); font-size: 11px; }

.contribution-dialog {
  width: min(620px, calc(100% - 28px));
  border: 1px solid #3b3f47;
  border-radius: 22px;
  padding: 24px;
  background: #111317;
  color: var(--text);
  box-shadow: 0 24px 90px rgb(0 0 0 / .72);
}
.contribution-dialog::backdrop { background: rgb(0 0 0 / .76); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog-heading h2 { margin-bottom: 8px; font-size: clamp(25px, 4vw, 36px); }
.dialog-side-label { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.dialog-close { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.dialog-close:hover { border-color: var(--text); color: var(--text); }
.contribution-dialog form { display: grid; gap: 18px; margin-top: 24px; }
.form-field { display: grid; gap: 8px; color: var(--text); font-size: 13px; font-weight: 750; }
.form-field input, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; outline: none; background: #0c0d10; color: var(--text); font: inherit; font-weight: 400; }
.form-field textarea { resize: vertical; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgb(241 214 75 / .1); }
.form-field small, .local-preview-note { color: var(--muted); font-size: 11px; font-weight: 400; }
.form-field small { display: flex; justify-content: space-between; }
.form-error { margin: 0; border: 1px solid #713137; border-radius: 10px; padding: 10px 12px; background: var(--red-soft); color: #ffc1c4; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.intent-button, .submit-contribution { border-radius: 11px; padding: 12px 15px; font-weight: 800; cursor: pointer; }
.intent-button { border: 1px solid var(--line); background: transparent; color: var(--text); }
.submit-contribution { border: 1px solid var(--yellow); background: var(--yellow); color: var(--bg); }
.intent-button:hover { border-color: var(--text); }
.submit-contribution:hover { filter: brightness(1.08); }
.local-preview-note { margin: -6px 0 0; line-height: 1.6; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 1360px); padding-top: 18px; }
  .topbar { align-items: flex-start; padding-bottom: 26px; }
  .topbar-actions { align-items: flex-end; flex-direction: column; gap: 8px; }
  .language-link { padding: 5px 8px; font-size: 10px; }
  .topbar-meta { display: none; }
  .intro { padding: 18px 0 30px; }
  .intro-copy { font-size: 15px; }
  .topic-head { display: block; }
  .topic-controls { display: block; }
  .window-control { justify-content: space-between; margin-top: 18px; }
  .refresh-button { width: 100%; margin-top: 10px; }
  .threads-auth { align-items: stretch; flex-direction: column; }
  .threads-auth-actions, .auth-button { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .arguments-intro { align-items: flex-start; flex-direction: column; }
  .section-copy { text-align: left; }
  .participation-strip { align-items: stretch; flex-direction: column; }
  .walls { grid-template-columns: 1fr; }
  .wall { min-height: 300px; }
  .unclassified-list { grid-template-columns: 1fr; }
  .contribution-dialog { padding: 20px; }
  .dialog-actions { flex-direction: column-reverse; }
  .intent-button, .submit-contribution { width: 100%; }
  .contribution-footer { align-items: flex-start; flex-direction: column; }
  .footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}
