/* Shell + pages (spec §4-5, §8-16, §82, §182-185).
   Phone: bottom nav · Tablet (≥768): compact rail · Desktop (≥1024): full rail.
   Same hierarchy everywhere: Home | Rooms | Profile. */

/* ---------------- shell ---------------- */
#app { min-height: 100dvh; }
.app-column { min-width: 0; min-height: 100dvh; display: flex; flex-direction: column; }
/* Signed-in shell: the page scrolls INSIDE the column, never the document, so the
   fixed bottom bar can't drift or bounce on iPhone (Home Screen app included). */
html:has(#app > .app-column), html:has(#app > .app-column) body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html:has(#app > .app-column) .app-column { height: 100dvh; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.main { flex: 1; min-width: 0; outline: none; padding-bottom: calc(var(--bottom-nav-h) + var(--sab) + 24px); }
.has-room-indicator .main { padding-bottom: calc(var(--bottom-nav-h) + var(--sab) + 92px); }
.page { width: 100%; max-width: 1600px; margin: 0 auto; padding: var(--s4) calc(var(--gutter) + var(--sar)) var(--s6) calc(var(--gutter) + var(--sal)); display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }
.page-title { font-size: var(--fs-2xl); }
.page-top { display: flex; align-items: center; gap: var(--s3); min-height: 48px; }
.page-top .page-title { flex: 1; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.section-head h2 { font-size: var(--fs-lg); }

.topbar { position: sticky; top: 0; z-index: var(--z-nav); display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: calc(var(--sat) + 8px) calc(var(--gutter) + var(--sar)) 8px calc(var(--gutter) + var(--sal));
  background: linear-gradient(180deg, rgba(5,5,5,.96) 70%, rgba(5,5,5,0)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.bell { position: relative; }
.badge-dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.me-link { display: grid; place-items: center; width: var(--touch); height: var(--touch); }

.bottom-nav { position: fixed; z-index: var(--z-nav); inset-inline: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--bottom-nav-h) + var(--sab)); padding: 0 var(--sar) var(--sab) var(--sal);
  background: rgba(8,8,9,.94); border-top: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; position: relative; transition: color var(--t-fast); }
.nav-item .ic { width: 24px; height: 24px; }
.nav-item.active { color: var(--gold); }
.nav-item.active .ic { filter: drop-shadow(0 0 6px rgba(231,185,107,.9)) drop-shadow(0 0 16px rgba(231,185,107,.55)); }
.nav-item.active .nav-label { text-shadow: 0 0 10px rgba(231,185,107,.65); }
.bottom-nav .nav-item.active::before { content: ""; position: absolute; top: 8px; left: 50%; width: 56px; height: 34px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(231,185,107,.28), transparent); pointer-events: none; }
.rail-nav { display: none; }
.in-room .bottom-nav, .in-room .topbar { visibility: hidden; }

@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .main { padding-bottom: 32px; }
  .has-room-indicator .main { padding-bottom: 96px; }
  #app { display: grid; grid-template-columns: calc(var(--rail-w) + var(--sal)) minmax(0, 1fr); }   /* the rail also spans the notch side in landscape */
  /* Full-screen views without the rail (sign-in, onboarding, system) span both columns. */
  #app > .auth-screen, #app > .system-screen { grid-column: 1 / -1; }
  .rail-nav { display: flex; flex-direction: column; gap: var(--s6); position: sticky; top: 0; height: 100dvh; padding: calc(var(--sat) + 22px) 12px 24px calc(12px + var(--sal)); border-inline-end: 1px solid var(--line); background: #070708; }
  .rail-nav .brand { justify-content: center; }
  .rail-nav .brand-word { display: none; }
  .nav-items { display: flex; flex-direction: column; gap: 6px; }
  .rail-nav .nav-item { flex-direction: column; min-height: 64px; border-radius: var(--r-md); font-size: var(--fs-xs); }
  .rail-nav .nav-item.active { background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(231,185,107,.35), var(--gold-glow); }
  .topbar .topbar-brand { display: none; }
  .topbar { justify-content: flex-end; }
}
@media (min-width: 1024px) {
  .rail-nav { padding-inline: 18px; }
  .rail-nav .brand { justify-content: flex-start; padding-inline: 12px; }
  .rail-nav .brand-word { display: inline; }
  .rail-nav .nav-item { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 52px; padding-inline: 16px; font-size: var(--fs-md); }
}
@media (hover: hover) { .nav-item:not(.active):hover { color: var(--text); } }

/* banners */
.banner-host { position: sticky; top: 0; z-index: calc(var(--z-nav) + 1); }
.banner { display: flex; align-items: center; justify-content: center; gap: 10px; padding: calc(var(--sat) + 8px) var(--gutter) 8px; font-size: var(--fs-sm); background: #141210; border-bottom: 1px solid rgba(231,185,107,.25); }
.banner + .banner { padding-top: 8px; }
.banner-sub { color: var(--text-2); }

/* Active Room indicator (§61) */
.room-indicator { position: fixed; z-index: var(--z-indicator); inset-inline: 12px; bottom: calc(var(--bottom-nav-h) + var(--sab) + 10px); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: var(--r-pill);
  background: rgba(18,17,15,.96); border: 1px solid rgba(231,185,107,.45); box-shadow: 0 12px 30px -12px rgba(0,0,0,.9), var(--gold-glow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ri-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding-inline: 12px; min-height: 44px; text-align: start; }
.ri-live { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); flex: none; animation: breathe 1.8s infinite; }
.ri-live.ri-warn { background: #ffb020; }
.ri-text { display: grid; min-width: 0; } .ri-text b { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ri-text small { color: var(--text-2); font-size: var(--fs-xs); }
.ri-btn.on { background: var(--gold-soft); color: var(--gold); }
.ri-btn.off { background: rgba(229,83,75,.16); color: #ff8a80; }
.ri-state { width: var(--touch); display: grid; place-items: center; color: var(--text-3); }
@media (min-width: 768px) { .room-indicator { inset-inline: auto 24px; bottom: 24px; width: 360px; } }
/* Never over the Room itself (it would cover Mic | Camera | Leave). */
body.in-room .room-indicator { display: none !important; }
body.in-room .fab-create { display: none !important; }            /* the + belongs to the Rooms list only */

/* ---------------- Home ---------------- */
.friends-row { display: flex; gap: var(--s4); overflow-x: auto; scrollbar-width: none; padding: 4px 2px 6px; scroll-snap-type: x proximity; }
.friends-row::-webkit-scrollbar { display: none; }
.friend { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; flex: none; text-align: center; scroll-snap-align: start; }
.friend-name { font-size: var(--fs-sm); font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.friend-status { font-size: var(--fs-xs); color: var(--text-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
.friend-status { display: inline-flex; align-items: center; gap: 5px; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.st-on .st-dot, .st-watching .st-dot { background: #3ecf7a; box-shadow: 0 0 6px rgba(62,207,122,.7); }
.st-room .st-dot { background: #f0a23b; box-shadow: 0 0 6px rgba(240,162,59,.7); }
.st-off { color: var(--text-3); }
.avatar.ring-online { box-shadow: 0 0 0 2.5px var(--gold), 0 0 14px rgba(231,185,107,.45); }
.avatar.ring-offline { box-shadow: 0 0 0 2px rgba(255,255,255,.28); }
.avatar.ring-offline > img { filter: saturate(.75) brightness(.9); }
.friend-add .avatar { width: 64px; height: 64px; }
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--s4); }

.search { position: relative; }
.search-bar { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 8px 0 16px; border-radius: var(--r-pill); background: var(--surface-1); border: 1px solid var(--line); color: var(--text-2); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.search.open .search-bar, .search-bar:focus-within { border-color: rgba(231,185,107,.55); box-shadow: 0 0 0 4px rgba(231,185,107,.08); }
.search-input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 16px; min-height: 48px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-results { margin-top: 10px; padding: var(--s3); border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); display: grid; gap: var(--s3); }
.search-body { display: grid; gap: var(--s4); min-height: 60px; }
.sr-group { display: grid; gap: 8px; } .sr-group h3 { font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.sr-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 6px; border-radius: var(--r-md); justify-content: space-between; }
.sr-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sr-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold); }
.sr-posters { display: flex; gap: var(--s3); overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.sr-posters .poster { width: 110px; }
@media (min-width: 1024px) {
  .home-search { position: sticky; top: calc(var(--sat) + 4px); z-index: 20; }
  .search-results { position: absolute; inset-inline: 0; top: 100%; max-height: min(70dvh, 640px); overflow: auto; box-shadow: 0 24px 48px -16px rgba(0,0,0,.9); }
}

.discover-bar { display: flex; align-items: center; gap: var(--s2); }
.discover-bar .segmented { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s3); align-items: end; }
.filter { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--text-2); }
.filter select { min-height: 40px; padding: 0 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }

.rail { min-width: 0; }
.rail-track { display: flex; gap: var(--s4); overflow-x: auto; scrollbar-width: none; padding: 2px 2px 8px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.rail-track::-webkit-scrollbar { display: none; }
.rail-track .poster, .rail-track .poster-wrap { scroll-snap-align: start; }
.poster-wrap { position: relative; flex: none; }
.poster-add { position: absolute; top: 8px; inset-inline-end: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10,10,10,.62); border: 1px solid rgba(255,255,255,.28); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background var(--t-fast), transform var(--t-fast); }
.poster-add svg { width: 18px; height: 18px; }
.poster-add[hidden] { display: none; }
.poster-add.on { background: var(--gold); border-color: var(--gold); color: #1a1408; }
.poster-add:active { transform: scale(.9); }
.see-all { display: inline-flex; align-items: center; gap: 2px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; min-height: 36px; }
.see-all svg { width: 16px; height: 16px; }
.rail.expanded .rail-track { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--poster-w), 1fr)); overflow: visible; scroll-snap-type: none; }
.rail.expanded .rail-track .poster { width: auto; }
.home-rails { display: grid; gap: var(--s6); }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: var(--s4); }
.poster-grid .poster, .mini-posters .poster { width: auto; }
.browse-grid { grid-template-columns: repeat(auto-fill, minmax(var(--poster-w, 128px), 1fr)); }   /* one size for every poster */
.browse-grid .poster-wrap, .browse-grid .poster { width: 100%; }
.browse-more { min-height: 48px; }
.rail.expanded .rail-track .poster-wrap { width: auto; }
.rail.expanded .rail-track .poster-wrap .poster { width: 100%; }
.mini-posters { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }

/* ---------------- Rooms ---------------- */
.create-room { display: flex; gap: var(--s2); }
.create-room .input { flex: 1; min-width: 0; }
.invite-card { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-lg); background: linear-gradient(160deg, rgba(231,185,107,.10), rgba(20,20,20,.9) 55%); border: 1px solid rgba(231,185,107,.30); margin-bottom: var(--s3); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.invite-card .invite-info { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.ic-text { display: grid; gap: 2px; min-width: 0; } .ic-text b { font-weight: 650; }
.ic-art .poster { width: 44px; } .ic-art .poster-meta { display: none; } .ic-art .poster-art { border-radius: 8px; }
.invite-card .invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.invite-card .invite-actions .btn { width: 100%; }
.invite-info { display: flex; align-items: center; gap: 12px; min-width: 0; } .invite-info > div { display: grid; min-width: 0; }
.invite-ring { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--gold); color: var(--gold); flex: none; }
.invite-actions, .row-actions { display: flex; gap: var(--s2); }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); }
.room-card { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); min-width: 0; }
a.room-card, button.room-card { padding: var(--s4); gap: 12px; width: 100%; text-align: start; }
.room-card-main { flex: 1; display: flex; align-items: center; gap: 12px; padding: 10px; min-width: 0; text-align: start; }
.room-card-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--gold); flex: none; }
.room-card-text { display: grid; min-width: 0; flex: 1; } .room-card-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seats { display: grid; grid-template-columns: repeat(4, 7px); gap: 4px; flex: none; }
.seat { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.12); }
.seat.on { background: var(--gold); box-shadow: 0 0 6px rgba(231,185,107,.7); }
.room-pick { display: grid; gap: var(--s2); }
@media (hover: hover) { .room-card:hover { border-color: rgba(231,185,107,.35); } }

/* ---------------- Title ---------------- */

.title-hero { position: relative; margin: calc(-1 * var(--s4)) calc(-1 * var(--gutter)) 0; aspect-ratio: 16 / 8; max-height: 56dvh; background: linear-gradient(180deg, #151412, var(--bg)); overflow: hidden; }
.title-backdrop { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-slow); }
.title-backdrop.loaded { opacity: .75; }
.title-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,5,5,0) 40%, var(--bg)); }
.overlay-top { position: absolute; z-index: 2; }
.title-body { display: grid; gap: var(--s4); margin-top: -64px; position: relative; z-index: 1; max-width: 900px; }
.title-name { font-size: clamp(26px, 5vw, 44px); }
.overview { color: var(--text-2); line-height: 1.6; }
.actions-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.actions-col { display: grid; gap: var(--s2); width: 100%; }
.stars { display: flex; gap: 6px; } .star { font-size: 28px; line-height: 1; color: rgba(255,255,255,.18); min-width: 36px; min-height: 36px; }
.star.on { color: var(--gold); text-shadow: 0 0 12px rgba(231,185,107,.6); }
.rate-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.heart-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); transition: color var(--t-fast), transform var(--t-fast); }
.heart-btn svg { width: 30px; height: 30px; }
.heart-btn.on { color: var(--gold); filter: drop-shadow(0 0 8px rgba(231,185,107,.6)); }
.heart-btn.on svg path { fill: currentColor; }
.heart-btn:active { transform: scale(.88); }
.rail-empty p { margin: 0 0 var(--s2); }
.stars-sm .star { font-size: 18px; min-width: 26px; min-height: 26px; } .stars-lg .star { font-size: 38px; }
.circle { display: grid; gap: 8px; } .circle-row { display: flex; align-items: center; gap: 10px; }
.attribution { font-size: var(--fs-xs); color: var(--text-3); }

/* ---------------- Profile ---------------- */
.page-profile { gap: var(--s5); }
.profile-banner { height: 150px; margin: calc(-1 * var(--s4)) calc(-1 * var(--gutter)) -90px; background: radial-gradient(ellipse at 70% 20%, rgba(231,185,107,.28), transparent 60%), linear-gradient(180deg, #17130d, var(--bg)); }
.profile-hero { display: flex; gap: var(--s6); align-items: flex-end; flex-wrap: wrap; position: relative; }
.profile-hero.compact { align-items: center; }
.profile-avatar .avatar { box-shadow: 0 0 0 3px rgba(231,185,107,.85), var(--gold-glow); }
.profile-id { display: grid; gap: 6px; min-width: 0; flex: 1; }
.profile-name-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.profile-name-row h1 { font-size: var(--fs-2xl); }
.bio { color: var(--text-2); max-width: 60ch; }
.stats { display: flex; gap: var(--s6); margin-top: var(--s2); }
.photo-edit { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s5); }
.stat { display: grid; } .stat b { font-size: var(--fs-xl); } .stat span { color: var(--text-2); font-size: var(--fs-sm); }
.profile-cols { display: grid; gap: var(--s6); }
.profile-tab { margin-top: var(--s4); min-height: 120px; }
@media (min-width: 1024px) { .profile-cols { grid-template-columns: minmax(0, 1fr) 340px; } .profile-banner { height: 220px; margin-bottom: -120px; } }

/* people + lists */
.people-list { display: grid; gap: 4px; margin-top: var(--s3); }
.person-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 56px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Settings ---------------- */
.settings-index { display: grid; gap: 4px; }
.settings-link { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 var(--s4); border-radius: var(--r-md); background: var(--surface-1); border: 1px solid var(--line); width: 100%; text-align: start; }
.settings-link span { flex: 1; }
.settings-link .ic:first-child { color: var(--gold); }
.settings-body { display: grid; gap: var(--s3); max-width: 760px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 58px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.set-label { font-weight: 600; } .set-sub { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.set-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.settings-list { display: grid; }
.notif-grid { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px 18px; }
.meter-row { display: flex; align-items: center; gap: 12px; }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold-metal); transform-origin: left; transform: scaleX(0); transition: transform 60ms linear; }
[dir="rtl"] .meter i { transform-origin: right; }
.cam-preview { width: 100%; max-width: 360px; aspect-ratio: 4/3; border-radius: var(--r-md); background: #000; object-fit: cover; transform: scaleX(-1); margin-top: 8px; }
.device-list { display: grid; gap: 4px; }
.device-row { display: flex; align-items: center; gap: 14px; min-height: 62px; border-bottom: 1px solid var(--line); }
.device-row > div { flex: 1; display: grid; min-width: 0; }
.device-row .ic { color: var(--gold); }
.diag { display: grid; gap: 2px; font-size: var(--fs-sm); }
.diag-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); word-break: break-word; }
.signout { margin-top: var(--s4); }

/* ---------------- Notifications ---------------- */
.notif-list { display: grid; gap: 2px; }
.notif { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 12px; border-radius: var(--r-md); text-align: start; width: 100%; border-bottom: 1px solid var(--line); }
.notif-text { display: grid; gap: 2px; } .notif-text b { font-weight: 600; }
.notif.unread { background: linear-gradient(90deg, rgba(231,185,107,.13), transparent); box-shadow: inset 3px 0 0 var(--gold); }
.notif-text { flex: 1; min-width: 0; } .notif-time { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.notif-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--gold); }

/* ---------------- Auth / system ---------------- */
.auth-screen, .system-screen { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--sat) + 24px) var(--gutter) calc(var(--sab) + 24px); background: radial-gradient(ellipse at 50% 0%, rgba(231,185,107,.12), transparent 60%), var(--bg); }
.auth-card, .system-card { width: min(420px, 100%); display: grid; gap: var(--s4); text-align: start; }
.auth-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: var(--s4); text-align: center; }
.auth-tag { color: var(--text-2); letter-spacing: .08em; }
.auth-switch { text-align: center; color: var(--text-2); font-size: var(--fs-sm); } .auth-switch a { color: var(--gold); font-weight: 600; }
.oauth-row { display: grid; gap: var(--s2); }
.verify { display: grid; gap: var(--s3); justify-items: center; text-align: center; } .verify-icon { width: 40px; height: 40px; color: var(--gold); }
#system { position: fixed; inset: 0; z-index: var(--z-system); background: var(--bg); overflow: auto; }
.system-card { text-align: center; justify-items: center; }
.onboarding { text-align: start; }
.ob-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); }
.ob-item > div:nth-child(2) { flex: 1; } .ob-item > .ic { color: var(--gold); }
.ob-item.granted { border-color: rgba(231,185,107,.5); } .ob-item.skipped { opacity: .55; }
.ob-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.install { display: grid; gap: var(--s4); justify-items: center; text-align: center; padding: var(--s4) 0; }
.page > section:empty { display: none; }

.share-row { display: grid; gap: 8px; margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }

/* Home: Active Rooms column on wide screens (owner design) */
.home-side { display: none; }
@media (min-width: 1200px) {
  .home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--s6); align-items: start; }
  .home-layout.no-side { display: block; }
  .home-main { min-width: 0; }
  .home-side { display: block; position: sticky; top: calc(var(--topbar-h, 64px) + 12px); }
}
.side-card { padding: var(--s4); border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); }
.active-rooms { display: grid; gap: var(--s3); }
.active-room { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.ar-art .poster { width: 56px; } .ar-art .poster-meta { display: none; }
.ar-text { display: grid; min-width: 0; } .ar-text b, .ar-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Share: link or QR (owner rule) */
.share-choices { display: grid; gap: var(--s3); }
.share-choice { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); text-align: start; }
.share-choice > svg { color: var(--gold); flex: none; }
.share-choice span { display: grid; gap: 2px; }
.qr-card { display: grid; justify-items: center; gap: var(--s3); text-align: center; }
.qr-frame { padding: 10px; border-radius: 18px; background: #fbf3e0; box-shadow: 0 0 0 2px var(--gold), 0 0 28px rgba(231,185,107,.35); line-height: 0; }
.share-btn svg { width: 18px; height: 18px; }

/* Profile: one scrolling page of poster rows (owner layout) */
.profile-sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); margin-top: var(--s5); min-width: 0; }
.profile-sec, .profile-sec > .rail { min-width: 0; max-width: 100%; }   /* rows scroll sideways instead of stretching the page */
.stat-btn { text-align: start; cursor: pointer; } .stat-btn b { color: var(--gold); }

/* Rooms (owner design): search icon → bar, gold + in the corner, gold pin on pinned Rooms */
.rooms-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.rooms-search-btn { color: var(--gold); }
.rooms-head.searching .rooms-search-btn { opacity: 0; pointer-events: none; }
.rooms-search { display: flex; align-items: center; gap: 10px; height: 52px; padding-inline: 16px 6px; margin: var(--s2) 0 var(--s4); border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(231,185,107,.10), rgba(255,255,255,.03)); border: 1px solid rgba(231,185,107,.45); box-shadow: 0 0 0 4px rgba(231,185,107,.08), 0 10px 28px rgba(0,0,0,.35);
  color: var(--gold); animation: roomsSearchIn var(--t-med) var(--ease) both; }
.rooms-search[hidden] { display: none; }
.rooms-search .search-input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: var(--fs-md); height: 100%; }
@keyframes roomsSearchIn { from { opacity: 0; transform: translateY(-6px) scaleX(.96); } to { opacity: 1; transform: none; } }
.fab-create { position: fixed; z-index: calc(var(--z-nav) - 1); inset-inline-end: calc(18px + var(--sar, 0px)); bottom: calc(var(--bottom-nav-h) + var(--sab) + 18px);
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #1a1408;
  background: linear-gradient(135deg, #f3d9a4, var(--gold) 55%, #b98a3e); box-shadow: 0 10px 26px rgba(0,0,0,.45), 0 0 22px rgba(231,185,107,.45); transition: transform var(--t-fast); }
.fab-create svg { width: 28px; height: 28px; stroke-width: 2.2; }
.fab-create:active { transform: scale(.92); }
.has-room-indicator .fab-create { bottom: calc(var(--bottom-nav-h) + var(--sab) + 86px); }
@media (min-width: 768px) { .fab-create { bottom: 28px; } .has-room-indicator .fab-create { bottom: 96px; } }
.page-rooms { padding-bottom: 96px; }
.room-card { position: relative; }
.room-card.pinned { border-color: rgba(231,185,107,.45); background: linear-gradient(135deg, rgba(231,185,107,.08), var(--surface-1) 60%); }
.room-pin { position: absolute; top: 8px; inset-inline-end: 10px; color: var(--gold); filter: drop-shadow(0 0 6px rgba(231,185,107,.6)); }
.room-pin svg { width: 18px; height: 18px; fill: rgba(231,185,107,.35); }
.rooms-none { margin-top: var(--s3); }
/* Profile background: fades out toward the counts */
.profile-banner { position: relative; overflow: hidden; }
.profile-banner .banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-med);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 100%); mask-image: linear-gradient(180deg, #000 30%, transparent 100%); }
.profile-banner .banner-img.loaded { opacity: .9; }
.profile-banner.has-img { height: 240px; margin-bottom: -150px; }
@media (min-width: 1024px) { .profile-banner.has-img { height: 320px; margin-bottom: -170px; } }
.banner-edit { display: grid; gap: var(--s2); margin-bottom: var(--s5); }
.banner-edit-preview { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.banner-edit-preview .profile-banner { margin: 0; height: 120px; }
.banner-edit-preview .profile-banner.has-img { height: 120px; margin: 0; }
.backdrop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.backdrop-choice { display: grid; gap: 6px; text-align: start; }
.backdrop-choice img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); }
.backdrop-choice:hover img, .backdrop-choice:focus-visible img { border-color: var(--gold); }
.profile-actions { margin-top: var(--s4); }
.profile-lock { margin-top: var(--s4); }
/* QR card */
.qr-brand { display: flex; align-items: center; gap: 8px; letter-spacing: .3em; font-weight: 700; color: var(--gold); }
.qr-brand .brand-ring { width: 18px; height: 18px; }
.qr-stats { display: flex; justify-content: center; gap: var(--s6); min-height: 48px; }
.qr-stat { display: grid; justify-items: center; } .qr-stat b { font-size: var(--fs-xl); color: var(--gold); } .qr-stat span { color: var(--text-2); font-size: var(--fs-sm); }
.qr-save { min-width: 200px; } .qr-save svg { width: 18px; height: 18px; }

.bell-btn { display: inline-flex; align-items: center; justify-content: center; padding-inline: 16px; min-width: 52px; } .bell-btn .ic { width: 20px; height: 20px; }
.bell-btn.on { color: var(--gold); border-color: rgba(231,185,107,.55); background: var(--gold-soft); box-shadow: var(--gold-glow); }

/* Seasons & episodes */
.seasons { display: grid; gap: var(--s3); min-width: 0; }
.season-summary { font-size: var(--fs-sm); }
.season-chips { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; }
.season-chips::-webkit-scrollbar { display: none; }
.season-chip { flex: none; min-width: 74px; display: grid; justify-items: center; gap: 2px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); color: var(--text-2); transition: border-color var(--t-fast), background var(--t-fast); }
.season-chip b { font-size: var(--fs-md); color: var(--text); } .season-chip small { font-size: 11px; color: var(--text-3); }
.season-chip.on { border-color: var(--gold); background: var(--gold-soft); box-shadow: var(--gold-glow); } .season-chip.on b { color: var(--gold); }
.season-chip.done small { color: var(--gold); }
.season-panel { display: grid; gap: var(--s3); padding: var(--s3); border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); min-width: 0; }
.season-panel[hidden] { display: none; }
.season-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.season-progress { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; } .season-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #f3d9a0); transition: width .3s ease; }
.ep-list { display: grid; gap: 2px; }
.ep { border-top: 1px solid var(--line); min-width: 0; } .ep:first-child { border-top: 0; }
.ep-main { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.ep-check { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; color: #1a1408; transition: background var(--t-fast), border-color var(--t-fast); }
.ep-check .ic { width: 18px; height: 18px; } .ep-check.on { background: var(--gold); border-color: var(--gold); } .ep-check:disabled { opacity: .35; }
.ep-info { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: start; } .ep-info b { font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ep-info small { font-size: 12px; }
.ep.watched .ep-info b { color: var(--text-2); } .ep.unaired .ep-info { opacity: .6; }
.ep-rating { flex: none; color: var(--gold); font-size: var(--fs-sm); font-weight: 700; }
.ep-open { flex: none; width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-3); } .ep-open .ic { width: 18px; height: 18px; transition: transform var(--t-fast); }
.ep.open .ep-open .ic { transform: rotate(90deg); }
.ep-detail { display: grid; gap: 10px; padding: 0 0 14px 40px; } .ep-detail[hidden] { display: none; }
.ep-overview { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }
.ep-mine { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ep-stars { display: flex; gap: 4px; } .ep-stars .star { font-size: 26px; line-height: 1; color: var(--text-3); padding: 2px 3px; } .ep-stars .star.on { color: var(--gold); }
.ep-note { width: 100%; resize: vertical; min-height: 76px; }
.ep-actions { display: flex; justify-content: flex-end; }
.ep-friends { display: grid; gap: 8px; } .ep-friends-h { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.ep-friend { display: flex; gap: 10px; align-items: flex-start; } .ep-friend p { margin: 2px 0 0; color: var(--text-2); font-size: var(--fs-sm); }

.ep-spoiler { display: inline-flex; align-items: center; gap: 6px; } .ep-spoiler .ic { width: 14px; height: 14px; }
.ep.next { box-shadow: inset 3px 0 0 var(--gold); background: linear-gradient(90deg, rgba(231,185,107,.07), transparent 40%); }
.home-continue:empty { display: none; } .home-continue { display: grid; gap: var(--s3); min-width: 0; }

/* ---- Watch Legacy card (v9_022) ---- */
.legacy-card { margin: var(--s4) 0; background: linear-gradient(180deg, #111113, #0a0a0b); border: 1px solid rgba(231,185,107,.22); border-radius: 22px; padding: 16px; height: 330px; display: flex; flex-direction: column; box-shadow: 0 0 40px -18px rgba(231,185,107,.35); overflow: hidden; }
.legacy-card[hidden] { display: none; }
.legacy-head { display: flex; align-items: center; gap: 8px; flex: none; }
.legacy-head .ic { width: 20px; height: 20px; color: var(--gold); flex: none; }
.legacy-head h3 { font-size: 16px; font-weight: 700; white-space: nowrap; margin: 0; }
.legacy-help { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--text-3); color: var(--text-3); font-size: 11px; display: grid; place-items: center; }
.legacy-seg { margin-inline-start: auto; display: flex; padding: 3px; border-radius: 999px; background: var(--surface-2, #151518); border: 1px solid var(--line); }
.legacy-tab { padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; transition: background 200ms, color 200ms; }
.legacy-tab.on { background: rgba(231,185,107,.16); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(231,185,107,.45); }
.legacy-body { flex: 1; min-height: 0; display: flex; flex-direction: column; will-change: opacity, transform; }
.legacy-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.legacy-cap { color: var(--text-2); font-size: 13px; margin-top: 14px; }
.legacy-big { color: var(--gold); font-size: 27px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legacy-big small { font-size: 15px; font-weight: 600; color: var(--gold-2, #f3d9a0); opacity: .8; }
.legacy-total { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.legacy-bar { display: flex; height: 8px; border-radius: 8px; overflow: hidden; gap: 3px; margin-top: 16px; background: rgba(255,255,255,.06); }
.legacy-bar i { display: block; height: 100%; border-radius: 8px; }
.legacy-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.legacy-legend b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.legacy-legend b i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legacy-legend span { display: block; font-size: 13px; margin-top: 5px; white-space: nowrap; }
.legacy-legend em { display: block; color: var(--text-3); font-size: 12px; font-style: normal; margin-top: 1px; }
.legacy-foot { margin-top: auto; padding-top: 10px; color: var(--text-3); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.legacy-foot .ic { width: 14px; height: 14px; } .legacy-foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.legacy-hint { flex-basis: 100%; color: var(--gold); }
.legacy-rank-pane { gap: 6px; }
.legacy-rows { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin-top: 8px; scrollbar-width: none; }
.legacy-rows::-webkit-scrollbar { display: none; }
.legacy-row { display: grid; grid-template-columns: 26px 36px 1fr auto; align-items: center; column-gap: 10px; padding: 8px 4px; }
.legacy-rk { color: var(--text-3); font-weight: 700; text-align: center; font-size: 14px; } .legacy-rk.crown { color: var(--gold); } .legacy-rk .ic { width: 18px; height: 18px; }
.legacy-row.me .avatar { box-shadow: 0 0 0 1.5px var(--gold), 0 0 12px -3px rgba(231,185,107,.6); }
.legacy-who { min-width: 0; } .legacy-nm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .legacy-row.me .legacy-nm { color: var(--gold); }
.legacy-tr { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); margin-top: 6px; overflow: hidden; }
.legacy-tr i { display: block; height: 100%; border-radius: 4px; background: #6b6862; } .legacy-row.me .legacy-tr i, .legacy-row.first .legacy-tr i { background: linear-gradient(90deg, var(--gold), var(--gold-2, #f3d9a0)); }
.legacy-hrs { text-align: end; font-weight: 700; font-size: 14px; } .legacy-hrs small { display: block; color: var(--text-3); font-weight: 500; font-size: 11px; white-space: nowrap; }
.legacy-pin { flex: none; padding: 9px 12px; border-radius: 14px; background: rgba(231,185,107,.10); border: 1px solid rgba(231,185,107,.4); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gold); font-weight: 600; }
.legacy-pin[hidden] { display: none; } .legacy-pin span { margin-inline-start: auto; }
.legacy-empty { padding: 10px 4px; }
.legacy-help-text p { margin: 0 0 10px; line-height: 1.5; }
/* rewatch counter: a round button that only shows a number */
.replay { flex: none; width: 46px; height: 46px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 17px; font-weight: 800; border: 1.5px solid rgba(231,185,107,.55); color: var(--gold); background: rgba(231,185,107,.08); transition: background 160ms, box-shadow 160ms; }
.replay[hidden] { display: none; }
.replay.inf { font-size: 24px; background: rgba(231,185,107,.18); box-shadow: 0 0 16px -4px rgba(231,185,107,.6); }
.replay-sm { width: 32px; height: 32px; font-size: 14px; } .replay-sm.inf { font-size: 18px; }
.season-actions { display: flex; align-items: center; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .legacy-body { transition: none !important; } }
.legacy-loading { opacity: .55; }

/* legal pages */
.page-legal { max-width: 720px; margin: 0 auto; padding-bottom: var(--s6); }
.legal-sec h2 { font-size: var(--fs-md); color: var(--gold); margin: var(--s4) 0 var(--s1); }
.legal-sec p { line-height: 1.65; color: var(--text-2); margin: 0; }
.legal-links { text-align: center; margin-top: var(--s3); } .legal-links a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.tour { text-align: center; }
.tour-icon { width: 76px; height: 76px; margin: 0 auto var(--s3); border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); border: 1px solid rgba(231,185,107,.4); box-shadow: var(--gold-glow); color: var(--gold); }
.tour-icon .ic { width: 34px; height: 34px; }
.tour-dots { display: flex; gap: 8px; justify-content: center; margin: var(--s4) 0; } .tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.18); transition: background 200ms, width 200ms; } .tour-dots i.on { background: var(--gold); width: 22px; border-radius: 8px; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); } .tour-next { min-width: 120px; }

/* help & admin */
.help-log { height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); scrollbar-width: none; }
.help-msg { max-width: 86%; padding: 9px 12px; border-radius: 16px; line-height: 1.45; font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.help-msg small { display: block; margin-top: 4px; color: var(--text-3); font-size: 11px; }
.help-msg.bot { align-self: flex-start; background: var(--surface-2, #151518); border: 1px solid var(--line); }
.help-msg.me { align-self: flex-end; background: var(--gold-soft); border: 1px solid rgba(231,185,107,.4); }
.help-msg.wait { opacity: .6; }
.help-form { display: flex; gap: 8px; margin: 10px 0; } .help-input { flex: 1; min-width: 0; }
.help-handoff { align-self: flex-start; }
.help-thread { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.help-ticket-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: start; padding: 12px; margin-bottom: 8px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); }
.ticket-snippet { display: block; margin-top: 2px; }
.ticket-status { flex: none; font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); }
.ticket-status.open { color: var(--gold); border-color: rgba(231,185,107,.5); } .ticket-status.answered { color: #7fd6a0; border-color: rgba(127,214,160,.4); }
.admin-seg { margin: 0 0 12px; width: max-content; }
.err-report { padding: 12px; margin-bottom: 10px; border-radius: var(--r-lg); background: var(--surface-1); border: 1px solid var(--line); } .err-report.seen { opacity: .55; }
.err-report p { margin: 6px 0; line-height: 1.5; } .err-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sev { font-size: 11px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; } .sev.high { background: rgba(240,80,80,.18); color: #ff8a8a; } .sev.medium { background: rgba(231,185,107,.18); color: var(--gold); } .sev.low { background: rgba(255,255,255,.08); color: var(--text-2); }

/* import */
.import-steps { padding-inline-start: 20px; line-height: 1.7; color: var(--text-2); margin: var(--s2) 0; }
.import-status { margin-top: var(--s3); } .import-progress { height: 8px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; margin: var(--s3) 0; } .import-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2, #f3d9a0)); transition: width 160ms; }
.import-missing { margin: var(--s3) 0; color: var(--text-2); } .import-missing ul { max-height: 220px; overflow: auto; padding-inline-start: 20px; line-height: 1.6; }
.import-review h3, .import-done h3 { margin: 0 0 var(--s2); }

/* half stars */
.star.half { color: transparent; background: linear-gradient(90deg, var(--gold) 50%, rgba(255,255,255,.2) 50%); -webkit-background-clip: text; background-clip: text; text-shadow: none; }
:root[dir="rtl"] .star.half, [dir="rtl"] .star.half { background: linear-gradient(270deg, var(--gold) 50%, rgba(255,255,255,.2) 50%); -webkit-background-clip: text; background-clip: text; }
