/* ==========================================================================
   UnblockedTube: a private YouTube-style player (opened from the calculator)
   ========================================================================== */

/* Roboto, as on YouTube. Latin only; other scripts fall back to system fonts. */
@font-face {
  font-family: "UnblockedTube Roboto";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/roboto-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "UnblockedTube Roboto";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/roboto-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "UnblockedTube Roboto";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/roboto-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Themes ---------- */
.vault {
  /* Dark theme */
  --yt-bg: #0f0f0f;
  --yt-menu-bg: #282828;
  --yt-text: #f1f1f1;
  --yt-text-2: #aaaaaa;
  --yt-text-3: #717171;
  --yt-tonal: rgba(255, 255, 255, 0.1);
  --yt-tonal-hover: rgba(255, 255, 255, 0.2);
  --yt-hover: rgba(255, 255, 255, 0.1);
  --yt-divider: rgba(255, 255, 255, 0.2);
  --yt-border: #303030;
  --yt-input-bg: #121212;
  --yt-input-text: #f1f1f1;
  --yt-placeholder: #888888;
  --yt-search-btn: #222222;
  --yt-search-btn-hover: #2c2c2c;
  --yt-focus: #1c62b9;
  --yt-blue: #3ea6ff;
  --yt-signin-border: rgba(255, 255, 255, 0.2);
  --yt-signin-hover: #263850;
  --yt-primary-bg: #f1f1f1;
  --yt-primary-text: #0f0f0f;
  --yt-primary-hover: #d9d9d9;
  --yt-snack-bg: #f1f1f1;
  --yt-snack-text: #0f0f0f;
  --yt-snack-action: #065fd4;
  --yt-snack-action-hover: rgba(6, 95, 212, 0.1);
  --yt-thumb-bg: #272727;
  --yt-error: #ff4e45;
  --yt-tooltip: rgba(97, 97, 97, 0.96);
  --yt-scrim: rgba(0, 0, 0, 0.5);
  --yt-blue-tint: rgba(62, 166, 255, 0.15);
  --yt-tonal-solid: #272727; /* --yt-tonal over --yt-bg */
  --yt-stack-1: #3f3f3f;
  --yt-stack-2: #2a2a2a;
  --yt-red: #ff0033;
  --yt-font: "UnblockedTube Roboto", Roboto, Arial, sans-serif;
  --yt-masthead: 56px;

  position: fixed;
  inset: 0;
  z-index: 100;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  color-scheme: dark;
  background: var(--yt-bg);
  color: var(--yt-text);
  font-family: var(--yt-font);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  visibility: hidden;
  clip-path: circle(0 at var(--origin-x, 50%) var(--origin-y, 50%));
}

.vault[data-yt-theme="light"] {
  --yt-bg: #ffffff;
  --yt-menu-bg: #ffffff;
  --yt-text: #0f0f0f;
  --yt-text-2: #606060;
  --yt-text-3: #909090;
  --yt-tonal: rgba(0, 0, 0, 0.05);
  --yt-tonal-hover: rgba(0, 0, 0, 0.1);
  --yt-hover: rgba(0, 0, 0, 0.05);
  --yt-divider: rgba(0, 0, 0, 0.1);
  --yt-border: #d3d3d3;
  --yt-input-bg: #ffffff;
  --yt-input-text: #0f0f0f;
  --yt-placeholder: #888888;
  --yt-search-btn: #f8f8f8;
  --yt-search-btn-hover: #efefef;
  --yt-blue: #065fd4;
  --yt-signin-border: rgba(0, 0, 0, 0.1);
  --yt-signin-hover: #def1ff;
  --yt-primary-bg: #0f0f0f;
  --yt-primary-text: #ffffff;
  --yt-primary-hover: #272727;
  --yt-snack-bg: #0f0f0f;
  --yt-snack-text: #f1f1f1;
  --yt-snack-action: #3ea6ff;
  --yt-snack-action-hover: rgba(62, 166, 255, 0.15);
  --yt-thumb-bg: #e5e5e5;
  --yt-error: #cc0000;
  --yt-blue-tint: rgba(6, 95, 212, 0.1);
  --yt-tonal-solid: #f2f2f2;
  --yt-stack-1: #c4c4c4;
  --yt-stack-2: #e1e1e1;

  color-scheme: light;
}

/* Opens as a circle growing out of the "+" key */
.vault.is-open {
  visibility: visible;
  clip-path: circle(150vmax at var(--origin-x, 50%) var(--origin-y, 50%));
  transition: clip-path 0.8s var(--ease-in-out);
}

/* Closes with a quick fade, so locking is instant */
.vault.is-closing {
  visibility: visible;
  clip-path: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

@keyframes yt-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes yt-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* "backwards", not "both": once done, nothing lingers that could trap the fixed full-window player */
.vault.is-open .yt-masthead {
  animation: yt-fade 0.5s ease 0.15s backwards;
}

.vault.is-open .yt-page {
  animation: yt-rise 0.6s var(--ease-out) 0.25s backwards;
}

/* ---------- Basics ---------- */
.vault .icon {
  stroke-width: 1.75;
}

:where(.vault) button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

:where(.vault) :focus-visible {
  outline: 2px solid var(--yt-text);
  outline-offset: 2px;
}

:where(.vault) h1,
:where(.vault) h2,
:where(.vault) h3,
:where(.vault) p {
  margin: 0;
}

.vault kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--yt-tonal);
  color: var(--yt-text);
  font: 500 11px/14px var(--yt-font);
  text-align: center;
}

.yt-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--yt-text);
  transition: background-color 0.1s ease;
}

.yt-icon-btn:hover {
  background: var(--yt-hover);
}

.yt-icon-btn:active {
  background: var(--yt-tonal-hover);
}

.yt-icon-btn--tonal {
  background: var(--yt-tonal);
}

.yt-icon-btn--tonal:hover {
  background: var(--yt-tonal-hover);
}

/* Pill buttons ("Subscribe", "Share"…) */
.yt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: var(--yt-tonal);
  color: var(--yt-text);
  font: 500 14px/36px var(--yt-font);
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.yt-btn:hover {
  background: var(--yt-tonal-hover);
}

.yt-btn .icon {
  width: 24px;
  height: 24px;
  margin-left: -6px;
}

.yt-btn--primary {
  background: var(--yt-primary-bg);
  color: var(--yt-primary-text);
}

.yt-btn--primary:hover {
  background: var(--yt-primary-hover);
}

/* ---------- Masthead ---------- */
.yt-masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--yt-masthead);
  padding: 0 16px;
  background: var(--yt-bg);
}

.yt-masthead__start,
.yt-masthead__end {
  display: flex;
  align-items: center;
  flex: none;
}

.yt-masthead__end {
  gap: 8px;
}

.yt-masthead__start {
  gap: 0;
}

.yt-logo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 40px;
  padding: 0 14px 0 16px;
  border-radius: 8px;
  color: var(--yt-text);
}

.yt-logo__mark {
  width: 30px;
  height: 21px;
  flex: none;
}

.yt-logo__text {
  font: 700 19px/1 var(--yt-font);
  letter-spacing: -0.9px;
  white-space: nowrap;
}

.yt-masthead__center {
  display: flex;
  align-items: center;
  flex: 0 1 732px;
  min-width: 0;
}

.yt-masthead__back,
.yt-masthead__search {
  display: none;
}

.yt-masthead__paste {
  margin-left: 12px;
}

/* Search box (here it's for links) */
.yt-search {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  height: 40px;
}

.yt-search__box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin-left: 32px;
  padding: 0 4px 0 16px;
  border: 1px solid var(--yt-border);
  border-right: 0;
  border-radius: 40px 0 0 40px;
  background: var(--yt-input-bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.vault[data-yt-theme="light"] .yt-search__box {
  box-shadow: inset 0 1px 2px #eeeeee;
}

/* Like YouTube: on focus the box grows to the left and shows a search icon */
.yt-search__box:focus-within {
  margin-left: 0;
  padding-left: 16px;
  border-color: var(--yt-focus);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.yt-search__lead {
  display: none;
  width: 20px;
  height: 20px;
  margin-right: 12px;
}

.yt-search__box:focus-within .yt-search__lead {
  display: block;
}

.yt-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--yt-input-text);
  font: 400 16px/22px var(--yt-font);
}

.yt-search__input::placeholder {
  color: var(--yt-placeholder);
  opacity: 1;
}

.yt-search__clear {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.yt-search__clear:hover {
  background: var(--yt-hover);
}

.yt-search__clear .icon {
  width: 20px;
  height: 20px;
}

.yt-search__clear[hidden] {
  display: none;
}

.yt-search__submit {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 40px;
  border: 1px solid var(--yt-border);
  border-radius: 0 40px 40px 0;
  background: var(--yt-search-btn);
}

.yt-search__submit:hover {
  background: var(--yt-search-btn-hover);
}

.yt-search.is-error .yt-search__box {
  border-color: var(--yt-error);
}

@keyframes yt-shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(2px);
  }
}

.yt-search.is-shaking {
  animation: yt-shake 0.4s ease;
}

/* Error message, styled like a YouTube tooltip */
.yt-search__error {
  position: absolute;
  top: calc(100% + 8px);
  left: 32px;
  z-index: 30;
  max-width: min(440px, calc(100vw - 32px));
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--yt-tooltip);
  color: #ffffff;
  font: 400 13px/18px var(--yt-font);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* "Sign in"-style button, used for Lock */
.yt-signin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px 0 11px;
  border: 1px solid var(--yt-signin-border);
  border-radius: 18px;
  color: var(--yt-blue);
  font: 500 14px/34px var(--yt-font);
  white-space: nowrap;
  transition: background-color 0.1s ease;
}

.yt-signin:hover {
  border-color: transparent;
  background: var(--yt-signin-hover);
}

/* ---------- Mini guide (desktop) / bottom bar (phones) ---------- */
.yt-rail {
  display: none;
}

.yt-rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 64px;
  height: 74px;
  padding: 16px 0 14px;
  border-radius: 10px;
  color: var(--yt-text);
  font: 400 10px/14px var(--yt-font);
}

.yt-rail__item:hover {
  background: var(--yt-hover);
}

.yt-rail__item .icon {
  width: 24px;
  height: 24px;
}

/* Filled icons for the current page and for Private mode when it's on. Details inside an
   icon (the clock's hands, the play triangle) take the colour behind it, like a cut-out. */
.yt-rail__item.is-active .icon,
.yt-guide__item.is-active .icon,
.yt-rail__item[aria-pressed="true"] .icon {
  fill: currentColor;
  --icon-cutout: var(--yt-bg);
}

.yt-guide__item.is-active .icon {
  --icon-cutout: var(--yt-tonal-solid);
}

/* ---------- Page ---------- */
.yt-page {
  min-height: calc(100% - var(--yt-masthead));
}

.yt-home {
  padding: 0 24px 48px;
}

/* Filter chips */
.yt-chips {
  position: sticky;
  top: var(--yt-masthead);
  z-index: 5;
  display: flex;
  gap: 12px;
  padding: 12px 0;
  overflow-x: auto;
  background: var(--yt-bg);
  scrollbar-width: none;
}

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

.yt-chip {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--yt-tonal);
  color: var(--yt-text);
  font: 500 14px/32px var(--yt-font);
  white-space: nowrap;
  transition: background-color 0.1s ease;
}

.yt-chip:hover {
  background: var(--yt-tonal-hover);
}

.yt-chip[aria-pressed="true"] {
  background: var(--yt-text);
  color: var(--yt-bg);
}

/* Video grid */
.yt-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 40px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.yt-feed-note,
.yt-upnext__note {
  padding: 48px 16px;
  color: var(--yt-text-2);
  text-align: center;
}

.yt-upnext__note {
  padding: 8px 0;
  text-align: left;
}

/* ---------- Video cards ---------- */
.yt-card {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.yt-card__thumb {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.yt-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--yt-thumb-bg);
}

.yt-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* hqdefault has black bars top and bottom: zoom in a touch so no sliver of them shows */
.yt-thumb img.is-letterboxed {
  transform: scale(1.02);
}

.yt-thumb__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--yt-text-2);
}

.yt-thumb__placeholder .icon {
  width: 36%;
  max-width: 48px;
  height: auto;
  aspect-ratio: 1;
}

.yt-thumb__badge {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 8px;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #ffffff;
  font: 500 12px/18px var(--yt-font);
}

.yt-thumb__badge .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.yt-thumb__badge--live {
  background: #cc0000;
}

.yt-card__body {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 12px 24px 0 0;
}

.yt-card__text {
  flex: 1;
  min-width: 0;
}

.yt-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: 44px;
  margin-bottom: 4px;
  color: var(--yt-text);
  font: 500 16px/22px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-card__channel,
.yt-card__meta {
  overflow: hidden;
  color: var(--yt-text-2);
  font: 400 14px/20px var(--yt-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-card__menu {
  position: absolute;
  top: 6px;
  right: -12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--yt-text);
  opacity: 0;
  transition: opacity 0.1s ease, background-color 0.1s ease;
}

.yt-card__menu:hover {
  background: var(--yt-hover);
}

.yt-card__menu .icon {
  width: 20px;
  height: 20px;
}

.yt-card:hover .yt-card__menu,
.yt-card:focus-within .yt-card__menu,
.yt-plitem:hover .yt-card__menu,
.yt-plitem:focus-within .yt-card__menu,
.yt-card__menu[aria-expanded="true"] {
  opacity: 1;
}

/* Avatars: a letter on a colour, like YouTube's default channel pictures */
.yt-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--avatar-bg, #ff0033);
  color: #ffffff;
  font: 500 16px/1 var(--yt-font);
  text-transform: uppercase;
  -webkit-user-select: none;
  user-select: none;
}

.yt-avatar .icon {
  width: 42%;
  height: 42%;
  margin-left: 6%;
}

.yt-avatar--40 {
  width: 40px;
  height: 40px;
  font-size: 18px;
}

/* Compact cards (the list next to the player) */
.yt-upnext {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yt-card--compact {
  display: flex;
  gap: 8px;
}

.yt-card--compact .yt-card__thumb {
  flex: none;
  width: 168px;
  border-radius: 8px;
}

.yt-card--compact .yt-thumb {
  border-radius: 8px;
}

.yt-card--compact .yt-thumb__badge {
  margin: 4px;
}

.yt-card--compact .yt-card__body {
  flex: 1;
  min-width: 0;
  padding: 0 24px 0 0;
}

.yt-card--compact .yt-card__title {
  max-height: 40px;
  font: 500 14px/20px var(--yt-font);
}

.yt-card--compact .yt-card__channel,
.yt-card--compact .yt-card__meta {
  font: 400 12px/18px var(--yt-font);
}

.yt-card--compact .yt-card__menu {
  top: -6px;
}

/* Empty home */
.yt-empty {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--yt-masthead) - 48px);
  min-height: calc(100dvh - var(--yt-masthead) - 48px);
  padding: 24px 0;
}

.yt-empty__card {
  max-width: 560px;
  padding: 28px 32px 32px;
  border-radius: 12px;
  background: var(--yt-tonal);
  text-align: center;
}

.yt-empty__title {
  margin-bottom: 8px;
  font: 700 20px/28px var(--yt-font);
}

.yt-empty__text {
  margin-bottom: 20px;
  color: var(--yt-text-2);
}

/* ---------- Watch page ---------- */
.yt-watch {
  display: flex;
  justify-content: center;
  gap: 24px;
  max-width: 1754px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.yt-watch__primary {
  flex: 1 1 0;
  min-width: 0;
  /* Like YouTube: the player never gets taller than the window allows */
  max-width: max(480px, calc((100vh - var(--yt-masthead) - 24px - 136px) * 16 / 9));
  max-width: max(480px, calc((100dvh - var(--yt-masthead) - 24px - 136px) * 16 / 9));
}

.yt-watch__secondary {
  flex: 0 0 402px;
  min-width: 0;
}

.yt-player {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #000000;
}

.yt-player.is-short {
  aspect-ratio: 9 / 16;
  width: min(100%, calc((100vh - var(--yt-masthead) - 48px) * 9 / 16));
  width: min(100%, calc((100dvh - var(--yt-masthead) - 48px) * 9 / 16));
  margin: 0 auto;
}

.yt-player__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-watch__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 12px;
  font: 700 20px/28px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.yt-owner__channel {
  display: flex;
  align-items: center;
  min-width: 0;
}

.yt-owner__channel .yt-avatar {
  margin-right: 12px;
}

.yt-owner__text {
  min-width: 0;
  margin-right: 24px;
}

.yt-owner__name {
  overflow: hidden;
  font: 500 16px/22px var(--yt-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-owner__sub {
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
  white-space: nowrap;
}

.yt-actions {
  display: flex;
  gap: 8px;
}

.yt-desc {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--yt-tonal);
}

.yt-desc__meta {
  font-weight: 500;
}

.yt-desc__line {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.yt-desc__link {
  color: var(--yt-blue);
  text-decoration: none;
}

.yt-desc__link:hover {
  text-decoration: underline;
}

.yt-watch__heading {
  margin-bottom: 12px;
  font: 700 16px/22px var(--yt-font);
}

/* ---------- Settings menu ---------- */
.yt-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
}

.yt-menu {
  position: fixed;
  z-index: 40;
  width: 300px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 72px);
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  padding: 8px 0;
  border-radius: 12px;
  background: var(--yt-menu-bg);
  color: var(--yt-text);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.1);
}

.vault[data-yt-theme="dark"] .yt-menu {
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
}

.yt-menu__item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 40px;
  padding: 0 16px;
  font: 400 14px/20px var(--yt-font);
}

.yt-menu__item:hover,
.yt-menu__item:focus-visible {
  background: var(--yt-hover);
  outline: 0;
}

.yt-menu__label {
  flex: 1;
  min-width: 0;
}

.yt-menu__chevron {
  margin-right: -4px;
}

.yt-menu__check {
  visibility: hidden;
}

.yt-menu__item[aria-pressed="true"] .yt-menu__check {
  visibility: visible;
}

.yt-menu__divider {
  height: 1px;
  margin: 8px 0;
  border: 0;
  background: var(--yt-divider);
}

.yt-menu__hint {
  padding: 4px 16px;
  color: var(--yt-text-2);
  font: 400 12px/24px var(--yt-font);
}

.yt-menu__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--yt-divider);
  font: 400 16px/22px var(--yt-font);
}

.yt-menu__note {
  padding: 12px 16px 8px;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
}

/* ---------- Side menu ---------- */
.yt-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--yt-scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.yt-guide {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 51;
  display: flex;
  flex-direction: column;
  width: 240px;
  padding: 0 12px 12px;
  overflow-y: auto;
  background: var(--yt-bg);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}

.vault.is-guide-open .yt-scrim {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease;
}

.vault.is-guide-open .yt-guide {
  transform: none;
  visibility: visible;
  transition: transform 0.25s var(--ease-out);
}

.yt-guide__head {
  display: flex;
  align-items: center;
  flex: none;
  height: var(--yt-masthead);
  margin-right: -12px; /* the logo needs the menu's right padding too */
  padding-left: 4px;
}

/* Same position as the masthead logo (so it doesn't move when the menu opens), with a tighter right
   edge so the long name, its hover background and its focus ring all fit inside the 240px menu. */
.yt-guide__head .yt-logo {
  padding-right: 6px;
}

.yt-guide__section {
  padding: 12px 0;
  border-bottom: 1px solid var(--yt-divider);
}

.yt-guide__section:last-of-type {
  border-bottom: 0;
}

.yt-guide__title {
  padding: 6px 12px 4px;
  font: 700 16px/22px var(--yt-font);
}

.yt-guide__item {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font: 400 14px/20px var(--yt-font);
}

.yt-guide__item:hover {
  background: var(--yt-hover);
}

.yt-guide__item.is-active {
  background: var(--yt-tonal);
  font-weight: 500;
}

.yt-guide__aside {
  margin-left: auto;
  color: var(--yt-text-2);
  font-size: 12px;
}

.yt-guide__footer {
  margin-top: auto;
  padding: 16px 12px 4px;
  color: var(--yt-text-3);
  font: 400 12px/18px var(--yt-font);
}

/* ---------- Snackbar ---------- */
.yt-snackbar {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 288px;
  max-width: min(568px, calc(100vw - 24px));
  min-height: 48px;
  padding: 6px 8px 6px 16px;
  border-radius: 8px;
  background: var(--yt-snack-bg);
  color: var(--yt-snack-text);
  font: 400 14px/20px var(--yt-font);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(calc(100% + 40px));
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}

.yt-snackbar.is-visible {
  transform: none;
  visibility: visible;
  transition: transform 0.25s var(--ease-out);
}

.yt-snackbar__text {
  flex: 1;
  padding: 8px 0;
}

.yt-snackbar__action {
  flex: none;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  color: var(--yt-snack-action);
  font: 500 14px/36px var(--yt-font);
  white-space: nowrap;
}

.yt-snackbar__action:hover {
  background: var(--yt-snack-action-hover);
}

.yt-snackbar__action[hidden] {
  display: none;
}

/* ---------- More buttons ---------- */
.yt-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.yt-btn--icon {
  width: 36px;
  padding: 0;
}

.yt-btn--icon .icon {
  margin: 0;
}

.yt-btn--outline {
  border: 1px solid var(--yt-border);
  background: transparent;
  line-height: 34px;
}

.yt-btn--outline:hover {
  background: var(--yt-hover);
}

.yt-btn--white {
  background: #ffffff;
  color: #0f0f0f;
}

.yt-btn--white:hover {
  background: #d9d9d9;
}

.yt-btn--glass,
.yt-icon-btn--glass {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.yt-btn--glass:hover,
.yt-icon-btn--glass:hover {
  background: rgba(255, 255, 255, 0.2);
}

.yt-btn--text {
  background: transparent;
  color: var(--yt-blue);
}

.yt-btn--text:hover {
  background: var(--yt-blue-tint);
}

.yt-btn--text:disabled {
  background: transparent;
  color: var(--yt-text-3);
  opacity: 1;
}

/* Like, when it's on */
.yt-btn[aria-pressed="true"] .icon {
  fill: currentColor;
}

/* Red bar under the thumbnail of a video you've started */
.yt-thumb__progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: rgba(170, 170, 170, 0.6);
}

.yt-thumb__progress > span {
  display: block;
  height: 100%;
  background: var(--yt-red);
}

/* ---------- You ---------- */
.yt-library {
  max-width: 1310px;
  padding: 24px 24px 48px;
}

.yt-you {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yt-you__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff4d6d, #c4002b);
  color: #ffffff;
}

.yt-you__avatar .icon {
  width: 34px;
  height: 34px;
  stroke-width: 1.6;
}

.yt-you__text {
  min-width: 0;
}

.yt-you__title {
  font: 700 36px/48px var(--yt-font);
}

.yt-you__sub {
  color: var(--yt-text-2);
}

.yt-shelf {
  padding-top: 28px;
}

.yt-shelf__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 12px;
}

.yt-shelf__title {
  font: 700 20px/28px var(--yt-font);
}

.yt-shelf__row {
  display: grid;
  grid-auto-columns: 210px;
  grid-auto-flow: column;
  gap: 8px;
  margin: 0;
  padding: 0 0 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  list-style: none;
  scrollbar-width: thin;
}

.yt-shelf__empty {
  color: var(--yt-text-2);
}

.yt-shelf__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.yt-backup .yt-shelf__title {
  margin-bottom: 4px;
}

.yt-backup__text {
  max-width: 640px;
  margin-bottom: 16px;
  color: var(--yt-text-2);
}

.yt-backup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Smaller cards in the History shelf */
.yt-card--shelf .yt-card__body {
  padding: 8px 24px 0 0;
}

.yt-card--shelf .yt-card__title {
  max-height: 40px;
  font: 500 14px/20px var(--yt-font);
}

.yt-card--shelf .yt-card__channel,
.yt-card--shelf .yt-card__meta {
  font: 400 12px/18px var(--yt-font);
}

.yt-card--shelf .yt-card__menu {
  top: 0;
}

/* Playlist cards, with YouTube's stacked look */
.yt-plcard {
  min-width: 0;
  cursor: pointer;
}

.yt-plcard__thumb {
  display: block;
  width: 100%;
  padding-top: 8px;
  border-radius: 12px;
}

.yt-plcard__stack {
  position: relative;
  display: block;
}

.yt-plcard__stack::before,
.yt-plcard__stack::after {
  content: "";
  position: absolute;
  height: 4px;
  border-radius: 6px 6px 0 0;
}

.yt-plcard__stack::before {
  top: -4px;
  right: 8px;
  left: 8px;
  background: var(--yt-stack-1);
}

.yt-plcard__stack::after {
  top: -8px;
  right: 16px;
  left: 16px;
  background: var(--yt-stack-2);
}

.yt-plcard__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 12px;
  font: 500 14px/20px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-plcard__meta,
.yt-plcard__link {
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
}

.yt-plcard__meta {
  margin-top: 4px;
}

.yt-plcard__link {
  font-weight: 500;
}

.yt-plcard:hover .yt-plcard__link {
  color: var(--yt-text);
}

/* ---------- Playlist page ---------- */
.yt-plpage {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 24px 48px;
}

.yt-plhero {
  position: sticky;
  top: calc(var(--yt-masthead) + 24px);
  flex: 0 0 360px;
  overflow: hidden;
  height: calc(100vh - var(--yt-masthead) - 48px);
  height: calc(100dvh - var(--yt-masthead) - 48px);
  min-height: 500px;
  border-radius: 16px;
  background: #3b3b3b;
  color: #ffffff;
  isolation: isolate;
}

/* A blurred, scaled-up copy of the first thumbnail, like YouTube's colour wash */
.yt-plhero__bg {
  position: absolute;
  inset: -25%;
  z-index: -2;
  background-position: center;
  background-size: cover;
  filter: blur(40px) saturate(1.6);
}

.yt-plhero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.5) 55%, rgba(0, 0, 0, 0.68));
}

.yt-plhero__content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  scrollbar-width: none;
}

.yt-plhero__thumb {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.yt-plhero__thumb:disabled {
  cursor: default;
}

.yt-plhero__thumb .yt-thumb {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.yt-plhero__info {
  min-width: 0;
}

.yt-plhero__title {
  margin-top: 24px;
  font: 700 28px/38px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-plhero__meta {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.72);
  font: 400 12px/18px var(--yt-font);
}

.yt-plhero__meta strong {
  color: #ffffff;
  font-weight: 500;
}

.yt-plhero__tools {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.yt-plhero__tools[hidden] {
  display: none;
}

.yt-plhero__play {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.yt-plhero__play .yt-btn {
  flex: 1;
}

.yt-pllist {
  flex: 1;
  min-width: 0;
}

.yt-plitems {
  margin: 0;
  padding: 0;
  list-style: none;
}

.yt-plitem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 48px 8px 0;
  border-radius: 12px;
  cursor: pointer;
}

.yt-plitem:hover {
  background: var(--yt-hover);
}

.yt-plitem__index {
  flex: 0 0 32px;
  color: var(--yt-text-2);
  text-align: center;
}

.yt-plitem__thumb {
  flex: 0 0 160px;
  width: 160px;
  border-radius: 8px;
}

.yt-plitem__thumb .yt-thumb {
  border-radius: 8px;
}

.yt-plitem__thumb .yt-thumb__badge {
  margin: 4px;
}

.yt-plitem__text {
  flex: 1;
  min-width: 0;
}

.yt-plitem__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: 44px;
  margin-bottom: 4px;
  font: 500 16px/22px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-plitem__meta {
  overflow: hidden;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-plitem .yt-card__menu {
  top: calc(50% - 18px);
  right: 4px;
}

.yt-plempty {
  padding: 64px 16px;
  color: var(--yt-text-2);
  text-align: center;
}

.yt-plempty__title {
  margin-bottom: 4px;
  color: var(--yt-text);
  font: 500 16px/22px var(--yt-font);
}

/* ---------- Playlist panel on the watch page ---------- */
.yt-queue {
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--yt-border);
  border-radius: 12px;
}

.yt-queue__head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 8px 16px;
}

.yt-queue__heading {
  flex: 1;
  min-width: 0;
}

.yt-queue__title {
  overflow: hidden;
  font: 700 20px/28px var(--yt-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-queue__sub {
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
}

.yt-queue__head .yt-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.yt-queue__items {
  position: relative;
  max-height: 400px;
  margin: 0;
  padding: 0 0 8px;
  overflow-y: auto;
  list-style: none;
}

.yt-qitem__button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 12px 4px 0;
}

.yt-qitem__button:hover {
  background: var(--yt-hover);
}

.yt-qitem.is-current .yt-qitem__button {
  background: var(--yt-tonal);
}

.yt-qitem__index {
  flex: 0 0 24px;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
  text-align: center;
}

.yt-qitem__index .icon {
  width: 12px;
  height: 12px;
  vertical-align: -1px;
}

.yt-qitem .yt-thumb {
  flex: 0 0 100px;
  width: 100px;
  border-radius: 8px;
}

.yt-qitem .yt-thumb__badge {
  margin: 4px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 16px;
}

.yt-qitem__text {
  display: block;
  flex: 1;
  min-width: 0;
}

.yt-qitem__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: 40px;
  font: 500 14px/20px var(--yt-font);
  overflow-wrap: anywhere;
}

.yt-qitem__channel {
  display: block;
  overflow: hidden;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Video ⋮ menu ---------- */
.yt-popup {
  width: max-content;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 16px));
}

.yt-popup .yt-menu__label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-menu-backdrop.is-dim {
  background: var(--yt-scrim);
}

@keyframes yt-sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

/* On phones it slides up from the bottom, like the app */
.yt-popup.is-sheet {
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  max-width: none;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  border-radius: 12px 12px 0 0;
  animation: yt-sheet-up 0.2s var(--ease-out);
}

.yt-popup.is-sheet .yt-menu__item {
  min-height: 48px;
}

/* ---------- Dialogs ---------- */
.yt-dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: var(--yt-scrim);
  animation: yt-fade 0.15s ease;
}

@keyframes yt-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.yt-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 55;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  border-radius: 12px;
  background: var(--yt-menu-bg);
  color: var(--yt-text);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  animation: yt-pop 0.15s var(--ease-out);
}

.yt-dialog[hidden] {
  display: none;
}

.yt-save {
  width: min(340px, calc(100vw - 32px));
}

.yt-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 4px 24px;
}

.yt-dialog__title {
  font: 400 16px/22px var(--yt-font);
}

.yt-save__list {
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
}

.yt-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  padding: 0 24px;
  cursor: pointer;
}

.yt-check:hover {
  background: var(--yt-hover);
}

.yt-check__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.yt-check__box {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--yt-text);
  border-radius: 3px;
}

.yt-check__box .icon {
  width: 16px;
  height: 16px;
  stroke-width: 3;
  visibility: hidden;
}

.yt-check__input:checked + .yt-check__box {
  background: var(--yt-text);
  color: var(--yt-menu-bg);
}

.yt-check__input:checked + .yt-check__box .icon {
  visibility: visible;
}

.yt-check__input:focus-visible + .yt-check__box {
  outline: 2px solid var(--yt-blue);
  outline-offset: 2px;
}

.yt-check__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.yt-check > .icon {
  width: 18px;
  height: 18px;
  color: var(--yt-text-2);
}

.yt-save__new {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  padding: 0 24px;
  border-top: 1px solid var(--yt-divider);
}

.yt-save__new:hover {
  background: var(--yt-hover);
}

.yt-save__new[hidden] {
  display: none;
}

.yt-save__form {
  padding: 16px 24px 12px;
  border-top: 1px solid var(--yt-divider);
}

.yt-field {
  display: block;
}

.yt-field__label {
  display: block;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
}

.yt-field__input {
  display: block;
  width: 100%;
  padding: 4px 0 6px;
  border: 0;
  border-bottom: 1px solid var(--yt-text-3);
  border-radius: 0;
  background: transparent;
  color: var(--yt-text);
  font: 400 15px/22px var(--yt-font);
  outline: 0;
}

.yt-field__input:focus {
  border-bottom-color: var(--yt-blue);
  box-shadow: 0 1px 0 var(--yt-blue);
}

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

.yt-field__foot {
  margin-top: 4px;
  color: var(--yt-text-2);
  font: 400 12px/18px var(--yt-font);
  text-align: right;
}

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

.yt-namebox form {
  padding: 20px 24px 16px;
}

.yt-namebox__title {
  margin-bottom: 20px;
  font: 700 20px/28px var(--yt-font);
}

/* ---------- Full screen ---------- */
.yt-player:fullscreen {
  border-radius: 0;
}

.yt-player:-webkit-full-screen {
  border-radius: 0;
}

/* The fallback when real full screen isn't allowed: the player fills the window */
.yt-fwbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 48px;
  padding: 0 16px 0 8px;
  background: #000000;
  color: #ffffff;
}

.yt-fwbar[hidden] {
  display: none;
}

.yt-fwbar__exit {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border-radius: 18px;
  color: #ffffff;
  font: 500 14px/36px var(--yt-font);
}

.yt-fwbar__exit:hover {
  background: rgba(255, 255, 255, 0.15);
}

.yt-fwbar__exit:focus-visible {
  outline-color: #ffffff;
}

.yt-fwbar__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.vault.is-fullwindow {
  overflow: hidden;
}

/* Over the video, messages are always light, so they stand out from it */
.vault.is-fullwindow .yt-snackbar {
  --yt-snack-bg: #f1f1f1;
  --yt-snack-text: #0f0f0f;
  --yt-snack-action: #065fd4;
  --yt-snack-action-hover: rgba(6, 95, 212, 0.1);
}

.vault.is-fullwindow .yt-player {
  position: fixed;
  top: 48px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 31;
  width: auto;
  max-width: none;
  margin: 0;
  border-radius: 0;
  aspect-ratio: auto;
}

/* ==========================================================================
   Layouts
   ========================================================================== */

/* Mini guide down the left on the home page */
@media (min-width: 792px) {
  .vault:not(.is-watching) .yt-rail {
    position: fixed;
    top: var(--yt-masthead);
    bottom: 0;
    left: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 72px;
    padding: 4px;
    background: var(--yt-bg);
  }

  .vault:not(.is-watching) .yt-view {
    margin-left: 72px;
  }
}

/* One column on the watch page */
@media (max-width: 1015px) {
  .yt-watch {
    flex-direction: column;
    justify-content: flex-start;
  }

  .yt-watch__primary {
    flex: none;
    max-width: none;
  }

  .yt-watch__secondary {
    flex: none;
  }
}

/* Phones and small tablets: the shortcuts become a bottom bar */
@media (max-width: 791px) {
  .vault:not(.is-watching) .yt-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    height: calc(48px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--yt-divider);
    background: var(--yt-bg);
  }

  .yt-rail__item {
    flex: 1;
    gap: 2px;
    width: auto;
    height: 48px;
    padding: 0;
    border-radius: 0;
  }

  .vault:not(.is-watching) .yt-view {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .vault:not(.is-watching) .yt-snackbar {
    bottom: calc(60px + env(safe-area-inset-bottom));
  }

  .yt-feed {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Phones */
@media (max-width: 656px) {
  .vault {
    --yt-masthead: 48px;
  }

  .yt-masthead {
    gap: 4px;
    padding: 0 4px 0 12px;
  }

  .yt-masthead__guide,
  .yt-masthead__paste,
  .yt-masthead__center {
    display: none;
  }

  .yt-masthead__end {
    gap: 0;
  }

  .yt-masthead__search {
    display: inline-grid;
  }

  .yt-logo {
    padding: 0 8px 0 0;
  }

  .yt-signin {
    margin-left: 4px;
  }

  /* Tapping the search icon turns the bar into a full-width link box */
  .vault.is-search-open .yt-masthead__start,
  .vault.is-search-open .yt-masthead__end {
    display: none;
  }

  .vault.is-search-open .yt-masthead__center {
    display: flex;
    flex: 1;
    gap: 4px;
    padding-right: 8px;
  }

  .vault.is-search-open .yt-masthead__back {
    display: inline-grid;
    margin-left: -8px;
  }

  .yt-search {
    height: 36px;
  }

  .yt-search__box,
  .yt-search__box:focus-within {
    margin-left: 0;
    padding-left: 14px;
  }

  .yt-search__box:focus-within .yt-search__lead {
    display: none;
  }

  .yt-search__submit {
    width: 48px;
    height: 36px;
  }

  .yt-search__error {
    left: 0;
  }

  .yt-home {
    padding: 0 0 48px;
  }

  .yt-chips {
    padding: 12px;
  }

  /* Full-width cards, like the YouTube app */
  .yt-feed {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 0;
  }

  .yt-feed .yt-card__thumb,
  .yt-feed .yt-thumb {
    border-radius: 0;
  }

  .yt-feed .yt-card__body {
    padding: 12px 36px 0 12px;
  }

  .yt-feed .yt-card__menu {
    right: 0;
  }

  .yt-card__title {
    font-size: 15px;
    line-height: 21px;
    max-height: 42px;
  }

  .yt-card__channel,
  .yt-card__meta {
    font-size: 12px;
    line-height: 18px;
  }

  .yt-empty {
    padding: 24px 12px;
  }

  .yt-empty__card {
    padding: 24px 20px;
  }

  .yt-watch {
    gap: 16px;
    padding: 0 0 32px;
  }

  .yt-player {
    border-radius: 0;
  }

  .yt-player.is-short {
    width: min(100% - 48px, calc((100vh - var(--yt-masthead) - 200px) * 9 / 16));
    width: min(100% - 48px, calc((100dvh - var(--yt-masthead) - 200px) * 9 / 16));
    margin-top: 12px;
    border-radius: 12px;
  }

  .yt-watch__title,
  .yt-owner,
  .yt-desc,
  .yt-watch__secondary {
    margin-left: 12px;
    margin-right: 12px;
  }

  .yt-watch__title {
    font-size: 18px;
    line-height: 26px;
  }

  .yt-owner {
    flex-direction: column;
    align-items: stretch;
  }

  .yt-owner__channel .yt-btn {
    margin-left: auto;
  }

  .yt-actions {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .yt-snackbar {
    left: 8px;
    right: 8px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
  }

  .yt-card--compact .yt-card__thumb {
    width: 160px;
  }
}

@media (max-width: 380px) {
  .yt-signin span {
    display: none;
  }

  .yt-signin {
    padding: 0 7px;
  }

  .yt-card--compact .yt-card__thumb {
    width: 136px;
  }
}

/* Library pages on narrower screens */
@media (max-width: 1015px) {
  .yt-plpage {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 0 48px;
  }

  .yt-plhero {
    position: relative;
    top: auto;
    flex: none;
    height: auto;
    min-height: 0;
    border-radius: 0;
  }

  .yt-plhero__content {
    flex-direction: row;
    align-items: center;
    gap: 24px;
    height: auto;
  }

  .yt-plhero__thumb {
    flex: 0 0 300px;
    width: 300px;
  }

  .yt-plhero__info {
    flex: 1;
  }

  .yt-plhero__title {
    margin-top: 0;
  }

  .yt-pllist {
    padding: 8px 24px 0;
  }

  .yt-queue__items {
    max-height: 320px;
  }
}

@media (max-width: 656px) {
  .yt-library {
    padding: 16px 12px 48px;
  }

  .yt-you__avatar {
    width: 56px;
    height: 56px;
  }

  .yt-you__avatar .icon {
    width: 28px;
    height: 28px;
  }

  .yt-you__title {
    font-size: 28px;
    line-height: 36px;
  }

  .yt-shelf {
    padding-top: 24px;
  }

  .yt-shelf__row {
    grid-auto-columns: 160px;
    margin: 0 -12px;
    padding: 0 12px 6px;
    scroll-padding: 0 12px;
  }

  .yt-shelf__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
  }

  .yt-plhero__content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px 16px 20px;
  }

  .yt-plhero__thumb {
    flex: none;
    width: min(100%, 360px);
    margin: 0 auto;
  }

  .yt-plhero__title {
    font-size: 24px;
    line-height: 32px;
  }

  .yt-pllist {
    padding: 8px 0 0;
  }

  .yt-plitem {
    gap: 12px;
    padding: 6px 40px 6px 12px;
    border-radius: 0;
  }

  .yt-plitem__index {
    display: none;
  }

  .yt-plitem__thumb {
    flex-basis: 136px;
    width: 136px;
  }

  .yt-plitem__title {
    max-height: 40px;
    font-size: 14px;
    line-height: 20px;
  }

  .yt-queue {
    margin-bottom: 16px;
  }

  /* Dialogs become bottom sheets */
  .yt-dialog {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: 85vh;
    max-height: 85dvh;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 12px 12px 0 0;
    transform: none;
    animation: yt-sheet-up 0.2s var(--ease-out);
  }

  .yt-fwbar {
    padding-right: 12px;
  }
}

/* Touch screens: no hover, so keep ⋮ buttons visible and hide keyboard tips */
@media (hover: none) {
  .yt-card__menu {
    opacity: 1;
  }

  .yt-menu__keys {
    display: none;
  }
}
