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

:root {
  /* Knox-inspired palette: dark UI with Samsung blue accent */
  --bg: #0f1115;
  --bg-elev: #1a1d24;
  --bg-elev-2: #242830;
  --bg-elev-3: #2d3139;
  --border: #2d3139;
  --border-strong: #3d424c;
  --text: #e8e9ea;
  --text-muted: #9aa0aa;
  --text-dim: #6b7280;
  --accent: #1976ff;
  --accent-hover: #3a8aff;
  --accent-2: #0c4dab;
  --danger: #e24b4a;
  --success: #1d9e75;
  --warning: #f2a623;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

/* Make hidden attribute always win over display: flex/grid/etc. */
[hidden] { display: none !important; }

.brand { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; color: var(--text); }

.screen {
  display: none;
  height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ============== Auth ============== */
#screen-auth { align-items: center; justify-content: center; }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
}
.card h2 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--text-muted);
}
.auth-card { min-width: 380px; }
.auth-card .brand { display: block; text-align: center; margin-bottom: 24px; font-size: 22px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.tabs .tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }

.auth-form { display: none; flex-direction: column; gap: 10px; }
.auth-form.active { display: flex; }
/* [#1 비밀번호 찾기] */
.auth-link { align-self: center; font-size: 13px; margin-top: 2px; }
.auth-hint { font-size: 13px; color: var(--text-muted); margin: 0 0 2px; line-height: 1.5; }
.auth-ok {
  font-size: 13px; color: var(--success, #2f9e44); line-height: 1.5; margin: 2px 0 0;
  background: var(--bg-elev-2); border-radius: 6px; padding: 10px 12px; word-break: break-all;
}
.auth-ok a { color: var(--primary, #2b6cb0); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], select {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary {
  background: var(--accent);
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 500;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary.btn-sm { padding: 8px 14px; font-size: 13px; }

.btn-danger {
  background: var(--danger);
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 500;
}
.btn-danger:hover { background: #c43d3c; }

.btn-text {
  background: none;
  color: var(--text-muted);
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
}
.btn-text:hover { color: var(--text); background: var(--bg-elev-2); }

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ============== Lobby ============== */
.topbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.lobby form { display: flex; flex-direction: column; gap: 10px; }

/* ============== Lobby (refined) ============== */
.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.user-greet {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-elev-2);
  border-radius: 20px;
}
.user-greet .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.user-greet #user-name {
  color: var(--text);
  font-weight: 500;
}

.btn-icon {
  cursor: pointer;
}

.lobby {
  flex: 1;
  padding: 40px 32px 60px;
  overflow-y: auto;
  min-height: 0;            /* v0.21.4: flex 부모 안에서 스크롤 영역으로 동작 */
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  z-index: 1;
}

/* Decorative wave background — sits behind all lobby content */
#screen-lobby { position: relative; overflow: hidden; }
.lobby-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.lobby-bg-waves {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  /* Cover the lower 70% of the lobby; flows naturally at all sizes */
  width: 100%;
  height: 70%;
  display: block;
  /* The viewBox is 0..1440 but each wave path actually extends to 2880
     (twice as wide). We let the SVG render the full content via overflow,
     and animate each <g> by translating along x. */
  overflow: visible;
}

/* Each wave-layer pans its 2× path across the viewport. We give each layer
   a unique speed and direction so the waves read as a flowing scene rather
   than a single rigid background. The drift cycle is the same length as
   one viewport-width of motion (1440 units), so the loop is seamless. */
.wave-layer {
  /* Default GPU-friendly transform — overridden by per-layer keyframes */
  transform-origin: 0 0;
  will-change: transform;
}
.wave-layer path {
  /* SVG paths re-rasterize on each frame at their fill region; with a
     gradient fill this is cheap on modern GPUs. */
  shape-rendering: geometricPrecision;
}

/* Layer-specific drift + breathing. Each layer pairs:
     1) drift-X: horizontal pan of -1440 user units (= half the 2880-wide
        path). For SVG <g> elements, CSS px units are interpreted as
        user-units in the local coordinate system, so this stays correctly
        aligned regardless of how the SVG is scaled visually.
     2) breathe-X: tiny vertical sway via the `translate` property, on a
        different cadence so layers don't pulse in sync.
   Animations are layered with the comma-separated animation shorthand. */
@keyframes wave-drift-lr {
  from { transform: translateX(0); }
  to   { transform: translateX(-1440px); }
}
@keyframes wave-drift-rl {
  from { transform: translateX(-1440px); }
  to   { transform: translateX(0); }
}
@keyframes wave-breathe-a {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -8px; }
}
@keyframes wave-breathe-b {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 6px; }
}

.wave-1 { animation: wave-drift-lr 60s linear infinite, wave-breathe-a 11s ease-in-out infinite; }
.wave-2 { animation: wave-drift-rl 80s linear infinite, wave-breathe-b 13s ease-in-out infinite; }
.wave-3 { animation: wave-drift-lr 45s linear infinite, wave-breathe-a 9s ease-in-out infinite; }
.wave-4 { animation: wave-drift-rl 100s linear infinite, wave-breathe-b 17s ease-in-out infinite; }
.wave-5 { animation: wave-drift-lr 35s linear infinite, wave-breathe-a 7s ease-in-out infinite; }

/* Glow orbs — soft pulsing highlights. Each orb fades in and out and
   drifts a tiny amount. Different cadences keep them from blinking in
   sync. SVG circles fill is a radial gradient that already fades cleanly
   to transparent at the edge, so we only animate opacity (cheap on GPU). */
.glow {
  opacity: 0;
  transform-origin: center;
  filter: blur(2px);
  will-change: opacity, transform;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0;    transform: scale(0.85); }
  50%      { opacity: 0.55; transform: scale(1.05); }
}
@keyframes glow-pulse-soft {
  0%, 100% { opacity: 0;    transform: scale(0.9); }
  50%      { opacity: 0.35; transform: scale(1.0); }
}
.glow-1 { animation: glow-pulse 9s ease-in-out infinite; animation-delay: 0s; }
.glow-2 { animation: glow-pulse-soft 14s ease-in-out infinite; animation-delay: 3s; }
.glow-3 { animation: glow-pulse 11s ease-in-out infinite; animation-delay: 5s; }
.glow-4 { animation: glow-pulse-soft 8s ease-in-out infinite; animation-delay: 1.5s; }
.glow-5 { animation: glow-pulse 13s ease-in-out infinite; animation-delay: 7s; }
.glow-6 { animation: glow-pulse-soft 10s ease-in-out infinite; animation-delay: 4s; }

/* Respect reduced-motion preference — keep the visuals but hold them still. */
@media (prefers-reduced-motion: reduce) {
  .wave-layer, .glow { animation: none !important; }
}

/* Topbar must sit above the background */
.lobby-topbar { position: relative; z-index: 2; }

/* Hero section */
.hero {
  margin-top: 12px;
}
.hero-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}
.hero-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.hero-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  font-family: inherit;
}
.hero-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-elev-2);
}
.hero-btn:active { transform: translateY(1px); }
.hero-btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hero-btn.primary {
  background: linear-gradient(135deg, #1976ff 0%, #0c4dab 100%);
  border-color: transparent;
  color: white;
}
.hero-btn.primary:hover {
  background: linear-gradient(135deg, #2483ff 0%, #0e57c0 100%);
}
.hero-btn.primary .hero-btn-icon {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}
.hero-btn-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hero-btn-label strong {
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.1px;
}
.hero-btn-label small {
  font-size: 12px;
  opacity: 0.8;
}

/* Lobby cards */
.lobby-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}
.lobby-card-header {
  padding: 18px 20px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lobby-card-header h2 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.lobby-card-header .btn-text {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lobby-form {
  padding: 4px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lobby-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: -4px;
}
.lobby-form-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.schedule-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.schedule-row input[type="datetime-local"] {
  flex: 1;
  color-scheme: dark;
}
.lobby-form .hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: -2px;
}

.meetings-card .room-list {
  padding: 4px 12px 16px;
}
.room-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.room-list li {
  background: transparent;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.room-list li:last-child { border-bottom: none; }
.room-list li:hover { background: var(--bg-elev-2); }
.room-list .room-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.room-list .room-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  font-family: ui-monospace, "Menlo", monospace;
}
.room-list .room-actions { display: flex; gap: 6px; align-items: center; }
.room-list .btn-join {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.room-list .btn-join:hover { background: var(--accent-hover); }
.room-list .btn-delete {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.room-list .btn-delete:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.room-list .btn-info-icon {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.room-list .btn-info-icon:hover {
  background: var(--bg-elev-3);
  color: var(--text);
}
.room-list .empty-row {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 28px 0;
  border: none;
}

/* Schedule / waiter badges (kept compact) */
.schedule-badge,
.waiter-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  margin-right: 6px;
}
.schedule-badge.upcoming {
  background: rgba(25, 118, 255, 0.12);
  color: #6790ff;
  border: 1px solid rgba(25, 118, 255, 0.25);
}
.schedule-badge.live {
  background: rgba(29, 158, 117, 0.15);
  color: var(--success);
  border: 1px solid rgba(29, 158, 117, 0.3);
}
.schedule-badge.live::before {
  content: '●';
  margin-right: 4px;
  animation: pulse 1.5s infinite;
}
.waiter-badge {
  background: rgba(242, 166, 35, 0.15);
  color: var(--warning);
  border: 1px solid rgba(242, 166, 35, 0.35);
  cursor: pointer;
}
.waiter-badge:hover { background: rgba(242, 166, 35, 0.28); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Hide deprecated old card classes (keep inheriting elsewhere) */
.lobby .card:not(.auth-card) { padding: 0; }

/* ============== Room ============== */
.room-topbar {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  flex-shrink: 0;
  gap: 12px;
}
.room-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.room-info .room-id {
  color: var(--text-muted);
  font-size: 11px;
  font-family: monospace;
  background: var(--bg-elev-2);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.room-meta {
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: monospace;
  flex-shrink: 0;
}
.room-meta .meta-sep { color: var(--border-strong); }

.room-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.topbar-btn {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
}
.topbar-btn:hover { background: var(--bg-elev-3); }
.topbar-btn .icon { font-size: 17px; line-height: 1; }
.topbar-btn-label { font-weight: 500; }
.topbar-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

.room-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.stage {
  flex: 1;
  position: relative;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ----- Gallery layout ----- */
.gallery {
  flex: 1;
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: center;      /* v0.21.1: 16:9 유지 방식 복원 — fit 계산이 */
  justify-content: center;    /* px 크기를 정하므로 중앙 정렬 + 무스크롤 */
  overflow: hidden;
}

/* ----- Speaker layout ----- */
.speaker-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
  min-height: 0;
}
.speaker-main {
  flex: 1;
  background: var(--bg-elev);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Screen share tile renders the captured display, which can be any
   aspect ratio — use object-fit: contain so it isn't cropped. */
.speaker-main .screenshare-tile {
  background: #000;
}
.speaker-main .screenshare-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.speaker-main .screenshare-tile .name-tag {
  background: rgba(25, 118, 255, 0.85);
}
.speaker-main .screen-tag {
  margin-left: 8px;
  font-size: 10px;
  opacity: 0.95;
}
.thumb-strip {
  height: 100px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  padding: 2px;
}
.thumb-strip .video-tile {
  flex-shrink: 0;
  width: 150px;
  height: 90px;
  aspect-ratio: auto;
  cursor: pointer;
}

/* ----- Video tile (shared) ----- */
.video-tile {
  background: var(--bg-elev);
  border: 2px solid var(--border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 0;
  transition: border-color 0.15s;
}
.video-tile.speaking { border-color: var(--success); }
.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-elev-2);
  display: block;
}
.video-tile .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-muted);
  background: var(--bg-elev-2);
  font-weight: 500;
  letter-spacing: 0;
}
.video-tile .name-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.video-tile .indicators {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  font-size: 11px;
}
.video-tile .indicators .badge {
  background: rgba(0, 0, 0, 0.65);
  padding: 3px 6px;
  border-radius: 4px;
}
.video-tile .indicators .badge.muted { background: var(--danger); }
.video-tile .indicators .badge.hand {
  background: var(--warning);
  /* [#2 손들기] 일반 참가자도 쉽게 식별하도록 크게 + 펄스 강조 */
  font-size: 1.5em;
  padding: 4px 9px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
  animation: hand-pulse 1.2s ease-in-out infinite;
}
@keyframes hand-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}
.video-tile .indicators .badge.signal { background: rgba(0, 0, 0, 0.65); padding: 2px 4px; }
.video-tile .indicators .badge.signal.poor { background: rgba(242, 166, 35, 0.85); color: white; }
.video-tile .indicators .badge.signal.lost { background: rgba(226, 75, 74, 0.85); color: white; }
.video-tile .indicators .badge.stream-paused {
  background: rgba(154, 160, 170, 0.85);
  color: white;
}

/* Connection quality border tint */
.video-tile.quality-poor { box-shadow: inset 0 0 0 2px rgba(242, 166, 35, 0.6); }
.video-tile.quality-lost { box-shadow: inset 0 0 0 2px rgba(226, 75, 74, 0.7); }

/* In speaker view, thumbnail tiles are smaller */
.thumb-strip .video-tile .placeholder { font-size: 22px; }
.thumb-strip .video-tile .name-tag { font-size: 10px; padding: 2px 5px; }
.thumb-strip .video-tile .indicators { font-size: 9px; }

/* ----- Self-view PIP ----- */
.self-pip {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 220px;
  height: 124px;
  background: var(--bg-elev);
  border: 2px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
  z-index: 10;
  cursor: move;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.self-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-elev-2);
  display: block;
}
.self-pip .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
  background: var(--bg-elev-2);
  font-weight: 500;
}
.self-pip .self-pip-label {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.65);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  pointer-events: none;
}

/* ----- Sidebar ----- */
.sidebar {
  width: 320px;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.sidebar-tabs .tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
}
.sidebar-tabs .tab.active { color: var(--text); border-bottom: 2px solid var(--accent); }
.sidebar-tabs .count {
  background: var(--bg-elev-3);
  color: var(--text);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
  margin-left: 4px;
}

.panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  flex-direction: column;
  min-height: 0;
}
.panel.active { display: flex; }

#participant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#participant-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-elev-2);
  border-radius: 6px;
  font-size: 13px;
  gap: 8px;
}
#participant-list .pname { display: flex; align-items: center; gap: 8px; min-width: 0; }
#participant-list .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
#participant-list .status-icons { display: flex; gap: 4px; font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
}
.chat-message {
  background: var(--bg-elev-2);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  word-break: break-word;
}
.chat-message .author {
  color: var(--accent);
  font-weight: 500;
  font-size: 11px;
  margin-bottom: 2px;
}
.chat-message.self .author { color: var(--success); }
.chat-message.private .author::after {
  content: ' · ' attr(data-private-label);
  color: var(--warning);
  font-weight: 400;
}
.chat-message .file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-elev-3);
  border-radius: 6px;
}
.chat-message .file-icon {
  width: 28px;
  height: 28px;
  background: var(--accent-2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}
.chat-message .file-meta { min-width: 0; flex: 1; }
.chat-message .file-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-message .file-size { font-size: 11px; color: var(--text-muted); }
.chat-message .file-progress {
  height: 3px;
  background: var(--bg-elev-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.chat-message .file-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s linear;
}
.chat-message .file-download {
  background: var(--accent);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.chat-message .file-download:hover { background: var(--accent-hover); }

/* Chat composer (recipient + form) */
.chat-composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.chat-to-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.chat-to-row select {
  flex: 1;
  font-size: 12px;
  padding: 4px 6px;
  background: var(--bg-elev-2);
  color: var(--text);
}
#form-chat {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
}
#form-chat input[name="text"] { flex: 1; }
.chat-attach-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chat-attach-btn:hover { background: var(--bg-elev-2); color: var(--text); }

/* ----- Controls ----- */
.controls {
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.controls .divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 4px;
}
.control-btn {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 64px;
  font-family: inherit;
  transition: background 0.1s;
}
.control-btn:hover { background: var(--bg-elev-3); }
.control-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.control-btn.off {
  background: rgba(226, 75, 74, 0.12);
  border-color: rgba(226, 75, 74, 0.45);
  color: var(--text);
}
.control-btn.off:hover { background: rgba(226, 75, 74, 0.22); }
.control-btn.off .label { color: var(--danger); font-weight: 500; }

/* Unread badge on sidebar button */
.unread-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.control-btn { position: relative; }

/* File send status pill below progress bar */
.chat-message .file-status {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 500;
}
.chat-message .file-status.sent { color: var(--success); }
.chat-message .file-status.failed { color: var(--danger); }

/* Drag-drop overlay over chat panel */
.chat-drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 118, 255, 0.16);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}
.chat-drop-overlay.visible { display: flex; }
#panel-chat { position: relative; }

/* Audio meter (bars next to mic icon on local tile) */
.audio-meter {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}
.audio-meter span {
  width: 2px;
  background: var(--success);
  border-radius: 1px;
  transition: height 0.06s linear;
  height: 2px;
}

/* Virtual background option grid */
.vbg-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.vbg-option {
  background: var(--bg-elev-2);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text);
  font-family: inherit;
}
.vbg-option:hover { border-color: var(--border-strong); }
.vbg-option.active { border-color: var(--accent); }
.vbg-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  background: var(--bg-elev-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.vbg-thumb-none { color: var(--danger); }
.vbg-thumb-blur {
  background: linear-gradient(135deg, #6a8caf 0%, #c4b5a0 100%);
  filter: blur(3px);
}

/* Recordings list table */
.rec-row {
  display: grid;
  /* [v0.12.4] 선택 체크박스(auto) 칼럼 추가 — 기존 4칼럼 정의에 체크박스가
     1fr 을 차지해 거대해 보이던 버그 수정 */
  grid-template-columns: auto 1fr 110px 80px 130px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}
.rec-row .rec-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-row .rec-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}
.rec-row .rec-status.complete { background: rgba(29, 158, 117, 0.15); color: var(--success); }
.rec-row .rec-status.active, .rec-row .rec-status.starting { background: rgba(242, 166, 35, 0.18); color: var(--warning); }
.rec-row .rec-status.failed { background: rgba(226, 75, 74, 0.18); color: var(--danger); }
.rec-row .rec-meta { color: var(--text-muted); font-size: 11px; }
.rec-row .rec-actions { display: flex; gap: 6px; justify-content: flex-end; }
.rec-row .rec-download {
  background: var(--accent);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  text-decoration: none;
  font-weight: 500;
}
.rec-row .rec-download:hover { background: var(--accent-hover); }
.rec-row .rec-delete {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.rec-row .rec-delete:hover { background: var(--danger); color: white; border-color: var(--danger); }

@media (max-width: 640px) {
  .rec-row { grid-template-columns: 1fr; }
  .rec-row .rec-actions { justify-content: flex-start; }
}
.control-btn.danger { background: var(--danger); border-color: var(--danger); color: white; }
.control-btn.danger:hover { background: #c43d3c; }
.control-btn .icon { font-size: 16px; line-height: 1.2; }
.control-btn .label { font-size: 10px; line-height: 1.2; }

/* ============== Modals ============== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  max-height: 86vh;
  overflow-y: auto;
}
.modal h2 {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 600;
}
.modal label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 12px 0 4px;
}
.modal select, .modal input[type="text"] {
  width: 100%;
}
.modal-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.modal-row input { flex: 1; }
.modal-actions {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-close {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg-elev-3); }

.info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-muted); font-size: 12px; }
.info-row .value {
  font-family: monospace;
  word-break: keep-all;
  white-space: nowrap;
  overflow-x: auto;       /* horizontal scroll if very narrow viewport */
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}
.info-row .value::-webkit-scrollbar { height: 2px; }
.info-copyable {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.info-copy-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.info-copy-btn:hover { background: var(--bg-elev-3); color: var(--text); }

/* ============== Toast ============== */
#toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: var(--bg-elev-3);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  animation: toast-in 0.2s ease-out, toast-out 0.3s ease-in 2.7s forwards;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-10px); }
}

/* ============== Settings ============== */
.settings-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}
.settings-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.settings-nav-item:hover { background: var(--bg-elev-2); }
.settings-nav-item.active { background: var(--bg-elev-3); color: var(--text); }
.settings-nav-icon { font-size: 16px; width: 20px; text-align: center; }

.settings-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px;
  /* 스크롤 컨테이너는 전체 너비를 채워 스크롤바가 화면 우측 끝에 오게 한다.
     읽기 좋은 콘텐츠 폭 제한은 아래 .settings-section 에서 처리. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.settings-content::-webkit-scrollbar { width: 10px; }
.settings-content::-webkit-scrollbar-track { background: transparent; }
.settings-content::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.settings-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: padding-box;
}
/* 콘텐츠 가독 폭 제한(컨테이너가 아니라 섹션에 적용) */
.settings-section { display: none; max-width: 720px; }
.settings-section.active { display: block; }
.settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row label {
  flex-shrink: 0;
  width: 140px;
  color: var(--text-muted);
  font-size: 13px;
}
/* 토글 스위치는 위 label 폭(140px) 규칙에서 제외 — ON 상태에서 슬라이더가
   엿가락처럼 늘어나던 버그의 원인이었다 */
.settings-row label.switch {
  width: 40px;
  flex: 0 0 40px;
  margin-left: auto;
}
.settings-row select,
.settings-row .settings-value {
  flex: 1;
  font-size: 14px;
}
.settings-row .settings-value { color: var(--text); }
.settings-hint {
  color: var(--text-dim);
  font-size: 12px;
  margin: 8px 0 16px;
}
.settings-status {
  font-size: 12px;
  margin-top: 8px;
}
.settings-status.success { color: var(--success); }
.settings-status.error { color: var(--danger); }

.settings-row-toggle { justify-content: space-between; }
.settings-row-toggle label:first-child {
  flex: 1;
  width: auto;
  color: var(--text);
  font-size: 14px;
}
.settings-row-radio {
  border-bottom: none;
  padding: 4px 0;
}
.settings-row-radio label {
  width: auto;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.settings-row-radio input[type="radio"] { accent-color: var(--accent); }

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--bg-elev-3);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s;
}
.switch input:checked + .slider {
  background: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translateX(18px);
}

/* Icon button (gear) */
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--bg-elev-2); color: var(--text); }

/* Recording indicator badge in topbar */
.recording-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(226, 75, 74, 0.18);
  color: var(--danger);
  border: 1px solid rgba(226, 75, 74, 0.4);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}
.rec-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: rec-pulse 1.5s infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Recordings list inside info modal */
.recordings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.recording-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-elev-2);
  border-radius: 6px;
  font-size: 12px;
  gap: 8px;
}
.recording-row .rec-meta { color: var(--text-muted); font-size: 11px; }

/* Mobile adjustments */
@media (max-width: 640px) {
  .settings-main { flex-direction: column; }
  .settings-nav {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .settings-nav-item {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 13px;
  }
  .settings-nav-item span:not(.settings-nav-icon) { display: none; }
  .settings-content { padding: 16px; }
  .settings-row { flex-wrap: wrap; }
  .settings-row label { width: 100%; }
}

/* ============== Diagnostics ============== */
.diag-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}
.diag-card {
  max-width: 640px;
  width: 100%;
}
.diag-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.diag-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.diag-item {
  background: var(--bg-elev-2);
  border-radius: 6px;
  padding: 12px 14px;
}
.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.diag-name { font-weight: 500; }
.diag-status {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.diag-status.pending {
  background: rgba(154, 160, 170, 0.15);
  color: var(--text-muted);
}
.diag-status.pass {
  background: rgba(29, 158, 117, 0.18);
  color: var(--success);
}
.diag-status.fail {
  background: rgba(226, 75, 74, 0.18);
  color: var(--danger);
}
.diag-status.warn {
  background: rgba(242, 166, 35, 0.18);
  color: var(--warning);
}
.diag-status.skipped {
  background: rgba(154, 160, 170, 0.1);
  color: var(--text-dim);
}
.diag-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: monospace;
  word-break: break-all;
}
.diag-summary {
  background: var(--bg-elev-2);
  padding: 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
}
.diag-summary.pass { border-left-color: var(--success); }
.diag-summary.fail { border-left-color: var(--danger); }
.diag-actions {
  display: flex;
  justify-content: center;
}

/* Auth footer */
.auth-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
}

/* Sidebar close button (mobile) */
.sidebar-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  z-index: 1;
}
.sidebar-close:hover { background: var(--bg-elev-2); color: var(--text); }

/* ============== Mobile responsive ============== */

/* Tablets: sidebar slightly narrower */
@media (max-width: 900px) {
  .sidebar { width: 280px; }
  .self-pip { width: 160px; height: 90px; }
}

/* Phones: major layout shift */
@media (max-width: 640px) {
  .topbar, .room-topbar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar h1, .room-topbar strong { font-size: 14px; }
  .user-info { gap: 4px; flex-wrap: wrap; }
  .user-info button { font-size: 12px; padding: 4px 6px; }
  .room-meta { font-size: 11px; gap: 6px; }
  .room-actions { gap: 4px; }
  .topbar-btn { padding: 0 8px; height: 30px; }
  .topbar-btn-label { display: none; }     /* keep icon-only on small screens */

  .lobby {
    padding: 12px;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card { padding: 16px; border-radius: 8px; }
  /* On phones, the auth card was rendering too narrow because flex
     centering plus min-width:auto sized it to its content, leaving
     huge gutters either side. Force it to claim almost the full
     viewport width so the form actually fills the card.
     The `min-width: 0` overrides the desktop `min-width: 380px`
     which would otherwise blow past the screen on small phones. */
  .auth-card {
    width: calc(100vw - 24px);   /* ~12px gutter each side */
    max-width: 420px;            /* desktop-look on tablets/large phones */
    min-width: 0;
    padding: 24px 18px;
    box-sizing: border-box;
  }
  /* Make sure the parent flex column doesn't add its own margin */
  #screen-auth { padding: 0 12px; }

  /* Sidebar becomes a slide-in overlay */
  .sidebar {
    position: fixed;
    top: 0; right: 0;
    width: 100%;
    max-width: 360px;
    height: 100%;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0,0,0,0.5);
    border-left: none;
    transform: translateX(0);
    transition: transform 0.2s ease-out;
  }
  .sidebar-close { display: flex; align-items: center; justify-content: center; }

  /* Self-PIP smaller and draggable position adjusts */
  .self-pip {
    width: 110px;
    height: 64px;
    bottom: 12px;
    right: 12px;
  }

  /* Controls: scale down, hide labels, more compact */
  /* [v1.4.5] 모바일 하단 컨트롤: 가로 스크롤 대신 여러 줄로 자동 배치 —
     모든 버튼이 한눈에 보이고 '나가기'도 스크롤 없이 접근 가능. */
  .controls {
    padding: 6px 6px;
    gap: 6px;
    flex-wrap: wrap;
    overflow: visible;
    justify-content: center;
    row-gap: 6px;
  }
  .controls::-webkit-scrollbar { display: none; }
  .controls .divider { display: none; }
  .control-btn {
    min-width: 0;
    flex: 0 0 auto;
    width: 52px;
    padding: 7px 4px;
  }
  .control-btn .label { display: none; }
  .control-btn .icon { font-size: 19px; }
  /* 나가기 버튼은 항상 눈에 띄게(빨강 유지) + 줄 맨 끝 정렬 보조 */
  #btn-leave.control-btn { width: 52px; }

  /* Gallery: portrait-aware tile sizing.
     The native CSS Grid behaviour is to make square-ish cells; in portrait
     a 16:9 video tile inside a 2-column grid ends up tiny and centered.
     We unset aspect-ratio on small screens and let tiles fill row height
     so 4 people in portrait look like a 2x2 of half-screen tiles. */
  .gallery { padding: 6px; gap: 4px; align-content: stretch; }
  .gallery .video-tile { aspect-ratio: auto; min-height: 0; }

  .speaker-view { padding: 6px; gap: 6px; }
  .thumb-strip { height: 70px; }
  .thumb-strip .video-tile { width: 110px; height: 65px; }

  /* Schedule badge wraps to next line */
  .room-list .room-actions { flex-direction: row; }
  .room-list li { flex-wrap: wrap; }

  /* Modals fill the screen */
  .modal { width: 96%; padding: 18px; max-height: 92vh; }
  .modal h2 { font-size: 15px; }

  /* Chat input bigger touch target */
  #form-chat input { padding: 12px; font-size: 16px; /* prevents iOS zoom */ }

  /* Diagnostics */
  .diag-main { padding: 12px; }
  .diag-card { padding: 18px; }
  .diag-row { flex-wrap: wrap; }

  /* Waiting room compact */
  .waiting-card { padding: 32px 20px; }
  .waiting-icon { font-size: 44px; }
  .waiting-card h2 { font-size: 18px; }
  .waiting-countdown { font-size: 30px; }

  /* Host banner: stack vertically on narrow screens */
  .host-banner {
    flex-wrap: wrap;
    padding: 8px 12px;
    font-size: 12px;
    gap: 6px;
  }
  .host-banner-action { padding: 5px 10px; font-size: 12px; }
}

/* Portrait phones especially: arrange video grid to fill viewport */
@media (max-width: 640px) and (orientation: portrait) {
  .stage { display: flex; flex-direction: column; min-height: 0; }

  /* Reset our default aspect-ratio for portrait — let cells fill the
     available stage height equally. The video element inside uses
     object-fit: cover so it crops cleanly to whatever shape the cell has. */
  .gallery {
    flex: 1;
    display: grid;
    /* Default: 2 columns, rows determined by participant count */
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    /* Force the grid to fill the stage exactly — no overflow scroll */
    overflow: hidden;
    /* IMPORTANT: rows distribute equally across the full stage height */
    grid-auto-rows: 1fr;
  }
  .gallery .video-tile {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;     /* override our 16:9 default */
    min-height: 0;
    min-width: 0;
  }
  /* On mobile, preserve the camera's native aspect ratio so the user
     doesn't see a cropped face. The tile may have black bars top/bottom
     or left/right depending on camera orientation — that's intentional. */
  .gallery .video-tile video,
  .speaker-main video {
    object-fit: contain;
    background: #000;
  }

  /* 1 participant — full screen */
  .gallery:has(> .video-tile:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  /* 2 participants — stacked vertically (each gets full width, half height) */
  .gallery:has(> .video-tile:nth-child(2):last-child) {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  /* 3 participants — 2 on top, 1 on bottom (centered via implicit auto rows) */
  .gallery:has(> .video-tile:nth-child(3):last-child) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  /* 4 participants — perfect 2x2 (this is the user's case) */
  .gallery:has(> .video-tile:nth-child(4):last-child) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  /* 5-6 — 2 columns, 3 rows */
  .gallery:has(> .video-tile:nth-child(5)) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
  }
  /* 7-9 — 3 columns, 3 rows */
  .gallery:has(> .video-tile:nth-child(7)) {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .control-btn { min-width: 40px; padding: 6px 4px; }
  .self-pip { width: 90px; height: 54px; }
  /* Squeeze the auth card a bit more — viewport is < 380px, so the
     12px gutters from the 640px breakpoint still leave too little. */
  .auth-card {
    width: calc(100vw - 16px);
    padding: 18px 14px;
  }
  #screen-auth { padding: 0 8px; }
}

/* ============== Waiting room ============== */
.waiting-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.waiting-card {
  max-width: 480px;
  width: 100%;
  text-align: center;
  padding: 48px 40px;
}
.waiting-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.85;
}
.waiting-card h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}
.waiting-info {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 18px;
}
.waiting-time {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.waiting-countdown {
  font-size: 38px;
  font-weight: 600;
  color: var(--accent);
  margin: 6px 0 18px;
  font-variant-numeric: tabular-nums;
}
.waiting-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.waiting-actions {
  display: flex;
  justify-content: center;
}

/* ============== Host preview banner ============== */
.host-banner {
  background: linear-gradient(90deg, rgba(242, 166, 35, 0.18), rgba(242, 166, 35, 0.05));
  border-bottom: 1px solid rgba(242, 166, 35, 0.4);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}
.host-banner-icon {
  font-size: 18px;
}
.host-banner-text {
  flex: 1;
}
.host-banner-text strong {
  color: var(--warning);
  font-weight: 600;
}
.host-banner-action {
  background: var(--warning);
  color: #1f1300;
  border: none;
  padding: 6px 14px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 13px;
}
.host-banner-action:hover { background: #ffb733; }

/* Waiter count badge in lobby */
.waiter-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  margin-left: 6px;
  background: rgba(242, 166, 35, 0.18);
  color: var(--warning);
  border: 1px solid rgba(242, 166, 35, 0.4);
  cursor: pointer;
}
.waiter-badge:hover { background: rgba(242, 166, 35, 0.3); }

/* Waiter list inside modal */
.waiter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  margin: 12px 0;
}
.waiter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border-radius: 6px;
  font-size: 13px;
}
.waiter-row .waiter-info { display: flex; align-items: center; gap: 10px; }
.waiter-row .waiter-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
}
.waiter-row .waiter-time { color: var(--text-muted); font-size: 11px; margin-left: 4px; }
.waiter-row .btn-admit {
  background: var(--success);
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.waiter-row .btn-admit:hover { background: #259070; }

.waiter-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 30px 0;
}

/* ============== Whiteboard ============== */
.whiteboard {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(15, 17, 21, 0.92);
  display: flex;
  flex-direction: column;
}
.whiteboard.mode-fullscreen {
  background: #ffffff;
}
.whiteboard.mode-fullscreen canvas {
  background: #ffffff;
}
.whiteboard canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  display: block;
}
.wb-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.wb-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.wb-spacer {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}
.wb-tool {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.wb-tool:hover { transform: scale(1.1); }
.wb-tool.active { border-color: var(--text); }
.wb-action {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px;
}
.wb-action:hover { background: var(--bg-elev-3); }
.wb-action.danger {
  background: rgba(226, 75, 74, 0.15);
  border-color: rgba(226, 75, 74, 0.45);
  color: var(--danger);
}
.wb-action.danger:hover { background: var(--danger); color: white; }

/* ============== Host indicator + context menu ============== */
.host-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 500;
  vertical-align: middle;
}
.host-action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-left: 6px;
}
.host-action-btn:hover { background: var(--bg-elev-3); color: var(--text); }

.context-menu {
  position: fixed;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px;
  z-index: 1500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  min-width: 140px;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}
.context-menu button:hover { background: var(--bg-elev-2); }
.context-menu button.danger { color: var(--danger); }
.context-menu button.danger:hover { background: var(--danger); color: white; }

/* Section label inside context menus */
.context-menu .ctx-section-label {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 12px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.context-menu .ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.context-menu .ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.context-menu .ctx-item:hover { background: var(--bg-elev-2); }
.context-menu .ctx-item.selected { background: rgba(25, 118, 255, 0.15); color: var(--accent); }
.context-menu .ctx-item.selected::after { content: '✓'; margin-left: auto; }
.context-menu .ctx-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}
.context-menu .ctx-item.selected .ctx-icon { color: var(--accent); }

/* Layout menu specifically — bottom-anchored above the layout button */
.layout-menu {
  min-width: 200px;
}

/* Gallery pager */
.gallery-pager {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--text);
  z-index: 8;
}
.gallery-pager .pager-btn {
  background: transparent;
  border: none;
  color: var(--text);
  width: 26px;
  height: 26px;
  border-radius: 13px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.gallery-pager .pager-btn:hover { background: var(--bg-elev-3); }
.gallery-pager .pager-label {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  min-width: 36px;
  text-align: center;
}

/* ============================================================
 * MEDIA PLAYBACK (Phase 10)
 * ============================================================ */

/* Picker overlay — sits on top of the meeting UI when host browses
 * the lecture library. */
.media-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}
.media-picker {
  background: var(--bg-elev-2);
  border-radius: 12px;
  width: min(720px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.media-picker-head {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.media-picker-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.media-picker-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.media-picker-item {
  background: var(--bg-elev-1);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  color: inherit;
}
.media-picker-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.media-picker-item img,
.media-picker-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #1a3a6e 0%, #0c2447 100%);
}
.media-picker-meta {
  padding: 8px 10px 10px;
}
.media-picker-title {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
  /* Clamp to 2 lines so cards don't get jagged heights */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Lecture-video stage. When a meeting has an active media playback this
 * overlay sits over the gallery. The host's camera floats in the corner
 * as PIP (or vice versa, when state.focus === 'pip'). */
.media-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 100;
}
.media-stage video.media-main {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.media-stage .media-pip {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: clamp(140px, 18vw, 240px);
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev-2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.15);
}
.media-stage .media-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Host-only control bar */
.media-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 12px;
  border-radius: 30px;
  backdrop-filter: blur(8px);
  z-index: 110;
}
.media-controls button {
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-controls button:hover { background: rgba(255, 255, 255, 0.12); }
.media-controls .media-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 240px;
}
.media-controls input[type=range] {
  flex: 1;
  accent-color: var(--accent);
}

/* ============================================================
 * LECTURE-VIDEO PLAYBACK (Phase 10)
 * ============================================================ */

/* Content tile in the speaker-view main area when a lecture video is
 * playing. Same backdrop as screenshare; we just swap the source. */
.content-tile {
  background: #000;
  position: relative;
}
.content-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.content-tile .content-pip-corner {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: clamp(140px, 18vw, 240px);
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elev-2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.18);
}
.content-tile .content-pip-corner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Floating host control panel — pause/seek/mode/stop */
.content-host-panel {
  position: fixed;
  left: 50%;
  bottom: 96px;        /* above the main toolbar */
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 20, 30, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 14px;
  border-radius: 28px;
  z-index: 1100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  color: #e6ecf5;
}
.cp-btn {
  background: transparent;
  border: none;
  color: #e6ecf5;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  font-size: 18px;
  padding: 0;
}
.cp-btn:hover  { background: rgba(255, 255, 255, 0.10); }
.cp-btn.active { background: rgba(70, 130, 220, 0.30); color: #cfe1ff; }
.cp-btn.cp-stop { color: #ff8a8a; }
.cp-btn.cp-stop:hover { background: rgba(255, 80, 80, 0.18); }
.cp-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
}
.cp-progress input[type=range] {
  flex: 1;
  accent-color: #4682dc;
  /* Hide the default thumb shadow that defaults look bad on dark bg */
  height: 4px;
  cursor: pointer;
}
.cp-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: rgba(230, 236, 245, 0.75);
  min-width: 36px;
  text-align: center;
}
.cp-mode-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  padding: 2px;
}

/* Picker modal — content list grid */
.content-picker-overlay { z-index: 5000; }
.content-picker-modal {
  width: min(720px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.content-picker-head {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.content-picker-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
}
.content-picker-head .btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #aab);
  font-size: 24px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.content-picker-body {
  padding: 16px 18px;
  overflow-y: auto;
}
.content-picker-loading {
  text-align: center;
  color: var(--text-muted, #aab);
  padding: 40px 0;
}
.content-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.content-picker-card {
  background: var(--bg-elev-1, rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
  color: inherit;
  font: inherit;
}
.content-picker-card:hover {
  border-color: #4682dc;
  transform: translateY(-2px);
}
.content-picker-card img,
.content-picker-card .content-picker-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: linear-gradient(135deg, #1a3a6e 0%, #0c2447 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 28px;
}
.content-picker-card-body {
  padding: 8px 10px 10px;
}
.content-picker-card-title {
  font-weight: 500;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.content-picker-card-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted, #aab);
}

/* ============================================================
 * MODE SELECTOR + PREFETCH UI (Phase 10b)
 * ============================================================ */
.content-mode-modal {
  width: min(560px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.mode-summary {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mode-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--bg-elev-1, rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: border-color 0.12s, transform 0.12s;
}
.mode-option:hover {
  border-color: #4682dc;
  transform: translateY(-1px);
}
.mode-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.mode-text { flex: 1; }
.mode-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}
.mode-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
}
.mode-cache-status {
  margin-top: 6px;
  font-size: 11px;
}

/* Prefetch banner — appears for viewers when host requests a download */
.prefetch-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: rgba(15, 20, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 14px 16px;
  z-index: 6000;
  font-size: 13px;
  color: #e6ecf5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.prefetch-title {
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 13px;
}
.prefetch-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.prefetch-bar {
  height: 100%;
  background: #4682dc;
  width: 0;
  transition: width 0.2s;
}
.prefetch-percent {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  text-align: right;
}

/* Spinner used by 'preparing' placeholder */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4682dc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 * PREFETCH WAITING ROOM (Phase 10c — host-side)
 * ============================================================ */
.prefetch-waiting-room {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  background: rgba(15, 20, 30, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  padding: 22px 24px;
  z-index: 6500;
  color: #e6ecf5;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.pwr-title {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}
.pwr-subtitle {
  font-size: 13px;
  color: rgba(230, 236, 245, 0.65);
  margin-bottom: 16px;
}
.pwr-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.pwr-bar {
  height: 100%;
  background: linear-gradient(90deg, #4682dc, #6aa6ff);
  width: 0;
  transition: width 0.3s;
}
.pwr-counts {
  font-size: 12px;
  color: rgba(230, 236, 245, 0.70);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pwr-failed { color: #ff8a8a; }
.pwr-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Viewer-side progress display */
.content-host-panel.viewer-only {
  /* Read-only mini panel — narrower, no controls */
  padding: 6px 12px;
}
.cp-mode-badge {
  font-size: 16px;
  margin-right: 6px;
  opacity: 0.85;
}
.cp-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  color: rgba(230, 236, 245, 0.85);
}
.cp-progress-readonly {
  min-width: 240px;
}
.cp-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.cp-progress-fill {
  height: 100%;
  background: #4682dc;
  width: 0;
  transition: width 0.5s linear;
}

/* Play-mode switcher in the host control panel */
.cp-playmode-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}
.cp-playmode-toggle .cp-btn {
  font-size: 14px;
  width: 30px;
  height: 30px;
}

/* ============================================================
 * UTILITY CLASSES (Phase 12 — strict CSP migration)
 * ============================================================
 * These replace inline style="..." attributes so the page can run
 * under script-src + style-src strict CSP without 'unsafe-inline'
 * on either. Where a value is genuinely dynamic (a percentage that
 * changes per frame, a user-picked color), the code now uses
 * element.style.* JS calls — those are CSP-compatible because
 * they're not inline-attribute injections.
 */
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex-1 { flex: 1; }
.flex-1-min0 { flex: 1; min-width: 0; }
.flex-1-min0-mono { flex: 1; min-width: 0; font-family: inherit; }
.flex-1-mono { flex: 1; min-width: 24px; font-family: monospace; text-align: right; }
.flex-1-small { flex: 1; font-size: 12px; }

/* 파일 선택 버튼(이미지 업로드 등) — OS 기본 스타일 대신 앱 버튼 스타일 적용 */
input[type="file"] { color: var(--text-muted); font-size: 12px; }
input[type="file"]::file-selector-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  margin-right: 10px;
  transition: border-color .15s, color .15s, background .15s;
}
input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2, rgba(255,255,255,0.03));
}
input[type="file"]::-webkit-file-upload-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  margin-right: 10px;
}
.maxw-380 { max-width: 380px; }
.maxw-420 { max-width: 420px; }
.maxw-480 { max-width: 480px; }
.va-middle { vertical-align: middle; }

/* Color helpers (use existing CSS variables) */
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted-13 { color: var(--text-muted); font-size: 13px; }
.text-muted-12 { color: var(--text-muted); font-size: 12px; }
.text-muted-block { color: var(--text-muted); font-size: 13px;
                    text-align: center; padding: 30px 0; }
.text-danger-block { color: var(--danger); font-size: 13px;
                    text-align: center; padding: 30px 0; }
.muted-mt6 { color: var(--text-muted); margin-top: 6px; }

.indent-muted { padding-left: 20px; color: var(--text-muted); }
.note-muted    { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.note-pre      { font-size: 14px; color: var(--text-muted); margin-bottom: 16px;
                 white-space: pre-line; }
.note-tiny     { font-size: 12px; color: var(--text-muted); margin-top: 14px; }
.note-13       { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

.code-block {
  font-size: 12px; font-family: monospace;
  background: var(--bg-elev-2); padding: 10px;
  border-radius: 6px; margin-bottom: 12px;
  max-height: 120px; overflow: auto;
}

/* Diagnostics page — preview thumbnails */
.diag-thumb {
  width: 100%; background: #000; border-radius: 6px;
  aspect-ratio: 16 / 9;
}

/* Sky gradient backgrounds for the lobby orb glow */
.bg-sky-warm  { background: linear-gradient(180deg, #7ec8e3 0%, #f4d35e 60%, #ee964b 100%); }
.bg-sky-cool  { background: linear-gradient(180deg, #3a4a5e 0%, #6a7a8e 100%); }
.bg-brand     { background: linear-gradient(135deg, #1976ff 0%, #7f77dd 100%); }
.bg-white     { background: #ffffff; }
.bg-amber     { background: #f2a623; }
.bg-red       { background: #e24b4a; }
.bg-green     { background: #1d9e75; }
.bg-blue      { background: #1976ff; }

/* Layout helpers */
.center-stack {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}

/* Progress fill width is set via element.style.width — base style here */
.progress-fill { transition: width 0.3s; }
.text-13 { font-size: 13px; }

/* Virtual-bg custom thumbnail with user-uploaded image */
.vbg-thumb-cover {
  background-size: cover;
  background-position: center;
}

/* ============================================================
 * AUTH-SCREEN LANGUAGE PICKER (Phase 13)
 * ============================================================
 * Dropdown showing BOTH languages with the active one marked.
 * Replaces the previous "single button that flips" UI which was
 * confusing — users couldn't tell whether 'English' was the current
 * state or the action.
 */
.lang-picker {
  position: relative;
  display: inline-block;
}
.lang-picker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lang-picker-current {
  font-weight: 500;
}
.lang-picker-menu {
  position: absolute;
  bottom: calc(100% + 6px);   /* opens UPWARD because picker is at bottom of card */
  left: 50%;
  transform: translateX(-50%);
  min-width: 130px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 100;
}
.lang-picker-menu li { margin: 0; }
.lang-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}
.lang-picker-item:hover {
  background: var(--bg-elev-3);
}
.lang-picker-check {
  width: 14px;
  display: inline-block;
  text-align: center;
  color: var(--accent);
  visibility: hidden;     /* shown only on the active item via .active */
}
.lang-picker-item.active {
  font-weight: 500;
}
.lang-picker-item.active .lang-picker-check {
  visibility: visible;
}

/* ===== 입장 진행 오버레이 ===== */
#join-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(8, 12, 20, .88); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
#join-overlay[hidden] { display: none; }
.join-box { text-align: center; }
.join-spinner {
  width: 48px; height: 48px; margin: 0 auto 18px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: joinspin 0.9s linear infinite;
}
@keyframes joinspin { to { transform: rotate(360deg); } }
.join-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.join-step { font-size: 13px; color: var(--text-muted); min-height: 18px; }
.modal-sm { max-width: 360px; }
.btn-danger { background: #c0392b; color: #fff; border: 0; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; font-size: 14px; }
.btn-danger:hover { background: #e74c3c; }

/* ===== 오디오 장치 테스트 ===== */
.btn-test { flex-shrink: 0; padding: 6px 12px; font-size: 12px; white-space: nowrap; }
.level-meter {
  flex: 1; height: 10px; background: var(--bg-input, #1a2433);
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.level-fill {
  height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, #22c55e 60%, #f5b740 80%, #f8285a 100%);
  transition: width .06s linear;
}
.level-status { flex-shrink: 0; font-size: 12px; color: var(--text-muted); min-width: 90px; }

/* ===== 예약 폼 ===== */
.schedule-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
#recur-until-row { margin-top: 10px; }

/* ===== 다가오는 예약 항목 ===== */
.up-item { display: flex; align-items: center; gap: 12px; padding: 11px 4px;
  border-bottom: 1px solid var(--border); }
.up-item:last-child { border-bottom: 0; }
.up-when { flex-shrink: 0; text-align: center; width: 64px; }
.up-when .d { font-size: 17px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.up-when .m { font-size: 11px; color: var(--text-muted); }
.up-info { flex: 1; min-width: 0; }
.up-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-sub { font-size: 12px; color: var(--text-muted); }
.up-recur { font-size: 10px; font-weight: 700; color: #8fdcef; background: rgba(23,163,196,.16);
  border-radius: 5px; padding: 1px 6px; margin-left: 6px; }

/* ===== 캘린더 (월 그리드 — 콘솔 다크 톤) ===== */
.cal-header { display: flex; align-items: center; gap: 8px; }
.cal-header h2 { flex: 1; text-align: center; font-size: 16px; margin: 0; }
.cal-nav { font-size: 18px; padding: 2px 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-dim); padding: 6px 0 8px; font-weight: 700; }
.cal-cell { min-height: 64px; border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 6px; cursor: pointer; background: rgba(255,255,255,.015); transition: border-color .12s; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.other { opacity: .35; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-cell .dnum { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cal-cell.today .dnum { color: var(--accent); }
.cal-ev { margin-top: 3px; font-size: 10.5px; padding: 2px 5px; border-radius: 5px;
  background: rgba(23,163,196,.18); color: #aee6f2; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.cal-ev-more { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.cal-day-detail { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.cal-day-detail h3 { font-size: 14px; margin: 0 0 8px; }

/* ===== flatpickr 다크 보정 (vendor 기본 라이트 테마 위에 덮음) ===== */
.flatpickr-calendar { background: #10222e; border: 1px solid #28475c; box-shadow: 0 14px 44px rgba(0,0,0,.5);
  color: #e6f1f7; }
.flatpickr-calendar.arrowTop:before, .flatpickr-calendar.arrowTop:after { border-bottom-color: #10222e; }
.flatpickr-months, .flatpickr-month, .flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year, .flatpickr-weekdays, span.flatpickr-weekday {
  background: transparent; color: #e6f1f7; fill: #e6f1f7; }
.flatpickr-day { color: #c8dbe6; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: #5d7e94; }
.flatpickr-day:hover { background: #152a38; border-color: #28475c; }
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: #17a3c4; border-color: #17a3c4; color: #06222b; font-weight: 700; }
.flatpickr-day.today { border-color: #17a3c4; }
.flatpickr-time { background: #0d1c27; border-top: 1px solid #28475c; }
.flatpickr-time input, .flatpickr-time .flatpickr-am-pm { color: #e6f1f7; background: transparent; }
.flatpickr-time input:hover, .flatpickr-time input:focus { background: #152a38; }
.numInputWrapper span.arrowUp:after { border-bottom-color: #8fb6c9; }
.numInputWrapper span.arrowDown:after { border-top-color: #8fb6c9; }

/* ===== 콘텐츠 라이브러리 트리 탐색 ===== */
.content-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 0 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.crumb { background: none; border: 0; color: var(--accent); cursor: pointer;
  font-size: 13px; padding: 3px 6px; border-radius: 6px; }
.crumb:hover { background: rgba(23,163,196,.12); }
.crumb:last-child { color: var(--text); font-weight: 700; cursor: default; }
.crumb-sep { color: var(--text-dim); font-size: 12px; }
.content-picker-card.folder .content-picker-thumb-placeholder { font-size: 34px; }
.cp-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.cp-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.cp-section { font-size: 13px; color: var(--text-muted); margin: 16px 0 8px;
  padding-top: 12px; border-top: 1px solid var(--border); }

/* ===== 조직도 초대 모달 ===== */
.org-modal { max-width: 720px; width: calc(100% - 40px); max-height: 84vh;
  display: flex; flex-direction: column; }
.org-body { display: flex; gap: 16px; overflow: hidden; flex: 1; min-height: 320px; }
.org-tree { flex: 1.3; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; }
.org-side { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.org-dept { margin: 2px 0; }
.org-dept-head { display: flex; align-items: center; gap: 7px; padding: 5px 6px;
  border-radius: 7px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.org-dept-head:hover { background: rgba(255,255,255,.04); }
.org-caret { width: 14px; text-align: center; color: var(--text-dim); font-size: 11px;
  transition: transform .12s; }
.org-dept.open > .org-dept-head .org-caret { transform: rotate(90deg); }
.org-dept-children { margin-left: 20px; display: none; }
.org-dept.open > .org-dept-children { display: block; }
.org-person { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 26px;
  border-radius: 7px; font-size: 13px; cursor: pointer; }
.org-person:hover { background: rgba(255,255,255,.04); }
.org-person .em { color: var(--text-dim); font-size: 11px; margin-left: auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.org-sel-box { flex: 1; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; }
.org-chip { display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 6px 0;
  background: rgba(23,163,196,.14); color: #aee6f2; border-radius: 999px;
  font-size: 12px; padding: 3px 8px 3px 10px; }
.org-chip button { background: none; border: 0; color: #aee6f2; cursor: pointer;
  font-size: 13px; padding: 0; line-height: 1; }
.org-empty { color: var(--text-dim); font-size: 12.5px; }
.org-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.org-count { font-size: 13px; color: var(--text-muted); margin-right: auto; }
.invite-results { font-size: 12.5px; margin-top: 8px; }
.invite-results .ok { color: #22c55e; }
.invite-results .off { color: #f5b740; }
.invite-results .nr { color: var(--text-dim); }

/* ===== 화면 공유 사전 선택 ===== */
.share-modal { max-width: 520px; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.share-card { background: rgba(255,255,255,.02); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 10px; cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .12s, transform .12s; }
.share-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.share-card .share-ic { font-size: 28px; }
.share-card strong { font-size: 13.5px; }
.share-card small { font-size: 11px; color: var(--text-muted); text-align: center; }
.share-audio { display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 13px; color: var(--text-muted); cursor: pointer; }

/* ===== 녹화 목록 툴바/페이징 ===== */
.rec-toolbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 12px;
  border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.rec-selall { display: flex; align-items: center; gap: 7px; font-size: 13px;
  color: var(--text-muted); cursor: pointer; margin-right: auto; }
.rec-row .rec-check { flex-shrink: 0; }
.rec-pgn { display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 12px 0 4px; font-size: 13px; color: var(--text-muted); }
.rec-pgn button[disabled] { opacity: .35; }

/* ===== 조직도 차트 (d3-org-chart) — 사용자 모달 ===== */
.org-modal { max-width: 980px; }
.org-chart-wrap { flex: 1.6; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.org-switch { max-width: 200px; padding: 4px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg-elev-2); color: var(--text); font-size: 12.5px;
  margin-right: 6px; }
.org-chart-tb { display: flex; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border);
  align-items: center; }
.org-chart-tb .sp { flex: 1; font-size: 12.5px; color: var(--text-dim); }
.org-chart-tb button { width: 28px; height: 26px; border: 1px solid var(--border);
  background: transparent; color: var(--text); border-radius: 6px; cursor: pointer; }
.org-chart-tb button:hover { border-color: var(--accent); color: var(--accent); }
.org-chart-canvas { flex: 1; min-height: 380px; background:
  radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0) 0 0/22px 22px; }
.oc-card { width: 188px; height: 74px; box-sizing: border-box; border-radius: 12px;
  background: linear-gradient(160deg, #1b2433, #151c29); border: 1px solid #2a3548;
  box-shadow: 0 6px 16px rgba(0,0,0,.35); padding: 9px 11px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--text); transition: border-color .12s, box-shadow .12s; }
.oc-card:hover { border-color: #2c97b3; }
.oc-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(23,163,196,.35); }
.oc-card.root { background: linear-gradient(160deg, #14283a, #102030); border-color: #1d4f63; }
.oc-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.oc-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1; }
.oc-foot { display: flex; align-items: center; justify-content: space-between; }
.oc-cnt { font-size: 11px; color: var(--text-dim); background: rgba(147,166,194,.12);
  border-radius: 999px; padding: 1px 8px; }
.oc-pickall { font-size: 11px; border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.oc-pickall:hover, .oc-pickall.on { border-color: var(--accent); color: var(--accent); }
.oc-expand { width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  color: #06131c; font-weight: 900; font-size: 14px; display: flex; align-items: center;
  justify-content: center; margin: 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.org-side-title { font-size: 12px; color: var(--text-dim); font-weight: 700; margin: 2px 0 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-pick-shown { font-size: 11px; border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); border-radius: 6px; padding: 2px 8px; cursor: pointer; flex-shrink: 0;
  font-weight: 600; white-space: nowrap; }
.org-pick-shown:hover, .org-pick-shown.on { border-color: var(--accent); color: var(--accent); }

/* ===== 플로팅 미니 dock (공유 미니맵 / 강의 컨트롤러) ===== */
.mini-dock { position: fixed; right: 18px; bottom: 92px; width: 300px; z-index: 280;
  background: rgba(14, 20, 30, .92); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(8px); overflow: hidden; user-select: none; }
.md-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  cursor: grab; border-bottom: 1px solid var(--border); }
.md-head:active { cursor: grabbing; }
.md-dot { width: 8px; height: 8px; border-radius: 50%; background: #f8285a;
  animation: md-pulse 1.6s infinite; }
@keyframes md-pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.md-title { flex: 1; font-size: 12px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-btn { background: none; border: 0; color: var(--text-dim); cursor: pointer;
  font-size: 12px; padding: 2px 5px; border-radius: 5px; }
.md-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
#md-video { display: block; width: 100%; aspect-ratio: 16/9; background: #000;
  object-fit: contain; }
.mini-dock.collapsed .md-body { display: none; }
.md-controls { padding: 8px 10px 9px; }
.md-timeline { position: relative; height: 6px; background: rgba(255,255,255,.12);
  border-radius: 999px; cursor: pointer; margin-bottom: 8px; }
.md-progress { position: absolute; left: 0; top: 0; height: 100%; width: 0%;
  background: var(--accent); border-radius: 999px; }
.md-row { display: flex; align-items: center; gap: 8px; }
.md-ctl { width: 30px; height: 28px; border: 1px solid var(--border); background: transparent;
  color: var(--text); border-radius: 7px; cursor: pointer; font-size: 13px; }
.md-ctl:hover { border-color: var(--accent); color: var(--accent); }
.md-ctl.md-stop:hover { border-color: #f8285a; color: #ff8aa8; }
.md-time { font-size: 11.5px; color: var(--text-dim); flex: 1; text-align: center;
  font-variant-numeric: tabular-nums; }
.md-rate { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; font-size: 11.5px; padding: 4px 5px; }

/* ============================================================
   모바일 반응형 (v0.15) — 트렌드: 하단 고정 컨트롤 바, 바텀시트
   패널, 풀스크린 모달, 세이프에어리어, 큰 터치 타겟
   ============================================================ */
@media (max-width: 760px) {
  /* ── 공통 ── */
  input, select, textarea { font-size: 16px !important; } /* iOS 포커스 줌 방지 */
  .btn-primary, .btn-secondary { min-height: 44px; }       /* 터치 타겟 */

  /* ── 로비 ── */
  .lobby-topbar { padding: 10px 14px; }
  .lobby-hero { grid-template-columns: 1fr !important; padding: 14px !important; gap: 10px; }
  .hero-btn { min-height: 64px; }
  .lobby-grid, .lobby-cards { grid-template-columns: 1fr !important; }
  .lobby-card { margin: 0 0 12px; }

  /* ── 회의 화면 ── */
  .room-topbar { padding: 8px 10px; gap: 6px; }
  .room-topbar .room-meta { display: none; }            /* 통계는 모바일에서 숨김 */
  .room-topbar .room-id { display: none; }
  #room-name { font-size: 14px; max-width: 46vw; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }

  /* 하단 컨트롤: 고정 + 가로 스크롤 (주요 버튼이 항상 손 닿는 곳에) */
  .controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 250;
    flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    background: rgba(13, 18, 27, .96); backdrop-filter: blur(10px); }
  .controls::-webkit-scrollbar { display: none; }
  .controls .control-btn { flex: 0 0 auto; min-width: 58px; }
  .controls .control-btn .label { font-size: 10px; }
  .controls .divider { display: none; }
  /* 영상 영역이 바에 가리지 않게 */
  #screen-room { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  /* 사이드바(참여자/채팅) → 바텀시트 */
  .sidebar { position: fixed !important; inset: auto 0 0 0 !important;
    width: auto !important; height: 62dvh; border-left: 0 !important;
    border-top: 1px solid var(--border); border-radius: 16px 16px 0 0;
    z-index: 300; box-shadow: 0 -14px 40px rgba(0,0,0,.55);
    animation: sheetUp .22s ease; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .sidebar-close { display: block !important; }

  /* 비디오 그리드: 1~2열 자동 */
  .video-grid, #video-grid { grid-template-columns: repeat(auto-fit, minmax(46%, 1fr)) !important;
    gap: 6px !important; padding: 6px !important; }

  /* 모달 풀스크린화 */
  /* (v0.28.5) 구 풀스크린 모달 규칙 제거 — 중앙 대화상자 규칙으로 대체 */
  .org-modal .org-body { flex-direction: column; }
  .org-chart-canvas { min-height: 300px; }
  .share-grid { grid-template-columns: 1fr 1fr; }

  /* 설정 화면 행 세로 배치 */
  .settings-row { flex-wrap: wrap; }
  .settings-row label { width: 100% !important; margin-bottom: 2px; }
  .settings-row select { flex: 1 1 100%; }

  /* 미니 dock — 컨트롤 바 위로 */
  .mini-dock { width: min(280px, calc(100vw - 24px)); right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom)); }

  /* 녹화 목록 행 모바일 단순화 */
  .rec-row { grid-template-columns: auto 1fr; }
  .rec-row .rec-status, .rec-row > .rec-meta { display: none; }
}

/* 가로 모드(폰 landscape): 컨트롤 바 슬림 */
@media (max-width: 920px) and (orientation: landscape) and (max-height: 480px) {
  .controls { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .controls .control-btn .label { display: none; }
  #screen-room { padding-bottom: 52px; }
}

.sso-login-btn { width: 100%; margin-top: 8px; }

/* 로그인 계정 저장 스위치 */
.remember-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px;
  color: var(--text-dim); cursor: pointer; user-select: none; margin: 2px 0 4px; }
.remember-row input { display: none; }
.remember-row .sw { width: 38px; height: 22px; border-radius: 999px; background: var(--bg-elev-2);
  border: 1px solid var(--border); position: relative; transition: background .15s; flex: 0 0 auto; }
.remember-row .sw::after { content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-dim);
  transition: transform .15s, background .15s; }
.remember-row input:checked + .sw { background: rgba(23,163,196,.35); border-color: var(--accent); }
.remember-row input:checked + .sw::after { transform: translateX(16px); background: var(--accent); }

.org-room-pick { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.org-room-pick span { font-size: 12px; color: var(--text-dim); font-weight: 700; }
.org-room-sel { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 9px 10px; font-size: 13.5px; width: 100%; }

/* 조직도 footer — [N명 선택됨 · 모두 해제] | [초대할 회의: select] [초대] 한 줄 정렬 */
.org-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.org-foot-left { display: flex; align-items: center; gap: 10px; }
.org-foot .org-room-pick { flex: 1; min-width: 220px; flex-direction: row !important;
  align-items: center; gap: 8px; margin: 0 !important; }
.org-foot .org-room-pick span { white-space: nowrap; }
.org-foot .org-room-sel { flex: 1; width: auto; }
.org-foot .org-invite { white-space: nowrap; }

/* hero 링크 밑줄 제거 (라이브 방송 등 a 태그 hero 버튼) */
a.hero-btn, a.hero-btn * { text-decoration: none !important; }

/* 받은 초대 수신함 */
.inv-badge { background: var(--accent); color: #04222b; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; padding: 2px 9px; margin-left: 1em; }
.inv-list { display: flex; flex-direction: column; }
.inv-empty { color: var(--text-dim); font-size: 13px; padding: 14px 14px 14px 2em; }
.inv-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px;
  border-bottom: 1px solid var(--border); }
.inv-row:last-child { border-bottom: 0; }
.inv-main { flex: 1; min-width: 0; }
.inv-room { display: flex; align-items: center; gap: 8px; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.inv-st { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 2px 8px;
  flex: 0 0 auto; }
.inv-st.live { background: rgba(248,40,90,.16); color: #ff8aa8; }
.inv-st.sch  { background: rgba(23,163,196,.16); color: #8fdcef; }
.inv-st.idle { background: rgba(147,166,194,.14); color: var(--text-dim); }
.inv-st.end  { background: rgba(147,166,194,.10); color: var(--text-dim); opacity: .7; }
.inv-actions { display: flex; align-items: center; gap: 6px; }
.inv-pager { display: flex; align-items: center; justify-content: center; gap: 12px;
  padding-top: 8px; }
.inv-pager button { background: var(--bg-elev-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 7px; width: 28px; height: 26px; cursor: pointer; }
.inv-pager span { font-size: 12px; color: var(--text-dim); }

/* '캘린더' 버튼 1줄 고정 */
.lobby-card-header .btn-text { white-space: nowrap; flex: 0 0 auto; }

/* 초대 결과 대화상자 (Metronic 톤) */
.ir-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  align-items: center; justify-content: center; z-index: 6000; }  /* 조직도(<=5000) 위 */
.ir-modal { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 14px;
  width: min(440px, calc(100% - 40px)); box-shadow: 0 18px 60px rgba(0,0,0,.5);
  overflow: hidden; }
.ir-head { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 15px; }
.ir-x { background: none; border: 0; color: var(--text-dim); font-size: 15px; cursor: pointer; }
.ir-body { padding: 10px 18px; max-height: 46vh; overflow-y: auto; }
.ir-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13.5px;
  border-bottom: 1px solid var(--border); }
.ir-row:last-child { border-bottom: 0; }
.ir-row em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-dim); }
.ir-ic { width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  flex: 0 0 auto; }
.ir-row.ok .ir-ic { background: rgba(34,197,94,.16); color: #6ee7a0; }
.ir-row.off .ir-ic { background: rgba(23,163,196,.16); color: #8fdcef; }
.ir-row.nr .ir-ic { background: rgba(147,166,194,.14); color: var(--text-dim); }
.ir-foot { display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-top: 1px solid var(--border); }
.ir-note { flex: 1; font-size: 12px; color: var(--text-dim); }

/* 로비 카드 헤더 — 세로 가운데 정렬 + 우측 버튼 여백 */
.lobby-card-header { align-items: center !important; }
.lobby-card-header h2 { margin: 0; line-height: 1.3; }
.lobby-card-header .btn-text { margin-right: 6px; }

.inv-sync { margin-left: auto; font-size: 11px; color: var(--text-dim); }
#inv-refresh { white-space: nowrap; }

.inv-self { display: block; margin-top: 4px; font-size: 11px; opacity: .8; padding-left: 2px; }

.up-empty { list-style: none; color: var(--text-dim); font-size: 13px;
  padding: 14px 6px; }

/* 캘린더 모달 (v0.20.0) */
.cal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 900;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.cal-modal { width: min(880px, 100%); max-height: min(92dvh, 760px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,.55); }
.cal-modal .cal-grid { overflow-y: auto; }

/* v0.21.1 — '화면 공유 권한' 버튼: 공유 버튼 오른쪽에 결합 */
.control-btn.perm-arrow { margin-left: -6px; border-radius: 0 8px 8px 0;
  padding-left: 0; padding-right: 0; min-width: 34px; }  /* 측정 전 과소폭 방지 */
#btn-screen { border-top-right-radius: 0; border-bottom-right-radius: 0; }
#btn-screen[data-solo] { border-radius: 8px; }  /* 참가자(▾ 없음)는 원형 복귀 */

/* v0.21.1 — 조직도 사용자 검색 */
.org-search { width: 100%; box-sizing: border-box; margin-bottom: 8px;
  background: var(--bg-elev-2, #0d1522); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 13.5px; }
.org-search:focus { outline: none; border-color: var(--primary, #1976ff); }

/* v0.21.2 — 권한 메뉴: 참가자 많을 때 세로 스크롤 */
.share-perm-menu { max-height: min(58vh, 480px); overflow-y: auto; }

/* v0.21.2 — '다가오는 예약' 카드 좌우 숨통 */
#upcoming-card .room-list { padding-left: 1em; padding-right: 1em; }
#upcoming-card .lobby-card-header { padding-right: 1em; }

/* v0.21.4 — 브라우저 세로 축소 시 카드가 눌려 버튼이 잘리던 문제:
   로비 직계 자식(히어로/카드/그리드)은 절대 줄어들지 않고,
   공간이 모자라면 .lobby 가 세로 스크롤을 제공한다. */
.lobby > * { flex-shrink: 0; }
.lobby-card { flex-shrink: 0; }

/* v0.22.1 — 상단 통계 줄: 버튼 영역 확장에도 압착·줄바꿈 금지 */
.room-topbar .room-meta { flex-shrink: 0; white-space: nowrap; }

/* v0.22.2 — 화면공유: 참가자 패널 우측 세로 도킹 (Zoom 식) */
.speaker-view.strip-right { flex-direction: row; }
.speaker-view.strip-right .thumb-strip {
  flex-direction: column; width: 188px; height: auto;
  overflow-y: auto; overflow-x: hidden; align-content: flex-start;
}
.speaker-view.strip-right .thumb-strip .video-tile {
  width: 100%; height: auto; aspect-ratio: 16 / 9; flex-shrink: 0;
}
.strip-dock-btn {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev-2, #16202e); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  width: 30px; height: auto; align-self: stretch;
}
.speaker-view.strip-right .strip-dock-btn { width: 100%; height: 30px; align-self: auto; }
.strip-dock-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* v0.23.0 — 참가자 패널 분리(PiP) 중: 본창 스트립 숨김, 공유가 전체 사용 */
.speaker-view.strip-popped .thumb-strip { display: none; }

/* v0.26.1 — 로비 카드 안쪽 여백 (회귀 복구 + 확대)
   '다가오는 예약' 우측(캘린더 버튼)·'내가 만든 회의' 좌측이
   가장자리에 붙던 문제. 두 카드 모두 양측 1.5em 로 통일. */
#upcoming-card .room-list { padding-left: 1.5em; padding-right: 1.5em; }
#upcoming-card .lobby-card-header { padding-left: 1.5em; padding-right: 1.5em; }
.meetings-card .room-list { padding-left: 1.5em; padding-right: 1.5em; }
.meetings-card .lobby-card-header { padding-left: 1.5em; padding-right: 1.5em; }

/* ===== v0.28.0 — 사용자 화면 모바일 최적화 (≤760px) ===== */
@media (max-width: 760px) {
  /* 설정: 좌측 세로 메뉴 → 상단 가로 스크롤 탭 (모바일 표준 패턴).
     콘텐츠가 화면 전체 폭을 사용한다. */
  .settings-layout, .settings-body { display: block !important; }
  .settings-nav {
    display: flex !important; flex-direction: row !important;
    width: 100% !important; max-width: 100% !important;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 6px; padding: 8px 10px; position: sticky; top: 0; z-index: 5;
    background: var(--bg, #0b1320);
    border-bottom: 1px solid var(--border, #223349);
  }
  .settings-nav-item {
    flex: 0 0 auto; min-height: 44px; padding: 8px 14px !important;
    border-radius: 999px; font-size: 14px; white-space: nowrap;
  }
  .settings-content, .settings-section { padding: 14px 12px !important; }
  .settings-row { flex-wrap: wrap; gap: 6px; }
  .settings-row .settings-value { min-width: 0; overflow: hidden;
    text-overflow: ellipsis; }

  /* 로비: 카드가 화면 폭에 꽉 차게, 히어로 압축 */
  .lobby { padding: 10px 10px 28px !important; }
  .lobby-hero { padding: 14px 14px !important; }
  .lobby-hero h1 { font-size: 20px !important; }
  .lobby-grid, .lobby-cards { grid-template-columns: 1fr !important; }
  .room-list li { flex-wrap: wrap; row-gap: 6px; }

  /* 공통 모달: 진짜 '대화상자' — 내용 크기에 맞고 중앙에 뜬다.
     (이전 calc(100vw-20px) 강제 폭이 확인창까지 시트처럼 보이게 했음) */
  .modal-overlay { align-items: center !important; justify-content: center !important;
    padding: 16px; }
  .modal, .modal-overlay .modal {
    width: auto !important; min-width: min(78vw, 300px);
    max-width: min(92vw, 560px) !important;
    height: auto !important; min-height: 0 !important;
    max-height: 86vh !important; overflow-y: auto; margin: auto;
    border-radius: 14px !important; flex: 0 0 auto;
  }
  input, select, textarea { font-size: 16px; }

  /* 인증(로그인/가입) 카드 폭 */
  .auth-card { width: calc(100vw - 28px) !important; max-width: 420px; }
}

/* v0.28.2 — PiP 로 분리된 비디오의 원본 타일 숨김 (검은 잔상 방지) */
.video-tile.in-pip { display: none !important; }

/* v0.28.4 — 모바일: 상단 화면 배치 아이콘이 다른 아이콘보다 작던 문제 */
@media (max-width: 760px) {
  .topbar-btn { min-width: 42px; min-height: 42px;
    display: inline-flex; align-items: center; justify-content: center; }
  #btn-layout .icon { font-size: 22px !important; }
}

/* v0.28.6 — 모바일 분할 격자: 화면 전체를 N행×N열로 가득 채움.
   칸 비율은 화면비/N 을 따르고(세로·가로 자동 적응), 영상은 칸을
   가득 채운다(cover). 데스크톱 분할(16:9 칸)은 기존 유지. */
#gallery.grid-fill {
  align-content: stretch !important; justify-content: stretch !important;
  place-items: stretch; height: 100%; width: 100%;
}
#gallery.grid-fill .video-tile {
  width: 100% !important; height: 100% !important;
  aspect-ratio: auto !important; min-height: 0; min-width: 0;
}
#gallery.grid-fill .video-tile video { object-fit: cover; }

/* v0.28.7 — 강의 영상 컨트롤 (음소거·전체화면) */
.content-ctrls { position: absolute; top: 8px; right: 8px; display: flex;
  gap: 6px; z-index: 6; }
.cc-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid
  rgba(255,255,255,.25); background: rgba(0,0,0,.45); color: #fff;
  font-size: 17px; cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; backdrop-filter: blur(4px); }
.cc-btn:hover { background: rgba(0,0,0,.65); }
.cc-btn.active { background: var(--accent); border-color: var(--accent); }
@media (max-width: 760px) { .cc-btn { width: 42px; height: 42px; font-size: 19px; } }

/* v0.29.0 — 참가자 전체 화면(immersive) 강의 영상: 영상이 화면 전부 사용 */
.speaker-view.content-immersive .thumb-strip { display: none !important; }
.speaker-view.content-immersive #speaker-main { padding: 0 !important; }
.speaker-view.content-immersive .content-tile { border-radius: 0; }

/* v0.29.5 — 강의 영상 진단 배지 (좌상단, 임시 진단용) */
.cd-badge { position: absolute; top: 8px; left: 8px; z-index: 6;
  background: rgba(0,0,0,.55); color: #9fe870; font: 12px/1.5 monospace;
  padding: 4px 8px; border-radius: 8px; pointer-events: none; }

/* v0.29.7 — 자동재생 폴백 오버레이 / 컨트롤 패널 자동 숨김 */
.tap-unmute { position: absolute; inset: 0; z-index: 7; display: flex;
  align-items: center; justify-content: center; cursor: pointer;
  background: rgba(0,0,0,.35); }
.tap-unmute span { background: rgba(0,0,0,.7); color: #fff; padding: 12px 20px;
  border-radius: 999px; font-size: 16px; border: 1px solid rgba(255,255,255,.35); }
#content-host-panel { transition: opacity .3s ease; }
#content-host-panel.cp-idle { opacity: 0; pointer-events: none; }
#content-host-panel.cp-viewer { pointer-events: none; opacity: .85; }
#content-host-panel.cp-viewer.cp-idle { opacity: 0; }

/* v0.29.9 — 빌드 배지 (진단용) */
.build-tag { position: fixed; left: 6px; bottom: 6px; z-index: 2000;
  font: 10px/1 monospace; color: rgba(255,255,255,.5);
  background: rgba(0,0,0,.35); padding: 3px 6px; border-radius: 6px;
  pointer-events: none; }

/* v1.0.6 진단 — 콘텐츠 오디오 수신 상태칩 */
.ca-chip { position: absolute; bottom: 8px; left: 8px; z-index: 7;
  background: rgba(0,0,0,.6); color: #ffd166; font: 11px/1.5 monospace;
  padding: 3px 8px; border-radius: 7px; pointer-events: none; }

/* v1.0.14 — 강의 인앱 음량 슬라이더 */
.content-ctrls .cc-vol { width: 86px; accent-color: #fff; vertical-align: middle;
  margin: 0 4px; touch-action: none; }
@media (max-width: 768px) { .content-ctrls .cc-vol { width: 110px; } }

/* ============================================================
   v1.1.0 — 방송 오버레이(꾸미기) Phase 1
   ============================================================ */
.ov-layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.ov-layer.ov-edit { pointer-events: auto; }
.ov-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ov-layer.ov-edit .ov-draw { pointer-events: auto; }

.ov-obj { position: absolute; user-select: none; -webkit-user-select: none;
  touch-action: none; will-change: transform; }
.ov-text { padding: 2px 10px; border-radius: 6px; line-height: 1.25;
  max-width: 80%; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.ov-text.ov-editing { outline: 2px dashed #60a5fa; background: rgba(0,0,0,.35); cursor: text; }
.ov-image { background-repeat: no-repeat; }
.ov-shape svg { display: block; width: 100%; height: 100%; }

.ov-obj.ov-selected { outline: 1.5px solid #60a5fa; outline-offset: 2px; }
.ov-handles { position: absolute; inset: 0; pointer-events: none; }
.ov-handle { position: absolute; width: 14px; height: 14px; background: #fff;
  border: 2px solid #2E6BD6; border-radius: 50%; pointer-events: auto;
  touch-action: none; }
.ov-h-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.ov-h-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.ov-h-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.ov-h-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ov-h-rot { left: 50%; top: -28px; transform: translateX(-50%);
  background: #2E6BD6; cursor: grab; }

/* 호스트 편집 툴바 */
.ov-toolbar { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 2200; display: none; align-items: center; gap: 4px; padding: 8px 10px;
  background: rgba(20,24,33,.94); border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
  backdrop-filter: blur(8px); max-width: 94vw; flex-wrap: wrap; }
.ov-toolbar .ovt { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 8px;
  border: 1px solid transparent; background: rgba(255,255,255,.06); color: #fff;
  font-size: 16px; cursor: pointer; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center; }
.ov-toolbar .ovt:hover { background: rgba(255,255,255,.14); }
.ov-toolbar .ovt.active { border-color: #60a5fa; background: rgba(96,165,250,.25); }
.ov-toolbar .ovt[data-tool="text"] { font-weight: 800; font-family: serif; }
.ov-toolbar .ovt-act:disabled { cursor: default; }
.ov-toolbar .ovt-sep { width: 1px; height: 24px; background: rgba(255,255,255,.18);
  margin: 0 4px; }
.ov-toolbar .ovt-color { width: 32px; height: 32px; padding: 0; border: none;
  background: none; cursor: pointer; }
.ov-toolbar .ovt-size { width: 80px; }

@media (max-width: 768px) {
  .ov-toolbar { bottom: 78px; gap: 3px; padding: 6px; }
  .ov-toolbar .ovt { min-width: 32px; height: 32px; font-size: 15px; }
  .ov-toolbar .ovt-size { width: 60px; }
}

/* ============================================================
   v1.2.0 — 방송 오버레이 Phase 2 (위젯)
   ============================================================ */
/* 로어서드 */
.ov-l3 { padding: 10px 16px 10px 20px; border-radius: 8px;
  border-left: 5px solid var(--l3-accent, #2E6BD6);
  min-width: 180px; backdrop-filter: blur(4px); }
.ov-l3-title { font-weight: 800; line-height: 1.15; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.ov-l3-sub { font-size: 1.9vh; opacity: .85; margin-top: 2px; color: #cbd5e1; }
.ov-anim-slide .ov-l3 { animation: ovSlideIn .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ovSlideIn { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 배너/티커 (transform translateX marquee) */
.ov-banner-box { overflow: hidden; display: flex; align-items: center;
  border-radius: 4px; }
.ov-banner-track { display: inline-flex; white-space: nowrap; will-change: transform;
  animation: ovMarquee linear infinite; }
.ov-banner-track span { padding: 0 3vw; }
@keyframes ovMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ov-banner-track { animation: none; } }

/* 프레임 */
.ov-frame { box-sizing: border-box; }

/* 타이머 */
.ov-timer-box { display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 10px 22px; border-radius: 12px; gap: 2px;
  backdrop-filter: blur(4px); }
.ov-timer-label { font-size: 2vh; opacity: .85; }
.ov-timer-time { font-weight: 800; font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 6px rgba(0,0,0,.5); letter-spacing: 1px; }
.ov-timer-done { color: #f87171; animation: ovBlink 1s steps(2) infinite; }
@keyframes ovBlink { 50% { opacity: .35; } }

/* 툴바: 위젯/장면 드롭다운 */
.ovt-menu { position: relative; display: inline-flex; }
.ovt-dropdown { position: absolute; bottom: 44px; left: 0; display: none;
  flex-direction: column; min-width: 200px; padding: 6px; gap: 2px;
  background: rgba(20,24,33,.98); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.ovt-dropdown.open { display: flex; }
.ovt-dropdown > button, .ovt-scene-apply { text-align: left; padding: 8px 10px;
  border: none; background: transparent; color: #e5e7eb; border-radius: 6px;
  cursor: pointer; font-size: 13px; }
.ovt-dropdown > button:hover, .ovt-scene-apply:hover { background: rgba(96,165,250,.22); }
.ovt-scene-list { display: flex; flex-direction: column; gap: 2px;
  border-top: 1px solid rgba(255,255,255,.12); margin-top: 4px; padding-top: 4px; }
.ovt-scene-row { display: flex; align-items: center; gap: 4px; }
.ovt-scene-apply { flex: 1; }
.ovt-scene-del { background: transparent; border: none; color: #9ca3af;
  cursor: pointer; padding: 6px; border-radius: 6px; }
.ovt-scene-del:hover { background: rgba(248,113,113,.2); color: #fca5a5; }
.ovt-scene-empty { padding: 8px 10px; color: #9ca3af; font-size: 12px; }

/* ============================================================
   v1.3.0 — 방송 오버레이 Phase 3 (후원/인터랙티브)
   ============================================================ */
/* 알림 슬롯 + 카드 */
.ov-alert-slot { position: absolute; left: 0; right: 0; top: 12%; z-index: 60;
  display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.ov-alert { display: flex; align-items: center; gap: 14px; padding: 14px 22px;
  border-radius: 14px; background: linear-gradient(135deg, rgba(31,41,55,.96), rgba(17,24,39,.96));
  border: 1px solid rgba(255,255,255,.14); box-shadow: 0 10px 36px rgba(0,0,0,.5);
  color: #fff; max-width: 80%; opacity: 0; transform: translateY(-30px) scale(.96);
  transition: opacity .4s ease, transform .4s cubic-bezier(.2,.9,.3,1.2); }
.ov-alert-show { opacity: 1; transform: translateY(0) scale(1); }
.ov-alert-hide { opacity: 0; transform: translateY(-30px) scale(.96); }
.ov-alert-emoji { font-size: 5vh; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.ov-alert-title { font-weight: 800; font-size: 2.6vh; }
.ov-alert-msg { font-size: 2vh; opacity: .9; margin-top: 2px; }
.ov-alert-amount { font-size: 2.8vh; font-weight: 800; color: #ffd166; margin-top: 4px; }
.ov-alert-donation { border-color: rgba(255,209,102,.5); }
.ov-alert-follow { border-color: rgba(96,165,250,.5); }

/* 컨페티 */
.ov-confetti { position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px;
  opacity: .95; animation: ovConfetti 1.8s ease-in forwards; }
@keyframes ovConfetti {
  0% { transform: translate(0,0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--cx), var(--cy)) rotate(var(--cr)); opacity: 0; } }

/* 리액션 플로팅 */
.ov-reaction { position: absolute; bottom: 8%; z-index: 58; pointer-events: none;
  animation: ovFloatUp 3s ease-out forwards; will-change: transform, opacity; }
@keyframes ovFloatUp {
  0% { transform: translateY(0) scale(.6); opacity: 0; }
  15% { opacity: 1; transform: translateY(-10%) scale(1.1); }
  100% { transform: translateY(-75vh) scale(1); opacity: 0; } }

/* 목표 게이지 */
.ov-goal { padding: 10px 14px; border-radius: 12px; background: rgba(17,24,39,.86);
  backdrop-filter: blur(4px); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.ov-goal-top { display: flex; justify-content: space-between; align-items: baseline;
  color: #fff; margin-bottom: 6px; gap: 10px; }
.ov-goal-label { font-weight: 700; font-size: 1.9vh; }
.ov-goal-num { font-size: 1.7vh; opacity: .85; font-variant-numeric: tabular-nums; }
.ov-goal-bar { height: 14px; border-radius: 8px; background: rgba(255,255,255,.14); overflow: hidden; }
.ov-goal-fill { height: 100%; border-radius: 8px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* 투표 */
.ov-poll { padding: 12px 14px; border-radius: 12px; background: rgba(17,24,39,.88);
  backdrop-filter: blur(4px); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.ov-poll-q { font-weight: 800; font-size: 2vh; margin-bottom: 8px; }
.ov-poll-row { margin-bottom: 6px; }
.ov-poll-opt { font-size: 1.7vh; margin-bottom: 2px; }
.ov-poll-track { position: relative; height: 18px; border-radius: 6px;
  background: rgba(255,255,255,.12); overflow: hidden; }
.ov-poll-fill { height: 100%; background: linear-gradient(90deg,#60a5fa,#2E6BD6);
  transition: width .5s ease; }
.ov-poll-pct { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 1.4vh; font-weight: 700; }

/* 채팅 오버레이 */
.ov-chat-overlay { position: absolute; left: 16px; bottom: 96px; z-index: 56;
  display: none; flex-direction: column; gap: 4px; max-width: 38%;
  pointer-events: none; }
.ov-chat-row { background: rgba(17,24,39,.72); border-radius: 10px; padding: 5px 10px;
  color: #fff; font-size: 1.7vh; backdrop-filter: blur(3px); animation: ovChatIn .3s ease;
  word-break: break-word; }
.ov-chat-name { font-weight: 800; color: #60a5fa; margin-right: 6px; }
@keyframes ovChatIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ov-confetti, .ov-reaction { animation-duration: .01s; }
}

/* v1.3.5 — overlay 자체 대화상자(회의 화면용 fallback) */
.ov-dlg-ov { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 3000;
  display: flex; align-items: center; justify-content: center; }
.ov-dlg { background: #1f2937; border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  padding: 20px; min-width: 280px; max-width: 90vw; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.ov-dlg-title { margin: 0 0 8px; font-size: 17px; color: #fff; }
.ov-dlg-msg { margin: 0 0 14px; color: #cbd5e1; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.ov-dlg-input { width: 100%; box-sizing: border-box; margin-bottom: 12px; background: #0d1522;
  color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.ov-dlg-input:focus { outline: none; border-color: #60a5fa; }
.ov-dlg-btns { display: flex; gap: 10px; justify-content: flex-end; }
.ov-dlg-btn { border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.ov-dlg-btn.ghost { background: transparent; border-color: rgba(255,255,255,.25); color: #e5e7eb; }
.ov-dlg-btn.primary { background: #2E6BD6; color: #fff; }
.ov-dlg-btn.primary.danger { background: #e24b4a; }

/* v1.5.0 — 텍스트 속성 패널 (글꼴/크기/굵기/정렬) */
.ov-toolbar .ovt-textprops { display: inline-flex; align-items: center; gap: 3px; }
.ov-toolbar .ovt-font {
  height: 32px; border-radius: 8px; padding: 0 6px; font-size: 12.5px;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18);
  max-width: 92px; cursor: pointer; }
.ov-toolbar .ovt-font option { background: #1f2937; color: #fff; }
.ov-toolbar .ovt-fontsize { min-width: 32px; font-weight: 700; }
.ov-toolbar .ovt-fsval { min-width: 22px; text-align: center; font-size: 12.5px;
  color: #cbd5e1; font-variant-numeric: tabular-nums; }
.ov-toolbar .ovt-bold.active,
.ov-toolbar .ovt-align.active { border-color: #60a5fa; background: rgba(96,165,250,.28); }

/* ===== 임베드 모드 (eICU SSO 연동, ?embed=1) =====
   eICU 콘솔 안에 iframe 으로 표시될 때 불필요한 UI 를 숨겨 '협진 전용'
   메인으로 만든다. 상단 타이틀바(아바타/이름/설정/로그아웃)와 '라이브
   방송' 진입을 제거하고, 콘텐츠 상단 여백을 줄인다. */
.embedded .lobby-topbar { display: none !important; }
.embedded .hero-btn-cast { display: none !important; }
/* 상단바가 사라진 만큼 본문이 위로 붙도록 */
.embedded #screen-lobby .lobby-main,
.embedded #screen-lobby .hero { padding-top: 12px; }
/* 임베드 시 설정/진단 등 외부로 빠지는 동선 최소화: 설정 버튼이 다른 곳에
   남아있어도 가린다(중복 안전장치) */
.embedded #btn-open-settings,
.embedded #btn-logout { display: none !important; }
/* 임베드 메인: 인사말(좋은 저녁이에요…)은 숨기고, 안내 문구(회의를
   시작하거나 예약하고…)를 더 크게 — 협진용 화면을 깔끔하게. */
.embedded #hero-greeting { display: none !important; }
.embedded .hero-sub {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 24px;
}

/* ===== 임베드 설정 버튼 + 회의 표시 방식 대화상자 ===== */
/* 설정 버튼은 임베드 모드에서만 표시(우측 상단). */
.embed-settings-btn { display: none; }
.embedded .embed-settings-btn {
  display: inline-flex; align-items: center; justify-content: center;
  position: absolute; top: 14px; right: 16px; z-index: 30;
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border, #2a3442);
  color: var(--text-muted, #9aa6b2); cursor: pointer; transition: all .15s;
}
.embedded .embed-settings-btn:hover {
  background: rgba(255,255,255,.12); color: var(--text, #e6edf3);
}
/* lobby 안에서 버튼을 절대배치하기 위한 기준 */
.embedded .lobby { position: relative; }

.embed-dlg-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(5,8,14,.6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.embed-dlg {
  width: 100%; max-width: 460px; background: var(--panel, #131a24);
  border: 1px solid var(--border, #2a3442); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden;
}
.embed-dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border, #2a3442);
}
.embed-dlg-head h3 { margin: 0; font-size: 15px; color: var(--text, #e6edf3); }
.embed-dlg-x {
  border: 0; background: transparent; color: var(--text-muted, #9aa6b2);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.embed-dlg-x:hover { color: var(--text, #e6edf3); }
.embed-dlg-body { padding: 18px 20px; }
.embed-dlg-desc { margin: 0 0 14px; font-size: 13px; color: var(--text-muted, #9aa6b2); line-height: 1.6; }
.embed-opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; margin-bottom: 10px;
  border: 1px solid var(--border, #2a3442); border-radius: 11px; cursor: pointer; transition: all .15s;
}
.embed-opt:hover { border-color: var(--accent, #17a3c4); background: rgba(23,163,196,.05); }
.embed-opt.disabled { opacity: .5; cursor: not-allowed; }
.embed-opt.disabled:hover { border-color: var(--border, #2a3442); background: transparent; }
.embed-opt input { margin-top: 3px; accent-color: var(--accent, #17a3c4); flex: 0 0 auto; }
.embed-opt-main { display: flex; flex-direction: column; gap: 3px; }
.embed-opt-main strong { font-size: 14px; color: var(--text, #e6edf3); font-weight: 600; }
.embed-opt-main small { font-size: 12px; color: var(--text-muted, #9aa6b2); line-height: 1.55; }
.embed-dlg-warn { margin: 6px 0 0; font-size: 12px; color: #fcd980; line-height: 1.5; }
.embed-dlg-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border, #2a3442);
}
.embed-dlg-btn {
  border: 1px solid var(--border, #2a3442); background: var(--elev, #1a2230);
  color: var(--text, #e6edf3); border-radius: 9px; padding: 9px 18px; font-size: 13px; cursor: pointer;
}
.embed-dlg-btn.primary {
  background: var(--accent, #17a3c4); border-color: transparent; color: #04222b; font-weight: 700;
}
.embed-dlg-btn.primary:hover { filter: brightness(1.08); }

/* ===== 회의 전용 창(별도 창/PiP, ?embed_child=1) ===== */
/* 회의 입장 전 메인(로비)·로그인 화면이 잠깐 보이는 깜빡임을 막는다.
   room 화면과 입장 오버레이(join overlay)만 노출하고 나머지는 가린다.
   (클래스는 <html> 에 '렌더 전' 인라인 스크립트로 부착됨 — body 폴백도 유지) */
.embed-child { background: #0d1320; }
.embed-child #screen-lobby,
.embed-child #screen-auth { visibility: hidden !important; }
/* room 화면이 활성화되면 정상 표시 */
.embed-child #screen-room { visibility: visible !important; }
