:root {
  --bg-main: #0b0f19;
  --bg-card: #151c2e;
  --bg-card-hover: #1e293b;
  --bg-dark: #070a10;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --cyan: #06b6d4;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(21, 28, 46, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-main);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Buttons & Inputs */
.input-group { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 12px; }
.input-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.text-input { width: 100%; background: var(--bg-dark); border: 1px solid var(--border); color: var(--text); padding: 12px 16px; border-radius: 12px; font-size: 0.95rem; outline: none; transition: all 0.2s ease; }
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

select.text-input { cursor: pointer; }

.btn { background: var(--bg-card-hover); color: var(--text); border: 1px solid var(--border); padding: 12px 20px; border-radius: 12px; font-weight: 600; cursor: pointer; font-size: 0.95rem; transition: all 0.2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--border); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border: none; color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 8px 20px var(--accent-glow); }
.btn-secondary { background: var(--bg-card); }
.btn-pro { background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); color: white; border: none; font-weight: 700; }
.btn-pro:hover { opacity: 0.95; box-shadow: 0 8px 25px rgba(168, 85, 247, 0.35); }
.btn-danger { background: var(--danger) !important; border: none !important; color: white !important; }
.btn-danger:hover { background: var(--danger-hover) !important; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 8px; }

.link-btn { background: none; border: none; color: var(--cyan); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.link-btn:hover { text-decoration: underline; opacity: 0.8; }

/* Rich Landing Page */
#landing-page { position: absolute; inset: 0; z-index: 1000; overflow-y: auto; background: var(--bg-main); display: flex; flex-direction: column; }
.hero-section { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 20px; background: radial-gradient(circle at top center, #1e1b4b 0%, #0b0f19 70%); position: relative; }

.hero-content-wrapper { max-width: 1100px; width: 100%; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
@media(max-width: 850px) { .hero-content-wrapper { grid-template-columns: 1fr; text-align: center; } }

.hero-intro { display: flex; flex-direction: column; gap: 16px; }
.hero-intro h1 { font-size: 2.8rem; font-weight: 800; line-height: 1.15; }
.hero-intro h1 span { background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-intro p { font-size: 1.05rem; color: var(--text-muted); line-height: 1.6; }

.hero-highlights { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
@media(max-width: 850px) { .hero-highlights { justify-content: center; } }
.highlight-pill { background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(99, 102, 241, 0.3); color: #818cf8; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }

.lobby-card { background: var(--glass); backdrop-filter: blur(16px); border: 1px solid var(--border); padding: 36px 32px; border-radius: 28px; width: 100%; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.brand-badge { align-self: center; background: rgba(99, 102, 241, 0.15); color: var(--accent); border: 1px solid rgba(99, 102, 241, 0.3); padding: 4px 14px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

/* Sub-forms & Panels */
.view-panel { display: none; flex-direction: column; gap: 12px; animation: fadeIn 0.3s ease; }
.view-panel.active { display: flex; }
.sub-form { display: none; flex-direction: column; gap: 10px; }
.sub-form.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.form-switch-row { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.auth-divider { display: flex; align-items: center; text-align: center; color: var(--text-muted); font-size: 0.75rem; margin: 2px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.auth-divider::before { margin-right: 10px; }
.auth-divider::after { margin-left: 10px; }

.action-split { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: var(--bg-dark); padding: 14px; border-radius: 16px; border: 1px solid var(--border); }
.action-box { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.action-box h3 { font-size: 0.95rem; }
.action-box p { font-size: 0.7rem; color: var(--text-muted); }
.divider { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.7rem; font-weight: 700; position: relative; height: 100%; }
.divider::before, .divider::after { content: ''; width: 1px; height: 35px; background: var(--border); }

.scroll-down { position: absolute; bottom: 20px; text-align: center; color: var(--text-muted); text-decoration: none; font-size: 0.85rem; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: color 0.2s; }
.scroll-down:hover { color: var(--text); }
.scroll-down svg { animation: bounce 2s infinite; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-8px); } 60% { transform: translateY(-4px); } }

/* Info Section */
.info-section { background: var(--bg-dark); border-top: 1px solid var(--border); padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 60px; }
.info-nav { display: flex; gap: 24px; background: var(--glass); padding: 12px 30px; border-radius: 30px; border: 1px solid var(--border); backdrop-filter: blur(10px); position: sticky; top: 20px; z-index: 100; }
.info-nav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem; transition: color 0.2s; }
.info-nav a:hover { color: var(--accent); }
.info-container { max-width: 900px; width: 100%; display: flex; flex-direction: column; gap: 80px; }
.info-block h2 { font-size: 2rem; margin-bottom: 20px; color: var(--text); }
.info-block p { font-size: 1.05rem; color: var(--text-muted); line-height: 1.6; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 30px; }
.card { background: var(--bg-card); border: 1px solid var(--border); padding: 24px; border-radius: 20px; transition: transform 0.2s; display: flex; flex-direction: column; gap: 12px; }
.card:hover { transform: translateY(-5px); border-color: var(--accent); }
.card h3 { font-size: 1.1rem; color: white; }
footer { text-align: center; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); padding-top: 30px; width: 100%; max-width: 900px; }

/* App Container */
#app-container { display: none; flex-direction: column; height: 100vh; width: 100vw; }
header { height: 64px; background: var(--glass); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; z-index: 10; }
.brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.logo-icon { background: var(--accent); color: white; width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.mode-pill { background: rgba(99, 102, 241, 0.2); color: #818cf8; padding: 3px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }

.room-badge { background: var(--bg-dark); border: 1px solid var(--border); padding: 6px 16px; border-radius: 30px; font-size: 0.85rem; display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.room-badge strong { color: var(--text); }

.main-workspace { display: flex; flex: 1; height: calc(100vh - 134px); overflow: hidden; position: relative; }
@media(max-width: 768px) {
  .main-workspace { flex-direction: column; }
  .side-panel { width: 100% !important; height: 45vh; border-left: none; border-top: 1px solid var(--border); }
}

.workspace-center { flex: 1; position: relative; display: flex; flex-direction: column; background: var(--bg-dark); overflow: hidden; }

/* Grid Layout & Screen Sharing Multi-Viewer Integration */
.video-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; padding: 20px; align-content: center; justify-content: center; overflow-y: auto; width: 100%; height: 100%; }
.video-box { position: relative; background: var(--bg-card); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); display: flex; justify-content: center; align-items: center; min-height: 200px; aspect-ratio: 16/9; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); transition: all 0.2s; }
.video-box.screen-share-view { border-color: var(--cyan); box-shadow: 0 0 25px rgba(6, 182, 212, 0.3); }
video { width: 100%; height: 100%; object-fit: cover; }
.local-mirrored { transform: scaleX(-1); }
.video-label { position: absolute; bottom: 12px; left: 12px; background: rgba(11, 15, 25, 0.75); backdrop-filter: blur(8px); padding: 6px 12px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 10px var(--success); }

/* Pro Whiteboard Canvas Workspace */
.whiteboard-wrapper { position: absolute; inset: 0; background: var(--bg-dark); display: none; flex-direction: column; z-index: 50; }
.whiteboard-wrapper.active { display: flex; }
.wb-toolbar { height: 50px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; font-weight: 600; font-size: 0.9rem; }
.wb-tools { display: flex; gap: 10px; align-items: center; }
#whiteboard-canvas { flex: 1; background: #0f172a; cursor: crosshair; touch-action: none; width: 100%; height: 100%; }

/* 3D Workspace Demo Workspace */
.workspace-3d-wrapper { position: absolute; inset: 0; background: #05050a; display: none; flex-direction: column; z-index: 50; }
.workspace-3d-wrapper.active { display: flex; }
.spatial-canvas-demo { flex: 1; display: flex; justify-content: center; align-items: center; gap: 30px; perspective: 1000px; }
.spatial-object { width: 160px; height: 160px; background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(6, 182, 212, 0.3)); border: 2px solid var(--accent); border-radius: 16px; display: flex; justify-content: center; align-items: center; font-weight: 700; color: white; box-shadow: 0 20px 40px rgba(0,0,0,0.5); animation: float3d 4s ease-in-out infinite alternate; }
.spatial-object.obj-2 { animation-delay: 1.3s; border-color: var(--cyan); }
.spatial-object.obj-3 { animation-delay: 2.6s; border-color: #a855f7; }
@keyframes float3d { from { transform: translateY(-15px) rotateX(10deg) rotateY(-10deg); } to { transform: translateY(15px) rotateX(-10deg) rotateY(10deg); } }

/* Side Panel */
.side-panel { width: 360px; background: var(--bg-card); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.panel-tabs { display: flex; background: var(--bg-dark); border-bottom: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 14px 10px; background: none; border: none; color: var(--text-muted); font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--bg-card); }
.tab-content { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.tab-content.active { display: flex; }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { background: var(--bg-dark); padding: 10px 14px; border-radius: 12px; font-size: 0.85rem; line-height: 1.4; border: 1px solid var(--border); max-width: 88%; word-break: break-word; }
.chat-msg.self { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.3); align-self: flex-end; }
.chat-msg.system { color: var(--text-muted); text-align: center; align-self: center; font-size: 0.75rem; background: transparent; border: none; }
.chat-file-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(6, 182, 212, 0.15); border: 1px solid var(--cyan); padding: 4px 10px; border-radius: 8px; font-size: 0.8rem; margin-top: 4px; color: var(--cyan); text-decoration: none; }
.chat-input-bar { padding: 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: var(--bg-card); align-items: center; }

.participants-list { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.participant-item { display: flex; align-items: center; gap: 10px; background: var(--bg-dark); padding: 10px 14px; border-radius: 10px; font-size: 0.85rem; border: 1px solid var(--border); }

/* Pro Effects Panel */
.fx-panel-inner { padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.fx-panel-inner h4 { font-size: 1rem; color: #a855f7; }
.fx-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.fx-group { display: flex; flex-direction: column; gap: 8px; }
.fx-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.fx-buttons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reactions-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* Bottom Control Bar */
.control-bar { height: 70px; background: var(--glass); backdrop-filter: blur(12px); border-top: 1px solid var(--border); display: flex; justify-content: center; align-items: center; gap: 16px; }
.control-btn { background: var(--bg-dark); border: 1px solid var(--border); color: var(--text); width: 48px; height: 48px; border-radius: 16px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s; font-size: 1.2rem; }
.control-btn:hover { background: var(--bg-card-hover); transform: translateY(-2px); }
.control-btn.active-off { background: var(--danger) !important; border-color: var(--danger) !important; color: white !important; }

/* Floating Emoji Reactions Layer */
#floating-reactions-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 100; }
.floating-emoji { position: absolute; bottom: 80px; left: 50px; font-size: 2rem; animation: floatUpEmoji 3s ease-out forwards; }
@keyframes floatUpEmoji { 0% { transform: translateY(0) scale(0.5); opacity: 1; } 100% { transform: translateY(-400px) scale(1.4); opacity: 0; } }

/* Virtual Background FX Classes */
video.bg-blur { filter: blur(8px); }
video.bg-cyber { filter: hue-rotate(90deg) contrast(150%); }
video.bg-studio { filter: brightness(90%) saturate(120%); }

/* Shopify Pro Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(12px); z-index: 2000; display: none; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal-card { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: 28px; width: 100%; max-width: 480px; padding: 36px; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8); display: flex; flex-direction: column; gap: 24px; max-height: 90vh; }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.modal-close:hover { color: white; }
.pro-header { text-align: center; }
.pro-badge { background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); color: white; font-size: 0.7rem; font-weight: 800; padding: 4px 12px; border-radius: 12px; letter-spacing: 0.1em; }
.pro-header h2 { font-size: 1.5rem; margin-top: 10px; margin-bottom: 8px; }
.pro-header p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

.pro-features { display: flex; flex-direction: column; gap: 12px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.feature-item { display: flex; align-items: flex-start; gap: 14px; background: var(--bg-dark); padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); }
.feature-icon { font-size: 1.2rem; }
.feature-item strong { display: block; font-size: 0.85rem; margin-bottom: 2px; }
.feature-item p { font-size: 0.75rem; color: var(--text-muted); line-height: 1.3; }

.pro-pricing { text-align: center; border-top: 1px solid var(--border); padding-top: 16px; }
.price-tag { font-size: 2.2rem; font-weight: 800; }
.price-tag span { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; }
.price-subtext { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--success); color: white; padding: 12px 24px; border-radius: 30px; font-weight: 600; font-size: 0.9rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4); transition: all 0.3s ease; z-index: 3000; opacity: 0; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
