:root {
  --ink: #0d0d12;
  --ink-soft: #6b6b7b;
  --line: #ebebf1;
  --tint: #f7f7fb;
  --lilac: #f1eefe;
  --purple: #7c5cf5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.is-busy { cursor: progress; }

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
h2 { font-size: 16px; letter-spacing: -.02em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Nav */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 26px;
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); position: relative; }
.logo-mark::after {
  content: ""; position: absolute; left: 8px; top: 6px;
  border-left: 8px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.logo-word { font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.lab {
  margin-left: 4px; padding: 2px 9px; border-radius: 999px;
  background: var(--lilac); color: var(--purple); font-size: 12px; font-weight: 700;
}
.keys { font-size: 13px; color: var(--ink-soft); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 10px; padding: 12px 20px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #24242f; }
.btn-outline { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-outline:hover:not(:disabled) { background: var(--tint); }
.btn-sm { padding: 7px 13px; font-size: 13.5px; border-radius: 8px; }
.btn-wide { width: 100%; }
.spark { font-size: 12px; }
.link {
  padding: 0; border: 0; background: none; font: inherit;
  color: var(--purple); font-weight: 600; cursor: pointer; text-decoration: underline;
}
.link:disabled { opacity: .5; }

/* Hero */
.hero { max-width: 660px; margin: 0 auto; padding: 40px 26px 12px; text-align: center; }
.hero h1 { font-size: 40px; margin-bottom: 22px; }
.bar {
  display: flex; gap: 8px; padding: 7px 7px 7px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(13, 13, 18, .07);
}
.bar:focus-within { border-color: #c9bcfb; box-shadow: 0 10px 30px rgba(124, 92, 245, .14); }
.bar input {
  flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: none;
  font: inherit; font-size: 15.5px; background: transparent;
}
.hint { margin: 12px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.status { min-height: 22px; margin: 14px 0 0; font-size: 14px; color: var(--ink-soft); }
.status.error { color: #d2372a; }
.status.ok { color: #1f8a4c; }

/* Studio */
.studio {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 28px;
  max-width: 1160px; margin: 0 auto; padding: 24px 26px 60px;
}
.studio[hidden] { display: none; }
.panel {
  display: flex; flex-direction: column; gap: 16px; padding: 22px;
  background: var(--tint); border: 1px solid var(--line); border-radius: 24px;
}
.side-head { display: flex; align-items: center; gap: 12px; padding: 2px 4px 4px; }
.side-head h2 { font-size: 20px; margin: 0 0 2px; }
.side-head p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.side-tag {
  padding: 5px 11px; border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-head > div { flex: 1; min-width: 0; }
.card-head h2 { font-size: 17px; margin: 1px 0 3px; }
.card-head p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.card-head p strong { color: var(--ink); }
.num {
  flex: 0 0 30px; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--lilac); color: var(--purple); font-weight: 800; font-size: 14px;
}
.muted { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); }
.center { text-align: center; margin-top: 10px; }

.templates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tpl-detail {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px;
  background: var(--tint); font-size: 13px; color: var(--ink-soft);
}
.tpl-detail strong { color: var(--ink); }
.tpl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #fff; font: inherit; text-align: left; cursor: pointer;
}
.tpl:hover { border-color: #d9cffb; }
.tpl.is-on { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac); }
.tpl canvas {
  width: 100%; aspect-ratio: 9 / 16; margin-bottom: 6px;
  border-radius: 8px; background: var(--tint);
}
.tpl-name { font-weight: 700; font-size: 14px; }
.tpl-blurb { font-size: 12px; color: var(--ink-soft); }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.preset {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px;
  border: 1.5px solid var(--line); border-radius: 999px; background: #fff;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.preset:hover { border-color: #d9cffb; }
.preset.is-on { border-color: var(--purple); }
.preset i { display: flex; width: 34px; height: 18px; border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.preset i b { flex: 1; }
.tracks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 12px; }
.track {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; text-align: left; cursor: pointer;
}
.track:hover { border-color: #d9cffb; }
.track.is-on { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac); }
.track b { font-size: 14px; }
.track small { font-size: 12.5px; color: var(--ink-soft); }
.track em { font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--purple); }
.upload { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; cursor: pointer; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload .muted { margin: 0; }
.upload .btn { white-space: nowrap; }
.upload.is-on .btn { border-color: var(--purple); box-shadow: 0 0 0 3px var(--lilac); }
.upload input:focus-visible + .btn { outline: 2px solid var(--purple); outline-offset: 2px; }

.colors { display: flex; flex-direction: column; gap: 8px; }
.color {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.color:hover { border-color: #d9cffb; }
.color span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.color b { font-size: 14px; }
.color small { font-size: 12.5px; color: var(--ink-soft); }
.color code { font-size: 12.5px; color: var(--ink-soft); text-transform: uppercase; }
.color input {
  flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px;
  background: none; cursor: pointer;
}
.color input::-webkit-color-swatch-wrapper { padding: 0; }
.color input::-webkit-color-swatch { border: 1px solid rgba(0,0,0,.1); border-radius: 8px; }

.modal {
  width: min(420px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: 18px;
  box-shadow: 0 30px 80px rgba(13, 13, 18, .25);
}
.modal::backdrop { background: rgba(13, 13, 18, .45); }
.modal h2 { font-size: 22px; margin-bottom: 8px; }
.modal input {
  width: 100%; margin: 6px 0 12px; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 15.5px; outline: none;
}
.modal input:focus { border-color: #c9bcfb; box-shadow: 0 0 0 3px var(--lilac); }
.modal .error { margin: -4px 0 12px; font-size: 13.5px; color: #d2372a; }
.modal .skip { display: block; margin: 14px auto 0; font-size: 13.5px; color: var(--ink-soft); }

.details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field span { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.field input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14.5px; outline: none;
}
.field input:focus { border-color: #c9bcfb; box-shadow: 0 0 0 3px var(--lilac); }

.captions { display: flex; flex-direction: column; gap: 8px; }
.cap-row {
  display: flex; align-items: center; gap: 10px; padding: 6px;
  border: 1px solid var(--line); border-radius: 12px;
}
.cap-thumb {
  flex: 0 0 44px; height: 58px; border-radius: 8px;
  background: var(--tint) center / cover no-repeat;
}
.cap-thumb.is-end { background: var(--ink); }
.cap-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cap-label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.cap-body input {
  padding: 4px 0; border: 0; outline: none; font: inherit; font-size: 15px; background: transparent;
}
.cap-row:focus-within { border-color: #c9bcfb; }
.cap-del {
  flex: 0 0 30px; height: 30px; border: 0; border-radius: 8px;
  background: none; color: #9a9aab; font-size: 20px; cursor: pointer;
}
.cap-del:hover { background: var(--tint); color: #d2372a; }

/* Stage */
.stage {
  position: sticky; top: 20px; align-self: start; padding: 22px;
  background: #16151d; color: #fff; border-radius: 24px;
  box-shadow: 0 20px 50px rgba(13, 13, 18, .18);
}
.stage .side-head { margin-bottom: 14px; }
.stage .side-head p, .stage .muted, .stage .time { color: rgba(255, 255, 255, .6); }
.stage .side-tag { background: var(--purple); }
.stage .btn-outline { background: rgba(255, 255, 255, .08); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18); }
.stage .btn-outline:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.stage .btn-dark { background: var(--purple); }
.phone {
  width: 100%; aspect-ratio: 9 / 16; overflow: hidden;
  border-radius: 20px; background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
}
.phone canvas { width: 100%; height: 100%; display: block; }
.controls { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.controls input { flex: 1; accent-color: var(--purple); }
.time { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

@media (max-width: 860px) {
  .studio { grid-template-columns: 1fr; }
  .templates { grid-template-columns: repeat(2, 1fr); }
  .details { grid-template-columns: repeat(2, 1fr); }
  .stage { position: static; max-width: 420px; margin: 0 auto; width: 100%; order: -1; }
  .keys { display: none; }
  .hero h1 { font-size: 30px; }
}
