/* ==================================================================
   StreamVerse DS 4 — janelas, folhas e gavetas próprias das páginas
   Mesmo visual do motor de modais (assets/core/css/modal.css): superfície sólida, cantos de 16px,
   sombra só porque flutua de verdade, entrada curta e folha de baixo no celular.
   ================================================================== */
:root {
  --ds-scrim: color-mix(in srgb, var(--ui-overlay, rgba(3, 3, 8, .72)) 100%, transparent);
}

/* Fundos escurecidos */
.bi-backdrop, .filters-backdrop, .pin-modal-backdrop, .reels-sheet-backdrop, .rs-backdrop,
.story-report-backdrop, .story-viewer-backdrop {
  background: var(--ds-scrim);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: ds-fade .16s ease both;
}

/* Cartões / folhas */
.bi-sheet, .filters.has-drawer .filters-sheet, .pin-modal-card, .reels-sheet-panel, .rs-panel,
.story-report-modal, .story-report-sheet, .story-viewers-sheet, .unlock-sheet,
dialog.gift-dialog, dialog[class*="-dialog"], .cp-panel, .command-palette-panel {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong, var(--border-strong));
  border-radius: var(--r-window, 16px);
  box-shadow: var(--float);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: ds-sheet-in .2s var(--ds-ease) both;
}
dialog.gift-dialog::backdrop, dialog[class*="-dialog"]::backdrop {
  background: var(--ds-scrim);
}

/* Cabeçalho comum: título forte e botão de fechar redondo */
.bi-sheet h2, .rs-panel h2, .rs-panel h3, .filters.has-drawer .filters-sheet h2, .unlock-sheet h2,
.story-report-modal h2, .story-report-sheet h2, .reels-sheet-panel h2 { font-family: var(--font-display); font-weight: var(--display-weight, 750); letter-spacing: var(--display-track, 0); }
.bi-close, .pin-modal-close, .rs-close, .filters-close, .story-report-close, .reels-sheet-close {
  border-radius: var(--r-control, 8px);
  transition: background-color .15s ease;
}
.pin-modal-close:hover, .rs-close:hover, .filters-close:hover, .story-report-close:hover, .reels-sheet-close:hover { background: var(--hover); transform: none; }
.bi-close { min-height: 46px; border-radius: var(--r-control, 8px); font-weight: 600; }

/* Ícone do selo */
.bi-icon { border-radius: var(--r-panel, 12px); box-shadow: none; }

/* Gavetas laterais e de filtros */
.filters.has-drawer .filters-sheet { border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; }
.pl-drawer { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--line-strong, var(--border-strong)); }

/* Pop-ups pequenos (menus, resultados, sugestões) */
.popover, .tooltip, [role="tooltip"], .emoji-picker, .mention-list {
  border-radius: var(--r-panel, 12px);
  border: 1px solid var(--line-strong, var(--border-strong));
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: var(--float);
}

/* Celular: tudo vira folha de baixo com alça */
@media (max-width: 640px) {
  .bi-backdrop, .unlock-backdrop, .rs-backdrop, .story-report-backdrop, .reels-sheet-backdrop { align-items: flex-end; }
  .bi-sheet, .rs-panel, .unlock-sheet, .story-report-modal, .story-report-sheet, .story-viewers-sheet, .reels-sheet-panel, .pin-modal-card {
    border-radius: var(--r-window, 16px) var(--r-window, 16px) 0 0;
    border-bottom: 0;
    max-height: 92dvh;
    overflow: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    animation: ds-sheet-up .24s var(--ds-ease) both;
  }
  .bi-sheet::before, .rs-panel::before, .unlock-sheet::before, .story-report-modal::before, .story-report-sheet::before, .reels-sheet-panel::before {
    content: "";
    display: block;
    width: 40px; height: 4px;
    margin: -6px auto 14px;
    border-radius: 4px;
    background: var(--ds-hair-strong);
  }
  .filters.has-drawer .filters-sheet { border-radius: var(--r-window, 16px) var(--r-window, 16px) 0 0; }
}

@keyframes ds-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ds-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .bi-backdrop, .filters-backdrop, .pin-modal-backdrop, .reels-sheet-backdrop, .rs-backdrop, .story-report-backdrop, .story-viewer-backdrop,
  .bi-sheet, .filters.has-drawer .filters-sheet, .pin-modal-card, .reels-sheet-panel, .rs-panel, .story-report-modal, .story-report-sheet, .story-viewers-sheet, .unlock-sheet { animation: none; }
}

/* ------------------------------ Trailer em janela (alpha.107) ------------------------------
   Antes o estilo só existia na página do player: no filme e na série a janela mostrava um quadro branco
   pequeno e botões soltos. Agora: vídeo 16:9 com a capa do trailer enquanto carrega, nome do vídeo e
   "Abrir no YouTube" embaixo, e os outros vídeos numa faixa com miniatura que rola de lado. */
.modal--trailer { max-width: 880px; }
.modal--trailer .modal-body { padding-top: 4px; }
.trailer { display: grid; gap: var(--sp-3); min-width: 0; }
.trailer-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r-panel); background: #000; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, .7); }
.trailer-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; opacity: 0; transition: opacity var(--dur-2) var(--ease-out); }
.trailer-stage.is-ready iframe { opacity: 1; }
.trailer-cover { position: absolute; inset: 0; display: grid; place-items: center; background: #000 center / cover no-repeat; }
.trailer-cover::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.trailer-spin { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: trailer-spin .8s linear infinite; }
.trailer-stage.is-ready .trailer-spin { animation: none; }
@keyframes trailer-spin { to { transform: rotate(360deg); } }
.trailer-foot { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.trailer-now { margin: 0; min-width: 0; font-weight: 700; font-size: var(--fs-sm); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trailer-open { flex: none; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text); text-decoration: none; }
.trailer-open:hover { text-decoration: underline; }
.trailer-open[hidden] { display: none; }
.trailer-list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 190px); gap: var(--sp-2); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: var(--sp-1); scrollbar-width: thin; }
.trailer-chip { display: grid; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; scroll-snap-align: start; transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out); }
.trailer-chip:hover { border-color: var(--border-strong); }
.trailer-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.trailer-chip.is-active { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }
.trailer-chip-thumb { display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.trailer-chip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trailer-chip-title { font-size: var(--fs-xs); font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .trailer-stage { border-radius: var(--r-control); margin-inline: calc(var(--sp-2) * -1); }
  .trailer-list { grid-auto-columns: 62%; }
}
@media (prefers-reduced-motion: reduce) {
  .trailer-spin { animation: none; }
  .trailer-stage iframe { transition: none; }
}
