/* ============================================================
   Archives Ethan — noir chaud & ambre
   ============================================================ */
:root {
  --bg: #131110;
  --bg-raise: #1a1715;
  --bg-panel: #201c19;
  --bg-hover: #262019;
  --line: #2e2823;
  --line-soft: #241f1b;
  --ink: #ece5db;
  --ink-dim: #a89d8f;
  --ink-faint: #948a7c; /* ≥ 4.5:1 (AA) sur toutes les surfaces du thème */
  --amber: #e8a33d;
  --amber-soft: rgba(232, 163, 61, .14);
  --amber-line: rgba(232, 163, 61, .35);
  --link: #7fb4e6;
  --danger: #e06c5c;
  --radius: 10px;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --side-w: 320px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  overflow: hidden;
}
body::after { /* grain */
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  z-index: 200;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { max-width: 100%; }
::selection { background: var(--amber-soft); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute;
  top: -100px; left: 12px;
  z-index: 500;
  background: var(--amber);
  color: #131110;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
}
.skip-link:focus { top: 12px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .center-note .spin { animation: none; border-top-color: var(--line); }
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #3a332c transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #3a332c; border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; height: 100dvh; }

/* ============================ sidebar ============================ */
#sidebar {
  width: var(--side-w);
  min-width: var(--side-w);
  background: var(--bg-raise);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.brand { padding: 18px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.brand-link { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand-link:hover { text-decoration: none; }
.brand-mark {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: 12px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.brand-text small { color: var(--ink-faint); font-size: 11.5px; margin-top: 2px; }

.side-search { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.side-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 12px;
}
.side-search input:focus { border-color: var(--amber-line); }
.side-search input::placeholder { color: var(--ink-faint); }
#globalSearchBtn {
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-faint);
  padding: 4px 6px;
  border-radius: 6px;
  display: none;
}
#globalSearchBtn:hover { color: var(--amber); background: var(--bg-hover); }
#globalSearchBtn.visible { display: block; }

#convList { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  margin-bottom: 1px;
}
.conv-item:hover { background: var(--bg-hover); text-decoration: none; }
.conv-item.active { background: var(--amber-soft); }
.conv-item.active .conv-name { color: var(--amber); }
.conv-meta { min-width: 0; flex: 1; }
.conv-name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-sub {
  color: var(--ink-faint); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-empty-note { padding: 24px 12px; color: var(--ink-faint); text-align: center; font-size: 13px; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: var(--bg-panel);
}
.avatar-fallback {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  color: #131110;
}
.avatar-group {
  width: 38px; height: 38px; border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  font-size: 17px;
}

.side-foot {
  border-top: 1px solid var(--line-soft);
  padding: 10px 16px;
  font-size: 11.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}

#sideToggle {
  display: none;
  position: fixed;
  top: 10px; left: 10px;
  z-index: 60;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px; height: 40px;
  font-size: 17px;
}

/* ============================ main ============================ */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- home ---- */
.home {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(232,163,61,.06), transparent 60%),
    var(--bg);
}
.home h1 {
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 84px);
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -.5px;
  line-height: 1.05;
}
.home h1 em { font-style: italic; color: var(--amber); }
.home .home-sub { color: var(--ink-dim); font-size: 17px; max-width: 560px; margin: 0 auto 40px; }
.home-stats {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 40px;
}
.stat {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 26px;
  min-width: 150px;
}
.stat b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--amber); }
.stat span { color: var(--ink-faint); font-size: 12.5px; letter-spacing: .4px; text-transform: uppercase; }
.home-hint { color: var(--ink-faint); font-size: 14px; }
.home-hint kbd {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 7px; font-family: var(--mono); font-size: 12px;
}

/* ---- conversation header ---- */
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raise);
  min-height: 62px;
  flex-wrap: wrap;
}
.chat-head .avatar, .chat-head .avatar-fallback, .chat-head .avatar-group { width: 36px; height: 36px; }
.chat-title { min-width: 0; flex: 1; }
.chat-title h2 {
  margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-title .chat-sub { color: var(--ink-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-actions { display: flex; gap: 8px; }
.btn {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.btn:hover { color: var(--amber); border-color: var(--amber-line); }
.btn.primary { color: #131110; background: var(--amber); border-color: var(--amber); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

/* ---- messages ---- */
#msgScroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.msg-inner { max-width: 860px; margin: 0 auto; padding: 18px 20px 40px; }
.chunk-sentinel { height: 1px; }
.load-note { text-align: center; color: var(--ink-faint); font-size: 12.5px; padding: 12px; }
.conv-top-note {
  text-align: center;
  padding: 34px 20px 22px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 18px;
}
.conv-top-note .big { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.conv-top-note .dim { color: var(--ink-faint); font-size: 13px; margin-top: 6px; }

.day-sep {
  display: flex; align-items: center; gap: 14px;
  margin: 22px 0 10px;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: capitalize;
}
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.msg {
  position: relative;
  display: flex; gap: 14px;
  padding: 2px 10px 2px 8px;
  border-radius: 8px;
  scroll-margin: 80px;
}
.msg:hover { background: rgba(255,255,255,.025); }
.msg.head-msg { margin-top: 14px; }
.msg .gutter { width: 40px; flex: none; padding-top: 3px; }
.msg .gutter .avatar, .msg .gutter .avatar-fallback { width: 40px; height: 40px; }
.msg .gutter .htime {
  display: none;
  font-size: 10.5px; color: var(--ink-faint);
  text-align: right; width: 40px; padding-top: 5px;
  user-select: none;
}
.msg:not(.head-msg):hover .gutter .htime { display: block; }
.msg .body { min-width: 0; flex: 1; }
.msg-author { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-author .aname { font-weight: 600; font-size: 14.5px; }
.msg-author .aname.owner { color: var(--amber); }
.msg-author .abot {
  background: var(--amber-soft); color: var(--amber);
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  padding: 1px 5px; border-radius: 4px; text-transform: uppercase;
}
.msg-author .atime { color: var(--ink-faint); font-size: 11.5px; }
.msg-text { white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; }
.msg-text.jumbo { font-size: 34px; line-height: 1.2; }
.msg.highlight { animation: flash 2.4s ease-out; }
@keyframes flash {
  0%, 55% { background: var(--amber-soft); box-shadow: inset 3px 0 0 var(--amber); }
  100% { background: transparent; }
}
.edited-tag { color: var(--ink-faint); font-size: 10.5px; margin-left: 5px; user-select: none; }
.pin-flag { color: var(--amber); font-size: 11px; margin-left: 6px; }

/* hover toolbar */
.msg-tools {
  position: absolute;
  top: -14px; right: 10px;
  display: flex;
  opacity: 0;
  pointer-events: none;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.msg:hover .msg-tools, .msg:focus-within .msg-tools,
.sysmsg:hover .msg-tools, .sysmsg:focus-within .msg-tools {
  opacity: 1;
  pointer-events: auto;
}
.msg-tools button {
  padding: 5px 10px;
  font-size: 13px;
  color: var(--ink-dim);
}
.msg-tools button:hover { background: var(--bg-hover); color: var(--amber); }

/* markdown bits */
.msg-text code, .md-inline code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.msg-text pre {
  background: var(--bg-panel);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 4px 0;
}
.msg-text pre code { background: none; border: none; padding: 0; font-size: 12.5px; display: block; white-space: pre; }
.msg-text blockquote {
  margin: 2px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--ink-dim);
}
.spoiler {
  background: #000;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.spoiler.revealed { background: rgba(255,255,255,.08); cursor: auto; user-select: auto; }
.spoiler:not(.revealed) .spoiler-inner { visibility: hidden; }
.mention {
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 500;
}
.inline-emoji { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
.jumbo .inline-emoji, .jumbo-emoji .inline-emoji { width: 44px; height: 44px; vertical-align: -9px; }

/* reply strip */
.reply-strip {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-bottom: 3px;
  cursor: pointer;
  min-width: 0;
}
.reply-strip:hover .reply-snippet { color: var(--ink); }
.reply-strip::before {
  content: "";
  width: 26px; height: 9px;
  border-left: 2px solid var(--line);
  border-top: 2px solid var(--line);
  border-top-left-radius: 6px;
  margin-left: 17px;
  margin-top: 8px;
  flex: none;
}
.reply-strip .avatar, .reply-strip .avatar-fallback { width: 16px; height: 16px; font-size: 8px; }
.reply-strip .rname { font-weight: 600; flex: none; }
.reply-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-missing { font-style: italic; }

/* attachments */
.att-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 4px; }
.att-img {
  max-width: min(420px, 100%);
  max-height: 340px;
  border-radius: 8px;
  cursor: zoom-in;
  display: block;
  background: var(--bg-panel);
}
.att-video { max-width: min(520px, 100%); max-height: 380px; border-radius: 8px; display: block; background: #000; }
.att-file {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: min(420px, 100%);
  color: inherit;
}
.att-file:hover { text-decoration: none; border-color: var(--amber-line); }
.att-file .fico { font-size: 22px; }
.att-file .fmeta { min-width: 0; }
.att-file .fname { font-weight: 600; font-size: 13.5px; color: var(--link); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file .fsize { color: var(--ink-faint); font-size: 11.5px; }

/* voice message */
.voice-msg {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 16px 8px 8px;
  max-width: 340px; width: 100%;
}
.voice-msg .vplay {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--amber);
  color: #131110;
  display: grid; place-items: center;
  font-size: 13px;
}
.voice-msg .vbar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; position: relative; cursor: pointer; }
.voice-msg .vbar .vfill { position: absolute; inset: 0 100% 0 0; background: var(--amber); border-radius: 2px; }
.voice-msg .vtime { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); flex: none; }

/* stickers */
.sticker-box { margin-top: 4px; }
.sticker-box img, .sticker-box .lottie-holder { width: 160px; height: 160px; object-fit: contain; }
.sticker-name { color: var(--ink-faint); font-size: 11px; margin-top: 2px; }

/* embeds */
.embed {
  border-left: 4px solid var(--line);
  background: var(--bg-raise);
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 6px;
  max-width: min(480px, 100%);
  font-size: 13.5px;
}
.embed .e-author { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.embed .e-author img { width: 20px; height: 20px; border-radius: 50%; }
.embed .e-title { font-weight: 700; margin-bottom: 3px; }
.embed .e-title a { color: var(--link); }
.embed .e-desc { color: var(--ink-dim); white-space: pre-wrap; overflow-wrap: break-word; }
.embed .e-thumb { float: right; max-width: 76px; max-height: 76px; border-radius: 6px; margin: 0 0 6px 10px; }
.embed .e-image { max-width: 100%; border-radius: 6px; margin-top: 8px; cursor: zoom-in; display: block; }
.embed .e-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.embed .e-field b { display: block; font-size: 12px; margin-bottom: 1px; }
.embed .e-field span { color: var(--ink-dim); font-size: 12.5px; white-space: pre-wrap; }
.embed .e-footer { display: flex; align-items: center; gap: 6px; color: var(--ink-faint); font-size: 11.5px; margin-top: 8px; }
.embed .e-footer img { width: 16px; height: 16px; border-radius: 50%; }
.gif-embed { margin-top: 4px; }
.gif-embed video, .gif-embed img { max-width: min(360px, 100%); max-height: 300px; border-radius: 8px; display: block; }
.gif-tag {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,.7); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px;
}
.gif-holder { position: relative; display: inline-block; }

/* poll */
.poll-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 4px;
  max-width: 380px;
}
.poll-card .p-q { font-weight: 700; margin-bottom: 8px; }
.poll-card .p-row { font-size: 13px; color: var(--ink-dim); display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.poll-card .p-win { color: var(--amber); font-weight: 600; }
.poll-card .p-total { color: var(--ink-faint); font-size: 11.5px; margin-top: 6px; }

/* reactions */
.rx-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.rx {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: default;
}
.rx img { width: 16px; height: 16px; object-fit: contain; }
.rx .rc { color: var(--ink-dim); font-size: 12px; font-weight: 600; }

/* system messages */
.sysmsg {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-dim);
  font-size: 13px;
  padding: 5px 10px 5px 16px;
  border-radius: 8px;
  scroll-margin: 80px;
  position: relative;
}
.sysmsg:hover { background: rgba(255,255,255,.025); }
.sysmsg .sico { width: 32px; text-align: center; font-size: 15px; flex: none; }
.sysmsg .sname { font-weight: 600; color: var(--ink); }
.sysmsg .stime { color: var(--ink-faint); font-size: 11px; margin-left: 4px; }
.sysmsg .msg-tools { top: -12px; }
.sysmsg.highlight { animation: flash 2.4s ease-out; }

/* jump pill */
#jumpPill {
  position: absolute;
  bottom: 18px; right: 26px;
  display: flex; gap: 6px;
  z-index: 20;
}
#jumpPill .btn { box-shadow: 0 4px 14px rgba(0,0,0,.45); background: var(--bg-panel); }
.chat-body-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- search view ---- */
.search-view { flex: 1; overflow-y: auto; }
.search-inner { max-width: 860px; margin: 0 auto; padding: 26px 20px 60px; }
.search-inner h2 { font-family: var(--serif); font-weight: 600; margin: 0 0 4px; font-size: 26px; }
.search-bar { display: flex; gap: 8px; margin: 14px 0 6px; }
.search-bar input {
  flex: 1;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 15px;
}
.search-bar input:focus { border-color: var(--amber-line); }
.search-scope { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.scope-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  color: var(--ink-dim);
}
.scope-chip.on { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.search-progress { color: var(--ink-faint); font-size: 12.5px; margin: 10px 0; }
.search-progress .bar { height: 3px; background: var(--line-soft); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.search-progress .bar i { display: block; height: 100%; background: var(--amber); width: 0; transition: width .2s; }
.sr-group { margin-top: 22px; }
.sr-group > h3 {
  font-size: 13px; color: var(--ink-dim); font-weight: 600;
  margin: 0 0 6px;
  display: flex; align-items: center; gap: 8px;
}
.sr-group > h3 .avatar, .sr-group > h3 .avatar-fallback { width: 20px; height: 20px; font-size: 9px; }
.sr-hit {
  display: block;
  background: var(--bg-raise);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px 14px;
  margin-bottom: 5px;
  color: inherit;
}
.sr-hit:hover { text-decoration: none; border-color: var(--amber-line); background: var(--bg-hover); }
.sr-hit .h-head { display: flex; gap: 8px; font-size: 11.5px; color: var(--ink-faint); margin-bottom: 3px; }
.sr-hit .h-head b { color: var(--ink-dim); }
.sr-hit .h-text { font-size: 13.5px; color: var(--ink-dim); overflow-wrap: break-word; }
.sr-hit mark { background: var(--amber-soft); color: var(--amber); border-radius: 3px; padding: 0 1px; }
.sr-more { font-size: 12px; color: var(--ink-faint); padding: 2px 4px; }

/* ---- avertissement d'entrée ---- */
body.gated #app, body.gated #sideToggle { visibility: hidden; }
#disclaimer {
  position: fixed; inset: 0;
  z-index: 320;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 420px at 50% -10%, rgba(232,163,61,.07), transparent 60%),
    var(--bg);
}
#disclaimer[hidden] { display: none; }
.disc-card {
  max-width: 640px;
  width: 100%;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 30px 20px;
  margin: auto;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.disc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.disc-mark {
  font-family: var(--serif);
  font-size: 24px; font-weight: 700;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: 12px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  flex: none;
}
.disc-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
}
.disc-intro { color: var(--ink-dim); margin: 0 0 16px; }
.disc-list {
  list-style: none;
  margin: 0 0 20px; padding: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.disc-list li {
  display: flex; gap: 12px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-dim);
}
.disc-list li b { color: var(--ink); }
.disc-ico { font-size: 18px; flex: none; padding-top: 1px; }
.disc-contact {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  border-radius: 6px;
  padding: 1px 8px;
  cursor: copy;
}
.disc-contact:hover { filter: brightness(1.15); }
.disc-actions { display: flex; justify-content: flex-end; gap: 10px; }
.disc-actions .btn { padding: 10px 22px; font-size: 14px; }
.disc-note {
  text-align: right;
  color: var(--ink-faint);
  font-size: 11.5px;
  margin: 12px 0 0;
}
@media (max-width: 560px) {
  .disc-card { padding: 20px 18px 14px; }
  .disc-actions { flex-direction: column-reverse; }
  .disc-actions .btn { width: 100%; }
}

/* ---- lightbox ---- */
#lightbox {
  position: fixed; inset: 0;
  background: rgba(10, 8, 7, .92);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: 30px;
}
#lightbox[hidden] { display: none; }
#lightbox .lb-body { max-width: 92vw; max-height: 82vh; display: flex; align-items: center; justify-content: center; }
#lightbox .lb-body img, #lightbox .lb-body video { max-width: 92vw; max-height: 82vh; border-radius: 8px; }
#lightbox .lb-close {
  position: absolute; top: 14px; right: 18px;
  font-size: 22px; color: var(--ink-dim);
  width: 42px; height: 42px; border-radius: 50%;
}
#lightbox .lb-close:hover { color: #fff; background: rgba(255,255,255,.08); }
#lightbox .lb-open { color: var(--ink-dim); font-size: 13px; }
#lightbox .lb-open:hover { color: var(--amber); }

/* ---- toast ---- */
#toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translate(-50%, 20px);
  background: var(--bg-panel);
  border: 1px solid var(--amber-line);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 400;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- loading / error ---- */
.center-note {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  color: var(--ink-faint);
  padding: 40px;
  text-align: center;
}
.center-note .spin {
  width: 26px; height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ mobile ============================ */
@media (max-width: 860px) {
  :root { --side-w: 290px; }
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.5);
  }
  #app.side-open #sidebar { transform: translateX(0); }
  #sideToggle { display: grid; place-items: center; }
  .chat-head { padding-left: 60px; }
  .home { padding-top: 70px; }
  .msg .gutter { width: 34px; }
  .msg .gutter .avatar, .msg .gutter .avatar-fallback { width: 34px; height: 34px; }
  #jumpPill { right: 14px; bottom: 14px; }
  .search-inner { padding-top: 60px; }
}
