/* Video Studio — tema: panouri albastru-cerneală, accent chihlimbar (bandă de film / leader) */
:root {
  --bg: #0e1118; --panel: #161a24; --raise: #1e2330; --raise2: #262c3c;
  --line: #29303f; --line2: #38405a;
  --text: #e4e8f2; --mute: #8a93a9;
  --accent: #f2a93b; --accent-ink: #1b1304;
  --c-video: #2f9d8f; --c-image: #5b86e0; --c-text: #8a79e8; --c-shape: #d9628f; --c-audio: #7fae4b;
  --danger: #e5484d; --r: 6px;
  --head: 176px; --row: 48px; --ruler: 30px;
  color-scheme: dark;
  font: 13px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
html { touch-action: manipulation; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  display: grid; grid-template-rows: 48px minmax(0, 1fr) 316px; grid-template-columns: 300px minmax(0, 1fr) 328px;
  grid-template-areas: "top top top" "lib stage insp" "tl tl tl";
}
@media (max-width: 1100px) { body { grid-template-columns: 236px minmax(0, 1fr) 268px; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

button, select, input, textarea { font: inherit; color: inherit; }
button {
  background: var(--raise); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r); padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--raise2); border-color: var(--line2); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover:not(:disabled), .btn.primary:hover:not(:disabled) { background: #ffbd57; border-color: #ffbd57; }
.btn.danger { color: #ff8a8e; }
.btn.danger:hover:not(:disabled) { background: #3a1d22; border-color: var(--danger); }
.btn.wide { width: 100%; margin-top: 6px; }
button.toggle.on, button#loop.on { background: #3a2c10; border-color: var(--accent); color: var(--accent); }
input[type=text], input[type=number], select, textarea {
  background: #0f131b; border: 1px solid var(--line); border-radius: 5px; padding: 4px 7px; min-width: 0;
}
input[type=number] { width: 66px; }
select { max-width: 100%; }
textarea { width: 100%; resize: vertical; }
.grow { flex: 1; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.hint { color: var(--mute); font-size: 12px; margin: 6px 0; }
.boot { position: fixed; inset: 0; z-index: 99; background: var(--bg); display: grid; place-items: center; color: var(--mute); }

/* ---------- bara de sus ---------- */
#top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.lbl-short { display: none; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); margin-right: 6px; }
.brand b { color: var(--text); font-size: 15px; letter-spacing: .2px; }
.pname { width: 220px; background: transparent !important; border-color: transparent !important; font-weight: 600; }
.pname:hover, .pname:focus { border-color: var(--line2) !important; background: #0f131b !important; }
.savestate { color: var(--mute); font-size: 12px; margin-right: 6px; }

/* ---------- bibliotecă ---------- */
#library { grid-area: lib; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 9px 4px; color: var(--mute); border-bottom: 2px solid transparent; font-size: 12.5px; white-space: normal; line-height: 1.2; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.libbody { overflow: auto; padding: 12px; min-height: 0; flex: 1; }
.libbody h4 { margin: 14px 0 6px; font-size: 12px; color: var(--mute); font-weight: 600; }
.drop { border: 1.5px dashed var(--line2); border-radius: 8px; padding: 14px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.drop p { margin: 0; } .drop small { color: var(--mute); font-size: 11.5px; }
.drop.over { border-color: var(--accent); background: #2a2210; }
.mlist { display: grid; gap: 6px; margin-top: 12px; }
.mi { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 8px; align-items: center; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--raise); cursor: grab; }
.mi:hover { border-color: var(--line2); }
.mi .th { width: 64px; height: 40px; border-radius: 4px; overflow: hidden; background: #0b0e14; display: grid; place-items: center; }
.mi .th img { width: 100%; height: 100%; object-fit: cover; }
.mi .ph { color: var(--mute); font-size: 18px; }
.mi.k-audio .th { color: var(--c-audio); }
.mi .mt { min-width: 0; display: grid; }
.mi b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi small { color: var(--mute); font-size: 11.5px; }
.mi button { padding: 2px 7px; }
.mi .del { color: var(--mute); border-color: transparent; background: transparent; }
.mi.missing { opacity: .55; }
.grid1 { display: grid; gap: 7px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.preset { display: grid; gap: 2px; text-align: left; padding: 10px 12px; background: var(--raise); }
.preset span { line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset small { color: var(--mute); }
.preset.sh { min-height: 54px; place-items: center; }
.gfrow { display: flex; gap: 6px; } .gfrow input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { padding: 3px 9px; border-radius: 99px; font-size: 12px; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.flist { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.flist li { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; background: var(--raise); border-radius: 5px; font-size: 15px; }
.flist button { border: 0; background: transparent; color: var(--mute); padding: 0 4px; }

/* ---------- scenă ---------- */
#stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0a0c11; }
#stageWrap { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
#btnFs {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center;
  background: rgba(14, 17, 24, .72); border-color: rgba(255, 255, 255, .2); color: #fff;
}
#btnFs .fs-exit { display: none; }
#btnFs[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
#btnFs[aria-pressed="true"] .fs-enter { display: none; }
#btnFs[aria-pressed="true"] .fs-exit { display: block; }
.mi.snd { cursor: default; }
#cv { background: #000; box-shadow: 0 0 0 1px var(--line2), 0 12px 40px rgba(0,0,0,.55); touch-action: none; }
#transport { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.tcode { font: 600 14px ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 0 10px; color: var(--text); font-variant-numeric: tabular-nums; }
.tcode .of { color: var(--mute); margin: 0 6px; font-weight: 400; } #tdur { color: var(--mute); }
#play { min-width: 82px; }

/* ---------- panou proprietăți ---------- */
#inspector { grid-area: insp; background: var(--panel); border-left: 1px solid var(--line); overflow: auto; min-height: 0; }
.ihead { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.ihead .nm { flex: 1; font-weight: 600; }
.chip { display: inline-block; }
.ihead .chip { padding: 2px 9px; font-size: 11.5px; border: 0; background: var(--raise2); color: var(--text); border-radius: 99px; }
.chip.t-video { background: var(--c-video) !important; color: #04201c !important; } .chip.t-image { background: var(--c-image) !important; color: #071536 !important; }
.chip.t-text { background: var(--c-text) !important; color: #140c3a !important; } .chip.t-shape { background: var(--c-shape) !important; color: #3a0719 !important; }
.chip.t-audio { background: var(--c-audio) !important; color: #132104 !important; }
details.sec { border-bottom: 1px solid var(--line); }
details.sec > summary { padding: 9px 12px; cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; }
details.sec > summary::before { content: "▸"; color: var(--mute); font-size: 11px; transition: transform .12s; }
details.sec[open] > summary::before { transform: rotate(90deg); }
.secbody { padding: 2px 12px 12px; }
.f { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 6px; margin: 5px 0; }
.f.chk { grid-template-columns: auto 1fr; cursor: pointer; }
.fl { color: var(--mute); font-size: 12.5px; }
.fc { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fc select { flex: 1; } .fc em { color: var(--mute); font-style: normal; font-size: 12px; min-width: 14px; }
.rng { flex: 1; min-width: 0; accent-color: var(--accent); }
input[type=color], .clr { width: 44px; height: 26px; padding: 1px; border: 1px solid var(--line2); border-radius: 5px; background: #0f131b; cursor: pointer; }
.kf-btn { padding: 0 4px; border: 0; background: transparent; color: var(--line2); font-size: 14px; line-height: 1; }
.kf-btn.has { color: #b88a3c; } .kf-btn.on { color: var(--accent); }
.sub { margin-left: 8px; padding-left: 8px; border-left: 2px solid var(--line); }
.acts { display: flex; gap: 6px; padding: 12px; } .acts button { flex: 1; } .acts.two { padding: 6px 0 0; }
.animgrp { margin: 4px 0 12px; } .ah { font-weight: 600; margin: 8px 0 2px; font-size: 12.5px; }
.kfl { display: grid; gap: 4px; }
.kfr { display: grid; grid-template-columns: 1fr auto minmax(0, 96px) auto; gap: 6px; align-items: center; background: var(--raise); padding: 4px 6px; border-radius: 5px; }
.kfr .lnk { border: 0; background: transparent; text-align: left; padding: 0; color: var(--accent); overflow: hidden; text-overflow: ellipsis; }
.kfr .kv { color: var(--mute); font-size: 12px; } .kfr .x { border: 0; background: transparent; color: var(--mute); padding: 0 4px; }
.mini { font-size: 12px; padding: 2px 4px; }
.tips { margin: 0; padding-left: 18px; color: var(--mute); display: grid; gap: 6px; }

/* ---------- timeline ---------- */
#timeline { grid-area: tl; background: var(--panel); border-top: 1px solid var(--line2); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tl-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.tl-tools { display: contents; }
.tl-bar .zoom { display: flex; gap: 8px; align-items: center; color: var(--mute); } .tl-bar .zoom input { width: 140px; accent-color: var(--accent); }
.tl-scroll { flex: 1; overflow: auto; position: relative; min-height: 0; background: #11151e; }
.tl-inner { position: relative; min-height: 100%; }
.tl-row { display: flex; border-bottom: 1px solid var(--line); }
.tl-head { flex: none; width: var(--head); position: sticky; left: 0; z-index: 3; background: var(--panel); border-right: 1px solid var(--line2); padding: 4px 8px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.tl-head .tn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.tl-head.audio .tn { color: var(--c-audio); }
.tl-head .tb { display: flex; gap: 2px; }
.tl-head .tb button { padding: 0 5px; font-size: 11px; line-height: 18px; border-color: transparent; background: transparent; color: var(--mute); }
.tl-head .tb button.off { color: var(--danger); }
.tl-ruler { position: sticky; top: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--line2); }
.tl-corner { z-index: 5; color: var(--mute); font-size: 11.5px; justify-content: center; }
#tlRuler { cursor: ew-resize; position: relative; flex: none; }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line2); }
.tick span { position: absolute; left: 4px; top: 4px; font: 11px ui-monospace, Consolas, monospace; color: var(--mute); }
.mtk { position: absolute; bottom: 0; height: 6px; border-left: 1px solid var(--line); }
.rph { position: absolute; top: 0; bottom: 0; left: -6px; width: 12px; pointer-events: none; }
.rph::before { content: ""; position: absolute; top: 14px; left: 0; border: 6px solid transparent; border-top: 9px solid var(--accent); border-bottom: 0; }
.tl-lane { position: relative; flex: none; background-image: linear-gradient(to right, transparent calc(100% - 1px), rgba(255,255,255,.015) 0); }
.tl-lane.audio { background-color: rgba(127, 174, 75, .035); }
.tl-lane.hid { opacity: .45; }
.tl-clip { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; overflow: hidden; cursor: grab; color: #fff; background-color: #3a4256; background-size: auto 100%; background-repeat: repeat-x; border: 1px solid rgba(255,255,255,.18); box-shadow: inset 0 0 0 100px rgba(0,0,0,.12); }
.tl-clip.t-video { background-color: var(--c-video); } .tl-clip.t-image { background-color: var(--c-image); }
.tl-clip.t-text { background-color: var(--c-text); } .tl-clip.t-shape { background-color: var(--c-shape); }
.tl-clip.t-audio { background-color: #4b6a2d; }
.tl-clip.sel { outline: 2px solid var(--accent); outline-offset: -1px; z-index: 1; box-shadow: 0 0 0 1px #000, inset 0 0 0 100px rgba(0,0,0,0); }
.tl-clip.missing { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.25) 0 6px, transparent 6px 12px) !important; }
.tl-clip .lbl { position: absolute; left: 8px; right: 8px; top: 3px; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000b; pointer-events: none; }
.tl-clip .hl, .tl-clip .hr { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2; }
.tl-clip .hl { left: 0; } .tl-clip .hr { right: 0; }
.tl-clip:hover .hl, .tl-clip:hover .hr, .tl-clip.sel .hl, .tl-clip.sel .hr { background: rgba(255,255,255,.28); }
.tl-clip .wave { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; } .tl-clip .wave polygon { fill: rgba(220, 255, 180, .55); }
.tl-clip .kf { position: absolute; bottom: 4px; width: 7px; height: 7px; margin-left: -3px; background: var(--accent); transform: rotate(45deg); border: 1px solid #000a; pointer-events: none; }
.tl-clip .fx { position: absolute; bottom: 0; height: 4px; background: rgba(255,255,255,.7); pointer-events: none; } .tl-clip .fx.in { left: 0; } .tl-clip .fx.out { right: 0; }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 2; pointer-events: none; will-change: transform; }

/* ---------- ferestre și mesaje ---------- */
.modal { position: fixed; inset: 0; background: rgba(5,7,11,.66); display: grid; place-items: center; z-index: 50; }
.mbox { width: min(520px, 92vw); background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 20px 70px rgba(0,0,0,.6); }
.mbox.wide { width: min(760px, 94vw); }
.mh { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mh .x { border: 0; background: transparent; color: var(--mute); }
.mb { padding: 16px; }
.exp .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exp label { display: grid; gap: 4px; color: var(--mute); font-size: 12.5px; } .exp label select { color: var(--text); }
.exp label.chk { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text); }
.btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.bar { height: 10px; border-radius: 99px; background: #0f131b; overflow: hidden; border: 1px solid var(--line); margin-top: 12px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
#xTxt.err { color: #ff8a8e; }
textarea.code { height: 360px; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #2a2f40; border: 1px solid var(--line2); padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: 80vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#busy { position: fixed; inset: 0; z-index: 70; background: rgba(5,7,11,.5); display: grid; place-content: center; justify-items: center; gap: 12px; }
#busy[hidden] { display: none; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--accent); animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } #toast, .bar i { transition: none; } }

/* ---------- noutăți: tranziții, subtitrări, șabloane ---------- */
.tl-tj { position: absolute; top: 50%; transform: translate(-50%, -50%); z-index: 3; width: 20px; height: 20px; padding: 0; border-radius: 50%; line-height: 1; font-size: 13px; background: var(--panel); border: 1px solid var(--line2); color: var(--mute); }
.tl-tj:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.tl-tj.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tl-tw { position: absolute; top: 4px; bottom: 4px; z-index: 2; background: repeating-linear-gradient(135deg, rgba(242,169,59,.45) 0 4px, rgba(242,169,59,.18) 4px 8px); border-radius: 4px; pointer-events: none; }
.acts.wrap { flex-wrap: wrap; } .acts.wrap button { flex: 1 1 45%; }
.kfr.sp { grid-template-columns: 1fr auto 64px auto; }
.sf { display: grid; grid-template-columns: 1fr 96px; align-items: center; gap: 8px; margin: 6px 0; color: var(--mute); font-size: 12.5px; }
.sf input[type=number], .sf select { width: 100%; } .sf.chk { grid-template-columns: auto 1fr; justify-content: start; color: var(--text); }
.libbody .btn.wide { margin-top: 8px; }
.tcards { display: grid; gap: 8px; }
.tcard { display: grid; gap: 3px; text-align: left; padding: 11px 12px; white-space: normal; background: var(--raise); }
.tcard b { font-size: 13.5px; } .tcard span { color: var(--mute); font-size: 12px; } .tcard small { color: var(--accent); }
.tcard:hover { border-color: var(--accent); }
.tplform .tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 8px; }
.tf { display: grid; gap: 4px; color: var(--mute); font-size: 12.5px; } .tf.wide { grid-column: 1 / -1; }
.tf input[type=text], .tf select, .tf textarea { width: 100%; color: var(--text); } .tf .inl { display: flex; gap: 6px; } .tf .inl select { flex: 1; min-width: 0; }
.mb { max-height: 82vh; overflow: auto; }

/* ---------- cont editor ---------- */
#gate {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: grid; place-items: center; overflow: auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
#gate[hidden] { display: none; }
.gate-card { width: min(420px, 100%); display: grid; gap: 12px; }
.gate-card h1 { margin: 0; font-size: 26px; }
.gate-card label { display: grid; gap: 6px; color: var(--mute); font-size: 13px; }
.gate-card input { font-size: 16px; padding: 12px 14px; min-height: 48px; width: 100%; }
.gate-card button { min-height: 48px; font-size: 16px; }
#gateErr { color: #ff8a8e; min-height: 1.2em; margin: 0; }
.projlist { display: grid; gap: 8px; }
.plist { display: grid; gap: 8px; margin-top: 8px; }
.prow { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--raise); }
.prow.on { border-color: var(--accent); }
.prow b { display: block; } .prow small { color: var(--mute); }
.prow .pa { display: flex; gap: 6px; flex-wrap: wrap; }
.prow .pa .btn, .prow .pa button { flex: 1; min-height: 44px; text-align: center; text-decoration: none; }
.prow .del { color: #ff8a8e; }
#mnav { display: none; }

/* ---------- telefon și tabletă îngustă ---------- */
@media (max-width: 860px) {
  :root { --head: 128px; --row: 62px; --ruler: 26px; }
  html, body { height: 100dvh; }
  body {
    display: flex; flex-direction: column; overflow: hidden;
    padding-top: env(safe-area-inset-top);
    overscroll-behavior: none;
    touch-action: manipulation;
  }
  #top { flex: none; flex-wrap: wrap; height: auto; padding: 6px 8px 4px; gap: 6px; }
  .brand { margin-right: 0; }
  .brand b { display: none; }
  #gate .brand b { display: inline; }
  .pname { flex: 1; width: auto; min-width: 0; }
  .savestate { flex: none; margin: 0; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions {
    flex: 1 0 100%; flex-wrap: wrap; overflow: visible;
    gap: 6px; padding-bottom: 2px;
  }
  .top-actions .grow, .top-actions .sep { display: none; }
  .top-actions button { flex: 1 1 calc(25% - 6px); min-height: 40px; min-width: 0; padding: 6px 4px; text-align: center; }
  #library, #inspector { display: none; min-height: 0; border: 0; }
  #stage { flex: 1.15 1 0; min-height: 0; min-width: 0; }
  #timeline { flex: 1 1 0; min-height: 0; min-width: 0; }
  body[data-pane="library"] #stage,
  body[data-pane="library"] #timeline,
  body[data-pane="inspector"] #stage,
  body[data-pane="inspector"] #timeline { display: none; }
  body[data-pane="library"] #library { display: flex; flex: 1; min-height: 0; }
  body[data-pane="inspector"] #inspector { display: block; flex: 1; min-height: 0; }
  body[data-pane="timeline"] #stage { flex: 0 0 auto; }
  body[data-pane="timeline"] #stageWrap { height: 112px; flex: none; }
  body[data-pane="timeline"] #timeline { flex: 1; }
  #mnav {
    display: grid; grid-template-columns: repeat(4, 1fr); flex: none;
    background: var(--panel); border-top: 1px solid var(--line2);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #mnav button {
    border: 0; border-radius: 0; background: transparent; color: var(--mute);
    min-height: 48px; padding: 8px 2px 10px; font-size: 12px; font-weight: 600;
  }
  #mnav button.on { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  #mnav button.has:not(.on) { color: var(--text); }
  #stageWrap { padding: 4px; }
  #transport { gap: 4px; padding: 6px 8px; overflow: hidden; }
  #transport .grow { display: none; }
  #transport button { flex: none; min-height: 36px; padding: 6px 8px; }
  #play { min-width: 44px; }
  .tcode { font-size: 12px; padding: 0 2px; letter-spacing: -0.03em; }
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
  .tl-bar { overflow: hidden; flex-wrap: nowrap; padding: 6px 8px; }
  .tl-tools {
    display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0;
    overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  }
  .tl-tools .grow { display: none; }
  .tl-bar button { flex: none; min-height: 34px; }
  .tl-bar .zoom { flex: none; }
  .tl-bar .zoom input { width: 84px; }
  .tl-scroll { touch-action: pan-x pan-y; overscroll-behavior: contain; }
  .tl-clip, #tlRuler, .tl-tj { touch-action: none; }
  .tl-head { padding: 2px 4px; }
  .tl-head .tn { font-size: 12px; }
  .tl-head .tb { gap: 0; }
  .tl-head .tb button { padding: 0 4px; min-width: 22px; min-height: 24px; font-size: 13px; line-height: 22px; }
  .tl-clip .hl, .tl-clip .hr { width: 14px; }
  .tl-clip.sel .hl, .tl-clip.sel .hr { background: rgba(255,255,255,.28); }
  .tl-tj { width: 28px; height: 28px; font-size: 16px; }
  .tabs button { padding: 10px 2px; font-size: 12px; }
  .drop button { min-height: 44px; width: 100%; }
  .mi { grid-template-columns: 56px minmax(0, 1fr) auto auto; }
  .mi button { min-width: 32px; min-height: 32px; }
  .f { grid-template-columns: 86px minmax(0, 1fr); }
  input, select, textarea { font-size: 16px; }
  .modal { padding: 0; align-items: end; }
  .mbox, .mbox.wide { width: 100%; max-height: 100dvh; border-radius: 14px 14px 0 0; border-bottom: 0; }
  .mb { max-height: calc(100dvh - 64px); padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .exp .grid, .tplform .tgrid { grid-template-columns: 1fr; }
  .btns { flex-wrap: wrap; }
  .btns .btn { flex: 1; }
  textarea.code { height: 42vh; }
  #toast { bottom: calc(62px + env(safe-area-inset-bottom)); max-width: 92vw; }
  .kfr { grid-template-columns: minmax(0, 1fr) auto minmax(0, 88px) auto; }
}
@media (max-width: 860px) and (max-height: 480px) {
  body[data-pane="stage"] #timeline,
  body:not([data-pane]) #timeline { flex: 0 0 128px; }
  body[data-pane="timeline"] #stageWrap { height: 84px; }
  #mnav button { min-height: 40px; padding: 6px 2px; }
}

/* Ecran complet: API-ul pe #stage, iar pe telefoanele fără el o clasă pe body. */
#stage:fullscreen,
#stage:-webkit-full-screen {
  display: flex; flex-direction: column; width: 100%; height: 100%; background: #000;
}
#stage:fullscreen #stageWrap,
#stage:-webkit-full-screen #stageWrap { flex: 1; height: auto !important; min-height: 0; }
body.fs-preview #stage {
  position: fixed; inset: 0; z-index: 80; width: 100%; height: 100%;
  display: flex !important; flex-direction: column; background: #000;
}
body.fs-preview #stageWrap { flex: 1; height: auto !important; min-height: 0; }
