/* =========================================================================
   Roro Programme — Cahier Programme TV Chaud
   Dark charcoal editorial paper (#141210), broadcast crimson (#E5484D),
   favorites brass (#C89B54). Zero build step, pure CSS tokens + local fonts.
   ========================================================================= */

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Manrope';
  src: url('/fonts/manrope-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Newsreader';
  src: url('/fonts/newsreader-600-italic.woff2') format('woff2');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #141210;
  --sunken: #0D0B09;
  --card: #1D1915;
  --elevated: #26211B;
  --rule: #352D25;
  --rule-strong: #4B4035;

  --text: #F3EFE6;
  --text-2: #B0A698;
  --text-3: #998F80;

  --crimson: #E5484D;
  --crimson-cta: #BA2D33;
  --crimson-cta-hover: #C83339;
  --crimson-tint: rgba(229, 72, 77, 0.14);

  --gold: #C89B54;
  --gold-tint: rgba(200, 155, 84, 0.15);
  --jade: #58B37C;

  --font-sans: 'Manrope', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: 'Newsreader', "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 140ms;
  --dur-enter: 220ms;
  --dur-exit: 170ms;
}

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

html {
  color-scheme: dark;
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;
}

body.is-modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--crimson-tint);
  color: var(--text);
}

input, textarea, select {
  caret-color: var(--crimson);
  font-family: inherit;
}

button, select {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Scrollbar subtile */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--ink);
}
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--rule-strong);
}

/* =========================================================================
   Topbar
   ========================================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--ink);
  border-bottom: 1px solid var(--rule);
}

.topbar__row {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px clamp(16px, 3vw, 28px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand__title {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.05;
}

.brand__title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  color: var(--crimson);
}

.tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.tally__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background-color var(--dur-fast) ease;
}

.tally[data-state="loading"] .tally__dot {
  background: var(--gold);
}

.tally[data-state="ready"] .tally__dot {
  background: var(--jade);
}

.tally[data-state="live"] {
  border-color: rgba(229, 72, 77, 0.45);
  color: var(--text);
}

.tally[data-state="live"] .tally__dot {
  background: var(--crimson);
}

/* Search bar */
.search {
  position: relative;
  flex: 1 1 280px;
  max-width: 440px;
  min-width: 0;
  margin-left: auto;
}

.search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.search__input {
  width: 100%;
  min-height: 38px;
  padding: 7px 36px 7px 36px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.search__input::placeholder {
  color: var(--text-3);
}

.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search__input:focus {
  outline: none;
  border-color: var(--rule-strong);
  background: var(--elevated);
}

.search__clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.search__clear svg {
  width: 14px;
  height: 14px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Pills (topbar controls & dismiss actions) */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.pill--fav[aria-pressed="true"] {
  border-color: rgba(200, 155, 84, 0.55);
  background: var(--gold-tint);
  color: var(--gold);
}

.pill--fav[aria-pressed="true"] .icon {
  fill: var(--gold);
  stroke: var(--gold);
}

.pill--quiet {
  background: transparent;
  color: var(--text-2);
}

@media (hover: hover) and (pointer: fine) {
  .pill:hover {
    background: var(--elevated);
    border-color: var(--rule-strong);
    color: var(--text);
  }
  .pill--fav[aria-pressed="true"]:hover {
    background: rgba(200, 155, 84, 0.22);
    border-color: var(--gold);
  }
}

.pill:active {
  transform: scale(0.97);
}

/* =========================================================================
   Main container & Views
   ========================================================================= */

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px clamp(16px, 3vw, 28px) 64px;
}

.view--login {
  min-height: calc(100dvh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel--login {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.panel__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.panel__lede {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Forms & Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field__opt {
  font-weight: 400;
  color: var(--text-3);
}

.field__input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.field__input::placeholder {
  color: var(--text-3);
}

.field__input:focus {
  outline: none;
  border-color: var(--crimson);
  background: var(--sunken);
}

.field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.field--check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--crimson);
  cursor: pointer;
}

/* Notices (1px hairline rule — never border-left > 1px) */
.notice {
  margin: 0 0 16px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.45;
}

.notice--error {
  border-color: rgba(229, 72, 77, 0.45);
  background: var(--crimson-tint);
  color: #F7D7D8;
}

.notice--dash {
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.btn--primary {
  width: 100%;
  background: var(--crimson-cta);
  color: #FFFDF9;
}

.btn--secondary {
  background: var(--elevated);
  border-color: var(--rule);
  color: var(--text);
}

.btn--ghost {
  background: transparent;
  border-color: var(--rule);
  color: var(--text-2);
}

.btn--ghost.is-armed {
  border-color: var(--crimson);
  background: var(--crimson-tint);
  color: #F7D7D8;
}

.btn--auto {
  width: auto;
}

.btn--sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
  .btn--primary:not(:disabled):hover {
    background: var(--crimson-cta-hover);
  }
  .btn--secondary:not(:disabled):hover {
    background: #302A23;
    border-color: var(--rule-strong);
  }
  .btn--ghost:not(:disabled):hover {
    border-color: var(--rule-strong);
    color: var(--text);
  }
}

.btn:not(:disabled):active {
  transform: scale(0.97);
}

/* =========================================================================
   Subbar: Bouquet underline tabs + Counter
   ========================================================================= */

.subbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.chips {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: -1px;
  padding-right: 18px;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}

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

.chip-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px 10px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.chip-btn[aria-pressed="true"] {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--crimson);
}

@media (hover: hover) and (pointer: fine) {
  .chip-btn:hover {
    color: var(--text);
  }
}

.chip-btn:active {
  transform: scale(0.97);
}

.subbar__count {
  margin: 0 0 10px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Channel Grid & Programme Cards
   ========================================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.grid__empty {
  grid-column: 1 / -1;
  margin: 24px 0;
  padding: 36px 20px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  color: var(--text-2);
  font-size: 15px;
}

.grid__more {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.card {
  display: flex;
}

.card__inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  transition:
    transform var(--dur-enter) var(--ease-out),
    background-color var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover .card__inner {
    transform: translateY(-2px);
    background: var(--elevated);
    border-color: var(--rule-strong);
  }
}

.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin-bottom: 10px;
}

.card__kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.card__kind--live {
  color: var(--text);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}

.dot--live {
  background: var(--crimson);
}

.card__bouquet {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.card__fav {
  margin-left: auto;
  margin-right: -8px;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    color var(--dur-fast) ease,
    background-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.card__fav svg {
  width: 17px;
  height: 17px;
}

.card__fav[aria-pressed="true"] {
  color: var(--gold);
}

.card__fav[aria-pressed="true"] svg {
  fill: var(--gold);
  stroke: var(--gold);
}

@media (hover: hover) and (pointer: fine) {
  .card__fav:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gold);
  }
}

.card__fav:active {
  transform: scale(0.92);
}

.card__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.card__desc {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__desc:empty {
  display: none;
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.card__tags li {
  font-size: 11px;
  color: var(--text-3);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  border: 1px solid var(--rule);
}

.card__actions {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn--watch {
  flex: 0 0 auto;
  width: auto;
  min-height: 38px;
  padding: 0 16px;
}

.btn--watch .icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* =========================================================================
   Tools Drawer (Sheet)
   ========================================================================= */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 8, 7, 0.72);
  animation: fadeIn var(--dur-enter) var(--ease-out) both;
}

.sheet__panel {
  position: relative;
  width: min(440px, 100vw);
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--rule);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--dur-enter) var(--ease-out) both;
}

.sheet.is-closing .sheet__backdrop {
  animation: fadeOut var(--dur-exit) var(--ease-out) both;
}

.sheet.is-closing .sheet__panel {
  animation: slideOutRight var(--dur-exit) var(--ease-out) both;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
}

.sheet__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.chip {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--elevated);
  color: var(--text-2);
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: var(--elevated);
    color: var(--text);
  }
}

.icon-btn:active {
  transform: scale(0.95);
}

.sheet__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sheet__section {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.sheet__section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sheet__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sheet__heading {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.sheet__section-head .sheet__heading {
  margin-bottom: 0;
}

.sheet__hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack--form {
  margin-top: 12px;
}

.stack--form .field {
  margin-bottom: 4px;
}

.sheet__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

/* =========================================================================
   Player Modal & Video Stage
   ========================================================================= */

.player {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 28px);
  background: rgba(10, 8, 7, 0.84);
  animation: fadeIn var(--dur-enter) var(--ease-out) both;
}

.player__panel {
  width: min(1040px, 100%);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2vw, 22px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: scaleFadeIn var(--dur-enter) var(--ease-out) both;
}

.player.is-closing {
  animation: fadeOut var(--dur-exit) var(--ease-out) both;
}

.player.is-closing .player__panel {
  animation: scaleFadeOut var(--dur-exit) var(--ease-out) both;
}

.player__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.player__heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.player__title {
  margin: 0;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.player__badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule);
  background: var(--elevated);
  color: var(--text-2);
  white-space: nowrap;
}

.player__head-actions {
  flex-shrink: 0;
}

/* Video Stage */
.player__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player__stage:fullscreen,
.player__stage:-webkit-full-screen {
  border-radius: 0;
  border: 0;
  width: 100vw;
  height: 100vh;
}

.player__stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stage__controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 32px 14px 12px;
  background: linear-gradient(to top, rgba(13, 11, 9, 0.92) 0%, rgba(13, 11, 9, 0.56) 55%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 1;
  transition: opacity var(--dur-enter) var(--ease-out);
}

.player__stage.is-idle {
  cursor: none;
}

.player__stage.is-idle .stage__controls {
  opacity: 0;
  pointer-events: none;
}

.stage__seek {
  width: 100%;
  height: 4px;
  margin: 0;
  accent-color: var(--crimson);
  cursor: pointer;
}

.stage__seek:disabled {
  opacity: 0.45;
  cursor: default;
}

.stage__row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stage__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.stage__btn svg {
  width: 19px;
  height: 19px;
}

@media (hover: hover) and (pointer: fine) {
  .stage__btn:hover {
    background: rgba(243, 239, 230, 0.12);
  }
}

.stage__btn:active {
  transform: scale(0.94);
}

.stage__live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(229, 72, 77, 0.5);
  background: rgba(20, 18, 16, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.stage__live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crimson);
}

.stage__live.is-behind {
  border-color: var(--rule-strong);
  color: var(--text-2);
}

.stage__live.is-behind .stage__live-dot {
  background: var(--text-3);
}

.stage__time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-2);
  padding: 0 4px;
  white-space: nowrap;
}

.stage__spacer {
  flex: 1 1 auto;
}

.stage__vol {
  width: 76px;
  height: 4px;
  accent-color: var(--text);
  cursor: pointer;
}

.stage__quality {
  min-height: 32px;
  padding: 0 8px;
  background: rgba(29, 25, 21, 0.88);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.stage__quality:disabled {
  opacity: 0.65;
  cursor: default;
}

/* Telemetry Collapsible */
.telemetry {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--ink);
}

.telemetry__toggle {
  list-style: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.telemetry__toggle::-webkit-details-marker {
  display: none;
}

.telemetry__toggle::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-3);
}

.telemetry[open] .telemetry__toggle::after {
  content: '−';
}

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 16px;
  margin: 0;
  padding: 16px;
  border-top: 1px solid var(--rule);
}

.readout--compact {
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--ink);
  padding: 14px 16px;
}

.readout dt {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 2px;
}

.readout dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* =========================================================================
   Responsive (Mobile first parity, >= 44px touch ergonomics)
   ========================================================================= */

@media (max-width: 760px) {
  .topbar {
    position: static;
  }

  .topbar__row {
    flex-wrap: wrap;
    gap: 10px 12px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .topbar__actions {
    order: 2;
  }

  .search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
    margin-left: 0;
  }

  .search__clear {
    width: 44px;
    height: 44px;
    right: 0;
  }

  .search__input {
    padding-right: 44px;
  }

  .subbar__count {
    display: none;
  }

  .chips {
    flex: 1 1 100%;
  }

  .pill {
    min-height: 44px;
    padding: 0 12px;
  }

  .chip-btn {
    min-height: 44px;
  }

  .card__fav {
    width: 44px;
    height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .telemetry__toggle {
    min-height: 44px;
  }

  .player__stage:not(:fullscreen):not(:-webkit-full-screen) {
    aspect-ratio: auto;
    flex-direction: column;
    align-items: stretch;
  }

  .player__stage:not(:fullscreen):not(:-webkit-full-screen) video {
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .player__stage:not(:fullscreen):not(:-webkit-full-screen) .stage__controls {
    position: static;
    background: var(--sunken);
    border-top: 1px solid var(--rule);
    padding: 10px 10px 12px;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .stage__row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 4px;
  }

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

  .stage__vol {
    display: none;
  }

  .stage__live,
  .stage__quality {
    min-height: 44px;
  }

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

/* =========================================================================
   Keyframes & Reduced Motion
   ========================================================================= */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes scaleFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes scaleFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.97) translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card__inner,
  .pill,
  .btn,
  .chip-btn,
  .stage__btn,
  .stage__controls,
  .card__fav,
  .icon-btn {
    transition-duration: 0.01ms !important;
  }

  .sheet__backdrop,
  .sheet__panel,
  .sheet.is-closing .sheet__backdrop,
  .sheet.is-closing .sheet__panel,
  .player,
  .player__panel,
  .player.is-closing,
  .player.is-closing .player__panel {
    animation-duration: 0.01ms !important;
  }
}
