/* New Life Teeth - scripted voice-story prototype.
   Intentionally isolated from the existing .assistant-* component. */

:root {
  --story-night: #08140f;
  --story-forest: #10251d;
  --story-forest-2: #18382d;
  --story-cream: #f6f0e5;
  --story-mist: #bac9c2;
  --story-gold: #d8b97c;
  --story-gold-light: #f0dbad;
  --story-teal: #7bb8a8;
  --story-caller: #78a9c1;
  --story-office: #d8b97c;
  --story-line: rgba(240, 219, 173, 0.18);
  --story-glass: rgba(246, 240, 229, 0.075);
  --story-panel-radius: 24px;
}

.story-demo-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  visibility: hidden;
}

.story-demo-root.is-open {
  pointer-events: auto;
  visibility: visible;
}

.story-demo-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 8, 0.58);
  opacity: 0;
  backdrop-filter: blur(0);
  transition: opacity 480ms var(--ease-out), backdrop-filter 480ms var(--ease-out);
}

.story-demo-root.is-open .story-demo-scrim {
  opacity: 1;
  backdrop-filter: blur(7px) saturate(0.75);
}

.story-demo-panel {
  position: absolute;
  inset: 16px 16px 16px auto;
  width: min(1120px, calc(100vw - 32px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  color: var(--story-cream);
  background:
    radial-gradient(circle at 14% -12%, rgba(95, 156, 142, 0.22), transparent 34%),
    linear-gradient(145deg, #122820 0%, var(--story-night) 55%, #0c1813 100%);
  border: 1px solid rgba(240, 219, 173, 0.2);
  border-radius: var(--story-panel-radius);
  box-shadow: -28px 28px 100px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  opacity: 0;
  transform: translateX(54px) scale(0.985);
  transform-origin: right center;
  transition: transform 620ms var(--ease-out), opacity 440ms var(--ease-out), visibility 0s linear 620ms;
  visibility: hidden;
}

.story-demo-root.is-open .story-demo-panel {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.story-demo-panel:focus {
  outline: none;
}

.story-demo-head {
  min-height: 76px;
  padding: 14px 18px 14px 20px;
  display: grid;
  grid-template-columns: minmax(235px, auto) 1fr auto;
  align-items: center;
  gap: 22px;
  border-bottom: 1px solid var(--story-line);
  background: rgba(5, 15, 11, 0.5);
  backdrop-filter: blur(22px);
}

.story-demo-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-demo-brand .mark {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
}

.story-demo-brand > div,
.system-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.story-demo-kicker {
  font-size: 0.64rem;
  line-height: 1.3;
  letter-spacing: 0.155em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--story-gold);
}

.story-demo-brand-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.story-demo-disclosure {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--story-mist);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.story-demo-disclosure > span {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--story-gold);
  box-shadow: 0 0 0 4px rgba(216, 185, 124, 0.1);
}

.story-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--story-line);
  border-radius: 50%;
  background: rgba(246, 240, 229, 0.045);
  color: var(--story-cream);
  cursor: pointer;
  transition: border-color 220ms, background-color 220ms, transform 220ms;
}

.story-icon-button:hover {
  border-color: rgba(240, 219, 173, 0.65);
  background: rgba(216, 185, 124, 0.1);
  transform: rotate(4deg);
}

.story-icon-button svg {
  width: 17px;
  height: 17px;
}

.story-icon-button:focus-visible,
.story-play:focus-visible,
.story-control-link:focus-visible,
.story-journey-nav button:focus-visible {
  outline: 2px solid var(--story-gold-light);
  outline-offset: 3px;
}

.story-journey-nav {
  min-height: 56px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--story-line);
  background: rgba(6, 16, 12, 0.62);
}

.story-journey-nav button {
  position: relative;
  min-width: 0;
  min-height: 55px;
  padding: 9px 12px 8px;
  border: 0;
  border-left: 1px solid rgba(240, 219, 173, 0.09);
  color: rgba(246, 240, 229, 0.58);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 220ms, background-color 220ms;
}

.story-journey-nav button:last-child {
  border-right: 1px solid rgba(240, 219, 173, 0.09);
}

.story-journey-nav button::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--story-gold);
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 220ms, transform 220ms var(--ease-out);
}

.story-journey-nav button:hover,
.story-journey-nav button.is-active {
  color: var(--story-cream);
  background: rgba(216, 185, 124, 0.055);
}

.story-journey-nav button.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.story-journey-nav span,
.story-journey-nav small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-journey-nav span {
  font-size: 0.68rem;
  font-weight: 650;
}

.story-journey-nav small {
  margin-top: 1px;
  color: rgba(246, 240, 229, 0.38);
  font-size: 0.56rem;
}

.story-demo-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
}

.story-stage {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  padding: 20px 26px 16px;
  display: grid;
  grid-template-rows: auto minmax(250px, 1fr) 76px;
  gap: 10px;
  overflow: hidden;
  border-right: 1px solid var(--story-line);
  background:
    radial-gradient(circle at 80% 28%, rgba(123, 184, 168, 0.095), transparent 32%),
    radial-gradient(circle at 24% 65%, rgba(216, 185, 124, 0.07), transparent 31%);
}

.story-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.24;
  background-image: linear-gradient(rgba(240, 219, 173, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(240, 219, 173, 0.07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, transparent, black 16%, black 78%, transparent);
}

.story-stage-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.story-number {
  display: block;
  margin-bottom: 5px;
  color: var(--story-gold);
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.story-stage-copy h2 {
  max-width: 560px;
  font-size: clamp(1.55rem, 2.25vw, 2.65rem);
  font-weight: 300;
  line-height: 1.04;
  color: var(--story-cream);
}

.story-stage-copy h2 em {
  color: var(--story-gold-light);
}

.story-meta {
  max-width: 155px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.story-meta span {
  padding: 4px 7px;
  border: 1px solid rgba(240, 219, 173, 0.17);
  border-radius: 999px;
  background: rgba(246, 240, 229, 0.045);
  color: var(--story-mist);
  font-size: 0.61rem;
  white-space: nowrap;
}

.story-network {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(130px, 0.72fr) minmax(155px, 1fr);
  grid-template-rows: minmax(82px, 0.38fr) minmax(155px, 1fr);
  align-items: end;
  column-gap: 18px;
}

.story-phone,
.story-assistant,
.story-office {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
}

.story-phone {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
}

.story-assistant {
  grid-column: 3;
  grid-row: 2;
  justify-self: center;
}

.story-office {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  justify-self: center;
}

.phone-shell {
  position: relative;
  height: clamp(188px, 28.5vh, 228px);
  aspect-ratio: 2 / 3;
  border-radius: 27px;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.42));
  transform: perspective(800px) rotateY(2deg) rotateX(0.5deg);
  transition: transform 400ms var(--ease-out), box-shadow 400ms var(--ease-out);
}

.phone-frame-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.phone-call {
  position: absolute;
  z-index: 1;
  inset: 5.6% 7.7% 5.8%;
  padding: 0;
  color: #f7f6f0;
  background:
    radial-gradient(circle at 50% 25%, rgba(123, 184, 168, 0.28), transparent 32%),
    linear-gradient(165deg, #1c3b31 0%, #0b1712 54%, #070b09 100%);
  border-radius: 19% / 12%;
  overflow: hidden;
  transition: background 360ms var(--ease-out);
}

.phone-view {
  position: absolute;
  inset: 24px 7px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out), visibility 0s linear 260ms;
}

.story-phone[data-phone-screen="dialler"] .phone-dialler,
.story-phone[data-phone-screen="incoming"] .phone-incoming,
.story-phone[data-phone-screen="call"] .phone-connected,
.story-phone[data-phone-screen="ended"] .phone-connected {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.story-phone[data-phone-screen="ended"] .phone-wave i {
  animation: none;
  opacity: .3;
  transform: scaleY(.14);
}

.story-phone[data-phone-screen="ended"] .phone-actions,
.story-phone[data-phone-screen="ended"] .phone-end {
  opacity: .35;
}

.phone-incoming > strong {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: clamp(0.78rem, 1vw, 0.96rem);
  font-weight: 400;
}

.phone-incoming-actions {
  width: min(102px, 90%);
  margin-top: auto;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
}

.phone-incoming-actions > span {
  width: clamp(28px, 4vh, 34px);
  height: clamp(28px, 4vh, 34px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.035);
}

.phone-incoming-actions svg {
  width: 15px;
  height: 15px;
}

.phone-decline {
  background: #b34b3c;
  transform: rotate(135deg);
}

.phone-accept {
  background: #4d9c69;
  animation: story-dial-pulse 900ms ease-in-out infinite;
}

.phone-status {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.43rem, 0.6vw, 0.58rem);
  font-weight: 650;
}

.phone-label {
  color: rgba(255, 255, 255, 0.63);
  font-size: clamp(0.45rem, 0.58vw, 0.58rem);
  letter-spacing: 0.08em;
}

.caller-context {
  width: min(210px, 100%);
  margin-bottom: 5px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid rgba(120, 169, 193, 0.23);
  border-radius: 12px;
  color: var(--story-cream);
  background: rgba(120, 169, 193, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.caller-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(120, 169, 193, 0.48);
  border-radius: 50%;
  color: #d8eef8;
  background: rgba(120, 169, 193, 0.14);
  font-family: var(--font-display);
  font-size: 0.82rem;
  box-shadow: 0 0 0 5px rgba(120, 169, 193, 0.035);
}

.caller-context > div:last-child {
  min-width: 0;
  display: grid;
  gap: 0;
}

.caller-context > div:last-child > span {
  color: var(--story-caller);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.caller-context strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caller-context small {
  overflow: hidden;
  color: rgba(246, 240, 229, 0.54);
  font-size: 0.51rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-number {
  min-height: 19px;
  margin-top: 3px;
  color: #f4f7f5;
  font-size: clamp(0.72rem, 0.9vw, 0.9rem);
  font-weight: 560;
  letter-spacing: 0.025em;
  font-variant-numeric: tabular-nums;
}

.phone-number:empty::before {
  content: "Ready to dial";
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.62rem;
  font-weight: 450;
}

.phone-number-note,
.phone-called-destination {
  color: rgba(255, 255, 255, 0.45);
  font-size: clamp(0.4rem, 0.5vw, 0.5rem);
}

.phone-keypad {
  width: min(94px, 86%);
  margin-top: 3px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px 8px;
}

.phone-keypad > span {
  width: clamp(19px, 2.8vh, 23px);
  height: clamp(19px, 2.8vh, 23px);
  justify-self: center;
  display: grid;
  place-content: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.055);
  font-size: clamp(0.54rem, 0.7vw, 0.68rem);
  line-height: 0.85;
}

.phone-keypad small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.25rem;
  letter-spacing: 0.08em;
}

.phone-start,
.phone-end {
  width: clamp(24px, 3.3vh, 28px);
  height: clamp(24px, 3.3vh, 28px);
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.phone-start {
  margin-top: 3px;
  color: #f7fff9;
  background: #4d9c69;
  box-shadow: 0 0 0 5px rgba(77, 156, 105, 0.08);
}

.phone-start svg,
.phone-end svg {
  width: 14px;
  height: 14px;
}

.story-demo-root.is-dialling .phone-start {
  animation: story-dial-pulse 900ms ease-in-out infinite;
}

.phone-called-mark {
  width: clamp(38px, 5.2vh, 46px);
  height: clamp(38px, 5.2vh, 46px);
  margin: clamp(4px, 0.7vh, 6px) 0 3px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 185, 124, 0.28);
  border-radius: 50%;
  background: rgba(216, 185, 124, 0.07);
  box-shadow: 0 0 0 7px rgba(216, 185, 124, 0.025);
}

.phone-called-mark svg {
  width: 74%;
  height: 74%;
}

.phone-connected > strong {
  font-family: var(--font-display);
  font-size: clamp(0.78rem, 1vw, 0.96rem);
  font-weight: 400;
}

.call-timer {
  margin-top: 3px;
  color: var(--story-gold-light);
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.56rem, 0.7vw, 0.68rem);
  letter-spacing: 0.12em;
}

.phone-wave,
.assistant-wave,
.office-wave {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.phone-wave {
  margin-top: 2px;
}

.phone-wave i,
.assistant-wave i,
.office-wave i {
  width: 2px;
  height: 5px;
  border-radius: 4px;
  background: var(--story-gold);
  transform-origin: center;
}

.phone-actions {
  width: 100%;
  margin: 2px 0 3px;
  display: flex;
  justify-content: space-around;
  color: rgba(255, 255, 255, 0.58);
  font-size: clamp(0.42rem, 0.55vw, 0.55rem);
}

.phone-actions span {
  width: clamp(20px, 2.8vh, 24px);
  height: clamp(20px, 2.8vh, 24px);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.phone-end {
  color: #fff7f5;
  background: #b34b3c;
  transform: none;
}
.node-caption { margin-top: 8px; color: var(--story-mist); font-size: 0.67rem; letter-spacing: 0.03em; }
.node-caption b { color: var(--story-cream); font-weight: 600; }

.story-phone[data-state="speaking"] .phone-shell {
  transform: perspective(800px) rotateY(0) rotateX(0) translateY(-2px) scale(1.012);
  filter: drop-shadow(0 25px 34px rgba(0, 0, 0, 0.48)) drop-shadow(0 0 22px rgba(216, 185, 124, 0.14));
}

.story-phone[data-state="speaking"] .caller-avatar {
  animation: story-avatar-pulse 1.4s ease-in-out infinite;
}

.story-phone[data-state="emergency"] .phone-call {
  background:
    radial-gradient(circle at 50% 25%, rgba(179, 75, 60, 0.28), transparent 34%),
    linear-gradient(165deg, #3b211c 0%, #180e0c 54%, #090706 100%);
}

.story-phone[data-state="emergency"] .phone-called-mark {
  border-color: rgba(239, 143, 126, 0.62);
  color: transparent;
  background: rgba(179, 75, 60, 0.18);
  box-shadow: 0 0 0 9px rgba(179, 75, 60, 0.08);
}

.story-phone[data-state="emergency"] .phone-called-mark svg {
  display: none;
}

.story-phone[data-state="emergency"] .phone-called-mark::after {
  content: "999";
  color: #ffd9d1;
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.5vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.story-phone[data-state="emergency"] .phone-end {
  box-shadow: 0 0 0 7px rgba(179, 75, 60, 0.12);
}

.story-phone[data-state="waiting"] .phone-shell {
  opacity: 0.82;
  filter: saturate(0.58) drop-shadow(0 18px 24px rgba(0, 0, 0, 0.34));
}

.story-phone[data-state="speaking"] .phone-wave i,
.story-assistant[data-state="speaking"] .assistant-wave i,
.story-office[data-state="speaking"] .office-wave i {
  animation: story-wave 720ms ease-in-out infinite alternate;
}

.phone-wave i:nth-child(2), .assistant-wave i:nth-child(4), .office-wave i:nth-child(2) { animation-delay: -120ms !important; }
.phone-wave i:nth-child(3), .assistant-wave i:nth-child(2), .office-wave i:nth-child(4) { animation-delay: -260ms !important; }
.phone-wave i:nth-child(4), .assistant-wave i:nth-child(5), .office-wave i:nth-child(3) { animation-delay: -390ms !important; }
.phone-wave i:nth-child(5), .assistant-wave i:nth-child(3), .office-wave i:nth-child(5) { animation-delay: -180ms !important; }
.phone-wave i:nth-child(6) { animation-delay: -320ms !important; }
.phone-wave i:nth-child(7) { animation-delay: -80ms !important; }

.story-signal {
  position: absolute;
  z-index: 0;
  min-width: 0;
  height: 60px;
  display: grid;
  place-items: center;
  transform-origin: left center;
  pointer-events: none;
}

.story-signal-caller-assistant {
  left: 18%;
  bottom: 23%;
  width: 64%;
}

.story-signal-assistant-office {
  left: 50%;
  top: 6%;
  width: 36%;
  transform: rotate(31deg);
}

.story-signal-caller-office {
  left: 18%;
  top: 54%;
  width: 36%;
  transform: rotate(-31deg);
}

.story-signal svg {
  position: absolute;
  inset: -10px 0 auto;
  width: 100%;
  height: 70px;
  overflow: visible;
}

.signal-track,
.signal-live {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.signal-track { stroke: rgba(240, 219, 173, 0.13); stroke-width: 1.5; }
.signal-live { stroke: url(#nlt-grad); stroke-width: 2; stroke-dasharray: 5 8; opacity: 0; }

.signal-pulse {
  position: absolute;
  top: 22px;
  left: 0;
  width: 8px;
  height: 8px;
  border: 2px solid var(--story-gold-light);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 18px var(--story-gold);
}

.signal-copy {
  position: relative;
  top: 25px;
  padding: 3px 8px;
  border: 1px solid var(--story-line);
  border-radius: 999px;
  color: rgba(246, 240, 229, 0.47);
  background: var(--story-night);
  font-size: 0.55rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.story-signal-assistant-office .signal-copy { transform: rotate(-31deg); }
.story-signal-caller-office .signal-copy { transform: rotate(31deg); }

.story-signal:not([data-connection="idle"]):not([data-connection="hold"]) .signal-live {
  opacity: 1;
  animation: story-dash 1.1s linear infinite;
}

.story-signal-caller-assistant[data-connection="caller-to-assistant"] .signal-pulse,
.story-signal-assistant-office[data-connection="office-to-assistant"] .signal-pulse,
.story-signal-caller-office[data-connection="caller-to-office"] .signal-pulse {
  opacity: 1;
  animation: story-signal-forward 1.65s var(--ease-in-out) infinite;
}

.story-signal-caller-assistant[data-connection="assistant-to-caller"] .signal-pulse,
.story-signal-assistant-office[data-connection="assistant-to-office"] .signal-pulse,
.story-signal-caller-office[data-connection="office-to-caller"] .signal-pulse {
  opacity: 1;
  animation: story-signal-back 1.65s var(--ease-in-out) infinite;
}

.story-signal-caller-assistant[data-connection="hold"] .signal-track {
  stroke: rgba(120, 169, 193, 0.34);
  stroke-dasharray: 2 7;
}

.story-signal-caller-assistant[data-connection="hold"] .signal-copy {
  border-color: rgba(120, 169, 193, 0.28);
  color: rgba(214, 237, 247, 0.72);
}

.story-assistant {
  position: relative;
  transition: opacity 360ms var(--ease-out), filter 360ms var(--ease-out), transform 360ms var(--ease-out);
}

.assistant-halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(126px, 12vw, 164px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -55%);
  border: 1px solid rgba(123, 184, 168, 0.14);
}

.assistant-halo i {
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(216, 185, 124, 0.09);
  border-radius: 50%;
}

.assistant-halo i:nth-child(2) { inset: 25%; }
.assistant-halo i:nth-child(3) { inset: -14%; border-color: rgba(123, 184, 168, 0.07); }

.assistant-portrait {
  position: relative;
  z-index: 1;
  width: clamp(92px, 9.5vw, 122px);
  aspect-ratio: 1;
  padding: 4px;
  border: 1px solid rgba(240, 219, 173, 0.33);
  border-radius: 50%;
  background: rgba(246, 240, 229, 0.045);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.34), 0 0 0 9px rgba(123, 184, 168, 0.035);
  transition: transform 400ms var(--ease-out), box-shadow 400ms var(--ease-out);
}

.assistant-portrait img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 38%;
  filter: saturate(0.76) contrast(1.03);
}

.assistant-status {
  position: absolute;
  right: 7%;
  bottom: 10%;
  width: 13px;
  height: 13px;
  border: 3px solid var(--story-night);
  border-radius: 50%;
  background: var(--story-teal);
}

.assistant-identity {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  display: grid;
  justify-items: center;
  gap: 1px;
  text-align: center;
}

.assistant-identity strong {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 400;
}

.assistant-identity span { color: var(--story-mist); font-size: clamp(0.55rem, 0.74vw, 0.69rem); }
.assistant-wave { margin-top: 3px; }
.assistant-wave i { background: var(--story-teal); }

.story-assistant[data-state="speaking"] .assistant-portrait {
  transform: translateY(-2px) scale(1.018);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.38), 0 0 42px rgba(123, 184, 168, 0.22), 0 0 0 9px rgba(123, 184, 168, 0.055);
}

.story-assistant[data-state="speaking"] .assistant-halo { animation: story-halo-breathe 2.2s ease-in-out infinite; }

.story-assistant[data-state="dimmed"] {
  opacity: 0.34;
  filter: saturate(0.35);
  transform: scale(0.96);
}

.story-office {
  position: relative;
  opacity: 0.42;
  filter: saturate(0.58);
  transform: scale(0.94);
  transition: opacity 420ms var(--ease-out), filter 420ms var(--ease-out), transform 420ms var(--ease-out);
}

.office-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(88px, 7.5vw, 108px);
  aspect-ratio: 1;
  border: 1px solid rgba(216, 185, 124, 0.12);
  border-radius: 50%;
  transform: translate(-50%, -63%);
  opacity: 0;
}

.office-orbit i {
  position: absolute;
  inset: 14%;
  border: 1px solid rgba(123, 184, 168, 0.13);
  border-radius: 50%;
}

.office-orbit i:last-child {
  inset: -12%;
}

.office-visual {
  position: relative;
  width: clamp(104px, 9.5vw, 136px);
  aspect-ratio: 900 / 474;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.office-mark {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: clamp(58px, 5.5vw, 72px);
  aspect-ratio: 1;
  opacity: 0.36;
  transform: translate(-50%, -50%) translateY(4px) scale(0.92);
  transition:
    top 460ms var(--ease-out),
    left 460ms var(--ease-out),
    opacity 460ms var(--ease-out),
    transform 460ms var(--ease-out),
    filter 460ms var(--ease-out);
}

.office-mark > svg {
  width: 100%;
  height: 100%;
  transition: opacity 220ms;
}

.office-mark.is-3d > svg {
  opacity: 0;
}

.office-portrait {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(216, 185, 124, 0.2);
  border-radius: 16px 16px 22px 22px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px) scale(0.96);
  background:
    radial-gradient(circle at 50% 34%, rgba(216, 185, 124, 0.12), transparent 48%),
    rgba(8, 20, 15, 0.68);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transition:
    opacity 360ms var(--ease-out),
    visibility 0s linear 360ms,
    transform 420ms var(--ease-out),
    filter 360ms var(--ease-out);
  pointer-events: none;
}

.office-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter: saturate(0.82) contrast(1.03);
  transform: scale(1.3);
  transform-origin: 50% 100%;
}

.office-identity {
  position: relative;
  z-index: 1;
  width: 176px;
  max-width: 18vw;
  margin-top: 1px;
  display: grid;
  justify-items: center;
  gap: 1px;
  text-align: center;
}

.office-identity strong {
  overflow: hidden;
  max-width: 100%;
  color: var(--story-cream);
  font-family: var(--font-display);
  font-size: clamp(0.78rem, 0.9vw, 0.96rem);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.office-identity span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--story-mist);
  font-size: clamp(0.47rem, 0.54vw, 0.56rem);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.office-wave {
  margin-top: 2px;
}

.office-wave i {
  background: var(--story-gold);
}

.story-office[data-state="linked"] {
  opacity: 0.68;
  filter: saturate(0.82);
  transform: scale(0.97);
}

.story-office[data-state="ringing"],
.story-office[data-state="connected"],
.story-office[data-state="speaking"] {
  opacity: 1;
  filter: none;
  transform: none;
}

.story-office[data-state="ringing"] .office-orbit {
  opacity: 1;
  animation: story-office-ring 1.45s ease-out infinite;
}

.story-office[data-state="ringing"] .office-mark,
.story-office[data-state="connected"] .office-mark,
.story-office[data-state="speaking"] .office-mark {
  opacity: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 18px rgba(216, 185, 124, 0.17));
}

.story-office[data-portrait-mode="active"] .office-portrait,
.story-office[data-portrait-mode="standby"] .office-portrait {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.story-office[data-portrait-mode="standby"] .office-portrait {
  opacity: 0.62;
  filter: saturate(0.62);
  transform: scale(0.97);
}

.story-office[data-portrait-mode="active"] .office-mark,
.story-office[data-portrait-mode="standby"] .office-mark {
  z-index: 3;
  top: 19%;
  left: 16%;
  opacity: 0.94;
  transform: translate(-50%, -50%) scale(0.46);
  filter: drop-shadow(0 0 12px rgba(216, 185, 124, 0.3));
}

.story-office[data-portrait-mode="standby"] .office-mark {
  opacity: 0.7;
}

.story-office[data-state="dimmed"] {
  opacity: 0.22;
  filter: grayscale(1);
}

.clinic-context {
  position: relative;
  min-width: 0;
  min-height: 72px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 16px;
  border: 1px solid rgba(240, 219, 173, 0.18);
  border-radius: 13px;
  background: #14261f;
}

.clinic-context > img,
.clinic-context-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.clinic-context > img { object-fit: cover; object-position: 50% 57%; opacity: 0.38; filter: saturate(0.58) contrast(1.05); }
.clinic-context-shade { background: linear-gradient(90deg, rgba(6, 15, 11, 0.93), rgba(6, 15, 11, 0.47) 62%, rgba(6, 15, 11, 0.72)); }
.clinic-context-copy, .clinic-context-status { position: relative; z-index: 1; }
.clinic-context-copy { display: grid; line-height: 1.2; }
.clinic-context-label { color: var(--story-gold); font-size: 0.58rem; letter-spacing: 0.15em; text-transform: uppercase; }
.clinic-context-copy strong { margin-top: 2px; font-family: var(--font-display); font-size: 1.28rem; font-weight: 400; }
.clinic-context-copy > span:last-child { margin-top: 2px; color: var(--story-mist); font-size: 0.65rem; }
.clinic-context-status { align-self: center; display: flex; align-items: center; gap: 6px; color: rgba(246, 240, 229, 0.67); font-size: 0.61rem; }
.clinic-context-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--story-gold); }

.clinic-context[data-state="linked"],
.clinic-context[data-state="ringing"],
.clinic-context[data-state="connected"],
.clinic-context[data-state="speaking"] {
  border-color: rgba(216, 185, 124, 0.38);
}

.clinic-context[data-state="linked"] > img,
.clinic-context[data-state="ringing"] > img,
.clinic-context[data-state="connected"] > img,
.clinic-context[data-state="speaking"] > img {
  opacity: 0.56;
  filter: saturate(0.82) contrast(1.04);
}

.clinic-context[data-state="dimmed"] {
  opacity: 0.42;
  filter: grayscale(1);
}

.story-transcript {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(3, 10, 7, 0.32);
}

.story-transcript-head {
  min-height: 74px;
  padding: 18px 20px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--story-line);
}

.story-transcript-head h3 {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
}

.transcript-count {
  color: rgba(246, 240, 229, 0.45);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.story-transcript-list {
  min-height: 0;
  padding: 16px 20px 24px;
  overflow-y: hidden;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scrollbar-color: rgba(216, 185, 124, 0.3) transparent;
  scrollbar-width: thin;
}

.story-message {
  width: fit-content;
  max-width: 86%;
  padding: 11px 13px 12px;
  border: 1px solid var(--story-line);
  border-radius: 12px 12px 12px 3px;
  background: rgba(123, 184, 168, 0.075);
  color: rgba(246, 240, 229, 0.9);
  font-size: 0.8rem;
  line-height: 1.5;
  opacity: 0.58;
  transform: translateY(5px);
  transition: opacity 350ms, transform 350ms, border-color 350ms, background-color 350ms;
}

.story-message.is-current {
  opacity: 1;
  transform: none;
  border-color: rgba(123, 184, 168, 0.5);
  background: rgba(123, 184, 168, 0.14);
  box-shadow: inset 3px 0 0 rgba(123, 184, 168, 0.6);
}

.story-message[data-speaker="caller"] {
  align-self: flex-end;
  border-radius: 12px 12px 3px 12px;
  border-color: rgba(120, 169, 193, 0.32);
  background: rgba(78, 133, 160, 0.18);
}

.story-message[data-speaker="caller"].is-current {
  border-color: rgba(120, 169, 193, 0.62);
  background: rgba(78, 133, 160, 0.29);
  box-shadow: inset -3px 0 0 rgba(120, 169, 193, 0.72);
}

.story-message-speaker {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--story-gold);
  font-size: 0.55rem;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.story-message[data-speaker="assistant"] .story-message-speaker { color: var(--story-teal); }
.story-message[data-speaker="caller"] .story-message-speaker { color: #a9d2e5; }

.story-message-role {
  color: rgba(246, 240, 229, 0.44);
  font-size: 0.47rem;
  font-weight: 520;
  letter-spacing: 0.07em;
  text-align: right;
}

.story-message[data-speaker="office"] {
  margin-left: 24px;
  border-color: rgba(216, 185, 124, 0.24);
  background: rgba(216, 185, 124, 0.08);
  box-shadow: inset 3px 0 0 rgba(216, 185, 124, 0.32);
}

.story-message[data-speaker="office"].is-current {
  border-color: rgba(216, 185, 124, 0.54);
  background: rgba(216, 185, 124, 0.14);
  box-shadow: inset 3px 0 0 rgba(216, 185, 124, 0.72);
}

.story-transcript-empty {
  position: absolute;
  inset: 74px 0 0;
  padding: 30px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  text-align: center;
  color: rgba(246, 240, 229, 0.56);
  transition: opacity 260ms, visibility 260ms;
}

.story-transcript-empty.is-hidden { opacity: 0; visibility: hidden; }
.story-transcript-empty p { max-width: 23ch; font-size: 0.78rem; line-height: 1.55; }
.empty-orbit { position: relative; width: 54px; height: 54px; border: 1px solid rgba(216, 185, 124, 0.22); border-radius: 50%; }
.empty-orbit::before { content: ""; position: absolute; inset: 11px; border: 1px solid rgba(123, 184, 168, 0.2); border-radius: 50%; }
.empty-orbit i { position: absolute; top: 3px; left: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--story-gold); box-shadow: 0 0 14px rgba(216, 185, 124, 0.6); transform: translateX(-50%); animation: story-orbit 5s linear infinite; transform-origin: 0 24px; }

.story-demo-foot {
  position: relative;
  min-height: 104px;
  padding: 16px 20px 15px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--story-line);
  background: rgba(4, 12, 9, 0.72);
  backdrop-filter: blur(22px);
}

.story-progress {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  background: rgba(246, 240, 229, 0.07);
}

.story-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--story-teal), var(--story-gold-light));
  box-shadow: 0 0 14px rgba(216, 185, 124, 0.4);
  transition: width 320ms var(--ease-out);
}

.story-system {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.system-mark {
  position: relative;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(123, 184, 168, 0.22);
  border-radius: 12px;
  background: rgba(123, 184, 168, 0.055);
}

.system-mark span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--story-teal);
  box-shadow: 0 0 0 5px rgba(123, 184, 168, 0.08), 0 0 18px rgba(123, 184, 168, 0.46);
}

.system-mark i {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(123, 184, 168, 0.12);
  border-radius: 8px;
}

.system-mark i:last-child { inset: 13px; }
.story-demo-root.is-playing .system-mark i { animation: story-system-pulse 1.9s ease-out infinite; }
.story-demo-root.is-playing .system-mark i:last-child { animation-delay: 620ms; }
.system-copy strong { overflow: hidden; text-overflow: ellipsis; color: var(--story-cream); font-size: 0.83rem; font-weight: 550; white-space: nowrap; }
.system-copy > span:last-child { overflow: hidden; text-overflow: ellipsis; color: rgba(246, 240, 229, 0.52); font-size: 0.66rem; white-space: nowrap; }

.story-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
}

.story-play {
  min-height: 46px;
  padding: 8px 17px 8px 13px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  color: #142018;
  background: var(--story-gold-light);
  font-size: 0.76rem;
  font-weight: 680;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(216, 185, 124, 0.12);
  transition: background-color 220ms, transform 220ms, box-shadow 220ms;
}

.story-play:hover { background: #f7e6be; transform: translateY(-1px); box-shadow: 0 10px 28px rgba(216, 185, 124, 0.18); }
.play-symbol { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(14, 29, 24, 0.1); }
.play-symbol::before { content: ""; margin-left: 2px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid #142018; }
.story-demo-root.is-playing .play-symbol::before { width: 7px; height: 9px; margin: 0; border: 0; border-left: 3px solid #142018; border-right: 3px solid #142018; }

.story-control-link {
  min-height: 38px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid rgba(240, 219, 173, 0.2);
  color: rgba(246, 240, 229, 0.64);
  background: transparent;
  font-size: 0.68rem;
  cursor: pointer;
}

.story-control-link:hover { color: var(--story-gold-light); border-color: var(--story-gold); }
.story-placeholder-note { padding-left: 4px; color: rgba(246, 240, 229, 0.36); font-size: 0.58rem; white-space: nowrap; }

@keyframes story-wave { from { transform: scaleY(0.7); } to { transform: scaleY(3.3); } }
@keyframes story-dial-pulse { 0%, 100% { transform: scale(0.96); box-shadow: 0 0 0 5px rgba(77, 156, 105, 0.08); } 50% { transform: scale(1.04); box-shadow: 0 0 0 9px rgba(77, 156, 105, 0.13); } }
@keyframes story-avatar-pulse { 0%, 100% { box-shadow: 0 0 0 8px rgba(216, 185, 124, 0.035); } 50% { box-shadow: 0 0 0 13px rgba(216, 185, 124, 0.075); } }
@keyframes story-halo-breathe { 0%, 100% { opacity: 0.55; transform: translate(-50%, -55%) scale(0.96); } 50% { opacity: 1; transform: translate(-50%, -55%) scale(1.06); } }
@keyframes story-office-ring { 0% { opacity: 0.9; transform: translate(-50%, -63%) scale(0.78); } 100% { opacity: 0; transform: translate(-50%, -63%) scale(1.18); } }
@keyframes story-dash { to { stroke-dashoffset: -26; } }
@keyframes story-signal-forward { 0% { left: 0; opacity: 0; } 12%, 80% { opacity: 1; } 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes story-signal-back { 0% { left: calc(100% - 8px); opacity: 0; } 12%, 80% { opacity: 1; } 100% { left: 0; opacity: 0; } }
@keyframes story-orbit { to { transform: translateX(-50%) rotate(360deg); } }
@keyframes story-system-pulse { 0% { opacity: 0.8; transform: scale(0.72); } 100% { opacity: 0; transform: scale(1.42); } }

@media (max-width: 72em) {
  .story-demo-panel { width: calc(100vw - 28px); inset: 14px; }
  .story-demo-body { grid-template-columns: minmax(0, 1fr) 340px; }
  .story-stage { padding-inline: 24px; }
  .story-placeholder-note { display: none; }
}

@media (max-width: 56em) {
  .story-demo-panel { inset: 0; width: 100%; border: 0; border-radius: 0; }
  .story-demo-disclosure {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .story-demo-disclosure > span { display: none; }
  .story-demo-head { grid-template-columns: 1fr auto; }
  .story-demo-body { grid-template-columns: minmax(0, 1fr) 310px; }
  .story-stage { padding-inline: 18px; }
  .story-demo-foot { grid-template-columns: 1fr auto; }
  .story-journey-nav {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(145px, 1fr);
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .story-control-link {
    min-width: 44px;
    min-height: 44px;
    padding-inline: 7px;
    border: 1px solid rgba(240, 219, 173, 0.2);
    border-radius: 999px;
  }
}

@media (max-width: 45em) {
  .story-demo-panel { overflow-y: auto; display: block; background: var(--story-night); }
  .story-demo-head { position: sticky; top: 0; z-index: 5; min-height: 66px; }
  .story-journey-nav { position: sticky; top: 66px; z-index: 4; }
  .story-demo-body { display: block; }
  .story-stage { min-height: 810px; grid-template-rows: auto minmax(520px, 1fr) 76px; border-right: 0; border-bottom: 1px solid var(--story-line); }
  .story-stage-copy { align-items: flex-end; }
  .story-stage-copy h2 { font-size: 1.8rem; }
  .story-network {
    grid-template-columns: minmax(118px, 1fr) 64px minmax(92px, 1fr);
    grid-template-rows: 116px minmax(360px, 1fr);
    column-gap: 4px;
  }
  .story-signal { height: 54px; }
  .signal-copy { display: none; }
  .story-signal-caller-assistant { left: 20%; width: 61%; }
  .story-signal-assistant-office { left: 49%; top: 8%; width: 38%; transform: rotate(45deg); }
  .story-signal-caller-office { left: 17%; top: 55%; width: 38%; transform: rotate(-45deg); }
  .office-visual { width: 100px; }
  .office-identity { width: 130px; max-width: 130px; }
  .caller-context { width: 150px; }
  .phone-shell { height: 190px; }
  .story-transcript { min-height: 430px; }
  .story-demo-foot { position: sticky; bottom: 0; z-index: 5; grid-template-columns: 1fr auto; min-height: 92px; }
  .story-system .system-mark { display: none; }
  .story-controls { gap: 8px; }
}

@media (max-height: 47em) and (min-width: 45.01em) {
  .story-demo-panel { inset-block: 8px; }
  .story-demo-head { min-height: 64px; padding-block: 9px; }
  .story-stage { grid-template-rows: auto minmax(238px, 1fr) 72px; padding-block: 16px 12px; }
  .phone-shell { height: clamp(194px, 29vh, 214px); }
  .clinic-context { min-height: 68px; padding-block: 9px; }
  .story-demo-foot { min-height: 88px; padding-block: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .story-demo-root *,
  .story-demo-root *::before,
  .story-demo-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .story-demo-root { display: none !important; }
}
