:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
  background: #000;
  --lavender: #ddc9ff;
  --muted: #cbc6cf;
  --text-shadow: 0 1px 3px #000c, 0 0 8px #0006;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
[hidden] { display: none !important; }
button, input, a { font: inherit; color: inherit; }
a { text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; background: transparent; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--lavender); outline-offset: -2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon {
  display: block; width: 24px; height: 24px; pointer-events: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.theater { height: 100vh; height: 100dvh; width: 100%; position: relative; display: grid; place-items: center; }
.viewer { --clip-aspect: .5625; position: absolute; inset: 0; }
.feed {
  width: 100%; height: 100%; overflow-y: auto; overflow-x: hidden;
  scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none;
  touch-action: pan-y pinch-zoom;
}
.feed::-webkit-scrollbar { display: none; }
.slide { width: 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.slide video { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

/* Match the painted video rectangle. The feed underneath owns the entire swipe surface. */
.overlay {
  position: absolute; inset: 0; margin: auto; width: 100%; height: 100%;
  max-width: calc(100vh * var(--clip-aspect)); max-width: calc(100dvh * var(--clip-aspect));
  max-height: calc(100vw / var(--clip-aspect));
  pointer-events: none;
}
.overlay::before, .overlay::after {
  content: ""; position: absolute; inset-inline: 0; pointer-events: none;
}
.overlay::before { top: 0; height: min(74px, 14%); background: linear-gradient(to bottom, #0005, transparent); }
.overlay::after { bottom: 0; height: min(106px, 18%); background: linear-gradient(to top, #0008, transparent); }
.overlay button, .overlay a { pointer-events: auto; }
.viewer-top, .caption, .rail, .progress { position: absolute; z-index: 1; }
.viewer-top {
  top: max(4px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(4px, env(safe-area-inset-right));
  display: flex; align-items: center; gap: 9px;
}
.viewer-top h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.035em; text-shadow: var(--text-shadow); }
.playback-actions { margin-left: auto; display: flex; }
.icon-button, .step, .resume { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.viewer-top .icon-button .icon { width: 21px; height: 21px; }
.overlay .icon { filter: drop-shadow(0 1px 2px #000b); }
.quiet { min-height: 44px; padding-inline: 12px; font-size: 13px; font-weight: 620; }
.rail {
  right: max(5px, env(safe-area-inset-right)); bottom: max(62px, calc(env(safe-area-inset-bottom) + 48px));
  display: grid; gap: clamp(5px, 1.3vh, 13px);
}
.action {
  min-width: 44px; min-height: 44px; padding: 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; border-radius: 12px;
}
.action .icon { width: 29px; height: 29px; }
.action[aria-pressed="true"] .icon { fill: #ff87a8; color: #ff87a8; }
#like-label { font-size: 12px; font-weight: 650; line-height: 1; text-shadow: var(--text-shadow); }
#like-label:empty { display: none; }
.caption {
  left: max(14px, env(safe-area-inset-left)); right: 62px;
  bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start;
}
.reel-description {
  width: 100%; display: flex; align-items: baseline; gap: 4px; min-height: 26px;
  font-size: 14px; line-height: 1.38; text-shadow: var(--text-shadow);
}
#caption-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#caption-toggle { flex: none; min-height: 26px; padding-inline: 2px; color: #faf8fc; font-weight: 650; text-shadow: inherit; }
.reel-description:has([aria-expanded="true"]) {
  display: block; max-height: 56vh; max-height: 56dvh; overflow-y: auto;
  overscroll-behavior: contain; pointer-events: auto;
}
.reel-description:has([aria-expanded="true"]) #caption-text { white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.overlay:has(#caption-toggle[aria-expanded="true"])::after {
  height: 75%; background: linear-gradient(to top, #000d, #0008 55%, transparent);
}
.byline {
  min-height: 44px; max-width: 100%; display: inline-flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 680; letter-spacing: -.025em; text-shadow: var(--text-shadow); border-radius: 4px;
}
.avatar {
  flex: none; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid #ffffffe6; background: linear-gradient(145deg, #a27eb6, #665075);
  box-shadow: 0 1px 5px #0006;
}
.avatar img { width: 20px; height: 23px; object-fit: contain; }
.hint {
  display: inline-flex; align-items: center; gap: 2px; margin: 0 0 1px; font-size: 12px;
  text-shadow: var(--text-shadow); animation: dismiss-hint .4s ease 3.6s forwards;
}
.hint .icon { width: 15px; height: 15px; }
@keyframes dismiss-hint { to { opacity: 0; } }
.progress { inset: auto 0 0; height: 2px; background: #ffffff32; }
.progress div { height: 100%; background: #ffffffe0; transform-origin: left; transform: scaleX(0); }

.resume, .clip-error { position: absolute; z-index: 2; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.resume { width: 58px; height: 58px; background: #0008; }
.resume .icon { width: 25px; height: 25px; margin-left: 3px; }
.clip-error { display: grid; justify-items: center; text-align: center; width: max-content; max-width: 92%; background: #161419ed; border-radius: 14px; padding: 16px 20px 4px; }
.clip-error .quiet { text-decoration: underline; text-underline-offset: 4px; }
.step-nav { display: none; }
@media (pointer: fine) and (min-width: 680px) and (min-aspect-ratio: 1/1) {
  .step-nav { position: absolute; right: max(12px, 2vw); top: 50%; transform: translateY(-50%); display: grid; gap: 8px; }
  .step { background: #ffffff16; }
}
@media (hover: hover) {
  .step:hover, .icon-button:hover, .action:hover { background: #ffffff20; }
  .byline:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .overlay:has(#caption-toggle[aria-expanded="true"]) .caption {
    left: auto; right: 54px; width: min(42vw, 27rem);
  }
}
@media (max-height: 430px) {
  .viewer-top:has(#pick-more:not([hidden])) h1 { display: none; }
  .caption { right: 4px; }
  .rail { gap: 1px; bottom: max(44px, env(safe-area-inset-bottom)); }
  .hint { display: none; }
}
.status { padding: 18px; width: min(420px, 100%); text-align: center; }
.status-mark {
  width: 76px; height: 80px; display: grid; place-items: center; margin: 0 auto 22px;
  border: 1px solid #5b4c65; border-radius: 19px; background: linear-gradient(145deg, #4d3e5b, #241e2e);
}
.status h1 { margin: 0; font-size: clamp(30px, 5vw, 43px); line-height: 1.1; letter-spacing: -.045em; }
.status p, dialog p { font-size: 16px; line-height: 1.5; color: var(--muted); }
.status p { margin: 10px auto 22px; max-width: 31ch; }
.pill { background: var(--lavender); color: #25182e; font-weight: 670; min-height: 45px; padding: 10px 22px; border-radius: 99px; }
#status-signup { display: inline-block; margin: 14px 8px; text-decoration: underline; text-underline-offset: 4px; }
dialog { width: min(360px, calc(100% - 30px)); padding: 24px; border: 1px solid #544b5b; border-radius: 18px; color: #fff; background: #241f29; }
dialog::backdrop { background: #07050bbf; }
dialog h2 { font-size: 23px; margin: 4px 36px 8px 0; }
dialog p { margin: 0; }
dialog .icon-button { position: absolute; right: 7px; top: 7px; }
#share-url { width: 100%; margin-top: 12px; padding: 10px; background: #131016; border: 1px solid #55495e; border-radius: 6px; }
.toast {
  position: fixed; z-index: 3; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: 90vw; padding: 10px 16px; border-radius: 99px; background: #241f29; text-align: center; font-size: 14px;
}
noscript { position: fixed; inset: 45% 8% auto; background: #201a26; padding: 20px; }
@media (prefers-reduced-motion: reduce) { .hint { animation-duration: 0s; } }
