/*
 * Prototype layer, loaded on every page after styles.css: the action search
 * bar, the Browse screen, the clip editor, and one button system.
 *
 * Buttons: yellow is the primary action (one per area), navy is every
 * secondary action, outlined navy is a toggle or a quiet action.
 * Icons are Lucide (icons.js), sized by font-size and centred by flex/grid.
 */
:root {
  --screen: #0f0d0b;
  --screen-ink: #f6f1e7;
  --screen-muted: rgba(246, 241, 231, 0.72);
  --shadow-1: 0 1px 2px rgba(27, 42, 71, 0.05), 0 2px 6px rgba(27, 42, 71, 0.05);
  --shadow-2: 0 12px 32px rgba(15, 13, 11, 0.16), 0 2px 6px rgba(15, 13, 11, 0.1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}
body { font-family: var(--font); -webkit-font-smoothing: antialiased; }
h1, .st-title h1 { font-variation-settings: "SOFT" 50; }

/* ---- icons ------------------------------------------------------------ */
.ico { width: 1.15em; height: 1.15em; flex-shrink: 0; display: block; stroke-width: 2; }
kbd {
  display: inline-grid; place-items: center;
  min-width: 1.5em; height: 1.5em; padding: 0 0.35em;
  font: 600 0.72rem/1 var(--font);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg2); color: var(--muted);
  vertical-align: middle;
}

/* ---- buttons ---------------------------------------------------------- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.75rem; padding: 0 1.15rem;
  border: 1.5px solid transparent; border-radius: 999px;
  font: 700 0.95rem/1 var(--font); letter-spacing: 0.005em;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s, filter 0.15s;
}
.ui-btn:hover { text-decoration: none; }
.ui-btn:active { transform: scale(0.98); }
.ui-btn .ico { font-size: 1.1rem; }
.ui-btn.sm { height: 2.25rem; padding: 0 0.9rem; font-size: 0.85rem; gap: 0.4rem; }
.ui-btn.lg { height: 3.25rem; padding: 0 1.5rem; font-size: 1.05rem; }
.ui-btn.block { width: 100%; }
.ui-btn.icon { width: 2.75rem; padding: 0; }
.ui-btn.icon.sm { width: 2.25rem; }
.ui-btn.primary { background: var(--action); color: var(--action-ink); }
.ui-btn.primary:hover { filter: brightness(1.05); }
.ui-btn.secondary { background: var(--secondary); color: var(--secondary-ink); }
.ui-btn.secondary:hover { filter: brightness(1.18); }
.ui-btn.outline { background: transparent; color: var(--secondary); border-color: color-mix(in srgb, var(--secondary) 35%, transparent); }
.ui-btn.outline:hover { border-color: var(--secondary); }
.ui-btn.outline[aria-pressed="true"] { background: var(--secondary); color: var(--secondary-ink); border-color: var(--secondary); }
.ui-btn:disabled, .ui-btn[aria-disabled="true"] { background: var(--bg3); color: var(--muted); border-color: transparent; cursor: not-allowed; filter: none; transform: none; }
@media (prefers-color-scheme: dark) { .ui-btn.outline { color: var(--text); border-color: var(--border-strong); } }

/* The legacy buttons follow the same rule: .btn is primary, .btn.ghost secondary. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border-radius: 999px; font-family: var(--font); }
.btn.ghost { background: transparent; color: var(--secondary); border: 1.5px solid color-mix(in srgb, var(--secondary) 35%, transparent); }
.btn.ghost:hover { border-color: var(--secondary); filter: none; }
.btn:disabled { background: var(--bg3); color: var(--muted); opacity: 1; }
.btn .ico { font-size: 1.05rem; }
.chip.on { background: var(--secondary); border-color: var(--secondary); color: var(--secondary-ink); }

/* ======================================================================
   Action search bar
   ====================================================================== */
.as { position: relative; width: 100%; }
.as-label {
  display: block;
  font: 600 0.72rem/1 var(--font-cond);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.45rem 0.15rem;
}
.as-field { position: relative; }
.as-field input {
  width: 100%; height: 3rem;
  padding: 0 3rem 0 1rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg2); color: var(--text);
  font: 500 1rem var(--font);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s, box-shadow 0.2s;
}
.as-field input::placeholder { color: var(--muted); opacity: 1; }
.as-field input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--secondary) 12%, transparent), var(--shadow-1); }
.as-flip { position: absolute; right: 0.95rem; top: 50%; width: 1.2rem; height: 1.2rem; margin-top: -0.6rem; overflow: hidden; pointer-events: none; color: var(--muted); }
.as-flip i { position: absolute; inset: 0; display: grid; place-items: center; transition: transform 0.2s var(--ease-out), opacity 0.2s; }
.as-flip .ico { font-size: 1.2rem; }
.as-flip-send { transform: translateY(-1.2rem); opacity: 0; color: var(--secondary); }
.as.is-typing .as-flip-search { transform: translateY(1.2rem); opacity: 0; }
.as.is-typing .as-flip-send { transform: none; opacity: 1; }
.as-hint { position: absolute; right: 2.6rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.as.is-typing .as-hint, .as.is-open .as-hint { display: none; }

/* compact: the top bar */
.as-compact .as-field input { height: 2.5rem; border-radius: 10px; font-size: 0.92rem; padding-right: 4.6rem; box-shadow: none; background: var(--bg); }
.as-compact .as-field input:focus { background: var(--bg2); }
.as-compact .as-pop { min-width: 520px; }

/* the panel unfolds (grid rows 0fr → 1fr); its rows rise one after another */
.as-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.4s var(--ease-out), opacity 0.2s;
  pointer-events: none;
}
.as-pop[data-open="true"] { grid-template-rows: 1fr; opacity: 1; pointer-events: auto; }
.as-pop-inner { min-height: 0; overflow: hidden; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-2); }
.as-list { list-style: none; margin: 0; padding: 0.35rem; max-height: min(62vh, 440px); overflow-y: auto; }
.as-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.55rem; border-radius: 8px; cursor: pointer;
  animation: as-rise 0.3s var(--ease-out) both;
}
.as-list li.still { animation: none; }
.as-list li:hover { background: var(--bg3); }
.as-list li[aria-selected="true"] { background: color-mix(in srgb, var(--secondary) 9%, var(--bg2)); }
@keyframes as-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.as-row-main { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.as-row-label { font-weight: 600; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-row-desc { font-size: 0.78rem; color: var(--muted); white-space: nowrap; text-transform: capitalize; }
.as-row-end { display: flex; align-items: center; gap: 0.55rem; flex-shrink: 0; font-size: 0.75rem; color: var(--muted); }
.as-row-short { font-variant-numeric: tabular-nums; }
.as-row-tag { min-width: 3.2rem; text-align: right; }
.as-ico { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 8px; flex-shrink: 0; background: var(--bg3); color: var(--text); }
.as-ico .ico { font-size: 1rem; }
.as-ico.primary { background: var(--action); color: var(--action-ink); }
.as-ico.secondary { background: var(--secondary); color: var(--secondary-ink); }
.as-thumb { width: 2.9rem; height: 1.9rem; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #000; }
.as-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-foot { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0.9rem; border-top: 1px solid var(--border); font-size: 0.74rem; color: var(--muted); }
.as-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 13, 11, 0.4); backdrop-filter: blur(3px); display: none; padding: 12vh 16px 0; }
.as-overlay.on { display: block; animation: as-fade 0.15s; }
.as-overlay-card { max-width: 620px; margin: 0 auto; }
.as-overlay .as-label { color: #fff; }
@keyframes as-fade { from { opacity: 0; } }

/* the top bar holds it, and stays above everything that scrolls under it */
.topbar { z-index: 50; }
.topbar .top-search { flex: 1; max-width: 460px; margin: 0 1rem; }
.topbar .top-search-go { display: none; }
.topbar .lens, .topbar .burger, .back-btn .ico { font-size: 1.25rem; }
.nav-toggle .burger { display: block; }

/* the search page's box is the same bar, large */
.as-page { margin: 0 0 0.5rem; max-width: 760px; }
.as-page .as-field input { height: 3.4rem; font-size: 1.1rem; border-radius: 14px; }

/* ======================================================================
   Browse
   ====================================================================== */
.bw { max-width: 1440px; margin: 0 auto; padding: 1.25rem 2rem 3rem; overflow-x: clip; }
.bw-find { display: flex; align-items: flex-end; gap: 0.75rem; max-width: 900px; margin: 0.25rem 0 1.25rem; position: relative; z-index: 25; }
.bw-search { flex: 1; }
.bw-lucky { display: flex; height: 3rem; flex-shrink: 0; }
.bw-lucky .ui-btn { height: 3rem; border-radius: 12px 0 0 12px; }
.bw-scope select {
  height: 3rem;
  border: 0; border-left: 1px solid rgba(0,0,0,0.14);
  border-radius: 0 12px 12px 0;
  background: var(--action); color: var(--action-ink);
  font: 600 0.88rem var(--font);
  padding: 0 1.9rem 0 0.8rem;
  cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 0.95rem center, right 0.65rem center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.rolling .ico { animation: roll 0.55s var(--ease-out); }
@keyframes roll { 60% { transform: rotate(400deg) scale(1.15); } 100% { transform: rotate(360deg); } }

.bw-hero {
  position: relative; width: 100%;
  aspect-ratio: 21 / 9; max-height: 64vh; min-height: 300px;
  border-radius: 18px; overflow: hidden;
  background: var(--screen); color: var(--screen-ink);
  box-shadow: var(--shadow-2); isolation: isolate;
}
.bw-hero-media, .bw-hero-media video, .bw-hero-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bw-hero-media video::cue { font: 600 1.05rem var(--font); background: rgba(0,0,0,0.55); }
.bw-hero-poster { transition: opacity 0.6s; }
.bw-hero-poster.gone { opacity: 0; }
.bw-hero.is-changing .bw-hero-copy > * { opacity: 0; transform: translateY(8px); }
.bw-hero-copy > * { transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out); }
.bw-hero-copy > *:nth-child(2) { transition-delay: 0.05s; }
.bw-hero-copy > *:nth-child(3) { transition-delay: 0.1s; }
.bw-hero-copy > *:nth-child(4) { transition-delay: 0.15s; }
.bw-hero-shade {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(15,13,11,0.92) 0%, rgba(15,13,11,0.7) 32%, rgba(15,13,11,0) 64%),
    linear-gradient(0deg, rgba(15,13,11,0.75) 0%, rgba(15,13,11,0) 40%);
}
.bw-hero-copy { position: absolute; z-index: 2; left: clamp(1.25rem, 4vw, 3.25rem); bottom: clamp(1.25rem, 4vw, 3rem); max-width: min(560px, 52%); }
.bw-kicker { margin: 0 0 0.6rem; font: 600 0.8rem var(--font-cond); letter-spacing: 0.1em; text-transform: uppercase; color: var(--screen-muted); }
.bw-kicker b { color: var(--action); font-weight: 700; }
.bw-quote { margin: 0; font: italic 800 clamp(1.8rem, 3.6vw, 3.1rem)/1.05 var(--font-display); font-variation-settings: "SOFT" 50; letter-spacing: -0.015em; text-wrap: balance; }
.bw-said { margin: 0.5rem 0 0; font-size: 0.95rem; color: var(--screen-muted); text-transform: capitalize; }
.bw-hero-acts { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.bw-hero .ui-btn.secondary { box-shadow: inset 0 0 0 1px rgba(246,241,231,0.18); }
#heroSound .ico-on, #heroSound[aria-pressed="true"] .ico-off { display: none; }
#heroSound[aria-pressed="true"] .ico-on { display: block; }
.bw-hero-progress { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(246,241,231,0.12); }
.bw-hero-progress i { display: block; height: 100%; width: 0; background: var(--action); }

.bw-tabs { display: flex; gap: 0.4rem; margin: 1.75rem -2rem 0.5rem; position: sticky; top: 59px; z-index: 20; padding: 0.6rem 2rem; background: var(--bg); }

.bw-rails { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.6rem; margin-top: 0.75rem; }
.rail { min-width: 0; }
.rail[hidden] { display: none; }
.rail-head { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 0.5rem; }
.rail-head h2 { margin: 0; font: 700 1.2rem var(--font); letter-spacing: -0.01em; }
.rail-sub { color: var(--muted); font-size: 0.85rem; }
.rail-head .ui-btn { margin-left: auto; }
.rail-wrap { position: relative; margin: 0 -2rem; }
.rail-track {
  display: flex; gap: 0.75rem; overflow-x: auto;
  scroll-snap-type: x mandatory; scroll-padding: 0 2rem;
  padding: 0.6rem 2rem 1rem; scrollbar-width: none;
}
.rail-track::-webkit-scrollbar { display: none; }
.rail-track.is-dealing > * { opacity: 0; transform: translateY(10px) rotate(-1deg); }
.rail-track > * { transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out); }
.rail-track > *:nth-child(2) { transition-delay: 0.03s; } .rail-track > *:nth-child(3) { transition-delay: 0.06s; }
.rail-track > *:nth-child(4) { transition-delay: 0.09s; } .rail-track > *:nth-child(5) { transition-delay: 0.12s; }
.rail-track > *:nth-child(6) { transition-delay: 0.15s; } .rail-track > *:nth-child(7) { transition-delay: 0.18s; }
.bw-arrow {
  position: absolute; top: 50%; transform: translateY(-60%); z-index: 3;
  opacity: 0; transition: opacity 0.2s;
  box-shadow: var(--shadow-2);
}
.bw-arrow.left { left: 1.25rem; }
.bw-arrow.right { right: 1.25rem; }
.rail-wrap:hover .bw-arrow { opacity: 1; }
.rail-wrap.at-start .bw-arrow.left, .rail-wrap.at-end .bw-arrow.right { opacity: 0; pointer-events: none; }
.rail-empty {
  display: grid; gap: 0.3rem; align-content: center;
  min-width: 300px; padding: 1.2rem 1.4rem;
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  color: var(--muted); font-size: 0.9rem;
}
.rail-empty b { color: var(--text); font-size: 1rem; }

.scard {
  position: relative; flex: 0 0 clamp(220px, 21vw, 300px); aspect-ratio: 16 / 9;
  border-radius: 10px; overflow: hidden;
  background: var(--screen); color: var(--screen-ink);
  scroll-snap-align: start; text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.scard:hover { text-decoration: none; transform: translateY(-3px) scale(1.035); box-shadow: var(--shadow-2); z-index: 2; }
.scard:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.scard-frame, .scard-frame img, .scard-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.scard-frame video { opacity: 0; transition: opacity 0.3s; }
.scard.peeking .scard-frame video { opacity: 1; }
.scard-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(15,13,11,0.9) 0%, rgba(15,13,11,0.25) 55%, rgba(15,13,11,0.35) 100%); }
.scard-top { position: absolute; top: 0.55rem; left: 0.6rem; right: 0.6rem; display: flex; justify-content: space-between; font: 700 0.72rem var(--font-cond); letter-spacing: 0.06em; }
.scard-top b { background: var(--action); color: var(--action-ink); padding: 0.12rem 0.4rem; border-radius: 4px; }
.scard-top i { font-style: normal; background: rgba(15,13,11,0.6); padding: 0.12rem 0.4rem; border-radius: 4px; }
.scard-copy { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 0.65rem; display: grid; gap: 0.2rem; transition: transform 0.25s var(--ease-out); }
.scard-quote { font: italic 700 1.02rem/1.2 var(--font-display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.scard-meta { font-size: 0.75rem; color: var(--screen-muted); text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-acts { position: absolute; right: 0.6rem; bottom: 0.6rem; display: flex; align-items: center; gap: 0.4rem; opacity: 0; transform: translateY(6px); transition: 0.2s var(--ease-out); }
.scard:hover .scard-acts, .scard:focus-visible .scard-acts { opacity: 1; transform: none; }
.scard:hover .scard-copy { transform: translateY(-2.4rem); }
.scard-acts .ui-btn.secondary { box-shadow: inset 0 0 0 1px rgba(246,241,231,0.2); }
.scard.skel { background: linear-gradient(90deg, var(--bg3), var(--bg2), var(--bg3)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; box-shadow: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.peek { display: block; }

.tcard {
  flex: 0 0 150px; position: relative; aspect-ratio: 2 / 3;
  border-radius: 10px; overflow: hidden;
  background: var(--screen); color: var(--screen-ink);
  scroll-snap-align: start; text-decoration: none; box-shadow: var(--shadow-1);
  border: 0; font: inherit; text-align: left; padding: 0; cursor: pointer;
  transition: transform 0.25s var(--ease-out);
}
.tcard:hover { transform: translateY(-3px); text-decoration: none; }
.tcard img { width: 100%; height: 100%; object-fit: cover; }
.tcard-art { position: absolute; inset: 0; }
.tcard-art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease-out); }
.tcard:hover .tcard-art img { transform: scale(1.06); }
.tcard-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(15,13,11,0.92) 0%, rgba(15,13,11,0.35) 45%, rgba(15,13,11,0.15) 100%); }
.tcard-title { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-62%); display: grid; place-items: center; }
.tcard-title span { padding: 0.35rem 0.9rem 0.45rem; background: var(--action); color: var(--accent); border-radius: 50%; font: italic 800 1.35rem/1 var(--font-display); transform: rotate(-6deg); box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.tcard-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.5rem 0.6rem; font: 700 0.72rem var(--font-cond); letter-spacing: 0.06em; text-transform: uppercase; background: linear-gradient(0deg, rgba(15,13,11,0.85), transparent); color: var(--screen-ink); z-index: 1; }
.tcard-ep { position: absolute; left: 0.75rem; right: 0.75rem; bottom: 2rem; display: grid; gap: 0.3rem; z-index: 1; }
.tcard-ep b { font: 700 0.72rem var(--font-cond); letter-spacing: 0.06em; color: var(--action-ink); background: var(--action); justify-self: start; padding: 0.12rem 0.4rem; border-radius: 4px; }
.tcard-ep span { font: italic 800 1.15rem/1.1 var(--font-display); text-wrap: balance; }
.tcard.ep .tcard-meta { background: none; color: var(--screen-muted); }
/* the same card on /library and in the search page's library row */
.library-wall .tcard, .library .tcard { flex: none; width: 100%; }
.library .tcard { width: 150px; flex: 0 0 150px; }

/* ======================================================================
   Clip editor
   ====================================================================== */
.st { max-width: 1320px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
.st-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1rem; }
.st-title { min-width: 0; flex: 1; }
.st-crumb { margin: 0; font: 700 0.75rem var(--font-cond); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.st-title h1 { margin: 0; font: italic 800 clamp(1.4rem, 2.4vw, 1.9rem)/1.1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.st-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 32vw, 380px); gap: 1.25rem; align-items: start; }
.st-stage { display: grid; gap: 0.75rem; position: sticky; top: 74px; }
.st-player { border-radius: 14px; box-shadow: var(--shadow-2); }
.st-player video::cue { font: 600 1rem var(--font); }
.st-player .play-overlay { display: grid; place-items: center; padding: 0; font-size: 1.8rem; }
.st-player .play-overlay.hidden { display: none; }
.st-player .play-overlay .ico { margin-left: 0.12em; }

.st-transport { display: flex; align-items: center; gap: 0.85rem; }
.st-transport .tp-play { width: 3rem; height: 3rem; }
.tp-play .ico { font-size: 1.3rem; }
.tp-play .i-play { transform: translateX(1px); }
.tp-play .i-pause, .is-playing .tp-play .i-play { display: none; }
.is-playing .tp-play .i-pause { display: block; }
.tp-times { display: grid; line-height: 1.15; }
.tp-dur { font: 700 1.35rem var(--font); font-variant-numeric: tabular-nums; }
.tp-span { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tp-tools { margin-left: auto; display: flex; gap: 0.4rem; }
.tp-tools .hidden { display: none; }

.tl { position: relative; height: 76px; border-radius: 10px; overflow: hidden; background: var(--screen); cursor: crosshair; touch-action: none; user-select: none; }
.tl-strip { position: absolute; inset: 14px 0 0; display: flex; }
.tl-strip img { flex: 1; min-width: 0; height: 100%; object-fit: cover; opacity: 0.9; pointer-events: none; }
.tl-marks { position: absolute; left: 0; right: 0; top: 0; height: 14px; background: #1d1915; }
.tl-mark { position: absolute; top: 4px; height: 6px; border-radius: 3px; background: rgba(246,241,231,0.35); }
.tl-mark.in { background: var(--action); }
.tl-dim { position: absolute; top: 14px; bottom: 0; background: rgba(15,13,11,0.62); pointer-events: none; }
.tl-dim.left { left: 0; }
.tl-dim.right { right: 0; }
.tl-range { position: absolute; top: 14px; bottom: 0; border-top: 3px solid var(--action); border-bottom: 3px solid var(--action); cursor: grab; box-sizing: border-box; }
.tl.drag-move .tl-range { cursor: grabbing; }
.tl-handle { position: absolute; top: -3px; bottom: -3px; width: 16px; background: var(--action); cursor: ew-resize; display: grid; place-items: center; touch-action: none; }
.tl-handle.start { left: -8px; border-radius: 6px 0 0 6px; }
.tl-handle.end { right: -8px; border-radius: 0 6px 6px 0; }
.tl-handle i { width: 3px; height: 22px; border-radius: 2px; background: rgba(27,27,27,0.55); }
.tl-handle:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.3); pointer-events: none; z-index: 3; }
.tl-head::before { content: ""; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: #fff; }
.tl-legend { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-tip { text-align: center; font-size: 0.75rem; color: var(--muted); }
.tl-trim { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.trim-group { display: inline-flex; align-items: center; gap: 0.35rem; }
.trim-label { font: 700 0.72rem var(--font-cond); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-right: 0.15rem; }
.trim-time { min-width: 4.2rem; text-align: center; font: 600 0.95rem var(--font); font-variant-numeric: tabular-nums; }

.st-side { display: grid; gap: 1rem; min-width: 0; }
.st-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 1rem; box-shadow: var(--shadow-1); min-width: 0; }
.st-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.st-card-head h2 { margin: 0; font: 700 0.78rem var(--font-cond); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.st-make-meta, .st-hint { font-size: 0.8rem; color: var(--muted); }
.st-make { display: grid; gap: 0.85rem; }
.st-make .st-card-head { margin-bottom: 0; }

/* format: a segmented control; the choice is navy, the action stays yellow */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: 12px; background: var(--bg3); }
.seg button { border: 0; border-radius: 9px; background: transparent; color: var(--text); padding: 0.45rem 0.25rem; font: inherit; display: grid; gap: 0.1rem; justify-items: center; cursor: pointer; }
.seg button b { font-size: 0.9rem; font-weight: 700; }
.seg button i { font-style: normal; font-size: 0.7rem; color: var(--muted); }
.seg button:hover { background: color-mix(in srgb, var(--bg2) 70%, transparent); }
.seg button[aria-checked="true"] { background: var(--secondary); color: var(--secondary-ink); box-shadow: var(--shadow-1); }
.seg button[aria-checked="true"] i { color: inherit; opacity: 0.75; }
.seg button:disabled { opacity: 0.35; cursor: not-allowed; }

/* meme text: a row that opens into two stacked fields; each field's tools on their own line */
.mt { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.mt-toggle {
  display: flex; align-items: center; gap: 0.7rem; width: 100%;
  padding: 0.65rem 0.75rem; border: 0; background: var(--bg2);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.mt-toggle:hover { background: var(--bg); }
.mt-toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.mt-toggle-ico { width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; background: var(--bg3); color: var(--text); flex-shrink: 0; }
.mt-toggle-ico .ico { font-size: 1.05rem; }
.mt-toggle-text { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.mt-toggle-text b { font-size: 0.9rem; }
.mt-toggle-text i { font-style: normal; font-size: 0.76rem; color: var(--muted); }
.mt-chev { color: var(--muted); transition: transform 0.2s var(--ease-out); }
.mt-toggle[aria-expanded="true"] .mt-chev { transform: rotate(180deg); }
.mt-toggle[aria-expanded="true"] .mt-toggle-ico { background: var(--secondary); color: var(--secondary-ink); }
.mt-body { display: grid; gap: 0.85rem; padding: 0.85rem 0.75rem 0.75rem; border-top: 1px solid var(--border); background: var(--bg); }
.mt-body.hidden { display: none; }
.mt-field { display: grid; gap: 0.4rem; }
.mt-field-head { display: flex; justify-content: space-between; align-items: baseline; }
.mt-field-head label { font: 700 0.72rem var(--font-cond); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mt-count { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.mt-count.over { color: var(--danger); font-weight: 700; }
.mt-field input {
  width: 100%; height: 2.6rem; padding: 0 0.75rem;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg2); color: var(--text);
  font: 700 0.95rem var(--font); text-transform: uppercase; letter-spacing: 0.02em;
}
.mt-field input::placeholder { text-transform: none; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.mt-field input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--secondary) 14%, transparent); }
.mt-tools { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.mt-colors, .mt-size { display: inline-flex; align-items: center; gap: 0.3rem; padding: 3px; border-radius: 999px; background: var(--bg3); }
.mt-swatch { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: transparent; cursor: pointer; }
.mt-swatch span { width: 1.15rem; height: 1.15rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(27,42,71,0.35); }
.mt-swatch[data-color="white"] span { background: #fff; }
.mt-swatch[data-color="black"] span { background: #111; }
.mt-swatch[aria-checked="true"] { background: var(--bg2); box-shadow: 0 0 0 2px var(--secondary); }
.mt-size .ui-btn { height: 1.9rem; width: 1.9rem; border: 0; background: transparent; color: var(--text); }
.mt-size .ui-btn:hover:not(:disabled) { background: var(--bg2); }
.mt-size .ui-btn:disabled { background: transparent; opacity: 0.35; }
.mt-size .ico { font-size: 1.05rem; }
.mt-size-label { font-size: 0.72rem; color: var(--muted); padding: 0 0.15rem; }

.st-job { margin: 0; padding: 0; border: 0; background: none; display: grid; gap: 0.5rem; }
.st-job .btn.fat { height: 3.1rem; font-size: 1.02rem; }
.st-job .job-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 0.4rem; }
.st-job .job-acts .btn { width: 100%; height: 2.3rem; padding: 0 0.5rem; }
.st-why { margin: 0; font-size: 0.8rem; color: var(--muted); text-align: center; }
.st-job .job-foot { flex-wrap: wrap; gap: 0.5rem; }
.st-job .job-line { white-space: normal; min-width: 0; }
.st-why.hidden { display: none; }

/* the script */
.st-script { padding-bottom: 0.4rem; }
.st-lines { max-height: 52vh; overflow-y: auto; margin: 0 -0.5rem; padding: 0 0.5rem; display: grid; gap: 0; }
.st-line {
  display: grid; grid-template-columns: 2.6rem 1fr 1.75rem; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.55rem 0.5rem; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; position: relative;
}
.st-line:hover { background: var(--bg3); }
.st-line-when { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; align-self: start; padding-top: 0.15rem; }
.st-line-text { display: grid; gap: 0.1rem; font-size: 0.93rem; line-height: 1.35; }
.st-line-text b { font: 700 0.72rem var(--font-cond); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.st-line-add {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--secondary-ink); background: var(--secondary);
  opacity: 0; transform: scale(0.7); transition: 0.15s;
}
.st-line-add .ico { font-size: 0.95rem; }
.st-line.near .st-line-add, .st-line.partial .st-line-add { opacity: 0.45; transform: scale(0.9); }
.st-line.near:hover .st-line-add, .st-line.partial:hover .st-line-add { opacity: 1; transform: none; }
.st-line-add .i-trim, .st-line.trim .st-line-add .i-add { display: none; }
.st-line.trim .st-line-add .i-trim { display: block; }
.st-line.trim .st-line-add { opacity: 0.45; transform: scale(0.9); background: var(--bg2); color: var(--secondary); box-shadow: inset 0 0 0 1.5px var(--secondary); }
.st-line.trim:hover .st-line-add { opacity: 1; transform: none; background: var(--secondary); color: var(--secondary-ink); }
.st-line.in { background: var(--highlight); border-radius: 0; }
.st-line.in.first { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.st-line.in.last { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.st-line.partial { background: linear-gradient(90deg, var(--highlight), transparent 70%); }
.st-more { width: 100%; margin: 0.25rem 0; }
.st-clips { margin-top: 1.5rem; }

/* ======================================================================
   Narrow
   ====================================================================== */
@media (max-width: 1100px) { .tl-tip { display: none; } }
@media (max-width: 860px) {
  .topbar .top-search { max-width: none; margin: 0 0.5rem; }
  .as-compact .as-pop { min-width: 0; }
}
@media (max-width: 780px) {
  .st-grid { grid-template-columns: 1fr; }
  .st-stage { position: static; }
  .st-lines { max-height: none; }
  /* typing meme text on a phone: keep the picture in view */
  .remixing .st-player { position: sticky; top: 56px; z-index: 15; }
}
@media (max-width: 640px) {
  .topbar .top-search { display: none; }
  .topbar .top-search-go { display: grid; place-items: center; width: 44px; height: 44px; color: var(--text); }
}
@media (max-width: 720px) {
  .bw { padding: 0.75rem 16px 2rem; }
  .bw-find { flex-direction: column; align-items: stretch; }
  .bw-lucky .ui-btn { flex: 1; }
  .bw-hero { aspect-ratio: 5 / 4; min-height: 340px; max-height: 62vh; border-radius: 14px; }
  .bw-hero-shade { background: linear-gradient(0deg, rgba(15,13,11,0.95) 0%, rgba(15,13,11,0.6) 45%, rgba(15,13,11,0.1) 75%); }
  .bw-hero-copy { max-width: none; right: 1.25rem; }
  .rail-wrap { margin: 0 -16px; }
  .rail-track { padding: 0.5rem 16px 0.9rem; scroll-padding: 0 16px; }
  .scard { flex-basis: 72vw; }
  .bw-arrow { display: none; }
  .bw-tabs { overflow-x: auto; top: 56px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .bw-tabs .ui-btn { flex-shrink: 0; }
  .st { padding: 0.75rem 16px 2rem; }
  .st-head .label { display: none; }
  .tp-tools .label { display: none; }
  .tp-tools .ui-btn { width: 2.75rem; padding: 0; }
  .as-foot span:first-child { display: none; }
}
