:root {
  --cyan: #1ad1ec;
  --cyan-bright: #5cf0ff;
  --cyan-deep: #0aa6c4;
  --pink: #ff2d95;
  --pink-soft: #ff6fc6;
  --magenta: #b026ff;
  --bg: #05070e;
  --bg-2: #080c18;
  --ink: #eaf6fb;
  --muted: #8ea3b8;
  --glass: rgba(16, 24, 40, 0.55);
  --glass-brd: rgba(120, 200, 230, 0.14);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
  --r: 22px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; }
input { font-family: inherit; }
h1, h2, h3, .brand-live, .btn { font-family: "Sora", sans-serif; }

/* ---------- Background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--bg); }
.bg-mesh {
  position: absolute; inset: -30%;
  background:
    radial-gradient(40% 50% at 18% 22%, rgba(26, 209, 236, 0.35), transparent 60%),
    radial-gradient(45% 55% at 82% 30%, rgba(176, 38, 255, 0.30), transparent 60%),
    radial-gradient(50% 55% at 60% 88%, rgba(255, 45, 149, 0.28), transparent 62%),
    radial-gradient(40% 45% at 30% 75%, rgba(10, 166, 196, 0.30), transparent 60%);
  filter: blur(40px) saturate(135%);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2%, -2.5%, 0) scale(1.08); }
  100% { transform: translate3d(-2.5%, 2%, 0) scale(1.04); }
}
.bg-grain {
  position: absolute; inset: 0; opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 3px 3px;
  mask-image: radial-gradient(80% 80% at 50% 40%, #000 30%, transparent 100%);
}

/* ---------- Glass primitive ---------- */
.glass {
  background: linear-gradient(160deg, rgba(22,32,54,0.66), rgba(8,12,24,0.62));
  border: 1px solid var(--glass-brd);
  backdrop-filter: blur(26px) saturate(140%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 22px; border-radius: 999px; font-weight: 700; font-size: 15px;
  letter-spacing: 0.2px; color: #fff; transition: transform .15s ease, box-shadow .25s ease, filter .2s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  box-shadow: 0 14px 34px -10px rgba(26,209,236,0.7);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 18px 44px -10px rgba(26,209,236,0.85); }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--muted); border: 1px solid rgba(255,255,255,0.1); }
.btn-ghost:hover { color: var(--ink); }
.btn-call {
  width: 100%;
  background: linear-gradient(135deg, var(--pink), var(--magenta));
  box-shadow: 0 16px 40px -10px rgba(255,45,149,0.7);
  padding: 16px; font-size: 16px;
  position: relative; overflow: hidden;
}
.btn-call::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%); animation: shine 4.5s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { transform: translateX(-120%);} 80%, 100% { transform: translateX(120%);} }
.btn-call:hover { filter: brightness(1.07); box-shadow: 0 22px 52px -10px rgba(255,45,149,0.85); }

/* ---------- Age gate ---------- */
.age-gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(8,12,24,0.65), rgba(3,4,9,0.92));
  backdrop-filter: blur(10px);
}
.age-gate.hidden { opacity: 0; pointer-events: none; transition: opacity .5s ease; }
.age-card { max-width: 420px; padding: 40px 34px; border-radius: 26px; text-align: center; }
.age-logo { height: 40px; margin-bottom: 22px; filter: drop-shadow(0 0 18px rgba(26,209,236,0.6)); }
.age-card h1 { font-size: 26px; margin-bottom: 12px; }
.age-card p { color: var(--muted); line-height: 1.6; margin-bottom: 26px; font-size: 15px; }
.age-actions { display: flex; flex-direction: column; gap: 12px; }

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; opacity: 0; }
.app.ready { opacity: 1; transition: opacity .6s ease; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-logo { height: 30px; filter: drop-shadow(0 0 14px rgba(26,209,236,0.55)); }
.brand-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.16); }
.brand-live {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  letter-spacing: 2px; color: var(--cyan-bright);
}
.pill { padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.pill-soft { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid rgba(255,255,255,0.08); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #19e57a; box-shadow: 0 0 10px #19e57a; display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- Layout ---------- */
.layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 360px 1fr; gap: 22px;
  padding: 0 clamp(16px, 4vw, 40px) clamp(16px, 3vw, 32px);
}

/* ---------- Profile ---------- */
.profile { border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; }
.profile-media { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 1/1; }
.profile-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-media-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(3,5,12,0.85)); }
.profile-online {
  position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(3,6,14,0.6); border: 1px solid rgba(255,255,255,0.12); backdrop-filter: blur(8px);
  padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.profile-id { position: absolute; left: 16px; bottom: 14px; }
.profile-id h2 { font-size: 24px; display: flex; align-items: center; gap: 8px; }
.profile-id p { color: #cfe7f0; font-size: 14px; margin-top: 2px; }
.verified { font-size: 13px; color: #061018; background: var(--cyan); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 12px rgba(26,209,236,0.8); }
.profile-bio { color: var(--muted); font-size: 14px; line-height: 1.6; padding: 0 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgba(26,209,236,0.1); border: 1px solid rgba(26,209,236,0.22); color: var(--cyan-bright); }
.profile-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: -4px; }

/* ---------- Chat ---------- */
.chat { border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.chat-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(26,209,236,0.5); box-shadow: 0 0 16px rgba(26,209,236,0.4); }
.chat-head-id { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.chat-head-id strong { font-size: 16px; }
.chat-substatus { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--pink), var(--magenta)); box-shadow: 0 10px 26px -8px rgba(255,45,149,0.7); transition: transform .15s ease, filter .2s; }
.icon-btn:hover { filter: brightness(1.1); transform: scale(1.05); }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 22px clamp(14px, 3vw, 26px); display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb { background: rgba(120,200,230,0.18); border-radius: 8px; }

.msg { max-width: 76%; padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.5; position: relative; animation: pop .35s cubic-bezier(.2,.9,.3,1.2); white-space: pre-wrap; word-wrap: break-word; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.msg.ai { align-self: flex-start; background: linear-gradient(160deg, rgba(26,209,236,0.16), rgba(26,209,236,0.06)); border: 1px solid rgba(26,209,236,0.22); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: linear-gradient(160deg, var(--pink), var(--magenta)); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 10px 30px -12px rgba(255,45,149,0.6); }
.msg .cursor { display: inline-block; width: 7px; height: 16px; background: var(--cyan-bright); margin-left: 2px; border-radius: 2px; vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 18px; background: rgba(26,209,236,0.1); border: 1px solid rgba(26,209,236,0.2); border-radius: 18px; border-bottom-left-radius: 6px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan-bright); animation: bounce 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-6px); opacity: 1; } }

.composer { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.composer-input { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 14px 20px; color: var(--ink); font-size: 15px; outline: none; transition: border-color .2s, box-shadow .2s; }
.composer-input:focus { border-color: rgba(26,209,236,0.6); box-shadow: 0 0 0 4px rgba(26,209,236,0.12); }
.composer-input::placeholder { color: #5f7186; }
.send-btn { width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #061018; background: linear-gradient(135deg, var(--cyan-bright), var(--cyan)); box-shadow: 0 10px 26px -8px rgba(26,209,236,0.7); transition: transform .15s, filter .2s; }
.send-btn:hover { filter: brightness(1.08); transform: scale(1.05); }
.send-btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ---------- Call screen ---------- */
.call-screen { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; }
.call-screen.open { display: grid; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; } }
.call-backdrop { position: absolute; inset: 0; overflow: hidden; }
.call-backdrop video { width: 100%; height: 100%; object-fit: cover; transform: scale(1.2); filter: blur(40px) brightness(.4) saturate(140%); }
.call-backdrop::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(5,7,14,0.4), rgba(3,4,9,0.92)); }

.call-inner { position: relative; z-index: 1; width: min(520px, 92vw); height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: clamp(28px, 6vh, 60px) 24px; text-align: center; }
.call-top { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.call-state { font-family: "Sora"; font-size: 14px; font-weight: 600; letter-spacing: 1px; color: var(--cyan-bright); text-transform: uppercase; }
.call-timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; }

.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.orb { position: relative; width: clamp(220px, 56vw, 300px); aspect-ratio: 1; display: grid; place-items: center; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(26,209,236,0.35); }
.orb-ring.r1 { animation: ring 3s ease-out infinite; }
.orb-ring.r2 { animation: ring 3s ease-out infinite .9s; }
.orb-ring.r3 { animation: ring 3s ease-out infinite 1.8s; }
@keyframes ring { 0% { transform: scale(.75); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
.orb-video { width: 72%; height: 72%; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255,255,255,0.18);
  box-shadow: 0 0 0 6px rgba(26,209,236,0.12), 0 30px 70px -20px rgba(0,0,0,0.9); transition: box-shadow .2s, transform .2s; }
/* speaking / listening states are driven by JS adding classes on .orb */
.orb.speaking .orb-video { box-shadow: 0 0 0 8px rgba(255,45,149,0.25), 0 0 60px rgba(255,45,149,0.55); }
.orb.speaking .orb-ring { border-color: rgba(255,45,149,0.5); }
.orb.listening .orb-video { box-shadow: 0 0 0 8px rgba(26,209,236,0.25), 0 0 60px rgba(26,209,236,0.5); }
.call-name { font-size: 30px; }
.call-hint { color: var(--muted); font-size: 15px; margin-top: -10px; }

.caption { min-height: 48px; max-width: 460px; color: #d7e9f1; font-size: 16px; line-height: 1.5; opacity: 0; transition: opacity .3s; padding: 0 10px; }
.caption.show { opacity: 1; }
.caption .who { color: var(--cyan-bright); font-weight: 700; margin-right: 6px; }

.call-controls { display: flex; gap: 26px; align-items: center; }
.ctrl { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.16); backdrop-filter: blur(10px); transition: transform .15s, background .2s, filter .2s; }
.ctrl:hover { transform: translateY(-2px); }
.ctrl.muted { background: rgba(255,255,255,0.9); color: #0a1018; }
.ctrl-hang { background: linear-gradient(135deg, #ff3b3b, #d40e4f); box-shadow: 0 14px 36px -10px rgba(255,59,59,0.7); }
.ctrl-hang:hover { filter: brightness(1.1); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); z-index: 60;
  background: rgba(10,14,26,0.92); border: 1px solid var(--glass-brd); backdrop-filter: blur(14px);
  padding: 14px 22px; border-radius: 14px; font-size: 14px; color: var(--ink); opacity: 0; pointer-events: none; transition: all .3s ease; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; padding-bottom: 24px; }
  .profile-media { aspect-ratio: 16/12; }
  .chat { height: 70vh; min-height: 480px; }
  .messages { }
}
@media (max-width: 520px) {
  .topbar-right { display: none; }
  .msg { max-width: 86%; }
}
