/* ============================================================
   HANDSHAKE — editorial / warm-paper aesthetic
   Cream paper · clay accent · literary serif · flat & hairline
   ============================================================ */

:root {
  --paper:   #F3F1E9;   /* warm ivory ground */
  --paper-2: #FBFAF5;   /* card / entry */
  --paper-3: #ECE9DD;   /* sunk panels */
  --ink:     #211F1A;   /* warm near-black */
  --ink-2:   #54514A;   /* secondary text */
  --ink-3:   #817D6E;   /* faint / meta (nudged darker for legibility) */
  --line:    #DCD7C7;   /* hairline */
  --line-2:  #CBC5B2;   /* stronger rule */
  --clay:    #C2674A;   /* primary accent (Anthropic clay) */
  --clay-2:  #A8543B;   /* deep clay */
  --clay-wash:#F0E2D7;  /* clay tint background */
  --sage:    #6E7B63;   /* calm secondary */

  --serif: "Fraunces", "Hoefler Text", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Apple SD Gothic Neo", "PingFang SC",
          "Helvetica Neue", Arial, sans-serif;

  --maxw: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint printed-paper grain (anti-"AI gloss") */
.paper-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}
body > *:not(.paper-grain) { position: relative; z-index: 1; }

button { font-family: inherit; cursor: pointer; color: inherit; }
::selection { background: var(--clay-wash); }
a { color: var(--clay-2); }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 14px;
}

/* ===== MASTHEAD ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--paper); }
.mast {
  max-width: var(--maxw); margin: 0 auto;
  padding: 16px 28px 12px;
  display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap;
}
.brand-name {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.4rem, 4.4vw, 3.5rem); line-height: 0.9; letter-spacing: 0.005em;
  text-transform: uppercase; color: var(--ink);
}
.brand-tag {
  margin: 8px 0 0; font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; letter-spacing: 0.01em; color: var(--ink-2); font-weight: 400;
}
.mast-tools { margin-left: auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.lang-wrap {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 10px; background: var(--paper-2);
}
.lang-wrap:focus-within { border-color: var(--clay); }
.globe { font-size: 0.9rem; }
.lang-select {
  border: none; background: transparent; font-family: var(--sans);
  font-size: 0.84rem; font-weight: 600; color: var(--ink); cursor: pointer;
  padding-right: 2px; max-width: 140px;
}
.lang-select:focus { outline: none; }

.hs-stat { text-align: right; line-height: 1.1; }
.hs-num { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; color: var(--clay-2); font-variant-numeric: tabular-nums; display: block; }
.hs-lbl { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }

.btn-primary {
  border: 1px solid var(--clay-2);
  background: var(--clay); color: #FBF7F0;
  border-radius: 9px; padding: 10px 18px;
  font-weight: 600; font-size: 0.9rem; letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.12s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--clay-2); transform: translateY(-1px); }
.btn-primary:active { transform: none; }

/* masthead double rule */
.mast-rule { max-width: var(--maxw); margin: 0 auto; height: 4px; position: relative; }
.mast-rule::before { content: ""; position: absolute; left: 28px; right: 28px; top: 0; border-top: 1.5px solid var(--ink); }
.mast-rule::after  { content: ""; position: absolute; left: 28px; right: 28px; top: 4px; border-top: 1px solid var(--ink); opacity: 0.45; }

/* ===== EYE-CATCH / HERO ===== */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 24px 28px 2px; }
.hero-figure { margin: 0; }
.hero-img {
  display: block; width: 100%; height: clamp(180px, 25vw, 300px);
  object-fit: cover; object-position: center 42%;
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--paper-3);
}
.hero-cap {
  margin: 16px 2px 0; max-width: 76ch; font-family: var(--serif);
  font-size: 1.02rem; color: var(--ink-2); line-height: 1.72;
  word-break: auto-phrase; /* CJK: break at phrase boundaries, not mid-word */
}
.hero-cap[dir="rtl"], [dir="rtl"] .hero-cap { margin-left: auto; }

/* ===== LAYOUT ===== */
.layout {
  max-width: var(--maxw); margin: 0 auto;
  padding: 28px 28px 64px;
  display: grid; grid-template-columns: 218px minmax(0, 1fr) 296px;
  gap: 36px; align-items: start;
}
.col-left, .col-right { position: sticky; top: 118px; display: flex; flex-direction: column; gap: 30px; }

/* ===== LEFT: index of conflicts ===== */
.topic-list { display: flex; flex-direction: column; }
.topic-group-label {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--clay-2); padding: 16px 0 7px; margin-top: 4px;
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.topic-group-label:first-child { margin-top: 0; }
.topic-item {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  border: none; background: transparent; text-align: left;
  padding: 6px 2px; color: var(--ink-2);
  font-size: 0.875rem; font-weight: 500; line-height: 1.35;
  border-left: 2px solid transparent; padding-left: 8px;
  transition: color 0.14s, border-color 0.14s;
}
.topic-item:hover { color: var(--ink); border-left-color: var(--line-2); }
.topic-item.active { color: var(--clay-2); font-weight: 600; border-left-color: var(--clay); }
.topic-item .t-flags { font-size: 0.92rem; }
.topic-item .t-name { flex: 1; min-width: 0; }
.topic-item .t-count { font-size: 0.72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.topic-item.active .t-count { color: var(--clay); }

/* ===== MOBILE TOPICS ===== */
.mobile-topics { display: none; gap: 8px; overflow-x: auto; padding: 2px 0 16px; scrollbar-width: none; }
.mobile-topics::-webkit-scrollbar { display: none; }
.mtopic {
  flex-shrink: 0; border: 1px solid var(--line-2); background: var(--paper-2);
  border-radius: 8px; padding: 7px 13px; font-size: 0.8rem; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.mtopic.active { background: var(--clay); color: #FBF7F0; border-color: var(--clay-2); }

/* ===== COMPOSER ===== */
.composer { border: 1px solid var(--line-2); border-radius: 6px; background: var(--paper-2); padding: 16px 18px; margin-bottom: 22px; }
.composer-top { display: flex; gap: 13px; align-items: flex-start; }
.avatar {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; color: #FBF7F0;
  font-family: var(--serif); font-weight: 600; font-size: 0.95rem;
  background: var(--sage);
}
#composerText {
  flex: 1; border: none; background: transparent; resize: none;
  font-family: var(--serif); font-size: 1.1rem; line-height: 1.55; color: var(--ink);
  padding: 8px 2px; min-height: 46px;
}
#composerText:focus { outline: none; }
#composerText::placeholder { color: var(--ink-3); font-style: italic; }
.composer-bottom {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
}
.composer-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; flex-wrap: wrap; }
.topic-select {
  border: 1px solid var(--line-2); background: var(--paper); border-radius: 8px;
  padding: 7px 12px; font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  color: var(--clay-2); max-width: 100%;
}
.topic-select:focus { outline: 2px solid var(--clay-wash); }
.composer-lang { font-size: 0.74rem; color: var(--ink-3); font-style: italic; }
.composer-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.char-count { font-size: 0.72rem; color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.char-count.warn { color: var(--clay); }

/* civility guard — the one house rule, surfaced gently */
.composer.invalid { border-color: var(--clay); }
.composer-alert {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 9px 12px;
  border: 1px solid var(--clay); border-radius: 7px;
  background: var(--clay-wash); color: var(--clay-2);
  font-size: 0.82rem; line-height: 1.45; font-weight: 500;
}
.composer-alert[hidden] { display: none; }
.composer-alert .ca-icon { font-size: 0.95rem; flex-shrink: 0; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; background: var(--clay); }
.composer.shake { animation: shake 0.4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* name + text fields */
.composer-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.composer-name {
  border: none; background: transparent; font-family: var(--sans);
  font-size: 0.82rem; font-weight: 600; color: var(--clay-2);
  padding: 4px 2px 5px; border-bottom: 1px solid var(--line);
}
.composer-name:focus { outline: none; border-bottom-color: var(--clay); }
.composer-name::placeholder { color: var(--ink-3); font-weight: 500; font-style: italic; }
.reply-name {
  width: 100%; border: none; background: transparent; font-family: var(--sans);
  font-size: 0.78rem; font-weight: 600; color: var(--clay-2);
  padding: 2px 2px 5px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.reply-name:focus { outline: none; border-bottom-color: var(--clay); }
.reply-name::placeholder { color: var(--ink-3); font-weight: 500; font-style: italic; }

/* ===== FEED CONTROLS ===== */
.feed-controls { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.sort-tabs { display: flex; gap: 18px; }
.sort-tab {
  border: none; background: transparent; padding: 0 0 3px; font-size: 0.86rem; font-weight: 600;
  color: var(--ink-3); border-bottom: 2px solid transparent; transition: color 0.14s, border-color 0.14s;
}
.sort-tab:hover { color: var(--ink-2); }
.sort-tab.active { color: var(--ink); border-bottom-color: var(--clay); }
.active-topic-label { font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--ink-2); }

/* ===== FEED / ENTRIES ===== */
.feed { display: flex; flex-direction: column; gap: 18px; }
.entry {
  border: 1px solid var(--line); border-radius: 5px; background: var(--paper-2);
  padding: 20px 22px; transition: border-color 0.16s, box-shadow 0.16s;
  animation: rise 0.4s ease both;
}
.entry:hover { border-color: var(--line-2); box-shadow: 0 2px 16px -12px rgba(33,31,26,0.4); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.entry-head { display: flex; align-items: flex-start; gap: 13px; }
.entry-head .avatar { width: 44px; height: 44px; }
.entry-meta { flex: 1; min-width: 0; }
.entry-author { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.3; }
.author-name { font-family: var(--serif); font-weight: 600; font-size: 1.04rem; color: var(--ink); }
.author-country { font-size: 1rem; }
.entry-time { font-size: 0.78rem; color: var(--ink-3); }
.entry-topic { display: inline-block; margin-top: 3px; font-size: 0.74rem; font-weight: 600; color: var(--clay-2); letter-spacing: 0.01em; }
.hot-badge {
  align-self: flex-start; font-family: var(--sans);
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--clay-2); border: 1px solid var(--clay); border-radius: 999px; padding: 2px 9px;
  white-space: nowrap;
}

.entry-body { margin: 14px 1px 8px; font-family: var(--serif); font-size: 1.16rem; line-height: 1.66; color: #2b2820; }
.entry-body[dir="rtl"] { text-align: right; }

.translation-note { font-size: 0.76rem; color: var(--ink-3); margin: 0 1px 14px; }
.translation-note .tn-toggle { color: var(--clay-2); font-weight: 600; cursor: pointer; border: none; background: none; padding: 0; font-size: 0.76rem; }
.translation-note .tn-toggle:hover { text-decoration: underline; }
.translation-note.pending { font-style: italic; opacity: 0.7; }

.entry-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.reaction {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; border-radius: 7px;
  padding: 6px 9px; font-size: 0.84rem; font-weight: 500; color: var(--ink-2);
  transition: background 0.14s, color 0.14s;
}
.reaction .r-emoji { font-size: 0.95rem; }
.reaction .r-count { font-variant-numeric: tabular-nums; }
.reaction:hover { background: var(--clay-wash); color: var(--ink); }
.reaction.active { color: var(--clay-2); font-weight: 700; }
.reaction.reply { margin-left: auto; }
.reaction.bounce { animation: pop 0.38s; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

.entry-share { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.share-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.share-btn {
  height: 28px; min-width: 28px; padding: 0 7px; border-radius: 7px;
  border: 1px solid var(--line-2); background: transparent;
  display: inline-grid; place-items: center; font-size: 0.78rem; font-weight: 700; color: var(--ink-2);
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.share-btn:hover { border-color: var(--clay); color: var(--clay-2); background: var(--paper-2); }
.share-btn.copy { gap: 5px; font-size: 0.74rem; font-weight: 600; }

/* empty state */
.empty-state { border: 1px dashed var(--line-2); border-radius: 6px; text-align: center; padding: 46px 22px; }
.empty-state .em { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); }
.empty-state p { margin: 0; font-size: 0.9rem; color: var(--ink-2); }

/* ===== RIGHT BLOCKS ===== */
.trending-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.trend-item {
  display: flex; align-items: baseline; gap: 11px; width: 100%;
  border: none; background: transparent; text-align: left;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  transition: padding-left 0.14s;
}
.trend-item:last-child { border-bottom: none; }
.trend-item:hover { padding-left: 4px; }
.trend-rank { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; color: var(--clay); width: 22px; flex-shrink: 0; }
.trend-body { flex: 1; min-width: 0; }
.trend-name { font-size: 0.86rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-meta { font-size: 0.74rem; color: var(--ink-3); }

/* pledge */
.pledge-block { border-left: 3px solid var(--clay); padding-left: 18px; }
.pledge-title { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.15rem; color: var(--ink); margin: 0 0 12px; }
.pledge-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.pledge-list li { position: relative; padding-left: 16px; font-size: 0.86rem; line-height: 1.5; color: var(--ink-2); }
.pledge-list li::before { content: "—"; position: absolute; left: 0; color: var(--clay); }
.pledge-note { margin: 0; font-size: 0.82rem; font-style: italic; line-height: 1.55; color: var(--ink-3); font-family: var(--serif); }

/* stats */
.stats-block .eyebrow { margin-bottom: 8px; }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: none; }
.sr-label { font-size: 0.82rem; color: var(--ink-2); }
.sr-value { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ===== FOOTER ===== */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 16px 28px 56px; text-align: center; }
.footer-rule { border-top: 1px solid var(--line-2); margin-bottom: 18px; }
.footer-line { margin: 0 0 6px; font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--ink-2); }
.footer-mini { margin: 0; font-size: 0.74rem; color: var(--ink-3); }
.footer-admin { margin: 10px 0 0; }
.footer-admin a { font-size: 0.72rem; color: var(--ink-3); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.footer-admin a:hover { color: var(--clay-2); }

/* ===== STATIC DIRECTORY (SEO / AIO crawlable content) ===== */
.static-index { max-width: var(--maxw); margin: 0 auto; padding: 8px 28px 64px; border-top: 1px solid var(--line); }
.si-inner { max-width: 90ch; }
.si-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 2.4vw, 1.7rem); color: var(--ink); margin: 30px 0 12px; letter-spacing: 0.005em; }
.si-mission { font-family: var(--serif); font-size: 1.02rem; line-height: 1.72; color: var(--ink-2); margin: 0 0 6px; word-break: auto-phrase; }
.si-h { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--clay-2); margin: 26px 0 8px; }
.static-index p { font-size: 0.92rem; line-height: 1.65; color: var(--ink-2); margin: 0 0 6px; max-width: 76ch; }
.si-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 28px; margin-top: 6px; }
.si-group h3 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1rem; color: var(--ink); margin: 10px 0 6px; }
.si-group ul { list-style: none; margin: 0 0 8px; padding: 0; }
.si-group li { padding: 2px 0; font-size: 0.88rem; line-height: 1.4; }
.si-group a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid transparent; }
.si-group a:hover { color: var(--clay-2); border-bottom-color: var(--line-2); }
.si-langs { font-size: 0.86rem; color: var(--ink-3); }
@media (max-width: 860px) { .static-index { padding: 8px 18px 50px; } }

/* ===== TOAST ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 11px 20px; border-radius: 9px;
  font-size: 0.85rem; font-weight: 500; box-shadow: 0 12px 30px -12px rgba(33,31,26,0.6);
  opacity: 0; pointer-events: none; z-index: 100; transition: opacity 0.22s, transform 0.22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== THREAD INDEX (categories as big threads) ===== */
.thread-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.index-intro { grid-column: 1 / -1; margin-bottom: 4px; }
.index-title { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 3vw, 2rem); color: var(--ink); letter-spacing: 0.005em; }
.index-sub { margin: 0; font-size: 0.92rem; color: var(--ink-2); max-width: 60ch; line-height: 1.55; }
.thread-card {
  display: flex; flex-direction: column; gap: 7px; text-align: left;
  border: 1px solid var(--line); border-radius: 6px; background: var(--paper-2);
  padding: 18px 20px; transition: border-color 0.16s, box-shadow 0.16s, transform 0.12s;
}
.thread-card:hover { border-color: var(--clay); box-shadow: 0 6px 22px -16px rgba(33,31,26,0.5); transform: translateY(-2px); }
.tc-top { display: flex; align-items: baseline; gap: 9px; }
.tc-flags { font-size: 1.2rem; flex-shrink: 0; }
.tc-name { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; color: var(--ink); line-height: 1.25; }
.tc-group { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.tc-prompt { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--clay-2); line-height: 1.4; }
.tc-preview { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink-2); line-height: 1.5; }
.tc-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.tc-meta { font-size: 0.74rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tc-enter { font-size: 0.78rem; font-weight: 700; color: var(--clay-2); white-space: nowrap; }

/* ===== THREAD HEADER (inside an open thread) ===== */
.thread-back {
  border: none; background: transparent; padding: 0 0 12px; font-size: 0.82rem; font-weight: 600;
  color: var(--clay-2); display: inline-flex; align-items: center; gap: 4px;
}
.thread-back:hover { text-decoration: underline; }
.thread-hero {
  display: flex; gap: 16px; align-items: flex-start;
  border-left: 3px solid var(--clay); padding: 2px 0 18px 18px; margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.th-flags { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.th-group { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.th-name { margin: 4px 0 0; font-family: var(--serif); font-weight: 600; font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.05; color: var(--ink); }
.th-prompt { margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.02rem; color: var(--clay-2); }
.th-meta { margin: 8px 0 0; font-size: 0.78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* composer scope line */
.composer-scope { font-size: 0.78rem; color: var(--ink-2); margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.composer-scope strong { font-weight: 700; color: var(--clay-2); }

/* ===== REPLIES (nested conversation) ===== */
.replies { margin: 14px 0 4px 14px; padding-left: 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.reply-entry { animation: rise 0.34s ease both; }
.reply-entry.muted-entry { opacity: 0.85; }
.reply-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.reply-avatar { width: 26px; height: 26px; font-size: 0.66rem; align-self: center; }
.reply-entry .author-name { font-size: 0.92rem; }
.reply-entry .author-country { font-size: 0.9rem; }
.reply-entry .entry-body { font-size: 1rem; margin: 8px 1px 6px; }
.reply-actions { margin-top: 2px; }
.reply-actions .reaction { padding: 4px 7px; font-size: 0.78rem; }

/* inline reply box */
.reply-box { margin: 14px 0 4px 14px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--paper-3); }
.reply-box.shake { animation: shake 0.4s; }
.reply-text {
  width: 100%; border: none; background: transparent; resize: vertical;
  font-family: var(--serif); font-size: 1rem; line-height: 1.5; color: var(--ink); min-height: 40px;
}
.reply-text:focus { outline: none; }
.reply-text::placeholder { color: var(--ink-3); font-style: italic; }
.reply-box-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.reply-alert { font-size: 0.78rem; color: var(--clay-2); font-weight: 600; }
.reply-alert[hidden] { display: none; }
.reply-box-actions { display: flex; gap: 8px; margin-left: auto; }
.btn-ghost { border: 1px solid var(--line-2); background: transparent; border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 0.82rem; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--clay); color: var(--clay-2); }
.btn-sm { padding: 7px 16px; font-size: 0.84rem; }

/* ===== MODERATION: flag, hidden, author-only ===== */
.flag-btn {
  margin-left: auto; border: 1px solid transparent; background: transparent; border-radius: 7px;
  padding: 5px 9px; font-size: 0.74rem; font-weight: 600; color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 5px; transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.flag-btn:hover { color: var(--clay-2); border-color: var(--line-2); }
.flag-btn.on { color: var(--clay-2); border-color: var(--clay); background: var(--clay-wash); }
.reply-actions .flag-btn { padding: 4px 8px; }

.hidden-entry { background: var(--paper-3); border-style: dashed; }
.hidden-note { margin: 0; font-size: 0.88rem; color: var(--ink-2); line-height: 1.5; font-style: italic; }
.reply-entry.hidden-entry { padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: 6px; }
.reveal-btn { border: none; background: none; padding: 0; color: var(--clay-2); font-weight: 600; font-size: inherit; cursor: pointer; font-style: normal; }
.reveal-btn:hover { text-decoration: underline; }

.muted-entry { background: var(--paper-3); }
.author-only-banner {
  display: flex; gap: 8px; align-items: flex-start;
  border: 1px solid var(--line-2); border-left: 3px solid var(--ink-3); border-radius: 7px;
  background: var(--paper); padding: 10px 13px; margin-bottom: 14px;
  font-size: 0.82rem; line-height: 1.5; color: var(--ink-2);
}
.author-only-banner.small { font-size: 0.78rem; padding: 8px 11px; margin-bottom: 10px; }
.revealed-banner {
  border: 1px solid var(--line-2); border-radius: 7px; background: var(--paper);
  padding: 9px 13px; margin-bottom: 14px; font-size: 0.8rem; color: var(--ink-2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1140px) {
  .layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 30px; }
  .col-left { display: none; }
  .mobile-topics { display: flex; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 22px 18px 50px; }
  .col-right { display: none; }
  .mast { padding: 14px 18px 10px; }
  .mast-rule::before, .mast-rule::after { left: 18px; right: 18px; }
  .entry-body { font-size: 1.08rem; }
  .thread-index { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .mast-tools { gap: 10px 14px; width: 100%; }
  .brand { width: 100%; }
  .lang-select { max-width: 120px; }
  .composer-lang { display: none; }
  /* keep the brand's signature counter visible, compact, on its own line */
  #shareVoiceBtn { order: 2; }
  .hs-stat { order: 3; flex-basis: 100%; text-align: left; display: flex; align-items: baseline; gap: 6px; }
  .hs-num { font-size: 1.1rem; }
  .hs-lbl { font-size: 0.6rem; }
  /* let the conversation picker breathe instead of truncating to "Rus…" */
  .composer-bottom { align-items: stretch; }
  .composer-left { width: 100%; }
  .topic-select { width: 100%; max-width: none; }
  .composer-right { width: 100%; margin-left: 0; justify-content: space-between; }
}

/* ===== RTL (ar / he / fa / ur) ===== */
[dir="rtl"] .topic-item { border-left: none; border-right: 2px solid transparent; padding-left: 2px; padding-right: 8px; }
[dir="rtl"] .topic-item:hover { border-right-color: var(--line-2); }
[dir="rtl"] .topic-item.active { border-right-color: var(--clay); }
[dir="rtl"] .pledge-block { border-left: none; border-right: 3px solid var(--clay); padding-left: 0; padding-right: 18px; }
[dir="rtl"] .pledge-list li { padding-left: 0; padding-right: 16px; }
[dir="rtl"] .pledge-list li::before { left: auto; right: 0; }
[dir="rtl"] .thread-hero { border-left: none; border-right: 3px solid var(--clay); padding: 2px 18px 18px 0; }
[dir="rtl"] .replies { margin: 14px 14px 4px 0; padding-left: 0; padding-right: 16px; border-left: none; border-right: 2px solid var(--line); }
[dir="rtl"] .reply-box { margin: 14px 14px 4px 0; }
[dir="rtl"] .author-only-banner { border-left: 1px solid var(--line-2); border-right: 3px solid var(--ink-3); }
[dir="rtl"] .thread-back { direction: rtl; }

/* ===== ACCESSIBILITY ===== */
/* Visible keyboard focus on every interactive element (mouse focus stays clean) */
.btn-primary:focus-visible,
.lang-select:focus-visible,
.topic-item:focus-visible,
.mtopic:focus-visible,
.sort-tab:focus-visible,
.reaction:focus-visible,
.share-btn:focus-visible,
.trend-item:focus-visible,
.topic-select:focus-visible,
.tn-toggle:focus-visible,
#composerText:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}

/* Honor the OS "reduce motion" preference — fitting for a space meant to feel calm */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
