/* AYNURSYNC v5 - PROFESSIONAL iPHONE QUALITY */
:root {
  --bg: #000000;
  --surface: #0c0c0c;
  --surface-elevated: #141414;
  --surface-hover: #1a1a1a;
  --border: rgba(255,255,255,0.06);
  --border-active: rgba(0,200,80,0.3);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.6);
  --text-tertiary: rgba(255,255,255,0.35);
  --accent: #00c853;
  --accent-dim: rgba(0,200,83,0.15);
  --accent-glow: rgba(0,200,83,0.2);
  --danger: #ff453a;
  --warning: #ff9f0a;
  --vip: #0a84ff;
  --vip-glow: rgba(10,132,255,0.4);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* { 
  margin: 0; padding: 0; box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* 60/120fps smooth animations */
* { 
  will-change: auto;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Dynamic background */
body::before {
  content: ''; position: fixed; inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,200,83,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(10,132,255,0.04) 0%, transparent 50%),
    var(--bg);
  z-index: -2;
}

body::after {
  content: ''; position: fixed; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.015'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  z-index: -1;
  opacity: 0.5;
}

/* ============== LOADING ============== */
#loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
#loading-overlay.hidden { 
  opacity: 0; 
  pointer-events: none;
}

.loader-ring {
  width: 48px; height: 48px;
  position: relative;
}
.loader-ring::before {
  content: ''; position: absolute; inset: 0;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  margin-top: 24px;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 500;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ============== AUTH ============== */
#auth-section {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.auth-box {
  width: 100%; max-width: 380px;
  animation: fadeSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Logo Animation */
.auth-logo {
  width: 72px; height: 72px;
  margin: 0 auto 20px;
  position: relative;
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-logo svg {
  width: 100%; height: 100%;
  fill: none; stroke: var(--text-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 20px rgba(0,200,83,0.3));
}

.auth-title {
  font-size: 2rem; font-weight: 800;
  letter-spacing: -1px;
  text-align: center;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #fff 30%, var(--accent) 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease-in-out infinite;
  background-size: 200% 200%;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.auth-subtitle {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 5px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 40px;
  font-weight: 500;
}

/* Toggle Switch */
.auth-toggle {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 4px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  position: relative;
}

.auth-toggle-btn {
  flex: 1; padding: 14px;
  background: transparent; border: none;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-xl);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 2;
}

.auth-toggle-btn.active {
  background: linear-gradient(135deg, var(--accent), #00a844);
  color: #fff;
  box-shadow: 0 4px 24px rgba(0,200,83,0.35);
}

/* Forms */
.auth-form { display: none; flex-direction: column; gap: 20px; }
.auth-form.active { display: flex; animation: fadeSlideUp 0.4s ease; }

.input-wrap { text-align: left; }
.input-label {
  display: block; font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  font-weight: 600;
}

.input-field {
  display: flex; align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.input-field:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 0 4px var(--accent-dim), 0 0 20px var(--accent-glow);
  background: var(--surface-elevated);
}

.input-field .icon {
  font-size: 1.1rem; margin-right: 14px;
  opacity: 0.4;
  transition: opacity 0.2s;
}
.input-field:focus-within .icon { opacity: 0.8; }

.input-field input {
  flex: 1; background: transparent; border: none;
  color: var(--text-primary); font-size: 1rem;
  outline: none; font-family: inherit;
}
.input-field input::placeholder { color: var(--text-tertiary); }

.input-field .eye-btn {
  background: none; border: none;
  color: var(--text-tertiary);
  cursor: pointer; font-size: 1.1rem;
  padding: 0 4px; transition: color 0.2s;
}
.input-field .eye-btn:hover { color: var(--text-secondary); }

.input-hint {
  font-size: 0.7rem; color: var(--text-tertiary);
  margin-top: 8px; padding-left: 4px;
}

/* Checkbox */
.check-row {
  display: flex; align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.check-row label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.check-row input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: var(--accent);
  border-radius: 6px;
}
.check-row a { 
  color: var(--accent); text-decoration: none; 
  font-weight: 500; transition: opacity 0.2s;
}
.check-row a:hover { opacity: 0.8; }

/* Main Button */
.main-btn {
  width: 100%; padding: 18px;
  background: linear-gradient(135deg, var(--accent), #00a844);
  border: none; border-radius: var(--radius-md);
  color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer; letter-spacing: 0.5px;
  box-shadow: 0 4px 24px rgba(0,200,83,0.3);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative; overflow: hidden;
}
.main-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,200,83,0.4);
}
.main-btn:active { transform: scale(0.97); }
.main-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.main-btn:hover::after { transform: translateX(100%); }

/* Divider */
.divider {
  display: flex; align-items: center; gap: 16px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* Guest Button */
.guest-btn {
  width: 100%; padding: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.guest-btn:hover {
  border-color: var(--border-active);
  background: var(--surface-elevated);
  color: var(--text-primary);
}

/* ============== HOME ============== */
#home-section {
  display: none; min-height: 100vh;
  padding: 16px 16px 100px;
  max-width: 900px; margin: 0 auto;
}
#home-section.active { display: block; animation: fadeSlideUp 0.4s ease; }

.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding: 8px 0;
}

.user-pill {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.user-pill:hover {
  background: var(--surface-elevated);
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00a844);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #000; font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0,200,83,0.3);
}

.user-name { font-weight: 600; font-size: 0.95rem; }

.vip-badge {
  display: inline-block; margin-left: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--vip), #0066ff);
  box-shadow: 0 0 10px var(--vip-glow);
  animation: vipPulse 2s ease-in-out infinite alternate;
  vertical-align: middle; position: relative;
}
@keyframes vipPulse {
  from { box-shadow: 0 0 5px var(--vip-glow); }
  to { box-shadow: 0 0 15px var(--vip-glow), 0 0 25px rgba(10,132,255,0.2); }
}
.vip-badge::after {
  content: '✓'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #fff; font-weight: 900;
}

/* Action Row */
.action-row {
  display: flex; gap: 10px; margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1; min-width: 200px; position: relative;
}
.search-box input {
  width: 100%; padding: 14px 16px 14px 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary); outline: none;
  font-size: 0.9rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.search-box input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface-elevated);
}
.search-box::before {
  content: '🔍'; position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%);
  opacity: 0.4; font-size: 0.9rem;
}

.btn {
  padding: 14px 20px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-active);
  transform: translateY(-1px);
}
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #00a844);
  border: none; color: #fff;
  box-shadow: 0 4px 20px rgba(0,200,83,0.25);
}
.btn.primary:hover {
  box-shadow: 0 6px 28px rgba(0,200,83,0.4);
  transform: translateY(-2px);
}

/* Invite Bar */
.invite-bar {
  display: flex; gap: 10px; margin-bottom: 24px;
}
.invite-bar input {
  flex: 1; padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem; font-weight: 700;
  letter-spacing: 4px; text-transform: uppercase;
  text-align: center; outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.invite-bar input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Section Title */
.sec-title {
  font-size: 0.85rem; font-weight: 700;
  color: var(--accent);
  margin: 28px 0 12px;
  display: flex; align-items: center; gap: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Room Grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.room-card {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.room-card::before {
  content: ''; position: absolute; left: 0; top: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0; transition: opacity 0.3s;
}
.room-card:hover::before { opacity: 1; }
.room-card:hover {
  border-color: var(--border-active);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 20px var(--accent-glow);
  background: var(--surface-elevated);
}
.room-card.locked { border-color: rgba(255,159,10,0.2); }
.room-card.locked::after {
  content: '🔒'; position: absolute; top: 16px; right: 16px;
  font-size: 0.9rem; opacity: 0.6;
}

.room-card-name { 
  font-weight: 700; font-size: 1.05rem; 
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.room-card-meta {
  font-size: 0.75rem; color: var(--text-tertiary);
  display: flex; gap: 12px; align-items: center;
}
.room-card-host { color: var(--accent); font-weight: 600; }
.room-card-count {
  background: var(--accent-dim); color: var(--accent);
  padding: 3px 10px; border-radius: 8px;
  font-weight: 600; font-size: 0.7rem;
}

.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-tertiary);
  grid-column: 1 / -1;
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.3; }

/* Groq Card */
.groq-card {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

/* ============== ROOM / WATCH ============== */
#room-section {
  display: none; height: 100vh;
  flex-direction: column;
  background: #000;
}
#room-section.active { display: flex; }

/* Room Header */
.room-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: rgba(12,12,12,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(180%);
  flex-shrink: 0;
  z-index: 10;
}
.room-head-title {
  font-weight: 700; color: var(--accent);
  font-size: 0.95rem;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.room-head-code {
  font-size: 0.7rem; color: var(--accent);
  font-weight: 700; letter-spacing: 1.5px;
  background: var(--accent-dim);
  padding: 6px 12px; border-radius: 10px;
}
.room-head-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-btn:hover {
  background: var(--surface-elevated);
  border-color: var(--border-active);
  color: var(--accent);
  transform: scale(1.05);
}
.icon-btn:active { transform: scale(0.95); }

/* Video Area */
.video-area {
  flex: 1; position: relative;
  background: #000;
  display: flex;
  align-items: center; justify-content: center;
  overflow: hidden;
  min-height: 0;
}
#yt-player, #raw-player {
  width: 100%; height: 100%;
  border: none; object-fit: contain;
}

.video-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 10;
  transition: opacity 0.4s ease;
}
.video-overlay.hidden { opacity: 0; pointer-events: none; }

.video-overlay-icon { 
  font-size: 3.5rem; margin-bottom: 16px; 
  opacity: 0.3; animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.video-overlay-text { 
  color: var(--text-tertiary); font-size: 0.95rem; 
  margin-bottom: 12px; font-weight: 500;
}
.video-overlay-hint { 
  font-size: 0.8rem; color: var(--accent);
  font-weight: 600;
  animation: pulse 2s ease-in-out infinite;
}

/* Video Controls */
.vid-controls {
  display: flex; gap: 10px; padding: 12px 16px;
  background: rgba(12,12,12,0.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px);
  align-items: center; flex-wrap: wrap;
  flex-shrink: 0;
}
.vid-controls .btn { padding: 10px 16px; font-size: 0.8rem; }

/* Source Selector (YouTube/Raw) */
.source-selector {
  display: flex; gap: 8px; padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.source-btn {
  flex: 1; padding: 12px;
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}
.source-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.source-btn:hover:not(.active) {
  border-color: var(--border-active);
  color: var(--text-primary);
}

/* Chat Panel */
.chat-panel {
  height: 300px;
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chat-msgs {
  flex: 1; overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
.chat-msgs::-webkit-scrollbar { width: 4px; }
.chat-msgs::-webkit-scrollbar-thumb { 
  background: var(--border); border-radius: 2px; 
}
.chat-msgs::-webkit-scrollbar-track { background: transparent; }

.msg {
  display: flex; gap: 10px; align-items: flex-start;
  animation: msgSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 85%;
}
.msg.own { align-self: flex-end; flex-direction: row-reverse; }
@keyframes msgSlide {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msg-av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #00a844);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.75rem; color: #000;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,200,83,0.2);
}

.msg-body { flex: 1; min-width: 0; }
.msg-head {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 4px;
}
.msg-auth { 
  font-weight: 700; font-size: 0.8rem; 
  color: var(--accent); 
}
.msg-auth.vip { color: var(--vip); }
.msg-time { font-size: 0.65rem; color: var(--text-tertiary); }

.msg-txt {
  font-size: 0.88rem; line-height: 1.5;
  word-break: break-word;
  color: var(--text-primary);
  background: var(--surface-elevated);
  padding: 10px 14px;
  border-radius: 16px;
  border-top-left-radius: 4px;
  display: inline-block;
  transition: transform 0.2s;
}
.msg:hover .msg-txt { transform: scale(1.01); }

.msg.own .msg-txt {
  background: var(--accent-dim);
  border-top-left-radius: 16px;
  border-top-right-radius: 4px;
}

.msg-txt.heart { 
  font-size: 2rem; background: transparent; padding: 0;
  animation: heartBeat 1s ease-in-out;
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.2); }
  50% { transform: scale(1); }
  75% { transform: scale(1.15); }
}

.msg-txt.love {
  font-size: 1rem; color: #ff375f;
  font-weight: 700;
  background: rgba(255,55,95,0.1);
  text-shadow: 0 0 20px rgba(255,55,95,0.3);
}

/* Chat Input */
.chat-input-wrap {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
}
.chat-input-wrap input {
  flex: 1; padding: 12px 16px;
  background: var(--surface-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  color: var(--text-primary); outline: none;
  font-size: 0.9rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-input-wrap input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.chat-actions { display: flex; gap: 6px; }

/* Floating Effects */
.float-heart {
  position: fixed; pointer-events: none;
  font-size: 2rem; z-index: 9999;
  animation: floatUp 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  filter: drop-shadow(0 0 10px rgba(255,55,95,0.5));
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-250px) scale(1.5) rotate(15deg); opacity: 0; }
}

.love-burst {
  position: fixed; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  z-index: 9998;
}
.love-burst-txt {
  font-size: 2.8rem; font-weight: 900;
  color: #ff375f;
  text-shadow: 0 0 40px rgba(255,55,95,0.5), 0 0 80px rgba(255,55,95,0.3);
  animation: burst 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes burst {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  20% { transform: scale(1.15) rotate(5deg); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ============== MODALS ============== */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(16px) saturate(180%);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-bg.on { display: flex; opacity: 1; }

.modal-box {
  width: 100%; max-width: 460px; max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-bg.on .modal-box {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  transition: all 0.2s;
}
.modal-close:hover { 
  color: var(--danger); 
  border-color: rgba(255,69,58,0.3);
  transform: rotate(90deg);
}

.modal-title {
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 24px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.modal-body { display: flex; flex-direction: column; gap: 16px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 24px;
}

/* Legal */
.legal-txt {
  font-size: 0.82rem; line-height: 1.7;
  color: var(--text-secondary);
  max-height: 55vh; overflow-y: auto;
  padding-right: 8px;
}
.legal-txt h4 { 
  color: var(--accent); margin: 18px 0 8px; 
  font-size: 0.95rem; font-weight: 700;
}
.legal-txt p { margin-bottom: 10px; }
.legal-txt ul { margin-left: 20px; margin-bottom: 10px; }
.legal-txt li { margin-bottom: 4px; }

/* Instagram Devs */
.dev-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.dev-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 10px; border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none; color: inherit;
}
.dev-card:hover {
  border-color: var(--border-active);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}
.dev-ig {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(220,39,67,0.3);
  transition: transform 0.3s;
}
.dev-card:hover .dev-ig { transform: scale(1.1) rotate(-5deg); }
.dev-n { font-weight: 700; font-size: 0.85rem; }
.dev-h { font-size: 0.75rem; color: var(--accent); font-weight: 500; }

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 8px;
  background: none; border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.nav-item.on { color: var(--accent); }
.nav-item.on::after {
  content: ''; position: absolute; bottom: 2px;
  width: 20px; height: 3px; border-radius: 2px;
  background: var(--accent);
}
.nav-item.on .nav-ico { 
  filter: drop-shadow(0 0 6px var(--accent-glow));
  transform: scale(1.1);
}
.nav-ico { 
  font-size: 1.3rem; 
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Footer */
.app-foot {
  text-align: center; padding: 30px 20px 100px;
  color: var(--text-tertiary); font-size: 0.72rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.app-foot a { 
  color: var(--accent); text-decoration: none; 
  font-weight: 500; transition: opacity 0.2s;
}
.app-foot a:hover { opacity: 0.8; }

/* Toast */
.toast-box {
  position: fixed; top: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10000;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.88rem; font-weight: 500;
  animation: toastSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
}
.toast.ok { border-color: rgba(0,200,83,0.4); color: var(--accent); }
.toast.err { border-color: rgba(255,69,58,0.4); color: var(--danger); }
.toast.warn { border-color: rgba(255,159,10,0.4); color: var(--warning); }
@keyframes toastSlide {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

/* ============== RESPONSIVE ============== */
@media (orientation: landscape) and (max-height: 500px) {
  #room-section { flex-direction: row; }
  .video-area { flex: 2; height: 100vh; }
  .side-panel { flex: 1; display: flex; flex-direction: column; height: 100vh; border-left: 1px solid var(--border); }
  .chat-panel { flex: 1; height: auto; }
  .vid-controls { padding: 8px 12px; }
  .vid-controls .btn { padding: 8px 12px; font-size: 0.7rem; }
  .source-selector { padding: 8px 12px; }
}

@media (max-width: 600px) {
  .auth-title { font-size: 1.6rem; }
  .room-grid { grid-template-columns: 1fr; }
  .dev-grid { grid-template-columns: 1fr; }
  .chat-panel { height: 260px; }
  .room-head-title { max-width: 120px; }
}

@media (max-width: 380px) {
  .auth-box { padding: 0 8px; }
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Selection */
::selection { background: var(--accent-dim); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
