:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(19, 21, 29, 0.82);
  --panel-solid: #12141b;
  --line: rgba(255, 255, 255, 0.09);
  --line-bright: rgba(255, 255, 255, 0.16);
  --text: #f4f3ef;
  --muted: #9699a6;
  --lime: #c8ff65;
  --violet: #8e72ff;
  --cyan: #52d9dc;
  --danger: #ff625f;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(100, 83, 195, 0.18), transparent 29rem),
    radial-gradient(circle at 90% 88%, rgba(57, 165, 153, 0.1), transparent 26rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

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

.topbar {
  height: 76px;
  padding: 0 clamp(22px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.brand-dot { color: var(--lime); }
.brand-mark { position: relative; display: flex; align-items: center; gap: 2px; width: 24px; height: 24px; }
.brand-mark i { width: 4px; height: 13px; border-radius: 8px; background: var(--lime); }
.brand-mark i:nth-child(2) { height: 22px; background: #fff; }
.brand-mark i:nth-child(3) { height: 8px; background: var(--violet); }

.topbar-meta, .connection { display: flex; align-items: center; gap: 9px; }
.topbar-meta { gap: 22px; font-size: 12px; color: var(--muted); }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #e0a647; box-shadow: 0 0 10px currentColor; }
.connection.online i { background: var(--lime); }
.secure { border-left: 1px solid var(--line-bright); padding-left: 22px; }

.workspace {
  width: min(1500px, calc(100% - 44px));
  margin: 26px auto 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(330px, 0.78fr);
  gap: 22px;
  /* Bound to the viewport so the page never grows: both columns share this height
     (ending at the same level) and the transcript scrolls internally instead. */
  height: calc(100vh - 136px);
  min-height: 680px;
}

.stage-panel, .persona-card, .transcript-card, .telemetry {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(24px);
}

.stage-panel { border-radius: var(--radius); padding: clamp(18px, 2vw, 28px); min-width: 0; }
.stage-header, .section-heading, .dialog-heading { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.2em; }
h1, h2 { margin: 0; letter-spacing: -0.04em; }
h1 { font-size: clamp(27px, 3vw, 42px); font-weight: 570; }
h2 { font-size: 17px; font-weight: 560; }
.stage-badges { display: flex; align-items: center; gap: 13px; }
.ai-badge, .timer { border: 1px solid var(--line-bright); border-radius: 999px; padding: 8px 11px; font-size: 10px; letter-spacing: 0.11em; color: #c8cad2; }
.ai-badge i { display: inline-block; width: 5px; height: 5px; margin: 0 6px 1px 0; border-radius: 50%; background: var(--violet); }
.adult-badge { border: 1px solid rgba(255,98,145,.5); border-radius: 999px; padding: 8px 11px; font-size: 10px; letter-spacing: 0.11em; color: #ff8fb0; background: rgba(255,98,145,.08); }
.timer { min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }
.lang-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line-bright); border-radius: 999px; background: rgba(255,255,255,.04); }
.lang-option { min-width: 30px; padding: 4px 9px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; letter-spacing: .06em; cursor: pointer; transition: color .15s ease, background .15s ease; }
.lang-option:hover { color: #d8dae0; }
.lang-option[aria-pressed="true"] { color: #090b10; background: var(--lime); }

.video-shell {
  isolation: isolate;
  position: relative;
  margin-top: 21px;
  width: 100%;
  min-height: 480px;
  height: calc(100vh - 332px);
  max-height: 780px;
  overflow: hidden;
  border-radius: 17px;
  background: #11131b;
  border: 1px solid rgba(255,255,255,0.08);
}

#avatarVideo, .avatar-stream { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
#avatarVideo.visible, .avatar-stream.visible { opacity: 1; }
.avatar-stream { display: block; transition-duration: .18s; transition-timing-function: ease-out; }
.idle-presence { position: absolute; z-index: 0; inset: 0; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, #171825, #0e1017 58%, #151b1c); }
.idle-video, .idle-portrait { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.idle-video { z-index: 2; opacity: 0; transition: opacity .35s ease; }
.idle-video.visible { opacity: 1; transform-origin: 50% 58%; animation: idle-breathing 5.4s ease-in-out infinite; will-change: transform; }
.idle-portrait { display: none; }
.idle-portrait.visible { display: block; transform-origin: 50% 42%; animation: idle-fallback 8s ease-in-out infinite alternate; }
/* Intro: Nova materializes from a blurred, washed-out face into sharp focus (masks warm-up time). */
@keyframes novaMaterialize {
  0%   { filter: blur(28px) saturate(0.5) brightness(1.32) contrast(0.9); opacity: 0.32; transform: scale(1.06); }
  50%  { filter: blur(10px) saturate(0.85) brightness(1.1); opacity: 0.85; }
  100% { filter: blur(0) saturate(1) brightness(1); opacity: 1; transform: scale(1); }
}
.intro-reveal .idle-presence,
.intro-reveal .avatar-stream,
.intro-reveal #avatarVideo { animation: novaMaterialize 2.6s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.idle-presence::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, black, transparent 86%); }
.aura { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .38; }
.aura-one { width: 58%; aspect-ratio: 1; background: radial-gradient(circle, rgba(143,114,255,.55), rgba(82,217,220,.05) 60%, transparent 70%); animation: breathe 5s ease-in-out infinite; }
.aura-two { width: 36%; aspect-ratio: 1; border: 1px solid rgba(200,255,101,.25); box-shadow: 0 0 90px rgba(200,255,101,.09), inset 0 0 60px rgba(142,114,255,.2); animation: rotate 18s linear infinite; }
.portrait-orb { z-index: 1; display: grid; place-items: center; width: clamp(145px, 23vw, 250px); aspect-ratio: 1; border-radius: 50%; color: rgba(255,255,255,.92); font-size: clamp(72px, 10vw, 128px); font-weight: 350; background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.025)); border: 1px solid rgba(255,255,255,.17); box-shadow: inset 0 1px 0 rgba(255,255,255,.17), 0 30px 90px rgba(0,0,0,.35); }
.portrait-orb.hidden { display: none; }
.soundline { position: absolute; z-index: 2; bottom: 115px; display: flex; align-items: center; gap: 4px; height: 20px; }
.soundline i { width: 2px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.55); }
.video-shell.processing .soundline i { animation: waveform .7s ease-in-out infinite alternate; }
.soundline i:nth-child(2), .soundline i:nth-child(6) { animation-delay: -.35s !important; }
.soundline i:nth-child(3), .soundline i:nth-child(5) { animation-delay: -.15s !important; }
.soundline i:nth-child(4) { animation-delay: -.5s !important; }
.video-gradient { position: absolute; z-index: 3; inset: 50% 0 0; pointer-events: none; background: linear-gradient(transparent, rgba(3,4,7,.76)); }
.stage-caption { position: absolute; z-index: 4; left: 24px; right: 110px; bottom: 24px; color: rgba(255,255,255,.84); font-size: 14px; line-height: 1.5; text-shadow: 0 1px 12px #000; }
#warmupBanner { position: absolute; z-index: 7; top: 14px; left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; white-space: nowrap; font: 600 12px/1 "IBM Plex Mono", ui-monospace, monospace; color: #08090d; background: linear-gradient(90deg,#ffd166,#ffb877); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
#warmupBanner .warm-dot { width: 8px; height: 8px; border-radius: 50%; background: #08090d; animation: warmpulse 1s ease-in-out infinite; }
@keyframes warmpulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
.stage-status { position: absolute; z-index: 4; right: 22px; bottom: 24px; display: flex; align-items: center; gap: 7px; font-size: 9px; letter-spacing: .14em; color: #d3d5dc; }
.stage-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 11px rgba(200,255,101,.8); }
.video-shell.processing .stage-status i { background: var(--violet); box-shadow: 0 0 11px rgba(142,114,255,.8); animation: pulse 1s ease-in-out infinite; }

.call-controls { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 11px; padding: 20px 0 0; }
.control-button { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line-bright); border-radius: 50%; background: rgba(255,255,255,.06); cursor: pointer; transition: transform .2s, background .2s, border-color .2s; }
.control-button:hover { transform: translateY(-2px); background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.25); }
.control-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.control-button.end { width: 62px; border-radius: 28px; color: #fff; background: var(--danger); border-color: transparent; }
.control-button.adult-toggle { width: 52px; border-radius: 24px; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #cfd1d8; }
.control-button.adult-toggle.active { color: #fff; background: rgba(255,98,145,.75); border-color: rgba(255,98,145,.9); }
.control-button.interrupt svg { fill: currentColor; stroke: none; }
.control-button.recording { color: #090b10; background: var(--lime); }
.control-button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.mic-status { display: flex; align-items: center; gap: 8px; min-width: 128px; height: 32px; padding: 0 10px; border: 1px solid var(--line-bright); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.035); font-size: 9px; letter-spacing: .06em; }
.mic-status[data-state="ready"] { color: #cfd1d8; }
.mic-status[data-state="listening"] { color: var(--lime); border-color: rgba(200,255,101,.32); background: rgba(200,255,101,.055); }
.mic-status[data-state="voiced"] { color: var(--lime); border-color: rgba(200,255,101,.55); background: rgba(200,255,101,.11); }
.mic-status[data-state="blocked"], .mic-status[data-state="error"] { color: #ffaaa7; border-color: rgba(255,98,95,.3); }
.mic-level { position: relative; width: 38px; height: 4px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.mic-level i { position: absolute; inset: 0; border-radius: inherit; background: var(--lime); transform: scaleX(.04); transform-origin: left center; transition: transform 70ms linear; }

.side-panel { display: flex; min-width: 0; flex-direction: column; gap: 16px; }
.persona-card, .transcript-card, .telemetry { border-radius: 18px; }
.persona-card { padding: 21px; }
.text-button { border: 0; padding: 5px; color: var(--lime); background: none; font-size: 12px; cursor: pointer; }
.account-button { padding: 7px 10px; border: 1px solid var(--line-bright); border-radius: 8px; color: #d8dae0; background: rgba(255,255,255,.05); font-size: 10px; cursor: pointer; }
.demo-button { padding: 7px 13px; border: 1px solid rgba(200,255,101,.35); border-radius: 8px; color: #090b10; background: var(--lime); font-size: 11px; font-weight: 600; letter-spacing: .02em; cursor: pointer; transition: filter .15s; }
.demo-button:hover { filter: brightness(1.08); }
.demo-intro { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.demo-direct { color: var(--muted); font-size: 12px; text-align: center; margin: 12px 0 0; }
.demo-direct a { color: var(--lime); }
.optional { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.login-demo { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line-bright); }
.login-demo-hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.login-demo-form input { margin-bottom: 10px; }
.primary-button.ghost { color: var(--lime); background: rgba(200,255,101,.06); border: 1px solid rgba(200,255,101,.4); }
.primary-button.ghost:hover { background: rgba(200,255,101,.13); }
.login-demo-ok { color: var(--lime); font-size: 13px; margin: 4px 0 0; }
.select-wrap { position: relative; display: block; margin-top: 17px; }
.select-wrap select { width: 100%; appearance: none; padding: 13px 38px 13px 14px; color: var(--text); border: 1px solid var(--line-bright); border-radius: 10px; outline: none; background: rgba(5,6,9,.38); }
.select-wrap svg { position: absolute; top: 14px; right: 13px; width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; pointer-events: none; }
.identity-proof { display: flex; align-items: center; gap: 11px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; color: #bec0c9; background: rgba(255,255,255,.035); }
.proof-icon { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid rgba(200,255,101,.25); border-radius: 50%; color: var(--lime); font-size: 11px; }
.identity-proof strong, .identity-proof small { display: block; }
.identity-proof strong { font-size: 11px; font-weight: 570; }
.identity-proof small { margin-top: 2px; color: var(--muted); font-size: 9px; }

.transcript-card { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.transcript-heading { padding: 21px; border-bottom: 1px solid var(--line); }
.turn-state { padding: 6px 9px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.05); font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.messages { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 19px; scrollbar-width: thin; scrollbar-color: #383b45 transparent; }
.welcome-message { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.welcome-message p { margin: 2px 0 0; }
.welcome-mark { display: grid; flex: 0 0 auto; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #0b0c10; background: var(--lime); font-size: 10px; font-weight: 750; }
.message { max-width: 88%; margin: 0 0 15px; }
.message.user { margin-left: auto; }
.message-label { display: block; margin-bottom: 5px; color: #737681; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; }
.message.user .message-label { text-align: right; }
.message p { margin: 0; padding: 10px 12px; border-radius: 5px 13px 13px 13px; color: #d8dae0; background: rgba(255,255,255,.055); font-size: 12px; line-height: 1.55; }
.message.user p { border-radius: 13px 5px 13px 13px; color: #101216; background: var(--lime); }
.composer { display: flex; align-items: flex-end; gap: 10px; margin: 0 15px 15px; padding: 8px 8px 8px 13px; border: 1px solid var(--line-bright); border-radius: 13px; background: rgba(4,5,8,.42); }
.composer:focus-within { border-color: rgba(200,255,101,.4); box-shadow: 0 0 0 3px rgba(200,255,101,.05); }
.composer textarea { width: 100%; max-height: 95px; padding: 6px 0; resize: none; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; line-height: 1.5; }
.composer textarea::placeholder { color: #686b75; }
.composer button { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: #111319; background: var(--lime); cursor: pointer; }
.composer button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }

.telemetry { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 9px; }
.telemetry div { padding: 3px 12px; border-right: 1px solid var(--line); min-width: 0; }
.telemetry div:last-child { border: 0; }
.telemetry span, .telemetry strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.telemetry span { margin-bottom: 5px; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .12em; }
.telemetry strong { font-size: 10px; font-weight: 550; }

dialog { width: min(480px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line-bright); border-radius: 20px; color: var(--text); background: #14161e; box-shadow: 0 35px 100px #000; }
dialog::backdrop { background: rgba(2,3,5,.78); backdrop-filter: blur(8px); }
.dialog-card { padding: 26px; }
.dialog-heading { margin-bottom: 22px; }
.close-button { border: 0; color: var(--muted); background: none; font-size: 27px; cursor: pointer; }
.dialog-card > label:not(.upload-zone):not(.consent-row) { display: grid; gap: 8px; color: #c6c7ce; font-size: 11px; }
.dialog-card input[type="text"], .dialog-card input[type="password"], .dialog-card input[type="email"], .dialog-card input:not([type]) { width: 100%; padding: 12px 13px; border: 1px solid var(--line-bright); border-radius: 9px; outline: none; color: var(--text); background: rgba(0,0,0,.24); }
.dialog-card input:focus { border-color: rgba(200,255,101,.5); }
.auth-dialog .dialog-card > label + label { margin-top: 14px; }
.password-guidance { margin: 12px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.signed-in-user { margin: -8px 0 17px; color: var(--muted); font-size: 11px; }
.signed-in-user strong { color: var(--text); font-weight: 600; }
.upload-zone { display: grid; place-items: center; margin-top: 15px; padding: 26px; border: 1px dashed rgba(255,255,255,.2); border-radius: 12px; cursor: pointer; text-align: center; background: rgba(255,255,255,.025); }
.upload-zone:hover { border-color: rgba(200,255,101,.45); }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone strong { margin: 8px 0 4px; font-size: 12px; }
.upload-zone small { color: var(--muted); font-size: 10px; }
.upload-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #101116; background: var(--lime); }
.consent-row { display: flex; align-items: flex-start; gap: 9px; margin: 17px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.consent-row input { accent-color: var(--lime); }
.primary-button { width: 100%; padding: 12px; border: 0; border-radius: 10px; color: #0c0e12; background: var(--lime); font-weight: 680; cursor: pointer; }
.form-error { min-height: 16px; margin: 0 0 8px; color: #ff8c89; font-size: 10px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 340px; padding: 12px 14px; border: 1px solid var(--line-bright); border-radius: 10px; color: #dfe0e6; background: #20222b; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s ease; font-size: 11px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes breathe { 0%,100% { transform: scale(.92); opacity: .26; } 50% { transform: scale(1.08); opacity: .47; } }
@keyframes idle-breathing { 0%,100% { transform: scale(1.002) translate3d(0,.08%,0); } 50% { transform: scale(1.006) translate3d(0,-.1%,0); } }
@keyframes idle-fallback { from { transform: scale(1.005) translate3d(-.15%, 0, 0); } to { transform: scale(1.018) translate3d(.2%, -.25%, 0); } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes waveform { from { height: 4px; } to { height: 19px; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .video-shell { height: min(68vh, 620px); }
  /* stacked: give the transcript a plain fixed scroll height (no flex collapse) */
  .transcript-card { min-height: 0; }
  .messages { flex: none; height: 330px; min-height: 0; }
}

@media (max-width: 540px) {
  .topbar { height: 64px; padding: 0 16px; }
  .secure { display: none; }
  .workspace { width: calc(100% - 20px); margin-top: 10px; gap: 10px; }
  .stage-panel { padding: 12px; border-radius: 16px; }
  .video-shell { min-height: 410px; margin-top: 14px; }
  .ai-badge { display: none; }
  .stage-caption { right: 75px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
