.main-wrap:has(> main > .reel-page) {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
main:has(> .reel-page) {
  height: 100%;
  width: 100%;
  max-width: none;
  padding: 0;
}
.reel-page {
  --reel-rail-space: 74px;
  --context-min: 212px;
  --reel-width: min(56.25dvh, calc(100% - var(--context-min) - var(--reel-rail-space)));
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(var(--context-min), 1fr) var(--reel-width) minmax(var(--reel-rail-space), 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.reel-context {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  padding: clamp(24px, 3vw, 44px) clamp(16px, 2vw, 30px);
  max-width: 296px;
  max-height: 100%;
  min-width: 0;
  overflow-y: auto;
}
.reel-context > .secondary {
  margin-top: 16px;
}
.reel-page .title-row h1 {
  display: block;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.14;
  letter-spacing: -.04em;
}
.reel-page .title-row p {
  margin-top: 7px;
  font-size: .875rem;
  line-height: 1.5;
}
.tools-row.reel-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: stretch;
  gap: 9px;
  margin: 23px 0 0;
}
.reel-context > .reel-tools:first-child { margin-top: 0; }
.reel-tools .tabs {
  display: grid;
  padding: 4px;
}
.reel-tools .tab {
  justify-content: space-between;
  padding: 9px 10px;
  min-height: 36px;
  font-size: .82rem;
}
.reel-tools .filter {
  width: 100%;
  min-width: 0;
  max-width: none;
  justify-content: space-between;
  min-height: 39px;
}
.reel-tools > .filter > .icon:last-child { display: inline-block; }
.reel-tools .filter select {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  max-width: none;
  padding: 0 30px 0 34px;
  margin: 0;
  color: var(--text-secondary);
  text-overflow: ellipsis;
}
.reel-filter-toggle { display: none; }
.reel-page .meme-stream {
  grid-column: 2 / -1;
  grid-row: 1;
  position: relative;
  isolation: isolate;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  container-type: size;
  outline-offset: -2px;
  overscroll-behavior: contain;
}
.meme-stream > .empty {
  position: absolute;
  top: 50%;
  inset-inline: 0 var(--reel-rail-space);
  width: min(calc(100% - var(--reel-rail-space)), 420px);
  margin-inline: auto;
  transform: translateY(-50%);
}
.stream-item {
  position: absolute;
  top: 0;
  left: 0;
  width: min(56.25cqh, calc(100cqw - var(--reel-rail-space)));
  height: 100%;
  margin: 0;
}
.stream-item[data-active="false"] {
  visibility: hidden;
  pointer-events: none;
}
.stream-item[data-transitioning] {
  visibility: visible;
  pointer-events: none;
}
.stream-item[data-active="true"] { z-index: 1; }
.reel-frame {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  background: #101011;
  color: #fff;
  box-shadow: 0 8px 32px #0003;
  touch-action: pan-x pinch-zoom;
}
.reel-media, .reel-media iframe, .reel-cover, .reel-shade, .reel-touch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.reel-media iframe {
  display: block;
  border: 0;
  background: #101011;
  pointer-events: none;
}
.reel-cover {
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
  transition: opacity .2s;
}
.stream-item:is([data-player="playing"],[data-player="paused"]) .reel-cover {
  opacity: 0;
}
.reel-shade {
  background: linear-gradient(180deg, #0006 0%, transparent 16%, transparent 53%, #0002 67%, #000b 100%);
  pointer-events: none;
}
.stream-item[data-player="playing"] .reel-shade {
  background: linear-gradient(180deg, #0005 0%, transparent 12%, transparent 67%, #0009 100%);
}
.reel-touch {
  display: grid;
  place-content: center;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: white;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-x pinch-zoom;
}
.reel-touch:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: -4px;
}
.reel-touch:active:not(:disabled) { transform: none; }
.reel-center-play {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 1px solid #ffffffa6;
  border-radius: 50%;
  background: #1d1b19a6;
  backdrop-filter: blur(4px);
}
.reel-center-play .icon { margin-left: 2px; }
.stream-item[data-player="playing"] .reel-center-play { visibility: hidden; }
.reel-tools-top {
  position: absolute;
  z-index: 1;
  inset: 13px 13px auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.reel-playback-controls {
  display: flex;
  gap: 6px;
}
.reel-tools-top :is(button,a) { pointer-events: auto; }
.reel-volume { display: flex; }
.reel-popup[hidden] { display: none; }
.reel-popup {
  border: 1px solid #ffffff30;
  color: #fff;
  background: #202023f5;
  box-shadow: 0 6px 24px #0005;
  pointer-events: auto;
}
.volume-panel {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  width: min(200px, 100%);
  padding: 5px 9px 5px 5px;
  border-radius: 13px;
}
.volume-panel input {
  width: 100%;
  min-width: 0;
  height: 28px;
  margin: 0;
  accent-color: var(--orange);
  cursor: pointer;
  touch-action: none;
}
.volume-panel output {
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.volume-mute {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  color: inherit;
}
.volume-mute:hover { background: var(--surface-hover); }
.reel-glass, .reel-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 24px;
  background: #18181ac4;
  color: #fff;
  backdrop-filter: blur(6px);
}
.reel-glass:hover, .reel-source:hover { background: #2e2e32e8; }
.reel-source {
  gap: 6px;
  padding: 7px 11px;
  min-height: 32px;
  font-size: .75rem;
  font-weight: 600;
  text-decoration: none;
}
.reel-source > svg:first-child { width: 13px; height: 16px; }
.reel-source > svg:last-child { opacity: .8; }
.when-paused, .when-silent,
[data-player="playing"] .when-playing,
[data-muted="false"] .when-audible {
  display: inline-flex;
}
.when-playing, .when-audible,
[data-player="playing"] .when-paused,
[data-muted="false"] .when-silent,
.error-source, [data-player="error"] .usual-source { display: none; }
[data-player="error"] .error-source { display: inline; }
.reel-caption {
  position: absolute;
  inset: auto 19px 18px;
  pointer-events: none;
  color: white;
  text-shadow: 0 1px 5px #0009;
}
.reel-byline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .86rem;
}
.reel-byline .avatar { height: 26px; width: 26px; font-size: 1.05rem; }
.reel-byline b {
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.reel-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid #ffffff36;
  border-radius: 20px;
  background: #1717199e;
  font-size: .73rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reel-caption h2 {
  margin: 9px 0 5px;
  font-size: 1.18rem;
  font-weight: 650;
  line-height: 1.18;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.reel-caption time {
  color: #e1dedc;
  font-size: .72rem;
}
.reel-rail {
  position: absolute;
  left: calc(100% + 14px);
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.stream-actions, .reel-navigation {
  display: grid;
  justify-items: center;
  gap: 10px;
}
.reel-social { position: relative; }
.reaction-strip {
  --choice-size: 42px;
  position: absolute;
  z-index: 3;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  width: 54px;
  max-height: min(calc(5 * var(--choice-size) + 2px), var(--space-above, 100dvh));
  border-radius: 17px;
  overflow: hidden auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: #69696f transparent;
  scroll-snap-type: y proximity;
}
.reaction-strip .emoji-choice {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  height: var(--choice-size);
  width: 100%;
  padding: 0;
  aspect-ratio: auto;
  border-radius: 10px;
  background: transparent;
  font-size: 1.47rem;
  scroll-snap-align: start;
}
.reaction-strip .emoji-choice:is(:hover,:focus-visible) { background: var(--surface-hover); }
.reaction-strip .emoji-choice.on { background: var(--peach); }
.reaction-strip .emoji-choice:focus-visible { outline-offset: -3px; }
.reaction-strip small { pointer-events: none; }
.reel-navigation {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  gap: 5px;
}
.reel-action {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0;
}
.reel-action-disc, .reel-nav-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--ink);
}
.reel-nav-button {
  width: 38px;
  height: 38px;
}
.reel-action:not(:disabled):hover .reel-action-disc, .reel-nav-button:not(:disabled):hover {
  background: var(--surface-hover);
  border-color: var(--control-line);
}
.reel-action.chosen .reel-action-disc, .reel-action[aria-expanded="true"] .reel-action-disc {
  background: var(--peach);
  color: var(--orange-dark);
}
.reel-emoji { font-size: 1.28rem; }
.reel-count {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 550;
}
.reel-nav-button:disabled { opacity: .29; }
.reel-sheet {
  position: absolute;
  z-index: 3;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  max-height: min(82%, 500px);
  border-top: 1px solid var(--line);
  border-radius: 17px 17px 0 0;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 -8px 32px #0004;
  touch-action: pan-y;
}
.reel-sheet:has(.stream-thread[hidden]) { display: none; }
.reel-sheet-close {
  position: absolute;
  z-index: 1;
  top: 9px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--muted);
}
.stream-thread {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.stream-thread .discussion {
  padding: 17px 15px 6px;
  border: 0;
  border-radius: 0;
}
.stream-thread .section-title { padding-right: 28px; }
.stream-thread .comment.nested { margin-left: 16px; }
.stream-thread .reply-to { margin-left: 0; }
@media (max-width: 760px) {
  .reel-page { grid-template-columns: minmax(0, 1fr); }
  .reel-page .meme-stream { grid-column: 1; }
  .stream-item {
    inset-inline: 0;
    width: min(56.25cqh, 100cqw);
    margin-inline: auto;
  }
  .main-wrap:has(.reel-page) .mobile-brandbar {
    position: absolute;
    z-index: 3;
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
  }
  .main-wrap:has(.reel-page) .mobile-wordmark { display: none; }
  .main-wrap:has(.reel-page) .mobile-brandbar .icon-btn,
  .reel-filter-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #ffffff2b;
    border-radius: 50%;
    background: #1b1b1ed9;
    color: #fff;
    backdrop-filter: blur(6px);
  }
  .reel-filter-toggle {
    position: absolute;
    z-index: 2;
    top: calc(max(12px, env(safe-area-inset-top)) + 48px);
    left: max(12px, env(safe-area-inset-left));
  }
  .reel-context[popover] {
    position: fixed;
    inset: max(12px, env(safe-area-inset-top)) auto auto calc(max(12px, env(safe-area-inset-left)) + 48px);
    margin: 0;
    padding: 18px;
    width: min(248px, calc(100vw - 78px));
    max-height: calc(100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    border: 1px solid var(--control-line);
    border-radius: 15px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 14px 42px #0006;
  }
  .reel-context::backdrop { background: #07070855; }
  .reel-context .title-row h1 { font-size: 1.3rem; }
  .reel-context .title-row p { font-size: .8rem; }
  .tools-row.reel-tools { margin-top: 16px; }
  .meme-stream > .empty {
    inset-inline: 0;
    width: min(calc(100% - 24px), 420px);
    margin-inline: auto;
    transform: translateY(-50%);
  }
  .reel-tools-top {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, calc(62px + env(safe-area-inset-left) - (100vw - 100%) / 2));
    right: max(12px, env(safe-area-inset-right));
  }
  .reel-rail {
    z-index: 2;
    top: calc(max(12px, env(safe-area-inset-top)) + 55px);
    bottom: max(96px, calc(68px + env(safe-area-inset-bottom)));
    left: auto;
    right: max(10px, env(safe-area-inset-right));
    flex-direction: column-reverse;
    justify-content: space-between;
    gap: 10px;
  }
  .stream-actions { gap: 8px; }
  .reel-navigation { padding: 0; border: 0; gap: 4px; }
  .reel-action-disc, .reel-nav-button, .reel-sheet-close {
    color: #fff;
    border-color: #ffffff33;
    background: #1b1b1ec9;
  }
  .reel-action-disc { width: 40px; height: 40px; }
  .reel-nav-button { width: 36px; height: 36px; }
  .reel-count { color: #fff; text-shadow: 0 1px 4px #000; }
  .reel-nav-button:disabled { opacity: .5; }
  .stream-item:has(.stream-thread:not([hidden])) .reel-rail { display: none; }
  .reel-caption {
    inset: auto 60px max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .reel-caption h2 { font-size: 1.05rem; }
  .reel-sheet { padding-bottom: env(safe-area-inset-bottom); }
}
@media (max-height: 580px) and (orientation: landscape) {
  .reel-context { padding-block: 18px; }
  .reel-rail {
    left: calc(100% + 9px);
    right: auto;
    top: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    gap: 7px;
    flex-direction: column;
  }
  .reel-rail .stream-actions { gap: 5px; }
  .reel-action-disc, .reel-nav-button { width: 36px; height: 36px; }
  .reel-navigation { display: flex; padding: 0; border: 0; gap: 3px; }
  .reel-tools-top { inset: max(6px, env(safe-area-inset-top)) 6px auto; }
  .reel-glass { min-width: 30px; min-height: 30px; }
  .reel-source { min-width: 30px; min-height: 30px; padding: 3px 6px; }
  .reel-source .usual-source, .reel-source svg:last-child { display: none; }
  .reel-caption { inset: auto 9px max(8px, env(safe-area-inset-bottom)); }
  .reel-caption h2 { margin-block: 4px; font-size: .92rem; }
}

.reel-end-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
}
.reel-end-check {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--orange-dark);
}
.reel-end-screen h2 {
  margin: 0;
  font-size: clamp(1.4rem, 6cqw, 2rem);
  line-height: 1.15;
  letter-spacing: -.035em;
}
