:root {
  color-scheme: dark;
  --canvas: #101813;
  --panel: #19241d;
  --line: #37473c;
  --quiet: #afc1b2;
  --text: #f3f6ec;
  --lime: #d0ef99;
  font: 100%/1.5 system-ui, sans-serif;
  background: var(--canvas);
  color: var(--text);
}
* { box-sizing: border-box }
body { margin: 0 }
a { color: inherit }
a:focus-visible, video:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px }
header { border-bottom: 1px solid var(--line) }
.bar, main { width: min(100% - 2.5rem, 66rem); margin: auto }
.bar { min-height: 4.35rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem }
nav a, .actions a, h2 a, .open, .pager a { text-decoration: none }
.title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: clamp(1.8rem,5vw,3.5rem) }
h1 { margin: 0; font-size: clamp(2.65rem,6.5vw,4.55rem); font-weight: 680; line-height: 1.04; letter-spacing: -.065em }
.title > span { color: var(--quiet); font-size: .9rem; white-space: nowrap }
nav { display: flex; flex-wrap: wrap; gap: .38rem; margin: 1.35rem 0 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line) }
nav a { padding: .48rem .95rem; border-radius: 2rem; font-size: .9rem; font-weight: 600; color: var(--quiet) }
nav a[aria-current] { color: var(--canvas); background: var(--lime) }
nav a:hover:not([aria-current]), .actions a:hover, .open:hover { background: #253529; color: var(--text) }
#library { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; align-items: start }
.clip-card, .status-card { border: 1px solid var(--line); border-radius: .8rem; background: var(--panel); min-width: 0 }
.frame { background: #0a100d; aspect-ratio: 16/10; border-radius: .75rem .75rem 0 0; overflow: hidden; position: relative }
.frame a, .frame video, .frame img { display: block; width: 100%; height: 100% }
.frame img { object-fit: contain }
.frame:has(> video) { aspect-ratio: auto }
.frame video { height: auto; max-height: 72svh; object-fit: contain }
.watch { position: relative }
.watch:focus-visible { outline-offset: -3px }
.play { position: absolute; left: .85rem; bottom: .85rem; display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border-radius: 50%; background: #101813e6; border: 1px solid #ffffff65 }
.play::after { content: ""; margin-left: .17rem; border-left: .64rem solid #fff; border-top: .43rem solid transparent; border-bottom: .43rem solid transparent }
.watch:hover .play, .watch:focus-visible .play { background: #2e3f2f }
.caption { padding: 1rem 1.1rem .9rem }
.meta { display: flex; align-items: center; gap: .65rem; font-size: .83rem; color: var(--quiet) }
.state { display: inline-flex; align-items: center; gap: .4rem }
.state::before { content: ""; width: .34rem; height: .34rem; border-radius: 50%; background: currentColor }
.ready { color: var(--lime) }
h2 { margin: .48rem 0; font-size: clamp(1.1rem,2.1vw,1.45rem); line-height: 1.25; letter-spacing: -.035em; overflow-wrap: anywhere }
h2 a:hover { text-decoration: underline; text-underline-offset: .15em }
.actions { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .8rem }
.actions a, .open { border-radius: .3rem; color: var(--quiet); font-size: .88rem; padding: .25rem 0 }
.code { color: var(--lime); font: .9rem/1.4 ui-monospace, monospace; margin-right: .4rem }
.status-card { grid-column: 1/-1; display: flex; gap: 1rem; align-items: center; padding: 1rem 1.15rem }
.status-body { flex: 1; min-width: 0 }
.status-card h2 { font-size: 1.14rem; margin: .15rem 0 }
.status-card p { margin: 0; font-size: .94rem; color: var(--quiet) }
.status-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; border: 1px solid #62543e; border-radius: .65rem; background: #302c22; color: #f1c48d; font-weight: 700 }
.failed .state { color: #e7bc8b }
.active .status-icon { background: #25322b; color: var(--lime); border-color: var(--line) }
.open { display: inline-flex; align-items: center; gap: .15rem; white-space: nowrap }
.empty { grid-column: 1/-1; color: var(--quiet); padding: 2rem 0 }
.pager, #feedback { text-align: center; color: var(--quiet) }
.pager a { display: inline-block; border: 1px solid var(--line); border-radius: .5rem; padding: .65rem 1.15rem; margin-top: 1.25rem }
#feedback { min-height: 1.5rem; margin: .5rem 0 2rem; font-size: .9rem }
@media (max-width: 40rem) {
  .bar, main { width: calc(100% - 1.75rem) }
  #library { grid-template-columns: minmax(0,1fr); gap: .75rem }
  .frame { aspect-ratio: auto }
  .frame .watch, .frame img { height: auto }
  .frame img { max-height: 68svh; aspect-ratio: auto 4/3 }
  .frame video { max-height: 68svh }
  nav { gap: .15rem }
  nav a { padding: .45rem .66rem }
  .status-card { gap: .7rem; padding: .85rem }
  .status-icon { width: 1.9rem; height: 1.9rem }
  .open { flex-direction: column; align-items: flex-end }
  .open .code { margin: 0 }
}
