/* ============================================================
   OSINTABUSE-black theme. All colors are CSS variables so an
   Appearance Studio can override them per user with no reload.
   System font stack = zero font downloads = fast on Chromebooks.
   ============================================================ */
:root {
  --bg:        #050505;
  --sidebar:   #0b0b0b;
  --panel:     #111111;
  --elevated:  #181818;
  --border:    #292929;
  --border-soft:#1d1d1d;
  --text:      #f5f5f5;
  --text-2:    #999999;
  --muted:     #666666;
  --hover:     #202020;
  --btn:       #ffffff;
  --btn-text:  #080808;
  --accent:    #f5f5f5;
  --danger:    #e5484d;
  --ok:        #3ba55d;
  --idle:      #d9a441;
  --dnd:       #e5484d;
  --radius:    10px;
  --radius-sm: 7px;
  --gap:       14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 8px 30px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--text); text-decoration: none; }
a:hover { color: #fff; }
h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; margin: 0 0 .4em; }
h1 { font-size: 2.1rem; }
::selection { background: #2a2a2a; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #242424; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--btn); color: var(--btn-text);
  border: 1px solid var(--btn); font-weight: 600; font-size: .92rem;
  cursor: pointer; transition: transform .06s ease, opacity .15s ease, background .15s ease;
  font-family: inherit; white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--hover); opacity: 1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: transparent; color: var(--danger); border-color: #3a2122; }
.btn.danger:hover { background: #2a1516; }
.btn.sm { padding: 6px 11px; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- inputs ---------- */
input, textarea, select {
  width: 100%; padding: 11px 13px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: inherit; font-size: .95rem; outline: none;
  transition: border-color .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: #3d3d3d; }
input::placeholder, textarea::placeholder { color: var(--muted); }
label { display: block; font-size: .8rem; color: var(--text-2); margin: 0 0 6px; font-weight: 500; }
.field { margin-bottom: 14px; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .82rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.error-text { color: var(--danger); font-size: .85rem; min-height: 1.1em; }
.ok-text { color: var(--ok); font-size: .85rem; }

/* ---------- avatar + presence ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 650; font-size: .85rem;
  background: var(--elevated); color: var(--text); border: 1px solid var(--border);
  position: relative; text-transform: uppercase;
}
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }
.avatar.has-img img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* profile cards: banner + overlapping avatar */
.profile-head { position: relative; margin: -4px -4px 0; }
.profile-banner { height: 96px; border-radius: var(--radius-sm); background: linear-gradient(135deg, #1c1c1c, #2a2a2a); background-size: cover; background-position: center; }
.profile-avatar { display: flex; justify-content: center; margin-top: -38px; position: relative; z-index: 2; }

/* Animated "hacker" banners: falling code + scanlines + glitching terminal title (pure CSS). */
.profile-banner.hk { --hk: #39ff7a; --hk-dim: #0a3d1c; --hk-bg: #010a04; position: relative; overflow: hidden; background: radial-gradient(120% 140% at 50% 0%, var(--hk-dim) 0%, var(--hk-bg) 70%); }
.profile-banner.hk.hacker-red { --hk: #ff4d5e; --hk-dim: #3d0a10; --hk-bg: #0a0103; }
.profile-banner.hk.hacker-blue { --hk: #48d6ff; --hk-dim: #0a2a3d; --hk-bg: #01060a; }
.hk-rain { position: absolute; inset: 0; }
.hk-rain span { position: absolute; top: 0; writing-mode: vertical-rl; text-orientation: upright; font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: 1px; color: var(--hk); text-shadow: 0 0 6px var(--hk); animation: hk-fall linear infinite; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 25%); mask-image: linear-gradient(to bottom, transparent, #000 25%); }
/* columns are ~110px tall; fall from just above the 96px banner to just below it */
@keyframes hk-fall { from { transform: translateY(-115px); } to { transform: translateY(100px); } }
.hk-scan { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0,0,0,.35) 0 1px, transparent 1px 3px); animation: hk-flicker 4s steps(1) infinite; }
@keyframes hk-flicker { 0%, 100% { opacity: 1; } 47% { opacity: .85; } 48% { opacity: 1; } 82% { opacity: .9; } }
.hk-title { position: absolute; left: 12px; top: 10px; font-family: var(--mono); font-weight: 700; font-size: 1rem; color: var(--hk); text-shadow: 0 0 8px var(--hk); background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 4px; animation: hk-glitch 3.2s infinite; }
.hk-title::before, .hk-title::after { content: attr(data-text); position: absolute; left: 8px; top: 2px; opacity: 0; }
.hk-title::before { color: #ff2bd6; animation: hk-split-a 3.2s infinite; }
.hk-title::after { color: #2bf3ff; animation: hk-split-b 3.2s infinite; }
@keyframes hk-glitch { 0%, 88%, 100% { transform: none; } 89% { transform: translate(-2px, 1px) skewX(-8deg); } 91% { transform: translate(2px, -1px); } 93% { transform: none; } }
@keyframes hk-split-a { 0%, 88%, 94%, 100% { opacity: 0; transform: none; } 89%, 92% { opacity: .8; transform: translate(-3px, 0); clip-path: inset(10% 0 55% 0); } }
@keyframes hk-split-b { 0%, 88%, 94%, 100% { opacity: 0; transform: none; } 90%, 93% { opacity: .8; transform: translate(3px, 0); clip-path: inset(55% 0 5% 0); } }
.hk-cursor { font-style: normal; animation: hk-blink 1s steps(1) infinite; }
@keyframes hk-blink { 50% { opacity: 0; } }
.hk-status { position: absolute; right: 10px; bottom: 8px; font-family: var(--mono); font-size: .62rem; letter-spacing: .18em; color: var(--hk); background: rgba(0,0,0,.6); border: 1px solid var(--hk); padding: 1px 6px; border-radius: 3px; animation: hk-blink 2.4s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .hk-rain span { transform: translateY(15%); } }

/* Hacker profile card themes: black terminal card around the user's own banner image. */
.modal.pc-theme { --pc: #39ff7a; --pc-dim: #39ff7a55; --pc-faint: #39ff7a14; position: relative; overflow: hidden auto; background: #000; border: 1px solid var(--pc-dim); box-shadow: 0 0 0 1px #000, 0 0 28px var(--pc-faint), inset 0 0 40px var(--pc-faint); font-family: var(--mono); color: #d8ffe4; }
.modal.pc-theme.pc-hacker-red { --pc: #ff4d5e; --pc-dim: #ff4d5e55; --pc-faint: #ff4d5e14; color: #ffe0e3; }
.modal.pc-theme.pc-hacker-blue { --pc: #48d6ff; --pc-dim: #48d6ff55; --pc-faint: #48d6ff14; color: #dff7ff; }
.modal.pc-theme::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px); }
.modal.pc-theme::after { content: ''; position: absolute; inset: 6px; pointer-events: none; z-index: 3; border: 1px solid transparent;
  background: linear-gradient(var(--pc), var(--pc)) top left / 14px 1px no-repeat, linear-gradient(var(--pc), var(--pc)) top left / 1px 14px no-repeat,
              linear-gradient(var(--pc), var(--pc)) top right / 14px 1px no-repeat, linear-gradient(var(--pc), var(--pc)) top right / 1px 14px no-repeat,
              linear-gradient(var(--pc), var(--pc)) bottom left / 14px 1px no-repeat, linear-gradient(var(--pc), var(--pc)) bottom left / 1px 14px no-repeat,
              linear-gradient(var(--pc), var(--pc)) bottom right / 14px 1px no-repeat, linear-gradient(var(--pc), var(--pc)) bottom right / 1px 14px no-repeat; }
.pc-term { font-family: var(--mono); font-size: .74rem; color: var(--pc); opacity: .85; margin: -2px 0 8px; }
.pc-term-name { color: #fff; }
.pc-theme .profile-banner { border: 1px solid var(--pc-dim); filter: saturate(.85) contrast(1.05); position: relative; }
.pc-theme .profile-banner::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, transparent 40%, #000c), repeating-linear-gradient(to bottom, rgba(0,0,0,.25) 0 1px, transparent 1px 3px); }
.pc-theme .profile-avatar .avatar.lg { border-color: #000; box-shadow: 0 0 0 2px var(--pc), 0 0 18px var(--pc-dim); }
.pc-theme h2 { font-family: var(--mono); letter-spacing: .02em; }
.pc-theme .pc-name { position: relative; color: #fff; text-shadow: 0 0 10px var(--pc-dim); animation: hk-glitch 4s infinite; display: inline-block; }
.pc-theme .pc-name::before, .pc-theme .pc-name::after { content: attr(data-text); position: absolute; left: 0; top: 0; opacity: 0; }
.pc-theme .pc-name::before { color: #ff2bd6; animation: hk-split-a 4s infinite; }
.pc-theme .pc-name::after { color: #2bf3ff; animation: hk-split-b 4s infinite; }
.pc-theme .muted, .pc-theme .text-2 { color: color-mix(in srgb, var(--pc) 55%, #888); }
.pc-theme .profile-status { color: var(--pc); }
.pc-theme .profile-status::before { content: '> '; opacity: .7; }
.pc-theme .badge { background: #000; border-color: var(--pc-dim); }
.pc-theme .mutual { border-top-color: var(--pc-faint); }
.pc-theme .mutual-chip { border-color: var(--pc-dim); background: #000; color: var(--pc); }
.pc-theme .btn { font-family: var(--mono); border-radius: 4px; }
.pc-theme .btn:not(.secondary):not(.ghost):not(.danger) { background: var(--pc); color: #000; border-color: var(--pc); box-shadow: 0 0 14px var(--pc-dim); }
.pc-theme .btn.secondary { background: #000; color: var(--pc); border-color: var(--pc-dim); }
.pc-theme .btn.ghost { color: var(--pc); }
.pc-theme textarea, .pc-theme input, .pc-theme select { background: #000; border-color: var(--pc-dim); color: #fff; font-family: var(--mono); caret-color: var(--pc); }
.pc-theme textarea::placeholder { color: color-mix(in srgb, var(--pc) 40%, #555); }
.pc-theme .icon-btn { color: var(--pc); }
.pc-theme .profile-head, .pc-theme .center, .pc-theme .stack, .pc-theme .mutual { position: relative; z-index: 4; }
.profile-avatar .avatar.lg { border: 3px solid var(--panel); box-sizing: content-box; }
.profile-status { margin-top: 6px; font-size: .88rem; color: var(--text-2); }
.mutual { border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 6px; }
.mutual-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mutual-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 3px 8px 3px 3px; border: 1px solid var(--border); border-radius: 999px; }
.mutual-chip .avatar { width: 22px; height: 22px; font-size: .6rem; }
.toggle { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .9rem; }
.toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ok); flex: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg label { display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input + span { display: block; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .88rem; }
.seg input:checked + span { border-color: #e9cf7a; background: #19160a; }
.disc-list { max-height: 260px; overflow-y: auto; }
.disc-row { padding: 8px 2px; border-bottom: 1px solid var(--border-soft); }

/* reactions, read receipts, typing, voice */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.react-chip { font-size: .8rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--elevated); color: var(--text); cursor: pointer; }
.react-chip.mine { border-color: #4c7dff; background: #111a33; }
.react-pop { position: fixed; z-index: 60; display: flex; gap: 2px; padding: 4px; background: var(--elevated); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow); }
.react-pop button { border: 0; background: none; font-size: 1.25rem; padding: 4px 6px; border-radius: 50%; cursor: pointer; }
.react-pop button:hover { background: var(--hover); transform: scale(1.15); }
.seen { font-size: .72rem; color: var(--muted); text-align: right; padding: 0 18px; min-height: 0; }
.seen:empty { display: none; }
.typing-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: tdot 1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.voice-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 6px; border: 1px solid #3a2122; background: #1a0e0f; border-radius: var(--radius-sm); font-size: .88rem; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: tdot 1s infinite; }
#voice-btn.recording { background: #2a1516; border-color: var(--danger); }
.voice-msg { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.voice-msg audio { height: 36px; max-width: min(300px, 70vw); }
.presence-dot {
  width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--sidebar);
  position: absolute; right: -2px; bottom: -2px; background: var(--muted);
}
.presence-dot.online { background: var(--ok); }
.presence-dot.idle { background: var(--idle); }
.presence-dot.dnd { background: var(--dnd); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .68rem;
  font-weight: 700; padding: 2px 7px; border-radius: 20px; letter-spacing: .02em;
  border: 1px solid var(--border); color: var(--text-2); background: var(--elevated);
  vertical-align: middle;
}
.badge.founder {
  color: #0a0a0a;
  background: linear-gradient(135deg, #ffffff 0%, #d7d7d7 45%, #f3f3f3 70%, #bcbcbc 100%);
  border: 1px solid #e9e9e9;
  box-shadow: 0 0 10px rgba(255,255,255,.12);
}
.badge.role-owner { color: #e9cf7a; border-color: #3a331c; background: #1a1708; }
.badge.role-admin { color: #cdd3ff; border-color: #262a4a; background: #0e1026; }
.badge.role-moderator { color: #a9e4c0; border-color: #1c3a2a; background: #0a1a12; }

/* ---------- topbar (public pages) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 5vw, 48px); border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; background: rgba(5,5,5,.8); backdrop-filter: blur(8px); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--text); color: var(--bg); font-weight: 800;
}

/* ---------- layout helpers ---------- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 24px); }
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }

/* ============================================================
   CHAT APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: 76px 300px 1fr; grid-template-rows: minmax(0, 1fr); height: 100dvh; overflow: hidden; }

/* rail (far-left: switch between DMs and each group) */
.rail {
  background: #070707; border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; overflow-y: auto;
}
.rail-btn {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--elevated); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; font-weight: 700; transition: border-radius .15s ease, background .15s ease; position: relative;
  text-transform: uppercase; font-size: .9rem;
}
.rail-btn:hover { border-radius: 12px; background: var(--hover); }
.rail-btn.active { border-color: #4a4a4a; background: #222; border-radius: 12px; }
.rail-btn.add { color: var(--text-2); font-size: 1.4rem; font-weight: 400; }
.rail-sep { width: 28px; height: 1px; background: var(--border); margin: 2px 0; }

/* middle column: list of conversations/members */
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head { padding: 16px; border-bottom: 1px solid var(--border-soft); font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-scroll { overflow-y: auto; padding: 8px; flex: 1; }
.sidebar-section { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 6px; font-weight: 700; }

.list-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-2); transition: background .12s ease; min-width: 0;
}
.list-item:hover { background: var(--hover); color: var(--text); }
.list-item.active { background: var(--elevated); color: var(--text); }
.list-item .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.list-item .sub { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .col { min-width: 0; flex: 1; }

/* main chat column */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.chat-head {
  height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border-soft); background: var(--panel);
}
.chat-head .title { font-weight: 650; display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-head .title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.messages { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 2px; }
.msg { display: flex; gap: 12px; padding: 5px 8px; border-radius: 8px; }
.msg:hover { background: #0c0c0c; }
.msg:hover .msg-actions { opacity: 1; }
.msg .avatar { width: 40px; height: 40px; }
.msg.cont { padding-top: 1px; padding-bottom: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; }
.msg-meta .author { font-weight: 600; }
.msg-meta .time { font-size: .7rem; color: var(--muted); }
.msg-text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg-text.deleted { color: var(--muted); font-style: italic; }
.msg-text .edited { font-size: .66rem; color: var(--muted); margin-left: 6px; }
.msg-actions { opacity: 0; display: flex; gap: 2px; transition: opacity .1s; }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer; border-radius: 6px; padding: 4px 7px; font-size: .78rem; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.composer { flex: none; padding: 12px 16px 16px; border-top: 1px solid var(--border-soft); }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { resize: none; max-height: 160px; min-height: 44px; background: var(--elevated); }

.composer .attach-btn { height: 44px; width: 44px; font-size: 1.3rem; flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--elevated); }
.composer .attach-btn:hover { background: var(--hover); color: var(--text); }
#attach-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.chip-thumb { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.chip-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.chip-ic { font-size: 1.1rem; }
.msg-img { max-width: min(340px, 72vw); max-height: 300px; border-radius: 10px; margin-top: 5px; border: 1px solid var(--border); display: block; cursor: pointer; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; margin-top: 5px; padding: 9px 12px; background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); max-width: 320px; }
.file-chip:hover { background: var(--hover); }
.messages.drop-hot { outline: 2px dashed #3d3d3d; outline-offset: -8px; border-radius: 10px; }

/* member panel (inside group) */
.members-panel { width: 240px; border-left: 1px solid var(--border-soft); background: var(--sidebar); overflow-y: auto; padding: 10px; flex: none; }

/* empty state */
.empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px; }
.empty .big { font-size: 1.1rem; color: var(--text-2); margin-bottom: 6px; }

.feed-tagline { margin-left: 4px; font-weight: 400; white-space: nowrap; }
@media (max-width: 600px) { .feed-tagline { display: none; } }

/* TikTok feed: one video per screen, snap scrolling */
.feed { flex: 1 1 0; min-height: 0; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; }
.feed-card { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 14px 12px; box-sizing: border-box; }
/* Phone-sized player: fits on a Chromebook screen with room for the caption below. */
.feed-player { flex: 0 1 auto; height: 100%; max-height: min(560px, calc(100% - 70px)); min-height: 0; aspect-ratio: 9 / 16; max-width: min(100%, 315px); border-radius: var(--radius-sm); overflow: hidden; background: #000; border: 1px solid var(--border-soft); }
.feed-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.feed-placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: 2.4rem; color: #333; }
.feed-meta { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 4px; flex: none; }
.feed-caption { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.site-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 70; margin-top: 8px; max-width: min(720px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: #19160a; border: 1px solid #4a3b0f; color: #ffe08a; border-radius: 999px; font-size: .88rem; box-shadow: var(--shadow); }
.clickable { cursor: pointer; }
.msg-meta .author.clickable:hover { text-decoration: underline; }

/* replies + mentions */
.composer { position: relative; }
.reply-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .82rem; padding: 6px 10px; margin-bottom: 6px; border-left: 2px solid var(--text-2); background: var(--elevated); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.reply-bar > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-ref { display: block; max-width: 100%; text-align: left; background: none; border: 0; padding: 0 0 2px; color: var(--text-2); font-size: .78rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-ref:hover { color: var(--text); }
.mention { background: #1f2547; color: #c9d1ff; border-radius: 4px; padding: 0 3px; font-weight: 600; }
.mention.me { background: #4a3b0f; color: #ffe08a; }
.msg.mentioned { background: #19160a; box-shadow: inset 2px 0 0 #e9cf7a; }
.msg.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { background: #2a2a2a; } }
.mention-pop { position: absolute; bottom: 100%; left: 12px; right: 12px; max-width: 360px; background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 4px; z-index: 10; margin-bottom: 4px; }
.mention-opt { padding: 6px 8px; border-radius: 5px; cursor: pointer; }
.mention-opt.sel, .mention-opt:hover { background: var(--hover); }

/* mini-games */
.game { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); padding: 12px; margin-top: 4px; max-width: 440px; display: flex; flex-direction: column; gap: 8px; }
.g-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.g-title { font-weight: 700; }
.g-status { font-size: .84rem; color: var(--text-2); }
.g-players { display: flex; flex-wrap: wrap; gap: 6px; }
.g-chip { font-size: .78rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.g-chip.me { color: var(--text); }
.g-chip.turn { border-color: #e9cf7a; color: #ffe08a; }
.g-foot { display: flex; gap: 6px; flex-wrap: wrap; }
.g-foot:empty { display: none; }
.g-board { display: flex; flex-direction: column; gap: 8px; overflow-x: auto; }
.g-grid { display: grid; gap: 3px; width: max-content; }
.g-cell { border: 1px solid var(--border-soft); background: var(--elevated); border-radius: 5px; font-size: 1.05rem; padding: 0; display: grid; place-items: center; color: var(--text); cursor: default; }
.g-grid.tictactoe .g-cell { font-size: 1.7rem; }
.g-grid.gomoku .g-cell { font-size: .8rem; border-radius: 3px; }
.g-cell.can { cursor: pointer; }
.g-cell.can:hover { background: var(--hover); border-color: #4a4a4a; }
.g-cell.last { border-color: #e9cf7a; }
.g-grid.reversi .g-cell { background: #0d2416; border-color: #173a24; }
.g-grid.reversi .g-cell.can::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #3ba55d88; }
.g-cell.card { font-size: 1.5rem; }
.g-cell.card.matched { opacity: .45; }
.g-cell.card.up { background: #1d1d1d; }
.dots { display: grid; width: max-content; }
.d-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.d-h, .d-v { border: 0; padding: 0; background: #222; border-radius: 3px; }
.d-h { height: 6px; align-self: center; }
.d-v { width: 6px; justify-self: center; }
.d-h:not(:disabled):hover, .d-v:not(:disabled):hover { background: #666; cursor: pointer; }
.d-h.p0, .d-v.p0 { background: #4c7dff; }
.d-h.p1, .d-v.p1 { background: #e5484d; }
.d-box { display: grid; place-items: center; font-size: 1.1rem; }
.g-q { font-weight: 600; }
.g-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.g-last { font-size: .82rem; color: var(--text-2); }
.g-big { font-size: 2rem; font-weight: 700; letter-spacing: .06em; }
.g-word { font-family: var(--mono); font-size: 1.4rem; letter-spacing: .1em; }
.g-keys { display: flex; flex-wrap: wrap; gap: 4px; }
.g-key { width: 30px; height: 30px; border-radius: 5px; border: 1px solid var(--border); background: var(--elevated); color: var(--text); cursor: pointer; padding: 0; }
.g-key:disabled { opacity: .3; cursor: default; }
.g-guess { display: flex; gap: 6px; }
.g-wyr { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--elevated); color: var(--text); cursor: pointer; }
.g-wyr.picked { border-color: #e9cf7a; }
.game-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 8px; }
.game-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--elevated); color: var(--text); cursor: pointer; font-size: .82rem; }
.game-tile:hover { background: var(--hover); border-color: #4a4a4a; }
.gt-emoji { font-size: 1.6rem; }

/* typing indicator */
.typing { font-size: .76rem; color: var(--muted); padding: 2px 16px 6px; height: 20px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { width: 100%; max-width: 460px; max-height: 88dvh; overflow-y: auto; }
.modal h2 { font-size: 1.2rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* toast */
.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--elevated); border: 1px solid var(--border); padding: 10px 16px; border-radius: var(--radius-sm); font-size: .88rem; box-shadow: var(--shadow); animation: pop .2s ease; }
.toast.err { border-color: #3a2122; color: #ff9ea1; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.code-pill { font-family: var(--mono); background: var(--elevated); border: 1px solid var(--border); padding: 3px 9px; border-radius: 6px; letter-spacing: .12em; font-size: .9rem; }

/* ---------- responsive: phones & small Chromebooks ---------- */
.menu-toggle { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; position: relative; }
  .rail, .sidebar { position: fixed; top: 0; bottom: 0; z-index: 30; transition: transform .2s ease; }
  .rail { left: 0; width: 72px; transform: translateX(-100%); }
  .sidebar { left: 72px; width: min(78vw, 300px); transform: translateX(-120%); }
  .app.nav-open .rail { transform: translateX(0); }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
  .menu-toggle { display: grid; }
  .members-panel { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
