/* Light workspace, navy sidebar, one blue accent. */
:root {
  color-scheme: light;
  --bg: #ffffff; --soft: #f6f7f9; --panel: #ffffff; --panel2: #f1f3f6; --line: #e4e7ec;
  --text: #101828; --body: #344054; --muted: #667085;
  --accent: #2456d6; --accent-hover: #1c47b5; --accent-soft: #edf2fd;
  --ok: #067647; --ok-soft: #ecfdf3; --danger: #b42318; --danger-soft: #fef3f2;
  --navy: #0f1b2d;
  --m: #1d4ed8; --f: #a21c5b; --o: #475467;
  --r: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .18);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Noto Sans Tamil", "Noto Sans Telugu", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.5 var(--font); -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.brand.small { font-size: 17px; }
.brand-mark { width: 30px; height: 30px; flex: none; background: url(/icons/mark.svg) center / contain no-repeat; }
.wm { display: block; width: auto; height: 1.4em; overflow: visible; --dot: #ffcf4a; }
.wm-dot { fill: var(--dot); }
.brand.small .wm { height: 27px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #12b76a; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--r); background: var(--panel); color: var(--body); border: 1px solid #d0d5dd; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn.primary, .btn.ok { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover, .btn.ok:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: #fda29b; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.big { width: 100%; padding: 11px; font-size: 15px; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.only-mobile { display: none; }

input, select, textarea { width: 100%; background: var(--panel); border: 1px solid #d0d5dd; border-radius: var(--r); padding: 9px 12px; box-shadow: var(--shadow); }
input::placeholder, textarea::placeholder { color: #98a2b3; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 214, .16); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--body); }
label > input, label > select, label > textarea { margin-top: 5px; color: var(--text); font-weight: 400; font-size: 14.5px; }

/* ---------- sign-in ---------- */
#auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.auth-hero { background: var(--navy); color: #fff; padding: 40px clamp(24px, 5vw, 72px); display: flex; flex-direction: column; }
.auth-hero-in { margin: auto 0; padding: 40px 0; max-width: 560px; }
.auth-hero h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.15; font-weight: 700; letter-spacing: -.022em; margin-bottom: 14px; }
.tagline { color: #b6c2d6; font-size: 16px; max-width: 48ch; }
.features { list-style: none; margin: 34px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.features b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.features span { display: block; font-size: 13px; color: #98a8c0; }
.features li { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 12px; display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 11px; align-content: start; }
.features li > b, .features li > span:not(.fi) { grid-column: 2; }
.features .fi { grid-column: 1; grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #9db8ff; display: flex; align-items: center; justify-content: center; }

/* the Vybingo name and line on the sign-in page */
.auth-brand { display: flex; align-items: center; gap: 15px; }
.auth-brand .brand-mark { width: 62px; height: 62px; filter: drop-shadow(0 10px 18px rgba(122, 63, 224, .38)); }
.auth-brand b { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.auth-brand .wm { height: 49px; margin: -2px 0 -1px; }
.auth-brand small { display: flex; align-items: center; gap: 8px; margin-left: 2px; font-size: 13px; letter-spacing: .012em; color: #b6c2d6; }
.auth-brand.phone { display: none; }
.auth-hero h1 em { font-style: normal; background: linear-gradient(90deg, #7ea2ff, #c58bff 55%, #ff85b3); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; height: 100%; border-radius: 2px; background: linear-gradient(#ff85b3, #7a5cf0); transform-origin: bottom; animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.7s; }
.eq i:nth-child(3) { animation-delay: -.35s; }
.eq i:nth-child(4) { animation-delay: -.9s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; } .eq i:nth-child(odd) { transform: scaleY(.6); } }

/* people saying hello */
.crowd { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.auth-hero .crowd { margin-top: 26px; }
.hello { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.hello:nth-child(even) { margin-bottom: 8px; }
.say { position: relative; background: #fff; color: #101828; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 12px; white-space: nowrap; box-shadow: 0 2px 8px rgba(16, 24, 40, .14); }
.say::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: #fff; transform: translateX(-50%) rotate(45deg); }
.face { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; display: block; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18); }
.blank { text-align: center; padding: 48px 20px 20px; }
.blank .crowd { justify-content: center; margin-bottom: 18px; }
.blank .say { border: 1px solid var(--line); }
.blank .say::after { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.blank .face { box-shadow: 0 0 0 1px var(--line); }
.blank b { font-size: 15.5px; }
.blank p { color: var(--muted); }
.rooms-h { margin: 34px 0 10px; display: flex; align-items: center; gap: 9px; font-size: 13px; color: #b6c2d6; }
.rooms-h b { color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .16); font-size: 12.5px; color: #d3dbe8; }
.chip b { margin-left: 6px; color: #75e0a7; font-weight: 600; }
.hero-foot { font-size: 12.5px; color: #7e8fa9; }
.auth-side { background: var(--soft); display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 6px 24px rgba(16, 24, 40, .07); }
.auth-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.auth-top h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.auth-top p { color: var(--muted); font-size: 13.5px; }
.badge18 { border: 1px solid #d0d5dd; color: var(--body); font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 6px; flex: none; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { padding: 8px 4px 10px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
#authForm { display: grid; gap: 13px; }
#guestBtn { margin-top: -4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--accent); box-shadow: none; }
.err { color: var(--danger); font-size: 13.5px; }
.err:empty { display: none; }
.hint { color: var(--muted); font-size: 13px; text-align: center; }
.hint:empty { display: none; }

/* ---------- app shell ---------- */
#app { height: 100dvh; display: grid; grid-template-columns: 248px minmax(0, 1fr) 244px; }
#side, #people { display: flex; flex-direction: column; min-height: 0; }
/* the sidebar redefines the tokens, so everything inside it reads correctly on navy */
#side { --text: #fff; --body: #c5d0e0; --muted: #8696af; --panel2: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .1); background: var(--navy); color: var(--text); }
#people { background: var(--soft); border-left: 1px solid var(--line); }
.side-head, .people-head { display: flex; align-items: center; justify-content: space-between; min-height: 58px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.people-head h3 { font-size: 13px; font-weight: 600; }
.people-head h3 span { color: var(--muted); font-weight: 400; }
.me { margin: 12px 10px 4px; padding: 9px 10px; border-radius: var(--r); background: var(--panel2); display: flex; align-items: center; gap: 10px; text-align: left; }
.me b { font-weight: 600; }
.me small { display: block; color: var(--muted); font-size: 12px; }
#nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.nav-h button { color: var(--body); font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; padding: 2px 7px; border-radius: 5px; }
.nav-h button:hover { background: var(--panel2); color: #fff; }
.item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; text-align: left; color: var(--body); }
.item:hover { background: var(--panel2); color: #fff; }
.item.on { background: var(--accent); color: #fff; }
.item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .ic { color: var(--muted); flex: none; }
.item.on .ic, .item.on .n { color: #fff; }
.badge { background: #d92d20; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.empty { color: var(--muted); font-size: 12.5px; padding: 2px 8px 6px; }
.side-foot { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.side-foot b { color: var(--text); }
.side-foot a { color: var(--body); }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
#head { display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); min-height: 58px; flex: none; }
.head-title { flex: 1; min-width: 0; }
.head-title h2 { font-size: 15.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-title p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; gap: 6px; align-items: center; }
#announce, #offline { padding: 8px 16px; font-size: 13.5px; background: var(--accent-soft); color: #1a3a8f; border-bottom: 1px solid var(--line); }
#offline { background: var(--danger-soft); color: var(--danger); text-align: center; }
#callBar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; background: var(--ok-soft); border-bottom: 1px solid #abefc6; }
#callBar > .ic { color: var(--ok); }
#callBar .who { flex: 1; min-width: 120px; }
#callBar .who small { color: var(--muted); display: block; }

#msgs { flex: 1; overflow-y: auto; padding: 8px 0 6px; overscroll-behavior: contain; }
.msg { display: flex; gap: 11px; padding: 2px 16px; position: relative; }
.msg:hover { background: var(--soft); }
.msg.first { margin-top: 12px; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: block; overflow: hidden; border: 0; padding: 0; background: var(--panel2); }
.av.sm { width: 28px; height: 28px; }
.msg .gap { width: 36px; flex: none; }
.body { min-width: 0; flex: 1; }
.meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.name { font-weight: 600; color: var(--text); }
.name:hover { text-decoration: underline; }
.role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; border-radius: 4px; background: var(--navy); color: #fff; }
.role.mod { background: var(--ok); }
.role.guest { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.meta time { font-size: 11.5px; color: #98a2b3; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--body); }
.msg-act { position: absolute; right: 12px; top: -10px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.msg:hover .msg-act { display: flex; }
.msg-act button { padding: 3px 10px; font-size: 12px; color: var(--muted); }
.msg-act button:hover { color: var(--text); }
.sys { text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px 16px; }
.photo { margin-top: 5px; position: relative; display: inline-block; border-radius: var(--r); overflow: hidden; background: var(--panel2); border: 1px solid var(--line); max-width: min(280px, 70vw); cursor: pointer; }
.photo img { display: block; max-width: 100%; max-height: 300px; min-width: 120px; min-height: 90px; object-fit: cover; }
.photo.blur img { filter: blur(22px); transform: scale(1.1); }
.photo.blur::after { content: "View photo"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; color: #fff; background: rgba(15, 27, 45, .45); }
.gone { display: inline-block; margin-top: 4px; font-size: 12.5px; color: var(--muted); border: 1px dashed #d0d5dd; border-radius: 6px; padding: 4px 10px; }
#typing { height: 18px; padding: 0 16px; font-size: 12px; color: var(--muted); flex: none; }

#composer { display: flex; align-items: flex-end; gap: 4px; margin: 0 14px calc(12px + env(safe-area-inset-bottom)); padding: 5px; border: 1px solid #d0d5dd; border-radius: 10px; box-shadow: var(--shadow); position: relative; }
#composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 214, .14); }
#input { resize: none; max-height: 120px; border: 0; box-shadow: none; padding: 7px 8px; }
.send { width: 36px; height: 36px; border-radius: 7px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.send:hover { background: var(--accent-hover); }
#emojiBox { position: absolute; bottom: calc(100% + 6px); left: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: min(330px, calc(100vw - 28px)); z-index: 5; }
#emojiBox button { font-size: 21px; padding: 4px; border-radius: 6px; }
#emojiBox button:hover { background: var(--panel2); }

#peopleList { flex: 1; overflow-y: auto; padding: 8px; }
.person { width: 100%; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; text-align: left; }
.person:hover { background: #eceff3; }
.person .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.person small { color: var(--muted); font-weight: 400; }
.invoice { color: var(--ok); }

/* ---------- lobby ---------- */
#msgs.in-lobby { padding: 0; background: var(--soft); }
.lobby { padding: 26px 24px 40px; max-width: 1040px; margin: 0 auto; }
.lobby-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lobby h1 { font-size: 22px; font-weight: 700; letter-spacing: -.015em; }
.lobby-top p { color: var(--muted); }
.search { width: min(300px, 100%); }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 20px; }
.action { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: var(--shadow); }
.action:hover { border-color: var(--accent); }
.action > .ic { width: 38px; height: 38px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.action b { display: block; font-weight: 600; }
.action small { display: block; color: var(--muted); font-size: 12.5px; }
.group h4 { margin: 26px 0 10px; font-size: 13px; font-weight: 600; color: var(--body); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); min-width: 0; }
.card:hover { border-color: var(--accent); }
.mono { width: 44px; height: 44px; border-radius: 12px; background: var(--tint); color: var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.script { font-weight: 700; font-size: 19px; line-height: 1; }
.ri { width: 24px; height: 24px; border-radius: 7px; background: var(--tint); color: var(--ink); display: flex; align-items: center; justify-content: center; flex: none; }
.ri .script { font-size: 12px; }
.card .info { min-width: 0; flex: 1; }
.card b { display: block; font-weight: 600; }
.card small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.only { display: inline-block; margin-left: 7px; padding: 0 6px; border-radius: 5px; background: #fde4ee; color: #a21c5b; font-size: 10.5px; font-weight: 700; vertical-align: 1px; white-space: nowrap; }
.card .cnt { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ok); font-weight: 600; flex: none; }

/* ---------- chat window: expanded by default in CSS, a box on the home page when .mini ---------- */
#page, #chatWin { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#roomTabs { display: flex; align-items: stretch; gap: 2px; padding: 6px 10px 0; overflow-x: auto; overflow-y: hidden; background: var(--soft); border-bottom: 1px solid var(--line); flex: none; scrollbar-width: thin; }
.rtab { display: flex; align-items: center; flex: none; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: var(--muted); }
.rtab.on { background: var(--panel); border-color: var(--line); color: var(--text); box-shadow: inset 0 2px 0 var(--accent); margin-bottom: -1px; padding-bottom: 1px; }
.rtab > button:first-child { display: flex; align-items: center; gap: 7px; padding: 7px 9px; font-weight: 600; font-size: 13px; }
.rtab .ri { width: 20px; height: 20px; border-radius: 6px; }
.rtab .ri .script { font-size: 10px; }
.rtab-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtab-x { width: 20px; height: 20px; margin-right: 5px; border-radius: 5px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.rtab-x:hover { background: var(--panel2); color: var(--text); }
.rtab-add { flex: none; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }
#winBar { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 16px; border-bottom: 1px solid var(--line); flex: none; }
#winBar h3 { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app.mini #page { display: block; overflow-y: auto; background: var(--soft); }
#app.mini #chatWin { height: clamp(340px, calc(100dvh - 410px - var(--ad-top, 0px)), 620px); width: min(992px, calc(100% - 48px)); margin: 10px auto 0; background: var(--panel); border: 1px solid #d0d5dd; border-radius: 12px; box-shadow: 0 6px 24px rgba(16, 24, 40, .08); }
#app.mini #roomTabs { border-radius: 11px 11px 0 0; }
#app.mini #composer { margin: 0 10px 10px; }
#app.mini .blank { padding: 14px 16px; }
#app.mini .blank .crowd { margin-bottom: 8px; }
.home-sec { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
#page { container-type: inline-size; }
#homeTop { padding-top: 16px; }
#homeTop .actions { margin-top: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
#homeTop .action { padding: 10px; gap: 10px; }
#homeTop .action > .ic { width: 34px; height: 34px; }
#homeTop .action b { font-size: 13.5px; line-height: 1.3; }
@container (max-width: 900px) { #homeTop .action small { display: none; } }
@container (max-width: 620px) { #homeTop .actions { grid-template-columns: 1fr 1fr; } }
.card.is-open { border-color: #b9ccf5; }
.opened { display: inline-block; margin-left: 7px; padding: 0 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
.item.has-new { color: #fff; font-weight: 700; }
#openSide { position: relative; }
#openSide .badge { position: absolute; top: 0; right: -2px; }

/* ---------- room cards above the chat box ---------- */
#roomDeck { margin-top: 12px; }
.deck-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.deck-head h2 { font-size: 13px; font-weight: 600; color: var(--body); }
.deck-all { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.deck-wrap { position: relative; }
.deck-row { display: flex; align-items: stretch; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 8px; scrollbar-width: none; overscroll-behavior-x: contain; }
.deck-row::-webkit-scrollbar { display: none; }
.rcard { position: relative; flex: 0 0 220px; min-width: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.rcard-join { flex: 0 0 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed #b9ccf5; border-radius: 12px; background: var(--panel); color: var(--accent); }
.rcard-join b { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.rcard-join:hover { border-color: var(--accent); background: var(--accent-soft); }
.rj-plus { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.rcard:hover { border-color: #b9ccf5; box-shadow: 0 4px 14px rgba(16, 24, 40, .09); }
.rcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 14px rgba(36, 86, 214, .12); }
.rc-main { display: block; min-width: 0; text-align: left; padding: 10px 11px 2px; border-radius: 11px 11px 0 0; }
.rc-top { display: flex; align-items: center; gap: 9px; }
.rc-art { flex: none; display: flex; }
.rc-art .mono { width: 34px; height: 34px; border-radius: 10px; }
.rc-art .script { font-size: 15px; }
.rc-id { flex: 1; min-width: 0; display: block; }
.rc-id b { display: block; font-size: 13.5px; font-weight: 650; line-height: 1.3; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-id small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-id small.live::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #12b76a; }
.rc-top .badge { align-self: flex-start; }
.rc-top .badge[hidden] { display: none; }
.rc-line { display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-line strong { font-weight: 600; color: var(--body); }
.rcard.has-new .rc-line { color: var(--text); }
.rc-foot { display: flex; align-items: center; gap: 5px; min-height: 36px; padding: 5px 11px 9px; overflow: hidden; }
.rc-faces { display: flex; flex: none; margin-right: 2px; }
.rc-faces .av { width: 22px; height: 22px; border: 2px solid var(--panel); border-radius: 50%; }
.rc-faces .av + .av { margin-left: -7px; }
.rc-quiet { margin-left: auto; font-size: 11.5px; color: #98a2b3; white-space: nowrap; }
.rc-chip { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.rc-chip.reply { background: #fef4e6; color: #93500b; }
.rc-chip.personal { background: #f4effd; color: #5b34b0; }
.rc-chip.call { background: var(--ok-soft); color: var(--ok); }
.rc-chip:hover { filter: brightness(.96); }
.deck-wrap::before, .deck-wrap::after { content: ''; position: absolute; top: 0; bottom: 0; width: 44px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 1; }
.deck-wrap::before { left: 0; background: linear-gradient(90deg, var(--soft), transparent); }
.deck-wrap::after { right: 0; background: linear-gradient(270deg, var(--soft), transparent); }
.deck-wrap.can-left::before, .deck-wrap.can-right::after { opacity: 1; }
.deck-arrow { position: absolute; top: 50%; z-index: 2; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--panel); border: 1px solid #d0d5dd; color: var(--text); box-shadow: 0 4px 12px rgba(16, 24, 40, .16); }
.deck-arrow[hidden] { display: none; }
.deck-arrow:hover { border-color: var(--accent); color: var(--accent); }
.deck-arrow.prev { left: -12px; }
.deck-arrow.next { right: -12px; }
/* short laptop screens: drop the greeting so the message box stays in view */
@media (min-width: 761px) and (max-height: 820px) {
  #homeTop .lobby-top { display: none; }
  #homeTop .actions { margin-top: 0; }
  #app.mini #chatWin { height: clamp(320px, calc(100dvh - 332px - var(--ad-top, 0px)), 620px); }
}
.msg.to-me { background: #fffaf0; box-shadow: inset 3px 0 0 #f0a339; }
.msg.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 40% { background: #ffe8b8; } }

/* ---------- sidebar tabs: Live, People, Groups ---------- */
#sideMain { padding: 4px 10px 0; }
#sideTabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 8px 10px 0; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, .07); }
#sideTabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 5px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--body); }
#sideTabs button:hover { color: #fff; }
#sideTabs button.on { background: var(--accent); color: #fff; }
#sideTabs .badge { position: absolute; top: -3px; right: 6px; }
#sideSearch { padding: 8px 10px 0; }
#sideSearch input { background: rgba(255, 255, 255, .08); border-color: transparent; color: #fff; padding: 6px 10px; font-size: 13px; box-shadow: none; }
#sideSearch input:focus { border-color: #5b84e8; }
.person-row { display: flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: 6px; }
.person-row:hover { background: var(--panel2); }
.person-row.on { background: var(--accent); }
.person-row .pic { position: relative; flex: none; display: block; }
.person-row .pic .dot { position: absolute; right: -1px; bottom: 0; width: 9px; height: 9px; border: 2px solid var(--navy); }
.person-row .grow { flex: 1; min-width: 0; text-align: left; }
.person-row b { display: block; font-weight: 600; font-size: 13.5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-row small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-row.has-new small { color: #fff; font-weight: 600; }
.person-row.on small { color: #dbe5ff; }
.mini-btn { flex: none; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: #cfdcff; border: 1px solid rgba(255, 255, 255, .22); white-space: nowrap; }
.mini-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.mini-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.sent-tag { font-size: 11.5px; color: var(--muted); }
.request-acts { display: flex; gap: 6px; padding: 2px 6px 8px 43px; }
.side-cta { padding: 8px; }
.item.is-open .grow { color: #fff; }

/* ---------- personal messages ---------- */
.inbox-h { margin: 20px 0 8px; font-size: 13px; font-weight: 600; color: var(--body); }
.conv { width: 100%; text-align: left; gap: 12px; }
.conv:hover { border-color: var(--accent); }
.conv-text { flex: 1; min-width: 0; }
.conv b .dot { margin-left: 7px; }
.conv.unread small { color: var(--text); font-weight: 600; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.conv-side time { font-size: 11.5px; color: var(--muted); }
.earlier { text-align: center; padding: 8px; }

/* ---------- people ---------- */
.invite-note { background: var(--accent-soft); color: #1a3a8f; border-radius: var(--r); padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; }
.ptabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.ptabs button { padding: 8px 12px 10px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ptabs button.on { color: var(--accent); border-color: var(--accent); }
.pfilter { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 8px; margin-bottom: 12px; }
.plist { display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; box-shadow: var(--shadow); }
.prow .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; text-align: left; }
.prow .who > span:last-child { min-width: 0; }
.prow b { display: block; font-weight: 600; }
.prow small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-acts { display: flex; gap: 6px; flex: none; }

/* ---------- stranger chat ---------- */
.stranger-start { max-width: 440px; margin: 0 auto; display: grid; gap: 12px; justify-items: center; }
.stranger-start .crowd { margin-bottom: 4px; }
.stranger-start label { width: 100%; text-align: left; }
.safety { margin: 4px 0 0; padding: 12px 14px 12px 30px; text-align: left; font-size: 13px; color: var(--body); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; width: 100%; display: grid; gap: 5px; }
.spinner { width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.blank .btn:not(.big) { margin-top: 14px; }
.av.mystery { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.share { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 18px 16px 8px; color: var(--muted); font-size: 13px; }

/* ---------- ads ---------- */
.ad { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ad:empty { display: none; }
#app:has(.ad-top:not(:empty)) { --ad-top: 52px; }
.ad-top { min-height: 50px; max-height: 100px; border-bottom: 1px solid var(--line); background: var(--soft); flex: none; }
/* full width, with a little space so a tap on a tab never lands on the ad */
.ad-mid { width: 100%; height: 66px; flex: none; margin-bottom: 4px; background: var(--soft); border-bottom: 1px solid var(--line); }
.ad-mid:empty { display: none; }
@media (max-width: 760px) { .ad-mid { display: none !important; } }
.ad-side { min-height: 250px; margin: 8px; border-radius: var(--r); }
.ad-feed { margin: 12px 16px; min-height: 90px; border-radius: var(--r); }
.ad-ph { width: 100%; height: 100%; min-height: inherit; display: flex; align-items: center; justify-content: center; border: 1px dashed #d0d5dd; border-radius: inherit; color: #98a2b3; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.ad ins { display: block; width: 100%; }
.inter { position: fixed; inset: 0; z-index: 60; background: rgba(255, 255, 255, .98); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
.inter .ad { width: min(340px, 100%); min-height: 280px; }

/* below the chat box; kept clear of the message box so taps are never accidental */
.ad-home { width: min(992px, calc(100% - 48px)); height: 250px; margin: 24px auto 28px; border-radius: var(--r); }
.ad-home:empty { display: none; }
.ad-rail { display: none; }
@media (min-width: 1280px) {
  #app.rail { grid-template-columns: 248px minmax(0, 1fr) 332px; }
  #app.rail #people { display: flex; align-items: center; overflow-y: auto; padding: 16px 0; gap: 16px; }
  #app.rail .people-head, #app.rail #peopleList { display: none; }
  #app.rail .ad-side { width: 300px; height: 250px; min-height: 250px; margin: 0; flex: none; }
  #app.rail .ad-rail { display: flex; width: 300px; height: 600px; flex: none; border-radius: var(--r); }
  #app.rail .ad-rail:empty { display: none; }
}
@media (max-width: 1279px) {
  #app.rail:not(.show-people) { grid-template-columns: 248px minmax(0, 1fr); }
  #app.rail #people { display: none; }
}
@media (max-width: 1100px) { #app.rail:not(.show-people) { grid-template-columns: 236px minmax(0, 1fr); } }
@media (max-width: 760px) {
  #app.rail:not(.show-people) { grid-template-columns: minmax(0, 1fr); }
  .ad-home { width: calc(100% - 16px); margin-top: 28px; }
}

/* ---------- right-hand panel ---------- */
.overlay.side { justify-content: flex-end; align-items: stretch; padding: 0; }
.modal.drawer { width: min(420px, 100%); max-height: none; height: 100dvh; border-radius: 0; animation: slide-in .18s ease-out; }
@keyframes slide-in { from { transform: translateX(100%); } }
.modal.drawer .stack { align-content: start; }
.cards.one { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.modal .inbox-h { margin-top: 8px; }

/* ---------- video ---------- */
#videoStage { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 8px; height: min(38dvh, 340px); padding: 8px; background: var(--navy); flex: none; }
.tile { position: relative; overflow: hidden; border-radius: var(--r); background: #1b2a41; min-width: 0; min-height: 0; padding: 0; cursor: default; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile.mine video { transform: scaleX(-1); }
.tile.blur { cursor: pointer; }
.tile.blur video { filter: blur(26px); }
.tile.off video { display: none; }
.cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 13px; pointer-events: none; }
.tile.off .cover svg { width: 64px; height: 64px; border-radius: 50%; }
.tile-name { position: absolute; left: 8px; bottom: 6px; padding: 1px 8px; border-radius: 5px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }

/* ---------- empty screens sit in the middle of the chat window ---------- */
#msgs > .blank:only-child { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 16px; padding-bottom: 16px; }
#msgs > .blank.stranger-start:only-child { display: grid; align-content: center; }

/* ---------- dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(12, 20, 33, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); color: var(--text); border-radius: 12px; width: min(420px, 100%); max-height: 88dvh; overflow-y: auto; padding: 20px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(560px, 100%); }
.modal h3 { font-size: 17px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal .stack { display: grid; gap: 11px; }
.modal .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.modal .acts .btn { flex: 1; }
.modal p, .modal li { color: var(--body); font-size: 14px; }
.modal ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.code { font: 700 22px/1 ui-monospace, Consolas, monospace; letter-spacing: .14em; text-align: center; padding: 14px; background: var(--soft); border-radius: var(--r); border: 1px solid var(--line); user-select: all; }
.profile { display: flex; align-items: center; gap: 12px; }
.profile .av { width: 56px; height: 56px; }
.light { max-width: 100%; max-height: 80dvh; border-radius: var(--r); }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 70; display: grid; gap: 8px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: #1d2939; color: #fff; border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; box-shadow: var(--shadow-lg); pointer-events: auto; }
.toast.bad { background: #912018; }
#scrim { display: none; }

@media (min-width: 1101px) {
  #app.no-people:not(.rail) { grid-template-columns: 248px minmax(0, 1fr); }
  #app.no-people:not(.rail) #people { display: none; }
}
@media (max-width: 1100px) {
  #app { grid-template-columns: 236px minmax(0, 1fr); }
  #people { position: fixed; top: 0; right: 0; bottom: 0; width: min(280px, 84vw); z-index: 30; transform: translateX(100%); transition: transform .18s; }
  #app.show-people #people { transform: none; }
  #app.show-people #scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(12, 20, 33, .45); }
  #closePeople { display: inline-flex; }
}
@media (max-width: 860px) {
  #auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-side { order: -1; padding: 20px 14px 28px; flex-direction: column; gap: 18px; }
  .auth-brand.phone { display: flex; }
  .auth-brand.phone small { color: var(--muted); font-size: 12px; }
  .auth-brand.phone .wm { --dot: #e0408a; }
  .auth-brand.phone .brand-mark { width: 58px; height: 58px; }
  .auth-hero > .auth-brand { display: none; }
  .auth-hero .crowd { flex-wrap: nowrap; gap: 10px; }
  .auth-hero .hello:nth-child(n+5) { display: none; }
  .auth-hero { padding: 28px 20px; }
  .auth-hero-in { padding: 24px 0; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #side { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-100%); transition: transform .18s; }
  #app.show-side #side { transform: none; }
  #app.show-side #scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(12, 20, 33, .45); }
  .only-mobile { display: inline-flex; }
  .msg-act { display: none !important; }
  .hide-sm { display: none; }
  .features { grid-template-columns: 1fr; gap: 14px; }
  .lobby { padding: 18px 14px 30px; }
  .search { width: 100%; }
  .home-sec { padding-left: 12px; padding-right: 12px; }
  #homeTop .actions { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  #homeTop .action { padding: 8px; gap: 8px; }
  #homeTop .action small, #homeTop .lobby-top p { display: none; }
  #homeTop h1 { font-size: 18px; }
  #homeTop .lobby-top { display: none; }
  #homeTop .actions { margin-top: 0; }
  #roomDeck { margin-top: 8px; }
  .deck-row { scroll-snap-type: x proximity; scroll-padding-left: 2px; }
  .rcard { flex-basis: 190px; scroll-snap-align: start; }
  .rcard-join { flex-basis: 78px; scroll-snap-align: start; }
  .deck-arrow { width: 28px; height: 28px; margin-top: -14px; }
  .deck-arrow.prev { left: -11px; }
  .deck-arrow.next { right: -11px; }
  #app.mini #chatWin { width: calc(100% - 16px); height: max(340px, calc(100dvh - 372px - var(--ad-top, 0px))); margin-top: 8px; }
  #roomTabs { scrollbar-width: none; }
  #roomTabs::-webkit-scrollbar { display: none; }
  #composer { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* stops iOS zooming into fields */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: .01s !important; } }
