:root {
  --bg: #0a0a0b;            /* near-black app background */
  --bg-2: #0f0f11;
  --text: #f4f4f6;
  --text-soft: #9a9aa4;
  --card: #161619;         /* elevated dark card */
  --card-2: #202024;
  --card-3: #2a2a30;
  --card-text: #f4f4f6;
  --card-soft: #9a9aa4;
  --muted: #141417;        /* dark grey surfaces */
  --muted-2: #202024;
  --border: #26262b;
  --border-2: #313138;
  --accent: #00e7ff;       /* active speaker green */
  --accent-ring: #00e7ff;
  --accent-deep: #00e7ff;
  --accent-soft: rgba(34,197,94,.14);
  --danger: #f0555b;
  --danger-soft: rgba(240,85,91,.14);
  --warn: #f5a524;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.4), 0 12px 40px rgba(0,0,0,.35);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(34,197,94,.08), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(34,197,94,.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; }
input, textarea, select { font-family: inherit; font-size: 15px; }
::placeholder { color: #66666f; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: 58px; padding: 0 16px;
  background: rgba(10,10,11,.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent); }
.topbar .spacer { flex: 1; }
.container { max-width: 1120px; margin: 0 auto; padding: 20px 16px 110px; }

/* ---------- Advertisement slot ---------- */
.ad-slot {
  margin: 0 0 18px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border-2); background: var(--muted);
  overflow: hidden; min-height: 0;
}
.ad-slot:empty { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border-2); background: var(--card-2); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--card-3); }
.btn.primary { background: #fff; color: #0a0a0b; border-color: #fff; }
.btn.primary:hover { background: #e9e9ee; }
.btn.green { background: var(--accent); color: #05230f; border-color: var(--accent); font-weight: 700; }
.btn.green:hover { background: var(--accent-ring); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger:hover { background: #e0484e; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--card-2); color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); background: var(--muted); color: var(--text);
}
.input:focus { border-color: var(--accent); background: var(--bg-2); }
textarea.input { resize: vertical; min-height: 80px; }
select.input { color: var(--text); }
option { background: var(--card); color: var(--text); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 400px; margin: 8vh auto; padding: 0 16px; }
.auth-card { background: var(--card); border: 1px solid var(--border); color: var(--card-text); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.auth-card p.sub { margin: 0 0 20px; color: var(--card-soft); font-size: 14px; }
.auth-card .input { background: var(--muted); border-color: var(--border-2); color: var(--card-text); }
.auth-card label { color: var(--card-soft); }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--muted); padding: 4px; border-radius: 999px; }
.auth-tabs button { flex: 1; border: none; background: transparent; color: var(--card-soft); padding: 8px; border-radius: 999px; font-weight: 600; }
.auth-tabs button.active { background: var(--accent); color: #05230f; }

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--border); font-size: 14px; font-weight: 600; color: var(--text-soft); }
.chip.active { background: var(--accent); color: #05230f; border-color: var(--accent); }

/* ---------- Room grid ---------- */
.section-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 16px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 620px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.room-card {
  background: var(--card); color: var(--card-text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .14s ease, border-color .14s ease;
}
.room-card:hover { transform: translateY(-3px); border-color: var(--border-2); }
.room-card .thumb {
  position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius-sm);
  overflow: hidden; background: linear-gradient(135deg, #1c2b22, #101013);
}
.room-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.room-card .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; opacity: .5; }
.room-card .thumb .live-badge {
  position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); color: #fff; font-size: 11px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px;
}
.room-card .thumb .live-badge .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.room-card .cat { font-size: 11px; font-weight: 700; color: var(--accent-ring); text-transform: uppercase; letter-spacing: .05em; }
.room-card h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.room-card .desc { color: var(--card-soft); font-size: 13px; margin: 0; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room-card .meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--card-soft); }

/* ---------- Room view ---------- */
.room-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.room-head .room-img { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; background: var(--card-2); flex: 0 0 auto; }
.room-head .info h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.room-head .info p { margin: 4px 0 0; color: var(--text-soft); font-size: 14px; }
.room-head .cat-badge { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 6px; }
.room-head .count-pill { display:inline-flex; gap:6px; align-items:center; font-size:13px; color: var(--text-soft); margin-left: 10px; }

.room-body { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 860px) { .room-body { grid-template-columns: 1.4fr 1fr; } }

.stage { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stage h4 { margin: 0 0 14px; font-size: 13px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .05em; }
.speakers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 18px 10px; }

.pax { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; position: relative; }
.avatar-wrap { position: relative; width: 60px; height: 60px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--card-2); object-fit: cover; border: 2px solid var(--border-2); }
.pax.speaking .avatar { border-color: var(--accent-ring); box-shadow: 0 0 16px var(--accent-soft); }
.pax.speaking .avatar-wrap::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent-ring); animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.28); opacity: 0; } }
.pax .name { font-size: 12px; font-weight: 600; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pax .role-tag { font-size: 10px; color: #05230f; background: var(--accent); border-radius: 999px; padding: 1px 6px; font-weight: 700; }
.pax .mic-badge { position: absolute; bottom: 16px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--card-3); color: var(--text); display: grid; place-items: center; box-shadow: var(--shadow); font-size: 11px; border: 1px solid var(--border-2); }
.pax .mic-badge.on { background: var(--accent); color: #05230f; border-color: var(--accent); }
.pax .mic-badge.muted-mod { background: var(--danger); color: #fff; border-color: var(--danger); }
.pax.listener .avatar { opacity: .8; }

/* moderation popover */
.pax .mod-menu { position: absolute; top: 0; right: -4px; }
.mod-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--card-2); color: var(--text); font-size: 12px; display: none; }
.pax:hover .mod-btn { display: block; }
.menu {
  position: absolute; z-index: 30; right: 0; top: 26px; background: var(--card); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; min-width: 150px;
}
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 10px; border: none; background: transparent; color: var(--text); border-radius: 8px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--card-2); }
.menu button.danger { color: var(--danger); }

/* active speaker bar */
.speaking-bar {
  position: fixed; left: 0; right: 0; bottom: 84px; z-index: 30;
  display: flex; justify-content: center; gap: 8px; padding: 0 12px; flex-wrap: wrap; pointer-events: none;
}
.speaking-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #05230f;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 20px rgba(34,197,94,.4);
}
.speaking-pill .wave { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.speaking-pill .wave i { width: 2px; background: #05230f; border-radius: 2px; animation: wave 1s ease-in-out infinite; }
.speaking-pill .wave i:nth-child(2){ animation-delay:.15s } .speaking-pill .wave i:nth-child(3){ animation-delay:.3s }
@keyframes wave { 0%,100%{ height: 4px } 50%{ height: 12px } }

/* mic control dock */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(10,10,11,.86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border);
}
.mic-btn { width: 56px; height: 56px; border-radius: 50%; border: none; background: var(--card-3); color: #fff; font-size: 22px; box-shadow: var(--shadow); }
.mic-btn.live { background: var(--accent); color: #05230f; box-shadow: 0 0 24px var(--accent-soft); }
.mic-btn.blocked { background: var(--muted-2); color: var(--text-soft); }
.dock .status { font-size: 13px; color: var(--text-soft); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: 440px; }
.chat .messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg img { width: 28px; height: 28px; border-radius: 50%; background: var(--card-2); }
.msg .bubble { background: var(--card-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; max-width: 82%; }
.msg .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; color: var(--text); }
.msg .who a { color: var(--text); }
.msg .body { font-size: 14px; word-break: break-word; color: var(--card-text); }
.msg .body a { color: var(--accent-ring); text-decoration: underline; }
.chat .typing { height: 18px; padding: 0 14px; font-size: 12px; color: var(--text-soft); }
.chat .compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--bg-2); }
.chat .compose input { flex: 1; border: 1px solid var(--border-2); border-radius: 999px; padding: 10px 14px; background: var(--muted); color: var(--text); }
.chat-tools { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--bg-2); }
.chat-tools .t { font-size: 13px; color: var(--text-soft); font-weight: 600; }

/* ---------- Profile ---------- */
.profile-card { background: var(--card); border: 1px solid var(--border); color: var(--card-text); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); max-width: 520px; margin: 0 auto; }
.profile-card .big-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--card-2); object-fit: cover; margin-bottom: 14px; border: 2px solid var(--border-2); }
.profile-card h2 { margin: 0; font-size: 24px; }
.profile-card .handle { color: var(--card-soft); font-size: 14px; }
.profile-card .bio { margin: 14px 0; color: var(--card-soft); }
.profile-card .counts { display: flex; gap: 24px; margin: 16px 0; }
.profile-card .counts b { font-size: 18px; } .profile-card .counts span { color: var(--card-soft); font-size: 13px; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { border: none; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--text-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--text); }
.tag.admin { background: #fff; color: #0a0a0b; }
.tag.moderator { background: var(--accent-soft); color: var(--accent-ring); }
.tag.banned { background: var(--danger-soft); color: var(--danger); }
.room-thumb-sm { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--card-2); }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--text-soft); padding: 48px 16px; }
.toast-wrap { position: fixed; top: 72px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--card-3); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); border: 1px solid var(--border-2); animation: slidein .2s ease; }
.toast.danger { background: var(--danger); border-color: var(--danger); }
@keyframes slidein { from { transform: translateY(-8px); opacity: 0; } }
.avatar-menu { position: relative; }
.avatar-menu .av { width: 36px; height: 36px; border-radius: 50%; background: var(--card-2); object-fit: cover; border: 1px solid var(--border-2); cursor: pointer; }
.menu-pop { position: absolute; right: 0; top: 46px; background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; min-width: 170px; z-index: 50; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 9px 11px; border: none; background: transparent; color: var(--text); border-radius: 8px; font-size: 14px; text-align: left; font-weight: 500; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--card-2); }
.menu-pop .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-pop .who { padding: 8px 11px; font-size: 13px; color: var(--text-soft); }
.menu-pop button.danger { color: var(--danger); }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.link { color: var(--accent-ring); font-weight: 600; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Live cams ---------- */
.cams-section { margin-bottom: 26px; }
.cams-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
@media (min-width: 620px) { .cam-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.cam-empty { grid-column: 1 / -1; color: var(--text-soft); background: var(--muted); border: 1px dashed var(--border-2); border-radius: var(--radius-sm); padding: 22px; text-align: center; font-size: 14px; }

.cam-tile { display: flex; flex-direction: column; gap: 6px; }
.cam-tile .cam-thumb {
  position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: var(--radius-sm);
  overflow: hidden; background: linear-gradient(135deg, #241018, #101013); border: 1px solid var(--border);
  transition: transform .12s ease, border-color .12s ease;
}
.cam-tile:hover .cam-thumb { transform: translateY(-2px); border-color: var(--accent); }
.cam-tile .cam-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cam-tile .cam-thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; opacity: .5; }
.cam-tile .live-badge {
  position: absolute; top: 7px; left: 7px; display: inline-flex; align-items: center; gap: 5px;
  background: #e5202e; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 999px;
}
.cam-tile .live-badge .live-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.cam-tile .watch-badge {
  position: absolute; bottom: 7px; right: 7px; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.cam-tile .you-badge {
  position: absolute; top: 7px; right: 7px; background: var(--accent); color: #05230f;
  font-size: 10px; font-weight: 800; padding: 3px 7px; border-radius: 999px;
}
.cam-tile .cam-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Cam room (full-bleed, Stripchat-style) ---------- */
/* Mobile-first: video fills the viewport, chat overlays the bottom. */
.cam-room {
  position: relative;
  width: 100%;
  height: calc(100dvh - 58px);   /* viewport minus sticky topbar */
  background: #000;
  overflow: hidden;
}
.cam-stage { position: absolute; inset: 0; }
.cam-video-wrap { position: absolute; inset: 0; background: #000; }
#cam-video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.cam-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: #cfcfd6; font-size: 14px; pointer-events: none; text-align: center; }

/* Top overlay bar: back / live / viewers / broadcaster controls */
.cam-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,.6), rgba(0,0,0,0));
}
.cam-ic {
  width: 38px; height: 38px; flex: 0 0 auto; border: none; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; font-size: 18px; display: grid; place-items: center;
  backdrop-filter: blur(6px); cursor: pointer;
}
.cam-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  color: #fff; font-size: 13px; font-weight: 700; border: none; cursor: default;
}
.cam-pill.live { color: #ff00a7; letter-spacing: .03em; }
.cam-pill.live { animation: blink 1.4s infinite; }
.cam-pill.stop { background: #292525; cursor: pointer; }

.cam-unmute {
  position: absolute; bottom: calc(50% + 20px); left: 50%; transform: translateX(-50%); z-index: 6;
  background: rgba(0,0,0,.7); color: #fff; border: 1px solid rgba(255,255,255,.25);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; backdrop-filter: blur(6px);
}

/* Chat overlays the lower part of the video on mobile. */
.cam-chat {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  height: 52%; display: flex; flex-direction: column; justify-content: flex-end;
  background: none; border: none; border-radius: 0; overflow: visible;
  pointer-events: none;
}
.cam-chat .messages {
  flex: 0 1 auto; max-height: 100%; overflow-y: auto; padding: 12px 12px 6px;
  display: flex; flex-direction: column; gap: 6px; pointer-events: auto;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 34px);
          mask-image: linear-gradient(to bottom, transparent 0, #000 34px);
}
.cam-chat .msg { align-items: flex-start; }
.cam-chat .msg .bubble {
  background: rgba(0,0,0,.42); border: none; backdrop-filter: blur(3px);
  border-radius: 12px; padding: 6px 10px; max-width: 88%;
}
.cam-chat .msg .who { color: #7fe0a0; font-size: 12px; }
.cam-chat .msg .who a { color: #7fe0a0; }
.cam-chat .msg .body { color: #fff; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.cam-chat .msg .body a { color: #9be7ff; }
.cam-chat .typing { color: #e6e6ea; padding: 0 14px; text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none; }
.cam-chat .compose {
  pointer-events: auto; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,.35) 70%, transparent);
  border: none;
}
.cam-chat .compose input {
  flex: 1; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 12px 16px;
  background: rgba(255,255,255,.12); color: #fff; backdrop-filter: blur(6px);
}
.cam-chat .compose input::placeholder { color: rgba(255,255,255,.7); }
.cam-send { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; padding: 0; font-size: 18px; }

/* Desktop: stream left (large/wide), chat right as a solid panel. */
@media (min-width: 860px) {
  .cam-room {
    display: flex; gap: 16px; padding: 16px;
    height: calc(100dvh - 58px); background: transparent; overflow: hidden;
  }
  .cam-stage { position: relative; flex: 1; min-width: 0; height: 100%; }
  .cam-video-wrap { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }

  .cam-chat {
    position: relative; z-index: 1; width: 360px; flex: 0 0 360px; height: 100%;
    background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius);
    justify-content: flex-start; overflow: hidden; pointer-events: auto;
  }
  .cam-chat .messages {
    flex: 1; max-height: none; padding: 14px;
    -webkit-mask-image: none; mask-image: none;
  }
  .cam-chat .msg .bubble { background: var(--card-2); border: 1px solid var(--border); backdrop-filter: none; }
  .cam-chat .msg .who, .cam-chat .msg .who a { color: var(--text); }
  .cam-chat .msg .body { color: var(--card-text); text-shadow: none; }
  .cam-chat .msg .body a { color: var(--accent-ring); }
  .cam-chat .typing { color: var(--text-soft); text-shadow: none; }
  .cam-chat .compose { background: var(--bg-2); border-top: 1px solid var(--border); padding: 10px; }
  .cam-chat .compose input { background: var(--muted); border-color: var(--border-2); }
  .cam-chat .compose input::placeholder { color: #66666f; }
}
