/* =============================================
   SPINTALK — Main Stylesheet
   Design: Dark Cyberpunk / Neon Teal
   ============================================= */

:root {
  --bg-base: #080c14;
  --bg-card: #0e1520;
  --bg-surface: #131d2e;
  --bg-hover: #1a2640;
  --accent: #00e5c4;
  --accent-dim: #00b89e;
  --accent-glow: rgba(0, 229, 196, 0.15);
  --danger: #ff4757;
  --danger-dim: #cc3344;
  --warning: #ffa502;
  --text-primary: #e8f0f8;
  --text-secondary: #7a93b5;
  --text-muted: #3d5473;
  --border: rgba(0, 229, 196, 0.12);
  --border-solid: rgba(255,255,255,0.07);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --font-display: 'Syne', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

[data-theme="light"] {
  --bg-base: #f0f4f8;
  --bg-card: #ffffff;
  --bg-surface: #e8eef6;
  --bg-hover: #dce5f0;
  --text-primary: #0d1b2e;
  --text-secondary: #4a6080;
  --text-muted: #8aa0bc;
  --border: rgba(0, 180, 160, 0.18);
  --border-solid: rgba(0,0,0,0.07);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-display);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── PAGES ─────────────────────────────────── */
.page { display: none; min-height: 100vh; position: relative; }
.page.active { display: block; }

/* ── BACKGROUND GRID ─────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(0,229,196,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,196,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.noise-overlay {
  position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; opacity: 0.4;
}

/* ── HEADER ──────────────────────────────── */
.site-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 48px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.5px;
  display: flex; align-items: center; gap: 2px;
  cursor: pointer;
}
.logo.small { font-size: 20px; }
.logo-spin { color: var(--accent); }
.logo-talk { color: var(--text-primary); }
.logo-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  margin-left: 4px;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.header-nav { display: flex; align-items: center; gap: 16px; }
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--accent); }
.btn-nav {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent); }

/* ── HERO ────────────────────────────────── */
.landing-main {
  position: relative; z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 60px 24px 40px;
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-glow);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 32px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 7vw, 72px);
  line-height: 1.0;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.title-accent {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(0,229,196,0.25);
}

.hero-sub {
  font-size: 18px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 48px;
  line-height: 1.6;
}

/* ── MODE CARDS ──────────────────────────── */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
}
.mode-card::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--accent-glow);
  opacity: 0;
  transition: opacity 0.25s;
}
.mode-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px rgba(0,229,196,0.1);
}
.mode-card:hover::before { opacity: 1; }

.mode-icon { font-size: 32px; position: relative; z-index: 1; }
.mode-name {
  font-size: 22px; font-weight: 800;
  position: relative; z-index: 1;
}
.mode-desc {
  font-size: 13px;
  color: var(--text-secondary);
  position: relative; z-index: 1;
}
.mode-arrow {
  position: absolute; right: 24px; top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
  color: var(--accent);
  opacity: 0;
  transition: all 0.25s;
}
.mode-card:hover .mode-arrow { opacity: 1; right: 20px; }

/* ── INTERESTS ───────────────────────────── */
.interests-section { margin-bottom: 24px; }

.interests-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.tags-input-wrapper {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 48px;
  transition: border-color 0.2s;
}
.tags-input-wrapper:focus-within { border-color: var(--accent); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
}
.tag-remove {
  cursor: pointer; opacity: 0.6;
  transition: opacity 0.15s;
  font-style: normal;
}
.tag-remove:hover { opacity: 1; }

.tag-input {
  background: transparent;
  border: none; outline: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  flex: 1;
  min-width: 120px;
}

.preset-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px;
}
.preset-tag {
  background: transparent;
  border: 1px solid var(--border-solid);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.preset-tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── AGE CONFIRM ─────────────────────────── */
.age-confirm { margin-bottom: 32px; }

.checkbox-label {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}
.checkbox-label a { color: var(--accent); }

.checkbox-label input[type="checkbox"] { display: none; }

.checkbox-custom {
  width: 20px; height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 5px;
  flex-shrink: 0;
  transition: all 0.18s;
  position: relative;
}
.checkbox-label input:checked + .checkbox-custom {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-label input:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--bg-base);
  font-size: 12px;
  font-weight: 700;
}

/* ── STATS STRIP ─────────────────────────── */
.stats-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  border-top: 1px solid var(--border-solid);
  padding-top: 32px;
  margin-top: 32px;
}
.stat-item { text-align: center; }
.stat-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}
.stat-divider {
  width: 1px; height: 40px;
  background: var(--border-solid);
}

/* ── FOOTER ──────────────────────────────── */
.site-footer {
  position: relative; z-index: 1;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-solid);
}
.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── CHAT PAGE LAYOUT ────────────────────── */
#chat-page { background: var(--bg-base); }

.chat-layout {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  grid-template-columns: 1fr 380px;
  height: 100vh;
  grid-template-areas:
    "topbar topbar"
    "video chat"
    "actions actions";
}

/* ── CHAT TOPBAR ─────────────────────────── */
.chat-topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-solid);
  gap: 16px;
}

.chat-status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}
.status-dot.searching { background: var(--warning); animation: blink 1s infinite; }
.status-dot.connected { background: var(--accent); }
.status-dot.disconnected { background: var(--danger); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.18s;
}
.btn-icon:hover { border-color: var(--accent); background: var(--accent-glow); }
.btn-icon:disabled { opacity: 0.4; cursor: default; }

.btn-danger-sm {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-danger-sm:hover { background: var(--danger-dim); }

/* ── VIDEO AREA ──────────────────────────── */
.video-area {
  grid-area: video;
  position: relative;
  background: #050810;
  overflow: hidden;
}

.video-wrapper {
  position: absolute; inset: 0;
}
.video-wrapper.remote video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-wrapper.local {
  width: 220px; height: 160px;
  bottom: 16px; left: 16px;
  top: auto; right: auto;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border-solid);
  box-shadow: var(--shadow);
  z-index: 2;
  background: #0a0f1a;
}
.video-wrapper.local video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.local-label {
  position: absolute; bottom: 8px; left: 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: white;
  background: rgba(0,0,0,0.5);
  padding: 2px 8px; border-radius: 4px;
}

.video-controls-float {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px;
}
.btn-float {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.18s;
}
.btn-float:hover { background: rgba(0,229,196,0.2); border-color: var(--accent); }
.btn-float.muted { background: rgba(255,71,87,0.3); border-color: var(--danger); }

/* ── VIDEO PLACEHOLDER ───────────────────── */
.video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #050810;
  gap: 24px;
  z-index: 1;
}
.video-placeholder p {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 1px;
}

/* Searching animation rings */
.searching-animation {
  position: relative;
  width: 80px; height: 80px;
}
.spin-ring {
  position: absolute; inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.4s linear infinite;
}
.spin-ring.delay1 {
  inset: 12px;
  border-top-color: var(--accent-dim);
  animation-delay: -0.3s;
}
.spin-ring.delay2 {
  inset: 24px;
  border-top-color: rgba(0,229,196,0.4);
  animation-delay: -0.6s;
}
@keyframes spin { to { transform: rotate(360deg); } }

.video-info-badge {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-primary);
}
.country-flag { font-size: 18px; }

/* ── CHAT PANEL ──────────────────────────── */
.chat-panel {
  grid-area: chat;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border-left: 1px solid var(--border-solid);
}

.messages-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-solid) transparent;
}

.message {
  max-width: 85%;
  animation: msg-in 0.2s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.message.own { align-self: flex-end; }
.message.stranger { align-self: flex-start; }

.message-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
}
.message.own .message-bubble {
  background: var(--accent);
  color: var(--bg-base);
  border-bottom-right-radius: 4px;
}
.message.stranger .message-bubble {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-solid);
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 4px;
  text-align: right;
}
.message.stranger .message-time { text-align: left; }

.system-msg {
  text-align: center;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 8px 16px;
  background: var(--bg-surface);
  border-radius: 999px;
  align-self: center;
}

.message-input-bar {
  display: flex; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-solid);
}
.msg-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.msg-input:focus { border-color: var(--accent); }
.msg-input::placeholder { color: var(--text-muted); }

.btn-send {
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: 50%;
  width: 42px; height: 42px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.18s;
  display: flex; align-items: center; justify-content: center;
}
.btn-send:hover { background: var(--accent-dim); transform: scale(1.08); }

/* ── ACTION BAR ──────────────────────────── */
.action-bar {
  grid-area: actions;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-solid);
  gap: 16px;
}

.btn-skip {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.3px;
}
.btn-skip:hover { background: var(--accent-dim); transform: translateY(-1px); }

.btn-stop {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-stop:hover { background: var(--danger); color: white; }

.action-center {
  display: flex; align-items: center; gap: 16px;
}
.chat-timer {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 2px;
}

/* ── SETTINGS PANEL ──────────────────────── */
.settings-panel {
  position: fixed;
  right: -360px;
  top: 0; bottom: 0;
  width: 340px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-solid);
  z-index: 100;
  transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex; flex-direction: column;
}
.settings-panel.open { right: 0; }

.settings-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-solid);
}
.settings-header h3 { font-size: 18px; font-weight: 700; }
.settings-header button {
  background: transparent; border: none;
  color: var(--text-secondary); font-size: 18px;
  cursor: pointer;
}

.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }

.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--text-secondary);
}
.setting-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}
.setting-select:focus { border-color: var(--accent); }

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}

.modal-center {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: 20px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  animation: modal-in 0.25s ease;
}
.modal-card.compact { padding: 32px; max-width: 380px; text-align: center; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.modal-card h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.modal-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.modal-icon { font-size: 48px; margin-bottom: 16px; }

.report-form { display: flex; flex-direction: column; gap: 14px; }
.report-form label { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.report-textarea {
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  padding: 12px 14px;
  min-height: 100px;
  resize: vertical;
  outline: none;
}
.report-textarea:focus { border-color: var(--accent); }

.modal-actions { display: flex; gap: 12px; margin-top: 8px; }
.btn-report-submit {
  flex: 1;
  background: var(--danger);
  color: white;
  border: none;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-report-submit:hover { background: var(--danger-dim); }
.btn-cancel {
  flex: 1;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-solid);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--accent); color: var(--accent); }

/* ── TOAST ───────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0,229,196,0.15);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── TEXT-ONLY CHAT ──────────────────────── */
.chat-layout.text-mode {
  grid-template-columns: 1fr;
  grid-template-areas:
    "topbar"
    "chat"
    "actions";
}
.chat-layout.text-mode .video-area { display: none; }
.chat-layout.text-mode .chat-panel {
  border-left: none;
  border-top: none;
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
  .site-header { padding: 16px 20px; }
  .landing-main { padding: 40px 16px 32px; }
  .mode-cards { grid-template-columns: 1fr; }
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "video"
      "chat"
      "actions";
  }
  .video-wrapper.local {
    width: 120px; height: 90px;
  }
  .chat-panel { max-height: 250px; }
  .stats-strip { gap: 16px; }
  .header-nav .nav-link { display: none; }
}

/* ── SCROLLBAR ───────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-solid); border-radius: 2px; }

/* ═══════════════════════════════════════════════
   PROFILE FORM v3.0
══════════════════════════════════════════════════ */

.profile-form {
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.flex-1 { flex: 1; }

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.field-input {
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.field-input:focus { border-color: var(--accent); }
.field-input::placeholder { color: var(--text-muted); }

.divider-line {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-mono);
  position: relative;
  margin: 4px 0;
}
.divider-line::before,
.divider-line::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border-solid);
}
.divider-line::before { left: 0; }
.divider-line::after { right: 0; }

.gender-select,
.age-range-select {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gender-btn,
.age-btn {
  flex: 1;
  min-width: 60px;
  background: var(--bg-surface);
  border: 1px solid var(--border-solid);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.gender-btn:hover,
.age-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gender-btn.active,
.age-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-base);
}

.msg-author {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
  font-family: var(--font-mono);
}
.message.own .msg-author { color: var(--bg-base); opacity: 0.7; text-align: right; }

.btn-start {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent) !important;
  color: var(--bg-base) !important;
  border: none !important;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.3px;
}
.btn-start:hover {
  background: var(--accent-dim) !important;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .field-row { flex-direction: column; gap: 14px; }
  .field-row .field-group { width: 100% !important; }
  .gender-btn, .age-btn { font-size: 12px; padding: 8px 10px; }
}

/* ═══════════════════════════════════════════════
   SPECTATE PAGE
══════════════════════════════════════════════════ */
.spectate-body {
  background: #050810;
  min-height: 100vh;
  font-family: var(--font-display);
  color: var(--text-primary);
}

.spectate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-solid);
}

.spectate-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
}

.spectate-warning {
  color: var(--warning);
  font-size: 13px;
  font-family: var(--font-mono);
  background: rgba(255,165,2,0.08);
  border: 1px solid var(--warning);
  border-radius: 999px;
  padding: 5px 14px;
}

.spectate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 24px;
  min-height: calc(100vh - 70px);
}

.spectate-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.spectate-user-header {
  padding: 14px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-solid);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-nick {
  font-size: 16px;
  font-weight: 700;
}
.user-meta {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.spectate-actions {
  display: flex;
  gap: 6px;
}
.btn-spectate-action {
  background: transparent;
  border: 1px solid var(--border-solid);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-display);
  transition: all 0.18s;
}
.btn-spectate-action:hover { border-color: var(--accent); color: var(--accent); }
.btn-spectate-action.ban { border-color: var(--danger); color: var(--danger); }
.btn-spectate-action.ban:hover { background: var(--danger); color: white; }

.spectate-video-wrap {
  position: relative;
  background: #050810;
  flex: 1;
  min-height: 320px;
}
.spectate-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.spectate-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.spectate-messages {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  padding: 16px;
}

.spectate-msg {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-solid);
  font-size: 13px;
}
.spectate-msg:last-child { border-bottom: none; }
.spectate-msg-nick { color: var(--accent); font-weight: 700; }
.spectate-msg-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-right: 8px;
}

@media (max-width: 900px) {
  .spectate-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   v4.0 — ГОЛОСОВОЙ ЧАТ, 3 РЕЖИМА, УВЕДОМЛЕНИЯ
══════════════════════════════════════════════════ */
.mode-cards { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 768px) { .mode-cards { grid-template-columns: 1fr; } }

.voice-stage { display: none; }
.chat-layout.voice-mode .video-wrapper { display: none; }
.chat-layout.voice-mode .voice-stage {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  background: radial-gradient(circle at 50% 40%, rgba(0,229,196,0.10), transparent 60%), #050810;
  padding: 24px;
}
.voice-peer { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.voice-avatar-wrap { position: relative; width: 160px; height: 160px; display: flex; align-items: center; justify-content: center; }
.voice-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,196,0.35), rgba(0,229,196,0) 70%);
  opacity: 0.25; transition: transform 0.08s linear, opacity 0.08s linear;
}
.voice-avatar {
  position: relative; width: 120px; height: 120px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0077ff);
  color: var(--bg-base); font-size: 52px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 40px rgba(0,229,196,0.25);
}
.voice-stage.searching .voice-avatar { background: var(--bg-surface); color: var(--text-muted); animation: voice-pulse 1.6s ease-in-out infinite; }
@keyframes voice-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(0.94); } }
.voice-name { font-size: 26px; font-weight: 800; color: var(--text-primary); }
.voice-meta { font-size: 14px; color: var(--text-secondary); font-family: var(--font-mono); }
.voice-self { display: flex; align-items: center; gap: 14px; background: var(--bg-card); border: 1px solid var(--border-solid); border-radius: 999px; padding: 10px 12px 10px 20px; }
.voice-self-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.voice-meter { width: 140px; height: 8px; border-radius: 4px; background: var(--bg-surface); overflow: hidden; }
.voice-meter-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.08s linear; }
.voice-mic-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--accent);
  background: var(--accent-glow); font-size: 22px; cursor: pointer; transition: all 0.2s;
}
.voice-mic-btn.muted { border-color: var(--danger); background: rgba(255,71,87,0.25); }

.btn-unmute {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  background: var(--accent); color: var(--bg-base); border: none; border-radius: 999px;
  padding: 14px 26px; font-family: var(--font-display); font-weight: 700; font-size: 16px; cursor: pointer;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.btn-skip:disabled { opacity: 0.6; cursor: default; transform: none; }

.notice-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.notice-overlay .modal-sub { color: var(--text-primary); font-size: 16px; }

@media (max-width: 768px) {
  .chat-layout.voice-mode .video-area { min-height: 330px; }
  .voice-avatar-wrap { width: 120px; height: 120px; }
  .voice-avatar { width: 90px; height: 90px; font-size: 40px; }
  .voice-name { font-size: 20px; }
  .voice-meter { width: 90px; }
}
.toast { opacity: 0; pointer-events: none; transition: transform 0.3s, opacity 0.3s; }
.toast.show { opacity: 1; }

/* ── Чат: адаптация под телефоны (v4.0) ── */
.chat-layout { grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto minmax(0, 1fr) auto; }
.chat-layout.text-mode { grid-template-columns: minmax(0, 1fr); }
.msg-input { min-width: 0; }
.chat-status-pill { min-width: 0; }
#status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    height: 100vh; height: 100dvh;
  }
  .chat-layout.text-mode { grid-template-rows: auto minmax(0, 1fr) auto; }
  .chat-layout.text-mode .chat-panel { max-height: none; }
  .chat-topbar { padding: 8px 10px; gap: 8px; }
  .chat-topbar .logo.small { font-size: 16px; flex-shrink: 0; }
  .chat-status-pill { padding: 5px 10px; font-size: 12px; flex: 1 1 auto; justify-content: center; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .btn-icon { padding: 6px 8px; font-size: 15px; }
  .btn-danger-sm { padding: 7px 10px; font-size: 12px; }
  .chat-panel { max-height: 210px; min-height: 150px; border-left: none; border-top: 1px solid var(--border-solid); }
  .messages-wrap { padding: 10px 12px; gap: 8px; }
  .message-input-bar { padding: 8px 10px; }
  .action-bar { padding: 10px 12px; gap: 8px; }
  .btn-skip, .btn-stop, .btn-start { padding: 11px 16px; font-size: 14px; }
  .chat-timer { font-size: 16px; letter-spacing: 1px; }
  .chat-layout.voice-mode .voice-stage { gap: 16px; padding: 16px; }
  .voice-self { padding: 6px 8px 6px 14px; gap: 10px; }
  .voice-mic-btn { width: 42px; height: 42px; font-size: 19px; }
}
@media (max-width: 380px) {
  .chat-topbar .logo.small { display: none; }
}
.message.own .msg-author { color: var(--text-muted); opacity: 1; }
