:root {
  --green: #075e54; --teal: #128c7e; --accent: #25d366;
  --bg: #0b141a; --ink: #fff; --muted: rgba(255,255,255,.72);
  --red: #ea0038; --glass: rgba(0,0,0,.38);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Devanagari", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #e9edef; }
body { display: grid; place-items: center; }
[hidden] { display: none !important; }

.phone {
  position: relative; width: min(420px, 100vw); height: min(880px, 100dvh);
  background: var(--bg); color: var(--ink); overflow: hidden;
  border-radius: 36px; box-shadow: 0 30px 80px rgba(0,0,0,.25);
}
@media (max-width: 480px) { .phone { border-radius: 0; width: 100vw; height: 100dvh; } }

/* ── start screen ── */
.start {
  height: 100%; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 28px 32px; background: linear-gradient(170deg, var(--green), #0a3d37 60%, var(--bg));
}
.brand { text-align: center; }
.logo {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center;
  background: #fff; color: var(--green); font-weight: 800; font-size: 28px;
}
.brand h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.hero { text-align: center; }
.hero p { color: var(--muted); line-height: 1.5; font-size: 15px; max-width: 300px; margin: 22px auto 0; }
.ring {
  width: 150px; height: 150px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(37,211,102,.25), transparent 70%);
  animation: breathe 2.6s ease-in-out infinite;
}
.ring-inner { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,255,255,.12); display: grid; place-items: center; font-size: 44px; }
@keyframes breathe { 50% { transform: scale(1.07); } }
.primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 16px; border: 0; border-radius: 999px; background: var(--accent); color: #062b1f;
  font-size: 16px; font-weight: 700; cursor: pointer; transition: transform .15s;
}
.primary:hover { transform: translateY(-1px); }
.primary:disabled { opacity: .6; }
.primary svg { width: 22px; fill: currentColor; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; margin: 14px 0 0; }

/* ── call screen ── */
.call { position: absolute; inset: 0; }
#doctorVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #1b2a30; }
.poster {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: linear-gradient(180deg, #1f3a40, #0b141a); color: var(--muted); font-size: 14px;
}
.pulse {
  width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: var(--teal); color: #fff; font-size: 38px; font-weight: 700;
  box-shadow: 0 0 0 0 rgba(37,211,102,.5); animation: ping 1.8s infinite;
}
.poster.voice-only .pulse { animation-duration: 3s; }
.poster.voice-only.talking .pulse { animation-duration: .8s; transform: scale(1.06); transition: transform .2s; }
@keyframes ping { 70% { box-shadow: 0 0 0 28px rgba(37,211,102,0); } 100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); } }

.topbar {
  position: absolute; top: 0; left: 0; right: 0; padding: 18px 16px 30px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.who { display: flex; align-items: center; gap: 10px; }
.mini { width: 40px; height: 40px; border-radius: 50%; background: var(--teal); display: grid; place-items: center; font-weight: 700; }
.name { font-weight: 700; font-size: 16px; }
.tick { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #062b1f; font-size: 10px; margin-left: 2px; }
.meta { font-size: 12.5px; color: var(--muted); }
.ai-badge { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--glass); border: 1px solid rgba(255,255,255,.25); }

.self { position: absolute; top: 84px; right: 14px; width: 96px; height: 136px; object-fit: cover; border-radius: 14px; border: 2px solid rgba(255,255,255,.6); transform: scaleX(-1); }

.captions { position: absolute; left: 14px; right: 14px; bottom: 120px; display: flex; flex-direction: column; gap: 8px; }
.cap { padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.4; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 90%; }
.cap.doc { background: rgba(0,0,0,.55); align-self: flex-start; }
.cap.you { background: rgba(37,211,102,.85); color: #062b1f; align-self: flex-end; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 11.5px; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.9); color: var(--green); font-weight: 600; }

.textform { position: absolute; left: 14px; right: 14px; bottom: 104px; display: flex; gap: 8px; }
.textform input { flex: 1; padding: 12px 16px; border-radius: 999px; border: 0; font-size: 15px; outline: none; }
.textform button { width: 46px; border-radius: 50%; border: 0; background: var(--accent); font-size: 18px; cursor: pointer; }
.captions:has(+ .textform:not([hidden])) { bottom: 164px; }

.controls {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 24px 30px;
  display: flex; justify-content: space-around; background: linear-gradient(0deg, rgba(0,0,0,.6), transparent);
}
.ctl { width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255,255,255,.2); cursor: pointer; backdrop-filter: blur(8px); }
.ctl svg { width: 26px; fill: #fff; }
.ctl.off { background: rgba(255,255,255,.9); }
.ctl.off svg { fill: #111; }
.ctl.end { background: var(--red); }
.ctl:focus-visible, .primary:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.err { position: absolute; top: 90px; left: 14px; right: 14px; padding: 12px 14px; border-radius: 12px; background: #fff1f2; color: #9f1239; font-size: 13px; }
.mini { flex-shrink: 0; }
.who > div:last-child { min-width: 0; }
.meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.debug { position: absolute; top: 74px; left: 10px; right: 10px; max-height: 38%; overflow: auto; margin: 0; padding: 8px 10px;
  background: rgba(0,0,0,.72); color: #b7f7c9; font: 11px/1.45 ui-monospace, Consolas, monospace; border-radius: 10px; z-index: 5; white-space: pre-wrap; }
.debug .bad { color: #ff8a9a; }
.err { z-index: 6; }

/* ── agent switcher ── */
.start { gap: 18px; }
.hero.compact .ring { width: 110px; height: 110px; }
.hero.compact .ring-inner { width: 72px; height: 72px; font-size: 34px; }
.agents { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.agents legend { font-size: 13px; color: var(--muted); margin-bottom: 8px; padding: 0; }
.agent { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1.5px solid rgba(255,255,255,.14); cursor: pointer; transition: background .15s, border-color .15s; }
.agent:hover { background: rgba(255,255,255,.12); }
.agent input { grid-row: 1 / 3; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.agent-name { font-weight: 700; font-size: 15px; }
.agent-tag { font-size: 12.5px; color: var(--muted); }
.agent:has(input:checked) { border-color: var(--accent); background: rgba(37,211,102,.14); }
.agent.off { opacity: .55; cursor: not-allowed; }
.agent-note { min-height: 16px; font-size: 12.5px; color: #ffd28a; text-align: center; margin: 0; }
.agent-badge { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 6px; background: var(--glass); border: 1px solid rgba(255,255,255,.25); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { position: absolute; right: 14px; top: 76px; font: 11.5px ui-monospace, Consolas, monospace; color: rgba(255,255,255,.8); background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 6px; z-index: 4; }
.meter:empty { display: none; }
.self { top: 106px; }
.start { justify-content: flex-start; padding: 32px 22px 24px; overflow-y: auto; }
.start .brand { margin-bottom: 4px; }
.start .primary { margin-top: auto; }
