/* YouTube-style shell (header, guide drawer, chips, dialogs) */
:root {
  --yt-bg: #0f0f0f;
  --yt-elev: #212121;
  --yt-elev-2: #282828;
  --yt-text: #f1f1f1;
  --yt-text-dim: #aaaaaa;
  --yt-border: rgba(255, 255, 255, 0.12);
  --yt-header-h: 56px;
  --yt-chips-h: 56px;
}

html.yt-shell-on,
html.yt-shell-on body {
  background: var(--yt-bg) !important;
}

html.yt-shell-on body {
  padding-top: calc(var(--yt-header-h) + var(--yt-chips-h));
}

html.yt-shell-locked {
  overflow: hidden;
}

.yt-shell,
.yt-shell * {
  box-sizing: border-box;
  font-family: "Roboto", "Arial", system-ui, -apple-system, sans-serif;
}

/* ---------- Header ---------- */
.yt-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--yt-header-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--yt-bg);
  color: var(--yt-text);
  z-index: 2147483000;
}

.yt-header__left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.yt-header__right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.yt-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--yt-text);
  cursor: pointer;
  padding: 0;
  flex: none;
}

.yt-iconbtn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.yt-iconbtn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.yt-logo {
  display: inline-flex;
  align-items: flex-start;
  gap: 2px;
  margin-left: 6px;
  text-decoration: none;
  color: var(--yt-text);
}

.yt-logo svg {
  height: 20px;
  display: block;
}

.yt-logo__word {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -1.2px;
  line-height: 20px;
  color: var(--yt-text);
}

.yt-logo__cc {
  font-size: 10px;
  line-height: 1;
  color: var(--yt-text-dim);
  margin-top: -2px;
}

.yt-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 18px;
  background: var(--yt-elev);
  color: var(--yt-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.yt-create:hover {
  background: var(--yt-elev-2);
}

.yt-create svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.yt-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  margin-inline-end: 2px;
  border-radius: 50%;
  overflow: hidden;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: #3ea6ff;
  color: #0f0f0f;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  flex: none;
}

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

/* ---------- Search bar ---------- */
.yt-searchbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--yt-header-h);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: var(--yt-bg);
  z-index: 2147483001;
}

.yt-searchbar.is-open {
  display: flex;
}

.yt-searchbar form {
  flex: 1;
  display: flex;
  align-items: center;
  height: 40px;
  border: 1px solid var(--yt-border);
  border-radius: 20px;
  overflow: hidden;
  background: #121212;
}

.yt-searchbar input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--yt-text);
  font-size: 15px;
  padding: 0 16px;
}

/* ---------- Chips ---------- */
.yt-chips {
  position: fixed;
  top: var(--yt-header-h);
  left: 0;
  right: 0;
  height: var(--yt-chips-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--yt-bg);
  z-index: 2147482999;
}

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

.yt-chip {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--yt-elev);
  color: var(--yt-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.yt-chip.is-active {
  background: #f1f1f1;
  color: #0f0f0f;
}

/* ---------- Guide drawer ---------- */
.yt-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2147483100;
}

.yt-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.yt-guide {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 240px;
  max-width: 84vw;
  background: var(--yt-bg);
  color: var(--yt-text);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 2147483200;
  overflow-y: auto;
  padding-bottom: 24px;
}

.yt-guide.is-open {
  transform: translateX(0);
}

.yt-guide__head {
  display: flex;
  align-items: center;
  height: var(--yt-header-h);
  padding: 0 16px;
  gap: 4px;
}

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

.yt-guide__section:first-of-type {
  border-top: 0;
}

.yt-guide__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 24px 12px;
  margin: 0;
}

.yt-guide__item {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--yt-text);
  font-size: 14px;
  text-align: left;
  padding: 0 12px;
  height: 40px;
  margin: 0 12px;
  width: calc(100% - 24px);
  border-radius: 10px;
  cursor: pointer;
}

.yt-guide__item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  flex: none;
}

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

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

.yt-guide__item.is-disabled {
  color: #5f5f5f;
  opacity: 0.55;
}

.yt-guide__empty {
  color: var(--yt-text-dim);
  font-size: 13px;
  padding: 4px 24px 8px;
  margin: 0;
}

/* ---------- Toast ---------- */
.yt-toast {
  position: fixed;
  left: 50%;
  top: calc(var(--yt-header-h) + var(--yt-chips-h) + 12px);
  transform: translate(-50%, -12px);
  max-width: min(420px, calc(100vw - 32px));
  background: var(--yt-elev-2);
  color: var(--yt-text);
  font-size: 14px;
  line-height: 1.4;
  padding: 14px 18px;
  padding-right: 30px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2147483300;
  text-align: center;
}

.yt-toast.is-open {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.yt-toast__msg {
  display: block;
  min-width: 0;
}

.yt-toast__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--yt-text);
  opacity: 0.45;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.yt-toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
  opacity: 0.9;
}

.yt-toast__close:active {
  transform: scale(0.9);
}

/* Guide drawer: safe bottom room, crisp edges */
.yt-guide {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 16px 16px 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ---------- Account sheet ---------- */
.yt-sheet {
  position: fixed;
  top: calc(var(--yt-header-h) + 4px);
  right: 12px;
  width: min(320px, calc(100vw - 24px));
  background: var(--yt-elev);
  color: var(--yt-text);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  padding: 20px;
  display: none;
  z-index: 2147483250;
}

.yt-sheet.is-open {
  display: block;
}

.yt-sheet__title {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 6px;
}

.yt-sheet__text {
  font-size: 13px;
  color: var(--yt-text-dim);
  margin: 0 0 16px;
}

.yt-gbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  border: 1px solid var(--yt-border);
  border-radius: 21px;
  background: #fff;
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.yt-gbtn:hover {
  background: #f2f2f2;
}

.yt-gbtn svg {
  width: 18px;
  height: 18px;
}

.yt-sheet__user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.yt-sheet__user img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.yt-sheet__name {
  font-size: 14px;
  font-weight: 500;
}

.yt-sheet__mail {
  font-size: 12px;
  color: var(--yt-text-dim);
}

.yt-linkbtn {
  border: 0;
  background: transparent;
  color: #3ea6ff;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

@media (max-width: 640px) {
  .yt-header {
    padding: 0 8px;
    gap: 4px;
  }

  .yt-create span {
    display: none;
  }

  .yt-create {
    padding: 0 10px;
  }

  .yt-iconbtn {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 420px) {
  .yt-logo__word {
    display: none;
  }

  .yt-create {
    display: none;
  }
}
/* ---------------- Floating bottom navigation ---------------- */
.yt-bottomnav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 14px;
  z-index: 2147483300;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 15, 15, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  font-family: "Roboto", Arial, sans-serif;
}

.yt-navitem {
  flex: 1 1 0;
  min-width: 0;
  background: transparent;
  border: 0;
  color: #aaaaaa;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.yt-navitem:hover {
  background: #3f3f3f;
}

.yt-navitem.is-active {
  color: #ffffff;
}

.yt-navitem__icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  display: block;
}

.yt-navitem--create .yt-navitem__icon {
  width: 44px;
  height: 30px;
  border-radius: 999px;
  background: #272727;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.yt-navitem--create .yt-navitem__icon svg {
  stroke: currentColor;
  fill: none;
}

.yt-navitem__label {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.yt-navavatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  background: #3f3f3f;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f1f1f1;
}

.yt-navavatar img { width: 100%; height: 100%; object-fit: cover; }
.yt-navavatar svg { width: 16px; height: 16px; fill: currentColor; }

/* Unselected hover color across the shell */
.yt-iconbtn:hover,
.yt-chip:not(.is-active):hover,
.yt-guide__item:not(.is-active):hover,
.yt-create:hover {
  background: #3f3f3f !important;
}

/* ---------- Apple-inspired responsive safe gutters ---------- */
.yt-header {
  padding-inline: max(12px, env(safe-area-inset-left, 0px))
    max(12px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  background: rgba(15, 15, 15, 0.86);
}

@media (min-width: 768px) {
  .yt-header {
    padding-inline: 20px;
  }
}

.yt-chips {
  padding-inline: max(12px, env(safe-area-inset-left, 0px))
    max(12px, env(safe-area-inset-right, 0px));
  scroll-padding-inline: 12px;
}

.yt-bottomnav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.yt-iconbtn,
.yt-avatar,
.yt-create {
  transition:
    background-color 0.2s cubic-bezier(0.32, 0.72, 0, 1),
    transform 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}

.yt-iconbtn:active,
.yt-avatar:active,
.yt-create:active {
  transform: scale(0.94);
}

/* Rewards chip: fixed white (selected) — YouTube active pill look */
.yt-chip.is-active {
  background: #ffffff !important;
  color: #0f0f0f !important;
  font-weight: 600;
}
.yt-chip.is-active:active {
  background: #e8e8e8 !important;
}

.yt-guide__item.is-active {
  background: transparent !important;
  color: #ffffff !important;
  font-weight: 600;
}

.yt-guide__item.is-active svg {
  fill: #ffffff;
}

.yt-navitem.is-active {
  background: transparent !important;
  color: #ffffff !important;
  font-weight: 600;
}

.yt-navitem.is-active svg {
  fill: #ffffff;
}

/* Center bottom nav items horizontally and vertically */
.yt-bottomnav {
  justify-content: center;
  align-items: center;
}

.yt-navitem {
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 52px;
}

.yt-navitem__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
