* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #111318; color: #eef1f6; font: 17px/1.3 system-ui, "Segoe UI", Arial, sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { background: #2a2f3a; border: 2px solid #3a4150; border-radius: 10px; min-height: 44px; min-width: 44px; padding: 0 14px; cursor: pointer; }
button:hover { background: #343b48; }
button.primary { background: #1e6fff; border-color: #1e6fff; }
button[aria-pressed="true"] { background: #1e6fff; border-color: #6ea0ff; }
input, select { background: #1b1f27; border: 2px solid #3a4150; border-radius: 8px; min-height: 44px; padding: 0 8px; }
input[type=color] { width: 52px; padding: 3px; }
input[type=number] { width: 72px; }
label.chk { display: inline-flex; align-items: center; gap: 6px; }
label.chk input { width: 24px; height: 24px; min-height: 0; }

/* Barra de menú/herramientas */
#bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: #181b22; border-bottom: 2px solid #262b35; }
.group { display: flex; align-items: center; gap: 6px; padding: 0 8px; border-right: 2px solid #262b35; }
.group:last-child { border: 0; }
.group .lbl { font-weight: 700; color: #9fb0c8; }
#goto input { width: 58px; text-align: center; }
#title { margin-left: auto; color: #9fb0c8; font-weight: 600; }

/* Menú Archivo */
.menu { position: relative; }
.menu .items { display: none; position: absolute; top: 100%; left: 0; z-index: 50; background: #20242d; border: 2px solid #3a4150; border-radius: 10px; padding: 6px; min-width: 230px; box-shadow: 0 10px 30px #0008; }
.menu.open .items { display: block; }
.menu .items button { display: block; width: 100%; text-align: left; border: 0; background: none; font-size: 19px; }
.menu .items button:hover { background: #1e6fff; }
.menu .items hr { border: 0; border-top: 1px solid #3a4150; }

/* Timeline */
#timeline { position: relative; background: #0c0e12; border-bottom: 2px solid #262b35; overflow-x: auto; overflow-y: hidden; user-select: none; }
#tlInner { position: relative; height: 104px; min-width: 100%; cursor: pointer; touch-action: none; }
#ruler { position: absolute; inset: 0 0 auto 0; height: 30px; border-bottom: 1px solid #2d3340; }
#ruler span { position: absolute; top: 4px; font-size: 13px; color: #8b97ab; padding-left: 4px; border-left: 1px solid #3a4150; height: 26px; }
#blocks { position: absolute; left: 0; right: 0; top: 40px; height: 52px; }
.block { position: absolute; top: 0; height: 52px; background: #2d5fb8; border: 2px solid #6ea0ff; border-radius: 6px; overflow: hidden; white-space: nowrap; font-size: 14px; padding: 4px 6px; }
.block.sel { background: #e0a100; border-color: #ffd257; color: #111; }
#needle { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; z-index: 5; }
#needle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px; background: #ff3b3b; }
#needle .handle { position: absolute; top: 0; left: -18px; width: 36px; height: 36px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #ff3b3b; border: 3px solid #fff; pointer-events: auto; cursor: grab; }

/* Escenario */
#stageWrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#stage { position: relative; background: #000; overflow: hidden; }
#stage video { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 6%; gap: 0.4em; pointer-events: none; }
.sub { position: relative; pointer-events: auto; max-width: 92%; text-align: center; }
.sub .txt { white-space: pre-wrap; outline: none; border-radius: 4px; line-height: 1.2; }
.editing .sub .txt { cursor: text; outline: 2px dashed #ffffff55; outline-offset: 4px; }
.editing .sub.sel .txt { outline: 3px solid #ffd257; }
.sub .x { display: none; position: absolute; top: -22px; right: -22px; min-width: 0; min-height: 0; width: 40px; height: 40px; padding: 0; border-radius: 50%; background: #e53935; border: 3px solid #fff; font-size: 20px; font-weight: 700; line-height: 1; }
.editing .sub .x { display: block; }
#empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8b97ab; font-size: 22px; text-align: center; padding: 20px; }

/* Transporte */
#transport { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 8px; background: #181b22; border-top: 2px solid #262b35; }
#transport button { font-size: 20px; min-width: 56px; }
#btnPlay { min-width: 80px !important; font-size: 24px !important; }
#time { font: 700 22px ui-monospace, Consolas, monospace; min-width: 260px; text-align: center; }
#selPanel { display: flex; gap: 8px; align-items: center; padding: 0 10px; border-left: 2px solid #262b35; }
#selPanel[hidden] { display: none; }

/* Diálogos */
dialog { background: #1b1f27; color: inherit; border: 2px solid #3a4150; border-radius: 14px; padding: 22px; width: min(560px, 94vw); }
dialog::backdrop { background: #000a; }
dialog h2 { margin-top: 0; }
dialog .row { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
dialog .row input[type=text], dialog .row input[type=email], dialog .row input[type=password] { flex: 1; }
#projList { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
#projList button { text-align: left; }
progress { width: 100%; height: 22px; }
#toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: #1e6fff; padding: 12px 22px; border-radius: 10px; font-size: 19px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 99; }
#toast.show { opacity: 1; }

/* Visor */
#scrub { width: 100%; height: 36px; accent-color: #ff3b3b; }
.viewer #topinfo { padding: 10px 14px; background: #181b22; font-weight: 600; }
