/* ============================================================
   Leo AI YouTube outreach mockup — shared stylesheet
   Pages: index.html / video.html / instagram.html
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
  --yt-bg: #ffffff;
  --yt-surface: #f9f9f9;
  --yt-text-primary: #0f0f0f;
  --yt-text-secondary: #606060;
  --yt-text-muted: #909090;
  --yt-border: #e5e5e5;
  --yt-hover: #f2f2f2;
  --yt-red: #ff0000;
  --yt-blue: #065fd4;
  --brand: var(--yt-red); /* JS overwrites */
  --yt-card-radius: 12px;
  --yt-pill-radius: 999px;
  --yt-shadow: 0 1px 2px rgba(0,0,0,.06);
  --content-max: 1284px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--yt-text-primary);
  background: var(--yt-bg);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ----- masthead (top app bar) ----- */
.yt-masthead {
  position: sticky; top: 0; z-index: 80;
  height: 56px;
  display: grid;
  grid-template-columns: 226px 1fr 226px;
  align-items: center;
  padding: 0 16px;
  background: var(--yt-bg);
  border-bottom: 1px solid transparent;
}
.yt-masthead-left { display: flex; align-items: center; gap: 16px; }
.yt-icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--yt-text-primary);
}
.yt-icon-btn:hover { background: var(--yt-hover); }
.yt-icon-btn svg { width: 24px; height: 24px; }

.yt-logo { display: inline-flex; align-items: center; gap: 4px; }
.yt-logo svg { height: 22px; width: auto; }

.yt-search {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.yt-search-form {
  display: flex; align-items: stretch;
  width: min(640px, 100%);
}
.yt-search-input {
  flex: 1;
  border: 1px solid var(--yt-border);
  border-right: none;
  border-radius: 40px 0 0 40px;
  padding: 0 16px 0 18px;
  height: 40px;
  font-size: 16px;
  outline: none;
}
.yt-search-input:focus {
  border-color: var(--yt-blue);
  box-shadow: inset 0 0 0 1px var(--yt-blue);
}
.yt-search-btn {
  width: 64px;
  height: 40px;
  border: 1px solid var(--yt-border);
  background: var(--yt-surface);
  border-radius: 0 40px 40px 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--yt-text-primary);
}
.yt-search-btn svg {
  width: 22px;
  height: 22px;
}
.yt-mic-btn {
  margin-left: 12px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--yt-surface);
  border: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.yt-masthead-right {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}
.yt-avatar-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  overflow: hidden;
  padding: 0;
}
.yt-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.yt-bell-dot { position: relative; }
.yt-bell-dot::after {
  content: ""; position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--yt-red);
  border: 1px solid #fff;
}

/* ----- mini sidebar (left rail) ----- */
.yt-sidebar {
  position: fixed;
  left: 0; top: 56px; bottom: 0;
  width: 72px;
  background: var(--yt-bg);
  padding: 8px 0;
  z-index: 70;
  overflow-y: auto;
  scrollbar-width: none;
}
.yt-sidebar::-webkit-scrollbar { display: none; }
.yt-sidebar .yt-side-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 0 14px;
  font-size: 10px;
  font-weight: 400;
  color: var(--yt-text-primary);
  text-decoration: none;
  border-radius: 10px;
  margin: 0 6px;
}
.yt-sidebar .yt-side-item:hover { background: var(--yt-hover); }
.yt-sidebar .yt-side-item[data-active="true"] { font-weight: 500; }
.yt-sidebar .yt-side-item svg {
  width: 24px; height: 24px;
  color: var(--yt-text-primary);
}

/* ----- main content shell ----- */
.yt-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px;
}
@media (min-width: 769px) {
  .page-channel .yt-main,
  .page-watch .yt-main {
    margin-left: 72px;
  }
}
@media (max-width: 768px) {
  .yt-sidebar { display: none; }
}

/* ============================================================
   CHANNEL HOME (index.html)
   ============================================================ */

.channel-banner {
  width: 100%;
  aspect-ratio: 6.2 / 1;
  border-radius: var(--yt-card-radius);
  overflow: hidden;
  background: linear-gradient(135deg, #ec4899 0%, #f97316 60%, #fbbf24 100%);
  position: relative;
  margin-bottom: 24px;
}
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }

.channel-header {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 0 24px 32px;
}
.channel-avatar {
  width: 160px; height: 160px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--yt-surface);
}
.channel-avatar img { width: 100%; height: 100%; object-fit: cover; }

.channel-info h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
}

/* Verified tick — scales with parent font-size via em.
   ~0.62em ≈ cap-height of the text it sits beside. */
.verified-tick {
  width: 0.62em;
  height: 0.62em;
  flex-shrink: 0;
  color: var(--yt-text-primary);
  display: inline-block;
  vertical-align: middle;
}
.channel-meta {
  color: var(--yt-text-primary);
  font-size: 14px;
  margin-bottom: 8px;
}
.channel-meta b { font-weight: 700; }
.channel-meta .sep { color: var(--yt-text-muted); margin: 0 4px; }
.channel-desc-teaser {
  color: var(--yt-text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}
.channel-desc-text {
  margin: 0 0 8px;
}
.channel-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}
.channel-link {
  color: var(--yt-blue);
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}
.channel-link:hover { text-decoration: underline; }
.channel-desc-teaser .more {
  color: var(--yt-text-primary);
  font-weight: 500;
}
/* Bio is truncated at "Collection." and the inline "...more" replaces the rest,
   so the standalone fallback "...more" anchor is always hidden. */
.channel-desc-teaser > .more { display: none; }
.channel-desc-more {
  color: var(--yt-text-primary);
  font-weight: 700;
  text-decoration: none;
}
.channel-buttons { display: flex; gap: 8px; align-items: center; }
.subscribe-btn {
  background: #0f0f0f;
  color: #fff;
  border: none;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--yt-pill-radius);
  font-weight: 500;
  font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.subscribe-btn:hover { background: var(--brand); }
.subscribe-btn[data-state="on"] {
  background: var(--yt-surface);
  color: var(--yt-text-primary);
  border: 1px solid var(--yt-border);
}
.subscribe-btn[data-state="on"]:hover { background: var(--yt-hover); }
.join-btn {
  background: transparent;
  border: 1px solid var(--yt-border);
  height: 36px;
  padding: 0 16px;
  border-radius: var(--yt-pill-radius);
  font-weight: 500;
}
.join-btn:hover { background: var(--yt-hover); }

/* ----- tab bar ----- */
.channel-tabs {
  display: flex; gap: 24px;
  border-bottom: 1px solid var(--yt-border);
  margin: 0 24px 24px;
  padding-top: 8px;
}
.channel-tabs a {
  position: relative;
  padding: 14px 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--yt-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.channel-tabs a[data-active="true"] {
  color: var(--yt-text-primary);
}
.channel-tabs a[data-active="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--yt-text-primary);
}

/* panels */
[data-panel] { display: none; }
[data-panel][data-active="true"] { display: block; }

/* ============================================================
   SPONSORED AD SLOT
   ============================================================ */

.ad-card {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--yt-card-radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--brand);
  margin-bottom: 32px;
  isolation: isolate;
  text-decoration: none;
}
.ad-card .ad-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(.78);
  z-index: 1;
}
.ad-card .ad-overlay {
  position: absolute; inset: 0;
  /* Subtle vignette only — corners darker, center clearer.
     Matches how real YouTube sponsored ads render the underlying frame. */
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 35%, rgba(0,0,0,.35) 100%),
    linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.15) 100%);
  z-index: 2;
}
.ad-card .ad-chrome {
  position: absolute; inset: 0;
  z-index: 3;
  color: #fff;
}
.ad-tl {
  position: absolute; top: clamp(12px, 2vw, 24px); left: clamp(12px, 2vw, 24px);
  display: flex; align-items: center; gap: clamp(8px, 1.4vw, 16px);
}
.ad-tl .ad-logo {
  width: clamp(36px, 5vw, 64px); height: clamp(36px, 5vw, 64px);
  border-radius: 50%;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
}
.ad-tl .ad-logo img { width: 100%; height: 100%; object-fit: cover; }
.ad-tl .ad-date {
  font-size: clamp(15px, 3vw, 36px);
  font-weight: 700; line-height: 1.05;
  letter-spacing: -0.01em;
}
.ad-tl .ad-advertiser {
  font-size: clamp(11px, 1.7vw, 22px);
  font-weight: 400; opacity: 0.95;
  margin-top: 2px;
}

.ad-tr {
  position: absolute; top: clamp(14px, 2.2vw, 28px); right: clamp(12px, 2vw, 24px);
  display: inline-flex; align-items: center; gap: clamp(6px, 1vw, 12px);
  font-size: clamp(12px, 2.4vw, 30px); font-weight: 400;
}
.ad-tr .visit-indicator {
  width: clamp(18px, 2.4vw, 30px);
  height: clamp(18px, 2.4vw, 30px);
  border-radius: 6px;
  background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ad-tr .visit-indicator svg { width: 60%; height: 60%; color: #fff; }

.ad-play {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: clamp(60px, 10vw, 120px);
  height: clamp(42px, 7vw, 84px);
  border-radius: clamp(10px, 1.4vw, 18px);
  background: var(--yt-red);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px rgba(0,0,0,.30);
}
.ad-play svg { width: 40%; height: 40%; color: #fff; }

.ad-bl {
  position: absolute; left: clamp(12px, 2vw, 24px); bottom: clamp(12px, 2vw, 24px);
  display: flex; flex-direction: column; gap: 8px;
}
.ad-bl-pill {
  background: rgba(0,0,0,.5);
  border-radius: var(--yt-pill-radius);
  padding: clamp(5px, .8vw, 8px) clamp(10px, 1.4vw, 16px);
  display: inline-flex; align-items: center; gap: clamp(8px, 1.2vw, 14px);
  width: fit-content;
}
.ad-bl-pill svg { width: clamp(14px, 1.8vw, 22px); height: clamp(14px, 1.8vw, 22px); color: #fff; }
.ad-bl-tag {
  font-size: clamp(11px, 1.4vw, 18px);
  font-weight: 400;
  display: inline-flex; align-items: center; gap: 6px;
}
.ad-bl-tag svg { width: clamp(12px, 1.4vw, 16px); height: clamp(12px, 1.4vw, 16px); opacity: .85; }

.ad-br {
  position: absolute; right: clamp(12px, 2vw, 24px); bottom: clamp(12px, 2vw, 24px);
  background: rgba(0,0,0,.5);
  border-radius: var(--yt-pill-radius);
  padding: clamp(6px, .9vw, 10px) clamp(12px, 1.8vw, 22px);
  display: inline-flex; align-items: center; gap: clamp(6px, .8vw, 10px);
  font-size: clamp(11px, 1.6vw, 20px);
  font-weight: 500;
}
.ad-br .yt-mark {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700;
}
.ad-br .yt-mark .play-tile {
  width: clamp(18px, 2.2vw, 26px);
  height: clamp(13px, 1.5vw, 18px);
  border-radius: 4px;
  background: var(--yt-red);
  display: inline-flex; align-items: center; justify-content: center;
}
.ad-br .yt-mark .play-tile svg { width: 50%; height: 50%; color: #fff; }

.ad-card:hover { filter: brightness(1.05); transform: translateZ(0) scale(1.005); transition: filter .2s, transform .2s; }

/* ---- Featured / channel-trailer 2-column row ---- */
.featured-row {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-bottom: 32px;
}
.featured-row .ad-card { margin-bottom: 0; }

.featured-meta {
  padding-top: 4px;
  min-width: 0;
}
.featured-title {
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--yt-text-primary);
}
.featured-stats {
  font-size: 14px;
  color: var(--yt-text-secondary);
  margin-bottom: 16px;
}
.featured-stats .sep { color: var(--yt-text-muted); }
.featured-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--yt-text-primary);
  margin: 0 0 12px;
}
.featured-readmore {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yt-text-secondary);
}
.featured-readmore:hover { color: var(--yt-text-primary); }

/* ============================================================
   SHELVES + VIDEO TILES
   ============================================================ */

.shelf { margin: 0 0 32px; }

/* Section dividers under the home-panel sections (featured-row + first three shelves).
   The last shelf (My Family) intentionally has no divider. */
[data-panel="home"] > .featured-row,
[data-panel="home"] > .shelf:not(:last-child) {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--yt-border);
}
.shelf-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.shelf-title {
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.shelf-rail-wrap { position: relative; }
.shelf-rail {
  display: flex; gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.shelf-rail::-webkit-scrollbar { display: none; }
.shelf-rail > * { scroll-snap-align: start; }

.shelf-arrow {
  position: absolute;
  top: 90px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  border: 1px solid var(--yt-border);
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 5;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.shelf-rail-wrap:hover .shelf-arrow { opacity: 1; pointer-events: auto; }
.shelf-arrow.prev { left: -8px; }
.shelf-arrow.next { right: -8px; }
.shelf-arrow svg { width: 20px; height: 20px; }

/* video tile (16:9) */
.tile {
  display: block;
  width: 320px;
  flex: 0 0 auto;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.tile-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--yt-card-radius);
  overflow: hidden;
  background: var(--yt-surface);
}
.tile-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .25s;
}
.tile.is-hovering .tile-thumb img { transform: scale(1.04); }
.tile-thumb video.preview {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* static UGC-style caption, painted directly on each tile thumb.
   Two visual variants alternate via :nth-child(even):
   (A) bold white outlined text on transparent background
   (B) white pill with dark text, hugging each wrapped line */
.tile-caption-overlay {
  position: absolute;
  left: 14px; right: 14px;
  text-align: center;
  font-size: 18px;
  letter-spacing: -0.01em;
  z-index: 2;
  pointer-events: none;
}
.tile-caption-overlay span {
  color: #fff;
  font-weight: 800;
  line-height: 1.15;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow: 0 0 4px rgba(0,0,0,.55), 0 2px 5px rgba(0,0,0,.7);
}
.tile:nth-child(even) .tile-caption-overlay span {
  background: #fff;
  color: #0e1126;
  -webkit-text-stroke: 0;
  text-shadow: none;
  padding: 4px 10px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  line-height: 1.15;
}
/* rotating positions: top / middle / bottom */
.tile-caption-pos-0, .tile-caption-pos-3, .tile-caption-pos-6, .tile-caption-pos-9 { top: 14px; }
.tile-caption-pos-1, .tile-caption-pos-4, .tile-caption-pos-7, .tile-caption-pos-10 { top: 50%; transform: translateY(-50%); }
.tile-caption-pos-2, .tile-caption-pos-5, .tile-caption-pos-8, .tile-caption-pos-11 { bottom: 14px; }
.tile-duration {
  position: absolute;
  right: 8px; bottom: 8px;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
}
.tile-retention-strip {
  position: absolute; left: 0; bottom: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--yt-red) 0%, var(--yt-red) 70%, transparent 70%);
  opacity: 0;
}
.tile-meta { padding: 12px 0 0; }
.tile-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin: 0 0 4px;
  color: var(--yt-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-channel { font-size: 13px; color: var(--yt-text-secondary); margin-bottom: 2px; }
.tile-stats { font-size: 13px; color: var(--yt-text-secondary); }
.tile-stats .sep { margin: 0 4px; color: var(--yt-text-muted); }

/* shorts (9:16) */
.short-tile {
  display: block;
  width: 220px;
  flex: 0 0 auto;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
}
.short-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: var(--yt-card-radius);
  overflow: hidden;
  background: var(--yt-surface);
}
.short-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.short-tile.is-hovering .short-thumb img { transform: scale(1.04); }
.short-thumb video.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; pointer-events: none; }
.short-tile.is-hovering .short-thumb video.preview { opacity: 1; }
/* UGC-style caption — alternates between two looks the way real Shorts do:
   (A) bold white text with strong black outline on transparent background
   (B) per-line white pills hugging each line of wrapped text */
.short-caption-overlay {
  position: absolute;
  left: 10px; right: 10px;
  text-align: center;
  background: transparent;
  padding: 0;
  font-size: 15px;
  letter-spacing: -0.01em;
}
/* rotating positions: every 3rd short cycles top / middle / bottom */
.short-tile:nth-child(3n+1) .short-caption-overlay { top: 18px; }
.short-tile:nth-child(3n+2) .short-caption-overlay { top: 50%; transform: translateY(-50%); }
.short-tile:nth-child(3n)   .short-caption-overlay { bottom: 18px; }
.short-caption-overlay span {
  color: #fff;
  font-weight: 800;
  line-height: 1.2;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  text-shadow:
    0 0 4px rgba(0,0,0,.55),
    0 2px 5px rgba(0,0,0,.7);
}
/* Pill variant — every even-indexed short.
   Each wrapped line gets its own white background that hugs only that line. */
.short-tile:nth-child(even) .short-caption-overlay span {
  background: #fff;
  color: #0e1126;
  -webkit-text-stroke: 0;
  text-shadow: none;
  padding: 4px 10px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  line-height: 1.15;
}
.short-meta { padding: 10px 4px 0; }
.short-title {
  font-size: 14px; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
}
.short-stats { font-size: 12px; color: var(--yt-text-secondary); }

/* my family (featured channels) */
.my-family-row {
  display: flex; gap: 24px;
  flex-wrap: wrap;
}
.family-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
}
.family-tile:hover { background: var(--yt-hover); }
.family-tile .family-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.family-tile .family-avatar img { width: 100%; height: 100%; object-fit: cover; }
.family-tile .family-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--yt-text-primary);
}
.family-tile .family-handle { font-size: 12px; color: var(--yt-text-secondary); }
.family-tile .family-subs { font-size: 12px; color: var(--yt-text-secondary); }

/* grids for Videos & Shorts tabs */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px 16px;
  margin: 0 24px;
}
.short-grid {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 24px 16px;
  margin: 0;
  scroll-snap-type: x proximity;
}
.short-grid::-webkit-scrollbar { display: none; }
.short-grid > .short-tile { scroll-snap-align: start; }
.tile-grid > .tile { width: 100%; }
.short-grid > .short-tile { width: 220px; flex: 0 0 auto; }

/* posts feed (cross-platform) — single column, image floats right of body */
.posts-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.post-card {
  background: var(--yt-surface);
  border: 1px solid var(--yt-border);
  border-radius: var(--yt-card-radius);
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 24px;
  align-items: start;
}
.post-card > .post-platform { grid-column: 1 / -1; margin-bottom: 0; }
.post-card .post-platform {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--yt-text-secondary);
  margin-bottom: 10px;
  font-weight: 700;
}
.post-card .post-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0;
  background: var(--yt-bg);
}
.post-card .post-image img { width: 100%; height: 100%; object-fit: cover; }
.post-card.post-yt .post-image { aspect-ratio: 1 / 1; }
.post-card .post-body { font-size: 13px; line-height: 1.5; margin-bottom: 8px; }
.post-card .post-engage {
  display: flex; gap: 14px;
  font-size: 12px; color: var(--yt-text-secondary);
  border-top: 1px solid var(--yt-border);
  padding-top: 8px;
}

/* Community Posts (Home tab) — light theme YouTube Community card */
.community-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 24px;
}
.community-post {
  background: var(--yt-surface);
  border: 1px solid var(--yt-border);
  border-radius: var(--yt-card-radius);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: start;
}
.community-post:has(> .community-body:only-child),
.community-post.is-text-only {
  grid-template-columns: 1fr;
}
.community-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--yt-text-secondary);
  margin-bottom: 10px;
}
.community-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.community-name {
  font-weight: 500;
  color: var(--yt-text-primary);
}
.community-byline .sep { color: var(--yt-text-muted); }
.community-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--yt-text-primary);
  margin: 0 0 14px;
  white-space: pre-wrap;
}
.community-engage {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--yt-text-secondary);
}
.community-engage .ce-icon {
  font-size: 14px;
}
.community-image {
  border-radius: 8px;
  overflow: hidden;
  background: var(--yt-bg);
  aspect-ratio: 1 / 1;
  display: block;
}
.community-image img { width: 100%; height: 100%; object-fit: cover; }
.community-platform {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--yt-text-secondary);
  font-weight: 700;
  padding: 2px 8px;
  border: 1px solid var(--yt-border);
  border-radius: 4px;
  margin-right: 4px;
}

/* ============================================================
   DESCRIPTION POPUP (channel home "...more")
   ============================================================ */

.desc-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  z-index: 100;
  align-items: center; justify-content: center;
}
.desc-popup[data-open="true"] { display: flex; }
.desc-popup-card {
  background: var(--yt-bg);
  border-radius: var(--yt-card-radius);
  width: min(720px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
}
.desc-popup-close {
  position: absolute;
  right: 14px; top: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent; border: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.desc-popup-close:hover { background: var(--yt-hover); }
.desc-popup h2 {
  font-size: 22px; font-weight: 700; margin: 0 0 16px;
}
.desc-popup .desc-section { margin-bottom: 20px; }
.desc-popup .desc-section h3 {
  font-size: 14px; font-weight: 700; margin: 0 0 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.desc-popup p, .desc-popup .desc-line {
  color: var(--yt-text-primary);
  font-size: 14px; line-height: 1.55;
}
.popup-link-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--yt-border);
}
.popup-link-row:last-child { border-bottom: none; }
.popup-link-label {
  flex: 0 0 110px;
  font-weight: 700; font-size: 14px;
}
.popup-link-url {
  color: var(--yt-blue);
  font-size: 14px;
  word-break: break-all;
}
.popup-link-url:hover { text-decoration: underline; }

/* ============================================================
   DEMO TOGGLE + LEVER OVERLAYS + TOAST
   ============================================================ */

.demo-toggle {
  position: fixed;
  top: 70px; right: 16px;
  z-index: 90;
  background: var(--yt-bg);
  border: 1px solid var(--yt-border);
  border-radius: var(--yt-pill-radius);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  box-shadow: var(--yt-shadow);
  color: var(--yt-text-secondary);
}
.demo-toggle[data-state="on"] {
  background: #0f0f0f;
  color: #fff;
  border-color: #0f0f0f;
}

.lever-callout {
  display: none;
  position: absolute;
  background: #0f0f0f;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  width: 240px;
  box-shadow: 0 12px 28px rgba(0,0,0,.20);
  z-index: 60;
  pointer-events: none;
}
.lever-callout::before {
  content: attr(data-num);
  display: inline-block;
  width: 22px; height: 22px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  font-size: 11px; font-weight: 800;
  text-align: center; line-height: 22px;
  margin-right: 8px;
  letter-spacing: 0;
}
.lever-callout::after {
  content: "";
  position: absolute;
  width: 0; height: 0;
  border: 8px solid transparent;
}
.lever-callout.point-up::after {
  top: -16px; left: 24px;
  border-bottom-color: #0f0f0f;
}
.lever-callout.point-down::after {
  bottom: -16px; left: 24px;
  border-top-color: #0f0f0f;
}
.lever-callout.point-left::after {
  left: -16px; top: 16px;
  border-right-color: #0f0f0f;
}
body[data-demo="on"] .lever-callout { display: block; }

/* anchor positions on the page */
.has-lever { position: relative; }

/* toast */
.toast {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 360px;
  background: var(--yt-bg);
  border: 1px solid var(--yt-border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.18);
  z-index: 95;
  padding: 16px;
  display: none;
}
.toast[data-visible="true"] { display: block; }
.toast .toast-head {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 13px;
  margin-bottom: 8px;
}
.toast .toast-head .toast-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}
.toast .toast-head .toast-mark svg { width: 12px; height: 12px; color: #fff; }
.toast .toast-body {
  font-size: 13px; color: var(--yt-text-primary);
  margin-bottom: 12px;
}
.toast .toast-actions { display: flex; gap: 8px; }
.toast .toast-actions button {
  flex: 1;
  height: 32px;
  border-radius: var(--yt-pill-radius);
  border: 1px solid var(--yt-border);
  background: var(--yt-bg);
  font-weight: 500; font-size: 13px;
}
.toast .toast-actions .accept {
  background: #0f0f0f; color: #fff; border-color: #0f0f0f;
}

/* ============================================================
   WATCH PAGE (video.html)
   ============================================================ */

.page-watch .yt-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 402px;
  gap: 24px;
}
.watch-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--yt-card-radius);
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}
.watch-player img.frame { width: 100%; height: 100%; object-fit: cover; }
.watch-player .play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.18);
}
.watch-player .play-btn {
  width: 88px; height: 64px;
  border-radius: 14px;
  background: var(--yt-red);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 30px rgba(0,0,0,.30);
}
.watch-player .play-btn svg { width: 36px; height: 36px; color: #fff; }

.watch-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 16px 12px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.6));
  color: #fff;
}
.watch-progress-wrap { position: relative; height: 28px; }
.heatmap-svg {
  position: absolute; left: 0; right: 0; top: 0;
  width: 100%; height: 22px;
  display: block;
  opacity: 0.85;
}
.heatmap-svg path[data-heatmap-fill] { fill: rgba(255,0,0,.32); }
.heatmap-svg path[data-heatmap-stroke] { fill: none; stroke: #ff4444; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.watch-progress {
  position: absolute;
  bottom: 4px; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,.30);
  border-radius: 2px;
}
.watch-progress::after {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 38%;
  background: var(--yt-red);
  border-radius: 2px;
}
.chapter-tick {
  position: absolute;
  top: -1px;
  width: 2px;
  height: 6px;
  background: rgba(255,255,255,.85);
  z-index: 4;
}
.chapter-tick:hover::before {
  content: attr(data-label);
  position: absolute;
  bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff;
  padding: 4px 8px; border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}
.most-replayed-tag {
  position: absolute;
  left: 12px; top: -22px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 11px; font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.04em;
}

.watch-title {
  font-size: 20px; font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.watch-meta-row {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.watch-channel {
  display: flex; align-items: center; gap: 12px;
  flex: 1;
}
.watch-channel-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.watch-channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.watch-channel-info .name {
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.32em;
}
.watch-channel-info .subs { font-size: 12px; color: var(--yt-text-secondary); }
.watch-actions { display: flex; gap: 8px; }
.watch-action-btn {
  height: 36px; padding: 0 14px;
  border-radius: var(--yt-pill-radius);
  background: var(--yt-surface);
  border: 1px solid var(--yt-border);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.watch-action-btn:hover { background: var(--yt-hover); }
.watch-action-btn svg { width: 18px; height: 18px; }

.watch-desc {
  background: var(--yt-surface);
  border-radius: 12px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.55;
}
.watch-desc[data-open="false"] .desc-extra { display: none; }
.watch-desc[data-open="false"] .desc-collapsed { display: block; }
.watch-desc[data-open="true"] .desc-collapsed { display: none; }
.watch-desc .desc-stats { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.watch-desc .desc-toggle {
  background: none; border: none;
  font-weight: 700; padding: 0; margin-top: 8px;
  font-size: 13px;
  color: var(--yt-text-primary);
}
.watch-desc .desc-divider {
  border: 0;
  border-top: 1px solid var(--yt-border);
  margin: 14px 0;
}
.watch-desc .desc-h {
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 12px; margin-bottom: 6px;
}
.watch-desc ul { margin: 6px 0; padding-left: 18px; }
.watch-desc a { color: var(--yt-blue); }
.watch-desc a:hover { text-decoration: underline; }
.watch-desc .desc-row { margin: 4px 0; }
.watch-desc .ts {
  display: inline-block;
  font-family: "Roboto Mono", monospace;
  font-feature-settings: "tnum";
  margin-right: 8px;
  color: var(--yt-blue);
}

.kw {
  color: var(--brand);
  font-weight: 600;
  cursor: help;
  position: relative;
}
.kw:hover::after {
  content: attr(data-vol);
  position: absolute;
  left: 0; top: 100%;
  margin-top: 6px;
  background: #0f0f0f;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 10;
}
.ask-box {
  border: 1px solid var(--yt-border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--yt-bg);
}
.ask-box .ask-bubble {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--yt-surface);
  display: inline-flex; align-items: center; justify-content: center;
}

.up-next {
  display: flex; flex-direction: column; gap: 8px;
}
.up-next-tile {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 8px;
  cursor: pointer;
}
.up-next-tile:hover { background: var(--yt-hover); border-radius: 8px; }
.up-next-tile .un-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 8px; overflow: hidden;
}
.up-next-tile .un-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-next-tile .un-meta { padding: 0 4px; }
.up-next-tile .un-title {
  font-size: 14px; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}
.up-next-tile .un-channel { font-size: 12px; color: var(--yt-text-secondary); }
.up-next-tile .un-stats { font-size: 12px; color: var(--yt-text-secondary); }

/* ============================================================
   INSTAGRAM PAGE
   ============================================================ */

.page-instagram { background: #fff; }

/* Left rail (replaces top nav) */
.ig-rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 72px;
  background: #fff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 14px;
  gap: 28px;
}
.ig-rail-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  color: #000;
  text-decoration: none;
}
.ig-rail-logo svg { display: block; }
.ig-rail-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}
.ig-rail-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px; height: 48px;
  border-radius: 12px;
  color: #000;
  text-decoration: none;
}
.ig-rail-item:hover { background: #f1f1f1; }
.ig-rail-item svg { width: 26px; height: 26px; }
.ig-rail-avatar img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.ig-rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ig-main { max-width: 935px; margin: 0 auto; padding: 50px 20px 30px 92px; }

/* IG profile section — mirrors the mobile layout at all viewports */
.ig-profile {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  text-align: left;
}
.ig-avatar-large {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  padding: 3px;
  margin: 0;
  box-sizing: border-box;
}
.ig-avatar-large img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  box-sizing: border-box;
  display: block;
}
.ig-profile-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}
.ig-profile-info .ig-handle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.ig-profile-info .ig-handle { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.ig-display-name { font-size: 14px; font-weight: 400; color: #0f0f0f; margin: 2px 0 14px; text-transform: uppercase; letter-spacing: 0.02em; }
.ig-handle-verified { display: inline-block; }
.ig-bio-text { font-size: 14px; color: #0f0f0f; margin: 14px 0 6px; line-height: 1.4; }
.ig-bio-text > div + div { margin-top: 0; }
.ig-profile-info .ig-website {
  color: #00376b;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  text-decoration: none;
}
.ig-profile-info .ig-website svg { flex-shrink: 0; }
.ig-website-more { color: #0f0f0f; font-weight: 700; }
.ig-followed-by {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #0f0f0f;
}
.ig-followed-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffd55a;
  flex: 0 0 auto;
}
.ig-followed-text b { font-weight: 600; }
.ig-handle-options {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #0f0f0f;
  display: inline-flex;
  align-items: center;
  margin-left: 0;
}
.ig-stats {
  display: flex;
  justify-content: flex-start;
  gap: 24px;
  font-size: 14px;
  margin-bottom: 0;
  padding: 0;
}
.ig-stats > div {
  display: inline;
  line-height: 1.25;
  color: #0f0f0f;
  font-weight: 400;
}
.ig-stats > div b {
  font-size: 14px;
  font-weight: 600;
  color: #0f0f0f;
  margin-bottom: 0;
}
.ig-bio {
  grid-column: 1 / -1;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  margin-top: 8px;
}
.ig-bio .ig-name { font-size: 16px; font-weight: 700; }
.ig-bio > div:not(.ig-name) { color: #0f0f0f; margin-bottom: 4px; }
.ig-bio .ig-website {
  color: #00376b;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  text-decoration: none;
}
.ig-bio .ig-website svg { flex-shrink: 0; }

.ig-actions {
  display: flex;
  gap: 6px;
  margin: 14px 0 4px;
}
.ig-action-btn {
  background: #efefef;
  border: none;
  height: 32px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #0f0f0f;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
}
.ig-action-btn:hover { background: #e5e5e5; }
.ig-action-wide { flex: 1; }
.ig-action-square { width: 36px; padding: 0; flex-shrink: 0; }

.ig-highlights {
  display: flex; gap: 28px;
  padding: 24px 0 32px;
  margin-bottom: 12px;
}
.ig-hl {
  text-align: center;
  font-size: 12px; font-weight: 500;
}
.ig-hl-cover {
  width: 96px; height: 96px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 10px;
  border: 3px solid #c8c8c8;
  background: #fff;
  box-sizing: border-box;
  position: relative;
}
.ig-hl-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 6px #fff;
  pointer-events: none;
}
.ig-hl-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.ig-tab-icon { display: none; }
.ig-empty {
  text-align: center;
  padding: 60px 20px;
  color: #737373;
  font-size: 14px;
}
.ig-tabs {
  display: flex;
  justify-content: space-around;
  gap: 0;
  border-bottom: 1px solid #dbdbdb;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #8e8e8e;
  text-transform: uppercase;
}
.ig-tabs a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #737373;
  padding: 14px 0;
  text-decoration: none;
}
.ig-tabs a[data-active="true"] {
  color: #0f0f0f;
  border-bottom: 2px solid #0f0f0f;
  margin-bottom: -1px;
}
.ig-tabs .ig-tab-icon { display: inline-block; }
.ig-tabs .ig-tab-label { display: none; }

.ig-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.ig-tile {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #efefef;
  cursor: pointer;
  overflow: hidden;
}
.ig-tile img { width: 100%; height: 100%; object-fit: cover; }
.ig-tile video.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; pointer-events: none; }
.ig-tile.is-hovering video.preview { opacity: 1; }
.ig-tile-reel,
.ig-tile-carousel {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  pointer-events: none;
}
.ig-tile-tag {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: #2a2a2a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
}
.ig-tile-tag.is-tagged {
  pointer-events: auto;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
}
.ig-tile-tag-link {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  text-decoration: none;
  z-index: 3;
}
.ig-tile-tag.is-tagged:hover .ig-tile-tag-link {
  opacity: 1;
  pointer-events: auto;
}
/* UGC-style alternating caption overlays — same pattern as YT .tile-caption-overlay.
   Two visual variants alternate via :nth-child(even); positions cycle top/middle/bottom. */
.ig-tile-text {
  position: absolute;
  left: 12px;
  right: 12px;
  text-align: center;
  font-size: 14px;
  letter-spacing: -0.01em;
  z-index: 2;
  pointer-events: none;
}
.ig-tile-text span {
  color: #fff;
  font-weight: 800;
  line-height: 1.15;
  -webkit-text-stroke: 1.5px #000;
  paint-order: stroke fill;
  text-shadow: 0 0 4px rgba(0,0,0,.55), 0 2px 5px rgba(0,0,0,.7);
}
/* Auto-alternation disabled — all tile-text overlays use the transparent style */
/* All overlay positions pinned to the bottom of the thumbnail */
[class*="ig-tile-text-pos-"] {
  top: auto !important;
  bottom: 14px !important;
  transform: none !important;
}

.ig-reels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.ig-reel {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #efefef;
  overflow: hidden;
}
.ig-reel img { width: 100%; height: 100%; object-fit: cover; }
.ig-reel video.preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .15s; pointer-events: none; }
.ig-reel.is-hovering video.preview { opacity: 1; }
.ig-reel .ig-reel-views {
  position: absolute; left: 8px; bottom: 8px;
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; gap: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ≤1024px tablet · ≤768px small tablet · ≤640px phone
   ============================================================ */

@media (max-width: 1024px) {
  .yt-masthead { grid-template-columns: 180px 1fr 180px; }
  .yt-search-input { font-size: 14px; }

  /* Watch page: stack player above Up next */
  .page-watch .yt-main {
    grid-template-columns: minmax(0, 1fr);
  }
  .page-watch aside { margin-top: 24px; }

  /* Tile sizes a touch smaller */
  .tile { width: 280px; }
  .short-tile { width: 180px; }
}

@media (max-width: 768px) {
  body { font-size: 13px; }
  .yt-main { padding: 24px 20px; }

  /* Masthead: hide left nav cluster, show only logo + search + avatar */
  .yt-masthead {
    grid-template-columns: auto 1fr auto;
    padding: 0 12px;
    height: 52px;
    gap: 8px;
  }
  .yt-masthead-left { gap: 8px; }
  .yt-masthead-left .yt-icon-btn { display: none; }
  .yt-mic-btn { display: none; }
  .yt-masthead-right .yt-icon-btn { display: none; }

  /* Mobile: collapse the search field, show only the search icon */
  .yt-search { justify-content: flex-end; }
  .yt-search-form { width: auto; }
  .yt-search-input { display: none; }
  .yt-search-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
  }
  .yt-search-btn:hover { background: var(--yt-hover); }
  .yt-search-btn svg { width: 28px; height: 28px; }

  /* Demo toggle: smaller and further from masthead */
  .demo-toggle { top: 60px; right: 12px; padding: 6px 12px; font-size: 11px; }

  /* Channel header: stack avatar above text */
  .channel-header {
    grid-template-columns: 1fr;
    gap: 12px;
    text-align: center;
    padding: 0 12px 24px;
  }
  .channel-link-more { color: var(--yt-text-primary); }
  .channel-avatar { width: 112px; height: 112px; margin: 0 auto; }
  .channel-info h1 { font-size: 22px; }
  .channel-meta, .channel-desc-teaser { font-size: 13px; }
  .channel-buttons { justify-content: center; }

  .channel-tabs {
    margin: 0 0 16px;
    gap: 0;
    flex-wrap: nowrap;
    justify-content: space-between;
  }
  .channel-tabs a {
    white-space: nowrap;
    padding: 12px 0;
    font-size: 13px;
    flex: 1;
    text-align: center;
  }

  /* Featured row stacks on small viewports — ad on top, meta below */
  .featured-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Tiles narrower */
  .tile { width: 240px; }
  .short-tile { width: 150px; }
  .shelf-title { font-size: 16px; }

  /* Posts feed already 1 column at desktop; on phone stack the card itself */
  .post-card { grid-template-columns: 1fr; }
  .community-post,
  .community-post:has(> .community-body:only-child) {
    grid-template-columns: 1fr;
  }
  .community-image { max-width: 320px; }
  /* Drop the desktop horizontal gutter on grids/feeds — .yt-main padding already insets */
  .tile-grid, .short-grid, .community-feed { margin: 0; }

  /* My Family: stack tighter */
  .my-family-row { gap: 8px; }

  /* Description popup */
  .desc-popup-card { padding: 18px 16px; max-height: 90vh; }

  /* Toast */
  .toast { right: 8px; bottom: 8px; left: 8px; width: auto; }

  /* Lever callouts (demo mode): hide on phone — too small to read */
  body[data-demo="on"] .lever-callout { display: none; }

  /* Watch page tweaks */
  .watch-title { font-size: 18px; }
  .watch-meta-row { gap: 12px; }
  .watch-actions { flex-wrap: wrap; }
  .watch-action-btn { height: 32px; padding: 0 12px; font-size: 13px; }
  .up-next-tile { grid-template-columns: 140px 1fr; }

  /* Instagram */
  .ig-main { padding: 48px 24px 24px; }
  .ig-rail { display: none; }
  .ig-profile {
    grid-template-columns: 110px 1fr;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 18px;
    text-align: left;
  }
  .ig-avatar-large { width: 100px; height: 100px; margin: 0; }
  .ig-profile-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
  }
  .ig-profile-info .ig-handle-row {
    justify-content: flex-start;
    gap: 6px;
    margin-bottom: 0;
    align-items: center;
  }
  .ig-profile-info .ig-handle { font-size: 18px; font-weight: 400; }
  .ig-handle-verified { display: inline-block; }
  .ig-handle-options { display: inline-flex; margin-left: 0; }

  .ig-stats {
    justify-content: flex-start;
    gap: 24px;
    font-size: 14px;
    margin-bottom: 0;
    padding: 0;
  }
  .ig-stats > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
    color: #737373;
    font-weight: 400;
  }
  .ig-stats > div b {
    font-size: 14px;
    font-weight: 600;
    color: #0f0f0f;
    margin-bottom: 0;
  }
  .ig-bio {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 8px;
  }
  .ig-bio .ig-name { font-size: 16px; font-weight: 700; }
  .ig-bio > div:not(.ig-name) { color: #0f0f0f; margin-bottom: 4px; }
  .ig-bio .ig-website {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
  }
  .ig-highlights { gap: 18px; padding: 18px 0 24px; overflow-x: auto; flex-wrap: nowrap; }
  .ig-highlights::-webkit-scrollbar { display: none; }
  .ig-hl-cover { width: 64px; height: 64px; }
  /* Mobile post grid: portrait tiles with tight 2px gap */
  .ig-grid {
    gap: 2px;
    margin-top: 0;
  }
  .ig-tile { aspect-ratio: 9 / 16; }
  /* Break out of .ig-main's 24px horizontal padding so the tabs and grid extend edge-to-edge */
  .ig-tabs,
  [data-ig-panel] {
    margin-left: -24px;
    margin-right: -24px;
  }
  [data-ig-panel="posts"],
  [data-ig-panel="reels"],
  [data-ig-panel="tagged"] { margin: 1px -24px; }
}

@media (max-width: 480px) {
  .yt-search-btn { width: 36px; height: 36px; }

  .channel-banner { aspect-ratio: 4 / 1; }

  .tile { width: 88vw; }
  .short-tile { width: 130px; }

  .watch-actions { gap: 6px; }
  .watch-action-btn { padding: 0 10px; font-size: 12px; }
  .watch-action-btn svg { width: 14px; height: 14px; }

  .ig-grid, .ig-reels { gap: 2px; }
  .ig-stats { font-size: 13px; gap: 12px; }

  /* Ad card on phones: keep visually intact via clamp() values
     defined globally — no further override needed. */
}

/* Zoom-in popup overlay for posts that carry the carousel/post glyph */
.ig-post-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: zoom-out;
  padding: 24px;
  box-sizing: border-box;
}
.ig-post-overlay[data-open="true"] { display: flex; }
.ig-post-overlay-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.ig-post-overlay img {
  max-width: min(90vw, 720px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Explicit overlay styles — override the .ig-tile:nth-child(even) auto-alternation */
.ig-tile .ig-tile-text.is-pill span {
  background: #fff !important;
  color: #0e1126 !important;
  -webkit-text-stroke: 0 !important;
  text-shadow: none !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  -webkit-box-decoration-break: clone !important;
  box-decoration-break: clone !important;
}
.ig-tile .ig-tile-text.is-plain span {
  background: transparent !important;
  color: #fff !important;
  -webkit-text-stroke: 2px #000 !important;
  text-shadow: 0 0 4px rgba(0,0,0,.55), 0 0 1px rgba(0,0,0,.95) !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Posts tab thumbnails use a 3:4 aspect ratio (overrides default 9:16) */
[data-ig-panel="posts"] .ig-tile { aspect-ratio: 3 / 4; }
@media (max-width: 700px) {
  [data-ig-panel="posts"] .ig-tile { aspect-ratio: 3 / 4; }
}

/* Posts tab grid: 5 columns instead of default 3 */
[data-ig-panel="posts"] .ig-grid { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 700px) {
  [data-ig-panel="posts"] .ig-grid { grid-template-columns: repeat(5, 1fr); }
}

/* Widen the Posts panel beyond the .ig-main 935px clamp so each tile is larger */
@media (min-width: 1280px) {
  [data-ig-panel="posts"] {
    margin-left: -180px;
    margin-right: -180px;
  }
}

/* Tighten the left rail — smaller width and items */
.ig-rail { width: 56px; padding: 14px 0 12px; gap: 22px; }
.ig-rail-logo { width: 36px; height: 36px; }
.ig-rail-logo svg { width: 22px; height: 22px; }
.ig-rail-item { width: 36px; height: 36px; border-radius: 10px; }
.ig-rail-item svg { width: 20px; height: 20px; }
.ig-rail-avatar img { width: 24px; height: 24px; }
.ig-rail-main { gap: 4px; margin-top: 22px; }
/* Pull the main column closer to the slimmer rail */
.ig-main { padding-left: 76px !important; }

/* Remove whitespace between thumbnails in all post/reel grids */
.ig-grid, .ig-reels { gap: 0 !important; }
