:root {
  --lime: #C8FF00;
  --black: #000000;
  --ink: #FFFFFF;
  --muted: #9A9A9A;
  --line: #2A2A2A;
  --panel: #141414;
  --danger: #FF5A36;
  --font: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --brush: "Permanent Marker", Impact, "Arial Black", sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html, body { margin: 0; background: var(--black); color: var(--ink); font-family: var(--font); }
body { font-size: 16px; line-height: 1.5; }
a { color: var(--lime); }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

.bar { display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); }
.logo { text-decoration: none; display: inline-flex; align-items: baseline; gap: 8px; }
.logo-click { font-family: var(--brush); font-size: 30px; color: var(--black); background: var(--lime); padding: 0 12px 2px; transform: rotate(-2deg); display: inline-block; }
.logo-ai { font-weight: 800; color: var(--lime); font-size: 20px; }

main { max-width: 1180px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 48px) 80px; }

h1 { font-weight: 800; font-size: clamp(34px, 6vw, 64px); line-height: 1.02; letter-spacing: -0.02em; margin: 0 0 14px; max-width: 16ch; }
h2 { font-weight: 800; font-size: 24px; margin: 0 0 12px; }
p.lead { color: var(--muted); font-size: 18px; max-width: 56ch; margin: 0 0 28px; }

.composer { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.source { display: flex; gap: 10px; flex-wrap: wrap; }
.source input[type=url] { flex: 1 1 280px; }
input, select, textarea { width: 100%; background: var(--black); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); outline: none; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }

button { font: inherit; cursor: pointer; border-radius: 10px; padding: 12px 18px; border: 1px solid transparent; }
.primary { background: var(--lime); color: var(--black); font-weight: 800; }
.primary:disabled { opacity: .5; cursor: wait; }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: var(--muted); }
.danger { background: transparent; color: var(--danger); border-color: var(--line); }

.drop { margin-top: 12px; border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over, .drop:hover { border-color: var(--lime); color: var(--ink); }
.drop strong { color: var(--ink); }

details.opts { margin-top: 14px; }
details.opts summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.grid-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; accent-color: var(--lime); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.jobs { margin-top: 44px; }
.job-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.job-row:hover .job-title { color: var(--lime); }
.job-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { color: var(--muted); font-size: 14px; grid-column: 1; }
.status { font-size: 14px; color: var(--muted); }
.status.done { color: var(--lime); }
.status.error { color: var(--danger); }
.meter { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; grid-column: 1 / -1; }
.meter i { display: block; height: 100%; background: var(--lime); transition: width .6s ease; }

.back { color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 18px; }
.job-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; }
.job-head h1 { font-size: clamp(26px, 4vw, 44px); max-width: 24ch; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { background: none; color: var(--muted); border-radius: 0; border-bottom: 3px solid transparent; padding: 10px 14px; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--lime); }

.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 28px 20px; }
.clip { display: grid; gap: 10px; align-content: start; }
.clip-media { position: relative; background: var(--panel); border-radius: 14px; overflow: hidden; aspect-ratio: 9 / 16; }
.clip-media video, .clip-media img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.score { position: absolute; top: 10px; left: 10px; font-family: var(--brush); font-size: 30px; line-height: 1; color: var(--black); background: var(--lime); padding: 4px 10px 6px; transform: rotate(-3deg); }
.score small { font-family: var(--font); font-size: 12px; font-weight: 800; margin-left: 2px; }
.clip h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.clip .why { color: var(--muted); font-size: 14px; margin: 0; }
.clip .time { color: var(--muted); font-size: 13px; }
.clip .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.clip .btns button, .clip .btns a { padding: 8px 12px; font-size: 14px; }
.clip .btns a { text-decoration: none; display: inline-block; border-radius: 10px; }
.rendering { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 20px; }

.summary { display: grid; gap: 26px; max-width: 760px; }
.summary ul { margin: 0; padding-left: 20px; }
.summary li { margin: 6px 0; }
.chapter { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.chapter span:first-child { color: var(--lime); font-variant-numeric: tabular-nums; }
.mind ul { list-style: none; padding-left: 18px; border-left: 2px solid var(--line); }
.mind > ul { border: 0; padding: 0; }
.mind li > span { display: inline-block; padding: 2px 0; }
.mind > ul > li > span { color: var(--black); background: var(--lime); font-weight: 800; padding: 4px 10px; border-radius: 6px; }

.moments-box, .ask-box { display: grid; gap: 12px; max-width: 760px; }
.answer { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.transcript p { margin: 0 0 10px; }
.transcript span { color: var(--lime); font-variant-numeric: tabular-nums; margin-right: 8px; font-size: 14px; }

.empty { color: var(--muted); padding: 30px 0; }
.err { color: var(--danger); background: rgba(255, 90, 54, .08); border: 1px solid rgba(255, 90, 54, .4); border-radius: 12px; padding: 14px 16px; }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; width: min(560px, 94vw); padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog form { display: grid; gap: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 140%); background: var(--lime); color: var(--black); font-weight: 600; padding: 12px 18px; border-radius: 12px; transition: transform .25s ease, opacity .25s ease; max-width: 90vw; opacity: 0; pointer-events: none; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .clips { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
  .score { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
