:root {
  --bg: #f6f4fb;
  --panel: #ffffff;
  --ink: #1d1830;
  --muted: #6b6585;
  --line: #e6e1f2;
  --brand: #7c4dff;
  --brand-ink: #ffffff;
  --brand-soft: #efe8ff;
  --accent: #ffb020;
  --ok: #18a058;
  --warn: #d97706;
  --danger: #d6336c;
  --shadow: 0 1px 2px rgba(29, 24, 48, .06), 0 8px 24px rgba(29, 24, 48, .08);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fredoka", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .01em; margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--brand); }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: #cfc6e8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* working (generating voices, writing, publishing): a spinner, and the button stays readable */
.btn.is-busy:disabled { opacity: .85; cursor: progress; }
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #6a3df0; border-color: #6a3df0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--ink); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  cursor: pointer; display: inline-grid; place-items: center; font-size: 16px;
}
.icon-btn:disabled { opacity: .4; cursor: default; }

label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
div.field { display: grid; gap: 4px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field-head .btn-sm { padding-block: 2px; }
input[type=text], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff;
  font-weight: 400; font-size: 14px; color: var(--ink);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: #f1eff7; color: var(--muted);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #b9b3cc; }
.chip.on { background: #e7f7ee; color: #11743f; }
.chip.on::before { background: var(--ok); }
.chip.stale { background: #fff4e0; color: #9a5800; }
.chip.stale::before { background: var(--warn); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 20px; font-weight: 600; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #7c4dff, #ff7ac6); display: grid; place-items: center; color: #fff; font-size: 16px; }
.topbar .spacer { flex: 1; }
.providers { display: flex; gap: 6px; flex-wrap: wrap; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
.preview { position: sticky; top: 72px; align-self: start; display: grid; gap: 10px; min-width: 0; }
.preview-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview-head h2 { font-size: 18px; margin-right: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--brand-soft); color: var(--brand); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2 { font-size: 17px; }
.panel-head .num { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.panel-head .spacer { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* mascot gallery */
.mascots { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.mascot-card {
  flex: 0 0 132px; border: 2px solid var(--line); border-radius: 12px; padding: 8px; background: #fbfaff; cursor: pointer;
  text-align: center; display: grid; gap: 4px; justify-items: center;
}
.mascot-card img { height: 120px; width: 100%; object-fit: contain; }
.mascot-card b { font-size: 14px; }
.mascot-card small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.mascot-card.on { border-color: var(--brand); background: var(--brand-soft); }
.mascot-card.add { border-style: dashed; justify-content: center; align-content: center; color: var(--muted); }
.mascot-card.add span { font-size: 30px; line-height: 1; }

/* voice options */
.voice-opts { display: grid; gap: 8px; }
.voice-opt { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.voice-opt input[type=radio] { margin-top: 3px; }
.voice-opt .title { font-weight: 600; }
.voice-opt .body { grid-column: 2; display: grid; gap: 8px; }
.voice-opt.disabled { opacity: .55; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* steps */
.steps { display: grid; gap: 12px; }
.step { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; background: #fff; }
.step.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.step-shot { position: relative; border-radius: 8px; overflow: hidden; background: #f1eff7; border: 1px solid var(--line); cursor: crosshair; align-self: start; }
.step-shot img { display: block; width: 100%; }
.step-shot .pin { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--accent); pointer-events: none; }
.step-shot .empty { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.step-shot-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.step-fields { display: grid; gap: 8px; min-width: 0; }
.step-top { display: flex; gap: 8px; align-items: center; }
.step-top .n { font-family: var(--display); font-weight: 600; color: var(--brand); }
.step-top input { font-weight: 600; }
.step-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.step-status { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.step.needs-voice { box-shadow: inset 3px 0 0 var(--warn); }
.step-adv { border-top: 1px dashed #e3def0; padding-top: 6px; }
.step-adv > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 4px; }
.step-adv > summary::-webkit-details-marker { display: none; }
.step-adv > summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
.step-adv[open] > summary::before { transform: rotate(90deg); }
.step-adv > summary .hint { font-weight: 400; font-size: 12px; }
.step-adv[open] { display: grid; gap: 8px; }
.step-adv .step-meta { grid-template-columns: 1fr 1fr; }
.add-step { width: 100%; border-style: dashed; padding: 12px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(20, 16, 36, .45); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal-box { background: #fff; border-radius: 16px; padding: 18px; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 12px; }
.modal-box h2 { font-size: 19px; }
.brand { white-space: nowrap; }
.embed-warn { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: #fff4e0; color: #9a5800; font-size: 13px; }
textarea.code { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; background: #f6f4fb; resize: none; white-space: pre; overflow-x: auto; }
.anchor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; }
.anchor-img { align-self: start; position: relative; background: repeating-conic-gradient(#f0eef6 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-radius: 10px; overflow: hidden; user-select: none; touch-action: none; }
.anchor-img img { display: block; width: 100%; pointer-events: none; }
.anchor-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; cursor: grab; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.anchor-dot[data-k=mouth] { background: #ff4d6d; }
.anchor-dot[data-k=eyeL], .anchor-dot[data-k=eyeR] { background: #3aa0ff; }
.anchor-dot[data-k=neck] { background: #18a058; }
.anchor-neck { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dashed #18a058; pointer-events: none; }
.anchor-side canvas { max-height: 320px; width: auto !important; margin: 0 auto; display: block; }
.anchor-side { display: grid; gap: 10px; align-content: start; }
.anchor-side canvas { width: 100%; background: linear-gradient(#f3f0ff, #fff); border-radius: 10px; }
.legend { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- demo player ---------- */
.dp { display: grid; gap: 10px; container-type: inline-size; min-width: 0; }
.dp > * { min-width: 0; }
.dp-subs-wrap { display: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.dp-subs { margin: 0; font-size: 14px; line-height: 1.45; color: #a29cbb; max-height: 4.4em; overflow: auto; }
.dp-subs span.said { color: var(--ink); }
@container (max-width: 560px) {
  .dp .dp-bubble { display: none; }
  .dp-subs-wrap { display: block; }
  /* not before the tour starts: the start screen is all there is (no line, no Next yet) */
  .dp:has(.dp-start:not([hidden])) .dp-subs-wrap { display: none; }
  .dp-mascot { height: 60%; }
  .dp-tip:not([hidden]) { display: block; font-size: 11px; padding: 4px 8px; }
  .dp-hot { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
  .dp-hot i { inset: 7px; }
}
.dp-stage { position: relative; border-radius: 16px; overflow: hidden; background: #e9e5f5; box-shadow: var(--shadow); isolation: isolate; }
/* one shape for every step (16:9, SCREEN_RATIO in player.js); a screen of another shape sits centred on the margin colour */
.dp-screen { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #eef0f4; }
.dp-zoom { position: absolute; inset: 0; transition: transform 1.4s cubic-bezier(.2, .7, .2, 1); }
.dp-zoom.zoomed { transform: scale(1.07); }
.dp-shot { display: block; width: 100%; height: 100%; object-fit: fill; }

.dp-hot {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 176, 32, .25); cursor: pointer; z-index: 2;
}
.dp-hot i { position: absolute; inset: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px #fff; }
.dp-hot::before, .dp-hot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); animation: ping 1.8s ease-out infinite;
}
.dp-hot::after { animation-delay: .9s; }
.dp-hot.nudge { animation: nudge 1.2s ease-in-out infinite; }
@keyframes ping { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.dp-tip {
  display: none; /* shown in narrow players only (see the container query above) */
  position: absolute; transform: translate(-50%, calc(-100% - 26px)); background: var(--ink); color: #fff; font-weight: 600;
  font-size: 13px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; z-index: 2; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.dp-tip::after { content: ""; position: absolute; left: var(--arrow, 50%); bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: translateX(-50%) rotate(45deg); }
.dp-tip.below { transform: translate(-50%, 28px); }
.dp-tip.below::after { top: -5px; bottom: auto; }

.dp-mascot {
  position: absolute; bottom: 0; height: 68%; display: flex; align-items: flex-end; gap: 0; z-index: 3; pointer-events: none;
  transition: left .7s cubic-bezier(.3, .8, .3, 1), right .7s cubic-bezier(.3, .8, .3, 1);
}
.dp-mascot.side-right { right: 1%; left: auto; }
.dp-mascot.side-left { left: 1%; right: auto; }
.dp-actor { height: 100%; position: relative; display: flex; align-items: flex-end; }
.dp-canvas { height: 100%; width: auto; display: block; filter: drop-shadow(0 8px 14px rgba(30, 20, 60, .28)); }

/* the speech bubble: a tooltip pointing at the hotspot (placed by _placeBubble() in player.js) */
.dp-bubble {
  position: absolute; left: 0; top: 0; z-index: 4; width: min(320px, 44cqw); background: #fff; border-radius: 16px; padding: 12px 16px 10px;
  border: 1px solid rgba(60, 40, 120, .08);
  box-shadow: 0 1px 2px rgba(30, 20, 60, .06), 0 14px 36px rgba(30, 20, 60, .22); opacity: 0; transform: translateY(6px) scale(.97);
  transition: opacity .3s ease, transform .3s ease, left .45s cubic-bezier(.3, .8, .3, 1), top .45s cubic-bezier(.3, .8, .3, 1);
  max-height: 62%; display: flex; flex-direction: column; pointer-events: none;
}
.dp-bubble.show { opacity: 1; transform: none; pointer-events: auto; }
/* the arrow, toward the hotspot: --ax / --ay are its position along the edge */
.dp-bubble::before {
  content: ""; position: absolute; width: 12px; height: 12px; background: #fff; transform: rotate(45deg); display: none;
  border: 1px solid rgba(60, 40, 120, .08); box-sizing: border-box;
}
.dp-bubble.at-below::before { display: block; top: -6.5px; left: clamp(16px, calc(var(--ax) - 6px), calc(100% - 28px)); border-right: 0; border-bottom: 0; }
.dp-bubble.at-above::before { display: block; bottom: -6.5px; left: clamp(16px, calc(var(--ax) - 6px), calc(100% - 28px)); border-left: 0; border-top: 0; }
.dp-bubble.at-right::before { display: block; left: -6.5px; top: clamp(14px, calc(var(--ay) - 6px), calc(100% - 26px)); border-top: 0; border-right: 0; }
.dp-bubble.at-left::before { display: block; right: -6.5px; top: clamp(14px, calc(var(--ay) - 6px), calc(100% - 26px)); border-bottom: 0; border-left: 0; }
.dp-bub-title {
  display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; flex: none; overflow: hidden;
  max-height: 3em; transition: max-height .4s ease, opacity .35s ease .1s, margin .4s ease;
}
/* beside the mascot (while it starts talking): a speech balloon, title folded away */
.dp-bubble.intro .dp-bub-title { max-height: 0; opacity: 0; margin-bottom: 0; transition: none; }
.dp-bubble.at-mascot { border-bottom-right-radius: 4px; }
.dp-bubble.at-mascot.from-left { border-bottom-right-radius: 16px; border-bottom-left-radius: 4px; }
/* the slide to the hotspot: a little slower than a re-placement, with a soft overshoot */
.dp-bubble.show:not(.intro) { transition: opacity .3s ease, transform .3s ease, left .6s cubic-bezier(.34, 1.2, .5, 1), top .6s cubic-bezier(.34, 1.2, .5, 1), border-radius .4s ease; }
.dp-bub-title[hidden] { display: none; }
/* spotlight: the screen dims around the hotspot a moment after the mascot starts talking */
.dp-dim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 1.1s ease;
  background: rgba(24, 18, 48, .42);
  /* the clear area around the hotspot (--r) and a long, eased fade into the dim (--f) */
  --r: clamp(40px, 6cqw, 80px); --f: clamp(110px, 16cqw, 220px);
  -webkit-mask: radial-gradient(circle at var(--hx, 50%) var(--hy, 50%), transparent 0, transparent calc(var(--r) * .55), rgba(0,0,0,0.000) calc(var(--r) + var(--f) * 0.0), rgba(0,0,0,0.028) calc(var(--r) + var(--f) * 0.1), rgba(0,0,0,0.104) calc(var(--r) + var(--f) * 0.2), rgba(0,0,0,0.216) calc(var(--r) + var(--f) * 0.3), rgba(0,0,0,0.352) calc(var(--r) + var(--f) * 0.4), rgba(0,0,0,0.500) calc(var(--r) + var(--f) * 0.5), rgba(0,0,0,0.648) calc(var(--r) + var(--f) * 0.6), rgba(0,0,0,0.784) calc(var(--r) + var(--f) * 0.7), rgba(0,0,0,0.896) calc(var(--r) + var(--f) * 0.8), rgba(0,0,0,0.972) calc(var(--r) + var(--f) * 0.9), rgba(0,0,0,1.000) calc(var(--r) + var(--f) * 1.0));
  mask: radial-gradient(circle at var(--hx, 50%) var(--hy, 50%), transparent 0, transparent calc(var(--r) * .55), rgba(0,0,0,0.000) calc(var(--r) + var(--f) * 0.0), rgba(0,0,0,0.028) calc(var(--r) + var(--f) * 0.1), rgba(0,0,0,0.104) calc(var(--r) + var(--f) * 0.2), rgba(0,0,0,0.216) calc(var(--r) + var(--f) * 0.3), rgba(0,0,0,0.352) calc(var(--r) + var(--f) * 0.4), rgba(0,0,0,0.500) calc(var(--r) + var(--f) * 0.5), rgba(0,0,0,0.648) calc(var(--r) + var(--f) * 0.6), rgba(0,0,0,0.784) calc(var(--r) + var(--f) * 0.7), rgba(0,0,0,0.896) calc(var(--r) + var(--f) * 0.8), rgba(0,0,0,0.972) calc(var(--r) + var(--f) * 0.9), rgba(0,0,0,1.000) calc(var(--r) + var(--f) * 1.0));
}
.dp-dim.on { opacity: 1; }
.dp-stage:has(.dp-start:not([hidden])) .dp-dim, .dp-stage:has(.dp-end:not([hidden])) .dp-dim { opacity: 0; }
.dp-bubble p { margin: 0; font-size: 15px; line-height: 1.5; color: #b3aec6; overflow: auto; min-height: 0; flex: 1 1 auto; padding-right: 2px; }

/* step controls, inside the bubble (or the subtitle strip in narrow players):
   [step dots]  pause  mute | <  [Next >] */
.dp-ctl { display: flex; align-items: center; gap: 2px; margin-top: 12px; flex: none; }
.dp-steps { flex: 1; min-width: 0; display: flex; align-items: center; }
.dp-dots { display: flex; align-items: center; gap: 5px; }
.dp-dot { width: 7px; height: 7px; border-radius: 99px; border: 0; padding: 0; background: #dcd6ec; cursor: pointer; transition: width .25s ease, background .2s ease; position: relative; }
.dp-dot::before { content: ""; position: absolute; inset: -7px -3px; } /* a bigger click area */
.dp-dot:hover { background: #bdb3dd; }
.dp-dot.on { width: 20px; background: var(--brand); }
.dp-dot:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.dp-count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-cbtn {
  width: 30px; height: 30px; border-radius: 9px; border: 0; background: transparent; color: #8a84a3;
  cursor: pointer; display: inline-grid; place-items: center; line-height: 1; padding: 0; flex: none;
  transition: background .15s ease, color .15s ease;
}
.dp-cbtn svg { display: block; }
.dp-cbtn:hover:not(:disabled) { background: var(--brand-soft); color: var(--ink); }
.dp-cbtn:disabled { opacity: .35; cursor: default; }
.dp-cbtn:focus-visible, .dp-next:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dp-csep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; flex: none; }
.dp-next {
  display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 8px 0 13px; margin-left: 4px; flex: none;
  border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 35%, transparent); transition: background .15s ease, transform .08s ease;
}
.dp-next:hover { background: color-mix(in srgb, var(--brand) 86%, #000); }
/* the start / replay buttons follow the tour's button colour too (player.js sets --brand) */
.dp .btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.dp .btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, #000); border-color: color-mix(in srgb, var(--brand) 86%, #000); }
.dp-next:active { transform: translateY(1px); }
.dp-next-i svg { display: block; }
.dp-subs-wrap .dp-ctl { margin-top: 8px; }
/* "Made with …": inside the screen, in the bottom corner away from the mascot */
.dp-brand {
  position: absolute; bottom: 10px; right: 10px; z-index: 6; display: inline-flex; gap: 4px; align-items: center;
  font-size: 11.5px; line-height: 1; color: #6b6585; text-decoration: none; white-space: nowrap;
  padding: 5px 10px 5px 9px; border-radius: 99px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(4px);
  box-shadow: 0 1px 2px rgba(30, 20, 60, .08), 0 4px 12px rgba(30, 20, 60, .12);
}
/* the Showtello logo: icon + name in Manrope ExtraBold */
.dp-brand b { display: inline-flex; align-items: center; gap: .2em; color: #1d1830; font-family: Manrope, var(--font); font-weight: 800; font-size: 1.08em; letter-spacing: -.02em; }
.dp-brand b svg { width: 1.45em; height: 1.45em; flex: none; }
.dp-brand:hover { background: #fff; color: var(--ink); }
@container (max-width: 560px) {
  .dp-brand { font-size: 10px; padding: 4px 8px; bottom: 6px; }
  .dp-brand { right: 6px; }
}
.dp-bubble p span { transition: color .15s ease; }
.dp-bubble p span.said { color: var(--ink); }

/* The tour's colour on the bubble and the hotspot (ACCENT_MODE 'bubble' in player.js: --tint
   is the colour, --tint-ink white or dark, whichever reads on it). The controls inside take
   the ink colour; Next is the ink colour with the tint as its text. */
.dp-tint .dp-bubble, .dp-tint .dp-bubble::before, .dp-tint .dp-subs-wrap { background: var(--tint); border-color: transparent; }
.dp-tint .dp-bub-title { color: var(--tint-ink); }
.dp-tint .dp-bubble p, .dp-tint .dp-subs { color: color-mix(in srgb, var(--tint-ink) 52%, transparent); }
.dp-tint .dp-bubble p span.said, .dp-tint .dp-subs span.said { color: var(--tint-ink); }
.dp-tint .dp-wait i { background: color-mix(in srgb, var(--tint-ink) 60%, transparent); }
.dp-tint .dp-dot { background: color-mix(in srgb, var(--tint-ink) 30%, transparent); }
.dp-tint .dp-dot:hover { background: color-mix(in srgb, var(--tint-ink) 55%, transparent); }
.dp-tint .dp-dot.on { background: var(--tint-ink); }
.dp-tint .dp-count { color: color-mix(in srgb, var(--tint-ink) 75%, transparent); }
.dp-tint .dp-cbtn { color: color-mix(in srgb, var(--tint-ink) 78%, transparent); }
.dp-tint .dp-cbtn:hover:not(:disabled) { background: color-mix(in srgb, var(--tint-ink) 14%, transparent); color: var(--tint-ink); }
.dp-tint .dp-csep { background: color-mix(in srgb, var(--tint-ink) 25%, transparent); }
.dp-tint .dp-next { background: var(--tint-ink); color: var(--tint); box-shadow: 0 2px 8px rgba(20, 15, 45, .18); }
.dp-tint .dp-next:hover { background: color-mix(in srgb, var(--tint-ink) 88%, var(--tint)); }
.dp-tint .dp-dot:focus-visible, .dp-tint .dp-cbtn:focus-visible, .dp-tint .dp-next:focus-visible { outline-color: var(--tint-ink); }
.dp-tint .dp-hot { background: color-mix(in srgb, var(--tint) 25%, transparent); }
.dp-tint .dp-tip, .dp-tint .dp-tip::after { background: var(--tint); color: var(--tint-ink); }

.dp-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(28, 20, 54, .45); backdrop-filter: blur(3px); z-index: 5; padding: 16px; }
.dp-card { background: #fff; border-radius: 18px; padding: 20px 24px; text-align: center; display: grid; gap: 8px; justify-items: center; max-width: min(360px, calc(100% - 24px)); box-shadow: var(--shadow); }
.dp-card h3 { font-size: 21px; }
.dp-card p { margin: 0; color: var(--muted); }
.dp-start-face { height: 110px; width: auto; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
/* the Start button's play mark: only when the start screen is just the button */
.dp-start-play { display: none; }
/* A start screen with neither the mascot nor the text (Tour details, tourLook in player.js):
   the button alone, over the tour's first screen. It pops in, a ring ripples out from it and
   a light sweeps across it now and then. */
.dp-start-bare .dp-card { background: none; box-shadow: none; padding: 0; }
.dp-start-bare .dp-start-btn {
  position: relative; display: inline-flex; align-items: center; gap: 12px; padding: 9px 26px 9px 9px; border: 0; border-radius: 99px;
  font-size: 17px; font-weight: 700; letter-spacing: -.005em; isolation: isolate;
  background: linear-gradient(105deg, var(--brand) 42%, color-mix(in srgb, var(--brand) 62%, #fff) 50%, var(--brand) 58%) 100% 0 / 260% 100% var(--brand);
  box-shadow: 0 14px 34px -10px color-mix(in srgb, var(--brand) 80%, #000), 0 2px 6px rgba(20, 15, 45, .18);
  animation: dp-launch-in .7s cubic-bezier(.34, 1.4, .5, 1) backwards, dp-launch-shine 3.6s ease-in-out 1.2s infinite;
  transition: transform .3s cubic-bezier(.34, 1.4, .5, 1), box-shadow .3s ease;
}
.dp-start-bare .dp-start-btn:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 18px 40px -10px color-mix(in srgb, var(--brand) 85%, #000), 0 2px 6px rgba(20, 15, 45, .18); }
.dp-start-bare .dp-start-btn:active { transform: scale(.98); }
.dp-start-bare .dp-start-play {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--brand-ink, #fff); color: var(--brand);
}
.dp-start-bare .dp-start-play svg { margin-left: 2px; fill: currentColor; }
.dp-start-bare .dp-start-btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; border: 2px solid var(--brand); pointer-events: none;
  animation: dp-launch-ring 2.4s cubic-bezier(.2, .6, .35, 1) .7s infinite; opacity: 0;
}
.dp-start-bare .dp-start-btn[aria-busy="true"] { padding-left: 22px; }
.dp-start-bare .dp-start-btn[aria-busy="true"] .dp-start-play { display: none; }
@keyframes dp-launch-in { from { opacity: 0; transform: scale(.8); } }
@keyframes dp-launch-ring { 0% { opacity: .75; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1, 1.5); } }
@keyframes dp-launch-shine { 0% { background-position: 100% 0; } 40%, 100% { background-position: 0 0; } }
@container (max-width: 560px) {
  .dp-start-bare .dp-start-btn { font-size: 15px; gap: 10px; padding: 7px 20px 7px 7px; }
  .dp-start-bare .dp-start-play { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .dp-start-bare .dp-start-btn { animation: none; }
  .dp-start-bare .dp-start-btn::after { display: none; }
}
/* Square corners (Tour details): for a page or frame that has its own edges. Embedded, the
   player then sits flush in its frame (no gap for a shadow). */
.dp-square .dp-stage, .dp-square .dp-subs-wrap { border-radius: 0; }
.play-page.embed:has(.dp-square) { padding: 0; }
.play-page.embed .dp-square .dp-stage { box-shadow: none; }
/* Small players (phones, narrow embeds): the screen is short, keep the cards compact. */
@container (max-width: 560px) {
  .dp-card { padding: 12px 16px; gap: 4px; }
  .dp-card h3 { font-size: 16px; }
  .dp-card p { font-size: 12.5px; margin: 0; }
  .dp-start-face { height: 64px; }
}
@container (max-width: 400px) {
  .dp-start-face { display: none; }
}

.dp-pause svg { display: block; margin: auto; }
.dp-paused .dp-bubble p { opacity: 0.6; }

/* ---------- full screen (shared links and embeds: player.js toggleFullscreen) ---------- */
.dp-fs {
  position: absolute; top: 10px; right: 10px; z-index: 7; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #1d1830; cursor: pointer;
  box-shadow: 0 1px 2px rgba(30, 20, 60, .08), 0 4px 12px rgba(30, 20, 60, .14); backdrop-filter: blur(4px);
}
.dp-fs[hidden] { display: none; }
.dp-fs svg { display: block; }
.dp-fs:hover { background: #fff; }
.dp-fs:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@container (max-width: 560px) { .dp-fs { top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 7px; } }
/* its tooltip (data-tip, player.js _syncFull): black, below the button, lined up with its right edge */
.dp-fs::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); right: 0; padding: 5px 9px; border-radius: 7px;
  background: #111; color: #fff; font: 600 12px/1.2 var(--font); white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translateY(-3px); transition: opacity .15s ease, transform .15s ease;
}
.dp-fs:hover::after, .dp-fs:focus-visible::after { opacity: 1; transform: none; transition-delay: .25s; }
@media (hover: none) { .dp-fs:hover::after { opacity: 0; } }
/* the page holds only the player: in full screen (or filling the window, on iPhone) it is all
   there is, as big as fits, on a dark backdrop. Landscape on a phone gets the wide layout. */
body.dp-full-page { overflow: hidden; }
.play-page.dp-full-page, .play-page.embed.dp-full-page {
  padding: 0; min-height: 100vh; min-height: 100dvh; height: 100vh; height: 100dvh; display: grid; place-items: center; background: #0f0c1d;
}
.play-page.dp-full-page .play-wrap, .play-page.embed.dp-full-page .play-wrap {
  width: min(100vw, calc(100vh * 16 / 9)); width: min(100vw, calc(100dvh * 16 / 9)); gap: 8px;
}
.play-page.dp-full-page .dp-stage { border-radius: 0; box-shadow: none; }
.play-page.dp-full-page .dp-subs-wrap { border-radius: 0; border-left: 0; border-right: 0; }

/* ---------- loading (slow connections) ---------- */
/* before the player's script has run (play.php): the stage's shape, with a spinner */
.dp-boot {
  aspect-ratio: 16 / 9; display: grid; place-content: center; justify-items: center; gap: 12px;
  border-radius: 16px; background: #e9e5f5; color: var(--muted); font-size: 14px; box-shadow: var(--shadow);
}
.dp-boot .spinner { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }
/* the mascot is loading: the Start button waits, with a spinner (player.js _setLoading) */
.dp .btn[aria-busy="true"] { opacity: 1; cursor: progress; display: inline-flex; align-items: center; gap: 8px; }
.dp .btn[aria-busy="true"]::before {
  content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
/* a new screen still on its way: the last one fades back, a spinner over it (after a beat) */
.dp-shot-spin {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; z-index: 2; pointer-events: none;
  border-radius: 50%; border: 3px solid var(--brand, #7c4dff); border-right-color: transparent; opacity: 0;
}
.dp-shot-wait .dp-shot-spin { opacity: 1; transition: opacity .2s ease .3s; animation: spin .8s linear infinite; }
.dp-shot-wait .dp-shot { opacity: .35; transition: opacity .2s ease .3s; }
/* the voice is on its way (player.js _onWait): "typing" dots instead of the words */
.dp-wait { display: none; gap: 5px; align-items: center; height: 1.5em; }
.dp-wait i { width: 7px; height: 7px; border-radius: 50%; background: #b3aec6; animation: dp-typing 1.1s ease-in-out infinite; }
.dp-wait i:nth-child(2) { animation-delay: .15s; }
.dp-wait i:nth-child(3) { animation-delay: .3s; }
@keyframes dp-typing { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.dp-waiting .dp-bubble .dp-wait { display: flex; }
.dp-waiting .dp-bubble p { display: none; }
/* the subtitle strip keeps its height (the controls under the words don't jump) */
.dp-subs-wrap { position: relative; }
.dp-waiting .dp-subs-wrap .dp-wait { display: flex; position: absolute; left: 12px; top: 8px; }
.dp-waiting .dp-subs { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .dp-wait i { animation-duration: 2.2s; }
  .dp-shot-wait .dp-shot-spin, .dp .btn[aria-busy="true"]::before { animation-duration: 2s; }
}

/* standalone player page */
.play-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, #e7dcff, transparent), var(--bg); }
.play-wrap { width: min(1100px, 100%); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.play-head { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.play-head[hidden] { display: none; }
.play-head h1 { font-size: 22px; flex: 1; }
/* Inside a customer's website (embed.js): no page chrome, height follows the content. */
.play-page.embed { min-height: 0; display: block; padding: 2px; background: transparent; }
.play-page.embed .play-wrap { width: 100%; gap: 8px; }
.play-page.embed .play-head { display: none; }
.dp-empty { display: grid; gap: 4px; place-content: center; text-align: center; min-height: 220px; padding: 24px; border-radius: 16px; background: #f1eff7; color: var(--muted); font-size: 14px; }
.dp-empty b { color: var(--ink, #1d1730); font-size: 16px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; order: -1; }
}
@media (max-width: 640px) {
  .layout { padding: 12px; }
  .step { grid-template-columns: 1fr; }
  .step-meta, .grid2 { grid-template-columns: 1fr; }
  .anchor-wrap { grid-template-columns: 1fr; }
  .dp-mascot { height: 56%; }
  .dp-bubble { width: min(280px, 50cqw); padding: 10px 12px 8px; }
  .dp-bubble p { font-size: 13px; }
  .topbar { padding: 10px 12px; }
}

/* tour switcher (top bar) + "Your tours" dialog */
.crumb-sep { color: #cfc6e8; font-size: 22px; margin: 0 2px; }
.tour-switch {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 340px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 4px 10px 4px 4px; cursor: pointer; text-align: left;
}
.tour-switch:hover { border-color: #cfc6e8; background: #faf8ff; }
.tour-switch img { width: 32px; height: 32px; object-fit: cover; object-position: top; border-radius: 8px; background: var(--brand-soft); flex: none; }
.ts-text { display: grid; min-width: 0; line-height: 1.15; }
.ts-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ts-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-caret { color: var(--muted); font-size: 12px; }

.tours-box { width: min(760px, 100%); align-content: start; }
.tours-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tours-head .spacer { flex: 1; }
.tours-head input[type=search] { width: 200px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.new-tour { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.new-tour-opt { display: grid; gap: 4px; text-align: left; border: 1px dashed #cfc6e8; background: #faf8ff; border-radius: 12px; padding: 12px; cursor: pointer; }
.new-tour-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.new-tour-opt span { color: var(--muted); font-size: 13px; }
.tour-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tour-row {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer;
}
.tour-row:hover { border-color: #cfc6e8; background: #faf8ff; }
.tour-row.current { border-color: var(--brand); background: var(--brand-soft); cursor: default; }
.tour-row img { width: 48px; height: 48px; object-fit: cover; object-position: top; border-radius: 10px; background: #fff; }
.tour-main { min-width: 0; display: grid; gap: 3px; }
.tour-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tour-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-name input { font: inherit; font-weight: 600; border: 1px solid var(--brand); border-radius: 8px; padding: 3px 8px; width: 100%; }
.tour-badge { flex: none; font-size: 11px; font-weight: 700; color: var(--brand); background: #fff; border: 1px solid var(--brand); border-radius: 999px; padding: 1px 8px; }
.tour-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.tour-meta .chip { font-size: 12px; }
.tour-actions { display: flex; gap: 2px; }
.tour-actions .btn { color: var(--muted); }
.tour-actions .btn.danger:hover { color: #c0392b; background: #fdecea; }
.tour-empty { color: var(--muted); text-align: center; padding: 18px; }
@media (max-width: 640px) {
  .tour-switch { max-width: 60vw; }
  .crumb-sep, .ts-label { display: none; }
  .new-tour { grid-template-columns: 1fr; }
  .tour-row { grid-template-columns: 40px 1fr; }
  .tour-row img { width: 40px; height: 40px; }
  .tour-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .tours-head input[type=search] { width: 100%; order: 5; }
}

/* single voice option (no radio) */
.voice-main { grid-template-columns: 1fr; }
.voice-main .body { grid-column: 1; }

/* voice picker: the chosen voice in the panel, and the "Choose a voice" dialog */
.voice-current { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.voice-loading { grid-column: 1 / -1; color: var(--muted); font-size: 14px; padding: 6px 0; }
.voice-info { display: grid; gap: 2px; min-width: 0; }
.voice-info b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-desc { color: var(--muted); font-size: 13px; line-height: 1.35; }
.voice-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.voice-tags:empty { display: none; }
.voice-tags span { font-size: 11px; line-height: 1.6; color: var(--muted); background: #f3f0fa; border-radius: 999px; padding: 0 8px; text-transform: capitalize; }
/* round play button; while playing it becomes a stop button with a progress ring (--p = 0..1) */
.voice-play {
  --p: 0;
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: conic-gradient(var(--brand) calc(var(--p) * 1turn), #e6e1f2 0);
}
.voice-play::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--panel); transition: background .15s; }
.voice-play::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 14px; margin: -7px 0 0 -4px;
  background: var(--brand); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.voice-play:hover::before { background: var(--brand-soft); }
.voice-play.playing::before { background: var(--brand); }
.voice-play.playing::after { width: 12px; height: 12px; margin: -6px 0 0 -6px; clip-path: none; border-radius: 2px; background: #fff; }
.voice-play:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* a sample that is still being made / loaded: spinning ring instead of the stop square */
.voice-play.playing.loading::before { background: var(--panel); }
.voice-play.playing.loading::after {
  width: 18px; height: 18px; margin: -9px 0 0 -9px; clip-path: none; border-radius: 50%;
  background: none; border: 2px solid #e6e1f2; border-top-color: var(--brand); animation: voice-spin .8s linear infinite;
}
@keyframes voice-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .voice-play.playing.loading::after { animation-duration: 2.4s; } }

/* Advanced: one section per setting (mood, gesture, pose after talking, position) */
.adv-body { display: grid; gap: 14px; margin-top: 8px; padding: 14px; border-radius: 12px; background: #faf9fd; border: 1px solid #efebf7; }
.adv-sec { display: grid; gap: 9px; min-width: 0; }
.adv-sec + .adv-sec { border-top: 1px solid #ebe7f4; padding-top: 14px; }
.adv-head { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.adv-head h4 { font: 600 13.5px/1.3 var(--font); margin: 0; }
.adv-sub { font-size: 12px; color: var(--muted); }
.adv-state, .adv-reset { margin-left: auto; font-size: 12px; }
.adv-state { color: var(--muted); }
.adv-reset { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; }
.adv-reset:hover { text-decoration: underline; }
/* "Auto" badge: marks what Auto picks for this line */
.auto-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.5;
  color: var(--brand); background: #fff; border: 1px solid #d9ccff; border-radius: 999px; padding: 0 5px;
}
.pick-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.pick-chip:hover { border-color: #cfc6e8; }
.pick-chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pick-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* picture tiles, like the mascot picker */
.pick-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 14px 8px; padding-top: 6px; }
.pick-tiles.pick-gesture { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 14px 6px; }
.pick-tile {
  position: relative; display: grid; grid-template-rows: auto auto; gap: 4px; padding: 4px 4px 6px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px; min-width: 0;
}
.pick-tile:hover { border-color: #cfc6e8; }
.pick-tile.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.pick-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* the badge sits on the tile's top edge, off the picture */
.pick-tile .auto-badge { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 1; }
.pick-img { position: relative; display: block; height: 88px; overflow: hidden; border-radius: 7px; background: #f6f4fb; }
.pick-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* gesture tiles: head and shoulders of the talking pose, moving the way the gesture does
   (pose frames are normalised: same size, character top at ~14% of the frame) */
.pick-gesture .pick-img { height: 64px; }
.pick-gesture .pick-img img { position: absolute; width: 230%; height: auto; max-width: none; left: -65%; top: 0; margin-top: -24%; transform-origin: 50% 30%; }
.pick-label { font-size: 11.5px; line-height: 1.25; color: var(--ink); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pick-tile.on .pick-label { color: var(--brand); font-weight: 600; }
.pick-tile:hover .g-nod, .g-nod.replay { animation: g-nod 1.1s ease-in-out; }
.pick-tile:hover .g-tilt, .g-tilt.replay { animation: g-tilt 1.6s ease-in-out; }
.pick-tile:hover .g-hop, .g-hop.replay { animation: g-hop .9s ease-out; }
.pick-tile:hover .g-lean_in, .g-lean_in.replay { animation: g-lean 1.8s ease-in-out; }
.pick-tile:hover .g-shake, .g-shake.replay { animation: g-shake 1.1s ease-in-out; }
@keyframes g-nod { 0%, 100% { transform: none; } 25% { transform: translateY(4px) scaleY(.97); } 50% { transform: none; } 75% { transform: translateY(3px) scaleY(.98); } }
@keyframes g-tilt { 0%, 100% { transform: none; } 30%, 70% { transform: rotate(-7deg); } }
@keyframes g-hop { 0%, 100% { transform: none; } 15% { transform: scaleY(.94); } 45% { transform: translateY(-12px); } 75% { transform: scaleY(.97); } }
@keyframes g-lean { 0%, 100% { transform: none; } 30%, 70% { transform: scale(1.12) translateY(2px); } }
@keyframes g-shake { 0%, 100% { transform: none; } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .pick-img img { animation: none !important; } }

.voices-box { overflow: hidden; width: min(680px, 100%); max-height: min(720px, calc(100vh - 40px)); grid-template-rows: auto auto minmax(0, 1fr) auto; }
.voice-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.voice-filters:empty { display: none; }
.voice-filter { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.voice-filter:hover { border-color: #cfc6e8; }
.voice-filter.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.voice-filter-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.voice-list { list-style: none; margin: 0; padding: 0 2px 2px 0; display: grid; gap: 6px; overflow-y: auto; align-content: start; }
.voice-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer;
}
.voice-row:hover { border-color: #cfc6e8; background: #faf8ff; }
.voice-row:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.voice-row.playing { border-color: #cfc6e8; background: #faf8ff; }
.voice-row.chosen { border-color: var(--brand); background: var(--brand-soft); }
@media (max-width: 640px) {
  .voice-current, .voice-row { grid-template-columns: auto minmax(0, 1fr); }
  .voice-current > .btn, .voice-row > .btn, .voice-row > .tour-badge { grid-column: 2; justify-self: start; }
}
.tour-noimg { width: 48px; height: 48px; border-radius: 10px; background: #f1eef8; color: var(--muted); display: grid; place-items: center; font-weight: 700; }

/* narrow screens: the top bar wraps instead of overflowing */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; }
  .topbar .providers { display: none; }
  .tour-switch { flex: 1 1 200px; max-width: none; }
  .ts-label { display: inline; }
}
@media (max-width: 480px) {
  .brand { font-size: 0; gap: 0; } /* keep only the logo mark */
  .crumb-sep { display: none; }
}
.tour-switch { min-width: 200px; flex: 0 1 auto; }
@media (max-width: 1200px) { .topbar .providers { display: none; } }
.btn-new { white-space: nowrap; border-color: var(--brand); color: var(--brand); font-weight: 600; }
.btn-new:hover { background: var(--brand-soft); border-color: var(--brand); }
@media (max-width: 1200px) {
  .brand { font-size: 0; gap: 0; } /* logo mark only: room for the tour name and actions */
  .crumb-sep { display: none; }
}
@media (max-width: 640px) {
  .adv-body { padding: 10px; }
  .adv-head .adv-sub { flex-basis: 100%; order: 3; }
}

/* Publish button when the live version is already up to date: greyed out */
.btn-primary.is-done:disabled { background: #ece9f3; border-color: #ece9f3; color: #8a85a0; opacity: 1; cursor: default; }
/* switching tours: dim the editor until the next one is in */
body.tour-loading .layout { opacity: .55; pointer-events: none; transition: opacity .15s; }
/* shown only if the builder script failed to start (see index.html) */
.boot-fail {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; gap: 12px; align-items: center;
  background: #fff4e0; color: #7a4500; border: 1px solid #f3d29a; border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 14px;
  max-width: calc(100vw - 32px);
}

/* "Spotlight from" word picker, under the line in each step card */
.spot-pick { display: grid; gap: 6px; margin-top: 6px; font-size: 12.5px; }
.spot-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.spot-label { font-weight: 600; color: var(--muted); }
.spot-value { flex: 1; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot-note { color: var(--muted); }
.spot-words { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-radius: 10px; background: #f7f5fc; border: 1px solid var(--line); }
.spot-chip { border: 1px solid transparent; background: #fff; border-radius: 7px; padding: 2px 7px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.spot-chip:hover { border-color: #cfc6e8; }
.spot-chip.lit { background: #efe8ff; }
.spot-chip.on { background: var(--brand); color: var(--brand-ink); }
.spot-auto { font-weight: 600; color: var(--muted); }
.spot-auto.on { background: var(--ink); color: #fff; }

/* start / end card titles: the same clean sans as the rest of the player */
.dp-card h3 { font-family: var(--font); font-weight: 700; letter-spacing: -.01em; }

/* the page around the embed asked to start the tour, but sound needs a click here (play.php):
   the Start button bounces to say "click me" */
.dp .dp-start-btn.dp-call { animation: dp-call .55s cubic-bezier(.3, 1.6, .5, 1) 2; }
@keyframes dp-call { 40% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .dp .dp-start-btn.dp-call { animation: none; outline: 3px solid var(--brand); outline-offset: 3px; } }
