/* ════════════════════════════════════════════
   NOVATALK — STYLE.CSS
   Aesthetic: Luxury dark · cosmic glass
   Fonts: Outfit (display) + JetBrains Mono
   ════════════════════════════════════════════ */

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

:root {
  /* Core palette */
  --bg:         #050508;
  --surface:    rgba(255,255,255,0.04);
  --surface2:   rgba(255,255,255,0.07);
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,255,255,0.14);
  --text:       #f0f2ff;
  --text-2:     #8b8fa8;
  --text-3:     #4a4e6a;

  /* Accent */
  --cyan:       #00e5ff;
  --cyan-dim:   rgba(0,229,255,0.15);
  --cyan-glow:  rgba(0,229,255,0.35);
  --violet:     #7c3aed;
  --violet-dim: rgba(124,58,237,0.2);
  --green:      #00ff88;
  --red:        #ff4466;
  --amber:      #ffb300;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #00e5ff 0%, #7c3aed 100%);
  --grad-card:  linear-gradient(145deg, rgba(0,229,255,0.08) 0%, rgba(124,58,237,0.06) 100%);

  /* Typography */
  --font:  'Outfit', sans-serif;
  --mono:  'JetBrains Mono', monospace;

  /* Spacing */
  --r:  12px;
  --r2: 20px;
  --tr: 0.22s ease;
}

html { height: 100%; scroll-behavior: smooth; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── THREE.JS CANVAS ── */
#three-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── PAGE SYSTEM ── */
.page {
  position: fixed; inset: 0; z-index: 1;
  display: none; flex-direction: column;
}
.page.active { display: flex; }
.hidden { display: none !important; }


/* ═══════════════════════════════════════════
   LANDING
═══════════════════════════════════════════ */
#page-landing {
  align-items: center;
  justify-content: center;
}

.landing-ui {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 860px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

/* NAV */
.land-nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 0;
}

/* BRAND */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-gem {
  width: 30px; height: 30px;
  background: var(--grad-brand);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  flex-shrink: 0;
  animation: gem-spin 8s linear infinite;
  filter: drop-shadow(0 0 10px var(--cyan-glow));
}
@keyframes gem-spin {
  from { filter: drop-shadow(0 0 8px var(--cyan-glow)) hue-rotate(0deg); }
  to   { filter: drop-shadow(0 0 8px var(--cyan-glow)) hue-rotate(360deg); }
}
.brand-name {
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-name em {
  font-style: normal;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand.small .brand-gem { width: 24px; height: 24px; }
.brand.small .brand-name { font-size: 1.1rem; }

/* ONLINE PILL */
.online-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-2);
  position: relative;
}
.online-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.pulse-ring {
  position: absolute;
  left: 12px;
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1px solid var(--green);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* HERO */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.eyebrow-line {
  display: block;
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2));
}
.hero-eyebrow .eyebrow-line:last-child {
  background: linear-gradient(270deg, transparent, var(--border2));
}

.hero-title {
  font-family: var(--font);
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  animation: fade-up 0.7s ease both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.title-gradient {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--text-2);
  font-weight: 300;
  max-width: 440px;
  animation: fade-up 0.7s 0.1s ease both;
}
.br-pc { display: none; }
@media (min-width: 600px) { .br-pc { display: block; } }

/* CTA */
.cta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  animation: fade-up 0.7s 0.2s ease both;
}

.cta-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-radius: var(--r2);
  border: 1px solid var(--border2);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  transition: all var(--tr);
  color: var(--text);
  font-family: var(--font);
  position: relative;
  overflow: hidden;
  min-width: 200px;
}
.cta-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity var(--tr);
}
.cta-btn:hover { transform: translateY(-3px); box-shadow: 0 20px 48px rgba(0,229,255,0.18); border-color: transparent; }
.cta-btn:hover::before { opacity: 0.12; }
.cta-btn:active { transform: translateY(0); }

.cta-video {
  border-color: rgba(0,229,255,0.3);
  box-shadow: 0 0 0 1px rgba(0,229,255,0.08), inset 0 1px 0 rgba(0,229,255,0.1);
}
.cta-video .cta-icon { color: var(--cyan); }

.cta-text { border-color: rgba(124,58,237,0.3); }
.cta-text .cta-icon { color: #a78bfa; }

.cta-icon {
  width: 44px; height: 44px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative; z-index: 1;
}
.cta-icon svg { width: 20px; height: 20px; }

.cta-text-wrap { /* avoid naming conflict */
  display: flex; flex-direction: column; gap: 2px;
  text-align: left;
  position: relative; z-index: 1;
}
.cta-btn .cta-text { display: flex; flex-direction: column; gap: 2px; position: relative; z-index: 1; }
.cta-btn .cta-text strong { font-size: 1rem; font-weight: 600; }
.cta-btn .cta-text span { font-size: 0.75rem; color: var(--text-2); font-weight: 300; }

.cta-badge {
  position: absolute;
  top: 12px; right: 14px;
  background: var(--cyan);
  color: #000;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 4px;
}

.terms-note {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--mono);
  animation: fade-up 0.7s 0.3s ease both;
}

/* STAT CARDS */
.stat-cards {
  display: flex;
  gap: 14px;
  animation: fade-up 0.7s 0.4s ease both;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 24px;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: card-float 4s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transition: transform var(--tr), box-shadow var(--tr);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,229,255,0.1); }
@keyframes card-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}
.stat-num {
  font-family: var(--font);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-lbl { font-size: 0.7rem; color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }


/* ═══════════════════════════════════════════
   CHAT PAGE
═══════════════════════════════════════════ */
#page-chat { z-index: 2; }

/* CHAT NAV */
.chat-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  height: 60px;
  background: rgba(5,5,8,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.status-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 14px;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-2);
  flex: 1;
  max-width: 280px;
  margin: 0 auto;
}
.sc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); flex-shrink: 0;
  transition: background 0.4s;
}
.sc-dot.waiting     { background: var(--amber); animation: dot-blink 1s ease-in-out infinite; }
.sc-dot.connected   { background: var(--green); }
.sc-dot.disconnected{ background: var(--red); }
@keyframes dot-blink { 0%,100%{opacity:1} 50%{opacity:.25} }

.nav-actions { display: flex; gap: 8px; margin-left: auto; }

.nav-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tr);
}
.nav-btn svg { width: 15px; height: 15px; }
.nav-btn:hover { color: var(--text); background: var(--surface2); }
.btn-next:hover { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 16px var(--cyan-dim); }
.btn-stop:hover { border-color: var(--red); color: var(--red); box-shadow: 0 0 16px rgba(255,68,102,0.2); }

/* CHAT BODY */
.chat-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* VIDEO PANE */
.video-pane {
  flex: 1;
  position: relative;
  background: #02020a;
  border-right: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.vid-slot { position: relative; overflow: hidden; }

/* Remote takes all remaining space */
.remote-slot { flex: 1; }
.remote-slot video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }

/* Local PiP — floats bottom-right */
.local-slot {
  position: absolute;
  bottom: 18px; right: 18px;
  width: clamp(100px, 22%, 180px);
  aspect-ratio: 4/3;
  border-radius: var(--r2);
  overflow: hidden;
  border: 2px solid rgba(0,229,255,0.35);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,229,255,0.1);
  z-index: 5;
  transition: all var(--tr);
}
.local-slot:hover { transform: scale(1.04); }
.local-slot video { width: 100%; height: 100%; object-fit: cover; display: block; transform: scaleX(-1); }
.vid-pip-border {
  position: absolute; inset: 0;
  border-radius: calc(var(--r2) - 2px);
  background: linear-gradient(135deg, rgba(0,229,255,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.vid-badge {
  position: absolute;
  bottom: 12px; left: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 8px;
  z-index: 2;
}
.you-badge { bottom: auto; top: 8px; left: 8px; font-size: 0.6rem; }

/* OVERLAY (waiting) */
.vid-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 24px;
  background: radial-gradient(ellipse at center, #0a0a18 0%, #050508 100%);
  transition: opacity 0.5s ease;
  z-index: 4;
}
.vid-overlay.gone { opacity: 0; pointer-events: none; }

/* Orbit loader */
.orbit-loader { position: relative; width: 64px; height: 64px; }
.orbit {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid transparent;
  animation: orbit-spin linear infinite;
}
.o1 { border-top-color: var(--cyan); animation-duration: 1.2s; }
.o2 { inset: 10px; border-top-color: #7c3aed; animation-duration: 1.8s; animation-direction: reverse; }
.o3 { inset: 20px; border-top-color: rgba(0,229,255,0.4); animation-duration: 2.4s; }
.orbit-core {
  position: absolute;
  inset: 26px;
  background: var(--grad-brand);
  border-radius: 50%;
  animation: core-pulse 2s ease-in-out infinite;
}
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@keyframes core-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.7)} }

.vid-overlay p {
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-2);
  letter-spacing: 0.08em;
}

/* TEXT MODE PANE */
.textmode-pane {
  flex: 1;
  background: #02020a;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-width: 0;
}
#mini-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ta-label {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* CHAT PANE */
.chat-pane {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: rgba(8,8,14,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 0;
}

/* Messages */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 3px; }
.messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: msg-pop 0.2s cubic-bezier(0.34,1.56,0.64,1);
  word-break: break-word;
}
@keyframes msg-pop {
  from { opacity: 0; transform: scale(0.88) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.msg.own {
  align-self: flex-end;
  background: linear-gradient(135deg, #0d2d4d 0%, #0e2040 100%);
  border: 1px solid rgba(0,229,255,0.2);
  border-bottom-right-radius: 4px;
  color: #c8e8ff;
}
.msg.stranger {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-label {
  font-size: 0.62rem;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.5;
}
.msg.own .msg-label { color: var(--cyan); }
.msg.stranger .msg-label { color: var(--text-2); }

.sys-msg {
  align-self: center;
  text-align: center;
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--text-3);
  padding: 5px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  animation: msg-pop 0.3s ease;
  letter-spacing: 0.05em;
}
.sys-msg.ev { color: var(--cyan); border-color: rgba(0,229,255,0.2); }

/* Typing */
.typing-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-3);
  border-top: 1px solid var(--border);
  height: 36px;
  flex-shrink: 0;
}
.t-dots { display: flex; gap: 3px; }
.t-dots i {
  display: block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  animation: td 1.2s ease-in-out infinite;
  font-style: normal;
}
.t-dots i:nth-child(2) { animation-delay: .2s; }
.t-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes td { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-5px)} }

/* Input dock */
.input-dock {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(5,5,10,0.8);
  flex-shrink: 0;
}
.msg-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.msg-input::placeholder { color: var(--text-3); }
.msg-input:focus { border-color: rgba(0,229,255,0.35); box-shadow: 0 0 0 3px rgba(0,229,255,0.06); }
.msg-input:disabled { opacity: 0.35; cursor: not-allowed; }

.send-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--r);
  background: var(--grad-brand);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr);
  box-shadow: 0 4px 16px rgba(0,229,255,0.25);
}
.send-btn svg { width: 16px; height: 16px; color: #000; }
.send-btn:hover:not(:disabled) { transform: scale(1.08); box-shadow: 0 6px 22px rgba(0,229,255,0.4); }
.send-btn:disabled { opacity: 0.25; cursor: not-allowed; box-shadow: none; }


/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {

  .stat-cards { gap: 10px; }
  .stat-card { padding: 12px 16px; }

  /* Chat body stacks */
  .chat-body { flex-direction: column; }

  .video-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: 45vh;
    flex: none;
  }

  .textmode-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: 100px;
    flex: none;
  }

  .local-slot {
    width: 30vw;
    max-width: 110px;
    bottom: 12px; right: 12px;
  }

  .chat-pane {
    width: 100%;
    flex: 1;
  }

  .nav-btn span { display: none; }
  .nav-btn { padding: 8px 12px; }

  .status-capsule { max-width: none; flex: 1; }
}

@media (max-width: 480px) {
  .cta-row { flex-direction: column; width: 100%; }
  .cta-btn { width: 100%; min-width: 0; justify-content: flex-start; }
  .hero-title { font-size: 2rem; }
  .stat-cards { flex-wrap: wrap; justify-content: center; }
}

/* Safe area (iOS notch/home bar) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-dock { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .chat-nav   { padding-top: env(safe-area-inset-top); }
}
