/* aShot — подредба като в мобилните монтажни програми (преглед горе, линия, лента с инструменти долу).
   Почти черен фон, бял текст; акцентът е наш — кехлибар. */
:root {
  --bg: #0b0b0c;
  --panel: #161618;
  --panel2: #222225;
  --line: #2e2e33;
  --fg: #f2f2f3;
  --mut: #8e8e95;
  --acc: #ffb547;
  --acc-ink: #1d1404;
  --ov: #c08bff;
  --txt: #86b6ff;
  --mus: #6fd3a8;
  --ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font: 14px/1.35 var(--ui); overflow: hidden;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button {
  font: inherit; color: inherit; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; touch-action: manipulation;
}
button:disabled { opacity: .35; cursor: default; }
button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button.primary { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 700; }
button.danger { color: #ff7a7a; }
button.icon { padding: 6px 9px; min-width: 38px; display: inline-grid; place-items: center; }
button.flat { background: none; border-color: transparent; }
button.big { padding: 12px 20px; font-size: 15px; }
button.pill { border-radius: 999px; padding: 7px 16px; }

.screen {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* начален екран */
#home { overflow-y: auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.htop { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: .01em; }
.brand b { color: var(--acc); }
a.ghost { color: var(--mut); text-decoration: none; font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; }
.install { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 4px 0 10px; border-radius: 14px; background: #1b1a17; border: 1px solid #4a3a1c; }
.install-ic img { display: block; border-radius: 10px; }
.install-tx { flex: 1; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--mut); }
.install-tx b { color: var(--fg); font-size: 14px; }
.newproj {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 22px; margin: 6px 0 22px;
  border-radius: 16px; background: linear-gradient(180deg, #26262a, #1b1b1e); border: 1px solid #34343a; font-size: 17px; font-weight: 700;
}
.newproj svg { width: 26px; height: 26px; padding: 3px; border-radius: 8px; background: var(--acc); color: var(--acc-ink); stroke-width: 2.4; }
.sect { font-size: 15px; margin: 0 0 10px; color: var(--mut); font-weight: 700; }
#projList { display: flex; flex-direction: column; gap: 10px; }
.pcard { display: flex; align-items: center; gap: 12px; }
.pthumb { width: 64px; height: 84px; flex: none; padding: 0; border-radius: 10px; background: #1d1d20 center/cover no-repeat; position: relative; border: 1px solid var(--line); }
.pthumb span { position: absolute; right: 4px; bottom: 4px; font: 10px var(--num); background: rgba(0,0,0,.65); padding: 1px 4px; border-radius: 4px; }
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pinfo b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo small { color: var(--mut); font-size: 12px; }
.pmore { background: none; border-color: transparent; font-size: 18px; }
.storage { color: #5d5d64; font-size: 12px; margin: 20px 0; }

/* монтаж */
.etop { display: flex; align-items: center; gap: 8px; padding: 6px 10px; flex: none; }
.pname { flex: 1; min-width: 0; background: none; border: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stage { flex: 1; min-height: 120px; display: flex; align-items: center; justify-content: center; padding: 2px 12px 4px; position: relative; }
#cv { max-width: 100%; max-height: 100%; background: #000; touch-action: none; }
#empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--bg); }
.empty-title { margin: 0; font-size: 20px; font-weight: 800; }
.empty-sub { margin: 0 0 10px; color: var(--mut); max-width: 30ch; }

#bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 2px 10px; flex: none; }
#time { font: 12px var(--num); color: var(--mut); font-variant-numeric: tabular-nums; }
#time b { color: var(--fg); font-weight: 500; }
button.play { width: 40px; height: 40px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: none; border: 0; color: var(--fg); }
button.play svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.hist { justify-self: end; display: flex; gap: 2px; }

#tlWrap { position: relative; height: min(34vh, 270px); min-height: 150px; flex: none; background: var(--bg); border-top: 1px solid #1c1c1f; }
#tl { position: absolute; inset: 0; overflow-x: auto; overflow-y: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
#tl::-webkit-scrollbar { display: none; }
#tlInner { position: relative; min-width: 100%; }
.ruler { position: absolute; top: 0; left: 0; right: 0; height: 22px; font: 10px var(--num); color: var(--mut); }
.tick { position: absolute; top: 0; height: 4px; border-left: 1px solid #333; }
.tick.major { height: 7px; border-color: #555; }
.tick span { position: absolute; top: 7px; left: 3px; white-space: nowrap; }
.blk { position: absolute; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.blk.clip { background-color: #2b2b30; background-repeat: repeat-x; background-size: auto 100%; }
.blk.clip .lab { position: absolute; left: 4px; bottom: 3px; font: 600 10px var(--num); background: rgba(0,0,0,.6); padding: 1px 4px; border-radius: 4px; white-space: nowrap; }
.blk.ov { background-color: #2f2440; background-repeat: repeat-x; background-size: auto 100%; border-left: 3px solid var(--ov); }
.blk.text, .blk.music { font-size: 11px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; }
.blk.text span, .blk.music span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk.text { background: #26324a; color: #d9e6ff; }
.blk.music { background: #1f3b33; color: #d4f5e8; }
.blk.sel { border-color: #fff; overflow: visible; z-index: 3; }
.blk.sel:not(.clip) { touch-action: none; }
.hdl { position: absolute; top: -2px; bottom: -2px; width: 14px; background: #fff; touch-action: none; z-index: 4; }
.hdl::after { content: ""; position: absolute; left: 6px; top: 30%; bottom: 30%; width: 2px; border-radius: 1px; background: #444; }
.hdl.l { left: -14px; border-radius: 6px 0 0 6px; }
.hdl.r { right: -14px; border-radius: 0 6px 6px 0; }
.tr {
  position: absolute; width: 24px; height: 24px; margin-left: -12px; padding: 0; z-index: 2;
  border-radius: 6px; background: #f2f2f3; color: #111; border: 0; display: grid; place-items: center;
}
.tr svg { width: 14px; height: 14px; }
.tr.on { background: var(--acc); color: var(--acc-ink); }
.addEnd { position: absolute; width: 36px; height: 36px; padding: 0; border-radius: 8px; background: #fff; color: #111; border: 0; display: grid; place-items: center; }
.addEnd svg { stroke-width: 2.4; }
#playhead { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; z-index: 5; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }

/* долна лента с инструменти */
#toolbar { flex: none; display: flex; align-items: stretch; background: var(--bg); border-top: 1px solid #1c1c1f; min-height: 66px; overflow-x: auto; scrollbar-width: none; padding: 0 4px; }
#toolbar::-webkit-scrollbar { display: none; }
.tbs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tbs::-webkit-scrollbar { display: none; }
.tb { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 64px; background: none; border: 0; padding: 6px 4px; font-size: 11px; color: #c9c9ce; border-radius: 0; }
.tb svg { width: 23px; height: 23px; color: var(--fg); }
.tb.danger svg, .tb.danger { color: #ff7a7a; }
.tb.back { min-width: 44px; border-right: 1px solid #1f1f23; position: sticky; left: 0; background: var(--bg); z-index: 1; }

/* панел с настройки (изскача отдолу) */
#panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; max-height: 48vh; overflow-y: auto;
  background: var(--panel); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 30px rgba(0,0,0,.45);
}
.ph { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; background: var(--panel); }
.ph b { font-size: 15px; }
.ph .ok { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 800; }
.pb { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 999px; font-size: 12px; }
.chip.on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 700; }
.swatch { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid var(--line); }
.swatch.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--bg) inset; }
.row2 { display: flex; gap: 8px; flex-wrap: wrap; }
.row2 button { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.row2 svg { width: 16px; height: 16px; }
label.sl { display: grid; grid-template-columns: 100px 1fr 52px; align-items: center; gap: 10px; font-size: 12px; color: var(--mut); }
label.sl b { font: 500 12px var(--num); color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--acc); }
textarea, .field input {
  width: 100%; background: var(--panel2); color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font: 16px/1.3 var(--ui); resize: none; user-select: text; -webkit-user-select: text;
}
textarea:focus, .field input:focus { outline: 2px solid var(--acc); outline-offset: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--mut); }
.note, .hint { margin: 0; font-size: 12px; color: var(--mut); }

#hidden { position: fixed; left: -20px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(5,5,6,.86); display: flex; align-items: center; justify-content: center; padding: 20px; }
.card { width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.card h3 { margin: 0; font-size: 18px; }
.card p { margin: 0; color: var(--mut); }
.card .meta { font: 12px var(--num); color: var(--fg); }
.card video { width: 100%; max-height: 46vh; background: #000; border-radius: 10px; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card .actions > * { flex: 1; text-align: center; }
.card a.btn { display: inline-block; text-decoration: none; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--fg); font-weight: 700; }
.opt { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--mut); }
.warn { margin: 0; padding-left: 18px; color: #ffcf85; font-size: 12px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--acc); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50; bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  background: rgba(0,0,0,.88); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; font-size: 13px; max-width: 90vw;
}
@media (min-width: 900px) {
  #editor { max-width: 560px; margin: 0 auto; border-left: 1px solid #1c1c1f; border-right: 1px solid #1c1c1f; }
  #home { max-width: 560px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ключови кадри, изрязване, маска, хромакей (стъпка 2) */
.kfd { position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; background: var(--acc); border: 2px solid #111; transform: rotate(45deg); z-index: 5; cursor: pointer; }
.kfd::before { content: ""; position: absolute; inset: -9px; }
.tb.kfon svg { color: var(--acc); fill: var(--acc); }
.tb.kfon { color: var(--acc); }
.row2 button.on { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); font-weight: 700; }
.chip svg { width: 14px; height: 14px; vertical-align: -2px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #fff6; vertical-align: -1px; margin: 0 4px; }

/* цвят (стъпка 3) */
.ctabs { display: flex; gap: 4px; background: #17171a; border-radius: 10px; padding: 3px; }
.ctabs button { flex: 1; border: 0; background: none; padding: 8px 4px; font-size: 13px; border-radius: 8px; color: #c9c9ce; }
.ctabs button.on { background: #2a2a30; color: var(--fg); font-weight: 700; }
#curveCv { width: 100%; max-width: 320px; aspect-ratio: 1; align-self: center; border-radius: 10px; touch-action: none; display: block; margin: 0 auto; }

/* звук (стъпка 4) */
.wave { position: absolute; left: 0; pointer-events: none; }
.wave path { stroke: #7fe3bf; stroke-width: 1.2; fill: none; }
.wave circle { fill: var(--acc); }
.wave.music { top: 2px; opacity: .9; }
.wave.clip { bottom: 0; background: rgba(0,0,0,.45); }
.wave.clip path { stroke: #9fd8ff; }
.blk.music span { position: relative; z-index: 1; text-shadow: 0 1px 2px #000; }
.recdot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #ff4d4d; margin-right: 6px; animation: recb 1s infinite; }
@keyframes recb { 50% { opacity: .25; } }
.card.rec h3 b { font-family: var(--num); margin-left: 8px; }

/* текст и стикери (стъпка 5) */
.lab2 { margin: 6px 0 -2px; font-size: 12px; font-weight: 700; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.swatch.pick { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; }
.chip svg { width: 18px; height: 18px; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.stk { font-size: 28px; line-height: 1; padding: 8px 0; background: #1b1b1f; border: 1px solid #26262b; border-radius: 10px; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
#spdCv { width: 100%; aspect-ratio: 2; border-radius: 10px; touch-action: none; display: block; }
