:root {
  color-scheme: dark;
  --bg: #0f0f0f;
  --panel: #181818;
  --panel2: #242424;
  --chip: #272727;
  --chip-hover: #3f3f3f;
  --text: #f1f1f1;
  --muted: #aaa;
  --line: #303030;
  --red: #f00;
  --blue: #3ea6ff;
  --overlay: rgba(28, 28, 28, 0.94);
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
html.player-locked {
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select {
  font: inherit;
}
button {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Icons ---------------------------------------------------------------- */
.icon {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.icon text {
  font: 700 7px/1 var(--font);
  fill: currentColor;
}
.when-on,
.active > .when-off {
  display: none;
}
.active > .when-on {
  display: block;
}

/* Form controls -------------------------------------------------------- */
select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 36px;
  max-width: 100%;
  padding: 7px 34px 7px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--chip) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f1f1f1'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center / 20px;
  color: var(--text);
  cursor: pointer;
}
select:hover {
  background-color: var(--chip-hover);
}
input[type="range"] {
  --fill: #fff;
  --progress: 50%;
  appearance: none;
  -webkit-appearance: none;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--fill) var(--progress), rgba(255, 255, 255, 0.3) var(--progress));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  transition: transform 0.12s;
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}
input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
}
input[type="range"]:disabled {
  cursor: default;
  opacity: 0.5;
}
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  margin: 0;
  border-radius: 10px;
  background: #717171;
  cursor: pointer;
  transition: background 0.15s;
}
.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch:checked {
  background: var(--blue);
}
.switch:checked::before {
  transform: translateX(16px);
}
.pill-button,
.continuation button,
.playlist-header button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.pill-button {
  padding-left: 10px;
}
.pill-button .icon {
  width: 22px;
  height: 22px;
}
.pill-button:hover,
.continuation button:hover {
  background: rgba(255, 255, 255, 0.2);
}
.pill-button.active {
  background: var(--text);
  color: var(--bg);
}
.pill-button:disabled,
.continuation button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Top bar -------------------------------------------------------------- */
.topbar {
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  /* Equal side columns keep the search box in the middle of the page. */
  grid-template-columns: 1fr minmax(200px, 640px) 1fr;
  align-items: center;
  gap: 24px;
  /* Same width as the page content below, so the logo lines up with it. */
  padding: 0 max(24px, calc((100% - 1760px) / 2));
  background: rgba(15, 15, 15, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.6px;
  white-space: nowrap;
}
.video-docked .brand {
  visibility: hidden;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 21px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
}
.brand-mark .icon {
  width: 15px;
  height: 15px;
}
.top-search {
  height: 40px;
  position: relative;
  display: flex;
  justify-self: center;
  width: 100%;
}
.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 64px;
  z-index: 40;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.search-suggestions li {
  padding: 9px 18px;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.search-suggestions li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-suggestions li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* A recent search: marked with a small clock-like ring and removable. */
.search-suggestions li.recent span::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}
.search-suggestions li.recent span {
  color: #c9b8ff;
}
.search-suggestions li button {
  flex: none;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 13px;
  cursor: pointer;
}
.search-suggestions li.active,
.search-suggestions li:hover {
  background: var(--chip-hover);
}
.top-search input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 20px 0 0 20px;
  background: #121212;
  color: #fff;
  padding: 0 18px;
  font-size: 16px;
  outline: none;
}
.top-search input:focus {
  border-color: #1c62b9;
}
.top-search button {
  display: grid;
  place-items: center;
  width: 64px;
  border: 1px solid var(--line);
  border-radius: 0 20px 20px 0;
  background: #222;
  color: var(--text);
  cursor: pointer;
}
.top-search button:hover {
  background: #2f2f2f;
}

/* Browse pages --------------------------------------------------------- */
.browse-shell {
  width: min(1760px, calc(100% - 48px));
  margin: 0 auto;
  padding: 16px 0 60px;
}
.chips,
.search-filters {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar,
.search-filters::-webkit-scrollbar {
  display: none;
}
.chips {
  padding: 0 0 16px;
}
.search-filters {
  margin: 0 0 24px;
}
.chips a,
.search-filters a {
  flex: none;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--chip);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
}
.chips a:hover,
.search-filters a:hover {
  background: var(--chip-hover);
}
.search-filters a.active {
  background: var(--text);
  color: var(--bg);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 2px 0 20px;
}
.section-heading h1,
.section-heading h2,
.subsection-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}
.section-heading > span,
.footnote {
  color: var(--muted);
}
.section-heading a {
  color: var(--blue);
  text-decoration: none;
}
.subsection-heading {
  margin: 30px 0 18px;
}
.channel-results {
  margin: 0 0 34px;
}
.channel-results h2 {
  margin: 0 0 14px;
  font-size: 18px;
}
.channel-list {
  display: grid;
  gap: 10px;
}
.channel-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 12px 18px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
}
.channel-card:hover {
  background: var(--panel);
}
.channel-card > img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
}
.channel-card-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}
.channel-card-copy strong {
  font-size: 17px;
}
.channel-card-copy span,
.channel-card-copy small {
  color: var(--muted);
}
.channel-card-copy small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 760px;
  font-size: 13px;
}
.channel-open {
  border-radius: 18px;
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
}
.channel-page {
  padding-top: 32px;
}
.channel-header {
  display: grid;
  grid-template-columns: 160px minmax(0, 760px);
  align-items: center;
  gap: 30px;
  margin: 0 0 42px;
}
.channel-header > img {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
}
.channel-header h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -0.8px;
}
.channel-stats,
.channel-description {
  color: var(--muted);
}
.channel-stats {
  margin: 8px 0;
  font-weight: 700;
}
.channel-description {
  margin: 12px 0 0;
}

/* Video cards ---------------------------------------------------------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 36px 16px;
}
.video-card {
  position: relative;
  min-width: 0;
  color: #fff;
}
.video-link {
  display: block;
  color: #fff;
  text-decoration: none;
}
.thumbnail {
  position: relative;
  display: block;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: #222;
}
.thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
@media (hover: hover) {
  .video-card:hover img {
    transform: scale(1.03);
  }
}
.duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.duration.live {
  background: #c00;
}
.duration.upcoming {
  background: #065fd4;
  letter-spacing: 0.03em;
}
.card-progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.35);
}
.card-progress.visible {
  display: block;
}
.card-progress i {
  display: block;
  height: 100%;
  background: var(--red);
}
.video-card.preparing .thumbnail::after,
.video-card.prepared .thumbnail::after {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.video-card.preparing .thumbnail::after {
  content: "Preparing…";
  background: rgba(0, 0, 0, 0.8);
}
.video-card.prepared .thumbnail::after {
  content: "Ready";
  background: rgba(0, 110, 40, 0.9);
}
.card-copy {
  display: flex;
  flex-direction: column;
  padding: 12px 2px 0;
}
.card-copy strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.375;
}
.card-copy span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-copy .card-meta {
  margin-top: 0;
}
.card-actions {
  display: flex;
  gap: 2px;
  margin: 6px 0 0 -6px;
}
.card-actions button,
.queue-item button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.card-actions .icon,
.queue-item .icon {
  width: 20px;
  height: 20px;
}
.card-actions button:hover,
.queue-item button:hover {
  background: var(--chip);
  color: var(--text);
}
.card-actions button.active {
  color: var(--blue);
}
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 16px;
}
.playlist-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fff;
  text-decoration: none;
}
.playlist-card strong {
  font-size: 16px;
  font-weight: 500;
}
.playlist-card > span:last-child {
  color: var(--muted);
}
.playlist-count {
  position: absolute;
  inset: 0 0 0 auto;
  width: 38%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  font-size: 12px;
  font-weight: 700;
}
.continuation {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 90px;
  color: var(--muted);
}
.continue-section {
  margin-bottom: 42px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}
.playlist-header {
  max-width: 900px;
  margin: 12px 0 38px;
  padding: 26px;
  border-radius: 16px;
  background: linear-gradient(135deg, #302044, #181818);
}
.playlist-header h1 {
  margin: 8px 0;
  font-size: 34px;
}
.playlist-header p {
  color: #ccc;
}
.playlist-header button {
  background: var(--text);
  color: var(--bg);
}
.playlist-header button:hover {
  background: #d9d9d9;
}
.footnote {
  margin: 42px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.alert {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid #5d3b00;
  border-radius: 12px;
  background: #2c1d00;
  color: #ffd18a;
}
.muted {
  color: var(--muted);
}

/* Watch page ----------------------------------------------------------- */
.watch-shell {
  width: min(1760px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
}
.watch-primary {
  min-width: 0;
}
/* Empty space that pushes the player to the bottom edge of the screen; its
   height is set by the player script when that mode is on. */
.dock-spacer {
  height: 0;
}
.smart-player {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: calc(100vh - 120px);
  border-radius: 12px;
  background: #000;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.smart-player:fullscreen,
.smart-player.pseudo-fullscreen {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
}
.smart-player:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
}
.smart-player.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
}
#video-canvas,
#video-transition-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
#video-transition-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
#video-transition-canvas[hidden] {
  display: none;
}
/* The next quality decodes here, invisible, until its first frame matches
   the audio clock; it then takes the place of #video-canvas. */
.video-canvas-incoming {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  pointer-events: none;
}
.player-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.player-poster.is-frame {
  object-fit: contain;
}
.player-poster[hidden] {
  display: none;
}
.gesture-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.speed-badge {
  position: absolute;
  z-index: 4;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.speed-badge[hidden] {
  display: none;
}
.smart-player.is-playing:not(.controls-visible) .gesture-layer {
  cursor: none;
}
.caption-overlay {
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  bottom: 24px;
  text-align: center;
  white-space: pre-line;
  color: #fff;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
  text-shadow: 0 2px 3px #000, 0 0 5px #000;
  pointer-events: none;
  transition: bottom 0.2s;
}
.smart-player.controls-visible .caption-overlay,
.smart-player:not(.is-playing) .caption-overlay {
  bottom: 84px;
}

/* State-driven icon swaps */
.smart-player .when-playing,
.smart-player .when-replay,
.smart-player .when-muted,
.smart-player .when-fullscreen,
.smart-player.is-playing .when-paused,
.smart-player.is-ended .when-paused,
.smart-player.is-ended .when-playing,
.smart-player.is-muted .when-unmuted,
.smart-player.is-fullscreen .when-windowed {
  display: none;
}
.smart-player.is-playing:not(.is-ended) .when-playing,
.smart-player.is-ended .when-replay,
.smart-player.is-muted .when-muted,
.smart-player.is-fullscreen .when-fullscreen {
  display: block;
}

/* Double-tap skip feedback */
.seek-ripple {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 38%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.seek-ripple.back {
  left: 0;
  border-radius: 0 50% 50% 0 / 0 50% 50% 0;
}
.seek-ripple.forward {
  right: 0;
  border-radius: 50% 0 0 50% / 50% 0 0 50%;
}
.seek-ripple.visible {
  opacity: 1;
}
.seek-ripple > span {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.seek-ripple .icon {
  width: 40px;
  height: 40px;
}
.seek-ripple b {
  font-size: 14px;
  font-weight: 500;
}
.seek-ripple.pulse .icon {
  animation: ripple-pulse 0.35s ease-out;
}
@keyframes ripple-pulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Center play + spinner */
.center-play {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  transform: scale(0.9);
}
.center-play .icon {
  width: 44px;
  height: 44px;
}
.center-play:hover {
  background: rgba(0, 0, 0, 0.75);
}
.smart-player:not(.is-playing):not(.is-loading) .center-play,
.smart-player.controls-visible:not(.is-loading) .center-play {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
@media (hover: hover) {
  .smart-player.is-playing:not(.is-ended) .center-play {
    opacity: 0;
    pointer-events: none;
  }
}
.player-spinner {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.smart-player.is-loading .player-spinner {
  opacity: 1;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Status toast */
.player-status {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 50%;
  max-width: calc(100% - 24px);
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.72);
  color: #eee;
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.player-status[hidden],
.player-status:empty {
  display: none;
}

/* Control bar */
.controls {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 48px 12px 4px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.35) 55%, transparent);
  transition: opacity 0.25s;
}
.smart-player.is-playing:not(.controls-visible) .controls {
  opacity: 0;
  pointer-events: none;
}
/* Seek bar extras: chapter gaps, sponsor segments and the hover preview. */
.seek-wrap {
  position: relative;
}
.seek-marks {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 3px;
  transform: translateY(-50%);
  pointer-events: none;
}
.seek-marks i {
  position: absolute;
  top: 0;
  bottom: 0;
}
.seek-marks .chapter {
  width: 2px;
  margin-left: -1px;
  background: rgba(0, 0, 0, 0.85);
}
.seek-marks .sponsor {
  background: #00d400;
  opacity: 0.85;
}
.seek-preview {
  position: absolute;
  bottom: 22px;
  z-index: 6;
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: 240px;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
  font-size: 13px;
  text-shadow: 0 1px 3px #000;
}
.seek-preview[hidden],
.seek-preview-image[hidden] {
  display: none;
}
.seek-preview-image {
  border: 2px solid #fff;
  border-radius: 6px;
  background-color: #000;
  background-repeat: no-repeat;
}
.seek-preview span:empty {
  display: none;
}
.chapter-label {
  min-width: 0;
  overflow: hidden;
  margin-left: 4px;
  color: #ddd;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chapter-label::before {
  content: "· ";
}
.chapter-label[hidden] {
  display: none;
}
/* Audio only: the thumbnail stands in for the picture, slightly dimmed. */
.smart-player.audio-only .player-poster {
  filter: brightness(0.55);
}
#seek {
  --fill: var(--red);
  display: block;
  width: 100%;
  height: 16px;
}
#seek::-webkit-slider-runnable-track {
  height: 3px;
  transition: height 0.1s;
}
#seek::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5px;
  transform: scale(0);
}
#seek:hover::-webkit-slider-runnable-track,
#seek:active::-webkit-slider-runnable-track {
  height: 5px;
}
#seek:hover::-webkit-slider-thumb,
#seek:active::-webkit-slider-thumb,
#seek:focus-visible::-webkit-slider-thumb {
  margin-top: -4px;
  transform: scale(1);
}
@media (hover: none) {
  #seek::-webkit-slider-thumb {
    transform: scale(1);
  }
}
#seek:disabled {
  opacity: 0.35;
}
.control-row {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 48px;
}
.control-button {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  opacity: 0.92;
  transition: background 0.15s, opacity 0.15s;
}
.control-button .icon {
  width: 28px;
  height: 28px;
}
.control-button:hover {
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}
.control-button:disabled {
  opacity: 0.4;
  cursor: default;
}
.smart-player:not(.can-seek) #skip-back,
.smart-player:not(.can-seek) #skip-forward {
  display: none;
}
#captions-toggle.active::after,
#audio-only-toggle.active::after,
#dock-toggle.active::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 7px;
  height: 3px;
  border-radius: 2px;
  background: var(--red);
}
#settings-toggle .icon {
  transition: transform 0.25s;
}
.smart-player.settings-open #settings-toggle .icon {
  transform: rotate(30deg);
}
.volume-group {
  display: flex;
  align-items: center;
}
.volume-group #volume {
  width: 0;
  opacity: 0;
  transition: width 0.2s, opacity 0.2s, margin 0.2s;
}
.volume-group:hover #volume,
.volume-group:focus-within #volume {
  width: 72px;
  margin: 0 8px 0 2px;
  opacity: 1;
}
.time-display {
  padding: 0 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.time-separator {
  opacity: 0.7;
}
.control-spacer {
  flex: 1;
}
.quality-badge {
  position: absolute;
  top: 8px;
  right: 3px;
  padding: 0 3px;
  border-radius: 2px;
  background: var(--red);
  font-size: 9px;
  font-weight: 700;
  line-height: 13px;
  pointer-events: none;
}
.quality-badge:empty {
  display: none;
}

/* Settings menu */
.settings-menu {
  position: absolute;
  z-index: 6;
  right: 12px;
  bottom: 64px;
  width: min(300px, calc(100% - 24px));
  max-height: calc(100% - 80px);
  overflow-y: auto;
  padding: 8px 0;
  border-radius: 12px;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.settings-menu[hidden] {
  display: none;
}
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 44px;
  padding: 6px 16px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
}
button.menu-row {
  cursor: pointer;
}
button.menu-row:hover {
  background: rgba(255, 255, 255, 0.1);
}
.menu-row select {
  min-height: 32px;
  max-width: 160px;
  background-color: rgba(255, 255, 255, 0.1);
}
.menu-row input[type="range"] {
  width: 130px;
}
.menu-value {
  color: var(--muted);
}
.diagnostics {
  position: absolute;
  z-index: 6;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.88);
  color: #8fffa7;
  font: 11px/1.5 ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  pointer-events: none;
}

/* Below the player */
.watch-meta {
  padding: 12px 0 4px;
}
.watch-meta h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
}
.watch-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
}
.video-owner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.video-owner img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}
.video-owner img[hidden] {
  display: none;
}
.video-owner small {
  color: var(--muted);
  font-size: 12px;
}
.video-owner small:empty {
  display: none;
}
.video-owner span {
  display: grid;
}
.watch-meta-row p {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
}
.watch-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.watch-actions::-webkit-scrollbar {
  display: none;
}
.related-section {
  margin-top: 28px;
}
.video-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.watch-note {
  height: max-content;
  border-radius: 12px;
  background: var(--panel);
  padding: 16px;
}
.watch-note h2 {
  margin: 0 0 12px;
  font-size: 16px;
}
.watch-note p {
  margin: 0;
  font-size: 13px;
}
.queue-list {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}
.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
}
.queue-item a {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.queue-item img {
  width: 96px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
}

/* Wide watch layout: related videos run down the right-hand column, next
   to the description and the comments, as on youtube.com. */
@media (min-width: 1101px) {
  .watch-shell {
    grid-template-columns: minmax(0, 1fr) 402px;
  }
  .watch-side {
    min-width: 0;
    margin-top: var(--dock-space, 0px);
  }
  .watch-note:not(:has(.queue-item)) {
    display: none;
  }
  .watch-side .watch-note {
    margin-bottom: 16px;
  }
  .watch-side .related-section {
    margin-top: 0;
  }
  .watch-side .section-heading {
    margin-bottom: 12px;
  }
  .watch-side .section-heading h2 {
    font-size: 16px;
  }
  .watch-side .video-grid.compact {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .watch-side .video-card {
    padding-right: 32px;
  }
  .watch-side .video-link {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 8px;
  }
  .watch-side .thumbnail {
    border-radius: 8px;
  }
  .watch-side .card-copy {
    padding: 0;
  }
  .watch-side .card-copy strong {
    font-size: 14px;
    line-height: 1.43;
  }
  .watch-side .card-copy span {
    font-size: 12px;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .watch-side .card-actions {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
  }
  .watch-side .card-actions button {
    width: 32px;
    height: 32px;
  }
  /* Comments are always shown here and load as they scroll into view. */
  #comments-toggle {
    display: none;
  }
  .comments .comments-body {
    display: block;
  }
}
@media (min-width: 1101px) and (hover: hover) {
  .watch-side .card-actions {
    opacity: 0;
    transition: opacity 0.15s;
  }
  .watch-side .video-card:hover .card-actions,
  .watch-side .card-actions:focus-within {
    opacity: 1;
  }
}

/* Description and comments ---------------------------------------------- */
.video-details {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 14px;
  line-height: 1.5;
}
.video-details[hidden] {
  display: none;
}
.video-stats {
  margin: 0 0 4px;
  font-weight: 600;
}
.video-stats:empty {
  display: none;
}
.video-description {
  max-height: 4.5em;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.video-details.expanded .video-description {
  max-height: none;
}
.video-description a,
.comment-text a {
  color: var(--blue);
}
.timestamp,
.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  cursor: pointer;
}
.text-button {
  margin-top: 6px;
  font-weight: 600;
}
.text-button[hidden] {
  display: none;
}
.comments {
  margin: 16px 0 8px;
}
.comments .section-heading small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}
.comments-body {
  display: none;
}
.comments.open .comments-body {
  display: block;
}
#comments-list {
  color: var(--muted);
}
.comment {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--text);
}
.comment img {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chip);
}
.comment p {
  margin: 0;
}
.comment-heading {
  color: var(--muted);
  font-size: 12px;
}
.comment-heading strong {
  color: var(--text);
  font-size: 13px;
}
.comment-heading .creator {
  padding: 1px 6px;
  border-radius: 10px;
  background: #555;
}
.comment-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comment-footer {
  color: var(--muted);
  font-size: 12px;
}
#comments-more[hidden] {
  display: none;
}

/* Message pages ---------------------------------------------- */
.message-page {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
}
.message-page > div {
  max-width: 520px;
}
.message-page h1 {
  font-size: 34px;
  margin: 10px 0;
}
.message-page p {
  color: var(--muted);
  font-size: 16px;
}
.error-code {
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}
.primary-link {
  display: inline-block;
  margin-top: 15px;
  color: var(--blue);
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 1400px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .video-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* Single-column watch layout: the player spans the full device width. */
@media (max-width: 1100px) {
  .watch-shell {
    width: 100%;
    padding: 0 0 48px;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .smart-player {
    border-radius: 0;
    max-height: calc(100vh - 56px);
  }
  .watch-meta,
  .comments,
  .related-section {
    padding-left: 16px;
    padding-right: 16px;
  }
  .video-details {
    margin-left: 16px;
    margin-right: 16px;
  }
  .video-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .watch-note {
    display: none;
  }
}
@media (max-width: 900px) {
  .video-grid,
  .playlist-grid,
  .video-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .topbar {
    height: auto;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 10px 16px;
  }
  .top-search {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .browse-shell {
    width: calc(100% - 32px);
  }
  .smart-player {
    max-height: none;
  }
  .video-grid {
    gap: 28px 12px;
  }
  .channel-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 13px;
    padding: 10px 6px;
  }
  .channel-card > img {
    width: 64px;
    height: 64px;
  }
  .channel-open,
  .channel-card-copy small {
    display: none;
  }
  .channel-header {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 30px;
  }
  .channel-header > img {
    width: 96px;
    height: 96px;
  }
  .channel-header h1 {
    font-size: 26px;
  }
  .channel-description {
    grid-column: 1 / -1;
  }
  .caption-overlay {
    font-size: 20px;
  }
  .watch-meta h1 {
    font-size: 18px;
  }
  .watch-meta-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .control-row {
    height: 44px;
  }
  .control-button {
    width: 40px;
    height: 40px;
  }
  .control-button .icon {
    width: 24px;
    height: 24px;
  }
  .volume-group #volume {
    display: none;
  }
}
@media (max-width: 560px) {
  .video-grid,
  .playlist-grid,
  .video-grid.compact {
    grid-template-columns: 1fr;
  }
  .section-heading > span {
    display: none;
  }
  .controls {
    padding: 32px 4px 0;
  }
  #seek {
    padding: 0 8px;
  }
  .seek-marks {
    right: 8px;
    left: 8px;
  }
  .center-play {
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
  }
  .center-play .icon {
    width: 36px;
    height: 36px;
  }
}
/* Landscape phones: give the video the whole screen height. */
@media (max-height: 500px) and (orientation: landscape) {
  body:has(.watch-shell) .topbar {
    position: static;
  }
  .smart-player {
    max-height: 100vh;
  }
}
.probe {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.probe h1 {
  margin: 0 0 8px;
  font-size: 24px;
}
.probe .muted {
  color: var(--muted);
}
.probe-duration {
  display: block;
  margin: 16px 0;
}
.probe-duration select {
  margin-left: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  color: var(--text);
}
.probe-start {
  min-height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 28px;
  background: var(--text);
  color: var(--bg);
  font-size: 18px;
  font-weight: 600;
}
.probe-start:disabled {
  opacity: 0.5;
}
.probe-status {
  min-height: 1.5em;
  font-size: 16px;
}
.probe-output {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
