/* ==========================================================================
   RATELi TFM Academy - Components
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  --btn-bg: var(--surface-raised);
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.72rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  transition:
    transform var(--duration-fast) var(--ease-out),
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out),
    color var(--duration-base) var(--ease-out);
}

.btn:hover { transform: translateY(-1px); color: var(--btn-fg); }
.btn:active { transform: translateY(0); }
.btn[disabled],
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--brand-accent-ink);
  --btn-border: transparent;
  box-shadow: var(--shadow-accent);
}

.btn--primary:hover { --btn-bg: var(--accent-hover); box-shadow: 0 18px 44px -16px rgba(232, 93, 4, 0.7); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-border: var(--line-strong);
}

.btn--ghost:hover { --btn-bg: var(--surface-hover); --btn-border: var(--accent); }

.btn--quiet {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--text-muted);
  padding-inline: 0.75rem;
}

.btn--quiet:hover { --btn-fg: var(--text-strong); --btn-bg: var(--surface-hover); }

.btn--soft {
  --btn-bg: var(--accent-soft);
  --btn-fg: var(--accent-text);
  --btn-border: transparent;
}

.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: transparent; }
.btn--bull { --btn-bg: var(--bull); --btn-fg: #041711; --btn-border: transparent; }
.btn--bear { --btn-bg: var(--bear); --btn-fg: #fff; --btn-border: transparent; }

.btn--lg { padding: 0.95rem 1.7rem; min-height: 52px; font-size: var(--text-base); }
.btn--sm { padding: 0.45rem 0.85rem; min-height: 34px; font-size: var(--text-xs); }
.btn--block { width: 100%; }
.btn--icon { padding: 0; width: 40px; min-height: 40px; }

.btn__icon { width: 17px; height: 17px; flex: none; }

/* --------------------------------------------------------------------------
   Cards and panels
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition:
    border-color var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out),
    box-shadow var(--duration-base) var(--ease-out);
}

.card--raised { background: var(--surface-raised); box-shadow: var(--shadow-sm); }
.card--sunken { background: var(--surface-sunken); }
.card--flush { padding: 0; overflow: hidden; }
.card--tight { padding: var(--space-4); }

.card--interactive { cursor: pointer; }
.card--interactive:hover {
  transform: translateY(-3px);
  border-color: var(--line-accent);
  box-shadow: var(--shadow-md);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-strong);
  letter-spacing: -0.012em;
}

.card__body { color: var(--text-muted); font-size: var(--text-sm); line-height: var(--leading-relaxed); }
.card__footer { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--line); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
}

.panel__title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel__body { padding: var(--space-5); }
.panel__body--flush { padding: 0; }

/* --------------------------------------------------------------------------
   Badges, pills and chips
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.62rem;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.badge--bull { background: var(--bull-soft); border-color: transparent; color: var(--bull); }
.badge--bear { background: var(--bear-soft); border-color: transparent; color: var(--bear); }
.badge--info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.badge--warn { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.badge--solid { background: var(--accent); border-color: transparent; color: var(--brand-accent-ink); }
.badge--quiet { background: transparent; color: var(--text-dim); }

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  transition: all var(--duration-base) var(--ease-out);
}

.chip:hover { border-color: var(--line-accent); color: var(--text-strong); }
.chip.is-active {
  background: var(--accent-soft);
  border-color: var(--line-accent);
  color: var(--accent-text);
}

/* --------------------------------------------------------------------------
   Statistics
   -------------------------------------------------------------------------- */

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-width: 0;
}

.stat__label {
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat__value {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.85rem);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.stat__meta { font-size: var(--text-xs); color: var(--text-muted); }
.stat--accent { border-color: var(--line-accent); background: linear-gradient(160deg, var(--accent-ghost), transparent 70%); }

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */

.progress {
  --progress: 0%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress__bar {
  height: 100%;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--brand-accent-bright));
  transition: width var(--duration-slow) var(--ease-out);
}

.progress--thin { height: 5px; }
.progress--bull .progress__bar { background: linear-gradient(90deg, var(--bull), #3ee8a8); }

.progress-ring { display: grid; place-items: center; position: relative; }
.progress-ring__value {
  position: absolute;
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.progress-ring circle { fill: none; stroke-linecap: round; }
.progress-ring__track { stroke: var(--surface-sunken); }
.progress-ring__bar {
  stroke: var(--accent);
  transition: stroke-dashoffset var(--duration-slow) var(--ease-out);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.field__hint { font-size: var(--text-xs); color: var(--text-dim); }
.field__error { font-size: var(--text-xs); color: var(--danger); font-weight: var(--weight-medium); }

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.72rem 0.9rem;
  min-height: 44px;
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--text-sm);
  transition: border-color var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out), background-color var(--duration-base) var(--ease-out);
}

.input::placeholder, .textarea::placeholder { color: var(--text-dim); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }

.textarea { min-height: 120px; resize: vertical; line-height: var(--leading-normal); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2398a3b5' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.2rem;
}

.input--mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.input--sm, .select--sm { height: 34px; padding-inline: var(--space-3); font-size: var(--text-xs); }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group__addon {
  display: grid;
  place-items: center;
  padding-inline: 0.9rem;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-hover);
  color: var(--text-dim);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

.checkbox, .radio {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.checkbox input, .radio input {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.option-card:hover { border-color: var(--line-accent); background: var(--surface-hover); }
.option-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-ghost);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.option-card input { flex: none; margin-top: 2px; accent-color: var(--accent); width: 18px; height: 18px; }
.option-card__text { font-size: var(--text-sm); color: var(--text); line-height: 1.5; }

.switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 42px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}
.switch__track::after {
  content: "";
  position: absolute;
  inset: 2px auto 2px 2px;
  width: 18px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform var(--duration-base) var(--ease-spring), background var(--duration-base) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--accent); }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  /* The text here is a bare run of nodes, so it becomes an anonymous flex
     item that no selector can reach and that refuses to shrink below its
     min-content width. break-word does not help, because it does not change
     min-content; anywhere does, which is the whole difference between an
     alert that fits a phone and one that pushes the page sideways. */
  overflow-wrap: anywhere;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

.alert__icon { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.alert strong { color: var(--text-strong); }

.alert--success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.alert--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.alert--warning { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.alert--info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.alert--success strong, .alert--danger strong, .alert--warning strong, .alert--info strong { color: inherit; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 560px;
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-sunken);
}

.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  vertical-align: middle;
}

.table tbody tr { transition: background var(--duration-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.strong, .table td .strong { color: var(--text-strong); font-weight: var(--weight-medium); }
.table .numeric { text-align: right; }
.table th.numeric { text-align: right; }

/* --------------------------------------------------------------------------
   Avatars
   -------------------------------------------------------------------------- */

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--brand-accent-deep));
  color: var(--brand-accent-ink);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  overflow: hidden;
  user-select: none;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 30px; height: 30px; font-size: var(--text-2xs); }
.avatar--lg { width: 58px; height: 58px; font-size: var(--text-md); }
.avatar--xl { width: 84px; height: 84px; font-size: var(--text-xl); }

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--text-muted);
}

.empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--text-dim);
}

.empty__title { font-family: var(--font-display); font-size: var(--text-md); font-weight: var(--weight-bold); color: var(--text-strong); }
.empty p { max-width: 42ch; font-size: var(--text-sm); }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: var(--space-1);
  padding: 4px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-xs);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--duration-base) var(--ease-out);
}

.tab:hover { color: var(--text-strong); background: var(--surface-hover); }
.tab.is-active { background: var(--surface-raised); color: var(--text-strong); box-shadow: var(--shadow-xs); }

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding-inline: 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent-text); }
.pagination .is-current { background: var(--accent); border-color: transparent; color: var(--brand-accent-ink); }

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(380px, calc(100vw - 2.5rem));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text);
  animation: toast-in var(--duration-base) var(--ease-spring);
}

.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(3, 6, 11, 0.72);
  backdrop-filter: blur(8px);
  animation: fade-in var(--duration-base) var(--ease-out);
}

.modal[hidden] { display: none; }

.modal__panel {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--duration-base) var(--ease-spring);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Skeletons and spinners
   -------------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--surface-hover) 50%, var(--surface-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Compliance strip - shown wherever performance figures appear
   -------------------------------------------------------------------------- */

.disclosure {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: var(--surface-sunken);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-dim);
}

.disclosure strong { color: var(--text-muted); font-weight: var(--weight-semibold); }
.disclosure__icon { flex: none; width: 16px; height: 16px; margin-top: 1px; color: var(--warning); }

/* ==========================================================================
   Lesson video player
   Built on top of a plain <video>. Every colour and space below is a token,
   so the player follows the theme rather than defining one of its own.
   ========================================================================== */

.vp {
    position: relative;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    line-height: 0;
}

.vp video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    background: #000;
}

/* The bar is only built once the script takes over. Until then the native
   controls are still on the element and the lesson is perfectly usable. */
.vp__bar {
    display: none;
}

.vp--enhanced .vp__bar {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--space-2) var(--space-3) var(--space-3);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0));
    line-height: 1.4;
    opacity: 1;
    transition: opacity 160ms ease;
}

/* Hide the bar while playing, until the pointer or keyboard asks for it. */
.vp--enhanced.is-playing:not(:hover):not(:focus-within) .vp__bar {
    opacity: 0;
}

.vp__scrub {
    position: relative;
    height: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.vp__scrub::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
}

.vp__buffered,
.vp__played {
    position: absolute;
    left: 0;
    height: 4px;
    border-radius: 2px;
    pointer-events: none;
}

.vp__buffered {
    background: rgba(255, 255, 255, 0.35);
    width: 0;
}

.vp__played {
    background: var(--accent);
    width: 0;
}

.vp__handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    transform: translateX(-50%);
    left: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms ease;
}

.vp__scrub:hover .vp__handle,
.vp__scrub:focus-visible .vp__handle {
    opacity: 1;
}

.vp__markers {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    pointer-events: none;
}

.vp__marker {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 8px;
    background: rgba(255, 255, 255, 0.85);
    transform: translateX(-1px);
}

.vp__row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-1);
    flex-wrap: nowrap;
}

.vp__spacer {
    flex: 1 1 auto;
}

.vp__btn {
    appearance: none;
    background: transparent;
    border: 0;
    color: #fff;
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-width: 34px;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.vp__btn:hover,
.vp__btn:focus-visible {
    background: rgba(255, 255, 255, 0.16);
}

.vp__btn.is-on {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.16);
}

.vp__sub {
    font-size: 0.6875rem;
    opacity: 0.8;
}

.vp__icon-play {
    display: block;
    width: 0;
    height: 0;
    border-left: 11px solid currentColor;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

.vp--enhanced.is-playing .vp__icon-play {
    width: 10px;
    height: 13px;
    border: 0;
    border-left: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.vp__time {
    color: #fff;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.vp__chapter-name {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
    max-width: 30ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vp__volume {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.vp__vol {
    width: 72px;
    accent-color: var(--accent);
}

/* The big centre button, for the first play and for tapping on a phone. */
.vp__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vp__overlay-icon {
    width: 0;
    height: 0;
    border-left: 24px solid #fff;
    border-top: 16px solid transparent;
    border-bottom: 16px solid transparent;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
    transition: transform 140ms ease;
}

.vp__overlay:hover .vp__overlay-icon {
    transform: scale(1.12);
}

.vp--enhanced.is-playing .vp__overlay-icon {
    opacity: 0;
}

.vp__resume {
    position: absolute;
    left: var(--space-3);
    bottom: 72px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: rgba(0, 0, 0, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.8125rem;
    line-height: 1.4;
    max-width: calc(100% - var(--space-3) * 2);
    flex-wrap: wrap;
}

/* Chapter and transcript lists sit outside the player frame. */
.vp-chapter {
    display: flex;
    width: 100%;
    gap: var(--space-2);
    align-items: baseline;
    padding: var(--space-2);
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.vp-chapter:hover,
.vp-chapter:focus-visible {
    background: var(--surface-hover);
}

.vp-chapter.is-current {
    background: var(--surface-hover);
    box-shadow: inset 2px 0 0 var(--accent);
}

.vp-chapter__at {
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-size: 0.8125rem;
    min-width: 5ch;
}

.vp-transcript {
    max-height: 22rem;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.9375rem;
    line-height: 1.7;
}

@media (max-width: 640px) {
    .vp video {
        max-height: 56vh;
    }

    /* On a phone there is not room for everything. The controls that
       survive are the ones a thumb needs. */
    .vp__volume,
    .vp__chapter-name,
    .vp__back {
        display: none;
    }

    .vp__row {
        gap: var(--space-1);
    }

    .vp__resume {
        bottom: 64px;
        left: var(--space-2);
        font-size: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .vp__bar,
    .vp__handle,
    .vp__overlay-icon {
        transition: none;
    }
}

/* ==========================================================================
   Sortable lists
   The grip is the only part that advertises dragging. Everything inside a
   sortable panel stays selectable and clickable, because the panels hold
   forms and a panel you cannot click into would be worse than one you
   cannot drag.
   ========================================================================== */

.panel--sortable {
    position: relative;
}

.sortable__grip {
    display: none;
    color: var(--text-dim);
    cursor: grab;
    margin-right: var(--space-1);
    vertical-align: middle;
}

/* Only offered once the script that implements it has run. */
.js [data-sortable-ready] .sortable__grip {
    display: inline-flex;
}

.sortable__grip:active {
    cursor: grabbing;
}

.panel--sortable.is-dragging {
    opacity: 0.55;
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .panel--sortable {
        transition: none;
    }
}

/* ==========================================================================
   Lesson player bar
   The player has no sidebar on purpose. This is the minimum that stops it
   being a room with no door: where you came from, where you are, how far
   through, and a way back to the dashboard.
   ========================================================================== */

.player-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--surface-raised);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(140%) blur(8px);
}

.player-bar__back,
.player-bar__home {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-dim);
    font-size: 0.875rem;
    text-decoration: none;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.player-bar__back:hover,
.player-bar__home:hover,
.player-bar__back:focus-visible,
.player-bar__home:focus-visible {
    color: var(--text);
    background: var(--surface-hover);
}

.player-bar__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    flex: 1 1 auto;
    justify-content: center;
}

.player-bar__course {
    font-size: 0.875rem;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 32ch;
}

.player-bar__progress {
    display: block;
    width: 8rem;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-3, rgba(127, 127, 127, 0.25));
    overflow: hidden;
    flex: 0 0 auto;
}

.player-bar__progress-fill {
    display: block;
    height: 100%;
    background: var(--accent);
}

.player-bar__percent {
    font-size: 0.8125rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    /* On a phone the way out matters more than knowing the course name. */
    .player-bar__course,
    .player-bar__home-label {
        display: none;
    }

    .player-bar__progress {
        width: 5rem;
    }
}

/* ==========================================================================
   Payment methods
   A choice somebody is about to spend money on. Each row says what it is,
   what it does and what happens next, because being surprised by a handset
   prompt when you expected a card form is a reason to abandon a purchase.
   ========================================================================== */

.pay-methods {
    display: grid;
    gap: var(--space-2);
}

.pay-method {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

.pay-method:hover {
    border-color: var(--accent);
}

.pay-method input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pay-method:has(input:checked) {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.pay-method:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pay-method__icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    color: var(--accent);
}

.pay-method:has(input:checked) .pay-method__icon {
    background: var(--accent);
    color: #fff;
}

.pay-method__body {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.pay-method__name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.pay-method__desc,
.pay-method__next {
    font-size: 0.8125rem;
    color: var(--text-dim);
}

.pay-method__next {
    opacity: 0.85;
}

.pay-method__tick {
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: transparent;
    align-self: center;
}

.pay-method:has(input:checked) .pay-method__tick {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.badge--warn {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
}

/* :has() is widely supported now, but where it is not the radio itself
   still shows, so the control never becomes unusable. */
@supports not selector(:has(*)) {
    .pay-method input {
        position: static;
        opacity: 1;
        pointer-events: auto;
    }

    .pay-method__tick {
        display: none;
    }
}

/* ==========================================================================
   Dialog, progress bar and icon buttons
   ========================================================================== */

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 150ms ease;
}

.dialog-backdrop.is-open {
    opacity: 1;
}

.dialog {
    width: min(30rem, 100%);
    background: var(--surface-raised);
    /* A heavier border than a panel, plus a ring in the accent, so the
       dialog reads as something that has taken over the window rather than
       as a card that happens to be on top of it. */
    border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
    border-radius: var(--radius-lg, 14px);
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
        0 0 28px color-mix(in srgb, var(--accent) 22%, transparent),
        0 28px 70px rgba(0, 0, 0, 0.45);
    padding: var(--space-5);
    transform: translateY(10px) scale(0.97);
    transition: transform 170ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* A destructive dialog glows in the danger colour instead, so the warning
   is carried by the frame and not only by the words. */
.dialog--danger {
    border-color: color-mix(in srgb, var(--danger, #dc2626) 55%, var(--line));
    box-shadow:
        0 0 0 1px color-mix(in srgb, var(--danger, #dc2626) 22%, transparent),
        0 0 30px color-mix(in srgb, var(--danger, #dc2626) 26%, transparent),
        0 28px 70px rgba(0, 0, 0, 0.5);
}

.dialog-backdrop.is-open .dialog {
    transform: none;
}

.dialog__title {
    font-size: 1.125rem;
    margin: 0 0 var(--space-2);
}

.dialog--danger .dialog__title {
    color: var(--danger, #dc2626);
}

.dialog__body {
    margin: 0 0 var(--space-4);
    color: var(--text-dim);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* The page behind a dialog does not scroll under it. */
body.has-dialog {
    overflow: hidden;
}

/* A destructive action should not look like an ordinary one. */
.btn--danger {
    background: var(--danger, #dc2626);
    color: #fff;
    border-color: transparent;
}

.btn--danger:hover,
.btn--danger:focus-visible {
    background: var(--danger-strong, #b91c1c);
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* 3px, not 2. A two pixel line at the very top of the window is easy
       to miss entirely on a laptop, and a preloader nobody notices is the
       same as no preloader. */
    height: 3px;
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms ease;
}

.progress-bar.is-active {
    opacity: 1;
}

.progress-bar__fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
    box-shadow: 0 0 10px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent);
    border-radius: 0 2px 2px 0;
}

/* Creeps towards the end without reaching it: the bar cannot know how long
   the server will take, and a bar that sits at 100% while nothing happens
   is worse than one still moving. */
.progress-bar.is-active .progress-bar__fill {
    animation: rateli-progress 8s cubic-bezier(0.1, 0.8, 0.2, 1) forwards;
}

.progress-bar.is-done .progress-bar__fill {
    width: 100%;
    animation: none;
    transition: width 140ms ease;
}

@keyframes rateli-progress {
    0% { width: 0; }
    40% { width: 62%; }
    80% { width: 86%; }
    100% { width: 94%; }
}

/* An action button that carries its icon beside its label. */
.btn__icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}

.btn--icon-only {
    padding-inline: var(--space-2);
}

[data-sound-toggle].is-on {
    color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    .dialog-backdrop,
    .dialog,
    .progress-bar {
        transition: none;
    }

    .progress-bar.is-active .progress-bar__fill {
        animation: none;
        width: 70%;
    }
}

/* ==========================================================================
   Resume card
   The first thing a student sees. It has one job: make the next action
   obvious without them reading anything else on the page.
   ========================================================================== */

.resume-card {
    display: flex;
    gap: var(--space-6);
    align-items: center;
    flex-wrap: wrap;
}

.resume-card__main {
    flex: 1 1 22rem;
    min-width: 0;
}

.resume-card__course {
    font-size: var(--text-xl, 1.25rem);
    margin-block: var(--space-2) var(--space-4);
}

.resume-card__where {
    display: grid;
    gap: 0.15rem;
    margin-top: var(--space-4);
    margin-bottom: 0;
}

.resume-card__module {
    font-size: 0.8125rem;
    color: var(--text-dim);
}

.resume-card__lesson {
    font-weight: 600;
    font-size: 1.0625rem;
}

.resume-card__at {
    font-size: 0.8125rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.resume-card__action {
    display: grid;
    gap: var(--space-2);
    flex: 0 0 auto;
}

@media (max-width: 720px) {
    .resume-card__action {
        width: 100%;
    }

    .resume-card__action .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Module progress inside the course curriculum. */
.curriculum-module__bar {
    display: block;
    height: 3px;
    border-radius: 2px;
    background: var(--surface-3, rgba(127, 127, 127, 0.25));
    margin-top: 0.35rem;
    overflow: hidden;
}

.curriculum-module__bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
}

/* A control that has been pressed and is waiting on the server. */
[data-busy] {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

[data-busy]::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
    animation: rateli-busy 1.1s ease-in-out infinite;
}

@keyframes rateli-busy {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    [data-busy]::after {
        animation: none;
        opacity: 0.6;
    }
}

/* A module's learning objective, inside the curriculum. */
.curriculum-module__objective {
    display: block;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin-top: 0.3rem;
    padding-left: 0.55rem;
    border-left: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* The course introduction is not a lesson and should not look like one. */
.curriculum-lesson--intro .lesson-state {
    border-style: dashed;
}

/* Course setup checklist. */
.setup-steps {
    display: grid;
    gap: var(--space-2);
}

.setup-step {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-3);
    align-items: start;
}

.setup-step__mark {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--line);
    font-size: 0.75rem;
    color: var(--text-dim);
    flex: 0 0 auto;
}

.setup-step.is-done .setup-step__mark {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.setup-step__body {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.setup-step__label {
    font-weight: 600;
    font-size: 0.9375rem;
}

.setup-step.is-done .setup-step__label {
    color: var(--text-dim);
    font-weight: 500;
}

.setup-step__hint {
    font-size: 0.8125rem;
    color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Touch targets

   Apple asks for 44px, Android for 48dp, and the small variants here sit at
   34 to 40. On a mouse that density is deliberate and reads well, so none of
   it changes: this applies only where the pointer is a finger. The audience
   for this platform is overwhelmingly on a phone, where a 34px control next
   to another 34px control is a coin toss.
   -------------------------------------------------------------------------- */

/* A badge never wraps, which is right until the label is long and the badge
   is inside a flex row on a 360px screen: the row then cannot shrink and the
   page scrolls sideways. Below the point where that happens, let it wrap. */
@media (max-width: 560px) {
  .badge {
    white-space: normal;
  }
}

@media (pointer: coarse) {
  .btn--sm {
    min-height: 44px;
    padding-block: 0.6rem;
  }

  .btn--icon {
    width: 44px;
    min-height: 44px;
  }

  .chip {
    min-height: 44px;
  }

  /* A tab is an anchor, so it is inline and min-height does nothing to it
     until it is given a box. */
  .tab {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 24px;
    height: 24px;
  }

  /* Video controls are the one row where 44px each would not fit: eight
     buttons plus a clock is wider than a 360px phone, and making the bar
     overflow to satisfy a guideline trades one defect for a worse one.
     Full height, slightly narrower, which is the dimension a thumb on a
     control bar actually misses. */
  .vp__btn {
    min-height: 44px;
    min-width: 40px;
  }

  /* "My courses" at the head of the rail: full width and 19px tall. */
  .player__aside-head a.row {
    min-height: 44px;
  }

  .player-bar__back,
  .player-bar__home {
    min-height: 44px;
    /* On a phone the home control loses its label and is left as a 17px
       icon, which is tall enough and far too narrow. */
    min-width: 44px;
    justify-content: center;
  }

  /* The wordmark is a link home and the avatar is the link to the profile.
     Both were wide enough and only about 30px tall, which is the shape a
     thumb misses. The avatar itself is left the size it is; only the box
     around it grows. */
  .brand {
    min-height: 44px;
  }

  a.row:has(.avatar) {
    min-height: 44px;
  }

  /* Footer links are 16px of text in a column. Giving each one a real box
     rather than more gap keeps the footer roughly the height it was. */
  .footer-links {
    gap: 0;
  }

  .footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}


/* --------------------------------------------------------------------------
   Lesson tabs

   The lesson, its notes, its downloads, its transcript and the notices used
   to be five panels stacked down one column, so the resources sat below
   however long the lesson happened to be. Tabs put them all one click from
   the video instead of one scroll past it.
   -------------------------------------------------------------------------- */

.lesson-tabs__bar {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-6);
  /* More tabs than a phone is wide: let the bar scroll rather than wrap into
     a block that pushes the lesson down. */
  overflow-x: auto;
  scrollbar-width: none;
}

.lesson-tabs__bar::-webkit-scrollbar { display: none; }

.lesson-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: none;
  padding: var(--space-3) var(--space-4);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.lesson-tab:hover { color: var(--text-strong); }

.lesson-tab[aria-selected="true"] {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
}

.lesson-tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--line);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
}

.lesson-tab[aria-selected="true"] .lesson-tab__count {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}

/* Hidden by the script, never by the markup: with no JavaScript every panel
   stays on the page in order, which is what it was before tabs existed. */
.lesson-tabs__panel[hidden] { display: none; }

.lesson-tabs__panel + .lesson-tabs__panel { margin-top: var(--space-6); }

@media (pointer: coarse) {
  .lesson-tab { min-height: 44px; }
}


/* --------------------------------------------------------------------------
   Autoplay and what comes next
   -------------------------------------------------------------------------- */

.autoplay {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}

.autoplay__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.autoplay__track {
  flex: none;
  width: 42px;
  height: 24px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
  border: 1px solid var(--line-strong);
  transition:
    background-color var(--duration-base) var(--ease-out),
    border-color var(--duration-base) var(--ease-out);
}

.autoplay__dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-dim);
  transition:
    transform var(--duration-base) var(--ease-out),
    background-color var(--duration-base) var(--ease-out);
}

.autoplay__input:checked + .autoplay__track {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.autoplay__input:checked + .autoplay__track .autoplay__dot {
  background: var(--accent);
  transform: translateX(18px);
}

/* The switch is the only thing here that takes focus, so the ring belongs on
   the part the eye reads as the control. */
.autoplay__input:focus-visible + .autoplay__track {
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.vp-next {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  text-align: center;
  background: color-mix(in srgb, #05070b 82%, transparent);
  backdrop-filter: blur(6px);
}

.vp-next__label {
  font-size: var(--text-2xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.vp-next__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text-strong);
  max-width: 34ch;
}

.vp-next__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-2);
}


/* --------------------------------------------------------------------------
   Questions and answers
   -------------------------------------------------------------------------- */

.qa-ask {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-sunken);
}

.qa-item + .qa-item {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

/* A post a moderator has taken down, visible only to them. It has to read
   as removed at a glance or they will not trust what they are looking at. */
.qa-item.is-hidden-post {
  opacity: 0.55;
  border-left: 2px solid var(--warning);
  padding-left: var(--space-4);
}

.qa-item__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.qa-item__title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-md);
  color: var(--text-strong);
}

.qa-item__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 0.15rem;
  font-size: var(--text-2xs);
  color: var(--text-dim);
}

.qa-item__body {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  /* A pasted log line or a URL in a question should not widen the column. */
  overflow-wrap: anywhere;
}

.qa-item__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.qa-vote {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
}

.qa-vote:hover { border-color: var(--line-accent); color: var(--text-strong); }

.qa-vote.is-on {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.qa-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.qa-link:hover { color: var(--accent-text); }

.qa-reply {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  margin-left: var(--space-6);
  padding-left: var(--space-4);
  border-left: 1px solid var(--line);
}

/* The answer that settled it, marked on the frame so it is findable in a
   long thread without reading every reply. */
.qa-reply.is-accepted {
  border-left-color: var(--bull);
  background: color-mix(in srgb, var(--bull) 6%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
}

.qa-reply-form {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
  margin-left: var(--space-6);
  justify-items: start;
}

.qa-reply-form textarea { width: 100%; }

@media (max-width: 560px) {
  .qa-reply,
  .qa-reply-form {
    margin-left: 0;
  }
}


/* One row of the Q&A queue: what was asked on the left, what to do on the
   right, which is the shape every other moderation list here uses. */
.admin-qa {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
}

.admin-qa + .admin-qa { border-top: 1px solid var(--line); }

.admin-qa:hover { background: var(--surface-hover); }

/* --------------------------------------------------------------------------
   Embedded payment checkout and payment timeline
   -------------------------------------------------------------------------- */

.text-bull { color: var(--bull); }
.text-bear { color: var(--bear); }

.pay-modal { width: min(480px, 100%); padding: var(--space-5); display: grid; gap: var(--space-4); }
.pay-modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.pay-modal__title { font-size: var(--text-lg); margin: 0; }
.pay-modal__frame { width: 100%; height: 440px; border: 0; border-radius: var(--radius-lg); background: #fff; }
.pay-modal__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.pay-modal__status { margin: 0; flex: 1 1 220px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline__item { position: relative; padding: 0 0 var(--space-5) var(--space-8); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-raised); border: 2px solid var(--line-strong); }
.timeline__item--successful .timeline__dot { border-color: var(--bull); background: var(--bull); }
.timeline__item--failed .timeline__dot, .timeline__item--amount_mismatch .timeline__dot { border-color: var(--bear); background: var(--bear); }
.timeline__item--expired .timeline__dot, .timeline__item--cancelled .timeline__dot { border-color: var(--text-dim, #8a94a6); }
.timeline__item--processing .timeline__dot, .timeline__item--pending .timeline__dot { border-color: var(--warning); }
.timeline__head { display: flex; gap: var(--space-3); align-items: baseline; flex-wrap: wrap; }
.timeline__payload { margin-top: var(--space-2); }
.timeline__payload pre { max-height: 220px; overflow: auto; font-size: var(--text-2xs, 11px); white-space: pre-wrap; word-break: break-all; }

.money-rows { display: grid; gap: var(--space-2); }
.money-rows > div { display: flex; justify-content: space-between; gap: var(--space-4); }
.money-rows > .money-rows__total { border-top: 1px solid var(--line); padding-top: var(--space-2); font-weight: 700; }

tr.is-clickable { cursor: pointer; }
tr.is-clickable:hover, tr.is-clickable:focus-visible { background: var(--surface-hover); outline: none; }
