/* SyncWave — interfaz cinematográfica, compacta y adaptable */
:root {
  --sw-bg: #090a0d;
  --sw-panel: #121419;
  --sw-panel-2: #191c22;
  --sw-panel-3: #20242c;
  --sw-line: rgba(255, 255, 255, .09);
  --sw-line-strong: rgba(255, 255, 255, .15);
  --sw-text: #f4f4f6;
  --sw-muted: #969ba7;
  --sw-accent: #7657ff;
  --sw-accent-2: #30d5c8;
  --sw-good: #45d48a;
  --sw-warn: #ffb454;
  --sw-bad: #ff617f;
  --sw-radius: 18px;
  --sw-header: 64px;
  --sw-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--sw-bg); }

body {
  min-width: 320px;
  margin: 0;
  background: var(--sw-bg);
  color: var(--sw-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior-y: none;
}

button, input, textarea { font: inherit; }
a { color: inherit; }
.min-w-0 { min-width: 0; }

::selection { background: rgba(118, 87, 255, .42); color: #fff; }

.sw-gradient-text {
  background: linear-gradient(105deg, #a794ff, #55ddd3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sw-panel {
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-radius);
}

.btn {
  border-radius: 12px;
  font-weight: 650;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, opacity .18s ease;
}

.btn:active { transform: translateY(1px); }

.btn-sw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  background: var(--sw-accent);
  border: 1px solid var(--sw-accent);
  color: #fff;
  box-shadow: 0 10px 28px rgba(118, 87, 255, .24);
}
.btn-sw:hover, .btn-sw:focus { background: #846aff; border-color: #846aff; color: #fff; }
.btn-sw:disabled { opacity: .5; }

.btn-quiet,
.btn-outline-light,
.btn-outline-secondary {
  background: var(--sw-panel-2);
  border: 1px solid var(--sw-line-strong);
  color: var(--sw-text);
}
.btn-quiet:hover,
.btn-outline-light:hover,
.btn-outline-secondary:hover { background: var(--sw-panel-3); border-color: rgba(255, 255, 255, .25); color: #fff; }

.form-label {
  margin-bottom: .45rem;
  color: #c5c8d0;
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .01em;
}

.form-control, .form-select {
  min-height: 46px;
  background: #0e1014;
  border: 1px solid var(--sw-line-strong);
  border-radius: 12px;
  color: var(--sw-text);
}
.form-control:hover, .form-select:hover { border-color: rgba(255, 255, 255, .22); }
.form-control:focus, .form-select:focus {
  background: #0e1014;
  border-color: var(--sw-accent);
  box-shadow: 0 0 0 3px rgba(118, 87, 255, .15);
  color: var(--sw-text);
}
.form-control::placeholder { color: #656a75; }
.form-switch .form-check-input { background-color: #2c3038; border-color: transparent; }
.form-switch .form-check-input:checked { background-color: var(--sw-accent); }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 3px rgba(118, 87, 255, .15); }

.alert-danger { background: rgba(255, 97, 127, .09); border-color: rgba(255, 97, 127, .28); color: #ff9bae; }
.dropdown-menu { background: #17191f; border: 1px solid var(--sw-line-strong); box-shadow: var(--sw-shadow); }
.dropdown-header { color: var(--sw-muted); }
.dropdown-item { color: var(--sw-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--sw-panel-3); color: #fff; }
.dropdown-item.active { background: rgba(118, 87, 255, .18); color: #c9beff; }

/* Portada */
.home-page { min-height: 100vh; overflow-x: hidden; }

.home-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(700px 500px at 7% 15%, rgba(118, 87, 255, .14), transparent 68%),
    radial-gradient(600px 420px at 92% 80%, rgba(48, 213, 200, .07), transparent 70%);
}
.home-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

.home-nav,
.home-shell,
.home-footer { position: relative; z-index: 1; }

.home-nav {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 760;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--sw-accent);
  box-shadow: 0 8px 24px rgba(118, 87, 255, .28);
}
.brand-mark i { transform: translateX(1px); }

.home-nav-note {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--sw-muted);
  font-size: .78rem;
}
.account-nav { display: flex; align-items: center; gap: .55rem; }
.account-nav form { margin: 0; }
.account-chip { display: inline-flex; align-items: center; gap: .42rem; color: #c9ccd3; font-size: .76rem; }
.account-chip i { color: #a99cff; }
.status-pulse {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: var(--sw-good);
  box-shadow: 0 0 0 4px rgba(69, 212, 138, .1);
}

.home-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 500px);
  gap: clamp(3rem, 8vw, 8rem);
  align-items: center;
  padding-top: clamp(3rem, 8vh, 6.5rem);
  padding-bottom: 5rem;
}

.home-intro { max-width: 650px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.35rem;
  color: #aca0ef;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.home-intro h1 {
  margin: 0;
  font-size: clamp(3.2rem, 6.3vw, 6.2rem);
  font-weight: 780;
  letter-spacing: -.065em;
  line-height: .92;
}
.home-intro h1 span { color: #777d89; }
.home-intro > p {
  max-width: 570px;
  margin: 1.65rem 0 0;
  color: #a4a8b1;
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  line-height: 1.65;
}
.home-points {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1.2rem;
  margin-top: 2rem;
  color: #b6bac3;
  font-size: .78rem;
}
.home-points span { display: inline-flex; align-items: center; gap: .45rem; }
.home-points i { color: var(--sw-accent-2); }

.home-actions { width: 100%; }
.action-card {
  background: rgba(18, 20, 25, .91);
  border: 1px solid var(--sw-line);
  border-radius: 22px;
  box-shadow: var(--sw-shadow);
  backdrop-filter: blur(18px);
}
.action-card-primary { padding: clamp(1.25rem, 3vw, 2rem); }
.action-heading { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; }
.action-heading h2 { margin: 0 0 .2rem; font-size: 1.18rem; font-weight: 720; letter-spacing: -.02em; }
.action-heading p { margin: 0; color: var(--sw-muted); font-size: .82rem; }
.action-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(118, 87, 255, .35);
  border-radius: 50%;
  color: #b6a9ff;
  font: 700 .66rem ui-monospace, monospace;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.creator-identity { display: flex; flex-direction: column; }
.creator-identity > span:last-child { min-height: 46px; display: flex; align-items: center; gap: .45rem; padding: 0 .8rem; border: 1px solid var(--sw-line); border-radius: 12px; background: rgba(255,255,255,.025); color: #d8dae0; font-size: .82rem; }
.creator-identity i { color: var(--sw-good); }

.advanced-options {
  margin: 1rem 0;
  border: 1px solid var(--sw-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .018);
}
.advanced-options summary {
  padding: .8rem .9rem;
  color: #c1c4cc;
  cursor: pointer;
  font-size: .78rem;
  list-style: none;
}
.advanced-options summary::-webkit-details-marker { display: none; }
.advanced-options summary::after { content: "+"; float: right; color: var(--sw-muted); font-size: 1rem; line-height: 1; }
.advanced-options[open] summary::after { content: "−"; }
.advanced-options summary i { margin-right: .4rem; color: var(--sw-accent-2); }
.advanced-options summary span { margin-left: .3rem; color: #686d77; }
.advanced-body { padding: 0 .9rem .9rem; }
.advanced-body .form-control { min-height: 42px; font-size: .82rem; }
.advanced-body .form-check-label { color: var(--sw-muted); font-size: .78rem; }
.permission-note { color: #8f95a0; font-size: .72rem; line-height: 1.45; }
.permission-note i { margin-right: .35rem; color: #a99cff; }

.join-divider {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: .85rem 0;
  color: #676c76;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.join-divider::before, .join-divider::after { content: ""; height: 1px; flex: 1; background: var(--sw-line); }
.action-card-join { padding: .7rem; border-radius: 16px; box-shadow: none; }
.join-form { display: grid; grid-template-columns: 1fr auto; gap: .55rem; }
.join-form .form-control { min-width: 0; min-height: 42px; font-size: .82rem; }
.join-form .btn { min-width: 88px; white-space: nowrap; }
.hero-code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .16em; text-transform: uppercase; }

.recent-section { grid-column: 1 / -1; margin-top: 1.5rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: 0; font-size: .95rem; font-weight: 680; }
.section-heading span { color: var(--sw-muted); font-size: .75rem; }
.recent-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.recent-room {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem .9rem;
  background: rgba(18, 20, 25, .72);
  border: 1px solid var(--sw-line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.recent-room:hover { background: var(--sw-panel); border-color: var(--sw-line-strong); transform: translateY(-1px); }
.recent-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 9px; background: var(--sw-panel-3); color: #c3b9ff; }
.recent-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.recent-copy strong { overflow: hidden; color: #e9e9ec; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.recent-copy small { color: var(--sw-muted); font-size: .7rem; }
.recent-arrow { color: #555b65; font-size: .75rem; }

.room-code-pill {
  padding: .26rem .48rem;
  border: 1px solid var(--sw-line);
  border-radius: 7px;
  color: #aaafb9;
  font: 650 .65rem ui-monospace, Menlo, monospace;
  letter-spacing: .12em;
}
.empty-rooms { display: flex; align-items: center; justify-content: center; gap: .85rem; padding: 1.2rem; border: 1px dashed var(--sw-line-strong); border-radius: 16px; color: var(--sw-muted); }
.empty-rooms > i { color: #9585ed; font-size: 1.35rem; }
.empty-rooms div { display: flex; flex-direction: column; }
.empty-rooms strong { color: #dfe1e5; font-size: .82rem; }
.empty-rooms span { font-size: .72rem; }

.home-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.4rem;
  padding-bottom: 1.6rem;
  border-top: 1px solid var(--sw-line);
  color: #636873;
  font-size: .7rem;
}

/* Acceso y registro */
.auth-page { min-height: 100vh; overflow-x: hidden; }
.auth-shell { position: relative; z-index: 1; width: min(100% - 2rem, 440px); min-height: 100vh; display: flex; flex-direction: column; justify-content: center; margin: 0 auto; padding: 2rem 0; }
.auth-brand { align-self: center; margin-bottom: 1.2rem; }
.auth-card { padding: clamp(1.35rem, 5vw, 2rem); border: 1px solid var(--sw-line); border-radius: 22px; background: rgba(18,20,25,.94); box-shadow: var(--sw-shadow); backdrop-filter: blur(18px); }
.auth-card h1 { margin: .28rem 0 .45rem; font-size: clamp(1.6rem, 6vw, 2rem); font-weight: 760; letter-spacing: -.04em; }
.auth-card > p { margin-bottom: 1.25rem; color: var(--sw-muted); font-size: .82rem; line-height: 1.55; }
.auth-kicker { color: #a99cff; font-size: .64rem; font-weight: 760; letter-spacing: .1em; text-transform: uppercase; }
.auth-notice { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; padding: .65rem .75rem; border: 1px solid rgba(69,212,138,.2); border-radius: 11px; background: rgba(69,212,138,.07); color: #a9dec3; font-size: .72rem; }
.auth-form { display: flex; flex-direction: column; gap: .85rem; }
.auth-form .btn { margin-top: .3rem; }
.auth-switch { min-height: 1rem; margin-top: 1rem; color: var(--sw-muted); font-size: .75rem; text-align: center; }
.auth-switch a { color: #b9aeff; font-weight: 650; }
.denied-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto .8rem; border: 1px solid var(--sw-line); border-radius: 16px; background: var(--sw-panel-2); color: #a99cff; font-size: 1.35rem; }

/* Sala */
.room-page { height: 100dvh; overflow: hidden; }
.viewer-mode .host-only,
.viewer-mode .host-control { display: none !important; }
.viewer-mode .side-tabs { display: none; }
.viewer-mode .big-play { display: none !important; }
.viewer-mode .controls { padding-top: .25rem; }
.viewer-mode .ctrl-row { padding-top: .15rem; }
.viewer-mode .time-label::before { content: "Viendo · "; color: rgba(255,255,255,.48); }
.app-shell { height: 100dvh; min-height: 100dvh; display: flex; flex-direction: column; }

.app-header {
  height: var(--sw-header);
  flex: 0 0 var(--sw-header);
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: env(safe-area-inset-top) .9rem 0;
  background: rgba(9, 10, 13, .94);
  border-bottom: 1px solid var(--sw-line);
  backdrop-filter: blur(16px);
  z-index: 10;
}
.header-icon,
.invite-button,
.ctrl-btn {
  border: 0;
  color: #f4f4f6;
  background: transparent;
}
.header-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 1.05rem;
  text-decoration: none;
}
.header-icon:hover, .header-icon:focus-visible { background: var(--sw-panel-2); color: #fff; }
.room-heading { line-height: 1.15; }
.room-title-row { display: flex; align-items: center; gap: .55rem; }
.room-title { font-size: .88rem; font-weight: 680; }
.host-label { padding: .15rem .38rem; border-radius: 5px; background: rgba(118, 87, 255, .14); color: #ae9fff; font-size: .56rem; font-weight: 760; letter-spacing: .06em; text-transform: uppercase; }
.room-presence { display: flex; align-items: center; gap: .38rem; margin-top: .2rem; color: var(--sw-muted); font-size: .68rem; }
.member-summary { display: flex; align-items: center; gap: .38rem; padding: .35rem .55rem; border: 1px solid var(--sw-line); border-radius: 9px; color: var(--sw-muted); font-size: .72rem; }
.invite-button { min-height: 38px; display: flex; align-items: center; gap: .55rem; padding: 0 .75rem; border: 1px solid var(--sw-line-strong); border-radius: 10px; background: var(--sw-panel-2); }
.invite-button:hover { background: var(--sw-panel-3); }
.invite-code { color: #cbcfd6; font: 700 .7rem ui-monospace, Menlo, monospace; letter-spacing: .14em; }

.conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sw-muted); }
.conn-dot.on { background: var(--sw-good); box-shadow: 0 0 0 3px rgba(69, 212, 138, .09); }
.conn-dot.off { background: var(--sw-bad); }
.conn-dot.wait { background: var(--sw-warn); }

.app-body { flex: 1 1 auto; min-height: 0; display: flex; background: #050608; }
.stage { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; padding: 14px; }
.side {
  width: 350px;
  flex: 0 0 350px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sw-panel);
  border-left: 1px solid var(--sw-line);
}
.side-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 .9rem; border-bottom: 1px solid var(--sw-line); color: #d9dbe0; font-size: .78rem; font-weight: 680; }
.side-status { display: flex; align-items: center; gap: .38rem; color: var(--sw-muted); font-size: .65rem; font-weight: 500; }

/* Reproductor */
.player-wrap {
  position: relative;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.38);
}
.player-wrap.is-fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
.player-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-wrap:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }

.player-meta { position: absolute; top: 1rem; left: 1rem; right: 12rem; z-index: 2; pointer-events: none; transition: opacity .25s ease; }
.source-title { display: inline-block; max-width: min(70vw, 620px); overflow: hidden; color: rgba(255,255,255,.78); font-size: .75rem; font-weight: 570; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 8px #000; vertical-align: middle; }
.source-kind { display: inline-block; margin-left: .45rem; padding: .18rem .38rem; border: 1px solid rgba(255,255,255,.14); border-radius: 5px; background: rgba(0,0,0,.35); color: rgba(255,255,255,.62); font-size: .52rem; font-weight: 750; letter-spacing: .07em; vertical-align: middle; }
.player-wrap.hide-ui .player-meta { opacity: 0; }

.player-badges { position: absolute; top: .8rem; right: .8rem; z-index: 2; display: flex; gap: .4rem; pointer-events: none; transition: opacity .25s ease; }
.player-wrap.hide-ui .player-badges { opacity: 0; }
.badge-soft { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .55rem; background: rgba(8,9,12,.64); border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: rgba(255,255,255,.82); font-size: .62rem; font-weight: 600; backdrop-filter: blur(8px); }
.sync-dot, .live-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--sw-good); }
.live-dot { background: var(--sw-bad); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Mensajes breves sobre el video, al estilo de un chat de streaming. */
.player-chat-overlay {
  position: absolute;
  left: .85rem;
  bottom: 4.8rem;
  z-index: 2;
  width: min(72%, 520px);
  max-height: 38%;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  gap: .35rem;
  overflow: hidden;
  pointer-events: none;
}
.player-wrap.is-fullscreen .player-chat-overlay,
.player-wrap:fullscreen .player-chat-overlay { display: flex; }
.video-chat-message {
  --chat-color: #7c5cff;
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: .42rem;
  padding: .38rem .56rem .4rem .42rem;
  border: 1px solid rgba(255,255,255,.11);
  border-left: 3px solid var(--chat-color);
  border-radius: 7px 12px 12px 7px;
  background: rgba(8,9,13,.78);
  color: rgba(255,255,255,.92);
  box-shadow: 0 7px 22px rgba(0,0,0,.28);
  font-size: clamp(.68rem, 1.7vw, .79rem);
  line-height: 1.32;
  backdrop-filter: blur(9px);
  animation: video-chat-in .2s ease-out both;
}
.video-chat-message.mine { background: rgba(38,29,75,.8); }
.video-chat-avatar { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 7px; background: var(--chat-color); color: #090a0d; font-size: .57rem; font-weight: 800; }
.video-chat-copy { min-width: 0; overflow-wrap: anywhere; }
.video-chat-name { margin-right: .35rem; color: var(--chat-color); font-weight: 760; }
.video-chat-reply { display: block; max-width: 40vw; margin-bottom: .12rem; color: rgba(255,255,255,.58); font-size: .84em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-chat-message.leaving { animation: video-chat-out .22s ease-in both; }
@keyframes video-chat-in { from { opacity: 0; transform: translateX(-10px); } }
@keyframes video-chat-out { to { opacity: 0; transform: translateY(-5px); } }

.player-overlay { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(to top, rgba(0,0,0,.84) 0%, rgba(0,0,0,.28) 21%, transparent 48%); opacity: 1; transition: opacity .25s ease; }
.player-wrap.hide-ui .player-overlay { opacity: 0; pointer-events: none; }
.player-wrap.hide-ui { cursor: none; }
.controls { padding: .5rem .8rem calc(.65rem + env(safe-area-inset-bottom)); }
.seek { --pct: 0%; position: relative; height: 24px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek .track { position: relative; width: 100%; height: 3px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.22); transition: height .15s ease; }
.seek:hover .track, .seek:focus .track { height: 5px; }
.seek .buffer, .seek .played { position: absolute; inset: 0 auto 0 0; }
.seek .buffer { width: 0%; background: rgba(255,255,255,.24); }
.seek .played { width: var(--pct); background: #fff; }
.seek .knob { position: absolute; top: 50%; left: var(--pct); width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px #000; transform: translate(-50%, -50%) scale(.75); opacity: 0; transition: opacity .15s ease, transform .15s ease; }
.seek:hover .knob, .seek:focus .knob { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ctrl-row { display: flex; align-items: center; gap: .05rem; }
.ctrl-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; font-size: 1.05rem; }
.ctrl-btn:hover, .ctrl-btn:focus-visible { background: rgba(255,255,255,.11); }
.ctrl-btn:disabled { opacity: .35; }
.time-label { margin-left: .25rem; color: rgba(255,255,255,.76); font-size: .72rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.volume-wrap { display: flex; align-items: center; gap: .25rem; }
.volume-wrap input[type=range] { width: 72px; accent-color: #fff; }

.player-center { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none; }
.big-play { width: 68px; height: 68px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; background: rgba(15,16,20,.7); color: #fff; font-size: 2rem; box-shadow: 0 12px 35px rgba(0,0,0,.46); backdrop-filter: blur(12px); pointer-events: auto; transition: transform .18s ease, background .18s ease; }
.big-play:hover { background: rgba(118,87,255,.82); transform: scale(1.04); }
.big-play i { transform: translateX(2px); }

.player-status { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at center, #13161d, #07080b 62%); text-align: center; }
.empty-player-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 1rem; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; background: rgba(255,255,255,.035); color: #9d8cff; font-size: 1.55rem; }
.player-status-title { font-size: .95rem; font-weight: 680; }
.player-status-copy { max-width: 330px; margin-top: .35rem; color: var(--sw-muted); font-size: .76rem; line-height: 1.5; }
.spinner-ring { width: 38px; height: 38px; margin: 0 auto .9rem; border: 2px solid rgba(255,255,255,.16); border-top-color: var(--sw-accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.media-embed { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-wrap.embed-mode .player-overlay,
.player-wrap.embed-mode .player-center { display: none; }
.player-wrap.embed-mode .player-meta,
.player-wrap.embed-mode .player-badges { opacity: 0; pointer-events: none; }
.embed-note { position: absolute; left: 50%; bottom: .75rem; z-index: 5; display: flex; align-items: center; gap: .7rem; max-width: calc(100% - 1.5rem); padding: .45rem .65rem; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; background: rgba(9,10,13,.84); color: #b8bcc5; font-size: .66rem; backdrop-filter: blur(12px); transform: translateX(-50%); white-space: nowrap; }
.embed-note a { color: #b5a8ff; text-decoration: none; font-weight: 650; }
.embed-note a:hover { text-decoration: underline; }

/* Panel lateral */
.side-tabs { padding: .35rem .5rem; border-bottom: 1px solid var(--sw-line); }
.side-tabs .nav-item { flex: 1; }
.side-tabs .nav-link { width: 100%; display: flex; align-items: center; justify-content: center; gap: .38rem; padding: .48rem .35rem; border: 0; border-radius: 8px; color: var(--sw-muted); font-size: .72rem; }
.side-tabs .nav-link:hover { color: #d7d9de; }
.side-tabs .nav-link.active { background: var(--sw-panel-2); color: #fff; }
.tab-count { min-width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--sw-panel-3); color: var(--sw-muted); font-size: .62rem; }
.tab-pane-fill { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; }
.tab-pane-fill.active { display: flex; }
.chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .9rem; display: flex; flex-direction: column; gap: .65rem; scrollbar-width: thin; scrollbar-color: #313640 transparent; }
.msg { width: 100%; display: flex; align-items: flex-start; gap: .55rem; }
.msg .avatar { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 9px; color: #0c0d10; font-size: .68rem; font-weight: 760; }
.msg-body { min-width: 0; max-width: min(82%, 270px); }
.msg-head { display: flex; gap: .4rem; margin-bottom: .18rem; color: #6e737e; font-size: .64rem; }
.msg-head .who { font-weight: 700; }
.msg-reply-action { width: 20px; height: 17px; display: inline-grid; place-items: center; margin: -2px 0; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #8e94a0; font-size: .82rem; opacity: .38; transition: opacity .15s ease, color .15s ease, background .15s ease; }
.msg:hover .msg-reply-action, .msg-reply-action:focus-visible { opacity: 1; color: #c7bcff; background: rgba(124,92,255,.13); }
.msg-reply-action:disabled { visibility: hidden; }
.msg-text { padding: .42rem .62rem; background: var(--sw-panel-2); border: 1px solid rgba(255,255,255,.055); border-radius: 4px 12px 12px; font-size: .78rem; line-height: 1.42; overflow-wrap: anywhere; }
.msg-main-text { display: block; white-space: pre-wrap; }
.msg-reply-quote { width: 100%; display: block; margin: -.12rem 0 .38rem; padding: .34rem .45rem; overflow: hidden; border: 0; border-left: 3px solid var(--sw-accent); border-radius: 5px; background: rgba(255,255,255,.055); color: inherit; text-align: left; }
.msg-reply-quote:hover, .msg-reply-quote:focus-visible { background: rgba(255,255,255,.09); }
.msg-reply-who, .msg-reply-copy { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reply-who { color: #b7aaff; font-size: .68rem; font-weight: 760; }
.msg-reply-copy { color: #8f95a0; font-size: .68rem; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .msg-head { justify-content: flex-end; }
.msg.mine .msg-text { border-radius: 12px 4px 12px 12px; background: rgba(118,87,255,.18); border-color: rgba(118,87,255,.3); }
.msg.pending { opacity: .5; }
.msg.failed .msg-text { border-color: var(--sw-bad); }
.msg.reply-highlight .msg-text { animation: reply-highlight 1.5s ease; }
@keyframes reply-highlight { 0%, 100% { box-shadow: none; } 25%, 70% { box-shadow: 0 0 0 2px rgba(157,140,255,.72), 0 0 22px rgba(124,92,255,.25); } }
.msg-system { align-self: center; padding: .2rem .55rem; border-radius: 999px; background: rgba(255,255,255,.035); color: #737884; font-size: .64rem; text-align: center; }
.typing-line { height: 1rem; padding: 0 .8rem; color: var(--sw-muted); font-size: .65rem; }
.chat-form { flex: 0 0 auto; padding: .65rem; padding-bottom: calc(.65rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--sw-line); background: var(--sw-panel); }
.reply-compose { display: flex; align-items: center; gap: .55rem; margin: 0 0 .5rem; padding: .42rem .48rem .42rem .6rem; border-left: 3px solid var(--sw-accent); border-radius: 7px; background: rgba(124,92,255,.09); }
.reply-compose-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.reply-compose strong { color: #b7aaff; font-size: .7rem; }
.reply-compose span { overflow: hidden; color: #959aa5; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.reply-compose > button { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #a1a6b0; }
.reply-compose > button:hover, .reply-compose > button:focus-visible { background: rgba(255,255,255,.08); color: #fff; }
.chat-form textarea { min-height: 40px; max-height: 104px; resize: none; font-size: 16px; }
.chat-form .btn { min-height: 40px; align-self: stretch; }
.member-row { display: flex; align-items: center; gap: .65rem; padding: .65rem .8rem; border-bottom: 1px solid rgba(255,255,255,.045); font-size: .78rem; }
.event-details { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--sw-line); color: var(--sw-muted); font-size: .72rem; }
.event-details summary { cursor: pointer; }
.event-log { display: flex; flex-direction: column; gap: .35rem; margin-top: .65rem; }
.format-strip { display: flex; flex-wrap: wrap; gap: .35rem; margin: .7rem 0; }
.format-strip span { padding: .2rem .42rem; border: 1px solid var(--sw-line); border-radius: 6px; background: rgba(255,255,255,.025); color: #858b96; font-size: .59rem; font-weight: 680; letter-spacing: .035em; }

.toast-stack { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); z-index: 1080; width: min(92vw, 420px); display: flex; flex-direction: column; gap: .4rem; transform: translateX(-50%); pointer-events: none; }
.sw-toast { padding: .65rem .8rem; background: rgba(24,27,34,.97); border: 1px solid var(--sw-line-strong); border-radius: 12px; box-shadow: var(--sw-shadow); font-size: .76rem; animation: toast-in .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-content { box-shadow: var(--sw-shadow); }

/* Responsive */
@media (max-width: 991.98px) {
  .msg-reply-action { opacity: .75; }
  .home-shell { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 3rem; }
  .home-intro { max-width: 760px; text-align: center; margin: 0 auto; }
  .home-intro > p { margin-left: auto; margin-right: auto; }
  .home-points { justify-content: center; }
  .home-actions { max-width: 600px; margin: 0 auto; }

  .app-body { flex-direction: column; }
  .stage { flex: 0 0 auto; padding: 0; }
  .player-wrap { flex: 0 0 auto; aspect-ratio: 16 / 9; border: 0; border-radius: 0; box-shadow: none; }
  .side { width: 100%; flex: 1 1 auto; min-height: 0; border-top: 1px solid var(--sw-line); border-left: 0; }
  .side-heading { display: none; }
  .toast-stack { top: calc(var(--sw-header) + .5rem); bottom: auto; }
  .volume-wrap { display: none; }
  .resync-control { display: none; }
}

@media (max-width: 767.98px) {
  .home-nav, .home-shell, .home-footer { padding-left: 1.15rem; padding-right: 1.15rem; }
  .home-nav-note { display: none; }
  .home-shell { padding-top: 2.4rem; padding-bottom: 3.5rem; }
  .home-intro h1 { font-size: clamp(3rem, 14vw, 4.6rem); }
  .home-points { gap: .55rem 1rem; }
  .recent-grid { grid-template-columns: 1fr; }
  .recent-section { margin-top: .5rem; }
  .home-footer { flex-direction: column; }

  .app-header { gap: .35rem; padding-left: .45rem; padding-right: .45rem; }
  .member-summary { display: none; }
  .invite-button { padding: 0 .55rem; }
  .invite-code { font-size: .64rem; }
  .player-meta { top: .7rem; left: .7rem; right: 9.5rem; }
  .player-badges { top: .55rem; right: .55rem; }
  .sync-badge { display: none; }
  .player-chat-overlay { left: .5rem; bottom: 3.85rem; width: min(82%, 430px); gap: .25rem; }
  .video-chat-message { padding: .3rem .48rem .32rem .34rem; }
  .controls { padding: .25rem .4rem calc(.35rem + env(safe-area-inset-bottom)); }
  .ctrl-btn { width: 36px; height: 36px; }
  .time-label { font-size: .66rem; }
  .big-play { width: 58px; height: 58px; font-size: 1.75rem; }
  .embed-note span { display: none; }
}

@media (max-width: 520px) {
  .field-grid { grid-template-columns: 1fr; }
  .join-form .btn { grid-column: 2; grid-row: 1; }
  .account-chip { max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-nav .btn span { display: none; }
  .home-points span:last-child { display: none; }
  .room-title { max-width: 37vw; }
  .skip-control { display: none; }
  .side-tabs .nav-link { font-size: .68rem; }
}

@media (orientation: landscape) and (max-height: 560px) {
  body.cinema .app-header { display: none; }
  body.cinema .player-wrap { height: 100dvh; aspect-ratio: auto; }
  body.cinema .side { display: none; }
  .player-wrap { height: 62dvh; aspect-ratio: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
