/* ============================================================
   Smile Solutions · AI Receptionist (Demo)
   Brand-matched to demos/dentists/smile-solutions/v1/index.html
   - Primary brand: #97C811 (lime — verified at v1 line 115/128)
   - Brand-deep:    #7BA80C
   - Brand-glow:    #B8E63A
   - Ink:           #0A0A0A
   - Paper:         #F5F5F0
   - Fonts: Hanken Grotesk (sans) + Instrument Serif (serif)
   Mobile-first: default rules target small Android, then scale up.
   ============================================================ */

:root {
  --brand:       #97C811;
  --brand-deep:  #7BA80C;
  --brand-glow:  #B8E63A;
  --brand-fade:  rgba(151, 200, 17, 0.12);
  --brand-line:  rgba(151, 200, 17, 0.45);
  --ink:         #0A0A0A;
  --ink-soft:    #111114;
  --ink-card:    #161619;
  --ink-line:    #23232A;
  --ink-line-2:  #2A2A30;
  --paper:       #F5F5F0;
  --paper-mute:  rgba(245, 245, 240, 0.62);
  --paper-faint: rgba(245, 245, 240, 0.38);

  /* WhatsApp brand for mockup */
  --wa-bg:       #efeae2;
  --wa-bubble:   #d9fdd3;
  --wa-text:     #111b21;
  --wa-meta:     #667781;
  --wa-header:   #008069;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);
}

/* ----- Reset / base ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; }
a { color: var(--brand-glow); text-decoration: none; }
a:hover { color: var(--paper); }
input, textarea, button { font-family: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ----- Header ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-top);
  background:
    linear-gradient(180deg, rgba(151, 200, 17, 0.10) 0%, transparent 28%),
    rgba(10, 10, 10, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--ink-line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  max-width: 760px;
  margin: 0 auto;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
}
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--ink-card);
  padding: 4px;
  border: 1px solid var(--ink-line);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  letter-spacing: 0.2px;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-glow);
  margin-top: 2px;
}
.header-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
}
.header-action:hover {
  background: rgba(151, 200, 17, 0.08);
  border-color: var(--brand-line);
  color: var(--brand-glow);
}
.header-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-mute);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-live {
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(151, 200, 17, 0.6);
  animation: pulse-live 1.8s ease-out infinite;
}
@keyframes pulse-live {
  0%   { box-shadow: 0 0 0 0 rgba(151, 200, 17, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(151, 200, 17, 0); }
  100% { box-shadow: 0 0 0 0 rgba(151, 200, 17, 0); }
}

/* ----- Chat shell ----- */
.chat-shell {
  flex: 1 1 auto;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px 14px 20px;
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(151, 200, 17, 0.10) 0%, transparent 60%),
    var(--ink);
}

/* ----- Asha intro card ----- */
.asha-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--ink-card);
  border: 1px solid var(--ink-line);
  border-radius: 18px;
  margin-bottom: 14px;
}
.asha-avatar svg {
  display: block;
  border-radius: 50%;
  box-shadow: 0 8px 24px -8px rgba(151, 200, 17, 0.55);
}
.asha-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asha-name {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  letter-spacing: 0.2px;
  color: var(--paper);
}
.asha-role {
  font-size: 12.5px;
  color: var(--paper-mute);
  letter-spacing: 0.02em;
}
.asha-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-glow);
}

/* ----- Chat log ----- */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 8px;
  min-height: 30vh;
}
.msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  animation: msg-in 240ms ease both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-asha {
  align-self: flex-start;
  background: var(--ink-card);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  border-bottom-left-radius: 6px;
}
.msg-asha.is-streaming::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--brand);
  animation: caret-blink 0.9s steps(2) infinite;
  border-radius: 2px;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--ink);
  border-bottom-right-radius: 6px;
  font-weight: 500;
  box-shadow: 0 6px 20px -8px rgba(151, 200, 17, 0.5);
}
.msg-tool {
  align-self: flex-start;
  background: rgba(151, 200, 17, 0.08);
  border: 1px dashed rgba(151, 200, 17, 0.35);
  color: var(--brand-glow);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.msg-tool .tool-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(151, 200, 17, 0.3);
  border-top-color: var(--brand);
  animation: tool-spin 0.7s linear infinite;
}
@keyframes tool-spin { to { transform: rotate(360deg); } }
.msg-error {
  align-self: stretch;
  text-align: center;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.4);
  color: #ffd2d2;
  font-size: 13.5px;
  border-radius: 14px;
}

/* ----- Typing indicator ----- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 10px;
  font-size: 12.5px;
  color: var(--paper-mute);
}
.typing-name {
  font-family: 'Instrument Serif', serif;
  color: var(--brand-glow);
  font-size: 14px;
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  animation: typing-bounce 1.1s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40%           { opacity: 1;    transform: translateY(-3px); }
}

/* ----- Composer ----- */
.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: 22px;
  box-shadow: 0 12px 28px -16px rgba(0, 0, 0, 0.6);
}
.composer-input {
  flex: 1 1 auto;
  resize: none;
  max-height: 160px;
  padding: 10px 12px;
  background: transparent;
  color: var(--paper);
  border: 0;
  outline: none;
  font-size: 16px; /* 16px+ avoids iOS zoom on focus */
  line-height: 1.4;
}
.composer-input::placeholder { color: var(--paper-faint); }
.composer-send {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--brand);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 8px 24px -10px rgba(151, 200, 17, 0.6);
}
.composer-send:hover:not(:disabled) { transform: translateY(-1px); }
.composer-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.composer-send svg { transform: translateX(1px); }

/* ----- Voice CTA placeholder (Wave 2 wires) ----- */
.voice-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  text-align: left;
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(151, 200, 17, 0.20) 0%, transparent 60%),
    var(--ink-card);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}
.voice-cta:hover {
  transform: translateY(-1px);
  border-color: var(--brand-line);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(151, 200, 17, 0.30) 0%, transparent 60%),
    var(--ink-card);
}
.voice-cta-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--ink);
  box-shadow: 0 8px 20px -8px rgba(151, 200, 17, 0.55);
}
.voice-cta-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.voice-cta-title { font-weight: 700; font-size: 15px; letter-spacing: 0.01em; }
.voice-cta-sub   { font-size: 12.5px; color: var(--paper-mute); }
.voice-cta-badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-glow);
  border: 1px solid var(--brand-line);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(151, 200, 17, 0.06);
  white-space: nowrap;
}

/* ----- Footer ----- */
.site-footer {
  margin-top: auto;
  padding: 22px 14px calc(22px + var(--safe-bottom));
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border-top: 1px solid var(--ink-line);
  background:
    linear-gradient(180deg, transparent 0%, rgba(151, 200, 17, 0.04) 100%),
    var(--ink);
}
.footer-card {
  padding: 14px 16px;
  background: var(--ink-card);
  border: 1px solid var(--ink-line);
  border-radius: 16px;
  font-size: 13.5px;
  color: var(--paper-mute);
}
.footer-card-title {
  font-family: 'Instrument Serif', serif;
  font-size: 14.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-glow);
  margin-bottom: 6px;
}
.footer-card p { margin: 0; }
.footer-card a {
  color: var(--paper);
  border-bottom: 1px dotted var(--brand-line);
}
.footer-card a:hover { color: var(--brand-glow); }
.footer-meta {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--paper-faint);
  text-transform: uppercase;
  padding-top: 8px;
}
.footer-meta strong { color: var(--brand-glow); font-weight: 600; }

/* ============================================================
   WhatsApp confirmation overlay
   Convincing real-WhatsApp look: green header, bubble color,
   double-checkmark, timestamp, verified badge.
   ============================================================ */
.wa-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  animation: wa-in 280ms ease both;
}
.wa-overlay[hidden] { display: none; }
@keyframes wa-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.wa-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.wa-overlay-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 18px 18px 20px;
  background: var(--ink-card);
  border: 1px solid var(--brand-line);
  border-radius: 22px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  animation: wa-card-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes wa-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
.wa-overlay-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-glow);
  background: rgba(151, 200, 17, 0.08);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  margin-bottom: 14px;
}
.wa-overlay-label .wa-emoji { font-size: 12px; }

/* The WhatsApp mockup itself */
.wa-mockup {
  border-radius: 16px;
  overflow: hidden;
  background: var(--wa-bg);
  /* WhatsApp default chat backdrop pattern (subtle dotted) */
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 14px 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--wa-text);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.wa-mockup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--wa-header);
  color: #fff;
}
.wa-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.wa-avatar img { width: 28px; height: 28px; object-fit: contain; }
.wa-mockup-meta { display: flex; flex-direction: column; line-height: 1.15; }
.wa-mockup-name {
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wa-verified {
  color: #fff;
  background: #25D366;
  border-radius: 50%;
  padding: 2px;
}
.wa-mockup-presence {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
}

.wa-mockup-body {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
}
.wa-bubble {
  align-self: flex-start;
  position: relative;
  max-width: 85%;
  padding: 7px 9px 5px;
  background: var(--wa-bubble);
  border-radius: 8px 8px 8px 2px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--wa-text);
}
/* WhatsApp tail */
.wa-bubble::before {
  content: '';
  position: absolute;
  left: -7px; bottom: 0;
  width: 8px; height: 13px;
  background: var(--wa-bubble);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.wa-bubble-text { white-space: pre-wrap; padding-right: 56px; }
.wa-bubble-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 11px;
  color: var(--wa-meta);
}
.wa-bubble-meta .wa-time { font-variant-numeric: tabular-nums; }
.wa-checks { display: block; }

.wa-overlay-note {
  margin: 14px 4px 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--paper-mute);
  text-align: center;
}
.wa-overlay-close {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  background: var(--brand);
  color: var(--ink);
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 8px 24px -10px rgba(151, 200, 17, 0.6);
}
.wa-overlay-close:hover { transform: translateY(-1px); }

/* ============================================================
   Breakpoints
   ============================================================ */

/* 360px small Android — default rules already cover this.
   Tighten a hair below 380px so the header doesn't overflow. */
@media (max-width: 380px) {
  .header-action span { display: none; }
  .header-action { padding: 8px 9px; }
  .brand-name { font-size: 16px; }
  .brand-sub  { font-size: 10.5px; }
  .asha-name  { font-size: 20px; }
  .voice-cta-badge { display: none; }
}

/* 768px tablet — give chat panel a bit more breathing room */
@media (min-width: 768px) {
  .header-inner { padding: 14px 24px; }
  .chat-shell  { padding: 22px 22px 28px; }
  .asha-intro  { padding: 16px 18px; }
  .msg         { max-width: 78%; font-size: 15.5px; }
  .composer-input { font-size: 15.5px; }
  .voice-cta   { padding: 16px 20px; }
  .site-footer {
    grid-template-columns: 1fr 1fr;
    padding: 28px 22px calc(28px + var(--safe-bottom));
  }
  .site-footer .footer-meta { grid-column: 1 / -1; }
}

/* 1024px desktop — center the chat with a soft side rail */
@media (min-width: 1024px) {
  .chat-shell  { padding: 28px 28px 32px; }
  .msg         { max-width: 70%; }
  .asha-name   { font-size: 26px; }
}

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

/* ----- Focus rings ----- */
:focus-visible {
  outline: 2px solid var(--brand-glow);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ============================================================
   PHONE UI (voice mode) — full-screen overlay
   Brand: lime ring on ink background. Mobile-first.
   Built by phone-ui.js, driven by voice.js.
   ============================================================ */
.voice-cta-unsupported {
  pointer-events: none;
}

.phone-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background:
    radial-gradient(80% 60% at 50% 30%, rgba(151, 200, 17, 0.18) 0%, transparent 65%),
    radial-gradient(60% 80% at 50% 100%, rgba(151, 200, 17, 0.08) 0%, transparent 70%),
    #050505;
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  animation: phone-fade-in 320ms ease both;
}
.phone-overlay[hidden] { display: none; }
@keyframes phone-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.phone-stage {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.phone-status {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-glow);
  margin-top: 4px;
  min-height: 1.2em;
}

/* ----- Avatar + ring ----- */
.phone-avatar-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px;
}
.phone-avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(151, 200, 17, 0.35);
  pointer-events: none;
  transition: border-color 220ms ease, box-shadow 220ms ease;
}
.phone-avatar-wrap.is-listening .phone-avatar-ring {
  border-color: var(--brand);
  animation: phone-ring-pulse 1.6s ease-out infinite;
}
.phone-avatar-wrap.is-speaking .phone-avatar-ring {
  border-color: var(--brand-glow);
  box-shadow:
    0 0 0 6px rgba(184, 230, 58, 0.20),
    0 0 24px rgba(151, 200, 17, 0.45);
  animation: phone-ring-speak 1.4s ease-in-out infinite;
}
.phone-avatar-wrap.is-thinking .phone-avatar-ring {
  border-color: rgba(151, 200, 17, 0.55);
  animation: phone-ring-think 1.2s linear infinite;
}
.phone-avatar-wrap.is-error .phone-avatar-ring {
  border-color: #f56565;
  box-shadow: 0 0 0 6px rgba(245, 101, 101, 0.18);
}
@keyframes phone-ring-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(151, 200, 17, 0.55); }
  70%  { box-shadow: 0 0 0 22px rgba(151, 200, 17, 0); }
  100% { box-shadow: 0 0 0 0 rgba(151, 200, 17, 0); }
}
@keyframes phone-ring-speak {
  0%, 100% { transform: scale(1);     opacity: 1; }
  50%      { transform: scale(1.04);  opacity: 0.85; }
}
@keyframes phone-ring-think {
  0%   { transform: rotate(0deg);   opacity: 0.55; }
  50%  { opacity: 1; }
  100% { transform: rotate(360deg); opacity: 0.55; }
}
.phone-avatar svg {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  box-shadow:
    0 18px 50px -10px rgba(151, 200, 17, 0.45),
    0 4px 14px -2px rgba(0, 0, 0, 0.5);
}

/* ----- Name + timer ----- */
.phone-name {
  font-family: 'Instrument Serif', serif;
  font-size: 30px;
  letter-spacing: 0.4px;
  margin-top: 6px;
  color: var(--paper);
}
.phone-timer {
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.14em;
  color: var(--paper-mute);
  text-transform: uppercase;
}

/* ----- Captions ----- */
.phone-captions {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  min-height: 92px;
  max-height: 28vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ink-line);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-line) transparent;
}
.phone-captions::-webkit-scrollbar {
  width: 6px;
}
.phone-captions::-webkit-scrollbar-thumb {
  background: var(--brand-line);
  border-radius: 999px;
}
.phone-caption {
  font-size: 14.5px;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 12px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: phone-caption-in 220ms ease both;
}
@keyframes phone-caption-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.phone-caption-asha {
  align-self: flex-start;
  background: rgba(151, 200, 17, 0.10);
  border: 1px solid var(--brand-line);
  color: var(--paper);
}
.phone-caption-asha::before {
  content: 'Asha';
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-glow);
  margin-bottom: 2px;
}
.phone-caption-user {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  max-width: 90%;
}
.phone-caption-user::before {
  content: 'You';
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-mute);
  margin-bottom: 2px;
}
.phone-caption.is-interim {
  font-style: italic;
  color: var(--paper-mute);
  border-style: dashed;
  opacity: 0.85;
}

/* ----- Hangup control ----- */
.phone-controls {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.phone-hangup {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #f04444 0%, #c1272d 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -3px 0 rgba(0, 0, 0, 0.22),
    0 16px 32px -10px rgba(220, 38, 38, 0.65),
    0 0 0 4px rgba(220, 38, 38, 0.15);
}
.phone-hangup:hover  { transform: translateY(-1px); filter: brightness(1.05); }
.phone-hangup:active { transform: translateY(0);    filter: brightness(0.95); }
.phone-hangup svg    { transform: translateY(1px); }
.phone-hangup-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-mute);
}

/* When voice is active, hide page scroll under the overlay (also set in JS). */
body.voice-call-active {
  overflow: hidden;
}

/* ----- Phone overlay breakpoints ----- */
@media (max-width: 380px) {
  .phone-avatar-wrap { width: 180px; height: 180px; }
  .phone-avatar svg  { width: 130px; height: 130px; }
  .phone-name        { font-size: 26px; }
  .phone-captions    { min-height: 80px; max-height: 24vh; }
  .phone-hangup      { width: 72px; height: 72px; }
}

@media (min-width: 768px) {
  .phone-stage       { gap: 16px; max-width: 520px; }
  .phone-avatar-wrap { width: 240px; height: 240px; }
  .phone-avatar svg  { width: 180px; height: 180px; }
  .phone-name        { font-size: 34px; }
  .phone-captions    { min-height: 110px; }
}

/* Reduced motion: disable ring animations but keep static state colors. */
@media (prefers-reduced-motion: reduce) {
  .phone-avatar-wrap.is-listening .phone-avatar-ring,
  .phone-avatar-wrap.is-speaking  .phone-avatar-ring,
  .phone-avatar-wrap.is-thinking  .phone-avatar-ring {
    animation: none;
  }
}
