/* ════════════════════════════════════════════
   SYNAPSE — VISUAL SYSTEM
   ════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg-deep: #030308;
  --accent: #00e5ff;
  --accent2: #ff00aa;
  --accent3: #7c4dff;
  --glass: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.06);
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* Default cursor visible on landing */
  cursor: default;
}

/* Custom cursor for in-room experience */
body.in-room {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='4' fill='%2300e5ff' opacity='0.9'/%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='%2300e5ff' stroke-width='1' opacity='0.4'/%3E%3C/svg%3E") 10 10, crosshair;
}

/* ---- Layered Background Canvas ---- */
#bg-canvas {
  position: fixed; inset: 0;
  z-index: 0;
}

/* ---- Main Rendering Canvas ---- */
#fx-canvas {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ---- Audio Visualizer Canvas (bottom) ---- */
#viz-canvas {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 200px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
#viz-canvas.active { opacity: 1; }

/* ---- Scanline / Grain Overlay ---- */
#overlay-fx {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.015) 2px, rgba(0,0,0,0.015) 4px);
  mix-blend-mode: multiply;
}

/* ---- Vignette ---- */
#vignette {
  position: fixed; inset: 0; z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, rgba(0,0,0,0.6) 100%);
}

/* ════════════════════════════════════════════
   LANDING SCREEN
   ════════════════════════════════════════════ */
#landing {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 50%, rgba(0,229,255,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 80% 20%, rgba(124,77,255,0.05) 0%, transparent 50%),
    rgba(3,3,8,0.97);
  backdrop-filter: blur(30px);
  transition: opacity 0.9s cubic-bezier(0.22,1,0.36,1), visibility 0.9s;
}
#landing.gone { opacity: 0; visibility: hidden; pointer-events: none; }

.landing-wrap {
  width: 90%; max-width: 520px;
  animation: landIn 0.8s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes landIn {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Animated logo */
.logo-block {
  text-align: center; margin-bottom: 32px;
}
.logo-block h1 {
  font-size: 42px; font-weight: 800;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #fff 20%, var(--accent) 60%, var(--accent3) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.logo-block p {
  font-size: 15px; color: rgba(255,255,255,0.4);
  font-weight: 400; letter-spacing: 0.3px;
}

/* Glass card */
.glass-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 36px 32px;
  backdrop-filter: blur(40px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.02),
    0 20px 60px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* Upload zone */
#dropzone {
  border: 2px dashed rgba(0,229,255,0.15);
  border-radius: 18px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.22,1,0.36,1);
  margin-bottom: 20px;
}
#dropzone:hover, #dropzone.dragover {
  border-color: rgba(0,229,255,0.5);
  background: rgba(0,229,255,0.03);
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0,229,255,0.08);
}
#dropzone.has-file {
  border-color: rgba(0,255,136,0.4);
  background: rgba(0,255,136,0.04);
}
#dropzone .dz-icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px;
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--accent);
  transition: all 0.3s ease;
}
#dropzone:hover .dz-icon {
  background: rgba(0,229,255,0.15);
  transform: scale(1.05);
}
#dropzone .dz-title {
  font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.85);
  margin-bottom: 6px;
}
#dropzone .dz-hint {
  font-size: 12px; color: rgba(255,255,255,0.3);
}
#dropzone .dz-file {
  font-size: 13px; color: #00ff88; font-weight: 500;
  margin-top: 10px; display: none;
}
#dropzone.has-file .dz-file { display: block; }
#dropzone.has-file .dz-title { display: none; }
#dropzone.has-file .dz-hint { display: none; }

/* Animated shimmer on dropzone border */
#dropzone::after {
  content: '';
  position: absolute; inset: -2px; border-radius: 18px;
  padding: 2px;
  background: conic-gradient(from var(--shimmer-angle, 0deg), transparent 0%, rgba(0,229,255,0.3) 10%, transparent 20%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
#dropzone:hover::after, #dropzone.dragover::after { opacity: 1; }

/* Role selector */
.role-row {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.role-row label {
  font-size: 12px; color: rgba(255,255,255,0.4);
  margin-bottom: 6px; display: block;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-row select {
  flex: 1;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  color: #fff; font-size: 14px;
  outline: none;
  transition: all 0.3s;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  font-family: inherit;
}
.role-row select:focus {
  border-color: rgba(0,229,255,0.4);
  background-color: rgba(0,229,255,0.04);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}
.role-row select option {
  background: #111; color: #fff;
}

/* Start button */
#enter-btn {
  width: 100%; padding: 17px;
  border: none; border-radius: 16px;
  background: linear-gradient(135deg, #00a8ff 0%, #00e5ff 50%, #7c4dff 100%);
  background-size: 200% 200%;
  animation: btnGlow 4s ease infinite;
  color: #000; font-size: 16px; font-weight: 700;
  cursor: pointer; position: relative; overflow: hidden;
  transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  opacity: 0.35; pointer-events: none;
  font-family: inherit;
}
#enter-btn.ready { opacity: 1; pointer-events: all; }
#enter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,229,255,0.35), 0 0 80px rgba(0,229,255,0.1);
}
#enter-btn:active { transform: translateY(0) scale(0.97); }
@keyframes btnGlow {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Room input */
.room-row {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.room-row input {
  flex: 1;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  color: #fff; font-size: 14px;
  outline: none;
  transition: all 0.3s;
  font-family: inherit;
}
.room-row input:focus {
  border-color: rgba(0,229,255,0.4);
  background: rgba(0,229,255,0.04);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}
.room-row input::placeholder { color: rgba(255,255,255,0.2); }
.room-row button {
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.room-row button:hover {
  background: rgba(0,229,255,0.1);
  color: var(--accent);
  border-color: rgba(0,229,255,0.3);
}

/* ════════════════════════════════════════════
   IN-GAME HUD
   ════════════════════════════════════════════ */
#hud {
  position: fixed; top: 24px; left: 24px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transform: translateY(-12px);
  transition: all 0.6s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
}
#hud.on { opacity: 1; transform: translateY(0); pointer-events: all; }

.hud-title {
  font-size: 20px; font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Connection status badge */
#conn-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  font-size: 12px; color: rgba(255,255,255,0.5);
  transition: all 0.4s;
}
#conn-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #444;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  transition: all 0.4s;
}
#conn-badge.connected .dot {
  background: #00ff88;
  box-shadow: 0 0 10px #00ff88;
  animation: dotPulse 2s ease-in-out infinite;
}
#conn-badge.connected { color: rgba(255,255,255,0.7); }
@keyframes dotPulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Room ID badge */
#room-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: rgba(0,229,255,0.05);
  border: 1px solid rgba(0,229,255,0.12);
  border-radius: 10px;
  font-size: 11px; color: rgba(0,229,255,0.7);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* User list */
#user-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 4px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  font-size: 12px;
  transition: all 0.3s;
  animation: chipIn 0.4s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes chipIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.user-chip .orb {
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.user-chip .name { font-weight: 600; color: rgba(255,255,255,0.8); }
.user-chip .role-label { color: rgba(255,255,255,0.35); margin-left: auto; font-size: 11px; }
.user-chip .vol-bar {
  width: 40px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.08);
  overflow: hidden; margin-left: 8px;
}
.user-chip .vol-fill {
  height: 100%; border-radius: 2px;
  width: 0%; transition: width 0.15s ease;
}

/* Toast notifications */
#toast-container {
  position: fixed; top: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 14px;
  backdrop-filter: blur(30px);
  font-size: 13px; color: rgba(255,255,255,0.85);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: toastIn 0.4s cubic-bezier(0.22,1,0.36,1), toastOut 0.4s ease 2.6s forwards;
  max-width: 280px;
}
.toast.join { border-left: 3px solid #00ff88; }
.toast.leave { border-left: 3px solid #ff4444; }
.toast.info { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid #ff4444; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px); }
}

/* Bottom hint */
#hint {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 50; pointer-events: none;
  padding: 12px 24px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  font-size: 13px; color: rgba(255,255,255,0.45);
  opacity: 0; transition: opacity 0.8s ease 0.4s;
  text-align: center;
}
#hint.show { opacity: 1; }

/* ════════════════════════════════════════════
   HOW-TO OVERLAY
   ════════════════════════════════════════════ */
#how-to {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,3,8,0.85);
  backdrop-filter: blur(20px);
  opacity: 0; visibility: hidden;
  transition: all 0.5s ease;
}
#how-to.show { opacity: 1; visibility: visible; }
.how-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 24px; padding: 40px;
  max-width: 460px; width: 90%;
  backdrop-filter: blur(40px);
  text-align: center;
}
.how-card h2 {
  font-size: 24px; font-weight: 700; margin-bottom: 8px;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.how-card p { font-size: 14px; color: rgba(255,255,255,0.4); margin-bottom: 28px; }
.steps {
  display: flex; flex-direction: column; gap: 14px;
  margin-bottom: 28px; text-align: left;
}
.step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 14px;
}
.step-num {
  width: 28px; height: 28px; border-radius: 10px;
  background: rgba(0,229,255,0.1); border: 1px solid rgba(0,229,255,0.2);
  color: var(--accent); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-body { font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.5; }
.step-body strong { color: rgba(255,255,255,0.9); }
.how-card .got-it {
  padding: 14px 36px; border-radius: 14px; border: none;
  background: linear-gradient(135deg, #00a8ff, #00e5ff);
  color: #000; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.3s;
  font-family: inherit;
}
.how-card .got-it:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,229,255,0.3);
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

input[type="file"] { display: none; }
