/* BeepSweep public voice-demo — self-contained, on-brand (obsidian tokens), embeddable.
   DARK is the default — matches beepsweep.com (obsidian / graphite / amber).
   ?theme=light forces the light Hearth skin.
   ?embed=1 → JS adds html.embed, hiding site chrome for seamless iframe use.
   Layout = viewport-height app-shell: only the live transcript (or summary) scrolls
   internally. Document never scrolls in embed mode — iOS scroll-trap fix. */

/* ── Design tokens (dark = default) ────────────────────────────────────────── */
:root {
  --bg:        #0c0e15;
  --surf:      #141824;
  --surf-2:    #1c2130;
  --txt:       #f3f1eb;
  --txt-2:     #aaa493;
  --txt-3:     #928b79;
  --hair:      rgba(243,241,235,.10);
  --hair2:     rgba(243,241,235,.05);
  --amber:     #f2a338;
  --amber-d:   #d6871c;
  --amber-ink: #231a08;
  --amber-text:#f2a338;
  --ok:        #8fb89e;  --ok-bg:   rgba(143,184,158,.13);
  --warn:      #d98e80;  --warn-bg: rgba(217,142,128,.14);
  --shadow:    0 1px 2px rgba(0,0,0,.45), 0 22px 44px -28px rgba(0,0,0,.75);
  /* legacy aliases — keep existing selectors working */
  --surf2: var(--surf-2);
  --txt2:  var(--txt-2);
  --txt3:  var(--txt-3);
  --ink:   var(--amber-ink);
}

[data-theme='light'] {
  --bg: #f3f1eb; --surf: #fbfaf6; --surf-2: #fff;
  --txt: #181a1f; --txt-2: #6f6e68; --txt-3: #8a887f;
  --amber-text: #8c5a00; --amber-d: #c9801a; --amber-ink: #fff8ee;
  --hair: #e7e3da; --hair2: #eeebe3;
  --ok: #4e7a5a; --ok-bg: rgba(94,140,106,.16);
  --warn: #b07a1e; --warn-bg: rgba(242,163,56,.18);
  --shadow: 0 1px 2px rgba(20,16,8,.05), 0 22px 44px -28px rgba(20,16,8,.45);
  --surf2: var(--surf-2); --txt2: var(--txt-2); --txt3: var(--txt-3); --ink: var(--amber-ink);
}

[data-theme='dark'] {
  --bg: #0c0e15; --surf: #141824; --surf-2: #1c2130;
  --txt: #f3f1eb; --txt-2: #aaa493; --txt-3: #928b79;
  --amber-text: #f2a338; --amber-d: #d6871c; --amber-ink: #231a08;
  --hair: rgba(243,241,235,.10); --hair2: rgba(243,241,235,.05);
  --ok: #8fb89e; --ok-bg: rgba(143,184,158,.13);
  --warn: #d98e80; --warn-bg: rgba(217,142,128,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 22px 44px -28px rgba(0,0,0,.75);
  --surf2: var(--surf-2); --txt2: var(--txt-2); --txt3: var(--txt-3); --ink: var(--amber-ink);
}

/* ── Reset & base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ── App-shell ─────────────────────────────────────────────────────────────── */
.demo {
  max-width: 1040px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 2.4vw, 20px) clamp(12px, 3vw, 22px) 16px;
}

/* ── Header & brand ────────────────────────────────────────────────────────── */
.d-head {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; }
.mark { width: 28px; height: 28px; display: inline-flex; color: var(--txt); }
.mark svg { width: 100%; height: 100%; display: block; }
.wm {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px; font-weight: 700; letter-spacing: -0.04em;
}
.wm b { font-weight: 700; }
.wm i { font-weight: 500; font-style: normal; color: var(--txt-2); }
.tagline {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.17em; text-transform: uppercase;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}

/* ── Intro ─────────────────────────────────────────────────────────────────── */
.intro { flex-shrink: 0; text-align: center; margin: 2px auto 12px; max-width: 600px; }
.intro h1 {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: clamp(20px, 3.6vw, 28px); line-height: 1.14;
  letter-spacing: -0.04em; margin: 0 0 6px;
}
.intro p { color: var(--txt-2); font-size: clamp(13px, 2.2vw, 15px); line-height: 1.45; margin: 0; }

/* ── Controls (language / voice / tone) ────────────────────────────────────── */
.controls {
  flex-shrink: 0; width: 100%; max-width: 660px; margin: 0 auto 10px;
  background: var(--surf); border: 1px solid var(--hair); border-radius: 14px;
}
.ctrl { display: flex; align-items: center; gap: 10px; padding: 6px 12px; }
.ctrl + .ctrl { border-top: 1px solid var(--hair); }
.ctrl-l {
  flex-shrink: 0; width: 50px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.17em;
  text-transform: uppercase; color: var(--txt-3);
}
.seg { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.seg-opt {
  appearance: none; border: 1px solid var(--hair);
  background: var(--surf-2); color: var(--txt);
  font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
  padding: 5px 9px; border-radius: 8px; line-height: 1;
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px;
  transition: border-color .14s cubic-bezier(.2,.7,.2,1),
              background .14s cubic-bezier(.2,.7,.2,1),
              color .14s cubic-bezier(.2,.7,.2,1);
}
.seg-opt:hover { background: color-mix(in srgb, var(--txt) 6%, var(--surf-2)); }
.seg-opt[aria-pressed='true'] {
  background: color-mix(in srgb, var(--amber) 16%, var(--surf-2));
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  color: var(--amber-text);
}
.seg-lang .seg-opt { min-width: 36px; justify-content: center; font-weight: 800; letter-spacing: 0.03em; padding: 6px; }
.seg-opt .sub { font-size: 10.5px; font-weight: 600; color: var(--txt-3); }
.seg-opt[aria-pressed='true'] .sub { color: var(--amber-text); }
.seg-opt .star { color: var(--amber); font-size: 10px; }
.seg-opt .vg { width: 14px; height: 14px; flex: 0 0 auto; opacity: 0.75; }
.seg-opt[aria-pressed='true'] .vg { opacity: 1; }
.demo[data-state='live'] .controls { opacity: 0.5; pointer-events: none; }

/* Collapse landing chrome during a call */
.demo[data-state='connecting'] .intro, .demo[data-state='live'] .intro,
.demo[data-state='ending'] .intro,    .demo[data-state='ended'] .intro,
.demo[data-state='connecting'] .controls, .demo[data-state='live'] .controls,
.demo[data-state='ending'] .controls, .demo[data-state='ended'] .controls { display: none; }
.demo[data-state='ended'] .stage { display: none; }
/* During a call: strict one-viewport shell; only transcript scrolls */
.demo[data-state='connecting'], .demo[data-state='live'],
.demo[data-state='ending'],     .demo[data-state='ended'] {
  height: 100dvh; min-height: 0; overflow: hidden;
}

/* ── Stage ──────────────────────────────────────────────────────────────────── */
.stage {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 14px; align-items: stretch;
}
.panel {
  background: var(--surf); border: 1px solid var(--hair);
  border-radius: 22px; box-shadow: var(--shadow); min-height: 0;
}
.call {
  padding: 20px 18px 16px; display: flex; flex-direction: column;
  align-items: center; text-align: center; justify-content: center;
}

/* ── Orb (the speak button) ────────────────────────────────────────────────── */
.orb-wrap {
  position: relative; width: min(46vw, 188px); aspect-ratio: 1; margin: 4px auto;
  display: grid; place-items: center;
}
.orb-rings { display: none; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.orb {
  position: relative; width: 100%; height: 100%; border-radius: 999px; border: none; cursor: pointer;
  padding: 0; background: transparent; display: grid; place-items: center;
  min-width: 44px; min-height: 44px;
}
.orb-core {
  --level: 0;
  width: 100%; height: 100%; display: grid; place-items: center;
  transition: transform .15s cubic-bezier(.2,.7,.2,1);
}
.orb:hover .orb-core { transform: scale(1.05); }
.orb:active .orb-core { transform: scale(0.97); }
/* Amber glow on hover — site's signature effect */
.orb:hover { filter: drop-shadow(0 0 22px color-mix(in srgb, var(--amber) 40%, transparent)); }
.orb-core .mark-lg { width: 100%; height: 100%; color: var(--txt); }
.orb-core .mark-lg .dot {
  fill: var(--amber);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--amber) 60%, transparent));
  transform-box: fill-box; transform-origin: center;
  transition: transform .07s ease-out;
}
.demo[data-state='live'] .orb-core .mark-lg .dot {
  transform: scale(calc(1 + var(--level) * 0.95));
}
@media (prefers-reduced-motion: no-preference) {
  .demo[data-state='idle'] .orb-core .mark-lg .dot,
  .demo:not([data-state]) .orb-core .mark-lg .dot { animation: dotpulse 2.4s ease-in-out infinite; }
}
@keyframes dotpulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 5px color-mix(in srgb, var(--amber) 45%, transparent)); }
  50%       { transform: scale(1.26); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--amber) 80%, transparent)); }
}
.demo.ai-speaking .orb-core .mark-lg .dot { animation: dotpulse 1.3s ease-in-out infinite; }
.orb-core .mark-lg .arcs {
  transform-box: fill-box; transform-origin: center;
  transition: transform .1s ease-out;
}
.demo[data-state='live'] .orb-core .mark-lg .arcs { transform: scale(calc(1 + var(--level) * 0.14)); }
@media (prefers-reduced-motion: no-preference) {
  .demo[data-state='idle'] .orb-core .mark-lg .arcs,
  .demo:not([data-state]) .orb-core .mark-lg .arcs { animation: arcpulse 2.4s ease-in-out infinite; }
}
@keyframes arcpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.demo.ai-speaking .orb-core .mark-lg .arcs { animation: arcpulse 1.3s ease-in-out infinite; }

/* ── Equalizer — signal motif (listening / AI speaking) ────────────────────── */
.equalizer {
  display: none; align-items: flex-end; justify-content: center; gap: 2.5px; height: 18px;
  margin: 10px auto 0;
}
.equalizer span {
  width: 3px; border-radius: 1.5px;
  background: var(--amber); transform-origin: bottom;
  animation: eq 1.3s cubic-bezier(.2,.7,.2,1) infinite;
}
.equalizer span:nth-child(1) { height: 40%; animation-delay: 0s; }
.equalizer span:nth-child(2) { height: 80%; animation-delay: .18s; }
.equalizer span:nth-child(3) { height: 100%; animation-delay: .36s; }
.equalizer span:nth-child(4) { height: 65%; animation-delay: .54s; }
.equalizer span:nth-child(5) { height: 40%; animation-delay: .72s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.3); opacity: 0.6; }
  50%       { transform: scaleY(1);   opacity: 1; }
}
.demo[data-state='live'] .equalizer,
.demo.ai-speaking .equalizer { display: flex; }

/* Orb copy below */
.orb-cta {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(16px, 4vw, 20px);
  color: var(--txt); letter-spacing: -0.03em; margin: 12px 0 0; min-height: 1.2em; text-align: center;
}
.demo[data-state='connecting'] .orb-cta::after {
  content: ''; display: inline-block; width: 1em; text-align: left; animation: dots 1.2s steps(4, end) infinite;
}
.demo[data-state='live'] .orb-cta,
.demo[data-state='live'] .hint { display: none; }
@keyframes dots { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }
.demo[data-state='ended'] .orb-wrap { opacity: 0.6; }

.hint { color: var(--txt-3); font-size: 13px; margin: 8px 0 0; min-height: 1.2em; }
.callbar { display: none; align-items: center; gap: 12px; margin-top: 12px; }
.demo[data-state='live'] .callbar,
.demo[data-state='connecting'] .callbar { display: flex; }
.timer {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-weight: 400; font-size: 15px; color: var(--txt);
  font-variant-numeric: tabular-nums; min-width: 44px;
}
.timer.low { color: #e06b5a; }
.endbtn {
  appearance: none; border: 1px solid var(--hair); background: var(--surf-2); color: var(--txt);
  font-family: inherit; font-weight: 800; font-size: 14px; cursor: pointer;
  padding: 12px 16px; border-radius: 12px; min-height: 44px;
  transition: background .14s cubic-bezier(.2,.7,.2,1);
}
.endbtn:hover { background: color-mix(in srgb, var(--txt) 8%, var(--surf-2)); }
.status { font-size: 13.5px; font-weight: 700; color: var(--txt-2); margin: 12px 0 0; min-height: 1.2em; }
.status.err { color: #e06b5a; }
.consent { font-size: 11.5px; color: var(--txt-3); margin: 9px 0 0; line-height: 1.45; max-width: 320px; }

/* ── Conversation panel ─────────────────────────────────────────────────────── */
.convo { display: flex; flex-direction: column; min-height: 0; }
.convo-head {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 13px 16px;
  border-bottom: 1px solid var(--hair); font-size: 15px;
}
.convo-head .mark-sm { width: 20px; height: 20px; color: var(--txt); }
.convo-head b { font-weight: 800; }
.chip {
  margin-left: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, transparent);
  padding: 4px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
}
/* Chip: equalizer bars swap in during live (replace pdot) */
.chip .eq-bars {
  display: none; align-items: flex-end; gap: 1.5px; height: 10px;
}
.chip .eq-bars span {
  width: 2px; border-radius: 1px; background: currentColor; transform-origin: bottom;
  animation: eq 1.3s cubic-bezier(.2,.7,.2,1) infinite;
}
.chip .eq-bars span:nth-child(1) { height: 40%; animation-delay: 0s; }
.chip .eq-bars span:nth-child(2) { height: 80%; animation-delay: .18s; }
.chip .eq-bars span:nth-child(3) { height: 100%; animation-delay: .36s; }
.chip .eq-bars span:nth-child(4) { height: 65%; animation-delay: .54s; }
.chip .eq-bars span:nth-child(5) { height: 40%; animation-delay: .72s; }
.chip .pdot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
@media (prefers-reduced-motion: no-preference) { .chip .pdot { animation: beat 1.4s ease-in-out infinite; } }
@keyframes beat { 0%, 100% { opacity: 1; } 45% { opacity: 0.4; } }
/* Swap pdot for eq-bars when live */
.demo[data-state='live'] .chip .pdot  { display: none; }
.demo[data-state='live'] .chip .eq-bars { display: flex; }

.transcript {
  flex: 1; min-height: 140px; overflow-y: auto;
  overscroll-behavior: contain; /* prevents scroll chaining into the parent */
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.convo-empty { color: var(--txt-3); font-size: 14px; text-align: center; margin: auto; max-width: 240px; }
.bubble {
  max-width: 86%; padding: 9px 13px; border-radius: 15px; font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; word-wrap: break-word; animation: rise .18s cubic-bezier(.2,.7,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bubble .who {
  display: block;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.17em; text-transform: uppercase;
  margin-bottom: 3px; color: var(--txt-3);
}
.bubble.assistant {
  align-self: flex-start; background: var(--surf-2); border: 1px solid var(--hair);
  border-bottom-left-radius: 5px; color: var(--txt);
}
.bubble.user {
  align-self: flex-end;
  background: color-mix(in srgb, var(--amber) 14%, var(--surf-2));
  border: 1px solid color-mix(in srgb, var(--amber) 28%, transparent);
  border-bottom-right-radius: 5px; color: var(--txt);
}
.bubble.partial { opacity: 0.72; }
.bubble.partial .tx:empty::after {
  content: '···'; letter-spacing: 2px; color: var(--txt-3); animation: blink 1.1s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }

/* ── Summary card ────────────────────────────────────────────────────────────── */
.summary { margin-top: 8px; }
.demo[data-state='ended'] .summary {
  flex: 1; min-height: 0; overflow-y: auto;
  animation: rise .24s cubic-bezier(.2,.7,.2,1);
}
.spot {
  background: var(--surf); border: 1px solid var(--hair); border-radius: 22px; box-shadow: var(--shadow);
  padding: 18px; max-width: 640px; margin: 0 auto;
}
.spot-h { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; flex-shrink: 0; position: relative; display: grid; place-items: center; color: var(--amber); }
.avatar.unknown { color: var(--txt-3); }
.avatar svg { width: 100%; height: 100%; }
.avatar .ini {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; color: var(--txt);
}
.spot-h .smid { min-width: 0; }
.spot-h .sname { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; letter-spacing: -0.03em; }
.spot-h .smeta { color: var(--txt-2); font-size: 13px; margin-top: 1px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lab {
  display: inline-flex; align-items: center;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber);
}
.lab.urgent   { background: rgba(217,142,128,.18); color: var(--warn); }
.lab.complaint{ background: rgba(217,142,128,.14); color: var(--warn); }
.lab.question { background: rgba(62,110,142,.18);  color: #7fb0ce; }
.lab.other    { background: var(--hair); color: var(--txt-2); }
[data-theme='light'] .lab.question { color: #3e6e8e; }
.ssum { margin: 14px 0 4px; font-size: 15px; line-height: 1.5; color: var(--txt); }
.sumbadge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--amber); background: color-mix(in srgb, var(--amber) 13%, transparent);
  padding: 4px 9px; border-radius: 999px; margin-top: 8px;
}
.sumbadge .sd { width: 5px; height: 5px; border-radius: 999px; background: currentColor; }

.fields { margin: 16px 0 4px; border-top: 1px solid var(--hair); }
.frow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.frow .fk {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--txt-3); width: 96px; flex-shrink: 0;
}
.frow .fv { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.tag-ok, .tag-warn {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10px; font-weight: 400; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.tag-ok   { background: var(--ok-bg);   color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }

.sum-tr { margin-top: 16px; }
.sum-tr summary {
  cursor: pointer; font-size: 12px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--txt-2); list-style: none;
}
.sum-tr summary::-webkit-details-marker { display: none; }
.sum-tr summary::before { content: '▸ '; color: var(--txt-3); }
.sum-tr[open] summary::before { content: '▾ '; }
.sum-tr pre {
  margin: 10px 0 0; padding: 12px; background: var(--surf-2); border: 1px solid var(--hair); border-radius: 12px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word; max-height: 280px; overflow-y: auto; color: var(--txt);
}
.sum-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.cb {
  appearance: none; border: none; cursor: pointer; font-family: inherit; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--amber); color: var(--amber-ink); border-radius: 12px; padding: 12px 18px; min-height: 44px;
  transition: background .14s cubic-bezier(.2,.7,.2,1), box-shadow .14s cubic-bezier(.2,.7,.2,1);
}
.cb:hover { background: var(--amber-d); box-shadow: 0 34px 70px -46px rgba(242,163,56,.5); }
.cb.ghost { background: var(--surf-2); color: var(--txt); border: 1px solid var(--hair); box-shadow: none; }
.cb.ghost:hover { background: color-mix(in srgb, var(--txt) 6%, var(--surf-2)); }

.d-foot { flex-shrink: 0; text-align: center; color: var(--txt-3); font-size: 12px; margin-top: 14px; }
.summarizing { text-align: center; color: var(--txt-2); font-size: 14px; padding: 26px 0; }

/* ── Embed mode (?embed=1 → demo.js adds html.embed) ───────────────────────── */
/* Strict viewport-height: document must never scroll (iOS scroll-trap fix). */
html.embed,
html.embed body { height: 100%; overflow: hidden; }
/* Flat background in embed — the parent page controls the visual context. */
html.embed body { background: var(--bg); }
html.embed .demo {
  height: 100dvh; min-height: 0; overflow: hidden;
  padding: clamp(8px, 2vw, 14px);
  padding-bottom: max(clamp(8px, 2vw, 14px), env(safe-area-inset-bottom));
}
/* Hide BeepSweep's own site chrome — the embedder already provides it. */
html.embed .d-head,
html.embed .d-foot,
html.embed .intro { display: none !important; }
html.embed .controls { margin-bottom: 6px; }
/* Active call: same strict-one-screen rules reinforced */
html.embed .demo[data-state='connecting'],
html.embed .demo[data-state='live'],
html.embed .demo[data-state='ending'],
html.embed .demo[data-state='ended'] { height: 100dvh; min-height: 0; overflow: hidden; }
/* Hide the language picker row when ?lang= is pre-set by the embedder */
html.embed.lang-locked .ctrl:first-child { display: none; }

/* ── Responsive — mobile-first ───────────────────────────────────────────────── */
/* On narrow screens in idle state: hide the conversation panel so the orb fits on
   one screen without scrolling. CSS reveals it again once a call starts. */
@media (max-width: 480px) {
  .demo[data-state='idle'] .convo,
  .demo:not([data-state]) .convo { display: none; }
}

@media (max-width: 720px) {
  .stage { display: flex; flex-direction: column; gap: 12px; }
  .call  { flex-shrink: 0; padding: 16px; }
  .convo { flex: 1; min-height: 160px; }
  .d-head { flex-wrap: wrap; }
  /* During a call: shrink the orb so transcript owns the screen */
  .demo[data-state='live'] .orb-wrap,
  .demo[data-state='connecting'] .orb-wrap { width: 100px; margin: 0; }
  .demo[data-state='live'] .consent,
  .demo[data-state='connecting'] .consent,
  .demo[data-state='live'] .hint,
  .demo[data-state='connecting'] .hint { display: none; }
  .demo[data-state='live'] .call,
  .demo[data-state='connecting'] .call { flex-direction: row; gap: 14px; padding: 12px 14px; }
  .demo[data-state='live'] .status,
  .demo[data-state='connecting'] .status { margin: 0; }
  /* Touch targets */
  .seg-opt { min-height: 36px; padding: 7px 9px; }
  .endbtn  { min-height: 44px; }
  /* Equalizer slightly smaller */
  .equalizer { height: 14px; }
}

/* Safe-area padding (notch / home-indicator phones) */
@supports (padding: env(safe-area-inset-bottom)) {
  .demo { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* ── Reduced-motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .orb-rings .ring { display: none; }
  .equalizer,
  .chip .eq-bars { display: none !important; }
}
