:root {
  color-scheme: dark;
  --tv-font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --tv-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --tv-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --tv-radius-stage: 16px;
  --tv-radius-panel: 12px;
  --tv-radius-control: 10px;
  --tv-radius-segment: 8px;
  --tv-incident: oklch(0.72 0.19 335);
  --tv-brake: oklch(0.83 0.14 75);
  --tv-throttle: oklch(0.8 0.15 152);
  --tv-lateral: oklch(0.74 0.15 290);
  --tv-autopilot: oklch(0.76 0.12 240);
  --tv-nearby: oklch(0.85 0.11 200);
  --tv-blinker: oklch(0.92 0.18 106);
  --tv-rainbow-1: oklch(0.72 0.2 25);
  --tv-rainbow-2: oklch(0.8 0.17 65);
  --tv-rainbow-3: oklch(0.9 0.16 100);
  --tv-rainbow-4: oklch(0.82 0.18 150);
  --tv-rainbow-5: oklch(0.75 0.15 240);
  --tv-rainbow-6: oklch(0.72 0.19 305);
  --tv-rainbow: linear-gradient(90deg, var(--tv-rainbow-1), var(--tv-rainbow-2), var(--tv-rainbow-3), var(--tv-rainbow-4), var(--tv-rainbow-5), var(--tv-rainbow-6));
  --tv-quiet: rgba(243, 243, 243, 0.58);
  --tv-layer-overlay: 10;
}

body {
  min-height: 100dvh;
  margin: 0;
  padding: clamp(16px, 3vw, 32px) clamp(16px, 3vw, 32px) 20px;
  background:
    radial-gradient(80% 50% at 50% -14%, rgba(255, 255, 255, 0.05), transparent 70%),
    var(--videoplayer-bg);
  color: var(--videoplayer-text);
  font-family: var(--tv-font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.tv [hidden] {
  display: none !important;
}

.tv-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.tv-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tv-icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tv-icon--small {
  width: 14px;
  height: 14px;
}

.tv-icon--large {
  width: 34px;
  height: 34px;
  stroke-width: 1.4;
}

.tv {
  display: grid;
  grid-template-columns: clamp(260px, 24vw, 340px) minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "library main"
    "footer footer";
  gap: 20px 24px;
  max-width: 1680px;
  margin: 0 auto;
}

.tv[data-mode="empty"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "main"
    "footer";
  max-width: 1040px;
}

.tv[data-mode="empty"] .tv-library,
.tv[data-mode="single"] .tv-library {
  display: none;
}

.tv[data-mode="single"] {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "main"
    "footer";
  max-width: 1200px;
}

.tv a {
  color: var(--videoplayer-text-muted);
  transition: color 160ms var(--tv-ease);
}

.tv a:hover {
  color: var(--videoplayer-text);
}

.tv a::before {
  background-color: var(--videoplayer-accent);
}

.tv :where(button, a, input, canvas, label[for], summary):focus-visible {
  outline: 2px solid var(--videoplayer-accent);
  outline-offset: 2px;
}

.tv-header {
  grid-area: header;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.tv-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tv-subtitle {
  margin: 4px 0 0;
  color: var(--videoplayer-text-muted);
  font-size: 14px;
  text-wrap: pretty;
}

.tv-home {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.tv-footer {
  grid-area: footer;
  color: var(--videoplayer-text-faint);
  font-size: 13px;
  text-align: center;
}

.tv-button,
.tv-text-button,
.tv-icon-button,
.tv-chip,
.tv-segment {
  font: inherit;
  cursor: pointer;
  transition: background-color 160ms var(--tv-ease), color 160ms var(--tv-ease), transform 160ms var(--tv-ease), box-shadow 160ms var(--tv-ease);
}

.tv-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--tv-radius-control);
  background-color: var(--videoplayer-control);
  box-shadow: inset 0 1px 0 var(--videoplayer-highlight), 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.tv-button:hover {
  background-color: var(--videoplayer-control-hover);
}

.tv-button--accent {
  background-color: var(--videoplayer-accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.tv-button--accent:hover {
  background-color: var(--videoplayer-accent-strong-hover);
}

.tv-button:active,
.tv-text-button:active,
.tv-icon-button:active,
.tv-chip:active,
.tv-segment:active {
  transform: scale(0.97);
}

.tv-button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.tv-text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--tv-radius-control);
  background-color: transparent;
  color: var(--videoplayer-text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.tv-text-button:hover {
  background-color: var(--videoplayer-control);
  color: var(--videoplayer-text);
}

.tv-text-button .tv-icon {
  width: 18px;
  height: 18px;
}

.tv-icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--tv-radius-control);
  background-color: var(--videoplayer-control);
  box-shadow: inset 0 1px 0 var(--videoplayer-highlight), 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text);
}

.tv-icon-button:hover {
  background-color: var(--videoplayer-control-hover);
}

.tv-icon-button--plain {
  background-color: transparent;
  box-shadow: none;
}

.tv-icon-button--play {
  width: 52px;
}

.tv-icon-button--play .tv-icon--pause,
.tv-icon-button--play[data-playing] .tv-icon--play {
  display: none;
}

.tv-icon-button--play[data-playing] .tv-icon--pause {
  display: block;
}

.tv-segments {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--tv-radius-panel);
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
}

.tv-segments--wide {
  display: flex;
}

.tv-segments--wide .tv-segment {
  flex: 1;
}

.tv-segment {
  height: 32px;
  min-width: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--tv-radius-segment);
  background-color: transparent;
  color: var(--videoplayer-text-muted);
  font-family: var(--tv-mono);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tv-segments--wide .tv-segment {
  font-family: var(--tv-font);
}

.tv-segment:hover {
  background-color: var(--videoplayer-control);
  color: var(--videoplayer-text);
}

.tv-segment:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tv-segment:is([aria-pressed="true"], [aria-selected="true"]) {
  background-color: var(--videoplayer-accent-tint);
  box-shadow: inset 0 0 0 1px var(--videoplayer-accent-line);
  color: var(--videoplayer-accent);
}

/* Library */

.tv-library {
  grid-area: library;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-height: calc(100dvh - 120px);
  position: sticky;
  top: 16px;
}

.tv-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tv-reopen-name {
  max-width: 12ch;
  overflow: hidden;
  color: var(--videoplayer-text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--tv-radius-panel);
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text-faint);
  transition: box-shadow 160ms var(--tv-ease);
}

.tv-search:focus-within {
  box-shadow: inset 0 0 0 1px var(--videoplayer-accent-line), 0 0 0 3px var(--videoplayer-accent-tint);
}

.tv-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--videoplayer-text);
  font: inherit;
  font-size: 14px;
}

.tv-search-input:focus-visible {
  outline: none;
}

.tv-search-input::placeholder {
  color: var(--videoplayer-text-faint);
}

.tv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text-muted);
  font-size: 13px;
  font-weight: 500;
}

.tv-chip:hover {
  color: var(--videoplayer-text);
}

.tv-chip[aria-pressed="true"] {
  background-color: var(--videoplayer-accent-tint);
  box-shadow: inset 0 0 0 1px var(--videoplayer-accent-line);
  color: var(--videoplayer-text);
}

.tv-chip-count {
  color: var(--videoplayer-text-faint);
  font-family: var(--tv-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tv-progress {
  display: grid;
  gap: 6px;
}

.tv-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background-color: var(--videoplayer-line);
}

.tv-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background-color: var(--videoplayer-accent);
  transition: width 240ms var(--tv-ease);
}

.tv-progress-text {
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.tv-list,
.tv-sublist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tv-list {
  flex: 1;
  min-height: 120px;
  margin: 0 -6px;
  padding: 0 6px 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--videoplayer-line-strong) transparent;
}

.tv-list-empty {
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 14px;
}

.tv-item {
  position: relative;
}

.tv-item + .tv-item {
  margin-top: 2px;
}

.tv-item-main {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: var(--tv-radius-panel);
  background-color: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms var(--tv-ease);
}

.tv-item-main:hover {
  background-color: var(--videoplayer-panel);
}

.tv-item-main[aria-current="true"] {
  background-color: var(--videoplayer-control);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line-strong);
}

.tv-thumb {
  flex: none;
  width: 64px;
  height: 48px;
  border-radius: 6px;
  background-color: var(--videoplayer-stage);
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--videoplayer-line);
}

.tv-thumb-frame {
  position: relative;
  display: block;
  flex: none;
}

.tv-thumb-ai {
  position: absolute;
  top: 3px;
  left: 3px;
  padding: 0 4px;
  border-radius: 4px;
  background-image: var(--tv-rainbow);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.55);
  color: var(--videoplayer-bg);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 14px;
}

.tv-thumb--empty {
  display: block;
  background:
    linear-gradient(135deg, transparent 47%, var(--videoplayer-line) 47%, var(--videoplayer-line) 53%, transparent 53%),
    var(--videoplayer-stage);
}

.tv-item-body {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding-right: 26px;
}

.tv-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tv-item-count {
  color: var(--videoplayer-text-faint);
  font-size: 12.5px;
  white-space: nowrap;
}

.tv-item-place {
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-item-time,
.tv-item-moments,
.tv-item-summary {
  overflow: hidden;
  color: var(--videoplayer-text-muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-item-moments {
  color: var(--videoplayer-text-faint);
}

.tv-item-expand {
  position: absolute;
  top: 8px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background-color: transparent;
  color: var(--videoplayer-text-muted);
  cursor: pointer;
}

.tv-item-expand:hover {
  background-color: var(--videoplayer-control-hover);
  color: var(--videoplayer-text);
}

.tv-item-expand .tv-icon {
  transition: transform 200ms var(--tv-ease);
}

.tv-item-expand[aria-expanded="true"] .tv-icon {
  transform: rotate(90deg);
}

.tv-sublist {
  margin: 2px 0 6px 20px;
  padding-left: 8px;
  border-left: 1px solid var(--videoplayer-line);
}

.tv-badge {
  --kind-color: var(--tv-quiet);
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  height: 20px;
  padding: 0 7px;
  overflow: hidden;
  border-radius: 6px;
  background-color: color-mix(in oklch, var(--kind-color) 16%, transparent);
  color: var(--kind-color);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-badge:empty {
  display: none;
}

.tv-badge[data-tone="incident"] {
  --kind-color: var(--tv-incident);
}

.tv-badge[data-tone="user"] {
  --kind-color: var(--videoplayer-text);
}

.tv-badge[data-tone="nearby"] {
  --kind-color: var(--tv-nearby);
}

.tv-moment[data-kind="brake"] {
  color: var(--tv-brake);
}

.tv-moment[data-kind="launch"] {
  color: var(--tv-throttle);
}

.tv-moment[data-kind="lateral"] {
  color: var(--tv-lateral);
}

.tv-moment[data-kind="disengage"] {
  color: var(--tv-autopilot);
}

/* Main area */

.tv-main {
  grid-area: main;
  min-width: 0;
}

.tv-drop {
  position: relative;
  display: grid;
  min-height: min(62vh, 560px);
  place-items: center;
  padding: 32px;
  border: 1.5px dashed var(--videoplayer-line-strong);
  border-radius: var(--tv-radius-stage);
  background-color: var(--videoplayer-stage);
  text-align: center;
  transition: border-color 160ms var(--tv-ease), background-color 160ms var(--tv-ease);
}

.tv-drop-hint,
.tv-drop-active,
.tv-drop-busy {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 46ch;
}

.tv-drop-active,
.tv-drop-busy,
.tv[data-dragging] .tv-drop-hint,
.tv[data-busy] .tv-drop-hint {
  display: none;
}

.tv[data-dragging] .tv-drop-active,
.tv[data-busy]:not([data-dragging]) .tv-drop-busy {
  display: grid;
}

.tv[data-dragging] .tv-drop {
  border-color: var(--videoplayer-accent);
  background-color: var(--videoplayer-accent-tint);
}

.tv-drop-hint .tv-icon {
  color: var(--videoplayer-text-faint);
}

.tv-drop-active .tv-icon {
  color: var(--videoplayer-accent);
}

.tv-drop-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.tv-drop-text,
.tv-drop-note {
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 14px;
  text-wrap: pretty;
}

.tv-drop-note {
  color: var(--videoplayer-text-faint);
  font-size: 13px;
}

.tv-drop-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.tv:not([data-mode="empty"])[data-dragging]::after {
  content: 'Drop to open';
  position: fixed;
  inset: 12px;
  z-index: var(--tv-layer-overlay);
  display: grid;
  place-items: center;
  border: 2px dashed var(--videoplayer-accent);
  border-radius: var(--tv-radius-stage);
  background-color: var(--videoplayer-backdrop);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
}

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

.tv-viewer[hidden],
.tv-single[hidden],
.tv-drop[hidden] {
  display: none;
}

.tv-viewer[data-loading] .tv-grid {
  opacity: 0.4;
}

.tv-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tv-viewer-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tv-event-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.tv-event-title > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-event-meta {
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.tv-stage {
  --tv-viewer-rows: 200px;
  --tv-grid-inset: 18px;
  position: relative;
  container-type: inline-size;
  width: min(100%, max(360px, (100cqh - var(--tv-viewer-rows) - var(--tv-grid-inset)) * 4 / 3 + var(--tv-grid-inset)));
  margin: 0 auto;
}

.tv-stage:has(> .tv-grid[data-layout="hexa"]:not([data-focus])) {
  width: min(100%, max(540px, (100cqh - var(--tv-viewer-rows) - var(--tv-grid-inset)) * 2 + 24px));
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: var(--tv-radius-stage);
  background-color: var(--videoplayer-stage);
  box-shadow: 0 0 0 1px var(--videoplayer-line), 0 28px 70px -30px rgba(0, 0, 0, 0.9);
  transition: opacity 200ms var(--tv-ease);
}

.tv-grid[data-layout="hexa"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tv-grid[data-focus] {
  grid-template-columns: minmax(0, 1fr);
}

.tv-grid[data-focus] .tv-tile:not([data-focused]) {
  display: none;
}

.tv-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border-radius: 10px;
  background-color: #000;
  cursor: zoom-in;
}

.tv-grid[data-focus] .tv-tile {
  cursor: zoom-out;
}

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

.tv-tile[data-gap] .tv-tile-video {
  opacity: 0.18;
  filter: grayscale(1);
}

.tv-tile-label {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 4px;
  border-radius: 7px;
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  font-weight: 500;
  pointer-events: none;
}

.tv-tile-label kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 5px;
  background-color: var(--videoplayer-control-hover);
  font-family: var(--tv-mono);
  font-size: 11px;
}

.tv-tile-gap {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 13px;
  pointer-events: none;
}

.tv-tile[data-gap] .tv-tile-gap {
  display: grid;
}

.tv-tile[data-error]::after {
  content: "This clip can't be played";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: rgba(0, 0, 0, 0.6);
  color: var(--videoplayer-text-muted);
  font-size: 13px;
}

/* HUD */

.tv-hud {
  position: absolute;
  bottom: 16px;
  left: 50%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 4px;
  border-radius: var(--tv-radius-panel);
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line), 0 10px 30px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
  pointer-events: none;
}

.tv-hud-cell {
  display: flex;
  flex: none;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 9px;
}

.tv-hud-cell + .tv-hud-cell {
  box-shadow: -1px 0 0 var(--videoplayer-line);
}

.tv-hud[data-telemetry="none"] .tv-hud-cell {
  display: none;
}

.tv-hud-empty {
  display: none;
  margin: 0;
  padding: 4px 8px;
  color: var(--videoplayer-text-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

.tv-hud[data-telemetry="none"] .tv-hud-empty {
  display: block;
}

.tv-hud-speed {
  align-items: baseline;
  gap: 5px;
}

.tv-hud-value {
  min-width: 3ch;
  font-family: var(--tv-mono);
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: right;
}

.tv-hud-unit,
.tv-hud-label {
  color: var(--videoplayer-text-faint);
  font-size: 11.5px;
}

.tv-hud-text {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#tvHudAutopilot[data-active] {
  color: var(--tv-autopilot);
}

.tv-hud-gears {
  gap: 1px;
  font-family: var(--tv-mono);
  font-size: 13px;
  font-weight: 500;
}

.tv-hud-gears span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 24px;
  border-radius: 6px;
  color: var(--videoplayer-text-faint);
}

.tv-hud-gears [data-active] {
  background-color: var(--videoplayer-control-hover);
  color: var(--videoplayer-text);
}

.tv-hud-brake {
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--videoplayer-text-faint);
  font-size: 12px;
  font-weight: 600;
}

.tv-hud-brake[data-on] {
  background-color: color-mix(in oklch, var(--tv-brake) 24%, transparent);
  color: var(--tv-brake);
}

.tv-hud-pedal {
  position: relative;
  width: 56px;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background-color: var(--videoplayer-line-strong);
}

.tv-hud-pedal-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background-color: var(--tv-throttle);
}

.tv-hud-wheel {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  transition: transform 80ms linear;
}

.tv-hud-steering .tv-hud-text {
  min-width: 4ch;
  text-align: right;
}

.tv-hud-blinker {
  color: var(--videoplayer-text-faint);
  font-size: 12px;
}

.tv-hud-blinker[data-on] {
  color: var(--tv-blinker);
  animation: tv-blink 700ms step-end infinite;
}

@keyframes tv-blink {
  50% {
    color: var(--videoplayer-text-faint);
  }
}

.tv-hud-g-plot {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--videoplayer-line-strong);
  stroke-width: 1;
}

.tv-hud-g-dot {
  fill: var(--videoplayer-text);
  stroke: none;
}

/* Scrubber and transport */

.tv-scrubber {
  position: relative;
}

.tv-scrubber-canvas {
  --tv-scrub-track: rgba(255, 255, 255, 0.06);
  --tv-scrub-coverage: rgba(243, 243, 243, 0.3);
  --tv-scrub-speed: rgba(243, 243, 243, 0.72);
  --tv-scrub-speed-fill: rgba(243, 243, 243, 0.07);
  --tv-scrub-brake: color-mix(in oklch, var(--tv-brake) 22%, transparent);
  --tv-scrub-playhead: #f3f3f3;
  --tv-marker-trigger: var(--tv-quiet);
  --tv-marker-incident: var(--tv-incident);
  --tv-marker-brake: var(--tv-brake);
  --tv-marker-launch: var(--tv-throttle);
  --tv-marker-lateral: var(--tv-lateral);
  --tv-marker-mode: var(--tv-autopilot);
  --tv-marker-nearby: var(--tv-nearby);
  --tv-marker-change: var(--videoplayer-text);
  display: block;
  width: 100%;
  height: 64px;
  border-radius: var(--tv-radius-panel);
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  cursor: pointer;
  touch-action: none;
}

.tv-scrubber-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  padding: 4px 8px;
  border-radius: 7px;
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 0 1px var(--videoplayer-line);
  font-family: var(--tv-mono);
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}

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

.tv-transport-buttons {
  display: flex;
  gap: 6px;
}

.tv-clock {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-family: var(--tv-mono);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.tv-clock-gap {
  color: var(--videoplayer-text-faint);
  font-family: var(--tv-font);
  font-size: 12.5px;
}

.tv-transport-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

/* Single video */

.tv-single-video {
  width: 100%;
  max-height: calc(100dvh - 260px);
  border-radius: var(--tv-radius-stage);
  background-color: #000;
}

.tv-chapters {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tv-chapter {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--tv-radius-segment);
  background-color: transparent;
  color: var(--videoplayer-text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.tv-chapter:hover {
  background-color: var(--videoplayer-panel);
}

.tv-chapter[aria-current] {
  background-color: var(--videoplayer-accent-tint);
  box-shadow: inset 0 0 0 1px var(--videoplayer-accent-line);
}

.tv-chapter-time {
  flex: none;
  min-width: 10ch;
  color: var(--videoplayer-text-muted);
  font-family: var(--tv-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Dialogs */

.tv-dialog {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 18px 20px 20px;
  overflow-y: auto;
  border: 0;
  border-radius: var(--tv-radius-stage);
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--videoplayer-highlight), inset 0 0 0 1px var(--videoplayer-line), 0 24px 60px rgba(0, 0, 0, 0.55);
  color: var(--videoplayer-text);
}

.tv-dialog::backdrop {
  background-color: var(--videoplayer-backdrop);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.tv-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.tv-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-dialog-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.tv-export-panel {
  display: grid;
  gap: 10px;
}

.tv-export-panel[hidden] {
  display: none;
}

.tv-export-text {
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 13.5px;
}

.tv-export-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}

.tv-export-range label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--videoplayer-text-muted);
}

.tv-input {
  width: calc(9ch + 20px);
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--tv-radius-segment);
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text);
  font-family: var(--tv-mono);
  font-size: 13.5px;
}

.tv-input:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--videoplayer-accent-line), 0 0 0 3px var(--videoplayer-accent-tint);
}

.tv-reel-list {
  display: grid;
  gap: 2px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.tv-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  font-size: 13.5px;
  cursor: pointer;
}

.tv-check[hidden] {
  display: none;
}

.tv-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--videoplayer-accent);
}

.tv-export-status {
  display: grid;
  gap: 6px;
}

.tv-export-status[hidden] {
  display: none;
}

.tv-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tv-dialog--shortcuts {
  width: min(980px, calc(100vw - 32px));
}

.tv-shortcuts {
  margin: 0;
  padding: 0;
  columns: 3 260px;
  column-gap: 28px;
  list-style: none;
}

.tv-shortcuts li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px;
  break-inside: avoid;
  border-bottom: 1px solid var(--videoplayer-line);
  font-size: 14px;
}

.tv-shortcuts .tv-keys {
  flex: none;
  min-width: 72px;
}

.tv-shortcuts li:last-child {
  border-bottom: 0;
}

.tv-keys {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--videoplayer-text-faint);
}

.tv-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background-color: var(--videoplayer-control);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.4), 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text);
  font-family: var(--tv-mono);
  font-size: 12.5px;
}

.tv-toast {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--tv-layer-overlay);
  max-width: min(320px, calc(100vw - 40px));
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line), 0 12px 32px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms var(--tv-ease), transform 200ms var(--tv-ease);
  pointer-events: none;
}

.tv-toast[data-visible] {
  opacity: 1;
  transform: none;
}

/* Sorting, deleting, autoplay, palette */

.tv-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tv-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--videoplayer-text-faint);
  font-size: 12.5px;
}

.tv-select {
  height: 30px;
  padding: 0 26px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--videoplayer-panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.tv-select:hover {
  color: var(--videoplayer-text);
}

.tv-section {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 10px 0 4px;
  padding: 4px 8px;
  background-color: var(--videoplayer-bg);
  color: var(--videoplayer-text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tv-section:first-child {
  margin-top: 0;
}

.tv-item-delete {
  position: absolute;
  right: 4px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background-color: transparent;
  color: var(--videoplayer-text-faint);
  opacity: 0;
  cursor: pointer;
  transition: opacity 160ms var(--tv-ease), background-color 160ms var(--tv-ease), color 160ms var(--tv-ease);
}

.tv-item:hover > .tv-item-delete,
.tv-item:focus-within > .tv-item-delete,
.tv-item-main[aria-current="true"] ~ .tv-item-delete {
  opacity: 1;
}

.tv-item-delete:hover {
  background-color: var(--videoplayer-accent-tint);
  color: var(--videoplayer-accent);
}

.tv-viewer-actions {
  display: flex;
  flex: none;
  gap: 2px;
}

.tv-text-button--danger:hover {
  background-color: var(--videoplayer-accent-tint);
  color: var(--videoplayer-accent);
}

.tv-button--danger {
  background-color: var(--videoplayer-accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.tv-button--danger:hover {
  background-color: var(--videoplayer-accent-strong-hover);
}

:is(.tv-button, .tv-text-button) kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  background-color: rgba(255, 255, 255, 0.12);
  font-family: var(--tv-mono);
  font-size: 11px;
  font-weight: 500;
}

.tv-text-button .tv-keys kbd {
  min-width: 20px;
  height: 20px;
}

.tv-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 999px;
  background-color: transparent;
  color: var(--videoplayer-text-muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 160ms var(--tv-ease), background-color 160ms var(--tv-ease);
}

.tv-switch:hover {
  background-color: var(--videoplayer-control);
}

.tv-switch-track {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background-color: var(--videoplayer-line-strong);
  transition: background-color 200ms var(--tv-ease);
}

.tv-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--videoplayer-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 200ms var(--tv-ease);
}

.tv-switch[aria-checked="true"] {
  color: var(--videoplayer-text);
}

.tv-switch[aria-checked="true"] .tv-switch-track {
  background-color: var(--videoplayer-accent);
}

.tv-switch[aria-checked="true"] .tv-switch-thumb {
  transform: translateX(12px);
}

.tv-stage:fullscreen {
  display: grid;
  place-content: center;
  width: 100vw;
  height: 100vh;
  background-color: #000;
}

.tv-stage:fullscreen .tv-grid {
  width: min(100vw, (100vh - 18px) * 4 / 3 + 18px);
  box-shadow: none;
}

.tv-stage:fullscreen:has(> .tv-grid[data-layout="hexa"]:not([data-focus])) .tv-grid {
  width: min(100vw, (100vh - 18px) * 2 + 24px);
}

.tv-dialog--wide {
  width: min(720px, calc(100vw - 32px));
}

#tv-rainbow stop:nth-child(1) {
  stop-color: var(--tv-rainbow-1);
}

#tv-rainbow stop:nth-child(2) {
  stop-color: var(--tv-rainbow-2);
}

#tv-rainbow stop:nth-child(3) {
  stop-color: var(--tv-rainbow-3);
}

#tv-rainbow stop:nth-child(4) {
  stop-color: var(--tv-rainbow-4);
}

#tv-rainbow stop:nth-child(5) {
  stop-color: var(--tv-rainbow-5);
}

#tv-rainbow stop:nth-child(6) {
  stop-color: var(--tv-rainbow-6);
}

#tvAi[data-has-notes] .tv-icon {
  stroke: url(#tv-rainbow);
}

#tvAi[data-has-notes] .tv-ai-label {
  background-image: var(--tv-rainbow);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

.tv-ai-notes {
  display: grid;
  gap: 10px;
}

.tv-ai-notes[hidden] {
  display: none;
}

.tv-ai-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--videoplayer-text-muted);
  font-size: 13.5px;
}

.tv-ai-summary {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.tv-ai-moments {
  display: grid;
  gap: 2px;
  max-height: 240px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.tv-ai-moment {
  --tone: var(--tv-quiet);
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-left: 2px solid var(--tone);
  border-radius: 0 var(--tv-radius-segment) var(--tv-radius-segment) 0;
  background-color: transparent;
  color: var(--videoplayer-text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.tv-ai-moment:hover {
  background-color: var(--videoplayer-control-hover);
}

.tv-ai-moment[data-tone="incident"] {
  --tone: var(--tv-incident);
}

.tv-ai-moment[data-tone="nearby"] {
  --tone: var(--tv-nearby);
}

.tv-ai-instructions summary {
  color: var(--videoplayer-text-muted);
  font-size: 13.5px;
  cursor: pointer;
}

#tvAiDialog[open] {
  display: flex;
  flex-direction: column;
}

#tvAiDialog > * {
  flex: none;
}

#tvAiDialog > .tv-ai-instructions {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.tv-ai-instructions pre {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: var(--tv-radius-segment);
  background-color: var(--videoplayer-panel);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text-muted);
  font-family: var(--tv-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tv-export-text code {
  color: var(--videoplayer-text);
  font-family: var(--tv-mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.tv-dialog--narrow {
  width: min(440px, calc(100vw - 32px));
}

.tv-delete-form {
  display: grid;
  gap: 12px;
  margin: 0;
}

.tv-delete-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.tv-delete-text {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  text-wrap: pretty;
}

.tv-export-problem {
  margin: 0;
  color: var(--videoplayer-text);
  font-size: 13px;
  font-weight: 600;
}

.tv-delete-warning {
  color: var(--videoplayer-text);
  font-weight: 600;
}

.tv-palette {
  width: min(560px, calc(100vw - 32px));
  max-height: min(540px, calc(100dvh - 96px));
  margin-top: 12vh;
  padding: 10px;
  gap: 8px;
}

.tv-palette[open] {
  display: flex;
  flex-direction: column;
}

.tv-palette-search {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 14px;
  border-bottom: 1px solid var(--videoplayer-line);
  color: var(--videoplayer-text-faint);
}

.tv-palette-search .tv-icon {
  width: 22px;
  height: 22px;
}

.tv-palette-search .tv-search-input {
  font-size: 18px;
}

.tv-palette-search:focus-within {
  border-bottom-color: var(--videoplayer-accent-line);
}

.tv-palette-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 2px 0;
  overflow-y: auto;
  list-style: none;
}

.tv-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--tv-radius-segment);
  font-size: 14px;
  cursor: pointer;
}

.tv-palette-item[aria-selected="true"] {
  background-color: var(--videoplayer-control-hover);
}

.tv-palette-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-palette-group {
  color: var(--videoplayer-text-faint);
  font-size: 12px;
}

.tv-palette-item .tv-keys kbd,
.tv-palette-hint kbd,
.tv-export-text kbd {
  min-width: 22px;
  height: 22px;
  font-size: 11.5px;
}

.tv-palette-empty {
  padding: 18px 10px;
  color: var(--videoplayer-text-muted);
  font-size: 14px;
  text-align: center;
}

.tv-palette-hint {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 6px 10px 2px;
  border-top: 1px solid var(--videoplayer-line);
  color: var(--videoplayer-text-faint);
  font-size: 12px;
}

.tv-palette-hint kbd,
.tv-export-text kbd {
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background-color: var(--videoplayer-control);
  box-shadow: 0 0 0 1px var(--videoplayer-line);
  color: var(--videoplayer-text);
  font-family: var(--tv-mono);
}

.tv-next {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: var(--tv-layer-overlay);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  max-width: min(320px, calc(100vw - 40px));
  overflow: hidden;
  border-radius: 999px;
  background-color: var(--videoplayer-glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px var(--videoplayer-line-strong), 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: tv-slide-in 200ms var(--tv-ease) both;
}

.tv-next-now,
.tv-next-cancel {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tv-next-now {
  min-width: 0;
  overflow: hidden;
  padding: 7px 4px 7px 14px;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-next-label {
  color: var(--videoplayer-text-faint);
}

.tv-next-cancel {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 3px;
  border-radius: 50%;
  color: var(--videoplayer-text-muted);
}

.tv-next-cancel:hover {
  background-color: var(--videoplayer-control-hover);
  color: var(--videoplayer-text);
}

.tv-next-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
}

.tv-next-bar {
  display: block;
  height: 100%;
  background-color: var(--videoplayer-accent);
  transform-origin: left center;
}

@keyframes tv-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.tv:has(.tv-next:not([hidden])) .tv-toast {
  bottom: calc(66px + env(safe-area-inset-bottom));
}

@media (min-width: 981px) {
  body:has(.tv[data-mode="library"]) {
    box-sizing: border-box;
    height: 100dvh;
    padding-top: 18px;
    padding-bottom: 16px;
    overflow: hidden;
  }

  .tv[data-mode="library"] {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "library main";
    gap: 14px 24px;
  }

  .tv[data-mode="library"] :is(.tv-footer, .tv-subtitle) {
    display: none;
  }

  .tv[data-mode="library"] .tv-library {
    position: static;
    min-height: 0;
    max-height: none;
  }

  .tv[data-mode="library"] .tv-main {
    min-height: 0;
    container-type: size;
  }

  .tv[data-mode="library"] .tv-viewer {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    align-content: start;
    gap: 12px;
  }

  .tv[data-mode="library"] .tv-transport {
    flex-wrap: nowrap;
  }

  @container (max-width: 1040px) {
    .tv-segment[data-rate="0.25"],
    .tv-segment[data-rate="0.5"] {
      display: none;
    }

    .tv-transport-actions .tv-text-button--labelled span:not(.tv-keys) {
      display: none;
    }
  }

  @container (max-width: 820px) {
    .tv-stage {
      --tv-viewer-rows: 250px;
    }

    .tv[data-mode="library"] .tv-transport {
      flex-wrap: wrap;
    }

    .tv-transport-actions {
      margin-left: 0;
    }
  }
}

@media (max-width: 980px) {
  .tv,
  .tv[data-mode="empty"],
  .tv[data-mode="single"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "main"
      "library"
      "footer";
  }

  .tv-library {
    position: static;
    max-height: none;
  }

  .tv-list {
    max-height: 60vh;
  }
}

@media (max-width: 560px) {
  .tv-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tv-grid {
    gap: 4px;
    padding: 4px;
  }

  .tv-transport-actions {
    margin-left: 0;
  }

  .tv-tile-label {
    font-size: 11px;
  }
}

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

  .tv-hud-blinker[data-on] {
    animation: none;
  }
}
