@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@600&display=swap");
:root {
  --paper: #EEF0F0; --surface: #FFFFFF; --ink: #1C2227; --muted: #5E6870; --line: #D3D8DB;
  --accent: #2F6FDB; --accent-ink: #FFFFFF; --link: #2F6FDB;
  --frame: #0B0E10; --caption: #FFFFFF;
  --display: Georgia, "Times New Roman", serif;
  --body: "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --r: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.5 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 48px;
}
[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.mast { display: grid; gap: 18px; padding-top: 28px; }
.brand { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 24px; }
.brand h1 { margin: 0; }

.lockup { display: grid; gap: 8px; justify-items: start; }
.fts { display: inline-flex; align-items: center; color: var(--muted); text-decoration: none; line-height: 1; }
.fts:hover { color: var(--ink); }
.fts img { height: 17px; width: auto; margin-right: 5px; }
.fts-word { width: 112px; height: 13px; background: currentColor;
  -webkit-mask: url(/static/brand/fts-wordmark-black.svg) left center / contain no-repeat;
  mask: url(/static/brand/fts-wordmark-black.svg) left center / contain no-repeat; }
.fts-com { margin-left: 2px; font-family: "Fredoka", var(--body); font-weight: 600; font-size: 15px; }
.tagline { margin: 0; color: var(--muted); font-size: 15px; max-width: 42ch; }
.tagline b { color: var(--ink); font-weight: 600; }

.browse { display: grid; gap: 6px; }
.browse-label { display: flex; justify-content: space-between; gap: 12px; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.browse-label b { color: var(--ink); font-weight: 500; }
.bars { display: flex; align-items: end; gap: 2px; height: 46px; border-bottom: 1px solid var(--line); }
.bars > * {
  flex: 1 1 0; min-width: 0; height: var(--h, 100%); padding: 0; border: 0; border-radius: 2px 2px 0 0;
  background: var(--line); transition: background .12s;
}
.bars > .hit { background: var(--accent); }
.ticks { position: relative; height: 12px; font: 400 10px/1 var(--mono); color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.ticks span:first-child { transform: none; }

.bars > .new-season { margin-left: 10px; }
.ticks .season { transform: none; text-transform: uppercase; letter-spacing: .06em; }

.bars > .soon {
  margin-left: 10px; height: 100%; display: flex; align-items: center; justify-content: center; padding: 0 4px;
  background: none; border: 1px dashed var(--muted); border-bottom: 0; opacity: .7;
  font: 500 10px/1.25 var(--mono); letter-spacing: .06em; text-transform: uppercase; text-align: center; color: var(--muted);
}

.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.field { position: relative; }
.field input {
  width: 100%; height: 60px; padding: 0 18px 0 50px; border-radius: var(--r);
  border: 2px solid var(--ink); background: var(--surface);
  font-family: var(--display); font-weight: 500; font-size: 22px;
}
.field svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }
.btn {
  height: 60px; padding: 0 18px; border-radius: var(--r); cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font-family: var(--body); font-weight: 700; font-size: 15px; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.btn:hover { background: var(--link); border-color: var(--link); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn.small { height: 40px; padding: 0 14px; font-size: 13px; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.recent > span { font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 26px; align-items: start; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.results-head h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.15; text-wrap: balance; }
.results-head h2 q { font-style: italic; }
.results-head p { margin: 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: grid; gap: 8px; text-align: left; padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; }
.card .frame { outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
.card:hover .frame { outline-color: var(--line); }
.card[aria-current="true"] .frame { outline-color: var(--accent); }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.meta .ep { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at, .code { font: 500 12px/1.4 var(--mono); color: var(--link); font-variant-numeric: tabular-nums; }
.code { margin-right: 6px; }
.tc { font: 400 12px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.where { position: relative; flex: 1; height: 2px; background: var(--line); border-radius: 1px; min-width: 30px; }
.where i { position: absolute; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); }
.empty { padding: 36px 0; color: var(--muted); }
.empty b { color: var(--ink); }

.frame {
  position: relative; aspect-ratio: var(--frame-aspect, 16 / 9); max-width: 100%; overflow: hidden;
  background: var(--frame); border-radius: var(--r); isolation: isolate;
}
.frame img, .frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .cap {
  position: absolute; left: 6%; right: 6%; bottom: 7%; text-align: center; z-index: 2;
  color: var(--caption); font-family: var(--body); font-weight: 800;
  font-size: clamp(12px, 1.5vw, 15px); line-height: 1.2; white-space: pre-line; text-wrap: balance;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000, 0 2px 6px rgba(0,0,0,.6);
}
.frame .cap.off { font-style: italic; }
.frame .cap mark { background: none; color: var(--accent); }
.frame .badge {
  position: absolute; top: 8px; left: 8px; z-index: 2; font: 500 10px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  background: rgba(0,0,0,.55); color: #fff; padding: 4px 6px; border-radius: 3px;
}
.player video { opacity: 0; transition: opacity .15s; }
.player video.ready { opacity: 1; }

.loading {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; overflow: hidden;
  background: rgba(5, 8, 10, .45); animation: loading-in .25s ease-out .2s both;
}
.loading::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%);
  transform: translateX(-100%); animation: loading-sweep 1.6s cubic-bezier(.45, 0, .25, 1) infinite;
}
.loading::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 35%;
  background: var(--accent); border-radius: 0 2px 2px 0; animation: loading-bar 1.6s cubic-bezier(.45, 0, .25, 1) infinite;
}
.loading .ring {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.22); border-top-color: var(--accent); border-right-color: var(--accent);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.45)); animation: loading-spin .8s linear infinite;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes loading-in { from { opacity: 0; } }
@keyframes loading-sweep { to { transform: translateX(100%); } }
@keyframes loading-bar { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@keyframes loading-spin { to { transform: rotate(1turn); } }
@keyframes loading-pulse { 50% { opacity: .45; } }

.player { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.timeline { position: relative; height: 26px; border-radius: 4px; background: var(--paper); overflow: hidden; }
.timeline .seg { position: absolute; top: 5px; bottom: 5px; border-radius: 2px; background: var(--line); }
.timeline .seg.hit { background: var(--accent); }
.trim { display: flex; flex-wrap: wrap; gap: 8px; }
.stepper {
  flex: 1; display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; height: 46px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); padding: 0 4px;
}
.stepper button { border: 0; background: none; height: 36px; border-radius: 4px; cursor: pointer; font-size: 18px; color: var(--muted); }
.stepper button:hover { background: var(--surface); color: var(--ink); }
.stepper .val { display: grid; justify-items: center; }
.stepper output { font: 500 17px/1.1 var(--mono); font-variant-numeric: tabular-nums; }
.stepper label { font: 500 10px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.create {
  flex: 1 1 100%; height: 54px; justify-content: space-between; gap: 12px;
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 17px;
}
.btn.create:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.size { font: 400 12px/1.3 var(--mono); opacity: .75; }

.hint { margin-left: 6px; font: 400 11px/1.3 var(--mono); opacity: .7; white-space: nowrap; }
@media (max-width: 640px) { .actions .btn.small { flex: 1 1 auto; } }
.ptitle { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.ptitle h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.15; }
.ptitle h3 .at { font-size: 14px; margin-left: 6px; }
.plot { margin: 0; color: var(--muted); font-size: 13px; }
.transcript { margin: 0; padding: 10px 0 0; list-style: none; display: grid; gap: 2px; border-top: 1px solid var(--line); }
.transcript button {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; width: 100%; padding: 5px 6px;
  border: 0; border-radius: 4px; background: none; text-align: left; font-size: 14px; cursor: pointer;
}
.transcript button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.transcript li .tc { padding-top: 2px; }
.transcript li.hit button { background: color-mix(in srgb, var(--accent) 22%, transparent); cursor: default; }
.transcript li.out { color: var(--muted); }
.transcript li.off .txt { font-style: italic; }

.note { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.note a { color: var(--link); text-underline-offset: 2px; }
.note span:first-of-type { margin-left: auto; }
@media (max-width: 640px) { .note span:first-of-type { margin-left: 0; } }

.note .support {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px 0 12px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; text-decoration: none;
}
.note .support:hover { background: var(--ink); color: var(--paper); }
.support .mark { width: 17px; height: 10px; flex: none; background: currentColor;
  -webkit-mask: url(/static/brand/fts-mark.svg) center / contain no-repeat;
  mask: url(/static/brand/fts-mark.svg) center / contain no-repeat; }

.doc { max-width: 640px; margin: 0 auto; padding: 32px 0 24px; font-size: 17px; line-height: 1.6; }
.doc-home { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; }
.doc-home:hover { color: var(--accent); }
.doc h1 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 50px); line-height: 1.02; letter-spacing: -.02em; margin: 44px 0 18px; text-wrap: balance; }
.doc h2 { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.2; margin: 44px 0 10px; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 8px; padding-left: .2em; }
.doc li::marker { color: var(--accent); }
.doc .lead { font-size: 19px; color: var(--ink); }
.doc cite { font-style: italic; }
.doc-contact {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 30px 0 8px;
  padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r);
}
.doc-email {
  font-family: var(--display); font-style: italic; font-weight: 700; font-size: clamp(22px, 4.6vw, 32px); line-height: 1.1;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 6px;
  overflow-wrap: anywhere;
}
.doc-email:hover { color: var(--link); }
.doc-updated { margin-top: 44px !important; font-size: 13px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r); font-size: 14px;
  max-width: calc(100% - 32px); z-index: 20;
}

.player .back { display: none; }

@media (max-width: 960px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .player {
    position: fixed; inset: 0; z-index: 30; overflow-y: auto; overscroll-behavior: contain;

    align-content: start; grid-auto-rows: max-content; border: 0; border-radius: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  }
  .player .back {
    display: inline-flex; align-items: center; gap: 4px; justify-self: start; min-height: 44px;
    margin: 0 0 -4px -8px; padding: 0 12px 0 4px; border: 0; border-radius: var(--r); background: none;
    color: var(--link); font: 600 16px var(--body); cursor: pointer;
  }
  .player .back svg { width: 22px; height: 22px; }
  body.previewing { overflow: hidden; }
}
@media (max-width: 640px) {
  .search { grid-template-columns: minmax(0, 1fr); }
  .bars { gap: 1px; height: 38px; }
  .bars > .new-season, .bars > .soon { margin-left: 6px; }
  #browseHint { display: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .meta .where { display: none; }
  .recent { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .recent > * { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  .player video { transition: none; }
  .loading::before, .loading::after { animation: none; display: none; }
  .loading .ring { animation: loading-pulse 1.6s ease-in-out infinite; }
}
