/* Velmio Studio. Shared tokens and type are in ui.css. */
.studio { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.studio button { font-family: var(--body); }
.studio-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: calc(env(safe-area-inset-top, 0px) + 60px); padding: env(safe-area-inset-top, 0px) var(--gutter) 0; border-bottom: 1px solid var(--glass-line); background: var(--bg-2); }
.studio-brand { display: flex; text-decoration: none; }
.studio-user { display: flex; align-items: center; gap: 12px; min-width: 0; margin-inline-start: auto; color: var(--muted); font-size: .875rem; }
.studio-top .theme-toggle { width: 44px; height: 44px; background: transparent; }
.studio-top .theme-toggle:hover { background: var(--glass); }
.top-preview { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--glass-line); border-radius: 999px; background: var(--card); color: var(--ivory); font: 500 .875rem/1 var(--body); cursor: pointer; }
.studio-top .studio-link, .composer-collapsed .studio-link { flex: none; white-space: nowrap; }
.studio-link { min-height: 44px; padding: 6px 2px; border: 0; background: none; color: var(--lavender); font: 500 .9rem/1.3 var(--body); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.studio-link:disabled { color: var(--muted); cursor: default; }
.studio-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }

/* Shared controls */
.btn-next, .btn-soft, .btn-ai { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; font: 600 .95rem/1.2 var(--body); letter-spacing: -.01em; text-decoration: none; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, transform .15s ease, opacity .15s ease; }
.btn-next, .btn-ai { border: 1px solid transparent; background: var(--brand); color: var(--on-brand); }
.btn-next:hover, .btn-ai:hover { background: var(--brand-hover); }
.btn-soft { border: 1px solid var(--glass-line); background: var(--card); color: var(--ivory); box-shadow: var(--sm-shadow); }
.btn-soft:hover { border-color: var(--lavender); }
.btn-next:active, .btn-soft:active, .btn-ai:active { transform: translateY(1px); }
.btn-next:disabled, .btn-soft:disabled, .btn-ai:disabled { opacity: .55; cursor: default; }
.btn-ai { min-height: 54px; padding: 0 26px; font-size: 1rem; }
.btn-soft.is-small { min-height: 44px; padding: 0 14px; font-size: .875rem; }
.page-studio .field label { font: 500 .875rem/1.3 var(--body); letter-spacing: 0; }
.page-studio .field input, .page-studio .field select, .page-studio .field textarea, .scene textarea { border: 1px solid var(--glass-line); border-radius: 12px; background: var(--card); color: var(--ivory); font: 400 16px/1.45 var(--body); }
.page-studio .field input, .page-studio .field select { height: 48px; }
.page-studio .field textarea, .scene textarea { width: 100%; padding: 13px 15px; resize: vertical; }
.page-studio .field input:focus, .page-studio .field select:focus, .page-studio .field textarea:focus, .scene textarea:focus { border-color: var(--lavender); outline: 3px solid rgba(var(--accent-rgb), .18); outline-offset: 0; }
.page-studio ::placeholder { color: var(--muted); opacity: .85; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 14px; margin-top: 14px; padding: 8px 14px; border: 1px solid rgba(var(--accent-rgb), .35); border-radius: 12px; background: var(--soft); font-size: .9rem; line-height: 1.4; }

/* Step rail */
.rail { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 60px); z-index: 20; padding: 8px var(--gutter); border-bottom: 1px solid var(--glass-line); background: var(--sidebar); }
.rail-title { display: none; }
.rail ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rail button[data-goto] { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-height: 56px; padding: 4px 2px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 500 .72rem/1.2 var(--body); text-align: center; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.rail button:disabled { cursor: default; opacity: .6; }
.rail i { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--glass-line); border-radius: 50%; background: var(--card); font-style: normal; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.rail i b { font: 600 .68rem/1 var(--body); }
.rail i svg { display: none; }
.rail .is-current { color: var(--ivory); }
.rail .is-current i { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.rail .is-done i { border-color: var(--lavender); background: var(--soft); color: var(--lavender); }
.rail .is-done:not(.is-current) i b { display: none; }
.rail .is-done:not(.is-current) i svg { display: block; }
.rail-result { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 0 10px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--lavender); font: 600 .85rem/1.2 var(--body); cursor: pointer; }
.rail-progress { display: none; }

/* Workspace */
.studio-main { min-width: 0; padding: 22px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 112px); }
.panel { width: min(900px, 100%); margin-inline: auto; }
.panel h1 { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); font-weight: 650; line-height: 1.18; letter-spacing: -.028em; }
.panel h1:focus { outline: none; }
.panel h2 { margin: 26px 0 10px; font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: -.012em; }
.panel-sub { margin: 6px 0 20px; color: var(--muted); line-height: 1.5; }
.panel-note { margin-top: 10px; color: var(--muted); font-size: .875rem; line-height: 1.45; }
.panel-note:empty { display: none; }
.optional { font-weight: 400; color: var(--muted); }
.panel-nav { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 10px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 10px); border-top: 1px solid var(--glass-line); background: var(--bg-2); }
.panel-nav .btn-next { flex: 1; }
#studio-error { width: min(900px, 100%); margin: 16px auto 0; }

/* Upload */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 30px 18px; border: 1.5px dashed rgba(var(--fg-rgb), .2); border-radius: 16px; background: var(--card); color: var(--lavender); text-align: center; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--lavender); background: var(--soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop strong { margin-top: 6px; color: var(--ivory); font: 600 1.05rem/1.3 var(--body); }
.drop em { color: var(--lavender); font-style: normal; font-weight: 500; }
.drop span { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.photo { position: relative; overflow: hidden; border: 2px solid transparent; border-radius: 14px; background: var(--soft); box-shadow: var(--sm-shadow); transition: border-color .15s ease, transform .15s ease; }
.photo.is-active { border-color: var(--lavender); }
.photo.is-target { transform: scale(.97); border-color: var(--purple); }
.photo-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.photo-num { position: absolute; top: 8px; inset-inline-start: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(23, 21, 43, .78); color: #fff; font: 600 .75rem/1 var(--body); }
.photo-grip { position: absolute; top: 8px; inset-inline-end: 8px; padding: 2px 6px; border-radius: 6px; background: rgba(23, 21, 43, .6); color: #fff; font-size: .8rem; line-height: 1.3; cursor: grab; }
.photo-tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 2px; background: rgba(23, 21, 43, .68); }
.photo-tools button { width: 44px; height: 44px; border: 0; border-radius: 8px; background: none; color: #fff; font-size: 1.05rem; cursor: pointer; }
.photo-tools button:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.photo-tools button:disabled { opacity: .3; cursor: default; }
.logo-box { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 12px 14px; margin-top: 18px; padding: 14px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--card); }
.logo-slot { display: grid; place-items: center; width: 72px; height: 72px; padding: 8px; border: 1px solid var(--glass-line); border-radius: 12px; background: var(--glass); color: var(--muted); font-size: .72rem; text-align: center; }
.logo-slot img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-copy h2 { margin: 0; font-size: .95rem; }
.logo-copy p { margin-top: 2px; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.logo-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.logo-actions label { min-height: 44px; padding: 0 16px; font-size: .875rem; cursor: pointer; }

/* Script composer */
.composer { padding: 16px; border: 1px solid var(--glass-line); border-radius: 18px; background: var(--card); box-shadow: var(--md-shadow); }
.composer-collapsed { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.composer-collapsed p { min-width: 0; overflow: hidden; color: var(--muted); font-size: .92rem; text-overflow: ellipsis; white-space: nowrap; }
.composer-idea textarea { min-height: 136px; field-sizing: content; max-height: 340px; }
.composer-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.composer-actions { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin-top: 4px; }
.composer-actions .studio-link { align-self: center; }
.ai-state { margin-top: 18px; padding: 18px; border-radius: 16px; background: var(--glass); text-align: center; }
.ai-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 10px; }
.ai-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--lavender); }
.motion .ai-dots i { animation: ai-pulse 1.2s ease-in-out infinite; }
.motion .ai-dots i:nth-child(2) { animation-delay: .15s; }
.motion .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-pulse { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }
.ai-state p { font-weight: 500; }
.ai-state.is-error { background: none; border: 1px solid var(--error); }
.ai-state.is-error p { color: var(--error); margin-bottom: 8px; }

/* Storyboard */
.story { margin-top: 26px; }
.story-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.story-head h2 { margin: 0; font-size: 1.2rem; }
.story-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.story-tools .btn-soft { min-height: 44px; padding: 0 14px; font-size: .875rem; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.quick button { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--glass-line); border-radius: 999px; background: var(--card); color: var(--ivory); font: 500 .85rem/1.2 var(--body); cursor: pointer; }
.quick button:hover:not(:disabled) { border-color: var(--lavender); }
.quick button:disabled { opacity: .55; cursor: default; }
.quick .quick-main { border-color: transparent; background: var(--soft); color: var(--lavender); }
.scene-list { display: grid; gap: 10px; margin-top: 14px; }
.scene { padding: 12px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--card); box-shadow: var(--sm-shadow); }
.scene.is-active { border-color: var(--lavender); }
.scene-main { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
.scene-main > button { padding: 0; border: 0; border-radius: 10px; background: none; cursor: pointer; }
.scene-main img { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; }
.scene-title { margin-bottom: 4px; color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }
.scene .field { margin: 0; }
.scene input, .scene select { height: 44px !important; }
.scene-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--ivory); cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link-btn { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--lavender); font: 500 .85rem/1.2 var(--body); cursor: pointer; }
.link-btn:disabled { color: var(--muted); cursor: default; }
.scene-tools select { max-width: 170px; height: 44px; padding: 0 8px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--ivory); font: 400 .85rem var(--body); }
.scene details { margin-top: 6px; }
.scene summary { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: .85rem; font-weight: 500; cursor: pointer; }
.scene-more { display: grid; gap: 10px; padding-top: 4px; }
.scene-more-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.scene-more label { display: block; margin-bottom: 4px; font-size: .78rem; font-weight: 500; }
.scene-more select, .scene-more input { width: 100%; padding: 0 8px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--ivory); font: 400 16px var(--body); }
.story-cta { margin-top: 14px; }

/* Voice */
.voice-group { margin: 18px 0 8px; }
.voice-group:first-child { margin-top: 0; }
.voice-group strong { display: block; font-size: .95rem; font-weight: 600; }
.voice-group span { color: var(--muted); font-size: .85rem; }
.voice-list { display: grid; gap: 8px; }
.voice { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--card); transition: border-color .15s ease, background-color .15s ease; }
.voice:hover { border-color: rgba(var(--accent-rgb), .5); }
.voice.is-on { border-color: var(--lavender); background: var(--soft); }
.voice-pick { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; min-height: 44px; padding: 8px 10px; border: 0; background: none; color: var(--ivory); text-align: start; font: inherit; cursor: pointer; }
.voice-pick strong { font: 500 .95rem/1.3 var(--body); }
.voice-pick span { color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.vo-box { display: grid; justify-items: start; gap: 2px; margin-top: 18px; }
.studio-info { padding: 12px 14px; border-radius: 12px; background: var(--glass); color: var(--muted); font-size: .875rem; line-height: 1.45; }

/* Format */
.size-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.size, .res { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; min-height: 44px; padding: 14px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--card); color: var(--ivory); text-align: start; font: inherit; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.size:hover, .res:hover { border-color: rgba(var(--accent-rgb), .5); }
.size-shape { display: flex; align-items: flex-end; height: 66px; margin-bottom: 6px; }
.size i { display: block; border: 1.5px solid var(--lavender); border-radius: 5px; background: rgba(var(--accent-rgb), .08); }
.size strong, .res strong { font: 600 .95rem/1.3 var(--body); }
.size span, .res span { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.size.is-on, .res.is-on { border-color: var(--lavender); background: var(--soft); box-shadow: 0 0 0 1px var(--lavender) inset; }
.res-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.len-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Rendering and result */
.panel-center { text-align: center; }
.panel-center .panel-sub { margin-inline: auto; }
.job { display: grid; gap: 20px; text-align: start; }
.render-stage, .result-stage { display: flex; justify-content: center; width: 100%; }
#render-canvas, #result-video { display: block; max-width: 100%; max-height: 56vh; border-radius: 16px; background: var(--soft); box-shadow: var(--shadow); }
#render-canvas { width: auto; height: auto; }
#result-video { height: auto; }
.job-steps { display: grid; gap: 4px; }
.job-steps li { display: flex; align-items: center; gap: 10px; min-height: 34px; color: var(--muted); font-size: .92rem; }
.job-steps li::before { content: ""; flex: none; width: 10px; height: 10px; border: 2px solid var(--glass-line); border-radius: 50%; }
.job-steps .is-active { color: var(--ivory); font-weight: 600; }
.job-steps .is-active::before { border-color: var(--lavender); background: var(--lavender); }
.motion .job-steps .is-active::before { animation: ai-pulse 1.2s ease-in-out infinite; }
.job-steps .is-done::before { border-color: var(--lavender); background: rgba(var(--accent-rgb), .25); }
.render-bar { height: 6px; margin-top: 14px; border-radius: 6px; background: var(--glass-line); overflow: hidden; }
.render-bar i { display: block; width: 0; height: 100%; background: var(--brand); transition: width .2s linear; }
.render-status { margin-top: 8px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.result-actions { display: grid; gap: 8px; margin-top: 8px; }
.result-actions .btn-soft { justify-content: flex-start; width: 100%; min-height: 44px; padding: 0 12px; font-size: .875rem; font-weight: 500; }
.result-actions .btn-soft .soon { margin-inline-start: auto; font-style: normal; }
.result-actions .is-danger { color: var(--error); }
.result-actions .is-danger:hover { border-color: var(--error); }
.studio.is-wide .panel-result { width: min(1060px, 100%); }
.result-layout { display: grid; gap: 18px; }
.result-layout .panel-note { text-align: center; }
.result-info { padding: 16px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--card); box-shadow: var(--md-shadow); }
.result-info .side-facts { margin: 0 0 12px; }
.result-dl { width: 100%; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* Audio step */
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 14px; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--card); color: var(--ivory); font: inherit; text-align: start; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.mode .ic { width: 22px; height: 22px; margin-bottom: 4px; color: var(--lavender); }
.mode strong { font-size: .95rem; font-weight: 600; line-height: 1.25; }
.mode span { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.mode-rec { position: absolute; top: 10px; inset-inline-end: 10px; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--lavender); font-size: .68rem; font-style: normal; font-weight: 600; }
.mode em.soon { background: var(--glass); color: var(--muted); }
.mode:hover:not(:disabled) { border-color: rgba(var(--accent-rgb), .5); }
.mode.is-on { border-color: var(--lavender); background: var(--soft); box-shadow: 0 0 0 1px var(--lavender) inset; }
.motion .mode.is-on { animation: mode-on .18s ease-out; }
@keyframes mode-on { from { transform: scale(.985); } }
.mode:disabled { opacity: .6; cursor: default; }
#narrator .voice-list { grid-template-columns: minmax(0, 1fr); }
.adv { margin-top: 12px; }
.adv summary { display: flex; align-items: center; min-height: 44px; color: var(--lavender); font-size: .9rem; font-weight: 500; cursor: pointer; }
.adv-body { display: grid; gap: 12px; padding: 10px 0; }
.adv-body label { display: block; margin-bottom: 4px; font-size: .84rem; font-weight: 500; }
.audio-sec { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--glass-line); }
.audio-sec header { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.audio-sec header h2 { margin: 0; }
.audio-sec header .switch { margin-inline-start: auto; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.chips button { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 10px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--muted); font: 500 .84rem/1.2 var(--body); text-align: start; }
.chips .ic { width: 13px; height: 13px; }
.track { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.track .ic { color: var(--muted); }
.track-name { flex: none; width: 96px; font-size: .875rem; font-weight: 500; }
.track input[type="range"] { flex: 1; min-width: 40px; }
.track.is-off { opacity: .7; }
@media (min-width: 480px) {
  .chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #narrator .voice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #narrator .voice-group { grid-column: 1 / -1; }
}
@media (min-width: 720px) {
  .mode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.editor { margin-top: 26px; padding: 16px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--card); text-align: start; }
.editor h2 { margin: 0 0 12px; }
.timeline { display: flex; gap: 4px; padding-bottom: 6px; overflow-x: auto; }
.tl-item { position: relative; flex: 1 0 96px; padding: 0 0 6px; border: 2px solid transparent; border-radius: 12px; background: var(--glass); color: var(--ivory); overflow: hidden; text-align: start; cursor: pointer; transition: border-color .15s ease; }
.tl-item.is-active { border-color: var(--lavender); }
.tl-item img { width: 100%; height: 70px; object-fit: cover; }
.tl-item .tl-tag { position: absolute; top: 4px; padding: 1px 6px; border-radius: 5px; background: rgba(23, 21, 43, .78); color: #fff; font-size: .68rem; }
.tl-item .tl-num { inset-inline-start: 4px; }
.tl-item .tl-time { inset-inline-end: 4px; }
.tl-item small { display: block; padding: 5px 7px 0; overflow: hidden; color: var(--muted); font-size: .72rem; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.timeline-editor { display: grid; gap: 10px; margin-top: 8px; }
.timeline-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.timeline-editor label { display: block; margin-bottom: 4px; font-size: .78rem; font-weight: 500; }
.timeline-editor input, .timeline-editor select { width: 100%; height: 44px; padding: 0 10px; border: 1px solid var(--glass-line); border-radius: 10px; background: var(--card); color: var(--ivory); font: 400 16px var(--body); }
.timeline-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* Preview inspector */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10, 8, 30, .45); }
.inspector { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; display: none; max-height: 86dvh; padding: 14px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 16px); border-radius: 20px 20px 0 0; background: var(--bg-2); box-shadow: var(--shadow); overflow-y: auto; }
.studio.show-preview .inspector { display: block; }
.inspector-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side-label { font-size: .95rem; font-weight: 600; }
.side-frame { position: relative; display: grid; place-items: center; width: auto; max-width: 100%; max-height: 46dvh; margin-inline: auto; overflow: hidden; border: 1px solid var(--glass-line); border-radius: 14px; background: var(--soft); }
#side-canvas { display: block; width: 100%; height: 100%; }
#side-canvas[hidden] { display: none; }
#side-empty { padding: 16px; color: var(--muted); font-size: .84rem; text-align: center; }
.side-play { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 54px; height: 54px; margin: -27px 0 0 -27px; border: 0; border-radius: 50%; background: rgba(23, 21, 43, .68); color: #fff; cursor: pointer; opacity: .92; transition: opacity .15s ease; }
.side-play .i-pause, .side-play[aria-pressed="true"] .i-play { display: none; }
.side-play[aria-pressed="true"] .i-pause { display: block; }
.side-play[aria-pressed="true"] { opacity: 0; }
.side-frame:hover .side-play, .side-play:focus-visible { opacity: 1; }
.side-facts { display: grid; margin: 12px 0 0; }
.side-facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--glass-line); font-size: .875rem; }
.side-facts div:last-child { border-bottom: 0; }
.side-facts dt { color: var(--muted); }
.side-facts dd { margin: 0; min-width: 0; font-weight: 500; text-align: end; overflow-wrap: anywhere; }

.confirm { width: min(420px, calc(100vw - 32px)); padding: 20px; border: 1px solid var(--glass-line); border-radius: 16px; background: var(--bg-2); color: var(--ivory); box-shadow: var(--shadow); }
.confirm::backdrop { background: rgba(10, 8, 30, .45); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Ask Velmio stays clear of the bottom action bar on phones. */
.page-studio .chat-launch { background: var(--brand); color: var(--on-brand); box-shadow: var(--md-shadow); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); }
.page-studio .chat-launch:hover { background: var(--brand-hover); }
.page-studio .chat-user, .page-studio .chat-send { background: var(--brand); color: var(--on-brand); }
.page-studio .chat-bot { background: var(--glass); }
.page-studio .chat-panel { z-index: 60; }

@media (max-width: 419px) {
  .studio-user { gap: 4px; }
  .top-preview { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .top-preview span { display: none; }
}

@media (min-width: 480px) {
  .composer-options { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .len-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .composer-actions { flex-direction: row; align-items: center; gap: 16px; }
  .composer-actions .studio-link { align-self: auto; }
  .scene-more-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .timeline-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 600px) {
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .size-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .logo-box { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .logo-actions { grid-column: auto; }
  .job { grid-template-columns: minmax(0, 1fr) minmax(0, 300px); align-items: center; }
}

@media (min-width: 768px) {
  .studio-body { grid-template-columns: 84px minmax(0, 1fr); }
  .rail { top: 60px; align-self: start; height: calc(100dvh - 60px); padding: 20px 8px; border-bottom: 0; border-inline-end: 1px solid var(--glass-line); }
  .rail ol { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .rail button[data-goto] { min-height: 60px; }
  .rail button[data-goto]:hover:not(:disabled) { background: rgba(var(--accent-rgb), .08); }
  .rail-result { padding: 6px; font-size: .72rem; }
  .studio-main { padding: 34px 32px 96px; }
  .panel-nav { position: static; width: min(900px, 100%); margin: 26px auto 0; padding: 0; border: 0; background: none; justify-content: space-between; }
  .panel-nav .btn-next { flex: none; min-width: 180px; margin-inline-start: auto; }
  .inspector { left: auto; top: 0; right: 0; width: min(380px, 100%); max-height: none; padding: 16px 20px; border-radius: 0; }
  [dir="rtl"] .inspector { left: 0; right: auto; }
  .page-studio .chat-launch { bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }
  .page-studio .chat-panel { top: 0; bottom: 0; inset-inline-end: 0; width: 400px; height: auto; border-width: 0; border-inline-start-width: 1px; border-radius: 0; }
}

@media (min-width: 1024px) {
  .studio-body { grid-template-columns: 232px minmax(0, 1fr); }
  .rail { padding: 22px 14px; }
  .rail-title { display: block; margin: 0 8px 14px; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .rail button[data-goto] { flex-direction: row; gap: 10px; min-height: 48px; padding: 6px 8px; font-size: .9rem; text-align: start; }
  .rail .is-current { background: var(--bg-2); box-shadow: var(--sm-shadow); }
  .rail-result { padding: 0 10px; font-size: .85rem; }
  .rail-progress { display: block; margin: 18px 8px 0; color: var(--muted); font-size: .8rem; }
  .rail-bar { height: 4px; margin-top: 6px; border-radius: 4px; background: var(--glass-line); overflow: hidden; }
  .rail-bar i { display: block; height: 100%; background: var(--brand); transition: width .25s ease; }
}

@media (min-width: 1280px) {
  .result-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .studio-body { grid-template-columns: 232px minmax(0, 1fr) 320px; }
  .studio.is-wide .studio-body { grid-template-columns: 232px minmax(0, 1fr); }
  .top-preview, #close-preview, .scrim { display: none !important; }
  .inspector { position: sticky; top: 60px; z-index: 1; display: block; align-self: start; width: auto; height: calc(100dvh - 60px); padding: 22px 20px 96px; border-inline-start: 1px solid var(--glass-line); box-shadow: none; }
  .inspector[hidden] { display: none; }
  .side-frame { max-height: 400px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-next, .btn-soft, .btn-ai, .rail i, .photo { transition: none; }
}
