/* Cassell forum reading v4 — standalone editorial threads and a focused publisher. */
.forum-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 42px);
  background: rgba(2, 4, 6, .82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.forum-modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: 90dvh;
  overflow: auto;
  padding: 32px;
  border: 1px solid rgba(222, 225, 228, .18);
  border-radius: 10px;
  background: #090c0f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .54);
}
.forum-modal-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 20px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  color: #8d9298;
  background: transparent;
  cursor: pointer;
}
.forum-modal-close:hover { color: #f0efec; }
.forum-modal--publisher .forum-modal-panel { width: min(1120px, 100%); padding: 0; overflow: hidden; }
.publisher { min-width: 0; }
.publisher-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 78px 28px 36px;
  border-bottom: 1px solid rgba(222, 225, 228, .14);
}
.publisher-kicker {
  color: #8fbae4;
  font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .18em;
}
.publisher h2 { margin: 9px 0 7px; color: #f0efec; font: 400 clamp(26px, 3vw, 38px)/1.2 "Songti SC", STSong, serif; letter-spacing: .04em; }
.publisher-head p { margin: 0; color: #777d84; font-size: 12px; line-height: 1.7; }
.publisher-cost { flex: 0 0 auto; padding: 7px 11px; border: 1px solid rgba(157, 200, 243, .24); border-radius: 999px; color: #a8caeb; font-size: 11px; }
.publisher-grid { display: grid; grid-template-columns: minmax(0, 1fr) 285px; min-height: 480px; }
.publisher-main { padding: 30px 36px 34px; }
.publisher-aside { padding: 30px 28px; border-left: 1px solid rgba(222, 225, 228, .13); background: #070a0c; }
.publisher-field { display: grid; gap: 9px; margin-bottom: 20px; color: #9da2a8; font-size: 12px; }
.publisher-field > span { display: flex; justify-content: space-between; gap: 16px; }
.publisher-field small { color: #5f656b; font-weight: 400; }
.publisher-field :where(input, select) { min-height: 48px; padding-inline: 14px; }
.publisher-field textarea { min-height: 270px; padding: 16px; line-height: 1.85; resize: vertical; }
.publisher-aside-label { color: #d8d8d5; font-size: 13px; letter-spacing: .08em; }
.publisher-aside > p { margin: 9px 0 22px; color: #6f757b; font-size: 11px; line-height: 1.75; }
.publisher-upload {
  display: grid;
  place-items: center;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed rgba(157, 200, 243, .32);
  border-radius: 8px;
  color: #b9cde0;
  text-align: center;
  cursor: pointer;
}
.publisher-upload strong { font-size: 13px; font-weight: 600; }
.publisher-upload span { margin-top: 5px; color: #68717a; font-size: 10px; }
.publisher-upload:hover { border-color: rgba(157, 200, 243, .58); background: #0c1116; }
.visually-hidden-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.attachment-list { display: grid; gap: 8px; margin-top: 14px; }
.attachment-chip { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 9px 10px; border: 1px solid rgba(222, 225, 228, .12); border-radius: 6px; color: #c4c7ca; background: #0b0f12; }
.attachment-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-chip small { margin-left: auto; color: #656b71; white-space: nowrap; }
.publisher-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 28px 18px 36px; border-top: 1px solid rgba(222, 225, 228, .14); }
.publisher-message { min-height: 20px; color: #777d84; font-size: 11px; }
.publisher-actions { display: flex; gap: 10px; }
.publisher-actions .nav-btn { min-width: 108px; }
.publisher-actions #publishBtn { color: #07101a; border-color: #9dc8f3; background: #afd0f0; font-weight: 650; }

/* Standalone thread */
.thread-page-v4 { min-height: 100dvh; background: #06080a; }
.thread-page-v4 #bg-layer { background: #06080a; filter: none; }
.thread-page-v4 #bg-overlay { background: transparent; }
.thread-page-v4 #particles { display: none; }
.thread-shell { position: relative; z-index: 1; width: min(1480px, calc(100% - 64px)); margin: 0 auto; padding: 44px 0 120px; }
.thread-crumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 36px; color: #646a70; font-size: 10px; letter-spacing: .13em; }
.thread-crumb a { color: #92979d; }
.thread-loading { padding: 72px 0; color: #787e84; text-align: center; }
.thread-error { width: min(720px, 100%); margin: 64px auto; padding: 30px; border: 1px solid rgba(225, 124, 124, .24); color: #e3b1b1; background: #0b0d10; text-align: center; }
.thread-layout { display: grid; grid-template-columns: minmax(0, 860px) 260px; justify-content: center; gap: clamp(42px, 6vw, 96px); }
.thread-article { min-width: 0; }
.thread-board-label { display: inline-flex; min-height: 28px; align-items: center; padding: 4px 9px; border: 1px solid rgba(157, 200, 243, .27); border-radius: 4px; color: #9dc8f3; font-size: 10px; letter-spacing: .1em; }
.thread-title { max-width: 820px; margin: 22px 0 20px; color: #efede8; font: 400 clamp(28px, 2.3vw, 36px)/1.28 "Songti SC", "Noto Serif SC", STSong, serif; letter-spacing: .025em; overflow-wrap: anywhere; }
.thread-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; color: #767c82; font-size: 11px; }
.thread-byline .author-profile-chip { color: #d7d9db; }
.thread-lead-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 27px 0 30px; }
.thread-lead-actions button { min-height: 44px; }
.thread-original { padding: 32px 0 42px; border-top: 1px solid rgba(222, 225, 228, .17); border-bottom: 1px solid rgba(222, 225, 228, .17); }
.thread-original-body, .thread-reply-body { color: #d2d1cd; font-size: 15px; line-height: 2; letter-spacing: .025em; white-space: pre-wrap; overflow-wrap: anywhere; }
.thread-signature { margin: 12px 0; color: #7d8389; font-size: 11px; }
.thread-replies-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 32px 0 12px; border-bottom: 1px solid rgba(222, 225, 228, .18); }
.thread-replies-head h2 { margin: 0; color: #e2e1dd; font-size: 15px; font-weight: 540; }
.thread-replies-head span { color: #696f75; font-size: 11px; }
.thread-reply { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 22px; padding: 28px 0 31px; border-bottom: 1px solid rgba(222, 225, 228, .14); content-visibility: auto; contain-intrinsic-size: 0 220px; }
.thread-floor { color: #8f9499; font: 22px/1.2 "Times New Roman", serif; }
.thread-reply-main { min-width: 0; }
.thread-reply-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; margin-bottom: 18px; color: #71777d; font-size: 10px; }
.thread-reply-head .author-profile-chip { color: #d2d4d6; }
.thread-reply-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.thread-reply-actions button { min-height: 40px; padding: 7px 12px; }
.thread-quote { margin: 0 0 18px; padding: 13px 15px; border-left: 2px solid rgba(157, 200, 243, .36); color: #8d9399; background: #0a0e11; }
.thread-quote b { display: block; margin-bottom: 5px; color: #aeb4ba; font-size: 11px; }
.thread-quote p { margin: 0; font-size: 12px; line-height: 1.65; }
.thread-rail { align-self: start; position: sticky; top: 104px; padding-left: 24px; border-left: 1px solid rgba(222, 225, 228, .16); }
.thread-rail-stat { padding: 16px 0 22px; border-bottom: 1px solid rgba(222, 225, 228, .13); }
.thread-rail-stat span { display: block; color: #70767c; font-size: 10px; letter-spacing: .12em; }
.thread-rail-stat strong { display: block; margin-top: 6px; color: #d8d7d3; font: 38px/1.1 "Times New Roman", serif; font-weight: 400; }
.thread-rail-actions { display: grid; gap: 9px; padding-top: 22px; }
.thread-rail-actions a, .thread-rail-actions button { width: 100%; justify-content: center; }
.thread-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 28px 0; border-bottom: 1px solid rgba(222, 225, 228, .14); }
.thread-pager span { color: #73797f; font-size: 11px; }
.thread-compose { margin-top: 36px; padding: 28px; border: 1px solid rgba(222, 225, 228, .18); border-radius: 8px; background: #090c0f; }
.thread-compose h2 { margin: 0 0 18px; color: #e4e3df; font-size: 16px; }
.thread-compose textarea { min-height: 170px; padding: 15px; line-height: 1.8; }
.thread-compose-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; margin-top: 12px; }
.thread-compose-upload { display: grid; place-items: center; min-height: 82px; padding: 12px; border: 1px dashed rgba(157, 200, 243, .3); border-radius: 6px; color: #a8bfd5; text-align: center; cursor: pointer; }
.thread-compose-upload span { font-size: 11px; }
.thread-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.thread-compose-status { color: #73797f; font-size: 11px; }
.thread-target { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding: 12px; border: 1px solid rgba(157, 200, 243, .2); border-radius: 6px; color: #9ca7b2; background: #0d1217; }
.thread-target[hidden] { display: none; }
.thread-target b, .thread-target span { display: block; }
.thread-target span { margin-top: 4px; color: #737b83; font-size: 10px; }
.post-attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.post-attachment-image { min-height: 180px; overflow: hidden; border: 1px solid rgba(222, 225, 228, .14); border-radius: 6px; background: #080b0d; }
.post-attachment-image img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; }
.post-attachment-file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 13px; border: 1px solid rgba(222, 225, 228, .15); border-radius: 6px; color: #c5c8ca; background: #0a0d10; }
.post-attachment-file b { color: #94b7d8; font-size: 10px; }
.post-attachment-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-attachment-file small { color: #666d73; }
.forum-toast { position: fixed; z-index: 1200; left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); padding: 11px 16px; border: 1px solid rgba(222, 225, 228, .18); border-radius: 6px; color: #e6e5e1; background: #11161a; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.forum-toast.show { transform: translate(-50%, 0); opacity: 1; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .forum-modal { background: rgba(2, 4, 6, .96); }
}
@media (max-width: 980px) {
  .thread-shell { width: min(100% - 40px, 860px); }
  .thread-layout { grid-template-columns: minmax(0, 1fr); }
  .thread-rail { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; padding: 0 0 28px; border: 0; border-bottom: 1px solid rgba(222, 225, 228, .16); }
  .thread-rail-actions { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publisher-grid { grid-template-columns: minmax(0, 1fr) 240px; }
}
@media (max-width: 680px) {
  .forum-modal { align-items: end; padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .forum-modal-panel { width: 100%; max-height: 94dvh; padding: 24px 16px calc(20px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 12px 12px 0 0; }
  .forum-modal--publisher .forum-modal-panel { width: 100%; border-radius: 12px 12px 0 0; overflow: auto; }
  .publisher-head { padding: 28px 62px 22px 18px; }
  .publisher-cost { display: none; }
  .publisher-grid { display: block; min-height: 0; }
  .publisher-main { padding: 22px 18px 4px; }
  .publisher-aside { padding: 18px; border-top: 1px solid rgba(222, 225, 228, .13); border-left: 0; }
  .publisher-field textarea { min-height: 210px; }
  .publisher-upload { min-height: 88px; }
  .publisher-foot { position: sticky; bottom: 0; flex-direction: column; align-items: stretch; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: #090c0f; }
  .publisher-actions { width: 100%; }
  .publisher-actions .nav-btn { flex: 1; }
  .thread-shell { width: calc(100% - 24px); padding: 26px 0 calc(96px + env(safe-area-inset-bottom)); }
  .thread-crumb { margin-bottom: 26px; }
  .thread-title { margin-top: 18px; font-size: clamp(24px, 7.5vw, 30px); line-height: 1.34; }
  .thread-original-body, .thread-reply-body { font-size: 15px; line-height: 1.9; }
  .thread-reply { grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 24px 0; }
  .thread-floor { font-size: 18px; }
  .thread-reply-head { align-items: flex-start; flex-direction: column; }
  .thread-rail { grid-template-columns: 1fr 1fr; }
  .thread-rail-actions { grid-template-columns: 1fr; }
  .thread-compose { margin-inline: -2px; padding: 20px 14px; }
  .thread-compose-grid { grid-template-columns: 1fr; }
  .thread-compose-foot { align-items: stretch; flex-direction: column; }
  .thread-compose-foot button { width: 100%; }
  .post-attachments { grid-template-columns: 1fr; }
  .post-attachment-image { min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .forum-toast { transition: none; }
  .thread-reply { content-visibility: visible; contain-intrinsic-size: auto; }
}
