@font-face { font-family: "Montserrat"; font-weight: 500; src: url(fonts/Montserrat_500Medium.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 700; src: url(fonts/Montserrat_700Bold.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 800; src: url(fonts/Montserrat_800ExtraBold.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Montserrat"; font-weight: 900; src: url(fonts/Montserrat_900Black.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Anton"; src: url(fonts/Anton_400Regular.ttf) format("truetype"); font-display: swap; }
@font-face { font-family: "Poppins"; font-weight: 800; src: url(fonts/Poppins_800ExtraBold.ttf) format("truetype"); font-display: swap; }

:root {
  --bg: #0c0d10;
  --panel: #15171c;
  --panel-2: #1c1f26;
  --line: #272b34;
  --line-2: #343946;
  --text: #eceef3;
  --muted: #8b92a3;
  --dim: #5d6474;
  --accent: #c8ff3d;
  --accent-ink: #12160a;
  --hot: #ff5c39;
  --warn: #ffb020;
  --good: #3ddc84;
  --blue: #5aa8ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 500 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
::selection { background: var(--accent); color: var(--accent-ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 14px 28px;
  background: rgba(12, 13, 16, .86); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; letter-spacing: -.02em; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.logo-mark svg { width: 18px; height: 18px; }
.logo span { color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 11.5px;
  font-weight: 700; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.badge.on .dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.badge.off .dot { background: var(--warn); }

main { max-width: 1320px; margin: 0 auto; padding: 28px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 700;
  font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #4a5060; background: #232731; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #d6ff6b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger:hover { border-color: var(--hot); color: var(--hot); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }

.input, select.input, textarea.input { width: 100%; height: 42px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #101216; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 72px; padding: 10px 13px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 255, 61, .14); }
select.input { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b92a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
input[type=color] { width: 42px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-2); background: #101216; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; cursor: pointer;
  font-weight: 700; font-size: 12.5px; color: var(--muted); }
.chip:hover { color: var(--text); border-color: #4a5060; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.toggle input { display: none; }
.toggle .sw { width: 36px; height: 21px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(15px); background: var(--accent-ink); }

/* ---------- hero / create ---------- */
.hero { position: relative; padding: 46px 40px 34px; border-radius: 22px; border: 1px solid var(--line); overflow: hidden;
  background: radial-gradient(1200px 380px at 10% -20%, rgba(200, 255, 61, .13), transparent 60%),
              radial-gradient(800px 300px at 100% 0%, rgba(90, 168, 255, .10), transparent 60%), var(--panel); }
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); font-weight: 900; line-height: 1.02; letter-spacing: -.035em; max-width: 760px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { margin: 12px 0 26px; color: var(--muted); font-size: 15.5px; max-width: 620px; }
.source-box { display: flex; gap: 10px; padding: 8px; border-radius: 16px; background: #0f1114; border: 1px solid var(--line-2); max-width: 880px; }
.source-box .input { border: 0; background: transparent; height: 48px; font-size: 15px; box-shadow: none; }
.source-box .btn { height: 48px; padding: 0 22px; font-size: 14.5px; border-radius: 12px; }
.drop-hint { margin-top: 12px; font-size: 13px; color: var(--dim); }
.drop-hint button { background: none; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 0; font-weight: 700; }
.dropzone-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(12, 13, 16, .88);
  border: 3px dashed var(--accent); font-size: 26px; font-weight: 900; color: var(--accent); }

.settings { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; max-width: 1100px; }
.settings summary { cursor: pointer; font-weight: 800; list-style: none; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.settings summary::-webkit-details-marker { display: none; }
.settings summary svg { width: 14px; height: 14px; transition: transform .15s; }
.settings[open] summary svg { transform: rotate(90deg); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px 24px; margin-top: 18px; }
.settings-grid .span2 { grid-column: span 2; }
@media (max-width: 700px) { .settings-grid .span2 { grid-column: auto; } }

.tpl-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.tpl { position: relative; height: 72px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; overflow: hidden;
  background: linear-gradient(160deg, #2a3140, #151820); display: grid; place-items: center; padding: 6px; text-align: center; }
.tpl:hover { border-color: #56607a; }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(200, 255, 61, .3); }
.tpl .sample { font-size: 14px; line-height: 1.1; color: #fff; }
.tpl .name { position: absolute; bottom: 4px; left: 0; right: 0; font-size: 9.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.s-bold { font: 900 15px Montserrat; text-transform: uppercase; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
.s-bold b { color: #ffe600; }
.s-beasty { font: 17px Anton; text-transform: uppercase; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
.s-beasty b { background: #ffe600; color: #fff; -webkit-text-stroke: 0; padding: 0 3px; border-radius: 4px; font-weight: 400; }
.s-karaoke { font: 800 13px Poppins; } .s-karaoke b { color: #ffe600; }
.s-pop { font: 24px Anton; color: #3cff7a; -webkit-text-stroke: 4px #000; paint-order: stroke fill; }
.s-minimal { font: 700 11px Montserrat; background: rgba(0, 0, 0, .65); padding: 3px 6px; border-radius: 3px; }
.s-none { font: 700 11px Montserrat; color: var(--dim); }

/* ---------- sections & project grid ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.section-head h2 { font-size: 20px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.proj { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; cursor: pointer;
  transition: border-color .15s, transform .15s; display: flex; flex-direction: column; }
.proj:hover { border-color: var(--line-2); transform: translateY(-2px); }
.proj .thumb { aspect-ratio: 16/9; background: #08090b center/cover no-repeat; position: relative; }
.proj .thumb .pill { position: absolute; left: 10px; top: 10px; }
.proj .body { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.proj .title { font-weight: 800; font-size: 14.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.empty { padding: 50px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11px; font-weight: 800;
  background: rgba(12, 13, 16, .85); border: 1px solid var(--line-2); text-transform: uppercase; letter-spacing: .04em; }
.pill.work { color: var(--blue); } .pill.done { color: var(--good); } .pill.err { color: var(--hot); }
.pill .spin { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bar { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s ease; }

/* ---------- project page ---------- */
.p-head { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.p-head .thumb { width: 220px; aspect-ratio: 16/9; border-radius: 12px; background: #08090b center/cover; flex: none; border: 1px solid var(--line); }
.p-head h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.02em; }
.p-head .meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13px; }
.status-card { margin-top: 22px; padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
.status-card.err { border-color: rgba(255, 92, 57, .4); background: rgba(255, 92, 57, .06); }
.steps { display: flex; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.step { flex: 1; min-width: 110px; font-size: 11.5px; font-weight: 700; color: var(--dim); display: flex; flex-direction: column; gap: 6px; }
.step i { height: 4px; border-radius: 99px; background: var(--line); }
.step.done { color: var(--muted); } .step.done i { background: var(--good); }
.step.now { color: var(--text); } .step.now i { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 26px 0 16px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 var(--line-2) inset; }

.clip-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.clip { border-radius: 18px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; }
.clip .vid { position: relative; aspect-ratio: 9/16; background: #08090b; max-height: 540px; display: grid; place-items: center; }
.clip .vid.r-1-1 { aspect-ratio: 1; } .clip .vid.r-4-5 { aspect-ratio: 4/5; } .clip .vid.r-16-9 { aspect-ratio: 16/9; }
.clip video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.clip .rendering { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted);
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.75)), var(--poster, none) center/cover; }
.clip .rendering .bar { width: 160px; margin: 10px auto 0; }
.score { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; align-items: baseline; gap: 2px; padding: 6px 10px 5px;
  border-radius: 11px; background: rgba(10, 11, 14, .82); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.08); font-weight: 900; }
.score b { font-size: 22px; line-height: 1; } .score small { font-size: 10px; color: var(--muted); font-weight: 800; }
.score.s-hi b { color: var(--accent); } .score.s-mid b { color: var(--warn); } .score.s-lo b { color: var(--hot); }
.clip .fav { position: absolute; top: 12px; right: 12px; z-index: 2; }
.clip .fav.on svg { fill: var(--warn); stroke: var(--warn); }
.clip .info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.clip .title { font-weight: 800; font-size: 15px; line-height: 1.3; }
.clip .times { font-size: 12px; color: var(--muted); display: flex; gap: 10px; }
.breakdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.breakdown div { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.breakdown .bar { height: 4px; margin-top: 4px; } .breakdown .bar i { background: var(--blue); }
.reason { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.caption-box { font-size: 12.5px; padding: 10px 12px; border-radius: 10px; background: #101216; border: 1px solid var(--line); line-height: 1.45; }
.caption-box .tags { color: var(--blue); margin-top: 4px; word-break: break-word; }
.clip .actions { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }

/* ---------- modal / editor ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(5, 6, 8, .78); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.modal h3 { font-size: 18px; margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.editor { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; grid-template-rows: auto 1fr; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.ed-top .ttl { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-body { display: grid; grid-template-columns: minmax(260px, 360px) minmax(340px, 1fr) minmax(320px, 440px); min-height: 0; }
.ed-col { min-height: 0; overflow: auto; padding: 18px 20px; border-right: 1px solid var(--line); }
.ed-col:last-child { border-right: 0; }
.ed-col h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }
.out-player { width: 100%; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 9/16; max-height: 62vh; display: grid; place-items: center; position: relative; }
.out-player video { width: 100%; height: 100%; object-fit: contain; }
.out-player .overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; background: rgba(0,0,0,.66); color: var(--muted); padding: 20px; }
.src-player { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 16/9; display: block; }
.timeline { position: relative; height: 54px; margin-top: 14px; border-radius: 10px; background: #101216; border: 1px solid var(--line); cursor: pointer; overflow: hidden; user-select: none; }
.timeline .win { position: absolute; top: 0; bottom: 0; background: rgba(200, 255, 61, .14); border-left: 3px solid var(--accent); border-right: 3px solid var(--accent); }
.timeline .cut { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(255,92,57,.45) 0 4px, transparent 4px 8px); }
.timeline .head { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 6px #fff; pointer-events: none; }
.timeline .handle { position: absolute; top: 0; bottom: 0; width: 14px; margin-left: -7px; cursor: ew-resize; z-index: 2; }
.timeline .ticks { position: absolute; inset: auto 0 2px 0; display: flex; justify-content: space-between; padding: 0 8px; font-size: 10px; color: var(--dim); pointer-events: none; }
.trim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.trim-box { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.trim-box .lbl { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.trim-box .val { font-size: 20px; font-weight: 900; margin: 2px 0 8px; }
.trim-box .row { gap: 6px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { height: 38px; padding: 0 14px; border: 0; background: none; color: var(--muted); font-weight: 800; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.words { line-height: 2.05; font-size: 14.5px; user-select: none; }
.word { padding: 3px 3px; border-radius: 5px; cursor: pointer; transition: background .1s; }
.word:hover { background: var(--panel-2); }
.word.out { color: var(--dim); }
.word.del { text-decoration: line-through; color: var(--hot); opacity: .7; }
.word.filler { box-shadow: inset 0 -2px 0 var(--warn); }
.word.now { background: var(--accent); color: var(--accent-ink); }
.word.edited { color: var(--blue); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.hint { font-size: 12px; color: var(--dim); line-height: 1.5; }

@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 1fr; overflow: auto; }
  .ed-col { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .out-player { max-height: 70vh; max-width: 420px; margin: 0 auto; }
}

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 16px; border-radius: 12px; background: #20242d; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-weight: 700; font-size: 13px;
  animation: tin .2s ease; max-width: 380px; }
.toast.err { border-color: rgba(255, 92, 57, .5); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 640px) {
  main { padding: 18px 14px; }
  .topbar { padding: 12px 14px; }
  .hero { padding: 30px 18px 22px; border-radius: 18px; }
  .source-box { flex-direction: column; }
  .p-head .thumb { width: 100%; }
  #ai-badge span:last-child { display: none; }
}
