/* Zuora Design Partner Program
   Two surfaces: the "desk" (light, where you answer) and the "stage" (dark,
   where you watch). Colours and type are set once here as tokens. */

@font-face {
  font-family: 'Public Sans';
  src: url('/fonts/public-sans.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #14213d;
  --ink-deep: #0c1529;
  --mist: #eef2f5;
  --paper: #ffffff;
  --teal: #0b7f7b;
  --teal-dark: #086764;
  --teal-wash: #e2f1f0;
  --slate: #5b6b7c;
  --slate-light: #a9b6c6;
  --amber: #f2b134;
  --line: #d3dce4;
  --danger: #b3261e;

  --display: Calibri, 'Segoe UI', 'Public Sans', system-ui, sans-serif;
  --body: 'Public Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --bar-h: 76px;
  --focus: var(--ink);
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: env(safe-area-inset-top, 0px) 0 calc(var(--bar-h) + 28px + env(safe-area-inset-bottom, 0px));
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--mist);
  transition: background-color 0.45s ease, color 0.45s ease;
}
body.no-bar {
  padding-bottom: 40px;
}
body.surface-stage {
  --focus: var(--amber);
  color: #fff;
  background: var(--ink);
}

h1,
h2 {
  font-family: var(--display);
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
h1:focus,
.screen:focus {
  outline: none;
}

.sr-only,
.player__now {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* Native inputs stay in the page for keyboards and screen readers; the
   visible control is drawn by the label around them. */
.sr-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
}
.skip-link:focus {
  top: 12px;
}
.noscript {
  max-width: 560px;
  margin: 80px auto;
  padding: 0 24px;
  text-align: center;
}

/* ------------------------------------------------------------ masthead -- */

.masthead {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px clamp(20px, 4vw, 48px);
}
.masthead__mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.masthead__logo {
  height: 26px;
  width: auto;
}
.masthead__program {
  padding-left: 14px;
  border-left: 1.5px solid currentColor;
  font-size: 0.9rem;
  line-height: 1.1;
  opacity: 0.72;
}

.screen {
  padding: 0 clamp(20px, 4vw, 48px);
}

/* ------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary {
  background: var(--teal);
  color: #fff;
}
.btn--primary:hover {
  background: var(--teal-dark);
}
.btn--primary:disabled {
  background: #cdd6de;
  color: #647383;
  cursor: not-allowed;
}
.surface-stage .btn--primary {
  background: #fff;
  color: var(--ink);
}
.surface-stage .btn--primary:hover {
  background: var(--mist);
}
.surface-stage .btn--primary:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.55);
}
.btn--primary.is-ready {
  animation: ready 1.6s ease-out 2;
}
@keyframes ready {
  from {
    box-shadow: 0 0 0 0 rgba(242, 177, 52, 0.75);
  }
  to {
    box-shadow: 0 0 0 16px rgba(242, 177, 52, 0);
  }
}
.btn--quiet {
  background: transparent;
  color: inherit;
  padding-inline: 14px;
}
.btn--quiet:hover {
  background: rgba(91, 107, 124, 0.16);
}
.btn--ghost {
  background: transparent;
  border-color: currentColor;
}
.btn--ghost:hover {
  background: rgba(20, 33, 61, 0.06);
}
.btn--lg {
  min-height: 56px;
  padding: 14px 34px;
  font-size: 1.125rem;
}
.linkbtn {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--slate);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------- welcome -- */

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(16px, 5vh, 64px) 0 24px;
}
.display {
  font-size: clamp(2.5rem, 5.4vw, 4.4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.lede {
  max-width: 34em;
  margin-top: 24px;
  font-size: 1.1875rem;
  line-height: 1.55;
}
.outline {
  list-style: none;
  counter-reset: chapter;
  margin: 32px 0 0;
  padding: 0;
  max-width: 34em;
  border-top: 1.5px solid var(--ink);
}
.outline li {
  counter-increment: chapter;
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.outline li::before {
  content: counter(chapter);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--teal);
}
.outline__title {
  font-weight: 600;
}
.outline__time {
  font-size: 0.875rem;
  color: var(--slate);
  white-space: nowrap;
}
.welcome__actions {
  margin-top: 32px;
}
.fine {
  max-width: 36em;
  margin-top: 20px;
  font-size: 0.875rem;
  color: var(--slate);
}

.welcome__preview {
  position: relative;
  margin: 0;
  padding: 0 7% 0 0;
}
.welcome__preview::before {
  content: '';
  position: absolute;
  inset: 9% 0 22% 12%;
  background: var(--ink);
  border-radius: 14px;
}
.welcome__slide {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 48px -24px rgba(20, 33, 61, 0.5);
}
.welcome__presenter {
  position: absolute;
  right: 0;
  top: 46%;
  width: 36%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 46% 50%;
  border: 4px solid var(--paper);
  border-radius: 12px;
  box-shadow: 0 18px 36px -18px rgba(20, 33, 61, 0.7);
}
.welcome__preview figcaption {
  position: relative;
  max-width: 58%;
  margin-top: 18px;
  font-size: 0.9375rem;
  color: var(--slate);
}
.welcome__preview figcaption strong {
  color: var(--ink);
}

/* --------------------------------------------------- question surfaces -- */

.sheet {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(16px, 5vh, 56px) 0 24px;
}
.sheet--wide {
  max-width: 1120px;
}
.q + .q {
  margin-top: 44px;
}
.prompt {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.prompt--minor {
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}
.helper {
  max-width: 40em;
  margin-top: 10px;
  color: var(--slate);
}
.q > .opts,
.q > .scale,
.q > .text,
.q > .loop,
.q > .levels,
.q > div {
  margin-top: 26px;
}

.opts {
  display: grid;
  gap: 10px;
}
.opt {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.opt:hover {
  border-color: var(--slate);
}
.opt:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-wash);
}
.opt:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.opt__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 1.5px solid var(--slate);
  border-radius: 6px;
  background: var(--paper);
  color: transparent;
}
.opt__mark--radio {
  border-radius: 50%;
}
.opt__mark .icon {
  width: 18px;
  height: 18px;
}
.opt input:checked ~ .opt__mark {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.opt__text {
  display: block;
  min-width: 0;
}
.opt__label {
  display: block;
  font-weight: 600;
}
.opt__hint {
  display: block;
  margin-top: 2px;
  font-size: 0.9375rem;
  color: var(--slate);
}
.opt--exclusive {
  margin-top: 8px;
  border-style: dashed;
}
.opts--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.opts--compact .opt {
  padding: 12px 14px;
}
.opts--compact .opt__label {
  font-weight: 500;
}
.opt--consent {
  margin-top: 24px;
  background: transparent;
  border-color: transparent;
  padding-inline: 0;
}
.opt--consent:hover {
  border-color: transparent;
}
.opt--consent:has(input:checked) {
  background: transparent;
  border-color: transparent;
}
.opt--consent .opt__label {
  font-weight: 500;
}

/* scale */
.scale__row {
  display: flex;
  gap: 10px;
}
.scale__item {
  flex: 1;
  display: grid;
  place-items: center;
  height: 68px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
.scale__item:hover {
  border-color: var(--slate);
}
.scale__item:has(input:checked) {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.scale__item:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.scale__ends {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--slate);
}

/* matrix: one scale row per item, rating several things on one screen */
.matrix {
  display: grid;
  gap: 22px;
}
.matrix__label {
  margin-bottom: 8px;
  font-weight: 600;
}

/* free text */
.text {
  position: relative;
}
.text__area {
  display: block;
  width: 100%;
  min-height: 108px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.5;
  resize: vertical;
}
.text__area:focus-visible,
.field__input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--ink);
}
.text__count {
  display: block;
  min-height: 1.4em;
  margin-top: 4px;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--slate);
}

/* the loop */
.loop {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
}
.loop__figure {
  position: relative;
}
.loop__ring {
  display: block;
  width: 100%;
  height: auto;
}
.loop__arc {
  cursor: pointer;
}
.loop__arc path {
  fill: #d5dee7;
  transition: fill 0.15s ease;
}
.loop__arc:hover path {
  fill: #bfccd8;
}
.loop__arc.is-on path {
  fill: var(--teal);
}
.loop__label {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 650;
  fill: var(--ink);
  pointer-events: none;
}
.loop__arc.is-on .loop__label {
  fill: #fff;
}
.loop__centre {
  position: absolute;
  inset: 31%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.loop__centre strong {
  font-family: var(--display);
  font-size: 1.125rem;
  line-height: 1.15;
}
.loop__centre span {
  margin-top: 4px;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--slate);
}

/* rank */
.rank {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.rank__card {
  display: flex;
  flex-direction: column;
  padding: 0 0 14px;
  overflow: hidden;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.rank__card:hover {
  border-color: var(--slate);
}
.rank__card.is-picked {
  border-color: var(--ink);
  box-shadow: 0 0 0 1.5px var(--ink);
}
.rank__card.is-full {
  opacity: 0.5;
}
.rank__thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #dfe9f3;
  border-bottom: 1px solid var(--line);
}
.rank__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rank__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.125rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(20, 33, 61, 0.35);
}
.rank__badge:empty {
  display: none;
}
.rank__title {
  padding: 12px 14px 4px;
  font-weight: 650;
  line-height: 1.25;
}
.rank__hint {
  padding: 0 14px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--slate);
}
.rank__foot {
  min-height: 2em;
  margin-top: 12px;
}

/* levels: a bar meter, one bar lit per step of autonomy handed to the agent */
.levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2.4vw, 32px);
  padding-top: 8px;
}
.level {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 14px 18px;
  text-align: center;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.level:hover {
  border-color: var(--slate);
}
.level:has(input:checked) {
  background: var(--teal-wash);
  border-color: var(--ink);
  box-shadow: 0 0 0 1.5px var(--ink);
}
.level:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.level__bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 56px;
  margin-bottom: 18px;
}
.level__bar {
  width: 12px;
  background: var(--line);
  border-radius: 3px 3px 0 0;
  transition: background-color 0.15s ease;
}
.level__bar:nth-child(1) {
  height: 25%;
}
.level__bar:nth-child(2) {
  height: 50%;
}
.level__bar:nth-child(3) {
  height: 75%;
}
.level__bar:nth-child(4) {
  height: 100%;
}
.level__bar.is-on {
  background: var(--amber);
}
.level:has(input:checked) .level__bar.is-on {
  background: var(--teal);
}
.level__label {
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 650;
  line-height: 1.2;
}
.level__hint {
  margin-top: 6px;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--slate);
}

/* join form */
.form {
  margin-top: 28px;
}
.form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
}
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.field__opt {
  font-weight: 400;
  color: var(--slate);
}
.field__input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
}
.field__input[aria-invalid='true'] {
  border-color: var(--danger);
}
.field__error {
  min-height: 1.5em;
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--danger);
}
.form__set {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}
.form__set legend {
  margin-bottom: 10px;
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

/* snapshot */
.snap {
  padding: clamp(24px, 4vw, 44px);
  background: var(--paper);
  border-radius: 16px;
  border-top: 6px solid var(--amber);
}
.snap__grid {
  margin: 28px 0 0;
}
.snap__row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 6px 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.snap__row dt {
  font-size: 0.9375rem;
  color: var(--slate);
}
.snap__row dd {
  margin: 0;
}
.snap__row dd strong {
  display: block;
  font-family: var(--display);
  font-size: 1.1875rem;
  font-weight: 650;
  line-height: 1.25;
}
.snap__row dd span {
  display: block;
  font-size: 0.9375rem;
  color: var(--slate);
}
.snap__rank,
.snap__list {
  margin: 0;
  padding-left: 1.25em;
}
.snap__rank li {
  font-weight: 600;
}
.snap__rank li::marker {
  font-family: var(--display);
  color: var(--teal);
}
.snap__saved {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--teal-dark);
}
.snap__closing {
  margin-top: 16px;
  font-size: 0.9375rem;
  color: var(--slate);
}
.snap__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

/* --------------------------------------------------------------- stage -- */
/* The stage is sized from the viewport height so slide, presenter, captions
   and controls all fit on screen together without scrolling. */

.stagewrap {
  width: min(100%, max(600px, calc((100dvh - 372px) * 2.2)), 1500px);
  margin: 0 auto;
}
.stagehead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  margin-bottom: 14px;
}
.stagehead__chapter {
  font-size: 0.875rem;
  color: var(--amber);
}
.stagehead h1 {
  font-size: clamp(1.375rem, 2.4vw, 1.875rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.stagehead__body {
  max-width: 62em;
  font-size: 0.9375rem;
  color: var(--slate-light);
}

.player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.player__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(168px, 20.5%, 280px);
  gap: 14px;
}
.player__main {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--ink-deep);
  border-radius: var(--radius);
  cursor: pointer;
}
.slides {
  position: absolute;
  inset: 0;
}
.slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  user-select: none;
}
.slide.is-on {
  opacity: 1;
}

.bigplay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 0;
  background: rgba(12, 21, 41, 0.5);
  color: #fff;
}
.bigplay__disc {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--ink);
  transition: transform 0.15s ease;
}
.bigplay__disc .icon {
  width: 40px;
  height: 40px;
}
.bigplay:hover .bigplay__disc {
  transform: scale(1.06);
}
.bigplay__text {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 650;
}
.bigplay__dur {
  margin-left: 10px;
  font-family: var(--body);
  font-size: 0.9375rem;
  font-weight: 400;
  opacity: 0.8;
}
.player.has-started .bigplay {
  display: none;
}
.player.has-ended .bigplay {
  display: flex;
}

.player__side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
}
.player__list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.player__listbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--slate-light);
  font-size: 0.875rem;
  line-height: 1.25;
  text-align: left;
}
.player__listbtn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.player__listbtn.is-current {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
}
.player__listn {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 650;
}
.is-current .player__listn {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

.presenter {
  position: relative;
  flex: none;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.22);
  cursor: pointer;
}
.presenter__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 46% 50%;
}
.presenter__swap {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(12, 21, 41, 0.72);
  color: #fff;
}
.presenter__swap:hover {
  background: var(--ink-deep);
}
.presenter__swap .icon {
  width: 18px;
  height: 18px;
}

/* swapped: presenter on the big screen, slide in the corner */
.player.is-swapped .player__main .presenter__video {
  position: absolute;
  inset: 0;
  object-fit: contain;
  object-position: 50% 50%;
}
.player.is-swapped .presenter {
  aspect-ratio: 16 / 9;
  background: var(--ink-deep);
}

.player__caption {
  min-height: 3em;
  max-width: 54em;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
}
.player[data-captions='false']:not(.has-error) .player__caption {
  display: none;
}
.player.has-error .player__caption {
  color: var(--amber);
}

.player__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctl {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
}
.ctl:hover {
  background: rgba(255, 255, 255, 0.12);
}
.ctl--text {
  width: auto;
  height: 28px;
  margin-inline: 6px;
  padding: 0 7px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ctl--text[aria-pressed='true'] {
  background: #fff;
  border-color: #fff;
  color: var(--ink);
}
.player__time {
  flex: none;
  min-width: 92px;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--slate-light);
}
.timeline {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  margin-inline: 8px;
  border-radius: 6px;
  cursor: pointer;
  touch-action: none;
}
.seg {
  position: relative;
  flex-basis: 0;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  transition: height 0.12s ease;
}
.timeline:hover .seg {
  height: 9px;
}
.seg__seen,
.seg__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
}
.seg__seen {
  background: rgba(255, 255, 255, 0.32);
}
.seg__fill {
  background: var(--amber);
}

.player:fullscreen {
  align-content: center;
  padding: 2vh 2.5vw;
  background: var(--ink);
  color: #fff;
}
.player:fullscreen .player__stage {
  width: min(100%, calc((100vh - 190px) * 2.2));
  margin: 0 auto;
}

/* ---------------------------------------------------------- bottom bar -- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 2.5vw, 32px);
  min-height: var(--bar-h);
  padding: 12px clamp(16px, 4vw, 48px) calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--paper);
  border-top: 1px solid var(--line);
  transition: background-color 0.45s ease, border-color 0.45s ease;
}
.surface-stage .bar {
  background: var(--ink-deep);
  border-top-color: rgba(255, 255, 255, 0.12);
}
body.no-bar .bar {
  display: none;
}
.bar__back {
  justify-self: start;
}
.bar__mid {
  min-width: 0;
}
.progress {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.prog {
  flex: 1 1 0;
  min-width: max-content;
}
.prog__track {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}
.surface-stage .prog__track {
  background: rgba(255, 255, 255, 0.18);
}
.prog__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--teal);
  transition: width 0.4s ease;
}
.surface-stage .prog__fill {
  background: var(--amber);
}
.prog__label {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--slate);
}
.surface-stage .prog__label {
  color: var(--slate-light);
}
.prog.is-current .prog__label {
  font-weight: 650;
  color: inherit;
}
.bar__meta {
  display: flex;
  gap: 14px;
  margin-top: 3px;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--slate);
}
.surface-stage .bar__meta {
  color: var(--slate-light);
}
.bar__status[data-state='saved']::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--teal);
  vertical-align: 1px;
}
.surface-stage .bar__status[data-state='saved']::before {
  background: #4fd1c5;
}
.bar__status[data-state='offline'] {
  font-weight: 600;
  color: #9a5b00;
}
.surface-stage .bar__status[data-state='offline'] {
  color: var(--amber);
}
.bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 1000px) {
  .rank {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .welcome {
    grid-template-columns: minmax(0, 1fr);
  }
  .welcome__preview {
    order: -1;
    max-width: 560px;
  }
  .welcome__preview figcaption {
    display: none;
  }
  .levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --bar-h: 116px;
  }
  body {
    font-size: 1rem;
  }
  .masthead {
    padding-block: 14px;
  }
  .stagewrap {
    width: 100%;
  }
  .stagehead__body {
    display: none;
  }
  .player__stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .player__side {
    flex-direction: row-reverse;
    align-items: stretch;
  }
  .presenter {
    width: 132px;
  }
  .player__list {
    max-height: 99px;
  }
  .player__listbtn {
    padding-block: 5px;
  }
  .player__caption {
    min-height: 4.4em;
    font-size: 1rem;
  }
  .player__time {
    min-width: 0;
    margin-right: auto;
  }
  .player__controls {
    flex-wrap: wrap;
  }
  .timeline {
    order: -1;
    flex: 1 0 100%;
    margin-inline: 0;
  }
  .bar {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'mid mid'
      'back actions';
    gap: 10px 12px;
  }
  .bar__mid {
    grid-area: mid;
  }
  .bar__back {
    grid-area: back;
  }
  .bar__actions {
    grid-area: actions;
    justify-content: flex-end;
  }
  .prog {
    min-width: 0;
  }
  .prog__label {
    display: none;
  }

  .loop {
    grid-template-columns: minmax(0, 1fr);
  }
  .loop__figure {
    max-width: 300px;
    margin: 0 auto;
  }
  .rank {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .form__grid,
  .opts--compact {
    grid-template-columns: minmax(0, 1fr);
  }
  .snap__row {
    grid-template-columns: minmax(0, 1fr);
  }
  .scale__row {
    gap: 6px;
  }
  .scale__item {
    height: 58px;
  }
}

@media (max-width: 460px) {
  .levels {
    gap: 6px;
  }
  .level {
    padding-inline: 6px;
  }
  .level__bars {
    height: 40px;
  }
  .level__hint {
    font-size: 0.875rem;
  }
  .masthead__program {
    font-size: 0.8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
