/* ============================================
   Renor Meet — design tokens allineati a renor.it
   ============================================ */

/* Raleway + Sora (self-hosted, variable fonts). No Google Fonts CDN —
   GDPR (LG München 2022), no external DNS, better LCP. */
@font-face {
  font-family: 'Raleway';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/raleway-variable.woff2') format('woff2-variations'),
       url('../fonts/raleway-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Sora';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('../fonts/sora-variable.woff2') format('woff2-variations'),
       url('../fonts/sora-variable.woff2') format('woff2');
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* ── Brand Renor ── */
  --renor-blue:        #3E69B3;
  --renor-blue-hover:  #304E81;
  --renor-pink:        #F5557C;
  --renor-pink-hover:  #C24665;
  --renor-gold:        #BBAB81;
  --renor-black:       #1F1F1F;

  /* ── Surfaces (light) ── */
  --color-bg:           #ffffff;
  --color-bg-alt:       #f7f8fa;
  --color-surface:      #ffffff;
  --color-surface-soft: #f0f2f4;

  /* ── Text ── */
  --color-text:           #1F1F1F;
  --color-text-secondary: #4a4a55;
  --color-text-muted:     rgba(31,31,31,.55);

  /* ── Accent (Renor blue) — sostituisce il vecchio teal ── */
  --color-accent:        #3E69B3;
  --color-accent-hover:  #304E81;
  --color-danger:        #ef4444;
  --color-danger-hover:  #dc2626;
  --color-border:        rgba(31,31,31,0.08);
  --color-border-hover:  rgba(31,31,31,0.16);

  /* ── Typography ── Raleway body, Sora display/heading ── */
  --font-family:  'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Sora', 'Raleway', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;

  --shadow-card:   0 4px 24px rgba(31,31,31,0.08);
  --shadow-accent: 0 8px 24px rgba(62,105,179,0.20);

  --transition-base: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  /* dvh accounts for mobile address-bar; falls back to vh on older browsers */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Room page locks the viewport: no document-level scroll, ever. The
   active view sizes itself inside .app-shell (height:100dvh) and the
   participant grid absorbs whatever space is left. */
body[data-page="room"] {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ─── Layout primitives ─────────────────────── */

.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* When in the room, we need a strict viewport height so the active view
     can compute its own bounds without spilling over (the participant
     grid uses flex:1 + min-height:0 to absorb whatever's left). */
  height: 100vh;
  height: 100dvh;
}

.app-nav {
  display: flex;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(11, 11, 15, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-nav-logo {
  display: inline-flex;
  align-items: center;
  height: 32px;
}

.app-nav-logo img {
  height: 100%;
  width: auto;
}

.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  overflow: hidden;
}

/* ─── Landing layout ───────────────────────── */

.landing {
  position: relative;
  flex-direction: column;
  text-align: center;
  padding: clamp(48px, 10vh, 120px) 24px;
  overflow: hidden;
}

/* Soft teal glow behind the hero — pure CSS, no asset. */
.landing-glow {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, 90vw);
  height: 700px;
  background: radial-gradient(
    ellipse at center,
    rgba(62, 105, 179, 0.18) 0%,
    rgba(62, 105, 179, 0.05) 35%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
  filter: blur(12px);
}

.landing-hero {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 18px;
  padding: 6px 14px;
  background: rgba(62, 105, 179, 0.08);
  border: 1px solid rgba(62, 105, 179, 0.2);
  border-radius: 999px;
}

.landing-title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 20px;
}

.landing-title .accent {
  color: var(--color-accent);
}

.landing-sub {
  color: var(--color-text-secondary);
  font-size: clamp(1rem, 2vw, 1.18rem);
  margin-bottom: 44px;
  max-width: 480px;
}

.landing-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-bottom: 36px;
}

.btn-action {
  flex: 1 1 240px;
  max-width: 280px;
  padding: 16px 24px;
  font-size: 0.98rem;
}

.btn-action svg {
  flex-shrink: 0;
}

/* ─── Divider "oppure" ────────────────────── */

.landing-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 24px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.landing-divider::before,
.landing-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ─── Join form ────────────────────────────── */

.landing-join {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.join-input {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--color-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: border-color var(--transition-base), background var(--transition-base);
}

.join-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg-alt);
}

.join-input::placeholder {
  color: var(--color-text-muted);
  font-family: var(--font-family);
  letter-spacing: normal;
}

.join-btn {
  padding: 13px 24px;
  flex-shrink: 0;
}

/* ─── Form fields ───────────────────────────── */

.field {
  margin-bottom: 20px;
}

/* Side-by-side fields (es. Nome + Cognome). Stacks 1-col su mobile.
   Children .field perdono il loro margin-bottom — il gap del grid lo
   sostituisce. */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.field-row .field {
  margin-bottom: 0;
}
@media (max-width: 480px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  letter-spacing: -0.005em;
}

.field-input {
  width: 100%;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--color-text);
  transition: border-color var(--transition-base), background var(--transition-base);
}

.field-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg);
}

.field-input::placeholder {
  color: var(--color-text-muted);
}

/* ─── Buttons ───────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 14px 28px;
  transition: all var(--transition-base);
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
}

.btn-secondary {
  background: var(--color-surface-soft);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: var(--color-border-hover);
}

.btn-block {
  width: 100%;
}

/* ─── Help text & footer note ──────────────── */

.help {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 14px;
  text-align: center;
}

/* ─── Created card (landing, after "Crea link") ────── */

.created-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.created-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  padding: 6px 12px;
  background: rgba(62, 105, 179, 0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.created-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}

.created-sub {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.created-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

/* ─── Status banner (room placeholder) ─────── */

.status {
  width: 100%;
  max-width: 520px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.status-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.status-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.status-sub {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* ─── Inline copy share box ────────────────── */

.share {
  margin-top: 24px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.share-url {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--color-text);
  background: transparent;
  border: none;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-copy {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
}

.share-copy:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.share-copy.copied {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ─── Error state ──────────────────────────── */

.error {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

/* ============================================
   Room layout (preflight, lobby, active, etc)
   ============================================ */

.room {
  padding: 0;
  align-items: stretch;
}

.view {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  width: 100%;
}

.view.hidden {
  display: none !important;
}

/* ─── Preflight card ───────────────────────── */

.preflight-card {
  width: 100%;
  max-width: 460px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}

.preflight-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  padding: 5px 12px;
  background: rgba(62, 105, 179, 0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.preflight-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
}

.preflight-sub {
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ─── Countdown card (scheduled meeting) ──── */

.countdown-card {
  width: 100%;
  max-width: 520px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.countdown-eyebrow {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  padding: 5px 12px;
  background: rgba(62, 105, 179, 0.08);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.countdown-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.countdown-sub {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.countdown-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  margin-bottom: 16px;
}

/* ─── Lobby (guest waiting) card ───────────── */

.lobby-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.lobby-self {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
  object-fit: cover;
  transform: scaleX(-1); /* selfie mirror */
}

/* ─── Active view (in meeting) ─────────────── */

.view-active {
  flex-direction: row;
  padding: 0;
  align-items: stretch;
}

.active-lobby {
  width: 280px;
  flex-shrink: 0;
  background: var(--color-bg-alt);
  border-right: 1px solid var(--color-border);
  padding: 22px 18px;
  overflow-y: auto;
}

.active-lobby-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
}

.active-lobby-empty {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  font-style: italic;
}

.lobby-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-item-name {
  font-weight: 500;
  font-size: 0.94rem;
  color: var(--color-text);
}

.lobby-item-actions {
  display: flex;
  gap: 6px;
}

.lobby-item-btn {
  flex: 1;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.lobby-item-admit {
  color: var(--color-accent);
  border-color: rgba(62, 105, 179, 0.3);
}

.lobby-item-admit:hover {
  background: rgba(62, 105, 179, 0.12);
  border-color: var(--color-accent);
}

.lobby-item-reject {
  color: var(--color-text-muted);
}

.lobby-item-reject:hover {
  background: rgba(31, 31, 31, 0.04);
  color: var(--color-text);
}

/* ─── Active main + grid ────────────────────── */

.active-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  min-width: 0;
  min-height: 0;
  /* Anchor for absolutely-positioned overlays inside the stage area
     (currently the REC indicator). */
  position: relative;
}

/* The grid fills whatever space is left after the control bar, with
   min-* zero so flex can shrink it inside the active-main column. */
.participant-grid {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}

/* 2-up: side-by-side on landscape. Mobile portrait stays 1 col (override
   in the responsive block below). */
.participant-grid:has(.tile:nth-child(2)) {
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
}

/* No fixed aspect-ratio: each tile fills its grid cell, the video uses
   object-fit:cover so it crops gracefully to whatever shape the cell
   ends up with. This is what keeps the room within the viewport
   regardless of aspect/screen size. */
.tile {
  position: relative;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

/* ─── 1:1 PiP cinematic layout ──────────────
   When the room has exactly two participants, the OTHER person fills
   the whole stage and YOU shrink to a small circle in the bottom-right
   corner. The classic Google Meet / FaceTime presentation. */
.participant-grid.layout-pip {
  display: block;
  position: relative;
  padding: 0;
  gap: 0;
}

.participant-grid.layout-pip .tile {
  position: absolute;
  inset: 0;
  border-radius: 0;
}

/* Cinematic main tile in PiP. Foreground uses 'contain' to avoid the
   cross-orientation zoom-in bug (phone portrait shown on laptop landscape
   with cover crops ~70% of the height); the .tile-bg sibling fills the
   letterbox area with a blurred, brightness-dimmed copy of the same
   video so the letterbox doesn't feel empty. Same trick as Meet/Zoom.

   Selectors use .tile-pip-main / .tile-pip-small (assigned by the JS
   renderer per slot) instead of .tile-self / :not(.tile-self), so that
   clicking the small circle can swap who lives in which slot without
   touching identity-bound classes (.tile-self stays on the local user
   for the selfie mirror). */
.participant-grid.layout-pip .tile-pip-main .tile-video {
  object-fit: contain;
  background: transparent; /* let the bg show through */
}

.participant-grid.layout-pip .tile-pip-main .tile-bg {
  display: block;
  position: absolute;
  /* Slight overscan so the blur edge isn't visible at the tile border */
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(40px) saturate(1.3) brightness(0.55);
  z-index: 0;
}

.participant-grid.layout-pip .tile-pip-small {
  /* Floating small circle. Default rest position is bottom-right via
     `inset`; once the user drags it, JS sets inline left/top + clears
     right/bottom so this rule no longer applies. */
  inset: auto 18px 18px auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  z-index: 10;
  border: 2px solid rgba(31, 31, 31, 0.18);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  background: var(--color-bg-alt);
  cursor: grab;
  touch-action: none; /* stop touch from scrolling the page on drag */
  user-select: none;
}

.participant-grid.layout-pip .tile-pip-small.dragging {
  cursor: grabbing;
  /* Bump shadow during drag for a subtle "lifted" effect. */
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
}

/* The name overlay is unnecessary on the small circle — too cramped. */
.participant-grid.layout-pip .tile-pip-small .tile-overlay {
  display: none;
}

@media (max-width: 600px) {
  .participant-grid.layout-pip .tile-pip-small {
    width: 110px;
    height: 110px;
    inset: auto 12px 12px auto;
  }
}

/* Foreground video. Critical: <video> is a replaced element with
   intrinsic min-width/height = source size; we position it absolute
   so the tile drives sizing instead of the video. */
.tile .tile-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--color-bg-alt);
  z-index: 1;
}

.tile-self .tile-video {
  transform: scaleX(-1); /* selfie mirror */
}

/* Background video: same MediaStream as .tile-video, used to fill the
   letterbox area in PiP mode with a blurred copy. Hidden by default;
   only shown for the main remote tile in cinematic 1:1 layout. */
.tile .tile-bg {
  display: none;
  pointer-events: none;
}

.tile-placeholder {
  width: clamp(64px, 16%, 110px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent) 0%, #2a7d7a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.tile-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #fff;
}

.tile-name {
  font-weight: 500;
  letter-spacing: -0.005em;
}

.tile-icon {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
}

.tile-mic-off::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-danger);
}

/* ─── Control bar ──────────────────────────── */

.control-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
  padding: 0;
}

.ctl:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border-hover);
}

.ctl[data-active="off"] {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

/* Show only one icon (on or off) per state */
.ctl-icon-on,
.ctl-icon-off {
  display: none;
}

.ctl[data-active="on"] .ctl-icon-on {
  display: block;
}

.ctl[data-active="off"] .ctl-icon-off {
  display: block;
}

/* Esci: same round 52x52 cerchio degli altri ctl, ma rosso per
   distinguerlo (icona phone-down è già nel markup). Niente più "pill"
   con scritta — risparmia spazio in control bar e match con Meet. */
.ctl-leave {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
}

.ctl-leave:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

.ctl-leave span {
  display: none;
}

/* ─── Active speaker indicator ────────────── */

/* Grid mode: outline around the tile of whoever is currently speaking. */
.tile.speaking {
  outline: 3px solid var(--color-accent);
  outline-offset: -3px;
}

/* PiP main: outline would look harsh on full-screen — use inset glow. */
.participant-grid.layout-pip .tile-pip-main.speaking {
  outline: none;
  box-shadow: inset 0 0 0 3px var(--color-accent);
}

/* PiP small circle: replace the default border + shadow with an accent ring. */
.participant-grid.layout-pip .tile-pip-small.speaking {
  border-color: var(--color-accent);
  box-shadow: 0 6px 24px rgba(62, 105, 179, 0.55);
}

/* ─── Screen-share presenter mode ─────────── */

/* Small round camera overlay pinned bottom-right inside a tile whose
   main video is a screen share. Keeps the sharer's face visible so the
   call doesn't go anonymous the moment someone presents. Lives on top
   of .tile-video / .tile-bg, opposite corner from .tile-overlay (name
   sits bottom-left) so they never collide. */
.tile-camera-overlay {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(31, 31, 31, 0.18);
  overflow: hidden;
  background: var(--color-bg-alt);
  z-index: 5;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.tile-camera-overlay.dragging {
  cursor: grabbing;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
}

.tile-camera-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 600px) {
  .tile-camera-overlay {
    width: 84px;
    height: 84px;
    bottom: 8px;
    right: 8px;
  }
}

/* In 1:1 PiP the bottom-right corner is reserved for the PiP small
   circle (the OTHER participant). Move the camera overlay to the
   top-right so the two round elements don't stack on top of each other. */
.participant-grid.layout-pip .tile-camera-overlay {
  top: 12px;
  right: 12px;
  bottom: auto;
  left: auto;
}

@media (max-width: 600px) {
  .participant-grid.layout-pip .tile-camera-overlay {
    top: 8px;
    right: 8px;
  }
}

/* (The .layout-self-presenting block that used to live here was made
   redundant by the slot-class refactor: .tile-pip-main / .tile-pip-small
   already handle whoever is in each slot, regardless of identity or
   who's screen-sharing.) */

/* ─── Settings panel ──────────────────────── */

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 90vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  padding: 22px 22px 28px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.settings-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.settings-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.settings-close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.settings-close:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-body .field-input {
  cursor: pointer;
}

/* ─── Screen share button states ──────────── */

/* The default .ctl[data-active="off"] paints the button red (sensible
   for mic/cam where 'off' = muted/disabled = warning). For screen the
   'off' state is just 'not currently sharing' — neutral, so we override
   back to the surface palette. Higher specificity via .ctl.ctl-screen. */
.ctl.ctl-screen[data-active="off"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.ctl.ctl-screen[data-active="off"]:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

/* When sharing, the button gets the accent colour to make the active
   state obvious in the control bar. */
.ctl-screen[data-active="on"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.ctl-screen[data-active="on"]:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* ─── Recording button + indicator ─────────
   Like the screen-share button, default neutral and active=red so the
   host (and only the host) sees a clear visual signal that recording
   is on. The indicator below is shown to ALL participants. */
.ctl.ctl-record[data-active="off"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.ctl.ctl-record[data-active="off"]:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.ctl-record[data-active="on"] {
  background: var(--color-danger);
  border-color: var(--color-danger);
  color: #fff;
  /* Subtle pulse so it's obvious "still recording". */
  animation: ctl-record-pulse 2s ease-in-out infinite;
}

.ctl-record[data-active="on"]:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

@keyframes ctl-record-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);     }
}

/* In-stage REC indicator: top-left corner of the participant grid,
   visible to host AND guest while a recording is in progress. */
.rec-indicator {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 22, 28, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #fff;
}

.rec-indicator .rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-danger);
  animation: rec-dot-pulse 1.4s ease-in-out infinite;
}

@keyframes rec-dot-pulse {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.35; }
}

@media (max-width: 600px) {
  .rec-indicator {
    top: 10px;
    left: 10px;
    padding: 5px 10px;
    font-size: 0.75rem;
  }
}

/* No screen-share / PiP on mobile.
   getDisplayMedia non è disponibile su iOS Safari e gated su Android
   Chrome; il browser-PiP non esiste su mobile (Document-PiP no, e il
   video-PiP nativo è già controllato dall'OS). Bottoni dead weight.
   !important serve per battere la specificità di .ctl.ctl-X[data-active="off"]
   che altrimenti ri-mostra il bottone. */
@media (max-width: 600px) {
  .ctl-screen, .ctl-pip { display: none !important; }
}

/* ─── PiP (mini-window) button ──────────────
   Sempre visibile a entrambi (host + guest). Stato: off = neutro,
   on = accent quando una mini-finestra è aperta. */
.ctl.ctl-pip[data-active="off"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.ctl.ctl-pip[data-active="off"]:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border-hover);
}

.ctl-pip[data-active="on"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.ctl-pip[data-active="on"]:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* ─── Blur background button (host only) ───
   Neutral when off (matches other ctl). Accent + soft glow when on, so
   it's obvious that the host's background is being processed. */
.ctl.ctl-blur[data-active="off"] {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
}

.ctl.ctl-blur[data-active="off"]:hover {
  background: var(--color-surface-soft);
  border-color: var(--color-border-hover);
}

.ctl-blur[data-active="on"] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  box-shadow: 0 0 0 0 rgba(62, 105, 179, 0.45);
  animation: ctl-blur-pulse 2.4s ease-in-out infinite;
}

.ctl-blur[data-active="on"]:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

@keyframes ctl-blur-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62, 105, 179, 0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(62, 105, 179, 0); }
}

/* ─── Chat button + unread badge ──────────── */

.ctl-chat {
  position: relative;
}

.ctl-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-bg-alt);
  pointer-events: none;
}

/* ─── Chat panel (slide in from right, same pattern as settings) ─── */

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-base);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
}

.chat-panel.open {
  transform: translateX(0);
}

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.chat-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Generic modal (used for the leave-confirmation dialog) ─── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 460px;
  width: 100%;
  z-index: 1;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.modal-body {
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0 0 24px;
}
/* Quando il body contiene più paragrafi (es. consenso registrazione),
   spaziali coerentemente e azzera margini residui di p singoli. */
.modal-body p { margin: 0 0 10px; }
.modal-body p:last-child { margin-bottom: 0; }

/* Consent modal: dettaglio "calmante" (piccolo, muted) sui dati audio. */
.rec-consent-detail {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}
.rec-consent-ask { font-weight: 500; color: var(--color-text); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* The modal action buttons share the .btn type but at a smaller scale
   than the main page CTAs (which are paragraph-sized). */
.modal-actions .btn {
  padding: 10px 18px;
  font-size: 0.92rem;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
}

/* On phones the action row has no room for three buttons in a single
   line — stack vertically and let each fill the width. */
@media (max-width: 460px) {
  .modal-actions {
    flex-direction: column-reverse; /* primary/danger actions on top */
  }
  .modal-actions .btn {
    width: 100%;
  }
}

/* ─── Chat toast notifications ─────────────
   Top-center stack of incoming-message previews. Shown only when the
   chat panel is closed. Each toast is a button (clickable to open the
   chat); they slide in from the top, sit ~4s, then fade out. */
.chat-toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 65;
  pointer-events: none;
  width: min(420px, calc(100vw - 24px));
}

.chat-toast {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: rgba(20, 22, 28, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: chatToastIn 220ms ease-out;
  transition: opacity 240ms ease, transform 240ms ease;
}

.chat-toast:hover {
  border-color: var(--color-border-hover);
  border-left-color: var(--color-accent);
}

.chat-toast.chat-toast-leaving {
  opacity: 0;
  transform: translateY(-8px);
}

.chat-toast-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: -0.005em;
}

.chat-toast-body {
  font-size: 0.92rem;
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

@keyframes chatToastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chat-close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
}

.chat-close:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.chat-empty {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-style: italic;
  text-align: center;
  margin-top: 32px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  align-self: flex-start;
}

.chat-msg.chat-msg-self {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  font-size: 0.94rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg-self .chat-msg-bubble {
  background: var(--color-accent);
  color: #fff;
}

.chat-msg-file {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  text-decoration: none;
  color: var(--color-text);
  transition: all var(--transition-base);
  max-width: 100%;
}

.chat-msg-self .chat-msg-file {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.chat-msg-file:hover {
  border-color: var(--color-accent);
}

.chat-msg-file-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.chat-msg-file-name {
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-all;
  line-height: 1.3;
}

.chat-msg-file-meta {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 2px;
}

.chat-msg-image {
  max-width: 100%;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-attach,
.chat-send {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.chat-attach:hover,
.chat-send:hover {
  background: var(--color-surface-soft);
  color: var(--color-text);
  border-color: var(--color-border-hover);
}

.chat-send {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.chat-send:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
}

.chat-input {
  flex: 1;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--color-text);
  /* 16px is the iOS Safari auto-zoom threshold — anything smaller and
     the page zooms in when the input gains focus, breaking the layout
     and forcing horizontal scroll. Don't drop below this. */
  font-size: 16px;
  min-width: 0;
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg);
}

@media (max-width: 600px) {
  .chat-panel {
    width: 100vw;
    /* 100dvh = "dynamic viewport height" — shrinks when the on-screen
       keyboard opens (modern Safari + Chrome). With the previous
       top:0/bottom:0 the panel kept the full layout-viewport height,
       so the input ended up under the keyboard and iOS scrolled the
       document to drag it into view, hiding the chat header. */
    height: 100dvh;
    bottom: auto;
  }
}

/* ─── Spinner ─────────────────────────────── */

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: tfm-spin 0.9s linear infinite;
}

@keyframes tfm-spin {
  to { transform: rotate(360deg); }
}

/* ─── Banner (toast) ──────────────────────── */

.banner {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: calc(100vw - 32px);
}

.banner-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.banner-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.banner-info {
  background: rgba(62, 105, 179, 0.18);
  color: var(--color-accent);
  border: 1px solid rgba(62, 105, 179, 0.4);
}

/* ─── Room code badge in nav ──────────────── */

.room-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  padding: 6px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

/* ─── Connection indicator (diagnostics) ─── */

.conn-indicator {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  flex-shrink: 0;
}

.conn-indicator[data-state="connecting"] .conn-dot {
  background: #fbbf24;
  animation: tfm-pulse 1s ease-in-out infinite;
}

.conn-indicator[data-state="open"] .conn-dot {
  background: #10b981;
}

.conn-indicator[data-state="closed"] .conn-dot,
.conn-indicator[data-state="error"] .conn-dot {
  background: var(--color-danger);
}

@keyframes tfm-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* Room code badge needs proper margin now that conn-indicator takes margin-left:auto */
.room-code-badge {
  margin-left: 8px;
}

/* ─── Accessibility ───────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Responsive ───────────────────────────── */

@media (max-width: 800px) {
  .view-active {
    flex-direction: column;
  }

  .active-lobby {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    max-height: 30vh;
    flex-shrink: 0;
  }

  /* On mobile, even with 2 participants, stack vertically so each tile
     stays large enough to be useful. */
  .participant-grid:has(.tile:nth-child(2)) {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
  }
}

@media (max-width: 600px) {
  .app-nav {
    padding: 14px 20px;
  }

  .app-main {
    padding: 24px 16px;
  }

  .room {
    padding: 0;
  }

  .preflight-card,
  .lobby-card,
  .status,
  .created-card {
    padding: 26px 22px;
  }

  .room-code-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .conn-indicator {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .conn-label {
    display: none;
  }
}

/* ============================================
   Renor light-theme overrides
   Aggiunto in coda per neutralizzare i pattern
   "dark by default" del codice originale.
   ============================================ */

html, body { background: var(--color-bg) !important; color: var(--color-text); }

/* Heading + display in Sora */
h1, h2, h3, h4, h5, h6,
.landing-title, .promo-title, .feature-title, .hero-title { font-family: var(--font-display); font-weight: 700; }

/* Nav bar — era dark glass, ora light glass */
.app-nav { background: rgba(255,255,255,0.85) !important; backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--color-border); }

/* Modal/card backgrounds: #fff su dark resta #fff su light, ma i cards
   "elevated" ora hanno un tint leggerissimo + ombra Renor */
.modal-card, .card, .panel, .lobby-panel, .preflight-card, .device-card,
.settings-panel, .chat-panel, .leave-modal, .post-leave-card, .recording-modal {
  background: #ffffff !important;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card) !important;
}
.modal-backdrop, .lobby-backdrop, .leave-backdrop {
  background: rgba(31,31,31,0.45) !important;
  backdrop-filter: blur(2px);
}

/* Inputs, selects — light bg + dark text, focus ring Renor blue */
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
textarea, select, .join-input {
  background: var(--color-surface-soft) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}
input:focus, textarea:focus, select:focus, .join-input:focus {
  border-color: var(--color-accent) !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(62,105,179,0.15);
}
::placeholder { color: var(--color-text-muted) !important; }

/* Primary button = Renor blue */
.btn-primary, .btn-action, .promo-cta, .promo-nav-cta {
  background: var(--color-accent);
  color: #ffffff !important;
  border: none;
  border-radius: var(--radius-md);
  transition: background var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover, .btn-action:hover, .promo-cta:hover, .promo-nav-cta:hover {
  background: var(--color-accent-hover) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Secondary button — outline blu */
.btn-secondary, .btn-ghost {
  background: transparent !important;
  color: var(--color-accent) !important;
  border: 1px solid var(--color-accent) !important;
}
.btn-secondary:hover, .btn-ghost:hover {
  background: rgba(62,105,179,0.06) !important;
  color: var(--color-accent-hover) !important;
}

/* Promo landing — la dark gradient hero diventa light + soft */
.promo-shell, .promo-hero {
  background: radial-gradient(ellipse at top, rgba(62,105,179,0.06) 0%, transparent 60%), #ffffff !important;
  color: var(--color-text) !important;
}
.promo-eyebrow {
  background: rgba(62,105,179,0.08);
  border-color: rgba(62,105,179,0.25) !important;
  color: var(--color-accent) !important;
}
.promo-title { color: var(--color-text) !important; }
.promo-title .accent { color: var(--color-accent) !important; }
.promo-sub, .promo-features p { color: var(--color-text-secondary) !important; }
.promo-nav-cta {
  background: transparent !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
  box-shadow: none;
}
.promo-nav-cta:hover {
  border-color: var(--color-accent) !important;
  color: var(--color-accent) !important;
  background: rgba(62,105,179,0.04) !important;
}
.promo-features .feature-card, .feature-card {
  background: var(--color-surface-soft) !important;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

/* Landing originale — glow blu Renor */
.landing-glow {
  background: radial-gradient(
    ellipse at center,
    rgba(62,105,179,0.18) 0%,
    rgba(62,105,179,0.05) 35%,
    transparent 65%
  ) !important;
}

/* Landing eyebrow */
.hero-eyebrow {
  background: rgba(62,105,179,0.08) !important;
  border-color: rgba(62,105,179,0.25) !important;
  color: var(--color-accent) !important;
}
.landing-sub { color: var(--color-text-secondary) !important; }

/* Tile / participant grid (in-call) — light tile bg */
.tile, .tile-pip-main, .tile-pip-small, .preview-tile, .participant-tile {
  background: var(--color-surface-soft) !important;
  border: 1px solid var(--color-border);
}
.tile-name, .tile-label { color: var(--color-text); background: rgba(255,255,255,.7); }

/* In-call control bar — light surface + Renor accent */
.control-bar, .controls, .room-controls {
  background: rgba(255,255,255,0.92) !important;
  border-top: 1px solid var(--color-border);
  backdrop-filter: blur(10px);
  color: var(--color-text);
}
.control-btn, .ctrl-btn {
  background: var(--color-surface-soft) !important;
  color: var(--color-text) !important;
  border: 1px solid var(--color-border) !important;
}
.control-btn:hover, .ctrl-btn:hover {
  background: rgba(62,105,179,0.08) !important;
  border-color: var(--color-accent) !important;
  color: var(--color-accent) !important;
}
.control-btn.danger, .ctrl-btn.danger, .leave-btn, .end-btn {
  background: var(--color-danger) !important;
  color: #ffffff !important;
  border-color: var(--color-danger) !important;
}
.control-btn.danger:hover, .ctrl-btn.danger:hover, .leave-btn:hover {
  background: var(--color-danger-hover) !important;
}

/* Chat panel — light */
.chat-panel, .chat-messages, .chat-input-area {
  background: #ffffff !important;
  color: var(--color-text);
  border-color: var(--color-border);
}
.chat-message, .chat-bubble {
  background: var(--color-surface-soft) !important;
  color: var(--color-text);
}
.chat-message.own, .chat-bubble.own {
  background: var(--color-accent) !important;
  color: #ffffff !important;
}

/* Lobby waiting / knock — light */
.lobby-strip, .lobby-knocking {
  background: rgba(255,255,255,0.95) !important;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}
.lobby-knock-btn-admit { background: var(--color-accent) !important; color: #ffffff !important; }
.lobby-knock-btn-reject { background: var(--color-danger) !important; color: #ffffff !important; }

/* Settings dropdowns / device picker */
.device-picker, .settings-dropdown {
  background: #ffffff !important;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

/* Toast / notifications */
.toast, .notification {
  background: rgba(255,255,255,0.97) !important;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}

/* Footer / promo footer su landing */
.promo-footer { background: #f0f2f4 !important; color: var(--color-text-secondary); border-top: 1px solid var(--color-border); }

/* Scrollbars sottili Renor */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(62,105,179,0.25); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(62,105,179,0.45); }
