:root {
  --primary: #5b4bff;
  --primary-2: #3f7cff;
  --accent: #ff4f8b;
  --accent-2: #ffa23a;
  --ink: #17153a;
  --ink-2: #4a4870;
  --muted: #7b7999;
  --bg: #f7f6ff;
  --card: #ffffff;
  --line: #e7e4fb;
  --danger: #ff3b5c;
  --ok: #16b47e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(41, 28, 140, 0.08);
  --grad: linear-gradient(90deg, var(--accent), var(--accent-2));
  --grad-primary: linear-gradient(135deg, #8a5cff, var(--primary-2));
  --font-head: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; }
img { max-width: 100%; }
a { color: var(--primary); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.5rem; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; border: 0; border-radius: 999px; padding: .65em 1.2em; font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; transition: transform .1s, box-shadow .2s, background .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: 0 6px 18px rgba(91, 75, 255, .35); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(91, 75, 255, .45); }
.btn-ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: .85em 1.6em; font-size: 1.05rem; }
.btn-sm { padding: .45em .9em; font-size: .85rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: inherit; line-height: 1; }

form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .8rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select {
  display: block; width: 100%; margin-top: .3rem; padding: .7em .9em; border: 1.5px solid var(--line); border-radius: 12px;
  font: 16px var(--font); color: var(--ink); background: #fff; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 75, 255, .15); }
label.check { display: flex; align-items: center; gap: .45em; font-weight: 500; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; gap: 8px; }
.row-between label { margin: 0; }
.form-error { color: var(--danger); font-size: .9rem; min-height: 1.2em; margin: .2rem 0 .6rem; }
.form-error:empty { min-height: 0; margin: 0; }
.code-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 600; font-size: .88rem; color: var(--ink-2); margin-bottom: .4rem; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: .6em 0; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 700; cursor: pointer; }
.seg input:checked + span { background: var(--grad-primary); color: #fff; border-color: transparent; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(91, 75, 255, .3); }

/* ---------- header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-name { font: 800 1.35rem var(--font-head); letter-spacing: -.5px; color: var(--primary); }
.topnav { display: none; gap: 20px; margin-left: 12px; }
.topnav a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.topnav a:hover { color: var(--primary); }
.auth-area { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font: 600 .95rem var(--font); color: var(--ink); padding: 4px; border-radius: 999px; }
.user-btn .uname { display: none; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); min-width: 180px; padding: 6px; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: .6em .8em; border-radius: 10px; color: var(--ink); text-decoration: none; background: none; border: 0; font: 500 .95rem var(--font); cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); }

/* ---------- avatars ---------- */
.avatar { --size: 36px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; color: #fff; font: 700 calc(var(--size) * .42) var(--font-head); background: var(--grad-primary); text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 28px; }
.avatar-xl { --size: 96px; }
.avatar.empty-slot { background: #fff; border: 2px dashed var(--line); color: var(--line); }

/* ---------- hero ---------- */
.hero { background: radial-gradient(1200px 400px at 80% -10%, rgba(255, 79, 139, .12), transparent), radial-gradient(900px 500px at 0% 0%, rgba(91, 75, 255, .14), transparent); padding: 40px 0 24px; overflow: hidden; }
.hero-inner { display: grid; gap: 24px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 800; letter-spacing: -1px; }
.lead { font-size: 1.1rem; color: var(--ink-2); max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.hero-stats { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); }
.hero-stats b { color: var(--ink); font-size: 1.1rem; }
.hero-art { position: relative; display: none; justify-self: center; width: 320px; height: 300px; }
.hero-art img { position: absolute; inset: 40px; animation: float 6s ease-in-out infinite; }
.bubble { position: absolute; background: #fff; padding: .5em .9em; border-radius: 18px; box-shadow: var(--shadow); font-weight: 700; animation: float 5s ease-in-out infinite; }
.b1 { top: 0; left: 0; color: var(--primary); }
.b2 { top: 30px; right: -10px; color: var(--accent); animation-delay: 1s; }
.b3 { bottom: 20px; left: -20px; color: var(--ok); animation-delay: 2s; }
.b4 { bottom: 0; right: 10px; color: var(--accent-2); animation-delay: 3s; }
@keyframes float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- ads ---------- */
.ad-slot { display: flex; align-items: center; justify-content: center; overflow: hidden; margin: 16px auto; }
.ad-slot.placeholder { background: repeating-linear-gradient(45deg, #f0eefc, #f0eefc 10px, #f6f5fe 10px, #f6f5fe 20px); border: 1px dashed #d8d3f6; border-radius: 12px; color: #a9a4cf; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; }
.ad-leaderboard { min-height: 90px; max-width: 970px; }
.ad-sidebar { width: 300px; min-height: 600px; }
.ad-infeed { grid-column: 1 / -1; min-height: 120px; width: 100%; margin: 0; }
.ad-chat { min-height: 60px; margin: 8px; width: auto; }
.ad-slot ins { display: block; width: 100%; }

/* ---------- rooms ---------- */
.rooms-section { padding: 24px 16px 40px; }
.rooms-layout { display: grid; gap: 24px; }
.rooms-aside { display: none; }
.sticky { position: sticky; top: 80px; }
.rooms-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.rooms-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.rooms-head h2::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(22, 180, 126, .2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input[type=search] { margin: 0; width: auto; flex: 1 1 160px; padding: .55em .8em; }
.filters .check { margin: 0; font-size: .9rem; white-space: nowrap; }
.room-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.room-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .2s; }
.room-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(41, 28, 140, .12); }
.room-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lang-badge { display: inline-flex; align-items: center; gap: 6px; background: #f1eeff; color: var(--primary); font-weight: 700; font-size: .85rem; padding: .3em .7em; border-radius: 999px; white-space: nowrap; }
.level-badge { font-size: .75rem; font-weight: 700; padding: .25em .6em; border-radius: 999px; background: #fff3e6; color: #c86a00; text-transform: capitalize; }
.room-card h3 { font-size: 1.1rem; margin: 0; word-break: break-word; }
.room-members { display: flex; flex-wrap: wrap; gap: 6px; }
.room-card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.count { font-weight: 700; color: var(--ink-2); }
.count.full { color: var(--danger); }
.empty { text-align: center; padding: 40px 16px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.skeleton { min-height: 180px; background: linear-gradient(90deg, #f0eefc 25%, #f7f6ff 50%, #f0eefc 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- sections ---------- */
.how, .langs, .faq { padding: 32px 16px; }
.how-grid { display: grid; gap: 16px; }
.how-grid article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.how-ico { font-size: 1.8rem; }
.how-grid h3 { margin: .4em 0; font-size: 1.1rem; }
.how-grid p { margin: 0; color: var(--ink-2); }
.lang-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-chip { display: inline-flex; gap: 6px; align-items: center; padding: .45em .9em; background: #fff; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.lang-chip:hover, .lang-chip.active { border-color: var(--primary); color: var(--primary); }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: .6em 0 0; color: var(--ink-2); }

/* ---------- footer ---------- */
.footer { background: #fff; border-top: 1px solid var(--line); padding: 32px 0 24px; margin-top: 24px; }
.footer-grid { display: grid; gap: 20px; }
.footer-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.footer-links a, .footer-bottom a { color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.footer-links a:hover, .footer-bottom a:hover { color: var(--primary); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

/* ---------- modals & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(23, 21, 58, .55); backdrop-filter: blur(4px); display: grid; place-items: end center; padding: 0; overflow-y: auto; }
.modal-card { position: relative; background: #fff; width: 100%; max-width: 460px; border-radius: 24px 24px 0 0; padding: 28px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; max-height: 100dvh; overflow-y: auto; }
.modal-sm { max-width: 360px; }
.modal-card h2 { font-size: 1.4rem; padding-right: 32px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); font-size: 1.4rem; cursor: pointer; color: var(--ink-2); }
.modal-foot { text-align: center; margin: 1rem 0 0; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 14px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-slot { display: flex; justify-content: center; min-height: 44px; }
.google-slot:empty, .google-slot:empty + .divider { display: none; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 200%); visibility: hidden; background: var(--ink); color: #fff; padding: .8em 1.2em; border-radius: 14px; z-index: 200; transition: transform .25s, visibility .25s; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow); }
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.error { background: var(--danger); }
.banner { background: #fff7e0; border: 1px solid #ffe2a1; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }

/* ---------- profile & legal ---------- */
.profile { padding: 24px 16px 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-bottom: 16px; }
.profile-head h1 { margin: 0; word-break: break-all; }
.avatar-edit { display: flex; align-items: center; gap: 16px; }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.profile-grid { display: grid; gap: 16px; }
.legal { padding: 32px 16px; max-width: 800px; }
.legal h2 { font-size: 1.2rem; margin-top: 1.5em; }

/* ---------- room page ---------- */
.page-room { background: #0f0d24; color: #fff; overflow: hidden; }
.room-app { display: flex; flex-direction: column; height: 100dvh; }
.room-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: #17143a; border-bottom: 1px solid #2a2660; }
.room-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.room-title h1 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-title .lang-badge { background: #2a2660; color: #cfc8ff; }
.room-title .muted { color: #9d98c9; white-space: nowrap; }
.room-top-actions { display: flex; gap: 6px; }
.room-top .btn-ghost { background: transparent; color: #cfc8ff; border-color: #3a3577; }
.room-body { flex: 1; display: flex; min-height: 0; position: relative; overflow: hidden; }
.stage { flex: 1; min-width: 0; padding: 10px; display: flex; position: relative; }
.video-grid { flex: 1; display: grid; gap: 10px; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 0; }
.video-grid[data-count="2"] { grid-template-columns: 1fr; }
.video-grid[data-count="3"], .video-grid[data-count="4"] { grid-template-columns: 1fr 1fr; }
.video-grid[data-count="5"], .video-grid[data-count="6"] { grid-template-columns: 1fr 1fr; }
.tile { position: relative; background: #1d1946; border-radius: 16px; overflow: hidden; display: grid; place-items: center; min-height: 0; border: 2px solid transparent; transition: border-color .2s; }
.tile.speaking { border-color: var(--ok); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile:not(.cam-on) video { opacity: 0; } /* keeps playing audio, shows the avatar instead */
.tile.self video { transform: scaleX(-1); }
.tile .avatar { --size: clamp(48px, 12vmin, 110px); box-shadow: 0 0 0 6px rgba(255, 255, 255, .06); }
.tile.cam-on .avatar { display: none; }
.tile-info { position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; }
.tile-name { background: rgba(0, 0, 0, .55); padding: .25em .6em; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-mic { background: rgba(0, 0, 0, .55); border-radius: 8px; padding: .2em .45em; }
.tile-crown { position: absolute; top: 8px; left: 8px; background: rgba(0, 0, 0, .55); border-radius: 8px; padding: .2em .5em; font-size: .8rem; }
.tile-menu { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .55); border: 0; color: #fff; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1.1rem; }
.tile.empty-tile { border: 2px dashed #2f2a6b; background: transparent; color: #5d58a0; font-size: .9rem; }
.room-status { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: #0f0d24; z-index: 5; }
.room-status .box { max-width: 380px; }
.room-status .ad-slot { margin-top: 24px; }

.chat { width: 340px; display: flex; flex-direction: column; background: #17143a; border-left: 1px solid #2a2660; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #2a2660; }
.chat-head h2 { font-size: 1rem; margin: 0; }
.chat-close { display: none; color: #cfc8ff; }
.chat .ad-slot.placeholder { background: #1f1b4a; border-color: #2f2a6b; color: #5d58a0; }
.chat-list { list-style: none; margin: 0; padding: 10px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-msg .body { min-width: 0; }
.chat-msg .meta { font-size: .78rem; color: #9d98c9; }
.chat-msg .meta b { color: #e6e2ff; margin-right: 6px; }
.chat-msg .text { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-msg.mine .meta b { color: #ffb36b; }
.chat-sys { font-size: .8rem; color: #9d98c9; text-align: center; font-style: italic; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #2a2660; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.chat-form input { margin: 0; background: #0f0d24; border-color: #2f2a6b; color: #fff; }

.controls { display: flex; justify-content: center; gap: 12px; padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: #17143a; border-top: 1px solid #2a2660; }
.ctrl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; padding: 8px 12px; border-radius: 16px; border: 0; background: #2a2660; color: #fff; cursor: pointer; font: 600 .75rem var(--font); }
.ctrl .ctrl-ico { font-size: 1.35rem; line-height: 1; }
.ctrl.off { background: #3a1730; color: #ffb3c4; }
.ctrl.off .ctrl-ico { filter: grayscale(1) opacity(.7); }
.ctrl.on { background: var(--grad-primary); }
#chatToggle { display: none; }
.badge { position: absolute; top: 2px; right: 10px; background: var(--accent); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 6px; min-width: 18px; }

.member-card { text-align: center; color: var(--ink); }
.member-card .avatar { margin: 0 auto 12px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .chat { position: absolute; inset: 0; width: 100%; z-index: 10; transform: translateX(100%); visibility: hidden; transition: transform .25s, visibility .25s; border-left: 0; }
  .chat.open { transform: none; visibility: visible; }
  .chat-close { display: block; }
  #chatToggle { display: flex; }
}
@media (max-width: 520px) {
  .room-title .muted { display: none; }
  .room-top .btn .label-long { display: none; }
  .room-title .lang-badge { padding: .3em .5em; }
  .room-title .lang-badge .lang-name { display: none; }
  .video-grid[data-count="3"], .video-grid[data-count="4"], .video-grid[data-count="5"], .video-grid[data-count="6"] { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (min-width: 600px) {
  .modal { place-items: center; padding: 16px; }
  .modal-card { border-radius: 24px; padding: 32px; }
  .room-grid { grid-template-columns: repeat(2, 1fr); }
  .rooms-head { flex-direction: row; justify-content: space-between; align-items: center; }
  .filters { flex-wrap: nowrap; }
  .how-grid { grid-template-columns: repeat(2, 1fr); }
  .user-btn .uname { display: inline; }
  .footer-links { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .topnav { display: flex; }
  .hero { padding: 64px 0 40px; }
  .hero-inner { grid-template-columns: 1.3fr 1fr; }
  .hero-art { display: block; }
  .how-grid { grid-template-columns: repeat(4, 1fr); }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 2fr; }
  .video-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
  .video-grid[data-count="5"], .video-grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .rooms-layout { grid-template-columns: 1fr 300px; }
  .rooms-aside { display: block; }
  .room-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------------- admin dashboard ---------------- */
.admin { padding: 24px 16px 48px; display: grid; gap: 16px; }
.admin h1 { margin: 0 0 4px; font-size: clamp(1.4rem, 3vw, 1.8rem); }
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.admin-head p { margin: 0; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .85rem; color: var(--ink-2); white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-pill[data-state="live"] .live-dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(22, 180, 126, .5); animation: livePulse 2s infinite; }
.live-pill[data-state="error"] .live-dot { background: var(--danger); }
@keyframes livePulse { 70% { box-shadow: 0 0 0 8px rgba(22, 180, 126, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 180, 126, 0); } }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.kpi-label { font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.kpi-value { font: 700 1.7rem/1.2 var(--font-head); color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-hero { background: var(--grad-primary); border-color: transparent; }
.kpi-hero .kpi-label, .kpi-hero .kpi-value, .kpi-hero .kpi-sub { color: #fff; }

.admin-card { padding: 16px; min-width: 0; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.count-badge { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.admin .empty { padding: 20px 12px; }

.spark-wrap { position: relative; }
.spark { display: block; width: 100%; height: auto; touch-action: pan-y; }
.spark .grid { stroke: var(--line); stroke-width: 1; }
.spark .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.spark .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--primary); opacity: .1; }
.spark .dot { fill: var(--primary); stroke: #fff; stroke-width: 2; }
.spark .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.spark-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: .8rem; padding: 4px 8px; border-radius: 8px; pointer-events: none; white-space: nowrap; }

.breakdowns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .breakdowns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .breakdowns { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.breakdown h3 { margin: 0 0 10px; font-size: .95rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: .85rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.bar-track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 4px; background: var(--primary); border-radius: 4px; }
.bar-value { color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

.admin-search { width: min(100%, 320px); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.visitors { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 860px; }
.visitors th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.visitors td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.visitors tr:last-child td { border-bottom: 0; }
.visitors td > span, .visitors td > div > span, .visitors td > div > a { display: block; }
.visitors .sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.visitors code { font-size: .8rem; background: var(--bg); padding: 1px 6px; border-radius: 6px; display: inline-block; }
.visitors a { color: var(--primary); text-decoration: none; }
.visitors .who { display: flex; gap: 10px; align-items: flex-start; }
.visitors .who strong { display: flex; align-items: center; gap: 6px; }
.visitors .guest { background: #d9d6f2; color: var(--ink-2); }
.visitors .tag { font-size: .65rem; font-weight: 700; text-transform: uppercase; background: var(--grad); color: #fff; border-radius: 999px; padding: 1px 6px; }
.visitors .nowrap { white-space: nowrap; }
.visitors .since { font-variant-numeric: tabular-nums; }
