/* Atelier de Vídeo — tema gris claro-oscuro, estilo editor profesional (herramientas abajo) */
:root {
  --bg: #3b3e44;
  --bg2: #303338;
  --bg3: #2a2c31;
  --panel: #464a51;
  --panel2: #52575f;
  --panel3: #5d626b;
  --ink: #f5f6f8;
  --ink2: #c9cdd4;
  --ink3: #9da3ad;
  --line: #5f646d;
  --accent: #56c8e0;
  --accent-ink: #10343c;
  --accent-soft: rgba(86, 200, 224, .18);
  --kf: #ffd060;
  --danger: #ff8a7a;
  --ok: #7fd49a;
  --shadow: 0 8px 26px rgba(0, 0, 0, .28);
  --r: 14px;
  --font: 'Inter', 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Inter', 'Sora', system-ui, sans-serif;
  --clip-video: #5f7192;
  --clip-over: #846f99;
  --clip-text: #a88a4c;
  --clip-fx: #4f8f87;
  --clip-audio: #4d7fae;
  --tl-h: 290px;
  --tb-h: 84px;
  --plum: var(--accent);
  --gold: var(--accent);
  --rose: #ff6f91;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; overscroll-behavior: none; }
body { overflow: hidden; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button { font-family: inherit; font-size: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 17px; color: var(--ink); }
.spacer { flex: 1; }

#app {
  height: 100dvh; display: grid;
  grid-template-rows: auto minmax(0, 1fr) var(--tl-h) auto;
  grid-template-columns: minmax(0, 1fr);
  width: 100vw;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}

/* ---------- cabecera ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--bg2); border-bottom: 1px solid #00000033; }
.brand { display: flex; align-items: center; gap: 9px; }
.logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-ink); font-size: 18px; background: var(--accent); }
.brand-txt { font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 8px 14px; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }
.chip em { font-style: normal; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; font-size: 14px; }
.proj-btn span { max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.icon-btn { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 22px; display: inline-grid; place-items: center; line-height: 1; color: var(--ink); }
.icon-btn.sm { width: 40px; height: 40px; font-size: 19px; border-radius: 11px; }
.icon-btn.flat { background: transparent; border-color: transparent; }
.icon-btn:active, .chip:active, .tbtn:active, .tool:active { transform: scale(.95); }
.icon-btn[disabled] { opacity: .3; }
.btn { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 12px; padding: 11px 18px; min-height: 48px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn.accent, .btn.gold { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.plum { background: var(--panel3); color: var(--ink); border-color: #ffffff22; }
.btn.danger { color: var(--danger); border-color: #ff8a7a66; background: transparent; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; margin-top: 8px; }
.btn:active { transform: scale(.98); }
#btnExport { padding: 10px 22px; }

/* ---------- zona de trabajo ---------- */
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; }
#app.panel-open .work { grid-template-columns: minmax(0, 1fr) var(--panel-w, 390px); }
.stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 10px 14px 0; }
.canvas-wrap { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; }
#cv { max-width: 100%; max-height: 100%; background: #000; border-radius: 4px; box-shadow: 0 6px 30px rgba(0, 0, 0, .45); touch-action: none; }
.empty-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; pointer-events: none; }
.empty-hint .big { font-size: 50px; color: var(--accent); }
.empty-hint p { margin: 0; font-size: 21px; font-weight: 600; max-width: 340px; color: var(--ink2); }
.empty-hint .btn { pointer-events: auto; }
.canvas-wrap.has-media .empty-hint { display: none; }
.canvas-wrap:not(.has-media) #cv { visibility: hidden; }
.transport { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 6px 2px; }
.tr-mid { display: flex; align-items: center; gap: 6px; }
.tr-right { display: flex; justify-content: flex-end; }
.play-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; font-size: 22px; color: var(--accent-ink); background: var(--ink); }
.play-btn:active { transform: scale(.94); }
.timecode { font-variant-numeric: tabular-nums; font-size: 17px; color: var(--ink3); }
.timecode b { color: var(--ink); font-size: 20px; font-weight: 700; }

/* ---------- panel de herramienta ---------- */
.panel { background: var(--panel); border-left: 1px solid #00000033; display: none; flex-direction: column; min-height: 0; overflow: hidden; }
#app.panel-open .panel { display: flex; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 54px; }
.panel-head b { flex: 1; font-size: 18px; font-weight: 700; }
.tab-body { flex: 1; overflow-y: auto; padding: 14px; -webkit-overflow-scrolling: touch; min-height: 0; }
.tab-body h3 { font-size: 18px; margin: 4px 0 10px; font-weight: 700; }
.tab-body h3.sub-h { font-size: 15px; color: var(--ink2); text-transform: uppercase; letter-spacing: .05em; }
.hint { color: var(--ink2); font-size: 15px; line-height: 1.45; margin: 4px 0 12px; }
.seg { display: flex; background: var(--bg2); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 10px; font-weight: 600; min-height: 44px; color: var(--ink2); }
.seg button.on { background: var(--panel3); color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.card { border: 1px solid var(--line); background: var(--panel2); border-radius: 13px; padding: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; min-height: 84px; justify-content: center; color: var(--ink); }
.card:active { transform: scale(.96); }
.card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card .em { font-size: 28px; line-height: 1; }
.media-card { padding: 6px; position: relative; overflow: hidden; }
.media-card .th { width: 100%; aspect-ratio: 9/14; border-radius: 9px; background: #222 center/cover; display: grid; place-items: center; font-size: 30px; }
.media-card .nm { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.media-card .dur { position: absolute; right: 10px; top: 10px; background: #000b; color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 8px; }
.media-card .add { position: absolute; left: 10px; top: 10px; background: var(--accent); color: var(--accent-ink); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 700; }
.style-card { padding: 14px 6px; min-height: 76px; background: #26282c; color: #fff; border: 1px solid #ffffff1a; }
.style-card span { font-size: 26px; line-height: 1.1; }
.style-card small { color: #ffffffaa; font-weight: 500; font-size: 12px; }
.row-btns { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; min-width: 130px; }

/* ---------- inspector ---------- */
details.sec { border: 1px solid var(--line); border-radius: 13px; margin-bottom: 10px; background: var(--panel2); overflow: hidden; }
details.sec > summary { list-style: none; padding: 13px 16px; font-weight: 700; font-size: 16.5px; display: flex; align-items: center; gap: 10px; min-height: 50px; cursor: pointer; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '▾'; margin-left: auto; color: var(--ink2); transition: transform .2s; }
details.sec[open] > summary::after { transform: rotate(180deg); }
details.sec > .body { padding: 2px 16px 16px; border-top: 1px solid var(--line); }
.solo > details.sec { border: 0; background: transparent; }
.solo > details.sec > summary { display: none; }
.solo > details.sec > .body { border: 0; padding: 0; }
.field { margin: 14px 0 4px; }
.field > label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.field > label output { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; margin-left: auto; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: #6c717b; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; margin-top: -11px; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: #6c717b; }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 0; }
select, input[type=text], input[type=number], textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: var(--bg2); color: var(--ink); min-height: 48px; -webkit-user-select: text; user-select: text; }
textarea { min-height: 84px; resize: vertical; }
input[type=color] { width: 56px; height: 44px; border: 1px solid var(--line); border-radius: 11px; padding: 3px; background: var(--bg2); }
.inline { display: flex; align-items: center; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-weight: 600; font-size: 15px; min-height: 48px; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #6c717b; transition: .2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 4px #0006; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(22px); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 6px; }
.chips button { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 11px; padding: 8px 4px; font-size: 13.5px; font-weight: 600; min-height: 54px; display: flex; flex-direction: column; align-items: center; gap: 2px; justify-content: center; line-height: 1.15; }
.chips button i { font-style: normal; font-size: 20px; }
.chips button.on { border-color: var(--accent); background: var(--accent-soft); color: #fff; box-shadow: 0 0 0 1px var(--accent); }
.clip-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.clip-head .badge { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 20px; flex: none; }
.clip-head b { font-size: 17px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-btns { display: flex; gap: 8px; margin-bottom: 12px; }
.mini-btns .btn { flex: 1; min-height: 44px; padding: 8px; font-size: 15px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* keyframes en los controles */
.kfd { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink3); display: grid; place-items: center; font-size: 15px; line-height: 1; padding: 0; }
.kfd.has { color: var(--kf); border-color: #ffd06066; }
.kfd.on { background: var(--kf); color: #3a2a00; border-color: var(--kf); }
.kf-nav { display: flex; align-items: center; gap: 8px; background: var(--bg2); border-radius: 12px; padding: 8px; margin-bottom: 6px; }
.kf-nav .btn { min-height: 44px; padding: 8px 12px; }
.kf-nav b { flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.kf-big { width: 100%; min-height: 54px; font-size: 16px; }
.kf-big.on { background: var(--kf); color: #3a2a00; border-color: var(--kf); }

/* ---------- línea de tiempo ---------- */
.tl { background: var(--bg2); border-top: 1px solid #00000040; display: flex; flex-direction: column; min-height: 0; }
.tl-bar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-bottom: 1px solid #00000030; }
.tbtn { border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 11px; padding: 6px 12px; min-height: 44px; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15px; }
.tbtn:hover { background: #ffffff10; }
.tbtn i { font-style: normal; font-size: 18px; }
.tbtn.danger { color: var(--danger); }
.tbtn.kfbtn i { color: var(--kf); }
.tbtn.kfbtn.on { background: var(--kf); color: #3a2a00; }
.tbtn.kfbtn.on i { color: #3a2a00; }
.tbtn[disabled] { opacity: .35; }
#zoom { width: 140px; }
.tl-scroll { flex: 1; overflow: auto; position: relative; -webkit-overflow-scrolling: touch; min-height: 0; background: var(--bg3); }
.tl-inner { position: relative; min-height: 100%; }
.ruler { position: sticky; top: 0; height: 32px; z-index: 6; background: var(--bg2); border-bottom: 1px solid #00000040; cursor: pointer; touch-action: none; }
.ruler .tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid #777c86; padding: 11px 0 0 5px; font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; pointer-events: none; }
.ruler .tick.minor { border-left-color: #4a4e55; padding: 0; }
.lane { position: relative; border-bottom: 1px solid #00000033; }
.lane:nth-child(odd) { background: rgba(255, 255, 255, .025); }
.lane .lbl { position: sticky; left: 0; z-index: 5; width: 74px; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 12px; font-weight: 700; color: var(--ink3); background: linear-gradient(90deg, var(--bg3) 72%, transparent); padding: 0 4px; pointer-events: none; line-height: 1.1; }
.lane .area { position: absolute; left: 0; top: 0; right: 0; bottom: 0; touch-action: pan-x pan-y; }
.lane .ghost { position: absolute; left: 90px; top: 50%; transform: translateY(-50%); color: #7d828c; font-size: 13px; pointer-events: none; white-space: nowrap; }
.clip { position: absolute; border-radius: 8px; overflow: hidden; color: #fff; font-size: 13px; font-weight: 600; border: 2px solid transparent; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); touch-action: none; cursor: grab; display: flex; align-items: center; }
.clip.video, .clip.image { background: var(--clip-video); }
.clip.overlay { background: var(--clip-over); }
.clip.text { background: var(--clip-text); }
.clip.fx { background: var(--clip-fx); }
.clip.audio { background: var(--clip-audio); }
.clip.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(0, 0, 0, .5); z-index: 3; }
.clip .cl-bg { position: absolute; inset: 0; background-repeat: repeat-x; background-size: auto 100%; opacity: .7; pointer-events: none; }
.clip .cl-lab { position: relative; padding: 0 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px #000c; pointer-events: none; width: 100%; }
.clip canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .9; }
.clip .h { position: absolute; top: 0; bottom: 0; width: 24px; z-index: 2; display: flex; align-items: center; justify-content: center; touch-action: none; cursor: ew-resize; }
.clip .h::after { content: ''; width: 4px; height: 46%; background: #fffd; border-radius: 3px; box-shadow: 0 0 3px #0008; }
.clip .h.l { left: 0; background: linear-gradient(90deg, #0005, transparent); }
.clip .h.r { right: 0; background: linear-gradient(-90deg, #0005, transparent); }
.clip:not(.sel) .h { opacity: .5; }
.clip .kfm { position: absolute; bottom: 3px; width: 13px; height: 13px; margin-left: -6.5px; background: var(--kf); transform: rotate(45deg); border: 1.5px solid #3a2a00; border-radius: 2px; z-index: 4; touch-action: none; }
.clip .kfm::before { content: ''; position: absolute; inset: -10px; }
.playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 8; pointer-events: none; }
.playhead::before { content: ''; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 4px #0009; }
.playhead::after { content: ''; position: absolute; left: -7px; top: 0; width: 14px; height: 14px; background: #fff; border-radius: 3px 3px 7px 7px; }

/* ---------- barra de herramientas inferior ---------- */
.toolbar { display: flex; gap: 2px; overflow-x: auto; padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid #00000040; scrollbar-width: none; min-height: var(--tb-h); align-items: stretch; }
.toolbar::-webkit-scrollbar { display: none; }
.tool { flex: 0 0 auto; min-width: 84px; border: 0; background: transparent; color: var(--ink); border-radius: 12px; padding: 8px 6px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 13.5px; font-weight: 500; }
.tool .ico { display: grid; place-items: center; height: 28px; }
.tool:hover { background: #ffffff0d; }
.tool.on { background: var(--panel); color: var(--accent); }
.tool.danger { color: var(--danger); }
.tool.kft .ico { color: var(--kf); }
.tool.back { min-width: 64px; border-right: 1px solid var(--line); border-radius: 12px 0 0 12px; margin-right: 6px; }
.tool .bdg { font-size: 11px; color: var(--ink3); margin-top: -3px; }
.tb-sep { width: 1px; background: var(--line); margin: 10px 4px; flex: none; }

/* ---------- ventanas ---------- */
.modal { position: fixed; inset: 0; background: rgba(10, 12, 16, .55); z-index: 50; display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.modal[hidden], .toast[hidden] { display: none; }
.sheet { background: var(--panel); color: var(--ink); border-radius: 20px; padding: 22px; width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); border: 1px solid #ffffff14; }
.sheet h2 { font-size: 24px; margin: 0 0 6px; }
.sheet .sub { color: var(--ink2); margin: 0 0 14px; font-size: 15px; }
.sheet h4 { margin: 16px 0 4px; font-size: 14px; color: var(--ink2); text-transform: uppercase; letter-spacing: .05em; }
.progress { height: 14px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.sheet video { width: 100%; max-height: 52dvh; border-radius: 12px; background: #000; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tb-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #f5f6f8; color: #202226; padding: 13px 20px; border-radius: 14px; z-index: 60; max-width: 90vw; box-shadow: 0 10px 30px #0008; font-size: 16px; font-weight: 600; }
#hiddenVideos { position: fixed; width: 2px; height: 2px; overflow: hidden; opacity: 0; pointer-events: none; left: 0; top: 0; }
#hiddenVideos video { width: 2px; height: 2px; }
.canvas-wrap:fullscreen { background: #000; }

/* ---------- selección múltiple ---------- */
.tbtn.on { background: var(--accent); color: var(--accent-ink); }
.sel-bar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: #2f4a52; border-bottom: 1px solid #00000040; flex-wrap: wrap; }
.sel-bar[hidden] { display: none; }
.sel-bar b { color: #fff; margin-right: 4px; font-size: 15px; }
.sel-tip { color: var(--ink2); font-size: 13px; margin-left: auto; }
.pill { border: 1px solid #ffffff33; background: #ffffff14; border-radius: 999px; padding: 6px 14px; min-height: 40px; font-weight: 600; font-size: 14px; color: #fff; }
.pill:active { transform: scale(.96); }
.tl-scroll.selmode .lane .area { touch-action: none; cursor: crosshair; }
.tl-scroll.selmode { box-shadow: inset 0 0 0 2px var(--accent); }
.band { position: absolute; z-index: 9; border: 2px dashed var(--accent); background: rgba(86, 200, 224, .15); border-radius: 6px; pointer-events: none; }
.clip.band-hit { outline: 3px solid var(--kf); outline-offset: -1px; }
.clip.prim { box-shadow: 0 0 0 3px var(--kf), 0 4px 14px rgba(0, 0, 0, .5); }
.clip.sel::after { content: '✓'; position: absolute; right: 28px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; z-index: 3; pointer-events: none; }

/* ---------- subtítulos ---------- */
.src-list { display: grid; gap: 6px; margin: 6px 0; }
.src-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel2); font-size: 15.5px; min-height: 48px; }
.src-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.sub-status { margin-top: 14px; padding: 12px; background: var(--bg2); border-radius: 12px; }
.sub-status p { margin: 0 0 8px; font-size: 15px; line-height: 1.4; }
.sub-bar { height: 10px; background: var(--panel3); border-radius: 99px; overflow: hidden; }
.sub-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.sub-list { display: grid; gap: 8px; margin: 10px 0; max-height: 46dvh; overflow-y: auto; padding-right: 2px; }
.sub-row { display: grid; grid-template-columns: 74px 1fr 46px; gap: 8px; align-items: start; }
.sub-t { display: grid; gap: 6px; justify-items: start; font-size: 14px; }
.sub-row textarea { width: 100%; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg2); color: var(--ink); resize: vertical; min-height: 56px; }
.sub-row .mini { min-width: 44px; min-height: 44px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel2); font-size: 17px; }
.sub-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sub-acts .btn { flex: 1 1 140px; min-height: 48px; }

/* ---------- tamaños de pantalla ---------- */
@media (max-height: 900px) { :root { --tl-h: 250px; } }
@media (max-height: 760px) { :root { --tl-h: 215px; --tb-h: 76px; } .tool { min-width: 76px; font-size: 12.5px; } }

/* iPad vertical y pantallas estrechas: el panel sale como hoja sobre la línea de tiempo */
@media (max-width: 999px) {
  #app.panel-open .work { grid-template-columns: minmax(0, 1fr); }
  .panel { display: flex; position: fixed; left: 0; right: 0; bottom: calc(var(--tb-h) + env(safe-area-inset-bottom)); height: var(--sheet-h, min(48dvh, 560px)); z-index: 30; border-left: 0; border-top: 1px solid #ffffff22; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, .45); transform: translateY(calc(100% + var(--tb-h) + 40px)); transition: transform .25s ease; }
  #app.panel-open .panel { transform: none; }
  .panel-head { border-radius: 18px 18px 0 0; }
  .panel-head::before { content: ''; position: absolute; left: 50%; top: 6px; width: 44px; height: 5px; margin-left: -22px; border-radius: 9px; background: #ffffff40; }
  .panel-head { position: relative; padding-top: 14px; }
  :root { --tl-h: 300px; }
}
@media (max-width: 999px) and (max-height: 900px) { :root { --tl-h: 250px; } }
@media (max-width: 700px) {
  body { font-size: 16px; }
  .top { padding: 6px 10px; gap: 6px; }
  .brand-txt { display: none; }
  .tbtn span { display: none; }
  .tbtn { padding: 6px 10px; }
  #zoom { width: 80px; }
  .sel-tip { display: none; }
  .tool { min-width: 70px; font-size: 12px; }
  :root { --tl-h: 230px; }
}

/* ---------- tiradores para cambiar el tamaño de las zonas ---------- */
.tl { position: relative; }
@media (min-width: 1000px) { .panel { position: relative; } }
.rz { position: absolute; z-index: 20; touch-action: none; }
.rz-tl { left: 0; right: 0; top: -9px; height: 18px; cursor: ns-resize; display: grid; place-items: center; }
.rz-tl i { width: 64px; height: 6px; border-radius: 9px; background: #8a909a; box-shadow: 0 0 0 1px #00000040; transition: background .15s, width .15s; }
.rz-tl:hover i, .rz.drag i { background: var(--accent); width: 90px; }
.rz-panel { top: 0; bottom: 0; left: -7px; width: 14px; cursor: ew-resize; }
.rz-panel::after { content: ''; position: absolute; left: 5px; top: 50%; width: 4px; height: 56px; margin-top: -28px; border-radius: 9px; background: #8a909a; }
.rz-panel:hover::after, .rz-panel.drag::after { background: var(--accent); }
body.resizing, body.resizing * { cursor: inherit !important; }
.mini-tr { display: none; align-items: center; gap: 4px; }
.mini-tc { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--ink2); min-width: 54px; }
#mPlay { background: var(--ink); color: var(--accent-ink); border: 0; border-radius: 50%; }
@media (max-width: 999px) {
  .rz-panel { display: none; }
  .mini-tr { display: flex; }
  .panel-head { touch-action: none; cursor: ns-resize; }
  .panel-head b { font-size: 16px; }
}
