:root {
  --bg: #f5f5f7; --surface: #fff; --hover: #fbfbfd;
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #86868b; --text-4: #aeaeb2;
  --faint: #d2d2d7; --hairline: rgba(0,0,0,0.07); --track: #e8e8ed;
  --accent: #0071e3; --live: #30d158; --danger: #ff3b30;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --r-pill: 999px; --r-thumb: 12px; --r-card: 18px; --r-panel: 22px; --r-sheet: 16px;
  --sh-card: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  --sh-panel: 0 1px 3px rgba(0,0,0,0.05), 0 14px 40px rgba(0,0,0,0.05);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --top: env(safe-area-inset-top); --bottom: env(safe-area-inset-bottom);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px;
  line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
#app { height: 100%; max-width: 720px; margin: 0 auto; position: relative; }
.view { height: 100%; display: flex; flex-direction: column; position: relative; min-width: 0; }
.view[hidden] { display: none; }

/* ── rooms ── */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--top) + 8px) 16px calc(var(--bottom) + 24px); }
.lt { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; padding: 36px 4px 12px; }
.nav-c { position: absolute; top: 0; left: 0; right: 0; z-index: 50; height: calc(var(--top) + 44px);
  padding-top: var(--top); display: flex; align-items: center; justify-content: center;
  background: rgba(245,245,247,.72); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid transparent; }
.nav-c-t { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; opacity: 0; transition: opacity .25s; }
.nav-c.show { border-bottom-color: var(--hairline); }
.nav-c.show .nav-c-t { opacity: 1; }
.nav-act { position: absolute; right: 8px; bottom: 0; width: 44px; height: 44px; display: grid;
  place-items: center; color: var(--accent); }
.nudge { margin-bottom: 14px; }
.nudge[hidden] { display: none; }
.nudge .row-t { color: var(--accent); font-weight: 600; }
.org { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .02em; padding: 18px 6px 8px; }
.panel { background: var(--surface); border-radius: var(--r-panel); box-shadow: var(--sh-panel);
  overflow: hidden; }
.room { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text);
  position: relative; min-height: 68px; }
.room + .room::before, .row + .row::before { content: ""; position: absolute; top: 0; right: 0;
  left: 68px; border-top: 1px solid var(--hairline); }
.row + .row::before { left: 16px; }
.room:active, .row-btn:active { background: var(--hover); }
.av { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 17px; color: #fff; background: #8e8e93; }
.room-main { flex: 1; min-width: 0; }
.room-top { display: flex; align-items: baseline; gap: 8px; }
.room-n { flex: 1; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.room-time { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.room-last { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 2px; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: grid;
  place-items: center; font-variant-numeric: tabular-nums; }
.empty { color: var(--text-3); text-align: center; padding: 48px 24px; }

/* ── room ── */
.bar { flex: none; display: flex; align-items: center; padding: var(--top) 4px 0;
  height: calc(var(--top) + 52px); background: rgba(245,245,247,.72);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline); z-index: 10; }
.back, .bar-gap { width: 44px; height: 44px; display: grid; place-items: center; flex: none; }
.bar-title { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-t { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-s { font-size: 12px; color: var(--text-3); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column;
  gap: 2px; -webkit-overflow-scrolling: touch; }
.day { align-self: center; font-size: 12px; color: var(--text-3); padding: 14px 0 6px; }
.m { display: flex; flex-direction: column; max-width: 78%; align-self: flex-start; }
.m.mine { align-self: flex-end; align-items: flex-end; }
.m .who { font-size: 12px; color: var(--text-3); padding: 8px 12px 2px; display: flex; gap: 6px;
  align-items: center; }
.ai { font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--accent);
  border: 1px solid rgba(0,113,227,.35); border-radius: var(--r-pill); padding: 0 5px; line-height: 15px; }
.b { padding: 8px 13px; border-radius: 19px; background: var(--surface); box-shadow: var(--sh-card);
  overflow-wrap: anywhere; font-size: 16px; line-height: 1.4; }
.m.mine .b { background: var(--accent); color: #fff; box-shadow: none; }
.m.mine .b a { color: #fff; text-decoration: underline; }
.m .t { font-size: 11px; color: var(--text-4); padding: 2px 12px 0; font-variant-numeric: tabular-nums; }
.draft { align-self: stretch; max-width: none; margin: 10px 0; background: var(--surface);
  border-radius: var(--r-card); box-shadow: var(--sh-card); padding: 12px 14px; }
.draft-h { font-size: 12px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.draft textarea { width: 100%; margin: 8px 0 10px; font: inherit; border: 1px solid var(--hairline);
  border-radius: var(--r-thumb); padding: 9px 11px; resize: none; background: var(--hover); color: var(--text); }
.draft-a { display: flex; gap: 8px; justify-content: flex-end; }
.btn { height: 36px; padding: 0 16px; border-radius: var(--r-pill); background: var(--accent);
  color: #fff; font-weight: 600; font-size: 15px; }
.btn.ghost { background: var(--track); color: var(--text); }
.btn:active { transform: scale(.97); }
.composer { flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 10px max(8px, var(--bottom)); background: rgba(245,245,247,.82);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hairline); }
.comp-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; font: inherit; font-size: 16px; line-height: 1.35; resize: none;
  max-height: 140px; border: 1px solid var(--faint); border-radius: 20px; padding: 8px 14px;
  background: var(--surface); color: var(--text); outline: none; }
.composer textarea:focus { border-color: var(--text-4); }
.send { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none; margin-bottom: 1px;
  transition: opacity .2s, transform .15s; }
.send:disabled { opacity: .3; }
.send:active { transform: scale(.92); }
.send.wait { opacity: .6; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); } }
.attach { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: var(--text-2); margin-bottom: 1px; transition: background .15s, color .15s; }
.attach:hover { background: var(--track); color: var(--text); }
.attach[hidden] { display: none; }

/* ── photos waiting to be sent ── */
.tray { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 2px; scrollbar-width: none; }
.tray[hidden] { display: none; }
.tr-i { position: relative; flex: none; width: 68px; height: 68px; border-radius: 14px; overflow: hidden;
  background: var(--track); }
.tr-i img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s; }
.tr-i.up img { opacity: .55; }
.tr-i.err img { opacity: .35; filter: grayscale(1); }
.tr-i.err { box-shadow: inset 0 0 0 2px var(--danger); }
.tr-p { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.45); overflow: hidden; opacity: 0; transition: opacity .2s; }
.tr-p::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: #fff;
  transition: width .2s; }
.tr-i.up .tr-p { opacity: 1; }
.tr-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.drop { position: absolute; inset: 8px; z-index: 30; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: var(--r-panel);
  background: color-mix(in srgb, var(--bg) 82%, transparent); }
.drop[hidden] { display: none; }
.drop-in { font-size: 17px; font-weight: 600; color: var(--accent); }

/* ── photos in the thread ── */
.m { position: relative; }
.gal { display: grid; gap: 2px; border-radius: var(--r-card); overflow: hidden; margin: 2px 0;
  width: 280px; max-width: 100%; }
.gal.n1 { width: auto; }
.gal.n2, .gal.n4 { grid-template-columns: 1fr 1fr; }
.gal.n3 { grid-template-columns: 1fr 1fr; }
.gal.n3 .ph:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.ph { position: relative; display: block; aspect-ratio: 1; background: var(--track); overflow: hidden;
  padding: 0; cursor: zoom-in; }
.gal.n1 .ph { aspect-ratio: var(--r, 1); width: min(280px, calc(320px * var(--r, 1))); max-width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.gone img { display: none; }
.ph.gone::after { content: "Photo unavailable"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 13px; color: var(--text-3); }
.ph .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.45);
  color: #fff; font-size: 24px; font-weight: 600; }
.m .gal + .b { margin-top: 4px; }
.m.bot .gal, .draft .gal { margin: 6px 0 8px; }
.old-shell .ph img, .old-shell #vw-img { -webkit-touch-callout: none; }

/* ── reactions ── */
.rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding: 0 2px; }
.rx[hidden] { display: none; }
.m.mine .rx { justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px;
  border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--hairline);
  font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; transition: transform .12s; }
.chip .e { font-size: 15px; line-height: 1; }
.chip.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent); font-weight: 600; }
.chip.add { padding: 0 7px; color: var(--text-3); }
.chip:active { transform: scale(.94); }
@media (hover: hover) { .chip.add { opacity: 0; } .m:hover .chip.add { opacity: 1; } .chip:hover { border-color: var(--text-4); } }
.hb { position: absolute; top: 0; left: calc(100% + 6px); z-index: 5; display: flex; align-items: center; gap: 1px;
  padding: 3px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--hairline);
  box-shadow: 0 4px 18px rgba(0,0,0,.12); animation: pop .14s var(--ease-spring); }
.m:has(> .who) .hb { top: 24px; }
.m.mine .hb { left: auto; right: calc(100% + 6px); }
.m .hb.in { left: auto; right: 8px; top: -18px; }
.m:has(> .who) .hb.in { top: 6px; }
.m .hb { white-space: nowrap; }
.hb button { width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; display: grid;
  place-items: center; transition: transform .12s, background .12s; }
.hb button:hover { background: var(--track); transform: scale(1.15); }
.hb .hb-more { color: var(--text-3); }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.96); } }
.m.pressed { transform: scale(.98); transition: transform .2s var(--ease-spring); }
@media (hover: none) { .msgs { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }

/* the reaction sheet */
.rx-quick { display: flex; justify-content: space-between; gap: 6px; padding: 4px 4px 6px; }
.rq { flex: 1; height: 54px; border-radius: 16px; font-size: 28px; background: var(--surface);
  box-shadow: var(--sh-card); transition: transform .12s; }
.rq.on { box-shadow: inset 0 0 0 2px var(--accent); }
.rq:active, .rg:active { transform: scale(.9); }
.rx-g { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 2px;
  background: var(--surface); border-radius: var(--r-panel); padding: 8px; }
.rg { height: 44px; font-size: 24px; border-radius: 12px; }
.rg:hover { background: var(--track); }
#rx-acts { margin-top: 14px; }
#rx-acts[hidden] { display: none; }

/* ── the photo viewer ── */
.viewer { position: fixed; inset: 0; z-index: 95; background: #000; color: #fff;
  display: flex; flex-direction: column; animation: fade .18s ease; }
.viewer[hidden] { display: none; }
body.viewing { overflow: hidden; }
@keyframes fade { from { opacity: 0; } }
.vw-top { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(var(--top) + 6px) 8px 6px; }
.vw-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.vw-btn:hover { background: rgba(255,255,255,.12); }
.vw-btn[hidden] { visibility: hidden; display: grid; }
.vw-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.vw-who { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vw-n { font-size: 12px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; }
.vw-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  padding: 0 0 calc(var(--bottom) + 12px); touch-action: none; cursor: zoom-in; user-select: none; }
.vw-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.vw-stage.zoom { overflow: auto; display: block; touch-action: pan-x pan-y; cursor: zoom-out; }
.vw-stage.zoom img { max-width: none; max-height: none; width: 200%; margin: auto; }
.vw-nav { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.12);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.vw-nav:hover { background: rgba(255,255,255,.22); }
.vw-nav.prev { left: 16px; } .vw-nav.next { right: 16px; }
.vw-nav[hidden] { display: none; }
@media (hover: none) { .vw-nav { display: none; } }

/* ── gate ── */
.gate { margin: auto; width: 100%; max-width: 360px; padding: 32px 24px calc(var(--bottom) + 32px);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.mark { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center;
  background: linear-gradient(135deg, #0071e3 0%, #5e5ce6 100%); color: #fff; font-size: 34px;
  font-weight: 700; box-shadow: 0 14px 40px rgba(0,113,227,.25); margin-bottom: 8px; }
.gate-t { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.gate-s { color: var(--text-2); }
#gate-form { width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
#gate-form[hidden] { display: none; }
#gate-name { font: inherit; height: 48px; border-radius: var(--r-thumb); border: 1px solid var(--faint);
  padding: 0 14px; background: var(--surface); outline: none; text-align: center; }
#gate-go { height: 48px; border-radius: var(--r-thumb); }
.gate-err { color: var(--danger); font-size: 14px; }

/* ── sheets ── */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.28); opacity: 0;
  pointer-events: none; transition: opacity .25s ease; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-width: 720px; margin: 0 auto;
  max-height: 86vh; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 10px 16px max(24px, var(--bottom)); transform: translateY(calc(100% + 40px));
  transition: transform .4s var(--ease-spring); }
.sheet.open { transform: translateY(0); box-shadow: 0 -8px 40px rgba(0,0,0,.16); }
.grab { width: 38px; height: 5px; border-radius: var(--r-pill); background: var(--faint); margin: 0 auto 14px; }
.sheet-t { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; padding: 0 4px 14px; }
.sec { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase;
  letter-spacing: .02em; padding: 20px 6px 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px;
  position: relative; width: 100%; text-align: left; }
.row-main { flex: 1; display: flex; flex-direction: column; }
.row-t { font-size: 16px; }
.row-s { font-size: 13px; color: var(--text-3); }
.row .av { width: 32px; height: 32px; font-size: 14px; }
.danger { color: var(--danger); }
.cap { font-size: 13px; color: var(--text-2); padding: 10px 6px 0; overflow-wrap: anywhere; }
.toggle { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; flex: none;
  border-radius: var(--r-pill); background: var(--track); position: relative; cursor: pointer;
  transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2);
  transition: transform .25s var(--ease-spring); }
.toggle:checked { background: var(--live); }
.toggle:checked::after { transform: translateX(20px); }
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 84px); z-index: 90;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; background: rgba(29,29,31,.9);
  color: #fff; font-size: 14px; padding: 9px 16px; border-radius: var(--r-pill);
  transition: opacity .2s, transform .3s var(--ease-spring); max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── formatted text (Jarl's answers) ── */
.md p { margin: 0 0 8px; }
.md > :last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 2px 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; padding-left: 2px; }
.md li::marker { color: var(--text-3); }
.md .lead, .md h4 { font-weight: 650; font-size: 15px; margin: 12px 0 4px; letter-spacing: -0.01em; }
.md > .lead:first-child, .md > h4:first-child { margin-top: 0; }
.md code { font: 14px ui-monospace, 'SF Mono', Menlo, monospace; background: var(--hover);
  border: 1px solid var(--hairline); border-radius: 6px; padding: 0 4px; }
.md strong { font-weight: 650; }
.m.mine .md code { background: rgba(255,255,255,.18); border-color: transparent; }

/* ── Jarl: a full-width card with its avatar, not a narrow bubble ── */
.m .who .av { width: 20px; height: 20px; font-size: 11px; }
.m .who-n { font-weight: 600; color: var(--text-2); }
.m.bot { max-width: 100%; align-self: stretch; }
.m.bot .b { border-radius: var(--r-card); padding: 12px 15px; font-size: 15.5px; line-height: 1.45;
  border: 1px solid var(--hairline); box-shadow: none; }

/* ── wide screens: rooms left, room right ── */
body.wide #app { max-width: 1280px; display: grid; grid-template-columns: 340px 1fr;
  grid-template-rows: minmax(0, 1fr); }   /* one window-high row: the thread scrolls, not the page */
body.wide #v-rooms { border-right: 1px solid var(--hairline); }
body.wide #v-rooms .nav-c { position: relative; flex: none; border-bottom-color: var(--hairline); }
body.wide #v-rooms .nav-c-t { opacity: 1; }
body.wide #v-rooms .lt { display: none; }
body.wide #v-rooms .scroll { padding-top: 12px; }
body.wide .back { visibility: hidden; }
body.wide .msgs { padding: 18px 28px 12px; }
body.wide .m { max-width: 64%; }
body.wide .m.bot { max-width: 760px; align-self: flex-start; }
body.wide .composer { padding: 10px 28px max(12px, var(--bottom)); }
.room.on { background: var(--hover); }
.room.on .room-n { color: var(--accent); }
.empty-pane { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-3); }
.empty-pane .mark { width: 56px; height: 56px; font-size: 26px; border-radius: 16px; margin: 0; }

/* ── replies, edits, deletes ── */
.q { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; max-width: 100%; margin: 2px 0 4px;
  padding: 6px 10px 6px 12px; border-left: 3px solid var(--accent); border-radius: 4px 12px 12px 4px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); text-align: left; cursor: pointer; }
.q.gone { border-left-color: var(--faint); }
.q-n { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.q.gone .q-n { color: var(--text-3); }
.q-t { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px; }
.q.gone .q-t { font-style: italic; }
.m.mine .q { align-self: flex-end; }
.b.tomb { font-style: italic; color: var(--text-3); background: transparent; box-shadow: inset 0 0 0 1px var(--hairline); }
.m.mine .b.tomb { background: transparent; color: var(--text-3); }
.m.flash > .b, .m.flash > .gal { animation: flash 1.2s ease; }
@keyframes flash { 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); } }
.ctx { display: flex; align-items: center; gap: 8px; padding: 6px 6px 2px 12px; border-left: 3px solid var(--accent);
  margin: 0 2px; }
.ctx[hidden] { display: none; }
.ctx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctx-k { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.ctx-t { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-x { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.ctx-x:hover { background: var(--track); }
.cf-s { color: var(--text-2); font-size: 15px; padding: 0 4px 18px; }
.cf-a { display: flex; gap: 10px; justify-content: flex-end; padding: 0 4px; }
.btn.danger-btn { background: var(--danger); color: #fff; }
.hb-sep { width: 1px; height: 20px; background: var(--hairline); margin: 0 3px; }
.hb .hb-act { color: var(--text-2); }
.hb .hb-act[hidden] { display: none; }

/* ── mentions ── */
.at { font-weight: 600; color: var(--accent); }
.m.mine .b .at { color: #fff; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.at.me { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 5px; padding: 0 3px; }
.m.at-me > .b { box-shadow: inset 3px 0 0 var(--accent), var(--sh-card); }
.mention-pop { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); max-width: 360px; z-index: 20;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; padding: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.mention-pop[hidden] { display: none; }
.composer { position: relative; }
.mp { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 10px;
  text-align: left; font-size: 15px; }
.mp .av { width: 26px; height: 26px; font-size: 12px; }
.mp.on, .mp:hover { background: var(--track); }

/* ── typing, unread, jump ── */
.typing { flex: none; display: flex; align-items: center; gap: 8px; padding: 2px 18px 4px; font-size: 13px;
  color: var(--text-3); }
.typing[hidden] { display: none; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.unread-div { display: flex; align-items: center; gap: 10px; margin: 14px 4px 6px; color: var(--accent);
  font-size: 12px; font-weight: 600; }
.unread-div::before, .unread-div::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
.jump { position: absolute; right: 16px; bottom: calc(var(--bottom) + 84px); z-index: 15; height: 38px; min-width: 38px;
  padding: 0 10px; border-radius: var(--r-pill); display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--hairline); box-shadow: 0 6px 20px rgba(0,0,0,.14);
  font-size: 13px; font-weight: 600; }
.jump[hidden] { display: none; }
.jump.has-n { background: var(--accent); color: #fff; border-color: transparent; }

/* ── link cards ── */
.lp { display: flex; flex-direction: column; width: 300px; max-width: 100%; margin-top: 4px; border-radius: 14px;
  overflow: hidden; background: var(--surface); border: 1px solid var(--hairline); color: var(--text); }
.m.mine .lp { align-self: flex-end; }
.lp img { width: 100%; aspect-ratio: 1.91; object-fit: cover; display: block; background: var(--track); }
.lp-t { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 11px; }
.lp-s { font-size: 12px; color: var(--text-3); text-transform: lowercase; }
.lp-h { font-size: 14.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.lp-d { font-size: 13px; color: var(--text-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.lp:hover .lp-h { text-decoration: underline; }

/* ── dark: follows the device (the Jarl app is dark) ── */
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --surface: #1c1c1e; --hover: #2c2c2e; --text: #f5f5f7; --text-2: #aeaeb2;
    --text-3: #8e8e93; --text-4: #636366; --faint: #3a3a3c; --hairline: rgba(255,255,255,0.1);
    --track: #3a3a3c; --accent: #0a84ff; --live: #30d158;
    --sh-card: none; --sh-panel: none; }
  .nav-c, .bar { background: rgba(0,0,0,.72); }
  .composer { background: rgba(0,0,0,.82); }
  .composer textarea { border-color: #3a3a3c; }
  .panel { border: 1px solid var(--hairline); }
  .m.mine .b { background: #0a84ff; }
  .sheet { background: #000; }
  .toast { background: rgba(58,58,60,.95); }
  .ai { border-color: rgba(10,132,255,.5); }
  .hb { box-shadow: 0 4px 18px rgba(0,0,0,.5); }
  .rq { background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .scrim, .toast, .toggle::after { transition-duration: .01ms; }
  .hb, .viewer, .send.wait, .dots i, .m.flash > .b, .m.flash > .gal { animation: none; }
}
