/* Studio layout (editor). Desktop-first; a gate is shown below 820 px. */
html, body.studio { height: 100%; }
body.studio { display: flex; flex-direction: column; overflow: hidden; }
.sbar { gap: 12px; padding: 8px 14px; }
.sbar-mid { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.title-input { max-width: 320px; background: transparent; border: 1px solid transparent; font-weight: 600; padding: 7px 10px; border-radius: 8px; }
.title-input:hover, .title-input:focus { border-color: var(--line-2); background: var(--glass); }
.sbar-hist { display: flex; gap: 6px; }
.save-state { font-size: 12px; color: var(--text-3); opacity: 0; transition: 0.3s; }
.save-state.on { opacity: 1; }
#app { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-height: 0; }

/* home */
.view-home { overflow: auto; display: grid; place-items: center; padding: 32px 20px; }
.home-inner { max-width: 820px; width: 100%; text-align: center; }
.home-inner h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; margin-bottom: 26px; }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.home-card { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 26px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(14px); transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; }
.home-card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--shadow-s); }
.home-card.primary { border-color: rgba(124, 92, 255, 0.5); background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(25, 198, 230, 0.08)); }
.hc-icon { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: rgba(124, 92, 255, 0.18); color: #b39bff; margin-bottom: 6px; }
.home-card.primary .hc-icon { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(124, 92, 255, 0.35); }
.hc-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.hc-desc { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.hc-cta { margin-top: auto; padding-top: 8px; color: var(--accent-2); font-weight: 600; font-size: 14px; }
.home-drop { margin: 18px 0 4px; color: var(--text-3); font-size: 14px; }
.projects { margin-top: 26px; text-align: left; }
.projects h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 10px; }
.project-list { display: grid; gap: 8px; }
.project-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); }
.project-row:hover { border-color: var(--line-2); }
.project-row .poster { width: 72px; height: 44px; border-radius: 8px; background: var(--bg-3); object-fit: cover; display: block; }
.project-row .pr-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.project-row .pr-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-row .pr-meta { color: var(--text-3); font-size: 12.5px; font-family: var(--mono); }
.project-row .btn-row { gap: 6px; }
.cap-list { display: grid; gap: 6px; margin-top: 10px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.cap-row { display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: start; }
.cap-row .cap-time { font-family: var(--mono); font-size: 11px; color: var(--text-3); padding-top: 8px; cursor: pointer; }
.cap-row .cap-time:hover { color: var(--accent-2); }
.cap-row textarea { min-height: 38px; resize: vertical; font-size: 13px; line-height: 1.35; padding: 6px 8px; }
.cap-row.on textarea { border-color: var(--accent-2); }
.field input[type="number"] { background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 6px 8px; width: 80px; }
.field textarea { background: var(--bg-3); border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 8px 10px; width: 100%; }
.home-unsupported { margin-top: 18px; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(255, 176, 32, 0.5); background: rgba(255, 176, 32, 0.08); font-size: 13.5px; color: var(--text-2); text-align: left; }
.view-home .trust { justify-content: center; margin-top: 26px; }

/* record */
.view-record { overflow: auto; display: grid; place-items: start center; padding: 32px 20px; }
.rec-card { width: min(720px, 100%); padding: 28px; }
.rec-card h2 { font-size: 24px; margin-bottom: 18px; }
.rec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-top: 8px; }
.rec-actions { margin: 14px 0 12px; }
.hud { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.hud-inner { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: blink 1.2s infinite; }
.hud.paused .rec-dot { animation: none; background: var(--warn); }
@keyframes blink { 50% { opacity: 0.3; } }
.hud-time { font-size: 18px; min-width: 64px; }
.hud-state { font-size: 13px; color: var(--text-2); }
.hud-preview { width: 240px; border-radius: 12px; border: 1px solid var(--line-2); background: #000; box-shadow: var(--shadow-s); }
.countdown { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(5, 6, 12, 0.55); backdrop-filter: blur(4px); }
.countdown span { font-size: 160px; font-weight: 800; color: #fff; text-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.countdown.tick span { animation: tick 1s ease-out; }
@keyframes tick { from { transform: scale(1.6); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); opacity: 1; } }

/* editor */
.view-editor { display: grid; grid-template-columns: 76px 1fr 320px; min-height: 0; }
.rail { display: flex; flex-direction: column; gap: 4px; padding: 10px 8px; border-right: 1px solid var(--line); background: var(--bg-2); overflow: auto; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-3); font-size: 11px; font-weight: 600; transition: 0.15s; }
.rail-btn:hover { color: var(--text); background: var(--glass); }
.rail-btn.on { color: var(--text); background: rgba(124, 92, 255, 0.16); border-color: rgba(124, 92, 255, 0.4); }
.rail-btn.on .ico { color: #b39bff; }
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.preview-wrap { flex: 1; min-height: 200px; display: grid; place-items: center; padding: 12px; position: relative; background: radial-gradient(ellipse at 50% 30%, rgba(124, 92, 255, 0.06), transparent 60%); }
#preview { border-radius: 10px; box-shadow: var(--shadow); max-width: 100%; max-height: 100%; cursor: crosshair; background: #0f1120; }
.preview-hint { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(6px); padding: 6px 12px; border-radius: 999px; background: rgba(10, 12, 20, 0.85); border: 1px solid var(--line-2); color: #e9ebf3; font-size: 12.5px; opacity: 0; transition: 0.2s; pointer-events: none; white-space: nowrap; }
.preview-hint.on { opacity: 1; transform: translateX(-50%); }
.controls { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-2); }
.controls .time { font-size: 13px; margin-left: 6px; }
.controls-spacer { flex: 1; }
.btn-play { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(124, 92, 255, 0.4); }
.btn-play .ico-pause { display: none; } .btn-play.playing .ico-pause { display: block; } .btn-play.playing .ico-play { display: none; }
.timeline { height: 272px; display: grid; grid-template-columns: 110px 1fr; background: var(--bg-2); user-select: none; }
.tl-labels { display: grid; grid-template-rows: 28px 76px 26px 50px 40px 40px; border-right: 1px solid var(--line); }
.tl-label { display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); }
.tl-label .ico { color: var(--text-3); }
.tl-add { margin-left: auto; width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--glass); color: var(--text-2); font-size: 14px; line-height: 1; display: grid; place-items: center; padding: 0; }
.tl-add:hover { color: var(--text); border-color: var(--accent); }
.tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.tl-inner { position: relative; height: 100%; display: grid; grid-template-rows: 28px 76px 26px 50px 40px 40px; min-width: 100%; }
.tl-audio { background: rgba(25, 198, 230, 0.04); }
.tl-audio.empty::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.tl-wave { position: absolute; left: 0; top: 1px; display: block; pointer-events: none; }
.tl-text-block { top: 6px; height: 28px; background: rgba(25, 198, 230, 0.2); border: 1px solid rgba(25, 198, 230, 0.7); color: #d6f6fb; }
.tl-text-block.title { background: rgba(255, 176, 32, 0.2); border-color: rgba(255, 176, 32, 0.7); color: #ffe6b3; }
.tl-mask-block { top: 6px; height: 28px; }
.tl-zoom-block { top: 7px; height: 36px; }
.tl-ruler { position: relative; border-bottom: 1px solid var(--line); overflow: hidden; }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--line-2); }
.tl-tick.major { height: 10px; }
.tl-tick span { position: absolute; left: 4px; bottom: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.tl-track { position: relative; border-bottom: 1px solid var(--line); }
.tl-thumbs { position: absolute; top: 8px; height: 60px; left: 0; overflow: hidden; border-radius: 6px; opacity: 0.9; }
.tl-thumbs canvas { position: absolute; top: 0; height: 60px; object-fit: cover; }
.tl-seg { position: absolute; top: 8px; height: 60px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3); cursor: pointer; }
.tl-seg:hover { border-color: rgba(255, 255, 255, 0.45); }
.tl-seg.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(25, 198, 230, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.3); }
.tl-seg.sped { background: repeating-linear-gradient(135deg, rgba(255, 176, 32, 0.22) 0 6px, rgba(255, 176, 32, 0.06) 6px 12px); }
.tl-seg-speed { position: absolute; left: 6px; top: 4px; font-family: var(--mono); font-size: 11px; color: #ffd580; background: rgba(0, 0, 0, 0.55); padding: 1px 6px; border-radius: 6px; }
.tl-gap { position: absolute; top: 8px; height: 60px; background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.72) 0 6px, rgba(0, 0, 0, 0.5) 6px 12px); border-radius: 6px; }
.tl-block { position: absolute; top: 10px; height: 36px; border-radius: 8px; cursor: grab; display: flex; align-items: center; padding: 0 10px; font-size: 11.5px; font-family: var(--mono); overflow: hidden; }
.tl-block:active { cursor: grabbing; }
.tl-zoom-block { background: rgba(124, 92, 255, 0.28); border: 1px solid rgba(124, 92, 255, 0.75); color: #e3dcff; }
.tl-zoom-block.auto { background: rgba(124, 92, 255, 0.18); border-style: dashed; }
.tl-mask-block { top: 6px; height: 30px; background: rgba(255, 92, 168, 0.22); border: 1px solid rgba(255, 92, 168, 0.7); color: #ffd0e6; }
.tl-block.selected { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); z-index: 2; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.tl-handle.l { left: 0; } .tl-handle.r { right: 0; }
.tl-handle::after { content: ''; position: absolute; top: 25%; bottom: 25%; left: 3px; width: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.5); }
.tl-ev { position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); opacity: 0.9; transform: translateX(-2px); pointer-events: auto; }
.tl-ev.type { background: var(--ok); } .tl-ev.scene, .tl-ev.scroll { background: var(--warn); width: 2px; height: 12px; border-radius: 1px; } .tl-ev.scroll { background: var(--text-3); }
.tl-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-3); z-index: 5; pointer-events: none; transform: translateX(-1px); }
.tl-playhead-knob { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; background: var(--accent-3); border-radius: 3px 3px 7px 7px; }

/* panel */
.panel { border-left: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; padding: 8px 0 40px; }
.ps { padding: 14px 16px 6px; border-bottom: 1px solid var(--line); }
.ps-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin-bottom: 12px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.preset-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass); color: var(--text-2); font-size: 12.5px; font-weight: 600; text-align: left; }
.preset-card.on { border-color: var(--accent); color: var(--text); background: rgba(124, 92, 255, 0.14); }
.preset-shape { width: 22px; height: 22px; border: 2px solid currentColor; border-radius: 3px; flex: none; opacity: 0.8; }
.preset-shape[data-ar="9:16"] { width: 13px; height: 22px; } .preset-shape[data-ar="1:1"] { width: 20px; height: 20px; } .preset-shape[data-ar="4:3"] { width: 24px; height: 18px; } .preset-shape[data-ar="16:9"] { width: 26px; height: 15px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.swatch { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; aspect-ratio: 16 / 10; }
.swatch canvas { width: 100%; height: 100%; display: block; }
.swatch.on { border-color: #fff; }
.kv { display: flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; flex-wrap: wrap; }
.list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.list li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.list li.on { border-color: var(--accent-3); background: rgba(255, 92, 168, 0.1); }
.list li .ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.list li .muted { margin-left: auto; font-family: var(--mono); font-size: 11.5px; }
.ps .btn-row { margin: 6px 0 12px; }

/* drop overlay + mobile gate */
.drop-overlay { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; background: rgba(124, 92, 255, 0.15); backdrop-filter: blur(4px); border: 3px dashed var(--accent); pointer-events: none; }
.drop-overlay.on { display: grid; }
.drop-overlay-inner { font-size: 24px; font-weight: 700; background: var(--bg-2); padding: 20px 36px; border-radius: 16px; border: 1px solid var(--line-2); }
.mobile-gate { display: none; position: fixed; inset: 0; z-index: 200; place-items: center; padding: 20px; background: var(--bg); }
.mobile-gate .card { padding: 28px; max-width: 420px; text-align: center; }
.mobile-gate h2 { font-size: 22px; margin-bottom: 10px; }
.mobile-gate p { color: var(--text-2); }
@media (max-width: 820px), (max-height: 480px) { .mobile-gate { display: grid; } }
@media (max-width: 1180px) { .view-editor { grid-template-columns: 68px 1fr 280px; } }
