/* The experience player's chrome. Each experience sets its own palette by
   passing `theme` to createExperience (or overriding these variables); the
   layout, type and behaviour stay the same everywhere. */
.xp {
  --xp-bg: #0d1117;
  --xp-ink: #f3f1ec;
  --xp-muted: rgba(243, 241, 236, .62);
  --xp-faint: rgba(243, 241, 236, .14);
  --xp-panel: rgba(13, 17, 23, .74);
  --xp-card: #11161d;
  --xp-accent: #ff9f43;
  --xp-accent-ink: #1b1206;
  --xp-warn: #ffb547;
  --xp-ok: #5ad19a;
  --xp-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --xp-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --xp-radius: 14px;
  --xp-bar-h: 74px;

  position: fixed; inset: 0; overflow: hidden;
  background: var(--xp-bg); color: var(--xp-ink);
  font-family: var(--xp-font); -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}
.xp *, .xp *::before, .xp *::after { box-sizing: border-box; }
.xp button { font: inherit; color: inherit; }
.xp [hidden] { display: none !important; }
.xp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.xp-canvas:active { cursor: grabbing; }
.xp-vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.35) 100%); }
.xp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* labels */
.xp-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.xp-label { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity .25s; }
.xp-label > span, .xp-label > small { display: block; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.xp-label > span {
  font-size: 12px; font-weight: 600; letter-spacing: -.005em; padding: 5px 9px; border-radius: 999px;
  background: rgba(255,255,255,.94); color: #10141a; box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.xp-label > small { font-size: 10.5px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); margin-top: 2px; transform: translate(-50%, calc(-100% - 8px)); text-align: center; }
.xp-label--pin > span { background: var(--xp-accent); color: var(--xp-accent-ink); }
.xp-label--warn > span { background: var(--xp-warn); color: #1d1405; }
.xp-label--soft > span { background: rgba(10,12,16,.72); color: #fff; font-weight: 500; backdrop-filter: blur(6px); }

/* top bar */
.xp-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent);
  pointer-events: none;
}
.xp-top > * { pointer-events: auto; }
.xp-brand { font-weight: 700; font-size: 13px; color: var(--xp-ink); text-decoration: none; opacity: .85; padding: 6px 10px; border-radius: 999px; background: rgba(0,0,0,.28); }
.xp-brand:hover { opacity: 1; }
.xp-titleblock { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.xp-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 8px rgba(0,0,0,.4); }
.xp-step { font-family: var(--xp-mono); font-size: 11px; color: var(--xp-muted); }
.xp-tools { display: flex; gap: 8px; }
.xp-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  border: 1px solid var(--xp-faint); border-radius: 999px; background: rgba(13,17,23,.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s, transform .15s;
}
.xp-btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.xp-btn:active { transform: scale(.96); }
.xp-btn svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.xp-btn--icon { width: 36px; padding: 0; justify-content: center; }
.xp-recentre { border-color: var(--xp-accent); color: var(--xp-accent); }
.xp :focus-visible { outline: 2px solid var(--xp-accent); outline-offset: 2px; }

/* chapter panel */
.xp-panel {
  position: absolute; z-index: 4; right: 18px; top: 72px; max-height: calc(100% - 72px - var(--xp-bar-h) - 28px);
  width: min(380px, 34vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 22px 18px; border-radius: var(--xp-radius);
  background: var(--xp-panel); border: 1px solid var(--xp-faint);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 20px 50px rgba(0,0,0,.35); user-select: text; -webkit-user-select: text;
  scrollbar-width: thin; scrollbar-color: var(--xp-faint) transparent;
}
.xp-panel-grip { display: none; }
.xp[data-state="intro"] .xp-panel, .xp[data-state="intro"] .xp-bar, .xp[data-state="loading"] .xp-panel, .xp[data-state="loading"] .xp-bar { opacity: 0; pointer-events: none; }
.xp-panel.xp-in > * { animation: xp-rise .5s cubic-bezier(.2,.7,.2,1) both; }
.xp-panel.xp-in > :nth-child(3) { animation-delay: .04s; }
.xp-panel.xp-in > :nth-child(4) { animation-delay: .08s; }
.xp-panel.xp-in > :nth-child(n+5) { animation-delay: .12s; }
@keyframes xp-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.xp-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.xp-clock { font-family: var(--xp-mono); font-size: 12px; color: var(--xp-accent); font-weight: 500; }
.xp-tag { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--xp-faint); color: var(--xp-ink); }
.xp-ch-title { font-size: 21px; line-height: 1.22; letter-spacing: -.02em; margin: 10px 0 10px; font-weight: 700; }
.xp-narr { font-size: 14.5px; line-height: 1.65; color: var(--xp-ink); opacity: .9; margin: 0; }
.xp-meters { display: grid; gap: 9px; margin-top: 16px; }
.xp-meters:empty { display: none; }
.xp-extra { margin-top: 16px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--xp-faint); font-size: 13.5px; line-height: 1.55; }
.xp-extra input[type=range] { width: 100%; accent-color: var(--xp-accent); }
.xp-extra button { cursor: pointer; border: 1px solid var(--xp-faint); background: rgba(255,255,255,.06); border-radius: 999px; padding: 6px 12px; margin: 4px 6px 0 0; }
.xp-extra button.is-right { background: var(--xp-ok); color: #06140d; border-color: transparent; }
.xp-extra button.is-wrong { border-color: #ff6b6b; color: #ffb3b3; }
.xp-extra output, .xp-extra .xp-big { display: block; font-family: var(--xp-mono); font-size: 20px; color: var(--xp-accent); margin-top: 6px; }
.xp-meter { display: grid; grid-template-columns: 74px 1fr auto; gap: 10px; align-items: center; font-size: 12px; }
.xp-meter > span { color: var(--xp-muted); }
.xp-meter i { height: 6px; border-radius: 6px; background: var(--xp-faint); overflow: hidden; }
.xp-meter i b { display: block; height: 100%; border-radius: 6px; background: var(--c); transition: width .9s cubic-bezier(.2,.7,.2,1); }
.xp-meter em { font-style: normal; font-size: 11.5px; color: var(--xp-ink); min-width: 64px; text-align: right; }
.xp-meter--value { grid-template-columns: 74px 1fr; }
.xp-meter--value b { font-weight: 600; font-family: var(--xp-mono); font-size: 12px; }
.xp-list { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--xp-faint); }
.xp-list h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--xp-muted); font-weight: 600; }
.xp-list h3 svg { width: 14px; height: 14px; fill: currentColor; }
.xp-watch h3 { color: var(--xp-warn); }
.xp-prep h3 { color: var(--xp-ok); }
.xp-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.xp-list li { position: relative; padding-left: 16px; font-size: 13.5px; line-height: 1.55; }
.xp-list li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.xp-watch li::before { background: var(--xp-warn); opacity: 1; }
.xp-prep li::before { background: var(--xp-ok); opacity: 1; }

/* bottom bar */
.xp-bar {
  position: absolute; z-index: 5; left: 18px; right: 18px; bottom: 14px; height: var(--xp-bar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 16px; border-radius: var(--xp-radius);
  background: var(--xp-panel); border: 1px solid var(--xp-faint);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.xp-transport { display: flex; gap: 6px; }
.xp-play { width: 44px !important; height: 44px !important; background: var(--xp-accent) !important; color: var(--xp-accent-ink) !important; border-color: transparent !important; }
.xp-play svg { width: 18px; height: 18px; }
.xp-track { flex: 1; display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 0; }
.xp-track::-webkit-scrollbar { display: none; }
.xp-tick { flex: 1 1 0; min-width: 56px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 5px; }
.xp-tick i { display: block; height: 4px; border-radius: 4px; background: var(--xp-faint); overflow: hidden; }
.xp-tick i b { display: block; height: 100%; width: 0; background: var(--xp-accent); }
.xp-tick.is-done i b { width: 100% !important; opacity: .55; }
.xp-tick span { font-family: var(--xp-mono); font-size: 10.5px; color: var(--xp-muted); white-space: nowrap; }
.xp-tick em { font-style: normal; font-size: 11.5px; color: var(--xp-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-tick.is-current span, .xp-tick.is-current em { color: var(--xp-ink); }
.xp-tick:hover em { color: var(--xp-ink); }

/* overlays */
.xp-overlay {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(80% 80% at 50% 40%, rgba(0,0,0,.35), rgba(0,0,0,.7));
  overflow-y: auto; user-select: text; -webkit-user-select: text;
}
.xp-loading { background: var(--xp-bg); align-content: center; gap: 14px; color: var(--xp-muted); font-size: 14px; }
.xp-loading p { margin: 0; text-align: center; max-width: 36ch; }
.xp-spinner { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--xp-faint); border-top-color: var(--xp-accent); animation: xp-spin 1s linear infinite; margin: 0 auto; }
@keyframes xp-spin { to { transform: rotate(1turn); } }
.xp-card {
  width: min(560px, 100%); padding: 30px 30px 26px; border-radius: 20px;
  background: var(--xp-card); border: 1px solid var(--xp-faint); box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: xp-pop .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes xp-pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.xp-card--text { width: min(760px, 100%); align-self: start; }
.xp-kicker { font-family: var(--xp-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--xp-accent); }
.xp-card h1 { font-size: clamp(26px, 4.4vw, 38px); line-height: 1.05; letter-spacing: -.035em; margin: 10px 0 10px; }
.xp-card h2 { font-size: 22px; letter-spacing: -.02em; margin: 8px 0; }
.xp-sub { color: var(--xp-muted); font-size: 15px; line-height: 1.6; margin: 0 0 6px; }
.xp-brief { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 20px 0 6px; border-radius: 12px; overflow: hidden; background: var(--xp-faint); border: 1px solid var(--xp-faint); }
.xp-brief div { background: var(--xp-card); padding: 10px 12px; }
.xp-brief dt { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--xp-muted); }
.xp-brief dd { margin: 3px 0 0; font-size: 14px; font-weight: 600; }
.xp-params { display: grid; gap: 14px; margin-top: 18px; }
.xp-param { border: 0; margin: 0; padding: 0; }
.xp-param legend { font-size: 12px; font-weight: 600; color: var(--xp-muted); margin-bottom: 7px; }
.xp-param > div { display: flex; flex-wrap: wrap; gap: 6px; }
.xp-opt { position: relative; cursor: pointer; }
.xp-opt input { position: absolute; opacity: 0; pointer-events: none; }
.xp-opt span { display: inline-block; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--xp-faint); font-size: 13.5px; transition: all .15s; }
.xp-opt small { display: block; font-size: 11px; color: var(--xp-muted); padding: 3px 4px 0; max-width: 18ch; }
.xp-opt:hover span { border-color: rgba(255,255,255,.35); }
.xp-opt input:checked + span { background: var(--xp-accent); color: var(--xp-accent-ink); border-color: transparent; font-weight: 600; }
.xp-opt input:focus-visible + span { outline: 2px solid var(--xp-accent); outline-offset: 2px; }
.xp-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 24px; }
.xp-cta {
  display: inline-flex; align-items: center; gap: 9px; height: 48px; padding: 0 24px; border: 0; border-radius: 999px;
  background: var(--xp-accent); color: var(--xp-accent-ink); font-weight: 700; font-size: 15px; cursor: pointer;
  box-shadow: 0 10px 30px -10px var(--xp-accent); transition: transform .15s, filter .15s;
}
.xp-cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
.xp-cta svg { width: 16px; height: 16px; fill: currentColor; }
.xp-ghost {
  display: inline-flex; align-items: center; height: 48px; padding: 0 18px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--xp-faint); color: var(--xp-ink); font-size: 14px; text-decoration: none;
}
.xp-ghost:hover { border-color: rgba(255,255,255,.4); }
.xp-ghost--sm { height: 34px; font-size: 12.5px; padding: 0 13px; margin-top: 10px; }
.xp-fine { margin: 16px 0 0; font-size: 12px; color: var(--xp-muted); line-height: 1.55; }
.xp-warn { background: rgba(255,181,71,.12); border: 1px solid var(--xp-warn); color: var(--xp-ink); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.xp-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.xp-x { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 1px solid var(--xp-faint); background: none; cursor: pointer; font-size: 20px; line-height: 1; }
.xp-tx { padding: 18px 0; border-top: 1px solid var(--xp-faint); }
.xp-tx header { display: flex; gap: 10px; align-items: center; font-family: var(--xp-mono); font-size: 12px; color: var(--xp-accent); }
.xp-tx header em { font-style: normal; font-family: var(--xp-font); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--xp-muted); }
.xp-tx h3 { margin: 6px 0; font-size: 18px; letter-spacing: -.015em; }
.xp-tx p { margin: 0; line-height: 1.7; font-size: 14.5px; opacity: .92; }
.xp-tx h4 { margin: 12px 0 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--xp-muted); }
.xp-tx ul { margin: 0; padding-left: 18px; line-height: 1.6; font-size: 14px; }
.xp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 20px 0 6px; }
.xp-stats div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--xp-faint); }
.xp-stats dt { font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--xp-accent); }
.xp-stats dd { margin: 2px 0 0; font-size: 12px; color: var(--xp-muted); }
.xp-h3 { margin: 22px 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--xp-muted); }
.xp-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 34vh; overflow-y: auto; }
.xp-checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; cursor: pointer; font-size: 14px; line-height: 1.5; border-radius: 8px; }
.xp-checklist label:hover { background: rgba(255,255,255,.04); }
.xp-checklist input { margin-top: 3px; accent-color: var(--xp-accent); width: 16px; height: 16px; flex: none; }
.xp-checklist input:checked + span { opacity: .5; text-decoration: line-through; }

/* capture mode: the still for the card, no chrome */
.xp--capture .xp-top, .xp--capture .xp-panel, .xp--capture .xp-bar, .xp--capture .xp-overlay, .xp--capture .xp-labels .xp-label--soft { display: none !important; }

/* phones: the panel becomes a bottom sheet above the bar */
@media (max-width: 760px) {
  .xp { --xp-bar-h: 64px; }
  .xp-top { padding: 10px 12px; gap: 8px; }
  .xp-brand span, .xp-btn span { display: none; }
  .xp-btn { width: 36px; padding: 0; justify-content: center; }
  .xp-title { font-size: 14px; }
  .xp-panel {
    left: 10px; right: 10px; width: auto; top: auto; bottom: calc(var(--xp-bar-h) + 18px);
    max-height: 34vh; padding: 16px 16px 14px; transition: max-height .3s ease;
  }
  .xp.sheet-open .xp-panel { max-height: 64vh; }
  .xp-panel-grip { display: block; position: sticky; top: -10px; margin: -8px auto 6px; width: 46px; height: 14px; border: 0; background: none; cursor: pointer; }
  .xp-panel-grip::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--xp-faint); margin: 5px auto; }
  .xp-ch-title { font-size: 18px; margin: 6px 0; }
  .xp-narr { font-size: 14px; }
  .xp-bar { left: 10px; right: 10px; bottom: 10px; padding: 0 10px; gap: 10px; }
  .xp-tick { min-width: 22px; }
  .xp-tick span, .xp-tick em { display: none; }
  .xp-tick.is-current { min-width: 92px; }
  .xp-tick.is-current span { display: block; }
  .xp-card { padding: 22px 18px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .xp *, .xp *::before, .xp *::after { animation: none !important; transition: none !important; }
}

/* cinema layout: the picture leads; the notes become a short caption */
.xp--cinema .xp-panel {
  top: auto; right: auto; left: 22px; bottom: calc(var(--xp-bar-h) + 22px);
  width: min(430px, 42vw); max-height: 46vh; padding: 18px 20px 16px;
  background: color-mix(in srgb, var(--xp-panel) 80%, transparent);
}
.xp--cinema .xp-ch-title { font-size: 25px; letter-spacing: -.025em; margin: 8px 0 6px; }
.xp--cinema .xp-narr { font-size: 15px; line-height: 1.55; opacity: .85; }
.xp--cinema .xp-list { margin-top: 12px; padding-top: 10px; }
.xp--cinema .xp-list h3 { display: none; }
.xp--cinema .xp-list ul { display: flex; flex-wrap: wrap; gap: 6px; }
.xp--cinema .xp-list li { padding: 5px 10px 5px 22px; border-radius: 999px; background: rgba(255,255,255,.06); font-size: 12.5px; line-height: 1.35; }
.xp--cinema .xp-list li::before { left: 9px; top: 50%; transform: translateY(-50%); }
.xp--cinema .xp-meters { grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 12px; }
.xp--cinema .xp-meter { grid-template-columns: auto 1fr; gap: 8px; font-size: 11.5px; }
.xp--cinema .xp-meter em { display: none; }
.xp--cinema .xp-vignette { background: radial-gradient(130% 100% at 60% 40%, transparent 50%, rgba(0,0,0,.45) 100%); }
@media (max-width: 760px) {
  .xp--cinema .xp-panel { left: 10px; right: 10px; width: auto; max-height: 30vh; }
  .xp--cinema .xp-ch-title { font-size: 19px; }
}

/* the take-home points */
.xp-card--wide { width: min(980px, 100%); }
.xp-points { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 10px; margin: 22px 0 4px; }
.xp-point {
  display: flex; flex-direction: column; gap: 5px; padding: 14px 15px 15px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid var(--xp-faint);
  animation: xp-rise .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 60ms + 150ms);
}
.xp-point-k { font-family: var(--xp-mono); font-size: 20px; font-weight: 500; color: var(--xp-accent); letter-spacing: -.02em; }
.xp-point b { font-size: 14.5px; letter-spacing: -.01em; }
.xp-point span:last-child:not(.xp-point-k) { font-size: 12.5px; color: var(--xp-muted); line-height: 1.5; }
.xp-outro { align-items: start; }
.xp-outro .xp-card { margin: auto 0; }
