:root {
  color-scheme: light;
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  color: #222ca7;
  background: #fff8ef;
  --cream: #fff8ef;
  --paper: #fffdf9;
  --ink: #222ca7;
  --blue: #55d9ff;
  --mid-blue: #0099ff;
  --smart-blue: #006bee;
  --purple: #9e29eb;
  --plum: #4d0e35;
  --pink: #ff5d69;
  --orange: #ff8c00;
  --yellow: #ffcd00;
  --line: rgba(34, 44, 167, 0.14);
  --shadow: 0 26px 70px rgba(34, 44, 167, 0.12);
  --energy: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 6% 14%, rgba(85, 217, 255, 0.26) 0 7rem, transparent 7.1rem),
    radial-gradient(circle at 96% 88%, rgba(255, 205, 0, 0.22) 0 9rem, transparent 9.1rem),
    var(--cream);
}

body::before,
body::after {
  position: fixed;
  z-index: -1;
  content: "";
  pointer-events: none;
}

body::before {
  top: 17%;
  right: -6rem;
  width: 18rem;
  height: 3px;
  border-radius: 999px;
  background: var(--pink);
  box-shadow: 0 18px 0 var(--orange), 0 36px 0 var(--yellow);
  rotate: -8deg;
}

body::after {
  bottom: 10%;
  left: -5rem;
  width: 15rem;
  height: 3px;
  border-radius: 999px;
  background: var(--mid-blue);
  box-shadow: 0 18px 0 var(--blue);
  rotate: 9deg;
}

button,
input { font: inherit; }
button,
a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid rgba(0, 153, 255, 0.35);
  outline-offset: 3px;
}

.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;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: clamp(16px, 2.4vw, 38px);
}

.auth-view { width: min(100%, 1080px); min-height: calc(100vh - clamp(32px, 4.8vw, 76px)); display: grid; place-items: center; margin: 0 auto; padding-top: 62px; }
.auth-brand { position: absolute; top: clamp(18px, 3vw, 38px); left: clamp(20px, 4vw, 54px); display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 950; letter-spacing: -0.035em; }
.auth-card { width: 100%; min-height: min(660px, calc(100vh - 120px)); display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(430px, 1.1fr); overflow: hidden; border: 1px solid var(--line); border-radius: clamp(30px, 4vw, 52px); background: var(--paper); box-shadow: var(--shadow); }
.auth-art { position: relative; min-height: 540px; overflow: hidden; isolation: isolate; background: radial-gradient(circle at 50% 32%, rgba(255, 205, 0, 0.94) 0 19%, transparent 19.3%), linear-gradient(155deg, #d928f1, #9e29eb 44%, var(--plum)); }
.auth-art::after { position: absolute; z-index: -1; inset: 46% -24% -25%; border-radius: 50% 50% 0 0; background: rgba(50, 3, 38, 0.7); content: ""; }
.auth-art img { position: absolute; z-index: 3; right: 50%; bottom: -4%; height: 88%; transform: translateX(50%); filter: drop-shadow(0 28px 18px rgba(31, 5, 26, 0.3)); }
.auth-art .auth-caesar { z-index: 2; right: auto; left: 3%; height: 68%; transform: none; }
.auth-art .auth-tara { right: -2%; bottom: -3%; height: 48%; transform: none; }
.auth-orbit { position: absolute; z-index: 1; border: 2px solid rgba(255, 255, 255, 0.26); border-radius: 50%; }
.auth-orbit-one { top: 13%; right: 8%; width: 54%; aspect-ratio: 1; }
.auth-orbit-two { right: 1%; bottom: 7%; width: 78%; aspect-ratio: 1; }
.auth-content { min-height: 0; display: grid; place-items: center; padding: clamp(30px, 5vw, 68px); }
.auth-content > div { width: min(100%, 440px); }
.auth-loading { display: flex; align-items: center; justify-content: center; gap: 11px; color: #666aa0; font: 800 14px/1.4 system-ui, sans-serif; }
.auth-loading-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--mid-blue); animation: pulse 800ms infinite alternate; }
.auth-content .eyebrow { color: var(--purple); }
.auth-content h1 { margin: 0; color: var(--ink); font-size: clamp(42px, 5vw, 66px); line-height: 0.95; letter-spacing: -0.06em; }
.auth-intro { margin: 18px 0 0; color: #666a9d; font: 14px/1.55 system-ui, sans-serif; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 28px; padding: 5px; border: 1px solid var(--line); border-radius: 17px; background: #f6f4fb; }
.auth-tabs button { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: #7377a8; cursor: pointer; font: 800 13px/1 system-ui, sans-serif; }
.auth-tabs button[aria-selected="true"] { background: white; color: var(--ink); box-shadow: 0 5px 14px rgba(34, 44, 167, 0.1); }
.auth-form { display: grid; gap: 8px; margin-top: 22px; }
.auth-form label { margin-top: 8px; color: var(--ink); font: 800 12px/1.3 system-ui, sans-serif; }
.auth-form input { width: 100%; min-height: 52px; padding: 0 15px; border: 2px solid rgba(34, 44, 167, 0.14); border-radius: 15px; background: white; color: var(--ink); font: 15px system-ui, sans-serif; }
.auth-form input:focus { border-color: var(--mid-blue); }
.auth-confirm-row { display: grid; gap: 8px; }
.auth-submit { min-height: 54px; margin-top: 15px; border: 0; border-radius: 17px; background: linear-gradient(135deg, var(--mid-blue), var(--blue)); color: var(--ink); box-shadow: 0 13px 27px rgba(0, 153, 255, 0.22); cursor: pointer; font-weight: 950; }
.auth-submit:disabled { cursor: wait; opacity: 0.56; }
.auth-message { margin: 10px 0 0; padding: 11px 13px; border-radius: 12px; background: #e9fbff; color: #146685; font: 12px/1.45 system-ui, sans-serif; }
.auth-message[data-state="error"] { background: #fff0f1; color: #9a2934; }
.auth-help { margin: 14px 0 0; color: #8589ad; font: 11px/1.5 system-ui, sans-serif; }
.account-email { max-width: 180px; overflow: hidden; color: #7478aa; font: 750 11px/1.2 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.sign-out-button { min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, 0.74); color: var(--ink); cursor: pointer; font: 800 11px/1 system-ui, sans-serif; }

.library-view,
.player-view {
  width: min(100%, 1440px);
  margin: 0 auto;
}

body[data-player-active="true"] {
  height: 100dvh;
  overflow: hidden;
}

body[data-player-active="true"] .app-shell {
  height: 100dvh;
  min-height: 0;
  padding: clamp(12px, 1.5vw, 22px);
}

body[data-player-active="true"] .player-view {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body[data-player-active="true"] .player-nav { margin-bottom: 12px; }
body[data-player-active="true"] .call-card { height: 100%; min-height: 0; }

.brand-header,
.player-nav {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px 12px 12px 4px;
  background: linear-gradient(145deg, var(--blue), var(--mid-blue));
  color: white;
  box-shadow: 0 8px 18px rgba(0, 153, 255, 0.22);
  font-size: 26px;
  font-weight: 950;
  line-height: 1;
}

.brand-mode {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.stage-column {
  position: absolute;
  bottom: 8%;
  width: 11%;
  height: 48%;
  border-radius: 999px 999px 0 0;
  background: rgba(255, 255, 255, 0.14);
}

.stage-column::before,
.stage-column::after {
  position: absolute;
  left: -28%;
  width: 156%;
  height: 8%;
  border-radius: 999px;
  background: inherit;
  content: "";
}
.stage-column::before { top: 4%; }
.stage-column::after { bottom: 0; }
.start-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 4vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}
.back-button,
.download-button,
.details-button {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease;
}
.back-button:hover,
.download-button:hover:not(:disabled),
.details-button:hover { transform: translateY(-2px); background: #eefbff; }
.download-button:disabled { cursor: not-allowed; opacity: 0.4; transform: none; }
.primary-action,
.resume-audio {
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--mid-blue), var(--blue));
  color: var(--ink);
  box-shadow: 0 14px 30px rgba(0, 153, 255, 0.2);
  cursor: pointer;
  font-weight: 950;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.primary-action:hover,
.resume-audio:hover { transform: translateY(-2px); box-shadow: 0 18px 34px rgba(0, 153, 255, 0.28); }
.primary-action:disabled { cursor: not-allowed; opacity: 0.48; transform: none; }

.player-nav { margin-bottom: 16px; }
.player-nav-title,
.mobile-button-icon { display: none; }
.player-nav-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.brand-lockup.compact { font-size: 16px; }
.brand-lockup.compact .brand-mark { width: 32px; height: 32px; border-radius: 10px 10px 10px 3px; font-size: 22px; }
.back-button,
.download-button,
.details-button { padding: 0 17px; font-size: 13px; }
.back-button { display: inline-flex; align-items: center; gap: 8px; }

.call-card {
  min-height: min(780px, calc(100vh - 120px));
  display: grid;
  grid-template-columns: minmax(390px, 0.92fr) minmax(460px, 1.08fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(28px, 3vw, 46px);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.visual-panel {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  isolation: isolate;
  padding: 30px;
  background: linear-gradient(155deg, #d928f1 0%, #bc24d9 24%, var(--plum) 78%);
  color: white;
}
.visual-panel::before {
  position: absolute;
  z-index: -1;
  right: -22%;
  bottom: -8%;
  width: 115%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(46, 7, 35, 0.27);
  content: "";
}

.topbar { position: relative; z-index: 4; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.topbar .eyebrow { color: var(--yellow); }
.call-time { margin: 0; color: rgba(255, 255, 255, 0.74); font: 13px/1.4 system-ui, sans-serif; }
.live-dot {
  width: 14px;
  height: 14px;
  flex: none;
  margin: 8px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 calc(7px + (var(--energy) * 12px)) rgba(255, 205, 0, 0.17);
}
.scene-toggle { display: none; }

.scene-artwork { position: relative; z-index: 1; min-height: 260px; flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; margin: 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 24px; background: var(--plum); box-shadow: 0 18px 40px rgba(31, 5, 26, 0.24); }
.scene-artwork::after { position: absolute; inset: 0; display: grid; place-items: center; background: var(--plum); color: rgba(255, 255, 255, 0.72); content: "Scene artwork unavailable"; font-size: 13px; opacity: 0; pointer-events: none; }
.scene-artwork[data-state="error"]::after { opacity: 1; }
.scene-artwork img { width: 100%; height: 100%; min-height: 0; display: block; object-fit: cover; opacity: 0.22; filter: saturate(0.82); transition: opacity 420ms ease, filter 420ms ease, transform 10s linear; }
.scene-artwork[data-state="loaded"] img { opacity: 1; filter: saturate(0.94); transform: scale(1.025); }
.scene-artwork[data-state="error"] img { opacity: 0; }
.scene-artwork figcaption { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 10px 13px; background: rgba(31, 4, 24, 0.92); color: white; font: 12px/1.35 system-ui, sans-serif; }
.scene-artwork figcaption > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-frame { flex: none; padding: 7px 9px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; background: rgba(34, 44, 167, 0.72); font-size: 9px; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.scene-artwork[data-frame="counterfactual"] .scene-frame { background: rgba(158, 41, 235, 0.78); }
.scene-artwork[data-frame="historical_record"] .scene-frame { background: rgba(0, 126, 111, 0.8); }

.character-summary { position: relative; z-index: 3; flex: 1; display: flex; flex-direction: column; }
.portrait-wrap { position: relative; flex: 1; min-height: 420px; display: grid; place-items: end center; }
.portrait { height: min(61vh, 545px); max-height: 100%; filter: drop-shadow(0 24px 18px rgba(31, 5, 26, 0.31)); }
.portrait img { width: auto; height: 100%; display: block; object-fit: contain; }

.has-scene-artwork .visual-panel { padding: 24px; }
.has-scene-artwork .character-summary { flex: none; min-height: 86px; display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 15px; padding: 2px 4px; }
.has-scene-artwork .portrait-wrap { width: 76px; min-height: 0; aspect-ratio: 1; display: block; overflow: hidden; border: 4px solid rgba(255, 255, 255, 0.9); border-radius: 50%; background: linear-gradient(145deg, var(--blue), white); box-shadow: 0 10px 24px rgba(20, 4, 18, 0.25); }
.has-scene-artwork .portrait { height: 112px; max-height: none; transform: translate(3px, 3px); }
.has-scene-artwork .identity { min-width: 0; margin: 0; }
.has-scene-artwork .identity .story-kicker { margin-bottom: 3px; }
.has-scene-artwork .identity h1 { font-size: clamp(28px, 2.8vw, 38px); }
.has-scene-artwork .identity > p:not(.story-kicker) { margin-top: 5px; }
.has-scene-artwork .voice-disclosure { display: none; }

.identity { position: relative; z-index: 4; margin-top: 5px; }
.identity .story-kicker { margin: 0 0 5px; color: var(--yellow); font-size: 12px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.identity h1 { margin: 0; font-size: clamp(38px, 4vw, 60px); line-height: 0.98; letter-spacing: -0.055em; }
.identity > p:not(.story-kicker) { margin: 8px 0 0; color: rgba(255, 255, 255, 0.83); }
.identity #scene-label { font: 15px/1.4 system-ui, sans-serif; font-weight: 650; }
.voice-disclosure { font: 11px/1.4 system-ui, sans-serif; }

.conversation-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  padding: clamp(18px, 2.2vw, 30px);
  background: radial-gradient(circle at 100% 0%, rgba(85, 217, 255, 0.13), transparent 16rem), var(--paper);
}

.call-status-bar { min-width: 0; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; flex: none; gap: 9px; min-height: 38px; padding: 7px 12px; border-radius: 999px; background: #f0f5ff; color: #5e649e; font: 12px/1.2 system-ui, sans-serif; font-weight: 750; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #9499bd; }
.status[data-state="listening"] { background: #e6fbff; color: #146685; }
.status[data-state="listening"] .status-dot { background: var(--mid-blue); }
.status[data-state="thinking"] { background: #f6ebff; color: #7424ae; }
.status[data-state="thinking"] .status-dot { background: var(--purple); animation: pulse 900ms infinite alternate; }
.status[data-state="speaking"] { background: #fff5cb; color: #785b00; }
.status[data-state="speaking"] .status-dot { background: var(--yellow); }
@keyframes pulse { to { opacity: 0.35; transform: scale(0.76); } }

.details { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: white; color: #555b91; font: 13px/1.5 system-ui, sans-serif; }
.latency { min-width: 230px; flex: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; color: #555b91; font: 12px/1.45 system-ui, sans-serif; }
.microphone-check { flex: 1 0 100%; display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: 7px 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 14px; background: white; color: #555b91; font: 12px/1.4 system-ui, sans-serif; }
.details h2 { margin: 0 0 8px; color: var(--ink); font: 900 18px/1.2 ui-rounded, sans-serif; }
.details p { margin: 0; }
.details .privacy { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; }
.mode-switch { display: flex; gap: 8px; margin: 18px 0 0; padding: 0; border: 0; }
.mode-switch legend { margin-bottom: 7px; color: var(--ink); font-weight: 800; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch label { flex: 1; }
.mode-switch label span { display: block; padding: 10px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.mode-switch input:checked + span { border-color: var(--purple); background: #f6eaff; color: #6f1ea5; }
.mode-note { margin: 8px 0 0; }
.details dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 14px 0 0; }
.details dt,
.details dd,
.latency dt,
.latency dd { margin: 0; }
.details dd,
.latency dd { color: var(--ink); font-weight: 750; text-align: right; }

.latency-heading { min-height: 38px; display: grid; grid-template-columns: auto auto minmax(44px, 1fr) auto; align-items: center; gap: 10px; padding: 7px 11px; color: var(--ink); cursor: pointer; list-style: none; }
.latency-heading::-webkit-details-marker { display: none; }
.latency-heading::before { color: #8b8fb3; content: "›"; font-size: 16px; transition: transform 140ms ease; }
.latency[open] .latency-heading::before { transform: rotate(90deg); }
.latency-heading > #latency-title { white-space: nowrap; }
.latency-details { padding: 0 12px 11px 28px; border-top: 1px solid rgba(34, 44, 167, 0.08); }
.latency-details > p { padding-top: 9px; }
.latency-breakdown { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 9px 0 0; }
.latency-breakdown > div { display: flex; gap: 5px; }
.microphone-check-heading { display: contents; color: var(--ink); }
.microphone-check-heading > span { grid-column: 1; }
.microphone-check-heading > strong { grid-column: 3; }
.latency-progress,
.microphone-meter { height: 6px; overflow: hidden; border-radius: 999px; background: #e9ebf6; }
.latency-progress { min-width: 38px; margin: 0; }
.microphone-meter { grid-column: 2; grid-row: 1; margin: 0; }
.latency-progress span,
.microphone-meter span { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--purple), var(--blue)); }
.latency[data-state="done"] .latency-progress span { width: 100%; }
.latency[data-state="failed"] .latency-progress span { width: 100%; background: var(--pink); }
.microphone-check p,
.latency p { margin: 0; }
.microphone-check p { grid-column: 1 / -1; }
.microphone-check[data-state="working"] p,
.microphone-check[data-state="paused"] p { display: none; }
.microphone-device { font-size: 11px; }

.conversation-stage { position: relative; min-height: 0; overflow: hidden; }
.conversation-scroll { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; overscroll-behavior: contain; padding: 3px 7px 10px 1px; scrollbar-width: thin; scrollbar-color: rgba(34, 44, 167, 0.2) transparent; }
.call-card:not([data-input-mode]) .conversation-scroll { justify-content: center; }
.jump-latest { position: absolute; z-index: 5; right: 15px; bottom: 12px; min-height: 40px; padding: 0 13px; border: 1px solid rgba(34, 44, 167, 0.16); border-radius: 999px; background: var(--ink); color: white; box-shadow: 0 10px 24px rgba(34, 44, 167, 0.2); cursor: pointer; font: 750 12px/1 system-ui, sans-serif; }

.conversation { flex: none; display: flex; flex-direction: column; gap: 15px; }
.turn { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.turn.user-turn { align-items: flex-end; }
.speaker-label { padding: 0 7px; color: #7424ae; font: 800 11px/1.2 system-ui, sans-serif; letter-spacing: 0.02em; }
.user-turn .speaker-label { color: #146685; }
.bubble { max-width: 86%; margin: 0; padding: 14px 16px; border: 1px solid rgba(158, 41, 235, 0.13); border-radius: 7px 19px 19px 19px; background: #f0e5ff; color: #42155f; font: 15px/1.45 system-ui, -apple-system, sans-serif; }
.bubble.user { border: 1px solid rgba(0, 153, 255, 0.2); border-radius: 19px 7px 19px 19px; background: #ddf8ff; color: #16566c; }

/* Compact ending keepsake. Long reflection has its own bounded scroll area. */
.ending-card { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid #dfd5bf; border-radius: 16px; background: #faf6ed; color: #343326; min-width: 0; }
.ending-eyebrow { color: #7a6540; font: 750 10px/1.2 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.ending-card h2 { margin: 0; font: 750 20px/1.2 system-ui, sans-serif; letter-spacing: -.025em; overflow-wrap: anywhere; }
.ending-card h3 { margin: 16px 0 5px; font: 750 13px/1.3 system-ui, sans-serif; }
.ending-card p { margin: 0; font: 14px/1.5 system-ui, sans-serif; }
.ending-frame { color: #756b57; font: 550 11px/1.3 system-ui, sans-serif; }
.ending-toggle { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; cursor: pointer; list-style: none; font: 700 12px/1.3 system-ui, sans-serif; }
.ending-toggle::-webkit-details-marker { display: none; }
.ending-toggle::after { content: "+"; font: 400 20px/1 system-ui, sans-serif; }
.ending-reflection[open] .ending-toggle::after { content: "−"; }
.ending-close-label, .ending-reflection[open] .ending-open-label { display: none; }
.ending-reflection[open] .ending-close-label { display: inline; }
.ending-body { max-height: min(240px, 24dvh); overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 12px 0; border-bottom: 1px solid #dfd5bf; }
.ending-toggle:focus-visible, .ending-body:focus-visible { outline: 2px solid #ad7c20; outline-offset: 3px; border-radius: 4px; }
.ending-card .ending-continue { color: #756b57; font: 500 11px/1.4 system-ui, sans-serif; }

.suggestions > p { margin: 0 0 10px; color: #7175a7; font: 12px/1.4 system-ui, sans-serif; font-weight: 750; }
#suggestion-list { display: grid; gap: 9px; }
#suggestion-list button { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid rgba(158, 41, 235, 0.2); border-radius: 16px; background: white; color: #5e2087; cursor: pointer; font: 14px/1.35 system-ui, sans-serif; font-weight: 720; text-align: left; transition: background 140ms ease, transform 140ms ease; }
#suggestion-list button:hover { transform: translateX(3px); background: #f8efff; }
#suggestion-list button:disabled { cursor: wait; opacity: 0.55; }

.error { margin: 0; padding: 13px 14px; border-radius: 15px; background: #fff0f1; color: #9a2934; font: 13px/1.4 system-ui, sans-serif; }
.resume-audio { width: 100%; }
.start-controls { margin-block: auto; }
.start-heading .eyebrow { color: var(--purple); }
.start-heading h2 { max-width: 440px; font-size: clamp(31px, 3.4vw, 47px); }
.start-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.start-call { min-height: 104px; display: flex; align-items: center; gap: 13px; padding: 17px; border: 0; border-radius: 22px; background: linear-gradient(145deg, var(--mid-blue), var(--blue)); color: var(--ink); box-shadow: 0 14px 28px rgba(0, 153, 255, 0.18); cursor: pointer; text-align: left; transition: transform 160ms ease, box-shadow 160ms ease; }
.start-call:hover { transform: translateY(-3px); box-shadow: 0 18px 34px rgba(0, 153, 255, 0.24); }
.start-call:disabled { cursor: wait; opacity: 0.58; transform: none; }
.start-call.secondary-start { background: linear-gradient(145deg, #b64df3, var(--purple)); color: white; box-shadow: 0 14px 28px rgba(158, 41, 235, 0.2); }
.control-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, 0.45); }
.start-call span:last-child { display: grid; gap: 3px; }
.start-call strong { font-size: 15px; }
.start-call small { font: 11px/1.35 system-ui, sans-serif; opacity: 0.74; }
#start-help { margin: 16px 0 0; color: #7478aa; font: 12px/1.45 system-ui, sans-serif; }

.call-dock { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 11px; border-top: 1px solid rgba(34, 44, 167, 0.1); }
.call-dock:has(.text-controls[hidden]):has(.call-controls[hidden]) { display: none; }
.text-controls { min-width: 0; flex: 1; display: grid; grid-template-columns: 1fr 52px; gap: 9px; }
.text-controls input { min-width: 0; min-height: 54px; padding: 0 16px; border: 2px solid rgba(34, 44, 167, 0.16); border-radius: 18px; background: white; color: var(--ink); font: 15px system-ui, sans-serif; }
.text-controls input::placeholder { color: #9296b8; }
.text-controls button { border: 0; border-radius: 18px; background: var(--ink); color: white; cursor: pointer; font-size: 24px; font-weight: 900; }

.call-controls { flex: none; display: flex; justify-content: center; gap: 10px; }
.control-button { min-width: 78px; min-height: 58px; display: grid; place-items: center; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 18px; background: white; cursor: pointer; }
.control-button small { font: 11px system-ui, sans-serif; }
.end-button { border-color: rgba(255, 93, 105, 0.24); background: #fff0f1; color: #9a2934; }

body:not([data-debug="true"]) .debug-only { display: none !important; }

@media (max-width: 980px) {
  .call-card { grid-template-columns: minmax(330px, 0.85fr) minmax(400px, 1.15fr); }
  .start-actions { grid-template-columns: 1fr; }
  .start-call { min-height: 78px; }
}

@media (max-width: 760px) {
  body { background: radial-gradient(circle at 2% 10%, rgba(85, 217, 255, 0.22) 0 5rem, transparent 5.1rem), var(--cream); }
  .app-shell { padding: 12px; }
  .brand-header { margin: 0 5px 12px; }
  .primary-action { width: 100%; }

  .auth-view { min-height: calc(100vh - 24px); padding-top: 48px; }
  .auth-brand { top: 18px; left: 20px; }
  .auth-card { min-height: 0; grid-template-columns: 1fr; border-radius: 28px; }
  .auth-art { min-height: 154px; }
  .auth-art img { bottom: -60%; height: 160%; }
  .auth-art .auth-caesar { left: 12%; bottom: -32%; height: 120%; }
  .auth-art .auth-tara { right: 7%; bottom: -16%; height: 98%; }
  .auth-orbit-one { top: -20%; right: 5%; width: 42%; }
  .auth-orbit-two { right: -10%; bottom: -70%; width: 70%; }
  .auth-content { padding: 22px 20px 24px; }
  .auth-content h1 { font-size: 40px; }
  .auth-intro { margin-top: 11px; font-size: 13px; }
  .auth-tabs { margin-top: 15px; }
  .auth-form { margin-top: 14px; }
  .auth-form input { min-height: 48px; }
  .auth-submit { min-height: 50px; margin-top: 11px; }
  .auth-help { margin-top: 10px; }
  .account-email { display: none; }

  body[data-player-active="true"] .app-shell { padding: 0; }
  .player-view { margin: -12px; width: calc(100% + 24px); }
  body[data-player-active="true"] .player-view { width: 100%; margin: 0; }
  .player-nav { position: relative; z-index: 20; min-height: 60px; margin: 0; padding: 7px 10px; border-bottom: 1px solid var(--line); background: rgba(255, 248, 239, 0.96); }
  .player-nav .brand-lockup { display: none; }
  .details-button,
  .download-button,
  .back-button { min-height: 44px; padding: 0 14px; background: rgba(255, 255, 255, 0.76); }
  .call-card { min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: min(52dvh, calc(56.25vw + 94px)) minmax(0, 1fr); border: 0; border-radius: 0; box-shadow: none; }
  .call-card:not(.has-scene-artwork) { grid-template-rows: minmax(0, 1fr); }
  .call-card:not(.has-scene-artwork) .visual-panel { display: none; }
  .has-scene-artwork .visual-panel { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0; padding: 0; }
  .has-scene-artwork .topbar { position: absolute; z-index: 5; top: 9px; right: 10px; left: 10px; align-items: center; pointer-events: none; }
  .has-scene-artwork .topbar > div:first-child { padding: 5px 9px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; background: rgba(31, 4, 24, 0.62); backdrop-filter: blur(10px); }
  .has-scene-artwork .topbar .eyebrow { display: none; }
  .has-scene-artwork .call-time { color: white; font-size: 11px; font-weight: 750; }
  .has-scene-artwork .live-dot { display: none !important; }
  .has-scene-artwork .scene-toggle { position: absolute; z-index: 7; top: 9px; right: 10px; display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; background: rgba(31, 4, 24, 0.72); color: white; box-shadow: 0 8px 22px rgba(31, 4, 24, 0.24); backdrop-filter: blur(10px); cursor: pointer; font: 800 10px/1 system-ui, sans-serif; }
  .has-scene-artwork .scene-artwork { min-height: 0; grid-row: 1; border: 0; border-radius: 0; box-shadow: none; }
  .has-scene-artwork .scene-artwork img { object-position: 50% 24%; transform: none; }
  .has-scene-artwork .scene-artwork[data-state="loaded"] img { transform: none; }
  .scene-artwork figcaption { min-height: 36px; padding: 6px 10px; font-size: 10px; }
  .scene-frame { padding: 5px 7px; font-size: 8px; }
  .has-scene-artwork .character-summary { grid-row: 2; grid-template-columns: 48px minmax(0, 1fr); min-height: 58px; gap: 10px; padding: 6px 12px; background: rgba(49, 4, 37, 0.96); }
  .has-scene-artwork .portrait-wrap { width: 48px; min-height: 0; border-width: 3px; }
  .has-scene-artwork .portrait { height: 73px; }
  .has-scene-artwork .identity .story-kicker { display: none; }
  .has-scene-artwork .identity h1 { font-size: 20px; letter-spacing: -0.035em; }
  .has-scene-artwork .identity #scene-label { max-width: 100%; overflow: hidden; font-size: 10px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
  .call-card.scene-expanded { grid-template-rows: minmax(0, 1fr); }
  .scene-expanded .visual-panel { grid-row: 1; }
  .scene-expanded .conversation-panel { display: none; }
  .scene-expanded .scene-artwork img { object-fit: contain; transform: none; background: #23061c; }
  .scene-expanded .scene-artwork[data-state="loaded"] img { transform: none; }
  .conversation-panel { min-height: 0; gap: 9px; padding: 11px 13px max(9px, env(safe-area-inset-bottom)); }
  .call-status-bar { gap: 7px; }
  .status { min-height: 34px; padding: 6px 10px; font-size: 11px; }
  .latency { min-width: 160px; }
  .latency-heading { min-height: 34px; gap: 7px; padding: 5px 8px; font-size: 10px; }
  .latency-heading > #latency-title { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .latency-details { padding: 0 9px 9px 22px; }
  .microphone-check { padding: 7px 9px; font-size: 11px; }
  .conversation-scroll { gap: 12px; padding-right: 4px; }
  .bubble { max-width: 92%; padding: 11px 13px; font-size: 14px; }
  .speaker-label { font-size: 10px; }
  .call-dock { gap: 7px; padding-top: 8px; }
  .control-button { min-width: 66px; min-height: 52px; padding: 6px 9px; border-radius: 16px; }
  .text-controls { grid-template-columns: 1fr 48px; gap: 7px; }
  .text-controls input { min-height: 50px; }
  .jump-latest { right: 9px; bottom: 9px; }
  .start-controls { margin-block: auto; }
  .start-heading h2 { font-size: 36px; }
  .start-actions { grid-template-columns: 1fr; margin-top: 21px; }
  .start-call { min-height: 78px; }
}

@media (max-width: 430px) {
  .brand-lockup { font-size: 18px; }
  .brand-mode { display: none; }
  .portrait { height: 290px; }
  .voice-disclosure { display: none; }
}

@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;
  }
}

/* Character-first library — the player above intentionally keeps its compact call layout. */
body {
  background: var(--cream);
}

body::before,
body::after {
  display: none;
}

.auth-brand {
  width: 154px;
  height: 54px;
  overflow: hidden;
}

.auth-brand img,
.brand-lockup img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.42);
}

.brand-lockup {
  width: 158px;
  height: 54px;
  flex: none;
  overflow: hidden;
}

.brand-lockup.compact {
  width: 124px;
  height: 42px;
}

.library-view {
  width: min(100%, 1480px);
  padding-bottom: 24px;
}

.library-header {
  min-height: 64px;
  margin-bottom: clamp(24px, 3vw, 44px);
}

.library-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.library-nav button,
.mobile-nav button,
.text-action {
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.library-nav button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 850;
}

.library-nav button:hover,
.library-nav button[aria-current="page"] {
  background: white;
  box-shadow: 0 8px 24px rgba(34, 44, 167, 0.1);
}

.library-panels,
.library-panel {
  min-width: 0;
}

.section-heading .eyebrow,
.page-heading .eyebrow {
  color: var(--smart-blue, #006bee);
}

.page-heading h1 {
  margin: 0;
  max-width: 880px;
  color: var(--ink);
  font-size: clamp(47px, 6.2vw, 92px);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.page-heading > p:last-child {
  max-width: 600px;
  margin: 22px 0 0;
  color: #656a98;
  font: 17px/1.55 system-ui, sans-serif;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.section-heading h2,
.empty-adventure h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 3.3vw, 50px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.text-action {
  min-height: 44px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 900;
}

.text-action:hover {
  color: var(--smart-blue, #006bee);
}

.character-art-crop {
  --character-art-top: auto;
  --character-art-right: auto;
  --character-art-bottom: -5%;
  --character-art-left: 50%;
  --character-art-width: 84%;
  --character-art-height: 106%;
  --character-art-fit: contain;
  --character-art-position: center bottom;
  --character-art-clip: none;
  --character-art-shift-x: -50%;
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
}

.character-art-crop > img {
  position: absolute;
  top: var(--character-art-top);
  right: var(--character-art-right);
  bottom: var(--character-art-bottom);
  left: var(--character-art-left);
  width: var(--character-art-width);
  height: var(--character-art-height);
  max-width: none;
  object-fit: var(--character-art-fit);
  object-position: var(--character-art-position);
  clip-path: var(--character-art-clip);
  transform: translateX(var(--character-art-shift-x));
  pointer-events: none;
}

.character-art-crop.tara,
.character-art-crop.selected-tara {
  --character-art-width: 96%;
  --character-art-height: 105%;
}

.character-art-crop.zip,
.character-art-crop.selected-zip {
  --character-art-top: -14%;
  --character-art-bottom: auto;
  --character-art-width: 164%;
  --character-art-height: auto;
  --character-art-fit: fill;
  --character-art-clip: inset(0 50% 0 0);
  --character-art-shift-x: -30.2%;
}

.character-art-crop.doctor-emma,
.character-art-crop.selected-doctor-emma {
  --character-art-top: -10%;
  --character-art-bottom: auto;
  --character-art-width: 162%;
  --character-art-height: auto;
  --character-art-fit: fill;
  --character-art-clip: inset(0 50% 0 0);
  --character-art-shift-x: -31%;
}

.pack-signals span {
  padding: 8px 11px;
  border: 1px solid rgba(34, 44, 167, 0.1);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  color: var(--ink);
  font: 750 12px/1 system-ui, sans-serif;
}

.primary-action {
  min-height: 54px;
  padding: 0 24px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--smart-blue, #006bee), var(--mid-blue));
  color: white;
  box-shadow: 0 13px 28px rgba(0, 107, 238, 0.22);
  cursor: pointer;
  font-size: 15px;
  font-weight: 950;
}

.primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 34px rgba(0, 107, 238, 0.28);
}

.pack-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0;
}

.page-heading {
  margin-bottom: 28px;
  padding: 12px 10px 0;
}

.page-heading h1 {
  font-size: clamp(46px, 5.6vw, 80px);
}

.adventures-panel {
  min-height: 620px;
}

.empty-adventure {
  min-height: 300px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: clamp(28px, 5vw, 62px);
  border: 2px dashed rgba(34,44,167,0.14);
  border-radius: 34px;
  background: rgba(255,255,255,0.58);
}

.empty-adventure p {
  margin: 9px 0 0;
  color: #6a6f9e;
  font: 15px/1.5 system-ui, sans-serif;
}

.empty-compass {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #b7edff, #68d8ff);
  color: var(--ink);
  font-size: 34px;
}

.adventure-list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgba(34,44,167,0.1);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 18px 48px rgba(34,44,167,0.09);
}

.adventure-list-card .eyebrow {
  color: var(--smart-blue, #006bee);
}

.adventure-list-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.adventure-list-card p:last-child {
  margin: 12px 0 0;
  color: #6a6f9e;
  font: 14px/1.4 system-ui, sans-serif;
}

.mobile-nav {
  display: none;
}

@media (max-width: 1050px) {
  .library-nav button { padding-inline: 12px; }
  .account-email { display: none; }
}

@media (max-width: 800px) {
  .app-shell { padding: 12px 12px 84px; }
  .library-header { min-height: 58px; margin: 0 4px 14px; }
  .brand-lockup { width: 132px; height: 48px; }
  .library-nav { display: none; }
  .library-header .brand-header-actions { min-width: 0; flex: 1; }
  .library-header .sign-out-button,
  .library-header .download-button { display: none; }
  .section-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 48px; }
  .empty-adventure { grid-template-columns: 1fr; justify-items: start; }
  .adventure-list-card { align-items: stretch; flex-direction: column; }
  .mobile-nav { position: fixed; z-index: 70; right: 10px; bottom: max(9px, env(safe-area-inset-bottom)); left: 10px; min-height: 66px; display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid rgba(34,44,167,0.11); border-radius: 23px; background: rgba(255,253,249,0.94); box-shadow: 0 18px 46px rgba(34,44,167,0.18); backdrop-filter: blur(16px); }
  .mobile-nav button { min-height: 66px; display: grid; place-items: center; align-content: center; gap: 2px; color: #777ba6; font: 750 11px/1.1 system-ui, sans-serif; }
  .mobile-nav button span { font-size: 20px; }
  .mobile-nav button[aria-current="page"] { color: var(--smart-blue, #006bee); background: #f0f9ff; }
}

@media (max-width: 480px) {
  .library-header { gap: 8px; }
  .brand-lockup { width: 118px; }
  .section-heading h2 { font-size: 30px; }
  .pack-signals { gap: 6px; }
  .pack-signals span { padding: 7px 9px; font-size: 11px; }
}
:root .ink-edition-banner { margin: 0; padding: 10px 24px; background: #e2f1e6; color: #204a35; font-size: 14px; text-align: center; }
:root .ink-edition-banner a { color: #204a35; font-weight: 700; }

/* Home: the adventures that can be called are the page. */
.page-heading h1 span { color: var(--smart-blue, #006bee); }
.home-heading { margin-bottom: 34px; }
.section-note { color: #656a98; font: 15px/1.5 system-ui, sans-serif; }

.still-going {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 34px;
  padding: 18px 26px 18px 18px;
  border: 1px solid rgba(34, 44, 167, 0.1);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(34, 44, 167, 0.09);
}
.still-going-portrait,
.workshop-portrait,
.character-row-portrait {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid rgba(34, 44, 167, 0.1);
  border-radius: 50%;
  background: var(--portrait-bg, #e7f9ff);
  box-shadow: inset 0 -22px 38px rgba(34, 44, 167, 0.05);
}
.still-going-portrait { width: 62px; }
.still-going-copy { flex: 1; min-width: 0; }
.still-going-copy .eyebrow { margin-bottom: 5px; }
.still-going-copy strong { display: block; font-size: 19px; letter-spacing: -0.03em; }
.still-going-copy span { display: block; margin-top: 4px; color: #656a98; font: 15px/1.5 system-ui, sans-serif; }
.still-going-actions { display: flex; align-items: center; gap: 12px; }
.still-going-actions .text-action { color: #656a98; }

.adventure-doors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 42px);
  margin-bottom: 56px;
}
.adventure-doors[data-door-count="1"] { grid-template-columns: minmax(0, 720px); }
.adventure-door {
  overflow: hidden;
  border: 1px solid rgba(34, 44, 167, 0.1);
  border-radius: 34px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}
.adventure-door { display: grid; grid-template-rows: 300px auto; }
.adventure-door-art {
  position: relative;
  background:
    radial-gradient(circle at 50% 118%, rgba(85, 217, 255, 0.5), transparent 60%),
    var(--door-bg, #e7f7ff);
}
.adventure-door-art .character-art-crop { position: absolute; inset: 0; }
.door-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.door-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(34, 44, 167, 0.1);
  font: 900 12px/1.35 system-ui, sans-serif;
  letter-spacing: 0.02em;
}
.adventure-door-copy { display: flex; flex-direction: column; gap: 16px; padding: 28px 32px 32px; }
.adventure-door-copy .eyebrow { margin-bottom: 6px; color: var(--smart-blue, #006bee); }
.adventure-door h3 { margin: 0; font-size: clamp(26px, 2.3vw, 33px); line-height: 1.02; letter-spacing: -0.045em; }
.adventure-door-summary { margin: 0; color: #656a98; font: 15px/1.5 system-ui, sans-serif; }
.adventure-door .pack-signals { margin: 0; }
.content-rating { margin: -6px 0 0; color: #7277a5; font: 13px/1.45 system-ui, sans-serif; }
.adventure-door .primary-action { align-self: flex-start; margin-top: 4px; }

.workshop-rail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}
.workshop-character { display: grid; gap: 10px; justify-items: center; }
.workshop-character strong { font-size: 15px; text-align: center; }
.workshop-character .workshop-portrait { width: 100%; opacity: 0.5; filter: saturate(0.35); }

/* Discover: worlds a child can call into, one row per character. */
.discover-heading p:last-child { margin-top: 14px; }
.world-band { margin-bottom: 36px; }
.world-heading { margin-bottom: 16px; }
.world-heading h2 { font-size: clamp(26px, 2.6vw, 40px); }
.character-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.character-row {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid rgba(34, 44, 167, 0.1);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(34, 44, 167, 0.07);
}
.character-row-soon { background: rgba(255, 255, 255, 0.5); box-shadow: none; }
.character-row-head { display: flex; align-items: center; gap: 14px; }
.character-row-portrait { width: 60px; }
.character-row-soon .character-row-portrait { opacity: 0.5; filter: saturate(0.35); }
.character-row-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.character-row-copy strong { font-size: 18px; letter-spacing: -0.03em; line-height: 1.1; }
.character-row-copy span { color: var(--ink); font: 700 14px/1.3 system-ui, sans-serif; }
.character-row-copy small { color: #7277a5; font: 13px/1.35 system-ui, sans-serif; }
.character-row-soon .character-row-copy strong,
.character-row-soon .character-row-copy span { color: #656a98; }
.compact-action { min-height: 44px; flex: none; padding: 0 18px; border-radius: 14px; font-size: 14px; }
.soon-badge {
  flex: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(34, 44, 167, 0.07);
  color: #7277a5;
  font: 800 12px/1 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.character-row-details { margin-top: 12px; border-top: 1px solid rgba(34, 44, 167, 0.08); }
.character-row-details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--smart-blue, #006bee);
  cursor: pointer;
  font: 850 14px/1 inherit;
  list-style: none;
}
.character-row-details summary::-webkit-details-marker { display: none; }
.character-row-details summary::before { content: "+"; width: 18px; font-size: 18px; text-align: center; }
.character-row-details[open] summary::before { content: "–"; }
.character-row-about { display: grid; gap: 12px; padding: 2px 0 8px; }
.character-row-about p { margin: 0; color: #656a98; font: 15px/1.5 system-ui, sans-serif; }
.character-row-about .pack-signals { margin: 0; }
.character-row-about .content-rating { margin: 0; }
.framing-note strong { color: var(--ink); }
.character-row-about .secondary-action { justify-self: start; }
.secondary-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border: 1px solid rgba(34, 44, 167, 0.12);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(34, 44, 167, 0.1);
  font: 950 14px/1 inherit;
  text-decoration: none;
}
.secondary-action:hover { color: var(--smart-blue, #006bee); }

@media (max-width: 1050px) {
  .character-rows { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .still-going { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .still-going-actions { width: 100%; }
  .still-going-actions .primary-action { flex: 1; }
  .home-heading { margin-bottom: 22px; }
  .adventure-doors { grid-template-columns: 1fr; gap: 18px; margin-bottom: 36px; }
  .adventure-door { grid-template-rows: 240px auto; border-radius: 26px; }
  .adventure-door-copy { padding: 22px 20px 24px; }
  .adventure-door .primary-action { width: 100%; min-height: 56px; justify-content: center; }
  .workshop-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .discover-heading { margin-bottom: 18px; }
  .discover-heading p:last-child { margin-top: 10px; font-size: 15px; }
  .world-band { margin-bottom: 26px; }
  .world-heading { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 12px; }
  .world-heading h2 { font-size: 26px; }
  .character-rows { gap: 10px; }
  .character-row { padding: 12px 14px; border-radius: 18px; }
  .character-row-portrait { width: 52px; }
  .compact-action { width: auto; }
  .character-row-copy strong { font-size: 17px; }
  .compact-action { padding: 0 16px; }
}
@media (max-width: 480px) {
  .workshop-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workshop-character strong { font-size: 13px; }
}

/* Phone-first calling experience. Keep optical character transforms above authoritative. */
.control-icon svg, .control-button svg { width: 25px; height: 25px; display: block; }
.hang-up-icon { transform: rotate(135deg); }
#start-call { background: #16794c; color: white; box-shadow: 0 8px 24px #16794c26; }
#start-typing { background: #edf0f8; color: #353c64; box-shadow: none; }
.end-button { background: #d93b50; border-color: #d93b50; color: white; }
.control-button[aria-pressed="true"] { background: #293555; color: white; }
.player-nav .brand-lockup { opacity: .8; }
.visual-panel { background: linear-gradient(155deg, #243b51, #111d32); }
.start-heading h2 { letter-spacing: -.045em; }
.start-heading .eyebrow { color: #4b6774; }
.call-time { font-variant-numeric: tabular-nums; }
@media (max-width: 800px) {
  .app-shell { padding: max(12px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
  .auth-form input { font-size: 16px; }
  .mobile-nav { bottom: 0; left: 0; right: 0; padding-bottom: env(safe-area-inset-bottom); border-radius: 22px 22px 0 0; }
  body[data-player-active="true"] .app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    /* The shell is fixed to the visual viewport and the document below is locked
       (see the phone polish block), so Safari's chrome never scrolls over the header.
       Only a real hardware inset (standalone/PWA) needs clearance. */
    padding: env(safe-area-inset-top, 0px) 0 0;
    transform: none;
    background: #f8f9fc;
  }
  body[data-player-active="true"] { background: #f8f9fc; }
  body[data-player-active="true"] .player-nav {
    min-height: 48px;
    margin: 0;
    padding: 2px 10px;
    display: grid;
    grid-template-columns: minmax(76px, 1fr) auto minmax(76px, 1fr);
    gap: 8px;
    background: #111d32;
    border: 0;
  }
  .player-nav-title {
    display: block;
    overflow: hidden;
    color: #f8fbff;
    font: 800 15px/1 ui-rounded, system-ui, sans-serif;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .player-nav .back-button {
    width: fit-content;
    min-width: 0;
    min-height: 44px;
    padding: 0 8px;
    color: #f3f6fc;
    background: transparent;
    border-color: transparent;
    border-radius: 12px;
    font-size: 13px;
  }
  .player-nav .back-button > span { font-size: 21px; font-weight: 500; }
  .player-nav-actions { justify-self: end; gap: 4px; }
  .player-nav .details-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    color: #f3f6fc;
    background: #ffffff12;
    border-color: #ffffff20;
    border-radius: 50%;
  }
  .desktop-button-label { display: none; }
  .mobile-button-icon { display: grid; place-items: center; font: 800 16px/1 Georgia, serif; }
  .player-nav #story-debug-open { display: none; }
  .player-nav .download-button, .player-nav .sign-out-button { display: none; }
  .call-card, .call-card:not(.has-scene-artwork) { grid-template-rows: clamp(190px, 34%, 250px) minmax(0, 1fr); background: #111d32; }
  .call-card:not(.has-scene-artwork) .visual-panel,
  .has-scene-artwork .visual-panel { display: flex; flex-direction: column; padding: 12px 20px; gap: 8px; }
  .visual-panel .topbar, .has-scene-artwork .topbar { position: relative; inset: auto; flex: none; justify-content: center; text-align: center; }
  .has-scene-artwork .topbar > div:first-child { padding: 0; border: 0; background: transparent; }
  .topbar .eyebrow { display: none; }
  .visual-panel .call-time { color: #d3e1e9; font: 12px/1.5 system-ui, sans-serif; letter-spacing: .04em; }
  .has-scene-artwork .scene-artwork { position: absolute; inset: 0; display: block; border: 0; border-radius: 0; background: #111d32; }
  .has-scene-artwork .scene-artwork img { height: 100%; object-fit: cover; object-position: center; }
  .has-scene-artwork .scene-artwork[data-state="loaded"] img { opacity: 1; filter: saturate(.9); }
  .has-scene-artwork .scene-artwork::before { position: absolute; z-index: 2; inset: 0; content: ""; background: linear-gradient(#111d3266, #111d3214 26%, #111d3266 62%, #111d32e0 88%, #111d32); }
  .scene-artwork figcaption { position: absolute; bottom: 0; left: 0; right: 0; min-height: 24px; justify-content: center; padding: 3px 8px; background: transparent; }
  .scene-artwork figcaption > span:first-child { display: none; }
  .scene-frame { font-size: 9px; padding: 3px 7px; background: #111d32bb; }
  .visual-panel .character-summary, .has-scene-artwork .character-summary { position: relative; z-index: 3; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 0 0 20px; background: none; text-align: center; }
  /* Whole Caesar figure uses contain, centered with no positional nudge. */
  .visual-panel .portrait-wrap, .has-scene-artwork .portrait-wrap { flex: 1; min-height: 50px; max-height: 150px; width: 132px; margin: 0 auto; display: flex; justify-content: center; overflow: visible; border: 0; border-radius: 0; background: none; box-shadow: none; aspect-ratio: auto; }
  .visual-panel .portrait, .has-scene-artwork .portrait { width: 100%; height: 100%; max-height: none; transform: none; }
  .visual-panel .portrait img { width: 100%; height: 100%; object-fit: contain; transform: none; }
  .visual-panel .identity { margin: 0; flex: none; }
  .visual-panel .identity h1, .has-scene-artwork .identity h1 { font-size: 29px; line-height: 1.1; }
  .visual-panel .identity .story-kicker { display: none; }
  .visual-panel .identity #scene-label, .has-scene-artwork .identity #scene-label { margin-top: 6px; max-width: 100%; font-size: 12px; white-space: normal; line-height: 1.35; color: #d2dfea; }
  /* With scene artwork the picture itself is the view: the figure moves into a small
     avatar beside the name at the foot of the scene instead of covering its middle. */
  .has-scene-artwork .character-summary { display: grid; grid-template-columns: auto minmax(0, auto); align-items: center; align-content: end; justify-content: center; gap: 11px; padding: 0 16px 18px; text-align: left; }
  .has-scene-artwork .portrait-wrap { flex: none; width: 46px; height: 46px; min-height: 0; max-height: none; margin: 0; overflow: hidden; border: 2px solid rgba(255, 255, 255, .82); border-radius: 50%; background: rgba(17, 29, 50, .55); }
  .has-scene-artwork .portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
  .has-scene-artwork .identity { min-width: 0; margin: 0; flex: none; }
  .has-scene-artwork .identity h1 { font-size: 21px; line-height: 1.15; }
  .has-scene-artwork .identity #scene-label { margin-top: 2px; font-size: 11.5px; }
  .visual-panel .voice-disclosure { display: none; }
  .has-scene-artwork .scene-toggle {
    top: 12px;
    right: 12px;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    box-shadow: none;
  }
  .has-scene-artwork .scene-toggle::before { content: "⛶"; font: 500 18px/1 system-ui, sans-serif; }
  .has-scene-artwork .scene-toggle[aria-expanded="true"]::before { content: "×"; font-size: 25px; }
  /* The Visual Viewport already ends above Safari's bottom toolbar. Adding the
     hardware safe-area inset again lifts the call controls too far upward. */
  .conversation-panel { border-radius: 22px 22px 0 0; padding: 10px 14px 8px; background: #f8f9fc; gap: 7px; }
  .call-status-bar { justify-content: center; }
  .status { max-width: 100%; min-width: 0; min-height: 30px; flex-shrink: 1; gap: 7px; padding: 4px 9px; background: transparent; text-align: center; font-size: 11px; }
  .status-dot { width: 7px; height: 7px; }
  body:not([data-debug="true"]) .latency,
  body:not([data-debug="true"]) .microphone-check[data-state="working"] { display: none !important; }
  .start-controls { margin-block: auto; padding: 3px 0; }
  .start-heading { text-align: center; }
  .start-heading .eyebrow { font-size: 10px; margin-bottom: 6px; }
  .start-heading h2 { font-size: 28px; margin: 0; }
  .start-actions { grid-template-columns: 1fr; margin-top: 16px; gap: 8px; }
  .start-call { min-height: 58px; padding: 10px 18px; border-radius: 19px; justify-content: center; }
  .start-call .control-icon { width: 30px; height: 30px; background: none; font-size: 25px; }
  .start-call strong { font-size: 16px; }
  .start-call small { font-size: 11px; }
  #start-help { margin-top: 10px; text-align: center; font-size: 11px; }
  .call-dock { flex-direction: column; gap: 8px; padding-top: 8px; }
  .text-controls { width: 100%; flex: none; }
  .text-controls input { font-size: 16px; }
  .call-controls { width: min(100%, 310px); justify-content: space-between; gap: 16px; }
  .control-button { width: 64px; min-width: 64px; min-height: 64px; border-radius: 50%; gap: 2px; padding: 7px 5px; }
  .control-button small { font-size: 9px; }
  .control-icon svg, .control-button svg { width: 22px; height: 22px; }
  .bubble { max-width: 92%; padding: 10px 13px; font-size: 14px; line-height: 1.42; background: #e9edf6; border-color: #e0e5ef; color: #283753; }
  .bubble.user { background: #deeee6; color: #20523a; border-color: #cce3d6; }
  .speaker-label { color: #52617b; }
  .call-card.scene-expanded { grid-template-rows: minmax(0, 1fr); }
  .scene-expanded .visual-panel { padding: 0; }
  .scene-expanded .character-summary { display: none; }
  .scene-expanded .scene-artwork { top: 0; }
  .scene-expanded .scene-artwork[data-state="loaded"] img { opacity: 1; object-fit: cover; object-position: 50% 50%; filter: none; }
  .scene-expanded .scene-artwork[data-artwork="image-riverbank"] img { object-position: 26% 50%; }
  .scene-expanded .scene-artwork::before { display: none; }
  .scene-expanded .scene-artwork figcaption {
    min-height: 54px;
    padding: 18px 12px 8px;
    background: linear-gradient(transparent, rgba(17, 29, 50, .82));
  }
}
@media (max-width: 800px) and (max-height: 700px) {
  .call-card, .call-card:not(.has-scene-artwork) { grid-template-rows: minmax(145px, 31%) minmax(0, 1fr); }
  .visual-panel .portrait-wrap, .has-scene-artwork .portrait-wrap { max-height: 76px; }
  .visual-panel .identity h1, .has-scene-artwork .identity h1 { font-size: 24px; }
  .call-card.scene-expanded { grid-template-rows: minmax(0, 1fr); }
}
#story-debug-dialog {width:min(1400px,96vw);max-width:96vw;height:92vh;max-height:92vh;background:#fffdf7;color:#20372e;border:1px solid #aac4b8;border-radius:18px;padding:22px;overflow:auto}
#story-debug-dialog::backdrop {background:#10282099}#story-debug-dialog header {display:flex;justify-content:space-between;align-items:center;gap:20px}#story-debug-dialog button {font:inherit;padding:8px 14px;border-radius:10px}#story-debug-dialog h2 {font-size:23px}#story-debug-dialog p,#story-debug-dialog li {font-size:14px;line-height:1.5}#story-debug-summary {margin:18px 0;padding:14px;background:#e1f0e7;font-weight:700}.story-debug-grid {display:grid;grid-template-columns:340px 1fr;gap:20px}#story-debug-map {width:100%;height:1100px;border:1px solid #bfd0c5;border-radius:12px}#story-debug-state {min-width:0}#story-debug-state pre {white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;background:#edf1ed;padding:10px}#story-debug-state table {font-size:13px;width:100%;text-align:left}#story-debug-state td {padding:8px}#story-debug-state th {overflow-wrap:anywhere}#story-debug-open {white-space:nowrap}@media(max-width:700px){.story-debug-grid {grid-template-columns:1fr}#story-debug-map {height:700px}#story-debug-dialog {padding:12px}#story-debug-dialog h2 {font-size:18px}.player-nav-actions #story-debug-open {padding:7px 9px;font-size:12px}}
@media(max-width:700px){#story-debug-map {grid-row:1;height:520px}#story-debug-state {grid-row:2}}

/* ==========================================================================
   Phone call-screen polish. Mobile only, layered after every rule above so the
   tested declarations (48px clearance, fixed shell, portrait containment,
   scene-toggle inset, sheet padding) stay exactly where they are.
   ========================================================================== */
@media (max-width: 800px) {
  /* Lock the document while a call is active so Safari has nothing to scroll and its
     toolbars never collapse over the header; the fixed shell then starts at the very top. */
  html:has(body[data-player-active="true"]) { height: 100%; overflow: hidden; }
  body[data-player-active="true"] { height: 100dvh; min-height: 0; overflow: hidden; overscroll-behavior: none; }
  body[data-player-active="true"],
  body[data-player-active="true"] .app-shell,
  body[data-player-active="true"] .player-view { background: #111d32; }
  .player-nav .back-button { font-weight: 700; }
  .player-nav .back-button > span { font-size: 20px; }

  /* Hero: dimmed backdrop, strong base gradient, glass timer pill, halo behind the figure. */
  .has-scene-artwork .scene-artwork[data-state="loaded"] img { opacity: 0.5; filter: saturate(0.7); }
  .has-scene-artwork .scene-artwork::before {
    background: linear-gradient(180deg, rgba(17, 29, 50, 0.62) 0%, rgba(17, 29, 50, 0.08) 32%, rgba(17, 29, 50, 0.3) 58%, rgba(17, 29, 50, 0.93) 88%, #111d32 100%);
  }
  .visual-panel .topbar,
  .has-scene-artwork .topbar { align-items: center; gap: 8px; min-height: 28px; }
  .visual-panel .topbar > div:first-child,
  .has-scene-artwork .topbar > div:first-child {
    padding: 4px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .visual-panel .call-time { color: #e6eef6; font: 650 12px/1.4 system-ui, sans-serif; letter-spacing: 0.03em; }
  .has-scene-artwork .live-dot:not([hidden]),
  .visual-panel .live-dot:not([hidden]) {
    display: block !important;
    width: 8px;
    height: 8px;
    margin: 0;
    border: 0;
    background: #34d27b;
    box-shadow: 0 0 0 calc(3px + (var(--energy) * 6px)) rgba(52, 210, 123, 0.22);
  }
  .visual-panel .portrait-wrap,
  .has-scene-artwork .portrait-wrap { position: relative; }
  .visual-panel .portrait-wrap::before {
    position: absolute;
    left: 50%;
    bottom: -6%;
    width: 160%;
    height: 72%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(85, 217, 255, 0.34), rgba(85, 217, 255, 0));
    content: "";
    pointer-events: none;
  }
  .visual-panel .portrait { position: relative; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.45)); }
  .visual-panel .character-summary,
  .has-scene-artwork .character-summary { gap: 6px; padding: 0 0 30px; }
  .visual-panel .identity h1,
  .has-scene-artwork .identity h1 { font-size: 27px; line-height: 1.08; letter-spacing: -0.04em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35); }
  .visual-panel .identity #scene-label,
  .has-scene-artwork .identity #scene-label {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: 300px;
    margin: 4px auto 0;
    color: #b7c6d6;
    font: 500 11.5px/1.3 system-ui, sans-serif;
  }
  .scene-artwork figcaption { bottom: 8px; min-height: 20px; }
  .scene-expanded .scene-artwork figcaption { bottom: 0; }
  .scene-frame {
    padding: 3px 8px;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #d8e3ee;
    font-size: 8px;
    letter-spacing: 0.08em;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  .scene-expanded .scene-frame { background: rgba(17, 29, 50, 0.6); }
  .has-scene-artwork .scene-toggle {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(17, 29, 50, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* Conversation sheet. */
  .conversation-panel { border-radius: 26px 26px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); }
  .status { min-height: 28px; padding: 4px 11px; border-radius: 999px; background: #eef1f7; color: #56607d; font-weight: 700; }
  .conversation { gap: 13px; }
  .turn { gap: 4px; }
  .speaker-label { padding: 0 6px; color: #6b7a94; font: 700 10.5px/1.2 system-ui, sans-serif; letter-spacing: 0.01em; }
  .user-turn .speaker-label { color: #2f7a55; }
  .bubble { max-width: 88%; padding: 11px 14px; border-color: #e3e8f1; border-radius: 6px 18px 18px 18px; background: #eceff6; color: #263450; font-size: 15px; line-height: 1.42; }
  .bubble.user { border-color: #cfe4d8; border-radius: 18px 6px 18px 18px; background: #dff0e7; color: #1f4f38; }
  .error {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(217, 59, 80, 0.18);
    border-radius: 16px;
    background: #fff3f4;
    color: #8e2333;
    font: 500 13px/1.45 system-ui, sans-serif;
  }
  .error::before {
    flex: none;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    margin-top: 1px;
    border-radius: 50%;
    background: #d93b50;
    color: white;
    font: 800 12px/1 system-ui, sans-serif;
    content: "!";
  }
  .suggestions > p { margin-bottom: 8px; color: #7a869d; font-size: 11px; }
  #suggestion-list { display: flex; flex-wrap: wrap; gap: 8px; }
  #suggestion-list button {
    width: auto;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid rgba(34, 44, 167, 0.16);
    border-radius: 999px;
    background: white;
    color: #222ca7;
    box-shadow: 0 2px 6px rgba(34, 44, 167, 0.06);
    font: 600 13.5px/1.3 system-ui, sans-serif;
  }
  #suggestion-list button:hover { transform: none; }
  .start-heading .eyebrow { color: #6b7a94; }

  /* After a call the transcript stays readable and the call-again actions pin to the bottom. */
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin-top: auto;
    padding: 12px 0 2px;
    background: linear-gradient(rgba(248, 249, 252, 0), #f8f9fc 32%);
  }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-heading,
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls #start-help { display: none; }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-actions { grid-template-columns: 1.25fr 1fr; gap: 8px; margin-top: 0; }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-call { min-height: 54px; gap: 6px; padding: 8px 10px; }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-call .control-icon { width: 26px; height: 26px; font-size: 20px; }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-call small { display: none; }
  .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-call strong { font-size: 14.5px; white-space: nowrap; }

  /* Dock. */
  .call-dock { padding-top: 8px; border-top-color: rgba(34, 44, 167, 0.08); }
  .call-controls { width: 100%; justify-content: center; gap: 28px; }
  .control-button { width: 60px; min-width: 60px; min-height: 60px; border-color: #dde3ee; box-shadow: 0 2px 8px rgba(17, 29, 50, 0.08); }
  .control-button small { color: #4d5a73; font-size: 9.5px; font-weight: 650; }
  .end-button small,
  .control-button[aria-pressed="true"] small { color: white; }
  .text-controls { grid-template-columns: 1fr 48px; align-items: center; gap: 8px; }
  .text-controls input { min-height: 48px; padding: 0 14px; border-color: #dde3ee; border-radius: 999px; }
  .text-controls input::placeholder { font-size: 15px; }
  .text-controls button { width: 48px; height: 48px; border-radius: 50%; font-size: 20px; }
  .call-card[data-input-mode="typing"] .call-dock { flex-direction: row; align-items: center; gap: 6px; }
  .call-card[data-input-mode="typing"] .text-controls { grid-template-columns: 1fr 44px; gap: 6px; }
  .call-card[data-input-mode="typing"] .text-controls button { width: 44px; height: 44px; font-size: 18px; }
  .call-card[data-input-mode="typing"] .text-controls { width: auto; flex: 1; }
  .call-card[data-input-mode="typing"] .call-controls { width: auto; flex: none; gap: 8px; }
  .call-card[data-input-mode="typing"] .control-button { width: 44px; min-width: 44px; min-height: 44px; padding: 0; }
  .call-card[data-input-mode="typing"] .control-button small { display: none; }
  .call-card[data-input-mode="typing"] .control-button svg { width: 20px; height: 20px; }
}
/* Short phones (iPhone SE class, landscape): the hero is ~145px, so drop the
   location line and the frame pill rather than letting them collide. */
@media (max-width: 800px) and (max-height: 700px) {
  .call-card:not(.has-scene-artwork) .visual-panel,
  .has-scene-artwork .visual-panel { padding: 8px 20px 6px; gap: 4px; }
  .visual-panel .topbar,
  .has-scene-artwork .topbar { min-height: 26px; }
  .visual-panel .portrait-wrap,
  .has-scene-artwork .portrait-wrap { min-height: 40px; }
  .visual-panel .character-summary,
  .has-scene-artwork .character-summary { gap: 4px; padding: 0 0 8px; }
  .visual-panel .identity h1,
  .has-scene-artwork .identity h1 { font-size: 22px; }
  .visual-panel .identity #scene-label,
  .has-scene-artwork .identity #scene-label { display: none; }
  .has-scene-artwork:not(.scene-expanded) .scene-artwork figcaption { display: none; }
}

/* Icon controls: vector icons centred by geometry, never by glyph metrics. */
@media (max-width: 800px) {
  .has-scene-artwork .scene-toggle { display: grid; place-items: center; }
  .has-scene-artwork .scene-toggle::before,
  .has-scene-artwork .scene-toggle[aria-expanded="true"]::before {
    width: 18px;
    height: 18px;
    background: currentColor;
    content: "";
    font-size: 0;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .has-scene-artwork .scene-toggle[aria-expanded="true"]::before {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  }

  /* Timer pill stays exactly centred and level with the scene toggle; the live dot lives inside it. */
  .visual-panel .topbar,
  .has-scene-artwork .topbar { min-height: 40px; }
  .has-scene-artwork .live-dot:not([hidden]),
  .visual-panel .live-dot:not([hidden]) { display: none !important; }
  .visual-panel .topbar > div:first-child,
  .has-scene-artwork .topbar > div:first-child { display: inline-flex; align-items: center; gap: 7px; }
  .topbar:has(#live-dot:not([hidden])) > div:first-child::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d27b;
    box-shadow: 0 0 0 3px rgba(52, 210, 123, 0.22);
    content: "";
    animation: live-pulse 1.6s ease-in-out infinite;
  }
  @keyframes live-pulse { 50% { box-shadow: 0 0 0 6px rgba(52, 210, 123, 0.06); } }

  /* Send arrow. */
  #send-text { display: grid; place-items: center; font-size: 0; }
  #send-text::before {
    width: 20px;
    height: 20px;
    background: currentColor;
    content: "";
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 5l7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  /* Call controls: a circle per action with its label beneath, so labels never wrap inside the circle. */
  .call-controls { align-items: flex-start; gap: 22px; }
  .control-button,
  .end-button,
  .control-button[aria-pressed="true"] {
    width: auto;
    min-width: 72px;
    min-height: 0;
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: #222ca7;
  }
  .control-button > svg,
  .control-button > span {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    border: 1px solid #dde3ee;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(17, 29, 50, 0.08);
    color: #222ca7;
  }
  .control-button > svg { padding: 16px; }
  .hang-up-icon { transform: none; }
  .hang-up-icon svg { width: 22px; height: 22px; transform: rotate(135deg); }
  #interruption > span { font-size: 0; }
  #interruption > span::before {
    width: 22px;
    height: 22px;
    background: currentColor;
    content: "";
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2L4.5 13.5H11L10 22l8.5-11.5H12L13 2z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M13 2L4.5 13.5H11L10 22l8.5-11.5H12L13 2z'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .end-button > span { border-color: #d93b50; background: #d93b50; color: white; }
  .control-button[aria-pressed="true"] > svg,
  .control-button[aria-pressed="true"] > span { border-color: #293555; background: #293555; color: white; }
  .control-button small,
  .end-button small,
  .control-button[aria-pressed="true"] small { color: #4d5a73; font: 650 10px/1 system-ui, sans-serif; white-space: nowrap; }
  .call-card[data-input-mode="typing"] .control-button { min-width: 0; }
  .call-card[data-input-mode="typing"] .control-button > svg,
  .call-card[data-input-mode="typing"] .control-button > span { width: 44px; height: 44px; }
  .call-card[data-input-mode="typing"] .hang-up-icon svg { width: 20px; height: 20px; }
}

/* Notion front poses: source dimensions and measured focal points in assets/figurines-notion.md.
   Scale each visible head-to-foot span to 88% of its viewport, with a 6% top margin. */
.character-art-crop:is(.ninja, .selected-ninja) {
  --character-art-top: -14.8000%;
  --character-art-bottom: auto;
  --character-art-width: auto;
  --character-art-height: 133.0133%;
  --character-art-fit: fill;
  --character-art-clip: inset(15% 54% 18% 16%);
  --character-art-shift-x: -30.7082%;
}
.character-art-crop:is(.centurion, .selected-centurion) {
  --character-art-top: -8.0762%;
  --character-art-bottom: auto;
  --character-art-width: auto;
  --character-art-height: 119.4081%;
  --character-art-fit: fill;
  --character-art-clip: inset(11% 55% 14% 17%);
  --character-art-shift-x: -29.3040%;
}
.character-art-crop:is(.princess, .selected-princess) {
  --character-art-top: -13.1965%;
  --character-art-bottom: auto;
  --character-art-width: auto;
  --character-art-height: 118.5054%;
  --character-art-fit: fill;
  --character-art-clip: inset(16% 55% 9% 13%);
  --character-art-shift-x: -28.9988%;
}
.character-art-crop:is(.george-washington, .selected-george-washington) {
  --character-art-top: -0.9448%;
  --character-art-bottom: auto;
  --character-art-width: auto;
  --character-art-height: 101.5919%;
  --character-art-fit: fill;
  --character-art-clip: inset(6% 58% 6% 15%);
  --character-art-shift-x: -28.2149%;
}

/* Exact icon centring: the buttons keep their accessible text at font-size 0, and that
   text node would otherwise take a grid cell beside the icon. Absolute + margin auto
   centres the icon independently of any sibling content. */
@media (max-width: 800px) {
  .has-scene-artwork .scene-toggle { display: block; } /* stays position: absolute (top/right 12px) */
  #send-text,
  #interruption > span { position: relative; display: block; }
  .has-scene-artwork .scene-toggle::before,
  .has-scene-artwork .scene-toggle[aria-expanded="true"]::before,
  #send-text::before,
  #interruption > span::before { position: absolute; inset: 0; margin: auto; }
}

/* Captions mode (phone, voice calls). The transcript sheet folds away; Caesar's latest
   line is a caption over the scene; a Transcript pill reopens the full sheet. Driven by
   data-captions="on", which the inline module in index.html sets only for microphone
   calls with no typed field, details panel, or start controls showing. */
.transcript-toggle { display: none; }
@media (max-width: 800px) {
  /* Fourth call-dock control, beside Mute, Interrupt and End call. */
  .transcript-toggle:not([hidden]) { display: grid; }
  #transcript-toggle > span { font-size: 0; }
  #transcript-toggle > span::before {
    width: 22px;
    height: 22px;
    background: currentColor;
    content: "";
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v11H9l-5 4z'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  .call-card[data-captions="on"] { position: relative; grid-template-rows: minmax(0, 1fr); }
  .call-card[data-captions="on"] .visual-panel { grid-row: 1; }
  .call-card[data-captions="on"] .character-summary { padding-bottom: min(250px, 36%); }
  .call-card[data-captions="on"] .portrait-wrap { max-height: 190px; }
  .call-card[data-captions="on"] .conversation-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 44px 14px 8px;
    border-radius: 0;
    background: linear-gradient(rgba(17, 29, 50, 0), rgba(17, 29, 50, 0.88) 30%, #111d32 70%);
    box-shadow: none;
  }
  .call-card[data-captions="on"] .status { background: rgba(255, 255, 255, 0.12); color: #e6eef6; }
  .call-card[data-captions="on"] .microphone-check { background: rgba(255, 255, 255, 0.94); }
  .call-card[data-captions="on"] .conversation-stage { flex: none; min-height: 0; }
  .call-card[data-captions="on"] .conversation-scroll { height: auto; max-height: 150px; gap: 8px; overflow: hidden; padding: 0; }
  .call-card[data-captions="on"] .conversation { gap: 0; }
  .call-card[data-captions="on"] .turn { align-items: center; }
  .call-card[data-captions="on"] .turn.user-turn,
  .call-card[data-captions="on"] .character-turn:has(~ .character-turn),
  .call-card[data-captions="on"] .speaker-label,
  .call-card[data-captions="on"] .suggestions,
  .call-card[data-captions="on"] .jump-latest { display: none !important; }
  .call-card[data-captions="on"] .bubble.character {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    max-width: 100%;
    padding: 0 6px;
    border: 0;
    background: transparent;
    color: #f3f6fc;
    font: 500 16px/1.4 system-ui, sans-serif;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  }
  .call-card[data-captions="on"] .call-dock { border-top-color: rgba(255, 255, 255, 0.12); }
  .call-card[data-captions="on"] .control-button small { color: #c9d4e2; }
  .call-card[data-captions="on"] .control-button > svg,
  .call-card[data-captions="on"] .control-button > span { border-color: rgba(255, 255, 255, 0.18); box-shadow: none; }
}
@media (max-width: 800px) and (max-height: 700px) {
  .call-card[data-captions="on"] .character-summary { padding-bottom: min(230px, 42%); }
  .call-card[data-captions="on"] .conversation-scroll { max-height: 96px; }
  .call-card[data-captions="on"] .bubble.character { -webkit-line-clamp: 3; font-size: 15px; }
}

/* Read-along caption: spoken words are bright, upcoming words are dimmed, and the
   caption never scrolls out of its overlay. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .conversation-scroll { max-height: none; overflow: visible; }
  .call-card[data-captions="on"] .bubble.character .cw { color: rgba(243, 246, 252, 0.42); transition: color 120ms ease; }
  .call-card[data-captions="on"] .bubble.character .cw.spoken { color: #f3f6fc; }
  .call-card[data-captions="on"] .bubble.character .cw.now { color: #ffd54a; }
}

/* Map & state on phones: a map icon beside the info button opens a full-screen sheet
   with Map and State tabs. Desktop keeps the original two-column dialog. */
.story-debug-tabs { display: none; }
@media (max-width: 800px) {
  .player-nav #story-debug-open { display: grid; place-items: center; position: relative; width: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%; color: #f3f6fc; background: #ffffff12; border-color: #ffffff20; font-size: 0; }
  .player-nav #story-debug-open::before {
    position: absolute;
    inset: 0;
    width: 18px;
    height: 18px;
    margin: auto;
    background: currentColor;
    content: "";
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2z M9 4v14 M15 6v14'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l6-2 6 2 6-2v14l-6 2-6-2-6 2z M9 4v14 M15 6v14'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .player-nav-actions { gap: 6px; }

  #story-debug-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: max(env(safe-area-inset-top, 0px), 10px) 12px max(env(safe-area-inset-bottom, 0px), 10px);
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #fffdf9;
  }
  #story-debug-dialog[open] { display: flex; flex-direction: column; gap: 8px; }
  #story-debug-dialog header { flex: none; gap: 12px; }
  #story-debug-dialog h2 { font-size: 17px; margin: 0; }
  #story-debug-dialog header button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: white; font-weight: 700; }
  #story-debug-dialog > p { display: none; }
  #story-debug-dialog > label { font-size: 13px; }
  #story-debug-summary { flex: none; margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; }
  .story-debug-tabs { flex: none; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #e9ede9; }
  .story-debug-tabs button { flex: 1; min-height: 36px; border: 0; border-radius: 9px; background: transparent; color: #20372e; font: 700 13px/1 system-ui, sans-serif; }
  .story-debug-tabs button[aria-selected="true"] { background: white; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
  .story-debug-grid { flex: 1; min-height: 0; display: block; }
  #story-debug-dialog[data-view="map"] #story-debug-state,
  #story-debug-dialog[data-view="state"] #story-debug-map { display: none; }
  #story-debug-map { width: 100%; height: 100%; border-radius: 12px; }
  #story-debug-state { height: 100%; overflow: auto; overscroll-behavior: contain; }
  #story-debug-state h3 { margin: 14px 0 6px; font-size: 14px; }
  #story-debug-state table, #story-debug-state p, #story-debug-state li { font-size: 13px; }
  #story-debug-state th { width: 60%; }
  #story-debug-state td { white-space: nowrap; }
  #story-debug-state pre { font-size: 11px; }
}
@media (max-width: 800px) {
  #story-debug-state:empty::before { display: block; padding: 24px 8px; color: #52675f; font: 14px/1.5 system-ui, sans-serif; text-align: center; content: "Remembered variables, the route taken, and covered facts appear here once a call is connected."; }
}

/* Caption box: fixed height that scrolls with the speech instead of clamping. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .bubble.character {
    display: block;
    -webkit-line-clamp: unset;
    position: relative;
    max-height: calc(1.4em * 4 + 8px);
    padding: 4px 6px;
    overflow: hidden;
    scroll-behavior: smooth;
    -webkit-mask-image: linear-gradient(transparent, black 12%, black 88%, transparent);
    mask-image: linear-gradient(transparent, black 12%, black 88%, transparent);
  }
  .call-card[data-captions="on"] .conversation-scroll { max-height: none; }
}
@media (max-width: 800px) and (max-height: 700px) {
  .call-card[data-captions="on"] .bubble.character { -webkit-line-clamp: unset; max-height: calc(1.4em * 3 + 8px); }
}

/* Captions overlay: measured height keeps the name above the pills, whatever the
   overlay holds. Minimised call: floating bar on the library while the call continues. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .character-summary { padding-bottom: calc(var(--captions-overlay, 250px) - 18px); }
}
@media (max-width: 800px) and (max-height: 700px) {
  .call-card[data-captions="on"] .character-summary { padding-bottom: calc(var(--captions-overlay, 230px) - 22px); }
}
.mini-call {
  position: fixed;
  z-index: 80;
  right: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: #111d32;
  color: #f3f6fc;
  box-shadow: 0 14px 40px rgba(17, 29, 50, 0.35);
}
.mini-call-return { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.mini-call-return img { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); background: #22365a; object-fit: cover; object-position: 50% 12%; }
.mini-call-copy { min-width: 0; display: grid; gap: 2px; }
.mini-call-copy strong { overflow: hidden; font: 800 15px/1.1 ui-rounded, system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.mini-call-copy small { overflow: hidden; color: #b7c6d6; font: 650 11.5px/1.2 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.mini-call-copy small::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #34d27b; vertical-align: 1px; }
.mini-call-end { position: relative; width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: #d93b50; color: white; cursor: pointer; }
.mini-call-end > span { position: absolute; inset: 0; width: 20px; height: 20px; margin: auto; background: currentColor; transform: rotate(135deg); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h4l2 5-3 2a16 16 0 0 0 6 6l2-3 5 2v4a2 2 0 0 1-2 2C10 21 3 14 3 5a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3h4l2 5-3 2a16 16 0 0 0 6 6l2-3 5 2v4a2 2 0 0 1-2 2C10 21 3 14 3 5a2 2 0 0 1 2-2Z'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (max-width: 800px) {
  .mini-call { bottom: calc(66px + 18px + env(safe-area-inset-bottom, 0px)); }
  body:has(.mini-call:not([hidden])) .app-shell { padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 801px) {
  .mini-call { right: auto; left: 50%; width: min(520px, calc(100% - 32px)); transform: translateX(-50%); }
}

/* Full-scene layout also for the ready and call-ended states; the status line keeps
   the full width and may wrap. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .status { max-width: 100%; white-space: normal; line-height: 1.3; text-align: center; }
  .call-card[data-captions="on"] #status-text { overflow: visible; white-space: normal; text-overflow: clip; }
  .error { overflow-wrap: anywhere; }

  .call-card[data-captions="on"] .start-controls,
  .call-card[data-captions="on"] .conversation-scroll > .conversation:not([hidden]) ~ .start-controls { position: static; margin: 0; padding: 0; background: none; }
  .call-card[data-captions="on"] .start-heading .eyebrow { color: #b7c6d6; }
  .call-card[data-captions="on"] .start-heading h2 { color: #f3f6fc; font-size: 24px; }
  .call-card[data-captions="on"] .start-actions { margin-top: 12px; }
  .call-card[data-captions="on"] #start-typing { background: rgba(255, 255, 255, 0.12); color: #f3f6fc; }
  .call-card[data-captions="on"] #start-help { color: #b7c6d6; }
  .call-card[data-captions="on"] .conversation-scroll > .conversation:not([hidden]) ~ .start-controls .start-call { min-height: 52px; }
}

/* Live microphone level while listening on phones, so silent capture is visible. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .microphone-check[data-state="working"] {
    display: grid !important;
    grid-template-columns: auto minmax(60px, 160px) auto;
    align-items: center;
    justify-content: center;
    flex: 1 0 100%;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: #8fa3ba;
    font: 650 10px/1 system-ui, sans-serif;
  }
  .call-card[data-captions="on"] .microphone-check[data-state="working"] .microphone-check-heading { display: contents; }
  .call-card[data-captions="on"] .microphone-check[data-state="working"] .microphone-check-heading strong { color: #b7c6d6; font-weight: 650; }
  .call-card[data-captions="on"] .microphone-check[data-state="working"] .microphone-meter { height: 4px; background: rgba(255, 255, 255, 0.14); }
  .call-card[data-captions="on"] .microphone-check[data-state="working"] #microphone-meter-fill { background: #34d27b; }
  .call-card[data-captions="on"] .microphone-check[data-state="working"] p { display: none; }
}

/* Saved calls remain separate from the live character stage. */
.session-history-panel { max-width: 1000px; margin: 0 auto; padding: 24px 18px 100px; }
/* Your calls: the call in progress, past calls ending-first, and a spoiler-free endings map. */
.calls-layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 40px; align-items: start; }
.calls-heading { margin: 26px 0 14px; align-items: baseline; }
.calls-heading .eyebrow { margin: 0; }
.calls-main { min-width: 0; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-list > p { margin: 0; color: #656a98; font: 15px/1.5 system-ui, sans-serif; }
.history-row {
  min-width: 0;
  border: 1px solid rgba(34, 44, 167, 0.1);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(34, 44, 167, 0.07);
}
.history-row-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 12px 14px 12px 12px;
  cursor: pointer;
  list-style: none;
}
.history-row-head::-webkit-details-marker { display: none; }
.history-portrait,
.endings-portrait {
  position: relative;
  display: block;
  flex: none;
  width: 48px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid rgba(34, 44, 167, 0.1);
  border-radius: 50%;
  background: var(--portrait-bg, #e7f9ff);
}
.history-copy { flex: 1; min-width: 0; display: grid; gap: 2px; }
.history-copy strong { font-size: 16px; letter-spacing: -0.02em; line-height: 1.15; }
.history-ended { color: var(--smart-blue, #006bee); font: 750 13px/1.3 system-ui, sans-serif; }
.history-ended.unfinished { color: #8589ad; }
.history-copy small { color: #7277a5; font: 12px/1.35 system-ui, sans-serif; }
.history-copy strong,
.history-ended,
.history-copy small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-download { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 50%; background: white; color: var(--smart-blue, #006bee); cursor: pointer; font: 900 18px/1 system-ui, sans-serif; }
.history-download:hover { background: #eef6ff; }
.history-callback { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 999px; background: #16794c; color: white; cursor: pointer; font: 900 13px/1 inherit; box-shadow: 0 8px 20px rgba(22, 121, 76, 0.18); }
.history-callback:hover { background: #12643f; }
.history-analyse { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 12px; background: white; color: var(--ink); font: 850 13px/1 inherit; text-decoration: none; }
.history-note { margin: 0 0 12px; color: #7277a5; font: 13px/1.4 system-ui, sans-serif; }

/* Account: who is listening, and the grown-up behind the account. */
.account-button { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--kid, #222ca7); color: white; cursor: pointer; font: 900 16px/1 inherit; box-shadow: 0 8px 20px rgba(34, 44, 167, 0.18); }
.account-button.compact { width: 40px; height: 40px; font-size: 14px; }
.suggest-chip { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 6px 10px; border-radius: 999px; background: #eef6ff; color: var(--smart-blue, #006bee); font: 800 11px/1 system-ui, sans-serif; }
.history-child { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 2px; border-radius: 50%; background: var(--kid, #222ca7); color: white; font: 900 10px/1 inherit; vertical-align: middle; }
.account-sheet { width: min(100%, 460px); max-width: 100%; max-height: min(92dvh, 900px); margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 28px; background: var(--paper); color: var(--ink); box-shadow: 0 26px 70px rgba(34, 44, 167, 0.2); }
.account-sheet::backdrop { background: rgba(17, 29, 50, 0.45); }
.account-sheet-body { max-height: inherit; display: flex; flex-direction: column; gap: 6px; padding: 22px 22px 24px; overflow-y: auto; overscroll-behavior: contain; }
.account-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.account-sheet-head .eyebrow { margin-bottom: 4px; color: var(--smart-blue, #006bee); }
.account-sheet-head h2 { margin: 0; font-size: 28px; line-height: 1.02; letter-spacing: -0.04em; }
.account-close { width: 40px; height: 40px; flex: none; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 50%; background: white; color: var(--ink); cursor: pointer; font: 400 22px/1 system-ui, sans-serif; }
.account-children { display: flex; flex-direction: column; }
.account-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 4px; border: 0; border-top: 1px solid rgba(34, 44, 167, 0.08); background: transparent; color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.account-children .account-row:first-child { border-top: 0; }
.account-row.is-active { color: var(--ink); }
.account-copy { flex: 1; min-width: 0; }
.account-copy strong { display: block; font-size: 16px; letter-spacing: -0.02em; }
.account-copy span { display: block; color: #656a98; font: 13px/1.3 system-ui, sans-serif; }
.account-sheet .account-email { display: block; max-width: none; overflow: hidden; color: var(--ink); font: 850 15px/1.2 system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.kid-dot { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--kid, #ffcd00); color: var(--ink); font: 900 15px/1 inherit; }
.kid-dot.grownup { background: var(--ink); color: white; }
.kid-dot.add { background: rgba(34, 44, 167, 0.08); color: var(--smart-blue, #006bee); font-size: 20px; }
.account-add { color: var(--smart-blue, #006bee); font-weight: 850; }
.account-tick { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #16794c; color: white; font: 900 12px/1 system-ui, sans-serif; }
.account-edit { flex: none; min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 999px; background: white; color: var(--smart-blue, #006bee); font: 850 12px/1 inherit; }
.child-form-remove { margin-right: auto; color: #9a2934; }
.account-eyebrow { margin: 14px 0 0; color: var(--smart-blue, #006bee); }
.account-grownup { cursor: default; }
.account-grownup .sign-out-button { flex: none; }
.account-setting { position: relative; display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px 4px; border-top: 1px solid rgba(34, 44, 167, 0.08); cursor: pointer; }
.account-setting .account-copy { padding-right: 4px; }
.account-setting input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.account-switch { position: relative; width: 48px; height: 28px; flex: none; border-radius: 999px; background: #d7d9e8; transition: background 140ms ease; }
.account-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 2px 7px rgba(17, 29, 50, 0.22); transition: transform 140ms ease; }
.account-setting input:checked + .account-switch { background: #16794c; }
.account-setting input:checked + .account-switch::after { transform: translateX(20px); }
.account-setting input:focus-visible + .account-switch { outline: 3px solid rgba(0, 107, 238, 0.35); outline-offset: 3px; }
.account-setting input:disabled + .account-switch { opacity: 0.55; }
.account-privacy { margin: 10px 0 0; color: #656a98; font: 12px/1.45 system-ui, sans-serif; }
.account-privacy[data-state="error"] { color: #a33b35; }
.child-form { display: grid; gap: 8px; padding: 6px 0 12px; border-top: 1px solid rgba(34, 44, 167, 0.08); }
.child-form label, .child-form .label { margin-top: 8px; color: var(--ink); font: 800 12px/1.3 system-ui, sans-serif; }
.child-form input { width: 100%; min-height: 48px; padding: 0 15px; border: 2px solid rgba(34, 44, 167, 0.14); border-radius: 15px; background: white; color: var(--ink); font: 16px system-ui, sans-serif; }
.child-form input:focus { border-color: var(--mid-blue); outline: 0; }
.child-form .auth-hint { margin: -2px 0 0; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 5px; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 17px; background: #f6f4fb; }
.segment { min-height: 44px; border: 0; border-radius: 12px; background: transparent; color: #7377a8; cursor: pointer; font: 800 13px/1 system-ui, sans-serif; }
.segment.on { background: white; color: var(--ink); box-shadow: 0 5px 14px rgba(34, 44, 167, 0.1); }
.colour-swatches { display: flex; gap: 10px; }
.swatch { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--kid); cursor: pointer; }
.swatch.on { outline: 3px solid var(--ink); outline-offset: 3px; }
.child-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.child-form-actions .primary-action { min-height: 48px; }
@media (max-width: 800px) {
  .account-sheet { width: 100%; max-height: 88dvh; margin: auto 0 0; border-radius: 26px 26px 0 0; }
  .account-sheet-body { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
  .account-sheet-body::before { content: ""; display: block; width: 40px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: rgba(34, 44, 167, 0.18); }
}
.history-chevron { flex: none; width: 10px; height: 10px; margin-right: 4px; border-right: 2px solid #8589ad; border-bottom: 2px solid #8589ad; transform: rotate(45deg); transition: transform 160ms ease; }
.history-row[open] .history-chevron { transform: rotate(-135deg); }
.history-row[open] .history-copy strong,
.history-row[open] .history-ended,
.history-row[open] .history-copy small { white-space: normal; }
.history-row-body { padding: 0 14px 14px; }
.history-row-body pre { margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(34, 44, 167, 0.04); white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 system-ui, sans-serif; max-height: 45vh; overflow-y: auto; }
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.history-actions button { min-height: 40px; padding: 0 14px; border: 1px solid rgba(34, 44, 167, 0.14); border-radius: 12px; background: white; color: var(--ink); cursor: pointer; font: 850 13px/1 inherit; }
.history-actions button:disabled { opacity: 0.45; cursor: default; }
.history-actions .history-delete { margin-left: auto; color: #9a2934; }
.calls-footnote { margin: 22px 0 0; color: #656a98; font: 13px/1.5 system-ui, sans-serif; }
.endings-found { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-top: 84px; }
.endings-found-list { min-width: 0; }
.endings-found > .eyebrow { margin-bottom: 0; }
.endings-found > .section-note { margin-top: -12px; font-size: 13px; }
.endings-card { padding: 22px 24px; border: 1px solid rgba(34, 44, 167, 0.1); border-radius: 26px; background: var(--paper); box-shadow: 0 15px 34px rgba(34, 44, 167, 0.09); }
.endings-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.endings-card-head .endings-portrait { width: 44px; }
.endings-card-head strong { display: block; font-size: 17px; letter-spacing: -0.03em; }
.endings-card-head .section-note { font-size: 13px; }
.ending-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ending-pill { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 999px; background: #eef6ff; color: var(--ink); font: 800 13px/1 system-ui, sans-serif; }
.ending-pill::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--smart-blue, #006bee); }
.ending-pill.locked { background: rgba(34, 44, 167, 0.06); color: #8589ad; }
.ending-pill.locked::before { background: transparent; border: 2px solid rgba(34, 44, 167, 0.25); }
.endings-card .text-action { padding: 0; margin-top: 14px; }

/* After the story ends: progress, go again, or go home. */
.after-call-card { display: grid; gap: 12px; padding: 16px; border: 1px solid rgba(34, 44, 167, 0.12); border-radius: 18px; background: white; box-shadow: 0 12px 30px rgba(34, 44, 167, 0.1); }
.after-call-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.after-call-progress .eyebrow { margin-bottom: 4px; color: var(--smart-blue, #006bee); }
.after-call-progress .section-note { font-size: 13px; }
.ending-dots { display: flex; gap: 6px; flex: none; }
.ending-dots span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(34, 44, 167, 0.25); }
.ending-dots span.found { background: var(--smart-blue, #006bee); border-color: var(--smart-blue, #006bee); }
.after-call-again { width: 100%; justify-content: center; background: #16794c; box-shadow: 0 8px 24px rgba(22, 121, 76, 0.15); }
.after-call-card .text-action { min-height: 44px; }
.after-call-stay { margin: 0; color: #656a98; font: 12px/1.4 system-ui, sans-serif; text-align: center; }
.start-rating { margin: 14px 0 0; color: #4b6774; font: 750 13px/1.45 system-ui, sans-serif; }
.auth-hint { margin: -2px 0 0; color: #8589ad; font: 12px/1.4 system-ui, sans-serif; }
@media (max-width: 800px) {
  /* Safari sizes an auto grid track to the endings strip's full width; clamp the column and its children. */
  .calls-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .calls-panel .page-heading { margin-bottom: 14px; padding-top: 0; }
  .calls-panel .page-heading h1 { font-size: 38px; }
  .calls-heading { margin: 8px 0 10px; }
  .endings-found { padding-top: 0; }
  .endings-found-list { display: flex; gap: 10px; width: 100%; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
  .endings-card { flex: none; width: min(78vw, 300px); padding: 16px; scroll-snap-align: start; }
  .history-list { gap: 8px; }
  .history-row { border-radius: 16px; box-shadow: none; }
  .history-row-head { gap: 12px; padding: 10px 12px 10px 10px; }
  .history-portrait { width: 44px; }
  .calls-footnote { margin-top: 16px; font-size: 12px; }
  .after-call-card { padding: 14px; }
}
#history-message { padding: 12px; background: #fff0da; color: #623800; border-radius: 10px; }
/* One equal column per tab, however many tabs the nav holds. */
@media (max-width: 800px) { .mobile-nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); } }

/* Keep the ending quiet on the full-scene call, including short phone screens. */
@media (max-width: 800px) {
  .call-card[data-captions="on"] .ending-card { gap: 4px; margin-top: 10px; padding: 10px 14px; border-color: #ffffff29; background: #142235ed; color: #f5ead5; border-radius: 14px; }
  .call-card[data-captions="on"] .ending-card h2 { font-size: 17px; }
  .call-card[data-captions="on"] .ending-eyebrow { color: #e7c98d; font-size: 9px; }
  .call-card[data-captions="on"] .ending-frame,
  .call-card[data-captions="on"] .ending-continue { color: #c1c9d3; }
  .call-card[data-captions="on"] .ending-body { max-height: min(180px, 20dvh); border-color: #ffffff29; }
  .call-card[data-captions="on"] .conversation:has(.ending-reflection[open]) > .turn { display: none; }
}

.story-voice-choice { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:12px 0; font-size:14px; }
.story-voice-choice select { font:inherit; padding:8px 12px; border-radius:10px; max-width:100%; background:#fff; color:#182737; border:1px solid #bfc8cc; }

/* Four call-dock controls (Mute, Interrupt, End call, Transcript) share the phone
   width, so the circles and their labels tighten as the screen narrows. */
@media (max-width: 800px) {
  .call-controls { gap: clamp(9px, 4.2vw, 22px); }
  .control-button,
  .end-button,
  .control-button[aria-pressed="true"] { min-width: 62px; }
}
@media (max-width: 390px) {
  .control-button,
  .end-button,
  .control-button[aria-pressed="true"] { min-width: 0; gap: 6px; }
  .control-button > svg,
  .control-button > span { width: 48px; height: 48px; }
  .control-button > svg { padding: 13px; }
  .control-button small,
  .end-button small,
  .control-button[aria-pressed="true"] small { font-size: 9px; }
  .call-card[data-input-mode="typing"] .control-button > svg,
  .call-card[data-input-mode="typing"] .control-button > span { width: 42px; height: 42px; }
}

.performance-open { border: 1px solid #ccd0e0; border-radius: 14px; background: white; color: #293267; padding: 8px 10px; font: inherit; cursor: pointer; }
.performance-dialog { width: min(900px, 94vw); max-height: 88dvh; overflow: auto; border: 0; border-radius: 18px; padding: 20px; color: #202544; background: #fff; box-shadow: 0 20px 80px #0004; }
.performance-dialog::backdrop { background: #10152d88; }
.performance-dialog > button { float: right; padding: 8px 16px; }
.performance-dialog h2 { display: inline-block; margin: 0 0 16px; }
.performance-dialog select { display: block; width: 100%; padding: 10px; margin-bottom: 12px; }
.performance-dialog p { font-size: 13px; line-height: 1.5; }
.performance-dialog table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 18px; }
.performance-dialog th, .performance-dialog td { text-align: left; padding: 7px 5px; border-bottom: 1px solid #e4e6ee; overflow-wrap: anywhere; }
.performance-dialog h3 { margin: 16px 0 8px; font-size: 15px; }
.performance-bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 65px; gap: 8px; align-items: center; font-size: 12px; margin: 9px 0; }
.performance-track { height: 14px; background: #eef0f7; border-radius: 4px; }
.performance-bar { height: 14px; background: #6166df; border-radius: 4px; }
.performance-interval-wrap { overflow-x: auto; }
.performance-dialog .performance-interval-table { min-width: 760px; }
.performance-interval-table td:first-child { max-width: 260px; }
.performance-interval-table small { display: block; margin-top: 4px; font-size: 10px; color: #666d80; }
.performance-interval-table td:last-child { width: 200px; min-width: 150px; }
.performance-dialog details { padding: 10px 0; }
.performance-dialog summary { cursor: pointer; font-weight: 600; }
.event-studio-scroll { overflow: auto; border: 1px solid #dce1ed; border-radius: 12px; margin: 12px 0; background: #f7f8fc; }
.event-studio-ruler { height: 30px; position: relative; background: #eef1f8; }
.event-studio-ruler span { position: absolute; top: 8px; transform: translateX(-50%); font-size: 10px; font-variant-numeric: tabular-nums; }
.event-studio-track { display: flex; border-top: 1px solid #e1e5ef; position: relative; }
.event-studio-label { position: sticky; left: 0; z-index: 2; width: 150px; min-width: 150px; padding: 10px 8px; box-sizing: border-box; background: #f7f8fc; font-size: 11px; }
.event-studio-area { position: relative; background-image: linear-gradient(to right, #dfe4ef 1px, transparent 1px); background-size: 10% 100%; }
.event-studio-clip { position: absolute; height: 26px; border: 0; border-radius: 5px; background: #7066da; color: white; padding: 3px; font: 10px system-ui; overflow: hidden; white-space: nowrap; text-align: left; cursor: pointer; }
.event-studio-clip[data-track="gemini"] { background: #148773; }
.event-studio-clip[data-track="filler"] { background: #1d829e; }
.event-studio-clip[data-track="silence"] { background: #c67c26; }
.event-studio-clip[data-track="network"] { background: #63768e; }
.event-studio-clip:focus-visible { outline: 3px solid #151c35; outline-offset: 2px; }
.event-studio-detail { min-height: 48px; padding: 12px; background: #f2f4fa; border-radius: 10px; overflow-wrap: anywhere; }

.audio-source-legend { display:flex;flex-wrap:wrap;gap:8px;margin:12px 0; }
.audio-source-badge { display:inline-block;border-radius:6px;padding:5px 8px;font-size:12px;font-weight:700;line-height:1.4;background:#edf0f4;color:#344054; }
.audio-source-badge[data-source="prepared"], .event-studio-clip[data-source="prepared"] { background:#235f9d;color:white; }
.audio-source-badge[data-source="reused"], .event-studio-clip[data-source="reused"] { background:#146c58;color:white; }
.audio-source-badge[data-source="live"], .event-studio-clip[data-source="live"] { background:#9a450a;color:white; }
.audio-source-badge[data-source="recording"], .event-studio-clip[data-source="recording"] { background:#536174;color:white; }

/* Centre the bounded call heading over the full-width call actions. */
#start-controls .start-heading { text-align: center; }
#start-controls .start-heading h2 { margin-inline: auto; }

/* Keep transcript access available when the active-call dock is hidden. */
@media (max-width: 800px) {
  .call-status-bar > .transcript-toggle:not([hidden]) { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: 20px; background: #ffffff20; color: inherit; }
  .call-status-bar > .transcript-toggle > span { display: none; }
  .call-status-bar > .transcript-toggle small { font-size: 13px; }
}

/* Tara scene art: top-align the complete picture so portrait panels put spare space below it. */
[data-character-id="tara"] .has-scene-artwork .scene-artwork img,
[data-character-id="tara"] .scene-expanded .scene-artwork[data-state="loaded"] img {
  object-fit: contain;
  object-position: 50% 0%;
  transform: none;
  opacity: 1;
  filter: none;
  background: #142638;
}

/* Immersive scene: one shared composition for every story pack and viewport. */
body[data-player-active="true"] .player-view { overflow-y: auto; }
body[data-player-active="true"] .call-card[data-captions="on"] { display:flex; flex-direction:column; height:auto; min-height:0; max-width:680px; width:100%; margin:0 auto; background:#101e30; border-radius:24px; overflow:hidden; }
.call-card[data-captions="on"] .visual-panel { display:flex; flex-direction:column; padding:0; gap:0; position:relative; background:#183448; overflow:visible; }
.call-card[data-captions="on"] .scene-artwork { position:relative; inset:auto; width:100%; height:auto; min-height:0; max-height:none; margin:0; border:0; border-radius:0; aspect-ratio:auto; }
.call-card[data-captions="on"] .scene-artwork[data-state="loaded"] img { display:block; width:100%; height:auto; object-fit:contain; object-position:50% 0%; transform:none; opacity:1; filter:none; }
.call-card[data-captions="on"] .scene-artwork figcaption { position:absolute; bottom:10px; left:12px; right:auto; padding:4px 8px; min-height:0; border-radius:12px; background:#101e30cc; font-size:10px; }
.call-card[data-captions="on"] .scene-artwork figcaption #scene-artwork-title { display:none; }
.call-card[data-captions="on"] .topbar { position:absolute; top:12px; left:12px; right:12px; z-index:3; }
.call-card[data-captions="on"] .character-summary { position:relative; display:flex; justify-content:center; align-items:center; padding:20px 18px 12px; margin:0; gap:12px; background:#183448; }
.call-card[data-captions="on"] .portrait-wrap { width:40px; height:40px; min-height:40px; max-height:40px; flex:0 0 40px; }
.call-card[data-captions="on"] .identity { text-align:left; }
.call-card[data-captions="on"] .identity h1 { font-size:28px; line-height:1.15; margin:0; }
.call-card[data-captions="on"] .identity #scene-label { display:block; font-size:12px; margin-top:5px; color:#b8ccdc; }
.call-card[data-captions="on"] .conversation-panel { position:relative; inset:auto; display:flex; flex-direction:column; gap:14px; padding:12px 22px 0; border:0; border-radius:0; background:linear-gradient(#183448,#101e30 55%); box-shadow:none; }
.call-card[data-captions="on"] .call-status-bar { justify-content:center; }
.call-card[data-captions="on"] .status { color:#9ce0d4; background:transparent; font-size:12px; padding:4px; }
.call-card[data-captions="on"] .conversation-stage { flex:none; min-height:0; }
.call-card[data-captions="on"] .conversation-scroll { height:auto; max-height:none; overflow:visible; padding:0; }
.call-card[data-captions="on"] .turn.user-turn,.call-card[data-captions="on"] .character-turn:has(~ .character-turn),.call-card[data-captions="on"] .speaker-label,.call-card[data-captions="on"] .suggestions {display:none!important;}
.call-card[data-captions="on"] .bubble.character { display:block; width:100%; max-width:100%; max-height:190px; overflow-y:auto; position:relative; margin:0; padding:8px 0 16px; border:0; background:transparent; color:#eef6fd; text-align:center; font:500 21px/1.5 system-ui,sans-serif; -webkit-line-clamp:unset; text-shadow:none; }
.call-card[data-captions="on"] .cw { color:#b6c6d8; }
.call-card[data-captions="on"] .cw.spoken,.call-card[data-captions="on"] .cw.phrase {color:#f1f7ff;}
.call-card[data-captions="on"] .cw.now { color:#ffe179; }
.call-card[data-captions="on"] .call-dock { border-top:1px solid #ffffff16; padding:16px 0 18px; margin:0; }
.call-card[data-captions="on"] .control-button > span,.call-card[data-captions="on"] .control-button > svg { width:48px;height:48px; }
.call-card[data-captions="on"] .control-button small { color:#c4d4e3;font-size:11px; }
.transcript-toggle:not([hidden]) { display:grid; }
@media(max-width:800px){body[data-player-active="true"] .call-card[data-captions="on"]{border-radius:0;}.call-card[data-captions="on"] .player-nav{margin:0;}}
/* A sideways phone gets two useful columns instead of a compressed portrait stack. */
@media (orientation:landscape) and (max-height:600px) {
 body[data-player-active="true"] .player-nav {min-height:42px;height:42px;padding:4px 16px;margin:0;}
 body[data-player-active="true"] .call-card[data-captions="on"] {display:grid;grid-template-columns:minmax(0,44fr) minmax(0,56fr);max-width:none;border-radius:0;align-items:start;}
 .call-card[data-captions="on"] .visual-panel {grid-column:1;grid-row:1;}
 .call-card[data-captions="on"] .conversation-panel {grid-column:2;grid-row:1;padding:12px 18px 0;min-width:0;}
 .call-card[data-captions="on"] .character-summary {padding:12px;gap:8px;}
 .call-card[data-captions="on"] .identity h1 {font-size:22px;}
 .call-card[data-captions="on"] .identity #scene-label {font-size:11px;}
 .call-card[data-captions="on"] .bubble.character {font-size:18px;max-height:130px;padding-bottom:10px;}
 .call-card[data-captions="on"] .call-dock {padding:10px 0;}
 .call-card[data-captions="on"] .control-button > span,.call-card[data-captions="on"] .control-button > svg {width:42px;height:42px;}
 .call-card[data-captions="on"] .scene-artwork figcaption {font-size:9px;bottom:5px;}
}
/* Final call composition overrides also cover desktop and sideways-phone controls. */
body[data-player-active="true"] .player-nav {background:#101e30;color:#eef6ff;border:0;}
body[data-player-active="true"] .player-nav button {color:#eef6ff;background:#ffffff0e;}
.call-card[data-captions="on"] .scene-artwork::before {display:none;}
.call-card[data-captions="on"] .character-summary {flex-direction:row;}
.call-card[data-captions="on"] .identity .story-kicker {display:none;}
.call-card[data-captions="on"] .control-button {border:0;background:transparent;box-shadow:none;display:flex;flex-direction:column;align-items:center;padding:0;gap:7px;}
.call-card[data-captions="on"] .control-button > span {display:grid;place-items:center;border-radius:50%;background:#263b51;color:#edf6ff;}
.call-card[data-captions="on"] .end-button > span {background:#d94961;}
.call-card[data-captions="on"] .control-button > span svg {width:23px;height:23px;}
.call-card[data-captions="on"] .topbar > div:first-child .eyebrow {display:none;}
.call-card[data-captions="on"] .portrait {width:100%;height:100%;max-height:none;transform:none;}
.call-card[data-captions="on"] .portrait img {width:100%;height:100%;object-fit:contain;transform:none;}
.call-card[data-captions="on"] .control-button > svg {padding:11px;border-radius:50%;background:#263b51;color:#edf6ff;box-sizing:border-box;}
body[data-player-active="true"] .player-nav .brand-lockup {display:none;}
#call-card[data-captions="on"] {height:auto!important;align-self:start;}
#call-card[data-captions="on"] .visual-panel {height:auto;min-height:0;flex:0 0 auto;}
#call-card[data-captions="on"] .scene-artwork {flex:0 0 auto;}
#call-card[data-captions="on"] .character-summary {height:auto;min-height:0;flex:0 0 auto;padding:20px 18px 12px;}
#call-card[data-captions="on"] .conversation-panel {flex:0 0 auto;}

/* Shared call-page typography: one centre line and matching action-label columns. */
#call-card[data-captions="on"] .character-summary {
  display:grid;
  grid-template-columns:40px minmax(0, 1fr) 40px;
  align-items:center;
  column-gap:12px;
  width:100%;
  box-sizing:border-box;
}
#call-card[data-captions="on"] .identity { min-width:0; text-align:center; }
#call-card[data-captions="on"] .identity h1 { text-wrap:balance; }
#call-card[data-captions="on"] .identity #scene-label {
  max-width:38ch;
  margin:8px auto 0;
  line-height:1.5;
  text-wrap:balance;
}
#start-controls { width:100%; max-width:560px; margin-inline:auto; }
#start-controls .start-heading { margin-bottom:14px; }
#start-controls .start-heading h2 { line-height:1.2; text-wrap:balance; }
.call-options {
  max-width:460px;
  margin:0 auto 12px;
  padding:0 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(255,255,255,.045);
}
.call-options > summary {
  min-height:58px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  cursor:pointer;
  list-style:none;
  color:#f3f6fc;
}
.call-options > summary::-webkit-details-marker { display:none; }
.call-options > summary::after { content:"+"; flex:none; color:#69d5ff; font:500 22px/1 system-ui,sans-serif; }
.call-options[open] > summary::after { content:"−"; }
.call-options > summary span,
.call-options > summary strong,
.call-options > summary small { display:block; }
.call-options > summary strong { font:750 13px/1.3 system-ui,sans-serif; }
.call-options > summary small { margin-top:3px; color:#aebfcb; font:500 10.5px/1.35 system-ui,sans-serif; }
.call-options > summary:focus-visible { outline:2px solid #9de6ff; outline-offset:4px; border-radius:8px; }
.call-options[open] { padding-bottom:12px; }
#start-controls .call-mode-switch {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  max-width:460px;
  margin:4px auto 12px;
}
#start-controls .call-mode-switch legend {
  grid-column:1 / -1;
  width:100%;
  margin:0 0 4px;
  color:#b8ccdc;
  font:700 12px/1.3 system-ui,sans-serif;
  text-align:center;
}
#start-controls .call-mode-switch label { min-width:0; }
#start-controls .call-mode-switch .premium-tier { grid-column:1 / -1; }
#start-controls .call-mode-switch label span {
  min-height:58px;
  display:grid;
  align-content:center;
  gap:3px;
  padding:8px 10px;
  border-color:rgba(255,255,255,.16);
  background:rgba(255,255,255,.07);
  color:#dbe7ef;
}
#start-controls .call-mode-switch label strong,
#start-controls .call-mode-switch label small { display:block; }
#start-controls .call-mode-switch label small { color:#aebfcb; font:500 10.5px/1.3 system-ui,sans-serif; }
#start-controls .call-mode-switch input:checked + span {
  border-color:#69d5ff;
  background:rgba(48,174,221,.2);
  color:#fff;
  box-shadow:0 0 0 1px rgba(105,213,255,.14) inset;
}
#start-controls .call-mode-switch input:disabled + span { opacity:.45; cursor:not-allowed; }
.premium-story-style {
  max-width:460px;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px;
  margin:0 auto 12px;
  padding:10px 12px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(255,255,255,.045);
}
.premium-story-style[hidden] { display:none; }
.premium-story-style legend {
  padding:0 6px;
  color:#c7d7e3;
  font:700 12px/1.3 system-ui,sans-serif;
}
.premium-story-style label { min-width:0; }
.premium-story-style input { position:absolute; opacity:0; pointer-events:none; }
.premium-story-style label span {
  min-height:54px;
  display:grid;
  align-content:center;
  gap:3px;
  padding:7px 8px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:12px;
  color:#dbe7ef;
  text-align:center;
  cursor:pointer;
}
.premium-story-style label strong,
.premium-story-style label small { display:block; }
.premium-story-style label small { color:#aebfcb; font:500 10.5px/1.3 system-ui,sans-serif; }
.premium-story-style input:checked + span {
  border-color:#69d5ff;
  background:rgba(48,174,221,.2);
  color:#fff;
  box-shadow:0 0 0 1px rgba(105,213,255,.14) inset;
}
.premium-story-style input:focus-visible + span { outline:2px solid #9de6ff; outline-offset:2px; }
.premium-story-style input:disabled + span { opacity:.45; cursor:not-allowed; }
.response-style {
  max-width:460px;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin:0 auto 12px;
  padding:10px 12px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(255,255,255,.045);
}
.response-style[hidden] { display:none; }
.response-style legend {
  padding:0 6px;
  color:#c7d7e3;
  font:700 12px/1.3 system-ui,sans-serif;
}
.response-style label { min-width:0; }
.response-style input { position:absolute; opacity:0; pointer-events:none; }
.response-style label span {
  min-height:68px;
  display:grid;
  align-content:center;
  gap:3px;
  padding:7px 8px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:12px;
  color:#dbe7ef;
  text-align:center;
  cursor:pointer;
}
.response-style label strong,
.response-style label small { display:block; }
.response-style label small { color:#aebfcb; font:500 10.5px/1.3 system-ui,sans-serif; }
.response-style input:checked + span {
  border-color:#69d5ff;
  background:rgba(48,174,221,.2);
  color:#fff;
  box-shadow:0 0 0 1px rgba(105,213,255,.14) inset;
}
.response-style input:focus-visible + span { outline:2px solid #9de6ff; outline-offset:2px; }
.response-style > p {
  grid-column:1 / -1;
  margin:2px 2px 0;
  color:#9fb3c1;
  font:500 10.5px/1.4 system-ui,sans-serif;
  text-align:center;
}
@media (max-width:520px) {
  .response-style { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .response-style label:nth-of-type(3) { grid-column:1 / -1; }
  .response-style label span { min-height:58px; }
}
.gemini-voice-control {
  max-width:460px;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:10px;
  margin:0 auto;
  color:#c7d7e3;
  font:700 12px/1.3 system-ui,sans-serif;
}
.gemini-voice-control select {
  min-width:0;
  min-height:40px;
  padding:0 11px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:12px;
  background:#203145;
  color:#f3f6fc;
  font:600 13px system-ui,sans-serif;
}
.pulse-language-control {
  max-width:460px;
  margin:10px auto 0;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(255,255,255,.045);
  color:#c7d7e3;
  font:600 12px/1.35 system-ui,sans-serif;
}
.pulse-language-control[hidden] { display:none; }
.pulse-language-control > label {
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:10px;
}
.pulse-language-control select {
  min-width:0;
  min-height:38px;
  padding:0 10px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:11px;
  background:#203145;
  color:#f3f6fc;
  font:600 13px system-ui,sans-serif;
}
.pulse-language-control details { margin-top:8px; }
.pulse-language-control summary { color:#aebfcb; cursor:pointer; }
.pulse-additional-languages {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}
.pulse-additional-languages label {
  display:flex;
  align-items:center;
  gap:5px;
  padding:6px 8px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:999px;
  color:#dbe7ef;
  font-weight:600;
}
.pulse-additional-languages input { accent-color:#69d5ff; }
.pulse-language-control p {
  margin:8px 0 0;
  color:#9fb3c1;
  font:500 10.5px/1.4 system-ui,sans-serif;
}
.waiting-reaction-control {
  max-width:460px;
  display:flex;
  align-items:flex-start;
  gap:9px;
  margin:10px auto 0;
  color:#dbe7ef;
  font:600 12px/1.35 system-ui,sans-serif;
  cursor:pointer;
}
.waiting-reaction-control input { margin-top:2px; accent-color:#b95ee8; }
.waiting-reaction-control span,
.waiting-reaction-control strong,
.waiting-reaction-control small { display:block; }
.waiting-reaction-control small { margin-top:1px; color:#9fb3c1; font-weight:500; }
.waiting-reaction-control[hidden] { display:none; }
.gemini-voice-note,
#start-controls .mode-note {
  max-width:52ch;
  margin:7px auto 0;
  color:#9fb3c1;
  font:500 10.5px/1.4 system-ui,sans-serif;
  text-align:center;
}
#start-controls .start-actions .start-call {
  display:grid;
  grid-template-columns:28px minmax(0, 280px) 28px;
  justify-content:center;
  align-items:center;
  gap:12px;
  padding:16px 18px;
}
#start-controls .start-call > span:not(.control-icon) { min-width:0; text-align:center; }
#start-controls .start-call strong { display:block; line-height:1.25; text-wrap:balance; }
#start-controls .start-call small { display:block; margin-top:4px; line-height:1.4; }
#start-controls #start-help { max-width:46ch; margin:16px auto 0; text-align:center; line-height:1.55; text-wrap:balance; }
@media (max-width:480px) {
  #call-card[data-captions="on"] .character-summary { column-gap:8px; }
  #start-controls .start-actions .start-call { grid-template-columns:24px minmax(0,1fr) 24px; gap:8px; padding:14px 12px; }
  #start-controls .call-mode-switch label span { min-height:54px; padding:7px 6px; }
}
#call-card[data-captions="on"] .character-summary {
  grid-template-columns:40px minmax(0, 38ch) 40px;
  justify-content:center;
}
#start-controls .start-actions { display:grid; grid-template-columns:1fr; gap:10px; }
#start-controls .start-heading h2 { color:#f3f6fc; font-size:clamp(22px,3vw,28px); }
#start-controls .eyebrow, #start-controls #start-help { color:#b8ccdc; }
#start-controls #start-call { background:#14794f; color:#fff; }
#start-controls #start-typing { background:#2d3d50; color:#f3f6fc; }
#start-controls .start-call small { color:#d0dddf; }

/* Use the spare portrait-phone space below an active call for the control dock. */
@media (max-width:800px) and (orientation:portrait) {
  body[data-player-active="true"] #call-card[data-captions="on"]:has(#call-controls:not([hidden])) {
    min-height:calc(var(--visible-viewport-height, 100dvh) - 48px - env(safe-area-inset-top, 0px));
  }
  #call-card[data-captions="on"]:has(#call-controls:not([hidden])) .conversation-panel {
    flex:1 0 auto;
  }
  #call-card[data-captions="on"]:has(#call-controls:not([hidden])) .call-dock {
    margin-top:auto;
    padding-bottom:max(12px, env(safe-area-inset-bottom, 0px));
  }
}

/* Shared read-along rules must outrank the legacy mobile caption selectors.
   Untimed passages remain readable; only measured timings advance word focus. */
.call-card[data-captions="on"] .bubble.character {
  -webkit-mask-image:none;
  mask-image:none;
  scroll-behavior:auto;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:#9bb3c8 transparent;
}
.call-card[data-captions="on"] .bubble.character .cw { color:#b6c6d8; }
.call-card[data-captions="on"] .bubble.character .cw.spoken,
.call-card[data-captions="on"] .bubble.character .cw.phrase { color:#f1f7ff; }
.call-card[data-captions="on"] .bubble.character .cw.now {
  color:#ffe179;
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:0.18em;
}

#resume-microphone {
  grid-column:1 / -1;
  min-height:44px;
  padding:10px 18px;
  border:1px solid #78bbd8;
  border-radius:12px;
  background:#164e67;
  color:#fff;
  font:600 15px/1.3 system-ui,sans-serif;
  cursor:pointer;
}
#resume-microphone:focus-visible { outline:3px solid #ffd54a; outline-offset:3px; }

/* Trailing space keeps the final spoken row clear of the bottom edge. */
.call-card[data-captions="on"] .bubble.character[data-read-along]::after {
  content:"";
  display:block;
  height:var(--read-along-tail, 0px);
}

/* Replies share one reading window regardless of clip length or timing coverage. */
.call-card[data-captions="on"] .bubble.character {
  box-sizing:border-box;
  height:190px;
  max-height:190px;
}
@media (orientation:landscape) and (max-height:600px) {
  .call-card[data-captions="on"] .bubble.character { height:130px; max-height:130px; }
}

/* Zip front pose: 1290×1024 source, face/torso axis x=375, head y=151,
   feet y=860. Visible span 709px fills 88% with 6% top/bottom clearance.
   Mask excludes the back pose and source-sheet remnants. */
.character-art-crop:is(.zip, .selected-zip) {
  --character-art-top: -12.7419%;
  --character-art-bottom: auto;
  --character-art-width: auto;
  --character-art-height: 127.0973%;
  --character-art-fit: fill;
  --character-art-clip: inset(13% 55% 15% 14%);
  --character-art-shift-x: -29.0698%;
}
.player-view[data-character-id="zip"] .portrait { position: relative; overflow: hidden; width:100%; height:100%; transform:none; }
.player-view[data-character-id="zip"] .portrait img {
  position: absolute; top: -12.7419%; bottom: auto; left: 50%; right: auto;
  width: auto; height: 127.0973%; max-width: none; object-fit: fill;
  clip-path: inset(13% 55% 15% 14%); transform: translateX(-29.0698%);
}

/* The caller stays recognisable in the full player; reuse the measured Zip front pose. */
.player-view[data-character-id="zip"] .call-card .portrait-wrap {
 width:96px; height:96px; min-height:96px; max-height:96px; flex:0 0 96px;
}
.player-view[data-character-id="zip"] .call-card .character-summary { grid-template-columns:96px minmax(0,1fr) 96px; }
.mini-call-portrait { position:relative; display:block; width:40px; height:40px; flex:none; overflow:hidden; border-radius:50%; background:#22365a; }
.mini-call[data-character-id="zip"] .mini-call-portrait img {
 position:absolute; top:-12.7419%; bottom:auto; left:50%; right:auto;
 width:auto; height:127.0973%; max-width:none; border:0; border-radius:0; object-fit:fill;
 clip-path:inset(13% 55% 15% 14%); transform:translateX(-29.0698%);
}
@media(max-width:600px) {
 .player-view[data-character-id="zip"] .call-card .portrait-wrap {width:80px;height:80px;min-height:80px;max-height:80px;flex-basis:80px;}
 .player-view[data-character-id="zip"] .call-card .character-summary {grid-template-columns:80px minmax(0,1fr) 80px;}
}

/* Zip's narrative illustrations contain clues across the full landscape frame. */
/* The notebook opens onto this destination, then the illustration fills the portal. */
.notebook-journey {
  --journey-tint:#7254a9; --journey-light:#f4d9a0;
  position:absolute; inset:0; z-index:12; pointer-events:none; overflow:hidden; isolation:isolate;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:32px;
  border-radius:inherit; color:#fff3d4;
  background:radial-gradient(ellipse at 50% 42%,var(--journey-tint),#141326 75%);
  animation:notebook-arrival var(--journey-duration,3200ms) ease-in-out both;
}
.notebook-journey[data-destination="egypt"] {--journey-tint:#9b643c;--journey-light:#ffd49b;}
.notebook-journey[data-destination="garden"] {--journey-tint:#347d6a;--journey-light:#e2f4bd;}
.notebook-journey[data-destination="orbit"] {--journey-tint:#395b9d;--journey-light:#bde5ff;}
.notebook-journey-window {
  position:absolute; inset:8%; border-radius:50%; border:2px solid var(--journey-light);
  box-shadow:0 0 30px 8px var(--journey-tint); overflow:hidden;
  animation:notebook-through var(--journey-duration,3200ms) cubic-bezier(.5,0,.35,1) both;
}
.notebook-journey-destination {width:100%;height:100%;object-fit:cover;display:block;}
.notebook-journey-book {
  position:relative; width:min(65%,260px); aspect-ratio:1.45; perspective:800px;
  filter:drop-shadow(0 10px 25px #0007);
  animation:notebook-book-flight var(--journey-duration,3200ms) ease-in-out both;
}
.notebook-journey-page,.notebook-journey-cover {
  position:absolute;top:0;bottom:0;width:50%;border:1px solid #dbbc89;
  border-radius:5px 12px 12px 5px;display:grid;place-items:center;overflow:hidden;
  box-shadow:inset 5px 0 9px #5b3b433b,0 3px #bca887,0 6px #eadbc0;
}
.notebook-journey-page-left {left:0;background:repeating-linear-gradient(#f7eace 0 23px,#dfcfac 24px 25px);color:#ab8250;font-size:38px;border-radius:12px 5px 5px 12px;}
.notebook-journey-page-right {right:0;background:#f7eace;}
.notebook-journey-cover {right:0;background:#593952;color:#f5d294;font-size:44px;transform-origin:left center;backface-visibility:hidden;animation:notebook-open var(--journey-duration,3200ms) ease-in-out both;}
.notebook-journey-caption {z-index:3;font-size:clamp(14px,2vw,19px);letter-spacing:.02em;text-align:center;max-width:90%;text-shadow:0 2px 10px #151020;}
.notebook-journey-stars {position:absolute;inset:0;}
.notebook-journey-spark {
  position:absolute;left:50%;top:43%;width:3px;height:12px;border-radius:50%;background:var(--journey-light);
  transform:rotate(calc(var(--i)*22.5deg)) translateY(-50px);
  animation:notebook-spark var(--journey-duration,3200ms) ease-in both;
}
@keyframes notebook-arrival {0%,100%{opacity:0} 8%,88%{opacity:1}}
@keyframes notebook-open {0%,12%{transform:rotateY(0)} 50%,100%{transform:rotateY(-165deg)}}
@keyframes notebook-book-flight {0%{transform:translateY(28px) rotate(-8deg) scale(.75);opacity:0} 12%,55%{transform:translateY(0) rotate(0) scale(1);opacity:1} 78%,100%{transform:translateY(10px) scale(2);opacity:0}}
@keyframes notebook-through {0%,38%{transform:scale(.08);opacity:0} 55%{opacity:.65} 90%,100%{transform:scale(1.6);opacity:1;border-radius:8%}}
@keyframes notebook-spark {0%,20%{opacity:0;transform:rotate(calc(var(--i)*22.5deg)) translateY(-40px) scaleY(.5)} 45%{opacity:.8} 90%,100%{opacity:0;transform:rotate(calc(var(--i)*22.5deg)) translateY(-480px) scaleY(7)}}
@media(prefers-reduced-motion:reduce) {
 .notebook-journey,.notebook-journey-book,.notebook-journey-cover{animation:none;}
 .notebook-journey-stars,.notebook-journey-window{display:none;}
 .notebook-journey-cover{transform:rotateY(-165deg);}
}
.player-view[data-character-id="zip"] .scene-artwork[data-state="loaded"] img {
  object-fit: contain;
  object-position: 50% 0%;
  transform: none;
}
@media (min-width: 801px) {
  .player-view[data-character-id="zip"] .scene-artwork {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
  }
}
.player-view[data-character-id="zip"] .scene-expanded .scene-artwork[data-state="loaded"] img {
  object-position: 50% 50%;
  opacity: 1;
  filter: none;
}

/* Elsie’s Storyhouse — Liquid Glass tokens and reusable surfaces. */
body[data-brand="elsie"] {
  color-scheme: dark;
  --cream: #fff7de;
  --paper: rgba(63, 17, 47, 0.58);
  --ink: #fff7de;
  --blue: #ffd56c;
  --mid-blue: #ffc04d;
  --smart-blue: #ffd66d;
  --purple: #efb557;
  --plum: #430d31;
  --pink: #e88977;
  --orange: #f5a94b;
  --yellow: #ffc452;
  --line: rgba(255, 248, 224, 0.22);
  --elsie-glass: rgba(63, 15, 46, 0.48);
  --elsie-glass-strong: rgba(39, 6, 28, 0.68);
  --elsie-highlight: rgba(255, 255, 255, 0.42);
  --shadow: 0 30px 90px rgba(19, 2, 14, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(26, 3, 20, 0.16), rgba(31, 4, 24, 0.62) 67%, rgba(20, 2, 15, 0.90)),
    url("/assets/elsie-library.png") center 28% / cover fixed;
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
}

body[data-brand="elsie"] .app-shell {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 215, 105, 0.16), transparent 32rem),
    radial-gradient(circle at 92% 78%, rgba(238, 131, 114, 0.12), transparent 28rem);
}

body[data-brand="elsie"] .brand-header,
body[data-brand="elsie"] .player-nav,
body[data-brand="elsie"] .mobile-nav,
body[data-brand="elsie"] .still-going,
body[data-brand="elsie"] .adventure-door,
body[data-brand="elsie"] .world-band,
body[data-brand="elsie"] .character-row,
body[data-brand="elsie"] .account-sheet,
body[data-brand="elsie"] .auth-card,
body[data-brand="elsie"] .call-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.055) 38%, rgba(67, 13, 49, 0.50));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(155%);
  -webkit-backdrop-filter: blur(28px) saturate(155%);
}

body[data-brand="elsie"] .brand-header,
body[data-brand="elsie"] .player-nav {
  min-height: 68px;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
}

body[data-brand="elsie"] .brand-lockup,
body[data-brand="elsie"] .auth-brand {
  width: auto;
  height: 54px;
  gap: 11px;
  overflow: visible;
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

body[data-brand="elsie"] .brand-lockup::after,
body[data-brand="elsie"] .auth-brand::after {
  content: "Elsie’s Storyhouse";
  padding-right: 12px;
  font-size: clamp(15px, 1.7vw, 21px);
  white-space: nowrap;
}

body[data-brand="elsie"] .brand-lockup img,
body[data-brand="elsie"] .auth-brand img {
  width: 52px;
  height: 52px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 18px;
  object-fit: cover;
  transform: none;
  box-shadow: 0 9px 24px rgba(22, 2, 16, 0.34), inset 0 1px 0 white;
}

body[data-brand="elsie"] .brand-lockup.compact::after { font-size: 16px; }
body[data-brand="elsie"] .brand-lockup.compact img { width: 42px; height: 42px; border-radius: 14px; }

body[data-brand="elsie"] .library-nav {
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(28, 3, 21, 0.24);
}

body[data-brand="elsie"] .library-nav button,
body[data-brand="elsie"] .mobile-nav button,
body[data-brand="elsie"] .text-action { color: rgba(255, 247, 222, 0.82); }

body[data-brand="elsie"] .mobile-nav button[aria-current="page"] {
  background: rgba(255, 213, 108, 0.92);
  color: #3d092c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62), 0 8px 22px rgba(18, 2, 13, 0.28);
}

body[data-brand="elsie"] .library-nav button:hover,
body[data-brand="elsie"] .library-nav button[aria-current="page"] {
  background: rgba(255, 245, 214, 0.18);
  color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 7px 18px rgba(18, 2, 13, 0.22);
}

body[data-brand="elsie"] .page-heading h1,
body[data-brand="elsie"] .section-heading h2,
body[data-brand="elsie"] .adventure-door h3,
body[data-brand="elsie"] .identity h1,
body[data-brand="elsie"] .start-heading h2 {
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.045em;
}

body[data-brand="elsie"] .page-heading h1 span,
body[data-brand="elsie"] .eyebrow,
body[data-brand="elsie"] .section-heading .eyebrow,
body[data-brand="elsie"] .page-heading .eyebrow,
body[data-brand="elsie"] .adventure-door-copy .eyebrow { color: #ffd56c; }

body[data-brand="elsie"] .page-heading > p:last-child,
body[data-brand="elsie"] .adventure-door-summary,
body[data-brand="elsie"] .character-row-copy small,
body[data-brand="elsie"] .calls-footnote,
body[data-brand="elsie"] .section-note { color: rgba(255, 247, 222, 0.72); }

body[data-brand="elsie"] .adventure-doors[data-door-count="1"] {
  grid-template-columns: minmax(0, 800px);
}

body[data-brand="elsie"] .adventure-door {
  overflow: hidden;
  border-radius: 38px;
}

body[data-brand="elsie"] .adventure-door-art {
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 218, 113, 0.34), transparent 46%),
    rgba(40, 6, 29, 0.30);
}

body[data-brand="elsie"] .character-art-crop.elsie {
  --character-art-top: 6%;
  --character-art-right: auto;
  --character-art-bottom: auto;
  --character-art-left: 50%;
  --character-art-width: auto;
  --character-art-height: 96%;
  --character-art-fit: contain;
  --character-art-shift-x: -50%;
}

body[data-brand="elsie"] .character-art-crop.elsie img {
  filter: drop-shadow(0 24px 30px rgba(24, 2, 17, 0.42));
}

body[data-brand="elsie"] .door-badge,
body[data-brand="elsie"] .pack-signals span,
body[data-brand="elsie"] .brand-mode,
body[data-brand="elsie"] .status {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.11);
  color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

body[data-brand="elsie"] .primary-action,
body[data-brand="elsie"] .resume-audio,
body[data-brand="elsie"] .auth-submit {
  border: 1px solid rgba(255, 255, 255, 0.46);
  background: linear-gradient(145deg, rgba(255, 225, 136, 0.92), rgba(255, 184, 63, 0.76));
  color: #3c092a;
  box-shadow: 0 15px 38px rgba(255, 184, 63, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

body[data-brand="elsie"] .primary-action:hover,
body[data-brand="elsie"] .resume-audio:hover {
  box-shadow: 0 19px 44px rgba(255, 184, 63, 0.29), inset 0 1px 0 white;
}

body[data-brand="elsie"] .character-row { border-radius: 25px; }

body[data-brand="elsie"] .call-card {
  background: rgba(28, 4, 21, 0.52);
}

body[data-brand="elsie"] .visual-panel {
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 215, 105, 0.22), transparent 44%),
    linear-gradient(160deg, rgba(97, 28, 70, 0.66), rgba(28, 4, 21, 0.74));
}

body[data-brand="elsie"] .conversation-panel,
body[data-brand="elsie"] .call-setup,
body[data-brand="elsie"] .details {
  border-color: rgba(255, 255, 255, 0.17);
  background: rgba(31, 5, 23, 0.44);
  color: var(--cream);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
}

body[data-brand="elsie"] .bubble.character {
  border-color: rgba(255, 255, 255, 0.19);
  background: rgba(255, 255, 255, 0.11);
  color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body[data-brand="elsie"] .bubble.user {
  background: rgba(255, 207, 97, 0.88);
  color: #3c092a;
}

body[data-brand="elsie"] .account-sheet::backdrop { background: rgba(20, 2, 15, 0.70); backdrop-filter: blur(8px); }

@media (max-width: 800px) {
  body[data-brand="elsie"] { background-attachment: scroll; background-position: center top; }
  body[data-brand="elsie"] .brand-header { padding-inline: 7px; }
  body[data-brand="elsie"] .brand-lockup::after { display: none; }
  body[data-brand="elsie"] .brand-lockup { width: 50px; height: 50px; }
  body[data-brand="elsie"] .mobile-nav {
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    border-radius: 26px;
    background: rgba(44, 7, 32, 0.68);
  }
  body[data-brand="elsie"] .adventure-door { border-radius: 30px; }
}

@media (prefers-contrast: more) {
  body[data-brand="elsie"] {
    --elsie-glass: rgba(35, 4, 25, 0.86);
    --line: rgba(255, 248, 224, 0.58);
  }
  body[data-brand="elsie"] .brand-header,
  body[data-brand="elsie"] .adventure-door,
  body[data-brand="elsie"] .world-band,
  body[data-brand="elsie"] .call-card { background: rgba(35, 4, 25, 0.88); }
}

/* Elsie library architecture — editorial Home, scalable Explore, saved My Storyhouse.
   The call player intentionally continues to use the shared Spark interaction model. */
body[data-brand="elsie"] .library-view { width: min(100%, 1320px); }
body[data-brand="elsie"] .library-panels { padding-inline: clamp(2px, 1.4vw, 18px); }

.elsie-home,
.elsie-explore { display: grid; gap: clamp(42px, 6vw, 78px); }

.elsie-home-hero {
  min-height: 470px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  overflow: hidden;
  padding: clamp(34px, 6vw, 82px);
  border: 1px solid rgba(255, 248, 224, .24);
  border-radius: 46px;
  background:
    radial-gradient(circle at 78% 40%, rgba(255, 214, 109, .18), transparent 34%),
    linear-gradient(140deg, rgba(38, 5, 28, .82), rgba(93, 30, 55, .55));
  box-shadow: 0 34px 100px rgba(15, 1, 11, .52), inset 0 1px 0 rgba(255,255,255,.22);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
}
.elsie-home-hero-copy { position: relative; z-index: 2; max-width: 700px; }
.elsie-home-hero-copy h1,
.elsie-explore-heading h1 {
  margin: 10px 0 0;
  color: #fff8e3;
  font: 700 clamp(52px, 7vw, 94px)/.88 Georgia, "Times New Roman", serif;
  letter-spacing: -.065em;
  text-wrap: balance;
}
.elsie-home-hero-copy h1 span { color: #ffd56c; }
.elsie-home-hero-copy > p:not(.eyebrow) {
  max-width: 590px;
  margin: 26px 0 30px;
  color: rgba(255, 248, 227, .76);
  font: 500 clamp(16px, 1.8vw, 20px)/1.55 system-ui, sans-serif;
}
.elsie-home-hero-copy .primary-action { min-height: 58px; padding-inline: 26px; }
.elsie-home-hero-art {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
}
.elsie-home-hero-art::before,
.elsie-home-hero-art::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 224, 139, .22);
  border-radius: 50%;
}
.elsie-home-hero-art::before { inset: 2%; }
.elsie-home-hero-art::after { inset: 13%; border-style: dashed; }
.elsie-home-hero-art img {
  position: relative;
  z-index: 2;
  width: 72%;
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 34%;
  object-fit: cover;
  box-shadow: 0 28px 68px rgba(13,1,9,.5), inset 0 1px 0 white;
  transform: rotate(2deg);
}
.elsie-moon {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: rgba(255, 209, 87, .12);
  box-shadow: 0 0 80px rgba(255, 209, 87, .22);
}
.elsie-spark { position: absolute; z-index: 3; color: #ffe29b; font-size: 34px; text-shadow: 0 0 18px rgba(255,213,108,.8); }
.elsie-spark.spark-one { top: 8%; right: 12%; }
.elsie-spark.spark-two { bottom: 9%; left: 9%; font-size: 28px; }

.elsie-shelf { min-width: 0; }
.elsie-shelf-heading,
.elsie-results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.elsie-shelf-heading h2,
.elsie-results-heading h2 {
  margin: 5px 0 0;
  color: #fff8e3;
  font: 700 clamp(31px, 4vw, 50px)/1 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}
.elsie-shelf-note { color: rgba(255, 248, 227, .66); font: 650 14px/1.45 system-ui, sans-serif; }

.elsie-feature-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  overflow: hidden;
  border: 1px solid rgba(255, 248, 224, .23);
  border-radius: 38px;
  background: linear-gradient(140deg, rgba(255,255,255,.15), rgba(65,10,46,.68));
  box-shadow: 0 28px 80px rgba(14,1,10,.44), inset 0 1px 0 rgba(255,255,255,.22);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}
.elsie-feature-cover { min-height: 430px; margin: 0; overflow: hidden; background: #2a071e; }
.elsie-feature-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.elsie-feature-copy { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(32px, 5vw, 64px); }
.elsie-feature-copy h3 {
  margin: 8px 0 18px;
  color: #fff8e3;
  font: 700 clamp(34px, 4vw, 56px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.05em;
  text-wrap: balance;
}
.elsie-feature-summary { margin: 0; color: rgba(255,248,227,.75); font: 500 16px/1.6 system-ui, sans-serif; }
.elsie-story-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.elsie-story-facts span {
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  color: #fff4d4;
  font: 750 12px/1.2 system-ui, sans-serif;
}

.elsie-theme-shelves { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.elsie-theme-card {
  min-width: 0;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 23px;
  border: 1px solid rgba(255,248,224,.2);
  border-radius: 28px;
  background: rgba(55,9,40,.58);
  color: #fff8e3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.17), 0 18px 44px rgba(14,1,10,.26);
  backdrop-filter: blur(24px) saturate(145%);
  -webkit-backdrop-filter: blur(24px) saturate(145%);
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, background 180ms ease;
}
.elsie-theme-card:hover { transform: translateY(-4px); background: rgba(78,20,53,.72); }
.elsie-theme-symbol { color: #ffd56c; font: 32px/1 Georgia, serif; }
.elsie-theme-card strong { margin-top: auto; font: 700 21px/1.08 Georgia, serif; }
.elsie-theme-card small { margin-top: 8px; color: rgba(255,248,227,.62); font: 500 12px/1.4 system-ui, sans-serif; }
.elsie-theme-arrow { margin-top: 15px; color: #ffd56c; font-weight: 900; }
.theme-myths { background: rgba(47,20,73,.58); }
.theme-animals { background: rgba(51,53,29,.54); }
.theme-adventures { background: rgba(92,37,30,.54); }
.theme-bedtime { background: rgba(26,38,73,.56); }

.elsie-growing-note {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 26px;
  border: 1px solid rgba(255,248,224,.17);
  border-radius: 24px;
  background: rgba(38,5,28,.5);
  color: #fff8e3;
}
.elsie-growing-mark { color: #ffd56c; font-size: 28px; }
.elsie-growing-note div { display: grid; gap: 4px; }
.elsie-growing-note strong { font: 700 18px/1.2 Georgia, serif; }
.elsie-growing-note span:last-child { color: rgba(255,248,227,.64); font: 500 13px/1.45 system-ui, sans-serif; }

.elsie-explore { gap: 26px; }
.elsie-explore-heading { max-width: 900px; padding: 26px 8px 4px; }
.elsie-explore-heading h1 { font-size: clamp(50px, 7vw, 88px); }
.elsie-explore-heading > p:last-child { max-width: 660px; margin: 22px 0 0; color: rgba(255,248,227,.7); font: 500 17px/1.55 system-ui, sans-serif; }
.elsie-search {
  min-height: 68px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 1px solid rgba(255,248,224,.25);
  border-radius: 24px;
  background: rgba(41,6,30,.66);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 18px 48px rgba(14,1,10,.3);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  color: #ffd56c;
  font-size: 28px;
}
.elsie-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff8e3;
  font: 650 17px/1 system-ui, sans-serif;
}
.elsie-search input::placeholder { color: rgba(255,248,227,.48); }
.elsie-search:focus-within { border-color: rgba(255,213,108,.7); box-shadow: 0 0 0 4px rgba(255,213,108,.12), 0 18px 48px rgba(14,1,10,.3); }
.elsie-filter-chips { display: flex; gap: 9px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: thin; }
.elsie-filter-chip {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 17px;
  border: 1px solid rgba(255,248,224,.2);
  border-radius: 999px;
  background: rgba(48,8,35,.57);
  color: rgba(255,248,227,.76);
  cursor: pointer;
  font: 750 13px/1 system-ui, sans-serif;
}
.elsie-filter-chip[aria-pressed="true"] { border-color: #ffd56c; background: #ffd56c; color: #3d092c; }
.elsie-results-heading { margin: 18px 0 0; }
.elsie-story-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; }
.elsie-story-tile {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,248,224,.2);
  border-radius: 28px;
  background: rgba(49,8,35,.64);
  box-shadow: 0 20px 50px rgba(14,1,10,.32), inset 0 1px 0 rgba(255,255,255,.17);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}
.elsie-book-cover { aspect-ratio: 4 / 3; margin: 0; overflow: hidden; background: #26051b; }
.elsie-book-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.elsie-story-tile-copy { display: grid; align-content: start; gap: 9px; padding: 20px; }
.elsie-story-tile-copy h3 { min-height: 2.2em; margin: 0; color: #fff8e3; font: 700 23px/1.08 Georgia, serif; letter-spacing: -.03em; }
.elsie-story-tile-copy > p:not(.eyebrow) { min-height: 2.8em; margin: 0; color: rgba(255,248,227,.62); font: 550 12px/1.4 system-ui, sans-serif; }
.elsie-story-tile-copy .primary-action { justify-self: start; margin-top: 4px; }
.elsie-no-results { margin: 0; padding: 42px; border: 1px dashed rgba(255,248,224,.24); border-radius: 28px; color: rgba(255,248,227,.7); text-align: center; }

body[data-brand="elsie"] .calls-panel .page-heading h1 { font-family: Georgia, "Times New Roman", serif; }

@media (max-width: 1100px) {
  .elsie-theme-shelves { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .elsie-story-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 800px) {
  body[data-brand="elsie"] .library-panels { padding-inline: 0; }
  .elsie-home, .elsie-explore { gap: 34px; }
  .elsie-home-hero {
    min-height: 0;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 34px 24px 26px;
    border-radius: 32px;
  }
  .elsie-home-hero-copy h1,
  .elsie-explore-heading h1 { font-size: clamp(46px, 14vw, 64px); }
  .elsie-home-hero-copy > p:not(.eyebrow) { margin: 20px 0 24px; font-size: 16px; }
  .elsie-home-hero-copy .primary-action { width: 100%; }
  .elsie-home-hero-art { width: min(72vw, 280px); }
  .elsie-shelf-heading, .elsie-results-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .elsie-feature-card { grid-template-columns: 1fr; border-radius: 30px; }
  .elsie-feature-cover { min-height: 0; aspect-ratio: 16 / 11; }
  .elsie-feature-copy { padding: 26px 22px 28px; }
  .elsie-feature-copy h3 { font-size: 35px; }
  .elsie-feature-copy .primary-action { width: 100%; }
  .elsie-theme-shelves { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .elsie-theme-card { min-height: 184px; padding: 18px; border-radius: 24px; }
  .elsie-theme-card:last-child { grid-column: 1 / -1; min-height: 150px; }
  .elsie-growing-note { align-items: flex-start; padding: 20px; }
  .elsie-explore-heading { padding-top: 10px; }
  .elsie-search { min-height: 60px; padding-inline: 16px; border-radius: 20px; }
  .elsie-filter-chips { margin-right: -16px; padding-right: 16px; }
  .elsie-story-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .elsie-story-tile { border-radius: 22px; }
  .elsie-story-tile-copy { padding: 16px; }
  .elsie-story-tile-copy h3 { font-size: 19px; }
  .elsie-story-tile-copy .primary-action { width: 100%; }
}

@media (max-width: 480px) {
  .elsie-story-grid { grid-template-columns: 1fr; }
  .elsie-book-cover { aspect-ratio: 16 / 10; }
  .elsie-story-tile-copy h3 { min-height: 0; font-size: 24px; }
  .elsie-story-tile-copy > p:not(.eyebrow) { min-height: 0; }
}
