/* Template Studio — UI styles */
:root {
  --bg: #0b0c0f;
  --panel: #131519;
  --panel-2: #1a1d23;
  --panel-3: #22262e;
  --line: #262a32;
  --line-2: #323743;
  --text: #eef0f4;
  --muted: #8b919d;
  --faint: #5d6370;
  --ui: #7c8cff;
  --inc: #3ddc97;
  --ui-2: #a3aeff;
  --ok: #3ddc97;
  --warn: #ffb547;
  --bad: #ff6b6b;
  --r: 14px;
  --font: "Unity", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ui-2); }
.hidden { display: none !important; }
::selection { background: rgba(124, 140, 255, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2e37; border-radius: 10px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

/* ───────── buttons ───────── */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); color: #0b0c0f; border-color: transparent; }
.btn.primary:hover { background: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.small { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.step-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #0b0c0f; color: var(--text); font-size: 11px; font-weight: 700; }
.btn.primary .step-num { background: #0b0c0f; color: #fff; }

/* ───────── gallery ───────── */
.gallery { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }
.brand { display: flex; align-items: center; gap: 18px; min-height: 52px; }
.brand-logo { height: 52px; width: auto; max-width: 340px; display: block; }
.brand-fallback { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand-div { width: 1px; height: 34px; background: var(--line-2); }
.brand-app { font-weight: 700; font-size: 17px; color: var(--muted); letter-spacing: .2px; }
.hero { padding: 56px 0 34px; }
.hero h1 { font-size: 44px; line-height: 1.08; letter-spacing: -1.2px; margin: 0 0 14px; font-weight: 750; }
.hero p { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0; }
.steps { display: flex; gap: 10px; margin: 26px 0 0; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-weight: 500; }
.steps li b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-3); color: var(--text); font-size: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; margin: 26px 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card { text-align: left; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; transition: transform .2s, border-color .2s, box-shadow .2s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 40px -18px rgba(0,0,0,.7); }
.card-media { aspect-ratio: 4 / 5; background: #000; position: relative; overflow: hidden; }
.card-media video, .card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 18px; letter-spacing: -.2px; }
.card-body p { margin: 0; color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-3); color: #c9cdd6; }
.card-cta { margin-top: auto; padding-top: 10px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.card-cta svg { width: 15px; transition: transform .2s; }
.card:hover .card-cta svg { transform: translateX(3px); }
.card.soon { border-style: dashed; background: transparent; justify-content: center; align-items: center; min-height: 240px; color: var(--faint); cursor: default; }
.card.soon:hover { transform: none; box-shadow: none; }
.foot { color: var(--faint); font-size: 12.5px; margin-top: 40px; display: flex; gap: 18px; flex-wrap: wrap; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(255, 181, 71, .1); border: 1px solid rgba(255, 181, 71, .3); color: #ffd79c; font-size: 13.5px; margin-top: 18px; }

/* ───────── editor ───────── */
.editor { display: grid; grid-template-columns: 420px 1fr; grid-template-rows: 92px 1fr; height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar .title { font-weight: 700; font-size: 17px; }
/* length / size pickers: big and labelled, so they're hard to miss */
.topbar .ctl { display: flex; flex-direction: column; gap: 6px; margin-left: 10px; }
.topbar .ctl-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); padding-left: 4px; }
.topbar .seg { padding: 4px; border-radius: 12px; background: var(--bg); border-color: var(--line-2); }
.topbar .seg button { height: 40px; padding: 0 16px; font-size: 15px; font-weight: 700; border-radius: 9px; gap: 9px; }
.topbar .seg button.on { background: var(--text); color: #0b0c0f; }
.btn.big { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; margin-left: 12px; align-self: center; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); }
.ratio-ico { display: inline-block; border: 1.6px solid currentColor; border-radius: 2.5px; }

.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 6px; padding: 14px 16px 0; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-weight: 600; }
.tab .step-num { background: var(--panel-3); color: var(--muted); }
.tab.on { background: var(--panel-2); color: var(--text); border-color: var(--line-2); }
.tab.on .step-num { background: var(--text); color: #0b0c0f; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.hint b { color: var(--text); font-weight: 600; }

.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 20px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--ui); background: rgba(124, 140, 255, .07); color: var(--text); }
.dropzone .dz-ico { width: 38px; height: 38px; margin: 0 auto 8px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-3); color: var(--text); }
.dropzone .dz-ico svg { width: 18px; }
.dropzone strong { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 2px; }

.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.slot { position: relative; aspect-ratio: 4 / 5; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--panel-2); padding: 0; }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .num { position: absolute; left: 5px; top: 5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: rgba(0,0,0,.7); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.slot .badge { position: absolute; left: 5px; bottom: 5px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.65); color: #cfd3db; letter-spacing: .3px; }
.slot .badge.vid { background: var(--ui); color: #fff; }
.slot.included { border-color: var(--inc); }
.slot.sel { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.slot { cursor: grab; }
.slot.dragging { opacity: .35; }
.slot.drop-before::after, .slot.drop-after::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 4px; border-radius: 3px; background: var(--ui); box-shadow: 0 0 0 2px rgba(124,140,255,.35); }
.slot.drop-before::after { left: 4px; }
.slot.drop-after::after { right: 4px; }
.scene.unused .scene-thumb, .scene.unused .scene-text .t { opacity: .45; }
.slot.unused img { opacity: .38; filter: grayscale(.6); }
.slots { grid-template-columns: repeat(4, 1fr); }
.field .help { margin-top: 6px; font-size: 12px; color: var(--muted); }
.ticks { position: absolute; inset: 0; pointer-events: none; }
.slot.over { border-color: var(--ui); }
.slot:hover img { filter: brightness(1.08); }

.focus-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.focus-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.focus-head .t { font-weight: 650; }
.focus-head .n { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.focus-stage { background: #000; border-radius: 10px; padding: 0; display: flex; justify-content: center; }
.focus-box { position: relative; width: fit-content; max-width: 100%; border-radius: 10px; overflow: hidden; cursor: crosshair; line-height: 0; }
.focus-box img { display: block; max-width: 100%; max-height: 300px; width: auto; height: auto; }
.focus-dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.45), inset 0 0 0 2px rgba(0,0,0,.25); pointer-events: none; transition: left .12s, top .12s; }
.focus-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #fff; }
.trim { margin-top: 14px; }
.trim-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.trim-head .t { font-weight: 650; }
.trim-read { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.trim-read b { color: var(--text); font-weight: 650; }
.trim-strip { position: relative; height: 58px; border-radius: 10px; overflow: hidden; background: #000; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.trim-strip.dragging { cursor: grabbing; }
.trim-strip.full { cursor: default; }
.trim-strip:focus-visible { outline: 2px solid var(--ui); outline-offset: 2px; }
.trim-frames { position: absolute; inset: 0; display: flex; }
.trim-frames img { flex: 1; min-width: 0; height: 100%; object-fit: cover; pointer-events: none; }
.trim-shade { position: absolute; top: 0; bottom: 0; background: rgba(5, 6, 8, .7); pointer-events: none; }
.trim-win { position: absolute; top: 0; bottom: 0; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 4px 14px rgba(0,0,0,.5); display: flex; justify-content: space-between; align-items: center; padding: 0 4px; pointer-events: none; transition: box-shadow .15s; }
.trim-strip.dragging .trim-win { box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 0 5px rgba(255,255,255,.18); }
.trim-win .grip { width: 4px; height: 22px; border-radius: 2px; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,.6); }
.trim-strip.full .trim-win .grip { display: none; }
.trim-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.focus-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.scene { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; background: var(--panel); overflow: hidden; }
.scene.open { border-color: var(--line-2); background: var(--panel-2); }
.scene-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: transparent; border: 0; text-align: left; }
.scene-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel-3); display: grid; place-items: center; color: var(--muted); }
.scene-thumb svg { width: 16px; }
.scene-text { flex: 1; min-width: 0; }
.scene-text .t { font-weight: 650; }
.scene-text .s { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 16px; color: var(--muted); transition: transform .2s; }
.scene.open .chev { transform: rotate(180deg); }
.scene-body { padding: 4px 14px 16px; display: grid; gap: 14px; }

.field label.lbl { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.field.off .input { opacity: .4; }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--ui); box-shadow: 0 0 0 3px rgba(124, 140, 255, .18); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.count { font-weight: 500; color: var(--faint); font-size: 11.5px; }

.switch { position: relative; width: 36px; height: 21px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(124, 140, 255, .35); }

.swatches { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: #fff; }
.color-input { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; border-radius: 8px; overflow: hidden; cursor: pointer; }
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 1px dashed var(--muted); border-radius: 8px; }

.img-field { display: flex; gap: 12px; align-items: center; }
.img-prev { width: 120px; height: 72px; border-radius: 10px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; background: repeating-conic-gradient(#20232a 0% 25%, #191b20 0% 50%) 50% / 14px 14px; cursor: pointer; overflow: hidden; }
.img-prev { position: relative; }
.img-prev img { position: absolute; inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); object-fit: contain; }
.img-prev.over { border-color: var(--ui); }
.img-prev.locked { cursor: default; border-style: solid; width: 150px; padding: 8px; }
.field.off .img-prev img { opacity: .35; }

/* stage */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: radial-gradient(1200px 600px at 50% 0%, #15171c, var(--bg)); }
.stage-info { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.canvas-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px 28px; }
.canvas-wrap canvas { border-radius: 10px; box-shadow: 0 30px 80px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.06); background: #000; display: block; }
.transport { display: flex; align-items: center; gap: 14px; padding: 12px 24px 18px; max-width: 920px; width: 100%; margin: 0 auto; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--text); color: #0b0c0f; display: grid; place-items: center; flex: none; }
.play svg { width: 18px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; width: 92px; text-align: center; flex: none; }
.scrub { flex: 1; position: relative; height: 36px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.scrub .track { position: absolute; left: 0; right: 0; height: 6px; border-radius: 6px; background: var(--panel-3); }
.scrub .fill { position: absolute; left: 0; height: 6px; border-radius: 6px; background: var(--text); }
.scrub .knob { position: absolute; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.scrub .tick { position: absolute; top: 4px; width: 2px; height: 8px; margin-left: -1px; border-radius: 2px; background: var(--faint); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; flex: none; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn svg { width: 17px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(5, 6, 8, .66); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; animation: fade .15s; }
.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 40px 100px -20px rgba(0,0,0,.8); animation: pop .18s ease-out; }
.modal-head { padding: 22px 24px 4px; }
.modal-head h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.3px; }
.modal-head p { margin: 0; color: var(--muted); }
.modal-body { padding: 16px 24px; display: grid; gap: 18px; }
.modal-foot { padding: 14px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.size { position: relative; border: 1.5px solid var(--line-2); background: var(--panel-2); border-radius: 14px; padding: 14px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.size .shape { height: 64px; display: flex; align-items: center; justify-content: center; }
.size .shape i { display: block; border: 2px solid var(--muted); border-radius: 5px; }
.size .r { font-weight: 700; font-size: 15px; }
.size .d { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.size .tick { position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; }
.size .tick svg { width: 12px; opacity: 0; }
.size.on { border-color: var(--text); background: var(--panel-3); }
.size.on .shape i { border-color: var(--text); }
.size.on .tick { background: var(--text); border-color: var(--text); color: #0b0c0f; }
.size.on .tick svg { opacity: 1; }
.quality { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quality .q { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--panel-2); text-align: left; }
.quality .q .t { font-weight: 700; }
.quality .q .s { color: var(--muted); font-size: 12px; line-height: 1.3; }
.quality .q.on { border-color: var(--text); background: var(--panel-3); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.opt-row .t { font-weight: 600; }
.opt-row .s { color: var(--muted); font-size: 12.5px; }
.warn { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.25); color: #ffd79c; font-size: 13px; }
.jobs { display: grid; gap: 10px; }
.job { display: grid; grid-template-columns: 96px 1fr 120px; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.job .r { font-weight: 700; }
.job .bar { height: 6px; border-radius: 6px; background: var(--panel-3); overflow: hidden; }
.job .bar i { display: block; height: 100%; width: 0; background: var(--text); border-radius: 6px; transition: width .2s; }
.job .st { text-align: right; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.job.done .bar i { background: var(--ok); }
.job.done .st { color: var(--ok); }
.job.err .st { color: var(--bad); }
.success { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: rgba(61,220,151,.08); border: 1px solid rgba(61,220,151,.25); }
.success svg { width: 22px; color: var(--ok); flex: none; }

.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 40; }
.loading .box { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--panel-3); border-top-color: var(--text); animation: spin .8s linear infinite; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel-3); border: 1px solid var(--line-2); padding: 12px 16px; border-radius: 12px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.7); z-index: 60; max-width: min(560px, calc(100vw - 32px)); animation: pop .18s; }
.toast.bad { border-color: rgba(255,107,107,.5); }
.drop-overlay { position: fixed; inset: 0; z-index: 45; background: rgba(124, 140, 255, .12); border: 3px dashed var(--ui); display: grid; place-items: center; pointer-events: none; font-size: 22px; font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
.toast { animation: toastin .2s; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes fade { from { opacity: 0; } }

/* mid-size windows: keep the big pickers but make everything fit on one row */
@media (max-width: 1280px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar .title + .sub, .topbar .tags { display: none; }
  .topbar .ctl { margin-left: 2px; }
  .topbar .seg button { padding: 0 12px; font-size: 14px; gap: 7px; }
  .btn.big { padding: 0 16px; margin-left: 4px; }
}
@media (max-width: 1080px) {
  .topbar .seg button { padding: 0 9px; }
  .btn.big .long { display: none; }
  .topbar > .btn.ghost .long { display: none; }
}
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .stage { min-height: 70vh; }
  .topbar .ctl { margin-left: 0; }
  .topbar .spacer { flex-basis: 100%; height: 0; }
  .sizes { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 34px; }
  .gallery { padding: 20px 16px 40px; }
}

/* splash — shown while the studio loads (see Template Studio.html); app/studio.js fades it out */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; background: #08080a; transition: opacity .6s ease, visibility 0s linear .6s; }
.splash.out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-bg { position: absolute; inset: -2%; background: linear-gradient(180deg, rgba(8, 8, 10, .55), rgba(8, 8, 10, .82)), url('brand/splash.jpg') center 45% / cover no-repeat;
  animation: splash-push 6s cubic-bezier(.2, .6, .3, 1) both; }
.splash-lockup { position: relative; display: flex; align-items: center; gap: clamp(18px, 2.4vw, 34px); padding: 0 24px; animation: splash-in .9s cubic-bezier(.2, .7, .2, 1) .1s both; }
.splash-logo { height: clamp(56px, 7.2vw, 104px); width: auto; max-width: 62vw; display: block; filter: drop-shadow(0 4px 24px rgba(0, 0, 0, .45)); }
.splash-div { width: 2px; height: clamp(38px, 5vw, 72px); background: rgba(255, 255, 255, .45); }
.splash-app { font-weight: 700; font-size: clamp(22px, 2.6vw, 38px); letter-spacing: .3px; color: #fff; white-space: nowrap; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }
.splash-bar { position: absolute; left: 50%; bottom: 12vh; width: min(220px, 40vw); height: 3px; margin-left: calc(min(220px, 40vw) / -2); border-radius: 3px; background: rgba(255, 255, 255, .16); overflow: hidden; animation: splash-in .9s ease .5s both; }
.splash-bar i { position: absolute; inset: 0 auto 0 0; width: 40%; border-radius: 3px; background: rgba(255, 255, 255, .85); animation: splash-run 1.1s ease-in-out infinite; }
@keyframes splash-push { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes splash-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes splash-run { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (max-width: 700px) {
  .splash-lockup { flex-direction: column; gap: 16px; }
  .splash-div { width: 56px; height: 2px; align-self: center; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-bg, .splash-lockup, .splash-bar { animation: none; }
  .splash-bar i { animation-duration: 2.4s; }
}
