/* An unobstructed player and a compact, independently scrolling recipe. */
.card-expand {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid #ffffff0d; border-radius: 50%;
  background: #ffffff0d; color: #fff; backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 2px 3px #ffffff0d, 0 2px 4px -.5px #0000001f;
  opacity: 0; transform: translateY(-3px);
  transition: opacity .16s, transform .16s, background .16s;
}
.card-expand svg { width: 16px; height: 16px; }
.card:has(.card-expand) .dur-chip { right: auto; left: 10px; }
.card:hover .card-expand, .card:focus-within .card-expand { opacity: 1; transform: none; }
.card-expand:hover { background: #ffffff1a; }
.card:focus-within .card-hover, .card:focus-within .card-meta { opacity: 1; transform: none; }
.card-expand:focus-visible, .template-preview button:focus-visible, .tp-prompt:focus-visible {
  outline: 2px solid #fff; outline-offset: 3px;
}
.template-preview-open { overflow: hidden !important; }
.template-preview {
  position: fixed; inset: 0; margin: auto; padding: 0;
  width: calc(100% - 32px); max-width: 1840px;
  height: calc(100dvh - 32px); max-height: 1120px;
  border: 1px solid #ffffff1f; border-radius: 20px;
  background: #0b0c0d; color: var(--text); overflow: hidden;
  box-shadow: 0 32px 120px #0009; color-scheme: dark;
}
.template-preview::backdrop { background: #000c; backdrop-filter: blur(10px); }
.tp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100%; }
.tp-player-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 24px; }
.tp-player-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 24px; }
.tp-now-playing { color: #b6b7b9; font-size: 14px; overflow-wrap: anywhere; }
.tp-close {
  display: grid; place-items: center; flex-shrink: 0;
  margin-left: auto;
  width: 24px; height: 24px; padding: 0; border: 0;
  border-radius: 4px; background: transparent; color: #b6b7b9;
}
.tp-close svg { width: 16px; height: 16px; }
.tp-close:hover { background: #ffffff0d; color: #fff; }
.tp-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 14px 0; }
.tp-video, .tp-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; border-radius: 8px; }
.tp-video[hidden], .tp-image[hidden] { display: none; }
.tp-player-footer { min-height: 48px; display: flex; align-items: center; gap: 16px; padding: 4px 0; }
.tp-player-footer:has(.tp-back[hidden]):has(.tp-player-status:empty) { display: none; }
.tp-back[hidden], .tp-section[hidden], .tp-credit[hidden] { display: none; }
.tp-back { flex-shrink: 0; min-height: 40px; padding: 8px 16px; border: 1px solid #ffffff26; border-radius: 999px; font-size: 14px; }
.tp-back[aria-pressed="true"] { background: #ffffff12; border-color: #ffffff65; }
.tp-player-status { color: #b6b7b9; font-size: 13px; line-height: 1.4; }
.tp-sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #18191b; border-left: 1px solid #ffffff10; }
.tp-details { overflow-y: auto; overscroll-behavior: contain; flex: 1; padding: 28px 24px; }
.tp-eyebrow { color: #a5a5aa; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.tp-heading h2 { font-size: 24px; font-weight: 650; letter-spacing: -.035em; line-height: 1.15; margin: 10px 0; overflow-wrap: anywhere; }
.tp-subtitle { color: #aaaab0; font-size: 12px; line-height: 1.5; letter-spacing: .04em; overflow-wrap: anywhere; }
.tp-facts { display: grid; grid-template-columns: .7fr 1.3fr; gap: 16px; padding: 22px 0; border-bottom: 1px solid #ffffff13; }
.tp-facts dt { font-size: 13px; color: #a5a5aa; margin-bottom: 7px; }
.tp-facts dd { font-size: 15px; font-weight: 550; line-height: 1.4; overflow-wrap: anywhere; }
.tp-aspect { display: block; color: #a5a5aa; font-size: 12px; margin-top: 3px; }
.tp-section { padding-top: 24px; }
.tp-section h3 { font-size: 14px; font-weight: 550; line-height: 1.4; }
.tp-footage-count { color: #a5a5aa; margin-left: 4px; }
.tp-assets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.tp-asset { display: flex; flex-direction: column; gap: 7px; min-width: 0; text-align: left; font-size: 12px; line-height: 1.4; color: #babac0; overflow-wrap: anywhere; }
.tp-asset-thumbnail { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; background: #26282b; border: 1px solid #ffffff20; border-radius: 10px; }
.tp-asset-thumbnail img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.tp-asset-glyph { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #0008; color: white; font-size: 12px; }
.tp-asset[aria-pressed="true"] .tp-asset-thumbnail { border: 2px solid var(--accent); }
.tp-asset:hover .tp-asset-thumbnail { border-color: #fff; }
.tp-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-copy { min-height: 40px; padding: 4px 10px; border: 1px solid #ffffff20; border-radius: 8px; color: #d8d8dd; font-size: 12px; }
.tp-copy:hover { background: #ffffff10; }
.tp-prompt { margin-top: 12px; padding: 16px; background: #222326; border: 1px solid #ffffff0d; border-radius: 10px; font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.tp-copy-status:empty { display: none; }
.tp-copy-status { display: block; font-size: 13px; color: #dedee2; margin-top: 8px; }
.tp-actions { padding: 16px 24px 24px; border-top: 1px solid #ffffff10; background: #18191b; }
.tp-credit { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 0; padding: 8px 0 4px; color: #a5a5aa; font-size: 13px; line-height: 1.4; }
.tp-credit img { display: block; flex-shrink: 0; }
.tp-recreate { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 12px 20px; background: var(--accent); color: var(--accent-ink); border-radius: 12px; font-size: 16px; font-weight: 600; }
.tp-recreate:hover { filter: brightness(1.12); }
@media (hover: none), (pointer: coarse) { .card-expand { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .tp-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .tp-player-panel { padding: 12px 16px; }
  .tp-details { padding: 24px 18px; }
  .tp-actions { padding: 16px 18px; }
}
@media (max-width: 680px) {
  .template-preview { width: 100%; height: 100dvh; max-height: none; border: 0; border-radius: 0; }
  .tp-layout { display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
  .tp-player-panel { flex: 0 0 auto; height: min(65dvh, 600px); min-height: 280px; padding-top: max(10px, env(safe-area-inset-top)); }
  .tp-player-header { padding-right: 32px; }
  .tp-close { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 16px; z-index: 2; }
  .tp-sidebar { flex: 1 0 auto; border-left: 0; border-top: 1px solid #ffffff13; }
  .tp-details { overflow: visible; padding: 24px 20px; }
  .tp-actions { position: sticky; bottom: 0; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); }
  .tp-assets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .card-expand { transition: none; } }
