/* ==========================================================================
   Lumen — AI Presentation Room
   Design tokens
   ========================================================================== */
:root{
  --bg-0: #090b10;
  --bg-1: #0d1017;
  --panel: rgba(255,255,255,0.045);
  --panel-strong: rgba(255,255,255,0.08);
  --panel-border: rgba(255,255,255,0.09);
  --text-hi: #eef1f6;
  --text-mid: #aab2c2;
  --text-low: #6b7386;

  --accent: #5ee6c8;         /* interactive / gesture cyan-teal   */
  --accent-soft: rgba(94,230,200,0.14);
  --voice: #9d8bfa;          /* voice-command violet               */
  --voice-soft: rgba(157,139,250,0.14);
  --camera: #f2b25a;         /* camera / device amber              */
  --camera-soft: rgba(242,178,90,0.14);
  --danger: #f2545b;
  --danger-soft: rgba(242,84,91,0.14);

  --laser: #33ff7a;          /* the single strong neon element     */

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;

  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease: cubic-bezier(.22,.9,.32,1);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(1100px 620px at 16% -8%, rgba(94,230,200,0.07), transparent 60%),
    radial-gradient(900px 560px at 100% 0%, rgba(157,139,250,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color: var(--text-hi);
  font-family: var(--font-body);
  overflow:hidden;
  -webkit-font-smoothing: antialiased;
}
button{ font-family: inherit; }
svg{ width:18px; height:18px; fill: currentColor; flex-shrink:0; }
::selection{ background: var(--accent-soft); }
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app{
  height:100vh;
  display:flex;
  flex-direction:column;
  padding:14px;
  gap:14px;
}

/* ---- top bar ---- */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 18px;
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-m);
  backdrop-filter: blur(18px);
  flex-shrink:0;
}
.topbar__brand{ display:flex; align-items:baseline; gap:10px; }
.brand-mark{
  font-family: var(--font-display);
  font-weight:700;
  font-size:19px;
  letter-spacing:0.2px;
  background: linear-gradient(120deg, #fff, var(--accent) 130%);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.brand-tag{ font-size:12.5px; color:var(--text-low); }

.topbar__status{
  display:flex; align-items:center; gap:8px;
  font-family: var(--font-mono);
  font-size:12.5px;
  color:var(--text-mid);
}
.live-dot{
  width:8px; height:8px; border-radius:50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(242,84,91,.6);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot{
  0%{ box-shadow:0 0 0 0 rgba(242,84,91,.55); }
  70%{ box-shadow:0 0 0 8px rgba(242,84,91,0); }
  100%{ box-shadow:0 0 0 0 rgba(242,84,91,0); }
}

.topbar__actions{ display:flex; align-items:center; gap:8px; }
.chip-btn{
  display:flex; align-items:center; gap:7px;
  background: transparent;
  border:1px solid var(--panel-border);
  color: var(--text-mid);
  padding:8px 14px;
  border-radius:999px;
  cursor:pointer;
  font-size:13px;
  transition: all .18s var(--ease);
}
.chip-btn:hover{ color:var(--text-hi); border-color: rgba(255,255,255,0.2); background: var(--panel-strong); }
.chip-btn svg{ width:15px; height:15px; }
.leave-btn{
  display:flex; align-items:center; gap:7px;
  background: linear-gradient(135deg, #ff5f6d, var(--danger));
  border:none; color:white;
  padding:9px 18px; border-radius:999px;
  font-weight:600; font-size:13px; cursor:pointer;
  box-shadow: 0 6px 18px rgba(242,84,91,0.28);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.leave-btn:hover{ transform: translateY(-1px); box-shadow: 0 8px 22px rgba(242,84,91,0.4); }
.leave-btn svg{ width:15px; height:15px; }

/* ---- layout grid ---- */
.layout{
  flex:1;
  display:grid;
  grid-template-columns: 1fr 300px;
  gap:14px;
  min-height:0;
}

/* ==========================================================================
   Stage / presentation area
   ========================================================================== */
.stage{
  position:relative;
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-l);
  backdrop-filter: blur(18px);
  display:flex; flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.indicators{
  position:absolute; top:16px; left:16px; z-index:6;
  display:flex; gap:8px;
}
.pill{
  display:flex; align-items:center; gap:6px;
  padding:6px 11px 6px 8px;
  border-radius:999px;
  background: rgba(10,12,16,0.55);
  border:1px solid var(--panel-border);
  font-size:11.5px; color:var(--text-low);
  backdrop-filter: blur(10px);
  transition: all .2s var(--ease);
}
.pill svg{ width:13px; height:13px; }
.pill[data-active="true"]{ color:var(--text-hi); border-color: transparent; }
.pill#indMic[data-active="true"]{ background: var(--voice-soft); color:var(--voice); }
.pill#indCam[data-active="true"]{ background: var(--camera-soft); color:var(--camera); }
.pill#indGesture[data-active="true"]{ background: var(--accent-soft); color:var(--accent); }
.pill#indVoice[data-active="true"]{ background: var(--voice-soft); color:var(--voice); animation: soft-flicker 1.4s infinite; }
@keyframes soft-flicker{ 0%,100%{opacity:1;} 50%{opacity:.72;} }

.voice-toast{
  position:absolute; top:16px; left:50%; transform: translate(-50%,-14px);
  z-index:7;
  padding:9px 18px;
  background: rgba(10,12,16,0.7);
  border:1px solid rgba(157,139,250,0.35);
  color: var(--voice);
  font-family: var(--font-mono);
  font-size:12.5px;
  border-radius:999px;
  backdrop-filter: blur(10px);
  opacity:0; pointer-events:none;
  transition: all .28s var(--ease);
}
.voice-toast.show{ opacity:1; transform: translate(-50%,0); }

.slide-viewport{
  position:relative;
  flex:1;
  margin:64px 22px 8px 22px;
  border-radius: var(--radius-m);
  background: #05070a;
  border:1px solid rgba(255,255,255,0.06);
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
}
.slide-zoomlayer{
  position:relative;
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  transform-origin: 50% 50%;
  transition: transform .45s var(--ease);
}
#slideCanvas, #slideImage{
  max-width:100%; max-height:100%;
  display:none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border-radius:4px;
}
.slide-viewport.has-slide #slideCanvas.active,
.slide-viewport.has-slide #slideImage.active{ display:block; }

.zoom-highlight{
  position:absolute;
  border:2px solid var(--accent);
  background: rgba(94,230,200,0.14);
  border-radius:6px;
  box-shadow: 0 0 0 4000px rgba(4,6,9,0.35), 0 0 18px rgba(94,230,200,0.5);
  opacity:0;
  pointer-events:none;
  transition: opacity .3s var(--ease);
}
.zoom-highlight.show{ opacity:1; }

/* ---- green laser pointer ---- */
.laser{
  position:absolute;
  width:16px; height:16px;
  border-radius:50%;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  background: radial-gradient(circle, #d8ffe4 0%, var(--laser) 42%, rgba(51,255,122,0.35) 70%, transparent 78%);
  box-shadow:
    0 0 8px 2px rgba(51,255,122,0.9),
    0 0 22px 8px rgba(51,255,122,0.55),
    0 0 46px 18px rgba(51,255,122,0.28);
  filter: blur(0.3px);
  opacity:0;
  pointer-events:none;
  z-index:5;
  transition: opacity .18s var(--ease), left .06s linear, top .06s linear;
}
.laser.show{ opacity:1; }

/* ---- empty state ---- */
.empty-stage{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; text-align:center; padding:24px;
  color: var(--text-mid);
}
.empty-stage__icon{
  width:56px; height:56px; border-radius:16px;
  display:flex; align-items:center; justify-content:center;
  background: var(--panel-strong);
  color: var(--accent);
  margin-bottom:6px;
}
.empty-stage__icon svg{ width:26px; height:26px; }
.empty-stage h2{ font-family:var(--font-display); font-size:18px; margin:0; color:var(--text-hi); font-weight:600; }
.empty-stage p{ margin:0; font-size:13.5px; max-width:320px; }
.empty-stage__hint{ font-size:11.5px; color:var(--text-low); margin-top:4px; }

.primary-btn{
  display:flex; align-items:center; gap:8px;
  background: linear-gradient(135deg, var(--accent), #35b79c);
  color:#052620; border:none; font-weight:700; font-size:13.5px;
  padding:11px 20px; border-radius:12px; cursor:pointer;
  margin-top:6px;
  box-shadow: 0 10px 26px rgba(94,230,200,0.2);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.primary-btn:hover{ transform: translateY(-1px); box-shadow: 0 12px 30px rgba(94,230,200,0.32); }
.primary-btn svg{ width:16px; height:16px; }

.slide-viewport.drag-over{ border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

.slide-counter{
  position:absolute; bottom:88px; right:32px; z-index:5;
  font-family: var(--font-mono); font-size:11.5px; color: var(--text-low);
  background: rgba(10,12,16,0.55); border:1px solid var(--panel-border);
  padding:5px 11px; border-radius:999px; backdrop-filter: blur(8px);
}

/* ---- definition popup ---- */
.definition-popup{
  position:absolute; bottom:96px; left:32px; z-index:8;
  width:300px;
  background: rgba(13,16,23,0.88);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-m);
  padding:16px 18px;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
  transform: translateY(16px) scale(.98);
  opacity:0; pointer-events:none;
  transition: all .25s var(--ease);
}
.definition-popup.show{ opacity:1; transform:translateY(0) scale(1); pointer-events:auto; }
.definition-popup__close{
  position:absolute; top:10px; right:12px;
  background:none; border:none; color:var(--text-low); font-size:18px; cursor:pointer;
  line-height:1;
}
.definition-popup__close:hover{ color: var(--text-hi); }
.definition-popup__word{ font-family: var(--font-display); font-weight:700; font-size:17px; text-transform: capitalize; color: var(--accent); }
.definition-popup__phonetic{ font-family: var(--font-mono); font-size:12px; color: var(--text-low); margin-top:2px; }
.definition-popup__body{ font-size:13.5px; color: var(--text-mid); margin-top:10px; line-height:1.5; }
.definition-popup__body em{ display:block; margin-top:8px; color: var(--text-low); font-style:italic; }

/* ---- control bar ---- */
.controlbar{
  flex-shrink:0;
  display:flex; align-items:center; justify-content:center; gap:6px;
  padding:10px 16px;
  margin:0 16px 16px 16px;
  background: rgba(10,12,16,0.5);
  border:1px solid var(--panel-border);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  flex-wrap:wrap;
}
.ctrl{
  display:flex; flex-direction:column; align-items:center; gap:3px;
  background:none; border:none; color: var(--text-mid);
  padding:8px 12px; border-radius:12px; cursor:pointer;
  transition: all .16s var(--ease);
  min-width:52px;
}
.ctrl:hover{ background: var(--panel-strong); color: var(--text-hi); }
.ctrl:active{ transform: scale(.94); }
.ctrl__label{ font-size:10.5px; }
.ctrl-divider{ width:1px; height:26px; background: var(--panel-border); margin:0 4px; }
.ctrl--toggle.is-on{ color: var(--accent); background: var(--accent-soft); }
.ctrl--toggle.is-off{ color: var(--danger); }
#btnLaser.is-on{ color: var(--laser); background: rgba(51,255,122,0.12); }

/* ==========================================================================
   Side panel
   ========================================================================== */
.sidepanel{
  display:flex; flex-direction:column; gap:14px; min-height:0;
}
.self-view{
  position:relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-m);
  overflow:hidden;
  background: linear-gradient(160deg,#141824,#0a0c11);
  border:1px solid var(--panel-border);
  flex-shrink:0;
}
.self-view video{
  width:100%; height:100%; object-fit:cover;
  transform: scaleX(-1);
}
.self-view canvas{
  position:absolute; inset:0; width:100%; height:100%;
  transform: scaleX(-1);
  pointer-events:none;
}
.self-view__label{
  position:absolute; bottom:8px; left:10px;
  font-size:11px; padding:4px 9px; border-radius:999px;
  background: rgba(0,0,0,0.55); color: var(--text-mid);
  backdrop-filter: blur(6px);
}
.self-view__off{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; color: var(--text-low); font-size:12px;
  background: #0a0c11;
  opacity:0; pointer-events:none; transition: opacity .2s;
}
.self-view__off.show{ opacity:1; }
.self-view__off svg{ width:22px; height:22px; }

.participants{
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-m);
  padding:12px 14px;
  flex-shrink:0;
}
.participants__title{
  font-size:12.5px; color: var(--text-mid); display:flex; align-items:center; gap:6px;
  margin-bottom:10px; font-weight:600;
}
.participants__title span{
  background: var(--panel-strong); color:var(--text-hi);
  font-family: var(--font-mono); font-size:10.5px;
  padding:1px 7px; border-radius:999px;
}
.participant-list{ display:flex; flex-direction:column; gap:8px; max-height:110px; overflow-y:auto; }
.participant-row{ display:flex; align-items:center; gap:9px; font-size:12.5px; color: var(--text-mid); }
.participant-avatar{
  width:26px; height:26px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display); font-weight:700; font-size:11px; color:#04110d;
}
.participant-row .mic-mini{ margin-left:auto; opacity:.55; }
.participant-row .mic-mini svg{ width:12px; height:12px; }

.chat-panel{
  flex:1; min-height:0;
  display:flex; flex-direction:column;
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius: var(--radius-m);
  overflow:hidden;
}
.chat-panel__title{ padding:12px 14px 8px; font-size:12.5px; font-weight:600; color: var(--text-mid); flex-shrink:0; }
.chat-messages{ flex:1; overflow-y:auto; padding:0 14px; display:flex; flex-direction:column; gap:9px; }
.chat-msg{ font-size:12.5px; line-height:1.4; }
.chat-msg b{ color: var(--accent); font-weight:600; }
.chat-msg span{ color: var(--text-mid); }
.chat-input{ display:flex; gap:8px; padding:10px 12px; border-top:1px solid var(--panel-border); flex-shrink:0; }
.chat-input input{
  flex:1; background: rgba(255,255,255,0.04); border:1px solid var(--panel-border);
  color:var(--text-hi); border-radius:999px; padding:8px 14px; font-size:12.5px;
}
.chat-input input:focus{ outline:none; border-color: var(--accent); }
.chat-input button{
  width:32px; height:32px; border-radius:50%; border:none;
  background: var(--accent); color:#052620; display:flex; align-items:center; justify-content:center; cursor:pointer;
  flex-shrink:0;
}
.chat-input button svg{ width:14px; height:14px; }

/* hide sidepanel gracefully when narrow, toggled via JS class */
.sidepanel.hidden{ display:none; }
.app.chat-collapsed .layout{ grid-template-columns: 1fr; }
.app.chat-collapsed .sidepanel{ display:none; }

/* ==========================================================================
   Settings drawer
   ========================================================================== */
.drawer-backdrop{
  position:fixed; inset:0; background: rgba(3,4,6,0.55);
  backdrop-filter: blur(2px);
  opacity:0; pointer-events:none; transition: opacity .25s var(--ease); z-index:20;
}
.drawer-backdrop.show{ opacity:1; pointer-events:auto; }

.settings-drawer{
  position:fixed; top:0; right:0; bottom:0; width:340px;
  background: rgba(11,13,18,0.96);
  border-left:1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  z-index:21;
  transform: translateX(100%);
  transition: transform .32s var(--ease);
  padding:20px 22px; overflow-y:auto;
}
.settings-drawer.show{ transform: translateX(0); }
.settings-drawer__header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.settings-drawer__header h3{ font-family: var(--font-display); margin:0; font-size:17px; }
.settings-drawer__header button{ background:none; border:none; color:var(--text-mid); font-size:20px; cursor:pointer; }
.settings-section{ margin-bottom:22px; }
.settings-section h4{ font-size:11.5px; text-transform:uppercase; letter-spacing:0.06em; color: var(--text-low); margin:0 0 10px; font-weight:600; }
.settings-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 0; font-size:13px; color: var(--text-mid); }
.settings-row select{
  background: rgba(255,255,255,0.05); color: var(--text-hi); border:1px solid var(--panel-border);
  border-radius:8px; padding:6px 8px; font-size:12.5px; max-width:170px;
}
.settings-row input[type="range"]{ width:130px; accent-color: var(--accent); }
.settings-row input[type="checkbox"]{ width:17px; height:17px; accent-color: var(--accent); }
#permissionText{ font-size:12.5px; color: var(--text-low); line-height:1.5; }

/* ==========================================================================
   Help panel
   ========================================================================== */
.help-fab{
  position:fixed; bottom:20px; right:20px; z-index:15;
  width:42px; height:42px; border-radius:50%;
  background: var(--panel-strong); border:1px solid var(--panel-border);
  color: var(--text-hi); font-family: var(--font-display); font-weight:700; font-size:16px;
  cursor:pointer; backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.help-panel{
  position:fixed; bottom:72px; right:20px; z-index:15;
  width:320px; max-height:65vh; overflow-y:auto;
  background: rgba(11,13,18,0.95); border:1px solid var(--panel-border);
  border-radius: var(--radius-m); padding:16px 18px;
  backdrop-filter: blur(18px);
  transform: translateY(12px) scale(.97); opacity:0; pointer-events:none;
  transition: all .22s var(--ease);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}
.help-panel.show{ opacity:1; transform: translateY(0) scale(1); pointer-events:auto; }
.help-panel__header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.help-panel__header h3{ margin:0; font-family: var(--font-display); font-size:15px; }
.help-panel__header button{ background:none; border:none; color:var(--text-mid); font-size:18px; cursor:pointer; }
.help-panel__section{ margin-bottom:14px; font-size:12.5px; color: var(--text-mid); }
.help-panel__section strong{ color: var(--text-hi); display:block; margin-bottom:6px; font-size:12.5px; }
.help-panel__section ul{ margin:0; padding-left:18px; line-height:1.7; }

/* ==========================================================================
   Fullscreen mode
   ========================================================================== */
.app.is-fullscreen .topbar,
.app.is-fullscreen .sidepanel,
.app.is-fullscreen .controlbar{ display:none; }
.app.is-fullscreen .layout{ grid-template-columns: 1fr; }
.app.is-fullscreen .stage{ border-radius:0; }
.app.is-fullscreen .slide-viewport{ margin:0; border-radius:0; }
.app.is-fullscreen .indicators{ top:20px; left:20px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .sidepanel{ flex-direction:row; overflow-x:auto; }
  .self-view{ width:200px; flex-shrink:0; }
  .participants{ width:200px; flex-shrink:0; }
  .chat-panel{ width:260px; flex-shrink:0; }
  .ctrl__label{ display:none; }
}
@media (max-width: 620px){
  .brand-tag{ display:none; }
  .topbar__actions span{ display:none; }
  .definition-popup{ left:12px; right:12px; width:auto; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
