:root {
  color-scheme: dark;
  --background: #120f0f;
  --surface: rgba(61, 45, 41, 0.62);
  --surface-strong: rgba(73, 53, 48, 0.86);
  --label: #fff8f3;
  --secondary-label: #d9c7bd;
  --tertiary-label: #a89287;
  --accent: #d99573;
  --accent-strong: #f0b18f;
  --danger: #ff8278;
  --hairline: rgba(255, 231, 216, 0.14);
  --body-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--label);
  font-family: var(--body-font);
  font-size: 17px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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

.call-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(260px, 0.9fr) minmax(120px, 1fr) auto;
  min-height: 100svh;
  max-width: 540px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(218, 142, 105, 0.18), transparent 34%),
    linear-gradient(180deg, #2a201e 0%, #171212 58%, #100d0e 100%);
}

.ambient {
  position: absolute;
  z-index: -1;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .16;
  pointer-events: none;
}
.ambient-one { top: -150px; right: -80px; background: #e9a27f; }
.ambient-two { left: -180px; bottom: 10%; background: #9c5f55; }

.call-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 12px;
}

.call-identity { text-align: center; }
.eyebrow {
  margin: 0 0 2px;
  color: var(--secondary-label);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: 1.18rem; font-weight: 650; letter-spacing: -.01em; }

.icon-button, .send-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  cursor: pointer;
}

svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-off { display: none; }
#soundButton[aria-pressed="false"] .sound-on { display: none; }
#soundButton[aria-pressed="false"] .sound-off { display: block; }

.presence { display: grid; place-content: center; justify-items: center; min-height: 260px; }
.halo { position: relative; display: grid; place-items: center; width: 172px; height: 172px; margin-bottom: 22px; }
.halo-ring, .halo-core { position: absolute; border-radius: 50%; }
.halo-ring { inset: 0; border: 1px solid rgba(247, 187, 153, .28); }
.ring-two { inset: 15px; border-color: rgba(247, 187, 153, .18); }
.halo-core {
  inset: 31px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
  background:
    radial-gradient(circle at 34% 24%, rgba(255,245,235,.42), transparent 25%),
    linear-gradient(145deg, rgba(238, 171, 135, .9), rgba(128, 72, 65, .88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 28px 80px rgba(173, 91, 68, .3);
}
.monogram { font-size: 2rem; font-weight: 650; text-shadow: 0 2px 16px rgba(0,0,0,.25); }
.status { margin: 0; font-size: 1rem; font-weight: 600; }
.timer { margin: 7px 0 0; color: var(--tertiary-label); font-size: .78rem; font-variant-numeric: tabular-nums; }

.halo.listening .ring-one { animation: listen 1.5s ease-out infinite; }
.halo.listening .ring-two { animation: listen 1.5s .32s ease-out infinite; }
.halo.thinking .halo-core { animation: breathe 1.25s ease-in-out infinite alternate; }
.halo.speaking .halo-core { animation: speak .72s ease-in-out infinite alternate; }

.transcript-panel {
  min-height: 0;
  margin: 0 2px 14px;
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--hairline);
  border-radius: 24px;
  background: rgba(31, 23, 23, .56);
  scrollbar-width: thin;
  transition: opacity .25s, transform .25s, min-height .25s;
}
.transcript-panel.collapsed { min-height: 0; height: 0; margin: 0; padding: 0; border: 0; opacity: 0; transform: translateY(-8px); overflow: hidden; }
.empty-state { display: grid; place-items: center; min-height: 88px; color: var(--tertiary-label); font-size: .84rem; }
.empty-state p { margin: 4px 0 0; }
.quiet-mark { letter-spacing: .2em; font-weight: 700; }
.messages { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.message { max-width: 86%; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }
.bubble { margin: 0; padding: 11px 14px; border-radius: 18px; line-height: 1.48; font-size: .94rem; overflow-wrap: anywhere; }
.user .bubble { border-bottom-right-radius: 6px; color: #321c17; background: var(--accent-strong); }
.assistant .bubble { border: 1px solid var(--hairline); border-bottom-left-radius: 6px; background: var(--surface-strong); }
.message-meta { display: block; margin: 5px 5px 0; color: var(--tertiary-label); font-size: .69rem; }
.user .message-meta { text-align: right; }

.composer { position: relative; }
.text-composer {
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 5px 5px 5px 16px;
  border: 1px solid var(--hairline);
  border-radius: 28px;
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}
.text-composer input { min-width: 0; height: 44px; padding: 0; border: 0; outline: 0; color: var(--label); background: transparent; }
.text-composer input::placeholder { color: var(--tertiary-label); }
.send-button { border: 0; color: #321b16; background: var(--accent-strong); }
.send-button:disabled { opacity: .45; cursor: default; }

.hold-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 8px 20px;
  border: 1px solid rgba(240, 177, 143, .34);
  border-radius: 28px;
  color: var(--accent-strong);
  background: rgba(133, 78, 65, .3);
  font-weight: 650;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.hold-button.recording { transform: scale(.975); color: #321b16; background: var(--accent-strong); }
.hold-button.canceling { color: white; background: rgba(255, 112, 107, .72); border-color: rgba(255, 112, 107, .9); }
.mic-symbol { display: grid; place-items: center; }
.hold-hint { margin: 8px 0 0; color: var(--tertiary-label); text-align: center; font-size: .72rem; }

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100% - 36px);
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  color: var(--label);
  background: rgba(57, 42, 40, .96);
  box-shadow: 0 18px 50px rgba(0,0,0,.36);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 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; }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(240, 177, 143, .94); outline-offset: 3px; }
button:active { transform: scale(.96); }

@keyframes listen { 0% { transform: scale(.74); opacity: .75; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes breathe { to { transform: scale(1.055); filter: brightness(1.12); } }
@keyframes speak { to { transform: scale(1.075); box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 22px 90px rgba(224, 133, 96, .42); } }

@media (min-width: 700px) {
  body { display: grid; place-items: center; padding: 28px; background: #0b0909; }
  .call-shell { width: min(100%, 470px); min-height: min(860px, calc(100svh - 56px)); max-height: 900px; border: 1px solid rgba(255,255,255,.12); border-radius: 42px; box-shadow: 0 40px 120px rgba(0,0,0,.55); }
}

@media (prefers-reduced-transparency: reduce) {
  .icon-button, .text-composer, .transcript-panel { background: #3c2c29; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --secondary-label: #e1e6ee; --tertiary-label: #c0c8d4; --hairline: rgba(255,255,255,.4); }
}

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

@media (max-height: 690px) {
  .call-shell { grid-template-rows: auto minmax(210px, .8fr) minmax(90px, 1fr) auto; }
  .presence { min-height: 210px; }
  .halo { width: 132px; height: 132px; margin-bottom: 12px; }
  .halo-core { inset: 25px; }
}
