:root {
  --bg: #0c0c10;
  --panel: #16161c;
  --line: #2a2a33;
  --text: #f3f3f5;
  --muted: #9a9aa6;
  --accent: #ffd60a;
  --good: #3ddc84;
  --bad: #ff5c5c;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
  padding-bottom: 110px;
}

h1, h2, p { margin: 0; }
h2 { font-size: 18px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; }
.mark { width: 14px; height: 14px; border: 3px solid var(--accent); border-radius: 5px; }
.agents { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; }
.agents.ready .dot { background: var(--good); animation: none; }
.agents.failed .dot { background: var(--bad); animation: none; }

main { max-width: 1280px; margin: 0 auto; padding: 0 32px; }

.hero { padding: 64px 0 40px; max-width: 820px; }
.hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; }
.hero em { color: var(--accent); font-style: normal; }
.lede { color: var(--muted); font-size: 17px; margin: 18px 0 28px; max-width: 640px; }
body.started .hero { padding: 28px 0 24px; }
body.started .hero h1 { font-size: 24px; }
body.started .lede, body.started .examples { display: none; }
body.started .search { margin-top: 16px; }

.search { display: flex; gap: 10px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }

button, .button {
  font: inherit;
  font-weight: 700;
  color: #111;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  padding: 14px 22px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }

.examples { margin-top: 16px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.chip:hover { border-color: var(--accent); }

.stage { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.side { display: grid; gap: 16px; position: sticky; top: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
#product-look { color: var(--muted); font-size: 13px; margin-top: 10px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 340px; overflow-y: auto; }
.steps li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; font-size: 13px; }
.steps .title { font-weight: 600; }
.steps .detail { color: var(--muted); overflow-wrap: anywhere; }
.icon { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; }
.running .icon { border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.done .icon { background: var(--good); }
.error .icon { background: var(--bad); }
.summary { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.results-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }

.card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  animation: rise 0.35s ease-out;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { transform: translateY(-2px); }
.card.selected { border-color: var(--accent); }
.frame { position: relative; aspect-ratio: 9 / 16; background: #000; }
.frame img, .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; padding: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 20px;
}
.play:hover { background: var(--accent); color: #111; }
.platform {
  position: absolute; left: 10px; top: 10px;
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
}
.platform.youtube { color: #ff4d67; }
.platform.tiktok { color: #25f4ee; }
.check {
  position: absolute; right: 10px; top: 10px;
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid #fff; background: rgba(0, 0, 0, 0.45);
  display: grid; place-items: center; font-weight: 900; color: transparent;
}
.selected .check { background: var(--accent); border-color: var(--accent); color: #111; }
.official {
  display: none;
  position: absolute; left: 10px; bottom: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; background: var(--accent); color: #111;
}
.is-official .official { display: block; }
.via {
  position: absolute; right: 10px; bottom: 10px;
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.7); color: #fff;
}
.meta .reach { font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 2px; }
.meta .reach.pending { color: var(--muted); font-weight: 400; }
.meta { padding: 12px 14px 14px; }
.handle { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-text, .reason { font-size: 12px; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.title-text { color: var(--muted); -webkit-line-clamp: 2; margin-top: 2px; }
.reason { -webkit-line-clamp: 3; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

.bar {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px; z-index: 10;
  max-width: calc(100vw - 32px);
  background: #1f1f27; border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 12px 12px 22px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}
.bar-info { display: grid; min-width: 150px; max-width: 260px; }
.bar-info .muted { font-size: 12px; line-height: 1.3; }
.styles { display: flex; gap: 6px; background: #121217; padding: 5px; border-radius: 14px; }
.style {
  display: flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 13px; color: var(--muted);
  background: transparent; border-radius: 10px; padding: 9px 13px;
}
.style.active { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.style.agent.active { box-shadow: inset 0 0 0 1px var(--accent); }
.style.off { opacity: 0.45; }
.style.local.active { box-shadow: inset 0 0 0 1px #25f4ee; }
.engine {
  margin-top: 18px; padding: 16px 18px; border: 1px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel)); font-size: 14px; display: grid; gap: 8px;
}
.engine code {
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; background: #0a0a0e;
  padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere;
}
.engine > code { display: block; padding: 10px 12px; }
.style .tag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em;
  color: #111; background: var(--accent); border-radius: 999px; padding: 2px 7px;
}

.studio { display: grid; gap: 24px; margin-top: 32px; }
.studio-hint { font-size: 13px; margin-top: 4px; }
.clips { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 22px; }
.clip-head { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
.clip-head .icon { margin-top: 0; flex: none; }
.clip-head .state { margin-left: auto; color: var(--muted); text-align: right; }
.skipped .icon { background: var(--muted); }
.clip.skipped .strip, .clip.error .strip { opacity: 0.35; }

.strip {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #0d0d11; min-height: 56px;
}
.strip img { display: block; width: 100%; height: auto; }
.strip.empty img { visibility: hidden; height: 56px; }
.shade, .window, .scan { position: absolute; top: 0; bottom: 0; display: none; }
.has-window .shade, .has-window .window { display: block; }
.shade { background: rgba(8, 8, 12, 0.72); transition: width 0.5s ease; }
.shade.left { left: 0; width: var(--left); }
.shade.right { right: 0; width: calc(100% - var(--left) - var(--width)); }
.window {
  left: var(--left); width: var(--width);
  border: 3px solid var(--clip); border-radius: 8px;
  box-shadow: 0 0 22px color-mix(in srgb, var(--clip) 55%, transparent);
  transition: left 0.5s ease, width 0.5s ease;
}
.tentative .window { border-style: dashed; opacity: 0.8; }
.window-label {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  font-size: 11px; font-weight: 800; white-space: nowrap;
  color: #111; background: var(--clip); border-radius: 999px; padding: 2px 8px;
}
.scanning .scan {
  display: block; width: 90px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--clip) 45%, transparent), transparent);
  border-right: 2px solid var(--clip);
  animation: scan 2.2s ease-in-out infinite alternate;
}
.scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; }
.scale .used { color: var(--text); font-weight: 600; }

.cut { display: flex; gap: 4px; margin: 6px 0 10px; }
.block {
  flex-basis: 0; min-width: 0; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--clip) 22%, var(--panel));
  border-top: 3px solid var(--clip);
  display: grid; font-size: 11px; color: var(--muted);
  animation: rise 0.35s ease-out;
}
.block strong { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log {
  list-style: none; margin: 0; padding: 14px 16px; max-height: 300px; overflow-y: auto;
  background: #0a0a0e; border-radius: 10px; display: grid; gap: 6px;
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
}
.log .command { color: #7dff8a; overflow-wrap: anywhere; }
.log .say { color: var(--text); font-family: inherit; }

.final { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.final video { width: 100%; aspect-ratio: 9 / 16; border-radius: 12px; background: #000; }
.final-side p { margin: 8px 0 16px; }
.credits { width: 100%; border-collapse: collapse; font-size: 13px; }
.credits td { padding: 9px 8px 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.credits a { color: var(--accent); text-decoration: none; }
.official-tag {
  margin-left: 8px; font-size: 10px; font-weight: 800; text-transform: uppercase;
  color: #111; background: var(--accent); border-radius: 999px; padding: 2px 7px;
}
.final-reach { color: var(--accent); font-weight: 700; margin-top: 4px; }
.recorded { font-size: 12px; margin-top: 6px; }
.actions { display: flex; gap: 10px; margin-top: 20px; }

.notice { color: var(--bad); font-size: 13px; margin-top: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes scan { from { left: -90px; } to { left: 100%; } }

@media (max-width: 860px) {
  main, .top { padding-left: 18px; padding-right: 18px; }
  .hero h1 { font-size: 30px; }
  .stage, .final { grid-template-columns: 1fr; }
  .side { position: static; }
  .search { flex-direction: column; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .bar { flex-wrap: wrap; justify-content: center; padding: 12px; }
  .clip-head { flex-wrap: wrap; }
  .final video { max-width: 320px; }
}
