:root {
  color-scheme: dark;
  --wechat-green: #07c160;
  --wechat-green-pressed: #06ad56;
  --call-red: #fa5151;
  --screen: #171c1a;
  --screen-deep: #0e1211;
  --surface: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f8f7;
  --text-secondary: rgba(247, 248, 247, 0.68);
  --text-tertiary: rgba(247, 248, 247, 0.44);
  --safe-top: max(3.2rem, env(safe-area-inset-top));
  --safe-bottom: max(1.7rem, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #cfd3d1;
  color: var(--text);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100svh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.9), transparent 32%),
    linear-gradient(145deg, #dfe3e1 0%, #bbc1be 100%);
}

button,
input,
select { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.phone-stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.iphone {
  position: relative;
  width: min(25.25rem, calc(100vw - 2rem));
  height: min(54.5rem, calc(100svh - 2rem));
  min-height: 39rem;
  padding: 0.62rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3.7rem;
  background: linear-gradient(145deg, #424745 0%, #151817 35%, #343937 100%);
  box-shadow:
    0 2rem 5rem rgba(24, 31, 28, 0.28),
    0 0.4rem 1.1rem rgba(24, 31, 28, 0.24),
    inset 0 0 0 1px rgba(0, 0, 0, 0.75),
    inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.iphone::before,
.iphone::after {
  position: absolute;
  left: -0.16rem;
  z-index: 0;
  width: 0.18rem;
  border-radius: 0.15rem 0 0 0.15rem;
  background: #747a77;
  content: "";
}

.iphone::before {
  top: 8.2rem;
  height: 3.6rem;
  box-shadow: 0 4.4rem 0 #747a77;
}

.iphone::after {
  left: auto;
  right: -0.16rem;
  top: 10.7rem;
  height: 5.3rem;
  border-radius: 0 0.15rem 0.15rem 0;
}

.call-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 3.08rem;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 28%, rgba(79, 100, 88, 0.34), transparent 34%),
    radial-gradient(circle at 24% 84%, rgba(7, 193, 96, 0.08), transparent 30%),
    linear-gradient(180deg, #252c29 0%, var(--screen) 45%, var(--screen-deep) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.call-shell::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 3.5rem 3.5rem;
  mask-image: linear-gradient(to bottom, #000, transparent 62%);
  content: "";
}

.dynamic-island {
  position: absolute;
  z-index: 20;
  top: 0.72rem;
  left: 50%;
  width: 7.8rem;
  height: 2.25rem;
  border-radius: 999px;
  background: #030504;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.025);
  pointer-events: none;
}

.dynamic-island::after {
  position: absolute;
  top: 0.63rem;
  right: 0.62rem;
  width: 0.42rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #223f5f, #07101a 72%);
  content: "";
}

.ios-status-bar {
  position: absolute;
  z-index: 15;
  top: 0;
  left: 0;
  width: 100%;
  height: 3.8rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.05rem 1.6rem 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.ios-status-time {
  min-width: 3rem;
  text-align: center;
}

.ios-status-icons {
  display: flex;
  align-items: center;
  gap: 0.34rem;
}

.ios-signal {
  width: 1rem;
  height: 0.7rem;
  display: flex;
  align-items: flex-end;
  gap: 0.11rem;
}

.ios-signal i {
  width: 0.14rem;
  border-radius: 0.1rem;
  background: currentColor;
}

.ios-signal i:nth-child(1) { height: 0.25rem; }
.ios-signal i:nth-child(2) { height: 0.38rem; }
.ios-signal i:nth-child(3) { height: 0.52rem; }
.ios-signal i:nth-child(4) { height: 0.66rem; }

.ios-wifi {
  position: relative;
  width: 0.95rem;
  height: 0.68rem;
  overflow: hidden;
}

.ios-wifi::before,
.ios-wifi::after {
  position: absolute;
  left: 50%;
  border: 0.11rem solid currentColor;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  content: "";
  transform: translateX(-50%) rotate(-45deg);
}

.ios-wifi::before {
  top: 0;
  width: 0.72rem;
  height: 0.72rem;
}

.ios-wifi::after {
  top: 0.28rem;
  width: 0.3rem;
  height: 0.3rem;
}

.ios-battery {
  position: relative;
  width: 1.35rem;
  height: 0.65rem;
  padding: 0.08rem;
  border: 0.08rem solid rgba(255, 255, 255, 0.78);
  border-radius: 0.2rem;
}

.ios-battery::before {
  display: block;
  width: 78%;
  height: 100%;
  border-radius: 0.09rem;
  background: currentColor;
  content: "";
}

.ios-battery::after {
  position: absolute;
  top: 0.13rem;
  right: -0.18rem;
  width: 0.1rem;
  height: 0.24rem;
  border-radius: 0 0.08rem 0.08rem 0;
  background: rgba(255, 255, 255, 0.6);
  content: "";
}

.active-call {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "header"
    "caller"
    "privacy"
    "trial"
    "recovery"
    "controls";
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
  gap: 0.72rem;
  padding: var(--safe-top) 1.45rem var(--safe-bottom);
}

.call-header {
  grid-area: header;
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.18rem;
}

.eyebrow {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 550;
  letter-spacing: 0.08em;
}

.call-header .eyebrow {
  position: absolute;
  left: 1.45rem;
}

.brand-link,
.don-profile,
.skill-credit,
.privacy-note a,
.ended-credits a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.16em;
}

.brand-link:hover,
.don-profile:hover,
.skill-credit:hover,
.privacy-note a:hover,
.ended-credits a:hover { text-decoration: underline; }

.duration {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.caller {
  grid-area: caller;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: translateY(-1.2rem);
}

.avatar {
  position: relative;
  isolation: isolate;
  width: clamp(7rem, 31vw, 8.4rem);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.22), transparent 19%),
    linear-gradient(145deg, #597263 0%, #2b3a32 48%, #152019 100%);
  box-shadow:
    0 1.45rem 3.5rem rgba(0, 0, 0, 0.34),
    inset 0 0 0 0.3rem rgba(255, 255, 255, 0.035);
  transform: translateZ(0);
  will-change: transform;
}

.avatar::before {
  position: absolute;
  z-index: 0;
  inset: -0.35rem;
  padding: 0.12rem;
  border-radius: inherit;
  opacity: 0;
  background: conic-gradient(
    from 0deg,
    rgba(104, 236, 163, 0.08),
    rgba(104, 236, 163, 0.86),
    rgba(255, 255, 255, 0.16),
    rgba(104, 236, 163, 0.08)
  );
  content: "";
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.avatar::after {
  position: absolute;
  inset: -0.45rem;
  border: 1px solid rgba(7, 193, 96, 0.44);
  border-radius: inherit;
  opacity: 0;
  content: "";
}

.avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
  object-position: 50% 44%;
}

[data-state="connected"] .avatar,
[data-state="listening"] .avatar {
  animation: avatar-breathe 3.4s ease-in-out infinite;
}

[data-state="thinking"] .avatar {
  animation: avatar-thinking 2.4s ease-in-out infinite;
}

[data-state="speaking"] .avatar {
  animation: avatar-speaking 1.15s ease-in-out infinite;
}

[data-state="thinking"] .avatar::before,
[data-state="speaking"] .avatar::before {
  opacity: 1;
  animation: avatar-orbit 3.2s linear infinite;
}

.identity-note {
  order: 4;
  margin: 0.65rem 0 0;
  color: rgba(133, 229, 176, 0.88);
  font-size: 0.66rem;
  font-weight: 520;
  letter-spacing: 0.04em;
}

.don-profile {
  margin-top: 0.38rem;
  color: rgba(232, 239, 235, 0.62);
  font-size: 0.69rem;
  font-weight: 520;
  letter-spacing: 0.015em;
}

.skill-credit {
  margin-top: 0.5rem;
  padding: 0.35rem 0.68rem;
  border: 1px solid rgba(126, 226, 169, 0.16);
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.055);
  color: rgba(165, 232, 194, 0.7);
  font-size: 0.64rem;
  line-height: 1;
}

h1,
h2,
p { text-wrap: pretty; }

h1,
h2 {
  margin: 0;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 12ch;
  font-size: clamp(1.75rem, 7.5vw, 2.2rem);
  font-weight: 630;
  line-height: 1.12;
}

.call-status {
  min-height: 1.4em;
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
}

.sound-wave {
  height: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  opacity: 0.16;
}

.sound-wave i {
  width: 0.17rem;
  height: 0.35rem;
  border-radius: 99px;
  background: #6de5a4;
  transform-origin: center;
}

[data-state="requesting_permission"] .avatar::after,
[data-state="connecting"] .avatar::after {
  opacity: 1;
  animation: call-ring 1.7s ease-out infinite;
}

[data-state="listening"] .sound-wave,
[data-state="thinking"] .sound-wave,
[data-state="speaking"] .sound-wave { opacity: 1; }

[data-state="listening"] .sound-wave i,
[data-state="speaking"] .sound-wave i {
  animation: voice-wave 0.9s ease-in-out infinite alternate;
}

.sound-wave i:nth-child(2),
.sound-wave i:nth-child(4) { animation-delay: -0.3s; }
.sound-wave i:nth-child(3) { animation-delay: -0.6s; }

[data-state="thinking"] .sound-wave i {
  animation: thinking 1.1s ease-in-out infinite;
}

.privacy-note {
  grid-area: privacy;
  max-width: 30rem;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.61rem;
  line-height: 1.45;
  text-align: center;
}

.privacy-note a {
  display: inline-block;
  margin-left: 0.36rem;
  color: rgba(255, 255, 255, 0.25);
}

.trial-notice {
  grid-area: trial;
  min-height: 1rem;
  margin: 0;
  color: rgba(255, 222, 126, 0.76);
  font-size: 0.65rem;
  line-height: 1.35;
  text-align: center;
}

.sound-recovery {
  grid-area: recovery;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.call-controls {
  grid-area: controls;
  min-height: 6.2rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(1.35rem, 7vw, 2rem);
}

.control-item {
  min-width: 4.3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.control-button {
  position: relative;
  width: 4.2rem;
  height: 4.2rem;
  flex: 0 0 4.2rem;
  box-sizing: border-box;
  padding: 0;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.control-icon {
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 1.55rem;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.control-label {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  width: 6rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.7rem;
  font-weight: 450;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.control-button:active:not(:disabled) { transform: scale(0.93); }

.control-button:focus-visible,
.sound-recovery:focus-visible,
.memory-controls button:focus-visible,
.ended-call button:focus-visible,
.api-credentials button:focus-visible,
.api-credentials input:focus-visible,
.api-credentials select:focus-visible {
  outline: 0.16rem solid rgba(99, 230, 158, 0.92);
  outline-offset: 0.2rem;
}

.control-button[aria-pressed="true"] { background: #f2f4f3; }

.control-button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

#mute-button .control-icon {
  background-image: url("./icons/microphone-muted.svg");
}

#mute-button[aria-pressed="true"] .control-icon { filter: invert(1); }

#output-button .control-icon {
  background-image: url("./icons/speaker.svg");
}

.call-button,
.credential-submit { background: var(--wechat-green); }

.call-button .control-icon,
.hangup-button .control-icon {
  background-image: url("./icons/phone.svg");
}

.hangup-button { background: var(--call-red); }
.hangup-button .control-icon { transform: rotate(135deg); }

.control-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

[data-state="idle"] .control-item:not(.call-item),
[data-state="error"] .control-item:not(.call-item) { display: none; }

[data-state="requesting_permission"] .call-item,
[data-state="connecting"] .call-item,
[data-state="connected"] .call-item,
[data-state="listening"] .call-item,
[data-state="thinking"] .call-item,
[data-state="speaking"] .call-item,
[data-state="ending"] .call-item,
[data-state="ended"] .call-item { display: none; }

.memory-controls {
  position: absolute;
  z-index: 8;
  right: 1.25rem;
  bottom: calc(var(--safe-bottom) + 10.9rem);
  left: 1.25rem;
  display: grid;
  justify-items: center;
  gap: 0.24rem;
  color: var(--text-tertiary);
  font-size: 0.62rem;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}

.memory-controls p {
  min-height: 0.9rem;
  margin: 0;
}

.memory-controls strong { color: rgba(255, 255, 255, 0.7); }

.memory-controls button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.66rem;
  cursor: pointer;
  pointer-events: auto;
}

#show-credentials-button {
  min-height: 2.2rem;
  margin-bottom: 0.05rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.7rem;
  text-decoration: none;
  backdrop-filter: blur(0.9rem);
}

#clear-memory-button {
  padding: 0.2rem;
  text-decoration: underline;
  text-underline-offset: 0.16rem;
}

.memory-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

[data-state="requesting_permission"] .memory-controls,
[data-state="connecting"] .memory-controls,
[data-state="connected"] .memory-controls,
[data-state="listening"] .memory-controls,
[data-state="thinking"] .memory-controls,
[data-state="speaking"] .memory-controls,
[data-state="ending"] .memory-controls,
[data-state="ended"] .memory-controls {
  opacity: 0;
  pointer-events: none;
}

.ended-call {
  height: 100%;
  overflow-y: auto;
  padding: calc(var(--safe-top) + 2.1rem) 1.35rem calc(var(--safe-bottom) + 1rem);
  scrollbar-width: none;
}

.ended-call::-webkit-scrollbar,
.api-credentials::-webkit-scrollbar { display: none; }

.ended-call .eyebrow { color: rgba(133, 229, 176, 0.74); }

.ended-call h2 {
  margin-top: 0.55rem;
  font-size: 2.15rem;
  font-weight: 650;
}

.ended-call > p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.55;
}

.call-again-button,
.share-card-button {
  width: 100%;
  min-height: 3rem;
  border-radius: 0.85rem;
  font-weight: 620;
  cursor: pointer;
}

.call-again-button {
  margin-top: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #eef1ef;
}

.share-section {
  margin: 1.25rem 0 0.8rem;
  padding: 1rem;
  border: 1px solid rgba(125, 230, 170, 0.2);
  border-radius: 1.15rem;
  background: rgba(7, 193, 96, 0.045);
}

.share-heading h3 {
  margin: 0.18rem 0 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.share-heading > p {
  margin: 0.5rem 0 0.85rem;
  color: var(--text-tertiary);
  font-size: 0.64rem;
  line-height: 1.5;
}

.share-kicker {
  color: rgba(119, 226, 165, 0.72);
  font-size: 0.61rem;
  font-weight: 620;
  letter-spacing: 0.045em;
}

.share-card-image {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.8rem;
  background: #101814;
  box-shadow: 0 0.8rem 2.5rem rgba(0, 0, 0, 0.22);
  -webkit-touch-callout: default;
  user-select: none;
}

.share-card-image[hidden] { display: none; }

.share-card-canvas {
  display: none;
}

.share-invitation {
  margin: 0.8rem 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.5;
}

.share-card-button {
  border: 0;
  background: var(--wechat-green);
  color: #07140d;
}

.share-card-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.share-feedback {
  min-height: 1em;
  margin: 0.5rem 0 0;
  color: rgba(168, 231, 195, 0.76);
  font-size: 0.66rem;
  text-align: center;
}

.ended-credits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.35rem 0 1.2rem;
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.6rem;
}

.api-credentials {
  position: absolute;
  z-index: 40;
  inset: 4.3rem 0 0;
  overflow-y: auto;
  padding: 1.25rem 1.25rem calc(var(--safe-bottom) + 1rem);
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 1.85rem 1.85rem 0 0;
  background: rgba(30, 35, 33, 0.96);
  box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(1.5rem) saturate(120%);
  scrollbar-width: none;
  animation: sheet-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.api-credentials::before {
  width: 2.4rem;
  height: 0.26rem;
  display: block;
  margin: -0.45rem auto 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  content: "";
}

.api-credentials h2 {
  margin-top: 0.35rem;
  font-size: 1.5rem;
  font-weight: 650;
}

.api-credentials > p,
.credential-privacy,
.credential-storage-status,
#credential-feedback {
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.52;
}

.api-credentials form {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.api-credentials label {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 560;
}

.api-credentials input,
.api-credentials select {
  width: 100%;
  min-height: 2.9rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 0.76rem;
  background: rgba(0, 0, 0, 0.2);
  color: #f7f8f7;
  padding: 0.7rem 0.8rem;
  font: 0.75rem/1.3 ui-monospace, "SFMono-Regular", Menlo, monospace;
}

.api-credentials select { appearance: none; }

.credential-field {
  display: grid;
  gap: 0.5rem;
}

.credential-field p {
  margin: -0.15rem 0 0.1rem;
  color: var(--text-tertiary);
  font-size: 0.63rem;
  line-height: 1.45;
}

.credential-remember {
  min-height: 2.2rem;
  display: flex;
  align-items: center;
  gap: 0.62rem;
  cursor: pointer;
}

.api-credentials .credential-remember input {
  width: 1.05rem;
  min-height: 1.05rem;
  margin: 0;
  padding: 0;
  accent-color: var(--wechat-green);
}

.credential-privacy,
.credential-storage-status { margin: 0; }

.credential-diagnose,
.credential-submit,
.credential-clear,
.credential-cancel {
  min-height: 2.9rem;
  border-radius: 0.8rem;
  font-weight: 620;
  cursor: pointer;
}

.credential-diagnose {
  margin-top: 0.3rem;
  border: 1px solid rgba(99, 230, 158, 0.34);
  background: rgba(7, 193, 96, 0.08);
  color: #bdf4d4;
}

.credential-diagnostic {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgba(0, 0, 0, 0.18);
}

.credential-diagnostic p {
  margin: 0;
  color: #edf0ee;
  font-size: 0.72rem;
  line-height: 1.5;
}

.credential-diagnostic ol {
  display: grid;
  gap: 0.28rem;
  margin: 0.55rem 0;
  padding: 0;
  list-style: none;
}

.credential-diagnostic li {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.68rem;
}

.credential-diagnostic li::before {
  width: 1.2rem;
  display: inline-block;
  content: "·";
}

.credential-diagnostic li[data-state="running"] { color: #f2d37d; }
.credential-diagnostic li[data-state="running"]::before { content: "…"; }
.credential-diagnostic li[data-state="passed"] { color: #8be7b2; }
.credential-diagnostic li[data-state="passed"]::before { content: "✓"; }
.credential-diagnostic li[data-state="failed"] { color: #ff9e9e; }
.credential-diagnostic li[data-state="failed"]::before { content: "×"; }

.credential-diagnostic small {
  color: var(--text-tertiary);
  font-size: 0.61rem;
}

.credential-submit {
  margin-top: 0.4rem;
  border: 0;
  color: #06140d;
}

.credential-cancel,
.credential-clear {
  border: 1px solid var(--line);
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}

.credential-cancel { border-color: transparent; }

.credential-clear:disabled,
.credential-diagnose:disabled,
.credential-submit:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.home-indicator {
  position: absolute;
  z-index: 60;
  bottom: 0.42rem;
  left: 50%;
  width: 8.1rem;
  height: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  transform: translateX(-50%);
  pointer-events: none;
}

[hidden] { display: none !important; }

@keyframes voice-wave { to { transform: scaleY(3.5); } }

@keyframes thinking {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 1; }
}

@keyframes call-ring {
  0% { opacity: 0.66; transform: scale(0.96); }
  100% { opacity: 0; transform: scale(1.18); }
}

@keyframes avatar-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes avatar-thinking {
  0%, 100% { transform: scale(0.99); }
  50% { transform: scale(1.025); }
}

@keyframes avatar-speaking {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 1.45rem 3.5rem rgba(0, 0, 0, 0.34), 0 0 0 rgba(7, 193, 96, 0);
  }
  50% {
    transform: scale(1.075);
    box-shadow: 0 1.65rem 4rem rgba(0, 0, 0, 0.38), 0 0 2.25rem rgba(7, 193, 96, 0.2);
  }
}

@keyframes avatar-orbit {
  to { transform: rotate(1turn); }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(1.25rem); }
}

[data-state="ending"] .call-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.5rem);
  transition: opacity 120ms ease, transform 120ms ease;
}

@media (max-width: 37.5rem) {
  body { background: var(--screen-deep); }

  .phone-stage {
    display: block;
    padding: 0;
  }

  .iphone {
    width: 100%;
    height: 100svh;
    min-height: 35rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .iphone::before,
  .iphone::after { display: none; }

  .call-shell { border-radius: 0; }

  .dynamic-island {
    top: max(0.6rem, calc(env(safe-area-inset-top) - 2.15rem));
  }

  .ios-status-bar {
    padding-top: max(1rem, calc(env(safe-area-inset-top) - 1.8rem));
  }

  .home-indicator {
    bottom: max(0.35rem, calc(env(safe-area-inset-bottom) - 0.75rem));
  }
}

@media (max-height: 43rem) {
  .active-call {
    gap: 0.35rem;
    padding-top: 3.1rem;
  }

  .caller { transform: translateY(-0.2rem); }

  .avatar {
    width: 5.8rem;
    margin-bottom: 0.75rem;
  }

  .privacy-note { display: none; }

  .memory-controls { bottom: 6.2rem; }

  .call-controls { min-height: 5.7rem; }

  .control-button {
    width: 3.75rem;
    height: 3.75rem;
    flex-basis: 3.75rem;
  }
}

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