/* ============================================================
   SONYA Editor — design tokens, glass primitives, layout.
   Source of truth: the SONYA Editor reference (dark + light).
   Palette — light: #FEFDFD pearl base · #D0CDD2 neutral glass ·
   #AFADBE cold lavender-grey · #877FC7 accent;
   dark: #171923 base · #3A3A47 panels · #AFADBE reflections ·
   #877FC7 accent. Purple only on selection, focus, playhead, Export.
   Themes switch token values only (html[data-theme]), never markup.
   ============================================================ */

/* ── Tokens ── */
:root,
[data-theme="dark"] {
	color-scheme: dark;
	--ed-bg: #050508;
	/* the wave artwork pushed toward black: vignette + dimming veil over it */
	--ed-bg-image:
		radial-gradient(120% 90% at 50% 45%, rgba(5, 5, 8, 0.35) 0%, rgba(3, 3, 5, 0.78) 70%, rgba(2, 2, 3, 0.94) 100%),
		linear-gradient(rgba(4, 4, 7, 0.45), rgba(4, 4, 7, 0.45)),
		url('/assets/editor/bg-dark.jpg');
	--ed-text: #EEEDF4;
	--ed-text-2: #AFADBE;
	--ed-text-3: rgba(175, 173, 190, 0.62);
	--ed-accent: #877FC7;
	--ed-accent-soft: rgba(135, 127, 199, 0.32);
	--ed-accent-glow: rgba(135, 127, 199, 0.55);

	/* glass material */
	--ed-glass-fill:
		linear-gradient(155deg, rgba(190, 188, 215, 0.12) 0%, rgba(30, 30, 40, 0.34) 38%, rgba(6, 6, 10, 0.62) 100%);
	--ed-glass-fill-hi:
		linear-gradient(155deg, rgba(200, 198, 228, 0.2) 0%, rgba(40, 40, 52, 0.38) 40%, rgba(8, 8, 12, 0.58) 100%);
	--ed-glass-rim:
		linear-gradient(140deg, rgba(255, 255, 255, 0.95) 0%, rgba(214, 212, 236, 0.5) 18%, rgba(175, 173, 190, 0.22) 42%,
			rgba(150, 142, 220, 0.7) 64%, rgba(214, 212, 236, 0.35) 82%, rgba(255, 255, 255, 0.9) 100%);
	--ed-glass-highlight: rgba(255, 255, 255, 0.38);
	--ed-glass-spec: rgba(255, 255, 255, 0.18);
	--ed-glass-lav: rgba(135, 127, 199, 0.16);
	--ed-glass-depth: rgba(5, 6, 12, 0.55);
	/* shadows + the glow: glass lit from within, a soft halo outside */
	--ed-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 26px 60px -18px rgba(0, 0, 0, 0.9),
		0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 34px -6px rgba(196, 192, 245, 0.24);
	--ed-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.45), 0 12px 26px -12px rgba(0, 0, 0, 0.85),
		0 0 18px -4px rgba(196, 192, 245, 0.2);
	--ed-field: rgba(23, 25, 35, 0.42);
	--ed-field-rim: rgba(175, 173, 190, 0.18);
	--ed-track: rgba(58, 58, 71, 0.28);
	--ed-track-rim: rgba(175, 173, 190, 0.14);
	--ed-screen: rgba(16, 17, 25, 0.62);
	--ed-screen-video: #0D0E15;
	--ed-frame-rim-w: 13px;
	--ed-frame-glow: rgba(214, 210, 255, 0.35);
	--ed-sheet-base: rgba(14, 15, 22, 0.84);
	--ed-frame-edge: rgba(245, 244, 255, 0.85);
	--ed-scrim: rgba(10, 11, 18, 0.5);
	--ed-tip-bg: rgba(23, 25, 35, 0.92);
	--ed-danger: #E3A6B0;
	--ed-bevel-hi: rgba(226, 224, 248, 0.62);   /* puffy edge light (SONYA bevel) */
	--ed-bevel-lo: rgba(5, 6, 12, 0.5);         /* edge shade, bottom-right */
	--ed-lip: rgba(255, 255, 255, 0.12);        /* top lip of the slab */
	--ed-spec: rgba(255, 255, 255, 0.16);       /* moving specular */
	--ed-export-ring: rgba(135, 127, 199, 0.95);
	--ed-export-halo: 0 0 22px rgba(135, 127, 199, 0.55), 0 0 2px rgba(135, 127, 199, 0.9);
}
[data-theme="light"] {
	color-scheme: light;
	--ed-bg: #FEFDFD;
	--ed-bg-image: url('/assets/editor/bg-light.jpg');
	--ed-text: #2E2C3B;
	--ed-text-2: #6D6A80;
	--ed-text-3: #9895A9;
	--ed-accent: #877FC7;
	--ed-accent-soft: rgba(135, 127, 199, 0.24);
	--ed-accent-glow: rgba(135, 127, 199, 0.35);

	--ed-glass-fill:
		linear-gradient(155deg, rgba(254, 253, 253, 0.78) 0%, rgba(254, 253, 253, 0.42) 40%, rgba(208, 205, 210, 0.42) 100%);
	--ed-glass-fill-hi:
		linear-gradient(155deg, rgba(254, 253, 253, 0.92) 0%, rgba(254, 253, 253, 0.6) 40%, rgba(208, 205, 210, 0.5) 100%);
	--ed-glass-rim:
		linear-gradient(140deg, #FFFFFF 0%, rgba(208, 205, 210, 0.75) 22%, rgba(175, 173, 190, 0.45) 45%,
			rgba(135, 127, 199, 0.32) 64%, rgba(208, 205, 210, 0.7) 82%, #FFFFFF 100%);
	--ed-glass-highlight: rgba(255, 255, 255, 0.95);
	--ed-glass-spec: rgba(255, 255, 255, 0.7);
	--ed-glass-lav: rgba(135, 127, 199, 0.1);
	--ed-glass-depth: rgba(110, 106, 130, 0.22);
	--ed-shadow: 0 2px 6px rgba(110, 106, 130, 0.12), 0 24px 50px -18px rgba(110, 106, 130, 0.38);
	--ed-shadow-sm: 0 2px 4px rgba(110, 106, 130, 0.1), 0 10px 22px -12px rgba(110, 106, 130, 0.35);
	--ed-field: rgba(254, 253, 253, 0.55);
	--ed-field-rim: rgba(175, 173, 190, 0.42);
	--ed-track: rgba(254, 253, 253, 0.42);
	--ed-track-rim: rgba(175, 173, 190, 0.38);
	--ed-screen: rgba(254, 253, 253, 0.28);
	--ed-screen-video: #14151C;
	--ed-frame-edge: rgba(255, 255, 255, 0.95);
	--ed-frame-glow: transparent;
	--ed-sheet-base: rgba(246, 245, 250, 0.9);
	--ed-scrim: rgba(208, 205, 210, 0.45);
	--ed-tip-bg: rgba(46, 44, 59, 0.9);
	--ed-danger: #9A4456;
	--ed-bevel-hi: rgba(255, 255, 255, 0.95);
	--ed-bevel-lo: rgba(150, 146, 172, 0.32);
	--ed-lip: rgba(255, 255, 255, 0.6);
	--ed-spec: rgba(255, 255, 255, 0.55);
	--ed-export-ring: rgba(135, 127, 199, 0.55);
	--ed-export-halo: 0 0 18px rgba(135, 127, 199, 0.28), 0 0 1px rgba(135, 127, 199, 0.6);
}
[data-theme="light"] .ed-export, [data-theme="light"] .ed-cta {
	--sg-fill: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(232, 228, 246, 0.85) 50%, rgba(208, 202, 236, 0.75) 100%);
}

html, body { height: 100%; }
body {
	margin: 0;
	overflow: hidden;
	color: var(--ed-text);
	background-color: var(--ed-bg);
	background-image: var(--ed-bg-image);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	background-attachment: fixed;
	font-family: 'Onest', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
}

/* Control reset at zero specificity, so components always win. */
:where(.ed-app, .ed-dialog, .ed-toast) :where(button, input, textarea) { font: inherit; color: inherit; margin: 0; }
:where(.ed-app, .ed-dialog) :where(button) { -webkit-appearance: none; appearance: none; border: 0; background: none; padding: 0; cursor: pointer; }
:where(.ed-app, .ed-dialog) :where(a) { color: inherit; text-decoration: none; }
.ed-app *, .ed-app *::before, .ed-app *::after, .ed-dialog *, .ed-dialog *::before, .ed-dialog *::after { box-sizing: border-box; }
.ed-app [hidden], .ed-dialog[hidden], .ed-scrim[hidden] { display: none !important; }
:where(.ed-app, .ed-dialog) :focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 3px; }

/* ============================================================
   Glass primitives — one material, varied by custom properties.
     .sg            base: fill + luminous rim + specular + depth
     .sg--panel     inspector, timeline, dialogs
     .sg--rail      tool rail
     .sg--frame     the preview's thick optical frame
     .sg--btn       round buttons (undo, redo, play)
     .sg--pill      capsules (aspect, Export, actions, playback bar)
     .sg--tile      square icon tiles (rail, track icons)
     .sg--field     inputs, value pills, segmented groups
     .sg--selected  lavender edge glow + brighter glass
   ============================================================ */
.sg {
	--sg-r: 24px;
	--sg-rim-w: 1.2px;
	--sg-blur: 18px;
	--sg-fill: var(--ed-glass-fill);
	--sg-bevel: 16px;          /* how "puffy" the edge is */
	--mx: 22%;                 /* specular position, follows the pointer */
	--my: 0%;
	position: relative;
	isolation: isolate;
	border-radius: var(--sg-r);
	background: var(--sg-fill);
	-webkit-backdrop-filter: blur(var(--sg-blur)) saturate(150%);
	backdrop-filter: blur(var(--sg-blur)) saturate(150%);
	box-shadow: var(--ed-shadow-sm);
	transition: box-shadow 0.18s ease, background 0.18s ease, transform 0.14s ease, opacity 0.18s ease;
}
/* rim: a gradient border — bright corners, lavender in the turn */
.sg::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	padding: var(--sg-rim-w);
	background: var(--ed-glass-rim);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
	pointer-events: none;
}
/* volume: top inner highlight, corner specular, lavender reflection, bottom depth */
.sg::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	pointer-events: none;
	background:
		radial-gradient(circle at var(--mx) var(--my), var(--ed-spec), transparent 42%),
		linear-gradient(180deg, var(--ed-lip), transparent 34%),
		radial-gradient(70% 45% at 18% 0%, var(--ed-glass-spec), transparent 70%),
		radial-gradient(45% 35% at 100% 100%, var(--ed-glass-lav), transparent 72%);
	box-shadow:
		inset calc(var(--sg-bevel) * -1) calc(var(--sg-bevel) * -1) calc(var(--sg-bevel) / 2) calc(var(--sg-bevel) * -1) var(--ed-bevel-hi),
		inset var(--sg-bevel) var(--sg-bevel) calc(var(--sg-bevel) / 2) calc(var(--sg-bevel) * -1) var(--ed-bevel-hi),
		inset 0 1px 0 var(--ed-glass-highlight),
		inset 0 0 0 1px rgba(255, 255, 255, 0.03),
		inset -2px -3px 6px -2px var(--ed-bevel-lo),
		inset 0 -16px 28px -20px var(--ed-glass-depth);
	transition: background-position 0.2s ease;
}
[data-theme="dark"] .sg--panel::before, [data-theme="dark"] .sg--rail::before, [data-theme="dark"] .ed-frame::before { --sg-rim-w: 1.5px; }
.sg--panel { --sg-r: 34px; --sg-blur: 24px; --sg-bevel: 22px; box-shadow: var(--ed-shadow); }
.sg--rail { --sg-r: 36px; --sg-blur: 22px; --sg-bevel: 22px; box-shadow: var(--ed-shadow); }
.sg--pill { --sg-r: 999px; --sg-bevel: 18px; }
.sg--btn { --sg-r: 999px; --sg-bevel: 15px; display: inline-grid; place-items: center; width: 52px; height: 52px; color: var(--ed-text); }
.sg--tile { --sg-r: 16px; --sg-blur: 10px; --sg-bevel: 12px; display: grid; place-items: center; }
.sg--field { --sg-r: 999px; --sg-fill: var(--ed-field); --sg-blur: 8px; --sg-bevel: 0px; box-shadow: inset 0 1px 3px var(--ed-glass-depth); }

/* Refraction of the background through the big slabs (Chromium: url() in
   backdrop-filter; elsewhere the declaration is dropped and the plain blur stays). */
.sg--panel, .sg--rail, .ed-frame {
	-webkit-backdrop-filter: blur(var(--sg-blur)) saturate(150%) url(#ed-glass-warp);
	backdrop-filter: blur(var(--sg-blur)) saturate(150%) url(#ed-glass-warp);
}
.sg--field::before { --sg-rim-w: 1px; background: linear-gradient(160deg, var(--ed-field-rim), transparent 60%, var(--ed-field-rim)); }
.sg--field::after { background: none; box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05); }

@media (hover: hover) and (pointer: fine) {
	.sg--btn:hover:not(:disabled), .sg--pill:hover:not(:disabled):not(.ed-playbar):not(.ed-toast), .ed-rail-item:hover .sg--tile {
		--sg-fill: var(--ed-glass-fill-hi);
	}
}
.sg--btn:active:not(:disabled), .sg--pill:active:not(:disabled):not(.ed-playbar), .ed-rail-item:active .sg--tile { transform: translateY(1px) scale(0.98); }
.sg:disabled { opacity: 0.62; cursor: default; }
.sg:disabled .ed-ico, .sg:disabled > span { opacity: 0.7; }

.sg--selected {
	--sg-fill: linear-gradient(155deg, rgba(190, 182, 245, 0.6) 0%, rgba(135, 127, 199, 0.46) 45%, rgba(96, 86, 170, 0.5) 100%);
	box-shadow: var(--ed-shadow-sm), 0 0 0 1px var(--ed-accent-soft), 0 0 22px var(--ed-accent-glow), inset 0 0 14px rgba(135, 127, 199, 0.35);
}
[data-theme="light"] .sg--selected {
	--sg-fill: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(214, 209, 238, 0.75) 50%, rgba(175, 168, 222, 0.6) 100%);
}
.sg--selected::before {
	--sg-rim-w: 1.4px;
	background: linear-gradient(140deg, rgba(255, 255, 255, 0.9), var(--ed-accent) 35%, rgba(135, 127, 199, 0.55) 65%, rgba(255, 255, 255, 0.75));
}

/* ── Icons ── */
.ed-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; }
.ed-ico svg { width: 100%; height: 100%; }

/* ============================================================
   Layout — desktop after the reference
   ============================================================ */
.ed-app {
	--rail-w: clamp(96px, 7vw, 118px);
	--insp-w: clamp(300px, 20.5vw, 350px);
	--tl-h: clamp(150px, 21vh, 206px);
	box-sizing: border-box;
	height: 100%;            /* html/body are 100% = the visible viewport */
	display: grid;
	grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--insp-w);
	grid-template-rows: 64px minmax(0, 1fr) var(--tl-h);
	grid-template-areas: "top top top" "rail stage insp" "tl tl tl";
	gap: clamp(16px, 2.2vh, 24px) clamp(20px, 2.6vw, 44px);
	--ed-pad-x: clamp(16px, 6vw, 104px);
	padding: clamp(18px, 2.6vh, 30px) var(--ed-pad-x) clamp(18px, 3.4vh, 40px);
	color: var(--ed-text);
}
/* App Library control (app-shell) sits fixed top-left: keep the wordmark clear of it. */
.sx-shell .ed-top { padding-left: max(0px, calc(var(--sx-edge, 20px) + 56px - var(--ed-pad-x))); }

/* Top: wordmark + actions */
.ed-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.ed-mark { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 4px 6px; border-radius: 12px; text-align: left; }
.ed-mark-sonya { font-family: 'Unbounded', 'Onest', system-ui, sans-serif; font-weight: 300; font-size: 20px; letter-spacing: 0.62em; line-height: 1; color: var(--ed-text); }
.ed-mark-app { font-weight: 300; font-size: 17px; letter-spacing: 0.62em; line-height: 1; color: var(--ed-text-2); }
.ed-top-actions { flex: none; display: flex; align-items: center; gap: 14px; }
/* the wordmark gives way first when the row gets tight (App Library control + actions) */
.ed-mark { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.ed-mark-sonya, .ed-mark-app { white-space: nowrap; }
.ed-aspect { display: inline-flex; align-items: center; gap: 12px; height: 52px; padding: 0 18px 0 20px; font-size: 15px; color: var(--ed-text); }
.ed-aspect .ed-ico[data-icon="chevronDown"] { width: 18px; height: 18px; margin-left: 14px; color: var(--ed-text-2); }
.ed-aspect-label { min-width: 54px; }
.ed-export {
	--sg-fill: var(--ed-glass-fill-hi);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	height: 54px;
	min-width: 206px;
	padding: 0 30px;
	font-size: 19px;
	font-weight: 400;
	letter-spacing: 0.01em;
	color: var(--ed-text);
	box-shadow: var(--ed-shadow-sm), var(--ed-export-halo);
}
.ed-export::before { --sg-rim-w: 1.6px; background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), var(--ed-export-ring) 30%, rgba(175, 173, 190, 0.4) 55%, var(--ed-export-ring) 80%, rgba(255, 255, 255, 0.85)); }
.ed-export .ed-ico { width: 24px; height: 24px; }

/* Rail */
.ed-rail { grid-area: rail; align-self: start; display: flex; flex-direction: column; align-items: center; gap: clamp(0px, 0.5vh, 12px); padding: clamp(8px, 1.4vh, 16px) 10px clamp(6px, 1.2vh, 14px); max-height: 100%; overflow: hidden auto; scrollbar-width: none; }
.ed-rail::-webkit-scrollbar { display: none; }
.ed-rail-item { display: flex; flex-direction: column; align-items: center; gap: clamp(2px, 0.5vh, 6px); width: 100%; padding: 2px 0; color: var(--ed-text); border-radius: 18px; }
.ed-rail-item .sg--tile { --sg-r: 17px; width: clamp(44px, 3.6vw, 58px); height: clamp(30px, 4.6vh, 52px); color: var(--ed-text); }
.ed-rail-item .ed-ico { width: clamp(22px, 3.2vh, 28px); height: clamp(22px, 3.2vh, 28px); }
.ed-rail-label { font-size: clamp(11.5px, 1.5vh, 13.5px); line-height: 1.15; font-weight: 400; color: var(--ed-text-2); }
.ed-rail-item.is-active .sg--tile { width: clamp(56px, 4.6vw, 76px); height: clamp(40px, 6.4vh, 70px); --sg-r: 20px; }
.ed-rail-item.is-active { padding: 2px 4px 4px; border-radius: 22px; }
.ed-rail-item.is-active .ed-rail-label { color: var(--ed-text); }
.ed-rail-item[data-rail="more"] .sg--tile { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; height: clamp(14px, 2.6vh, 26px); }
.ed-rail-item[data-rail="more"] .sg--tile::before, .ed-rail-item[data-rail="more"] .sg--tile::after { display: none; }

/* Rail artwork: the glass tile is the image itself. */
.ed-art {
	position: relative;
	display: block;
	width: clamp(30px, min(3.8vw, 4.6vh), 60px);
	aspect-ratio: 1;
	border-radius: 27%;
	transition: transform 0.16s ease, box-shadow 0.18s ease;
	box-shadow: 0 6px 16px -8px rgba(5, 6, 12, 0.55);
}
.ed-art img { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; transition: filter 0.18s ease; }
.ed-art .ed-art--light { display: none; }
[data-theme="light"] .ed-art .ed-art--light { display: block; }
[data-theme="light"] .ed-art .ed-art--dark { display: none; }
[data-theme="dark"] .ed-art img { filter: brightness(0.92); }
.ed-rail-item.is-active .ed-art {
	width: clamp(40px, min(4.6vw, 6.4vh), 72px);
	box-shadow: 0 0 0 1.5px var(--ed-accent), 0 0 22px var(--ed-accent-glow), 0 8px 18px -8px rgba(5, 6, 12, 0.5);
}
.ed-rail-item.is-active .ed-art img { filter: none; }
@media (hover: hover) and (pointer: fine) {
	.ed-rail-item:hover .ed-art { transform: translateY(-1px); }
	.ed-rail-item:hover .ed-art img { filter: none; }
}
.ed-rail-item:active .ed-art { transform: scale(0.96); }
.ed-rail-item:focus-visible { outline: none; }
.ed-rail-item:focus-visible .ed-art { box-shadow: 0 0 0 2px var(--ed-accent), 0 0 18px var(--ed-accent-glow); }

/* Stage: thick optical frame */
.ed-stage { grid-area: stage; min-width: 0; min-height: 0; display: grid; }
.ed-frame {
	--sg-r: clamp(36px, 4vw, 64px);
	--sg-rim-w: 1.6px;
	--sg-blur: 6px;
	--sg-fill: linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02) 35%, rgba(135, 127, 199, 0.06) 70%, rgba(255, 255, 255, 0.08));
	position: relative;
	min-height: 0;
	padding: var(--ed-frame-rim-w);
	box-shadow:
		var(--ed-shadow),
		inset 0 2px 1px -1px var(--ed-frame-edge),
		inset 0 -2px 1px -1px rgba(255, 255, 255, 0.18),
		inset 0 0 18px rgba(175, 173, 190, 0.08),
		inset 2px 0 0 rgba(135, 127, 199, 0.28),
		inset -2px 0 0 rgba(255, 255, 255, 0.16),
		inset 0 0 0 var(--ed-frame-rim-w) rgba(255, 255, 255, 0.025),
		0 0 40px -10px var(--ed-accent-soft),
		0 0 60px -14px var(--ed-frame-glow, transparent);
	--sg-bevel: 28px;
}
/* The frame is thick glass: its rim catches a second, softer bevel inside. */
.ed-frame > .ed-well::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 6;
	border-radius: inherit;
	pointer-events: none;
	box-shadow:
		inset 10px 10px 14px -12px rgba(255, 255, 255, 0.28),
		inset -10px -10px 14px -12px rgba(135, 127, 199, 0.3),
		inset 0 0 26px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .ed-frame > .ed-well::after {
	box-shadow:
		inset 10px 10px 14px -12px rgba(255, 255, 255, 0.95),
		inset -10px -10px 14px -12px rgba(135, 127, 199, 0.22),
		inset 0 0 22px rgba(150, 146, 172, 0.12);
}
/* inner edge of the thick glass rim */
.ed-frame > .ed-well { box-shadow: 0 0 0 1px var(--ed-frame-edge), 0 0 0 2px rgba(0, 0, 0, 0.18), 0 0 14px rgba(255, 255, 255, 0.06); }
.ed-glint { position: absolute; z-index: 3; pointer-events: none; border-radius: 50%; mix-blend-mode: screen; }
.ed-glint--a { top: -6px; left: 6%; width: 32%; height: 22px; background: radial-gradient(50% 50% at 50% 50%, rgba(255, 255, 255, 0.7), rgba(175, 173, 190, 0.18) 45%, transparent 70%); }
.ed-glint--b { bottom: -6px; right: 8%; width: 30%; height: 20px; background: radial-gradient(50% 50% at 50% 50%, rgba(255, 255, 255, 0.55), rgba(135, 127, 199, 0.25) 45%, transparent 72%); }
[data-theme="light"] .ed-glint { mix-blend-mode: normal; opacity: 0.85; }
.ed-well { position: relative; width: 100%; height: 100%; display: grid; place-items: center; border-radius: calc(var(--sg-r) - var(--ed-frame-rim-w)); overflow: hidden; }
.ed-screen {
	position: relative;
	overflow: hidden;
	border-radius: calc(var(--sg-r) - var(--ed-frame-rim-w) - 2px);
	background: var(--ed-screen);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 30px 60px -40px rgba(0, 0, 0, 0.45);
}
.ed-ready .ed-screen { background: var(--ed-screen-video); }
.ed-pic { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transform-origin: center; }
.ed-pic video { display: block; width: 100%; height: 100%; object-fit: fill; }
.ed-tint { position: absolute; inset: 0; mix-blend-mode: soft-light; pointer-events: none; }
.ed-screen-hit { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.ed-screen-hit:focus { outline: none; }
.ed-frame.is-drop .ed-screen { box-shadow: inset 0 0 0 2px var(--ed-accent), 0 0 30px var(--ed-accent-glow); }

/* Captions over the picture (same layout the export draws) */
.ed-caption-layer {
	position: absolute;
	left: 8%;
	right: 8%;
	bottom: 11%;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.2em;
	pointer-events: none;
	font: 700 calc(var(--ed-sh, 400px) * var(--ed-cap-size, 0.044)) / 1.25 'Onest', system-ui, sans-serif;
	text-align: center;
	color: #fff;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.9), 0 2px 10px rgba(0, 0, 0, 0.6);
}
.ed-caption-layer.is-top { bottom: auto; top: 9%; }
.ed-caption-layer span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--ed-cap-lines, 2); overflow: hidden; }
.ed-caption-layer.is-bold span { padding: 0.05em 0.35em; border-radius: 0.3em; background: rgba(8, 8, 10, 0.62); text-shadow: none; }

/* Empty / loading / error — calm, inside the glass */
.ed-state { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.ed-state strong { font-size: 17px; font-weight: 400; color: var(--ed-text); }
.ed-state > span:not(.ed-spin) { max-width: 34ch; font-size: 13.5px; line-height: 1.55; color: var(--ed-text-2); }
.ed-state--empty { padding-bottom: 90px; }
.ed-frame.is-empty .ed-playbar { display: none; }
.ed-state-hint { font-size: 13px; color: var(--ed-text-3); }
.ed-insp-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 10px 26px; text-align: center; }
.ed-insp-empty .sg--tile { width: 52px; height: 52px; color: var(--ed-text-2); }
.ed-insp-empty .ed-ico { width: 24px; height: 24px; }
.ed-insp-empty p { margin: 0; max-width: 26ch; font-size: 14px; line-height: 1.55; color: var(--ed-text-2); }
.ed-insp-empty .ed-act { width: auto; justify-content: center; padding: 0 20px; }
.ed-pick-btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px 0 18px; font-size: 14.5px; color: var(--ed-text); }
.ed-spin { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ed-accent-soft); border-top-color: var(--ed-accent); animation: edSpin 0.8s linear infinite; }
@keyframes edSpin { to { transform: rotate(360deg); } }

/* Playback capsule, floating inside the frame */
.ed-playbar {
	--sg-fill: var(--ed-glass-fill-hi);
	--sg-blur: 22px;
	position: absolute;
	left: 50%;
	bottom: clamp(22px, 4.4%, 36px);
	z-index: 5;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	gap: 14px;
	width: min(410px, calc(100% - 48px));
	height: 60px;
	padding: 0 18px 0 6px;
}
.ed-play { width: 48px; height: 48px; flex: none; }
.ed-play .ed-ico { width: 20px; height: 20px; }
.ed-time { flex: none; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ed-text-2); white-space: nowrap; }
.ed-progress { flex: 1; min-width: 40px; }
.ed-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; color: var(--ed-text-2); transition: color 0.15s ease, background-color 0.15s ease; }
.ed-icon-btn .ed-ico { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .ed-icon-btn:hover:not(:disabled) { color: var(--ed-text); background: rgba(175, 173, 190, 0.12); } }
.ed-icon-btn:disabled { opacity: 0.4; cursor: default; }
.ed-icon-btn--sm { width: 28px; height: 28px; }
.ed-icon-btn--sm .ed-ico { width: 16px; height: 16px; }

/* Thin slider: lavender active part, round glass thumb */
.ed-range {
	--lo: 0%;
	--hi: 0%;
	-webkit-appearance: none;
	appearance: none;
	height: 22px;
	margin: 0;
	background: transparent;
	cursor: pointer;
}
.ed-range::-webkit-slider-runnable-track {
	height: 3px;
	border-radius: 3px;
	background: linear-gradient(90deg, var(--ed-track-rim) 0 var(--lo), var(--ed-accent) var(--lo) var(--hi), var(--ed-track-rim) var(--hi) 100%);
}
.ed-range::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--ed-track-rim) 0 var(--lo), var(--ed-accent) var(--lo) var(--hi), var(--ed-track-rim) var(--hi) 100%); }
.ed-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 16px;
	height: 16px;
	margin-top: -6.5px;
	border-radius: 50%;
	background: radial-gradient(60% 60% at 35% 30%, #fff, #D9D7E6 55%, #AFADBE);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6), 0 2px 6px rgba(5, 6, 12, 0.35), 0 0 10px var(--ed-accent-soft);
}
.ed-range::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: radial-gradient(60% 60% at 35% 30%, #fff, #D9D7E6 55%, #AFADBE); box-shadow: 0 2px 6px rgba(5, 6, 12, 0.35); }
.ed-range:disabled { opacity: 0.45; cursor: default; }
.ed-range:focus-visible { outline: none; }
.ed-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--ed-accent-soft), 0 0 0 1px var(--ed-accent); }

/* ── Inspector ── */
.ed-inspector { grid-area: insp; align-self: start; max-height: 100%; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ed-tabs { flex: none; display: flex; align-items: center; gap: 2px; margin: 14px 14px 0; padding: 4px; border-radius: 22px; background: rgba(23, 25, 35, 0.22); box-shadow: inset 0 1px 2px var(--ed-glass-depth); }
[data-theme="light"] .ed-tabs { background: rgba(208, 205, 210, 0.3); }
.ed-tab { position: relative; flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 8px; border-radius: 18px; font-size: 14.5px; color: var(--ed-text-2); white-space: nowrap; }
.ed-tab[aria-selected="true"] {
	color: var(--ed-text);
	background: var(--ed-glass-fill-hi);
	box-shadow: inset 0 1px 0 var(--ed-glass-highlight), inset 0 0 0 1px rgba(255, 255, 255, 0.08), var(--ed-shadow-sm);
}
.ed-tab[aria-selected="true"]::after { content: ''; position: absolute; left: 28%; right: 28%; bottom: 5px; height: 2px; border-radius: 2px; background: var(--ed-accent); box-shadow: 0 0 8px var(--ed-accent-glow); }
@media (hover: hover) and (pointer: fine) { .ed-tab:not([aria-selected="true"]):hover { color: var(--ed-text); } }
.ed-sheet-close { display: none; }
.ed-inspector-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 22px 22px; scrollbar-width: thin; scrollbar-color: var(--ed-track-rim) transparent; }
.ed-sec { padding: 18px 0 16px; }
.ed-sec + .ed-sec { border-top: 1px solid var(--ed-track-rim); }
.ed-sec-head { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.ed-sec-title { flex: 1; margin: 0; font-size: 17px; font-weight: 500; color: var(--ed-text); }
.ed-sec.is-collapsed .ed-sec-body { display: none; }
.ed-sec.is-collapsed .ed-sec-head { margin-bottom: 0; }
.ed-fold .ed-ico { transition: transform 0.2s ease; }
.ed-sec.is-collapsed .ed-fold .ed-ico { transform: rotate(90deg); }
.ed-sec-body { display: flex; flex-direction: column; gap: 12px; }
.ed-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 72px; align-items: center; gap: 10px; min-height: 40px; }
.ed-row--block { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ed-row-label { font-size: 14px; color: var(--ed-text-2); }
.ed-num { width: 100%; height: 38px; padding: 0 12px; border: 0; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ed-text); }
.ed-num:disabled { color: var(--ed-text-3); }
.ed-num:focus { outline: none; box-shadow: 0 0 0 2px var(--ed-accent-soft), inset 0 1px 3px var(--ed-glass-depth); }
.ed-pos { grid-column: 2 / 4; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-xy { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; font-size: 14px; color: var(--ed-text-2); }
.ed-xy input { width: 100%; min-width: 0; border: 0; background: none; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ed-text); }
.ed-xy input:focus { outline: none; }
.ed-xy:focus-within { box-shadow: 0 0 0 2px var(--ed-accent-soft); }

.ed-seg { display: flex; gap: 2px; padding: 3px; --sg-r: 16px; }
.ed-seg-opt { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 6px; border-radius: 13px; font-size: 13px; line-height: 1.15; color: var(--ed-text-2); transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease; }
.ed-seg-opt.is-on { color: var(--ed-text); background: var(--ed-glass-fill-hi); box-shadow: inset 0 1px 0 var(--ed-glass-highlight), 0 0 0 1px var(--ed-accent-soft), 0 0 12px var(--ed-accent-soft); }
.ed-seg-opt:disabled { opacity: 0.5; cursor: default; }

.ed-switch { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 14.5px; color: var(--ed-text); cursor: pointer; }
.ed-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ed-switch i { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--ed-field); box-shadow: inset 0 1px 3px var(--ed-glass-depth), inset 0 0 0 1px var(--ed-field-rim); transition: background-color 0.2s ease; }
.ed-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(60% 60% at 35% 30%, #fff, #D9D7E6 55%, #AFADBE); box-shadow: 0 2px 5px rgba(5, 6, 12, 0.3); transition: transform 0.2s ease; }
.ed-switch input:checked + i { background: var(--ed-accent-soft); box-shadow: inset 0 0 0 1px var(--ed-accent), 0 0 12px var(--ed-accent-soft); }
.ed-switch input:checked + i::after { transform: translateX(20px); }
.ed-switch input:focus-visible + i { outline: 2px solid var(--ed-accent); outline-offset: 2px; }
.ed-switch input:disabled + i { opacity: 0.45; }

.ed-act { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 16px; font-size: 14px; text-align: left; color: var(--ed-text); }
.ed-act .ed-ico { width: 18px; height: 18px; color: var(--ed-text-2); }
.ed-act > span:not(.ed-ico) { flex: 1; }
.ed-act--danger, .ed-act--danger .ed-ico { color: var(--ed-danger); }
.ed-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-chip { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; font-size: 13px; color: var(--ed-text); }
.ed-timing { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ed-timing > span { flex: 1 0 100%; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ed-text-2); }
.ed-input { width: 100%; min-height: 40px; padding: 10px 14px; border: 0; --sg-r: 14px; font-size: 14.5px; line-height: 1.45; color: var(--ed-text); resize: vertical; }
.ed-input::placeholder { color: var(--ed-text-3); }
.ed-input:focus { outline: none; box-shadow: 0 0 0 2px var(--ed-accent-soft), inset 0 1px 3px var(--ed-glass-depth); }
.ed-caplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ed-caplist li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; }
.ed-caplist-time { height: 40px; padding: 0 12px; --sg-r: 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ed-text-2); }
.ed-media { display: flex; align-items: center; gap: 12px; }
.ed-media .sg--tile { width: 46px; height: 46px; flex: none; color: var(--ed-text-2); }
.ed-media-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ed-media-text b { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-media-text span { font-size: 12.5px; color: var(--ed-text-2); font-variant-numeric: tabular-nums; }
.ed-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-facts div { padding: 10px 12px; border-radius: 14px; background: var(--ed-field); box-shadow: inset 0 1px 3px var(--ed-glass-depth), inset 0 0 0 1px var(--ed-field-rim); }
.ed-facts dt { font-size: 11px; letter-spacing: 0.04em; color: var(--ed-text-3); }
.ed-facts dd { margin: 4px 0 0; font-size: 14.5px; font-variant-numeric: tabular-nums; color: var(--ed-text); }
.ed-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.ed-look { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 8px 10px; --sg-r: 18px; font-size: 13px; color: var(--ed-text); }
.ed-look-swatch { display: block; height: 52px; border-radius: 12px; background: linear-gradient(135deg, #2b2d3d 0%, #6e6b80 35%, #c9c3d8 60%, #8b7f72 80%, #3a3a47 100%); }
.ed-note { margin: 4px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ed-text-3); }
.ed-error { margin: 0; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; color: var(--ed-danger); background: var(--ed-field); }
.ed-keys { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ed-keys div { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 34px; }
.ed-keys dd { margin: 0; font-size: 13.5px; color: var(--ed-text-2); text-align: right; }
.ed-keys kbd { padding: 4px 8px; border-radius: 8px; font: 500 12px/1 'Onest', system-ui, sans-serif; color: var(--ed-text); background: var(--ed-field); box-shadow: inset 0 0 0 1px var(--ed-field-rim); }

/* ── Timeline ── */
.ed-timeline {
	grid-area: tl;
	min-height: 0;
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	grid-template-rows: 34px minmax(0, 1fr);
	column-gap: 18px;
	padding: 10px 22px 14px 22px;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}
.ed-tl-tools { display: flex; align-items: center; justify-content: center; gap: 2px; }
.ed-mini { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--ed-text-2); }
.ed-mini .ed-ico { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .ed-mini:hover:not(:disabled) { color: var(--ed-text); background: rgba(175, 173, 190, 0.14); } }
.ed-mini:disabled { opacity: 0.35; cursor: default; }
.ed-ruler { position: relative; cursor: pointer; }
.ed-tick { position: absolute; bottom: 4px; width: 1px; height: 4px; background: var(--ed-text-3); opacity: 0.55; }
.ed-tick--major { height: 8px; opacity: 1; }
.ed-tick b { position: absolute; bottom: 12px; left: 0; transform: translateX(-50%); font-size: 11.5px; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--ed-text-3); white-space: nowrap; }
.ed-tick--major:first-child b { color: var(--ed-accent); transform: translateX(-20%); }
.ed-tl-icons { display: flex; flex-direction: column; gap: 6px; align-items: center; min-height: 0; }
.ed-tl-icons .sg--tile { flex: 1; width: 48px; max-height: 44px; min-height: 0; --sg-r: 14px; color: var(--ed-text); }
.ed-tl-icons .ed-ico { width: 24px; height: 24px; }
.ed-tracks { position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 0; cursor: pointer; }
.ed-track { position: relative; flex: 1; min-height: 0; max-height: 44px; }
.ed-lane { position: absolute; inset: 0; border-radius: 12px; background: var(--ed-track); box-shadow: inset 0 0 0 1px var(--ed-track-rim), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.ed-clip, .ed-wave, .ed-cap { position: absolute; top: 0; bottom: 0; }
.ed-clip { padding: 0 2px; }
.ed-clip-strip {
	position: absolute;
	inset: 0 2px;
	display: flex;
	overflow: hidden;
	border-radius: 12px;
	background: var(--ed-track);
	box-shadow: inset 0 0 0 1px var(--ed-track-rim);
	transition: box-shadow 0.18s ease;
}
.ed-clip-strip i { flex: 1 1 0; min-width: 0; background: center / cover no-repeat; opacity: 0.92; }
.ed-clip-strip i + i { box-shadow: -1px 0 0 rgba(0, 0, 0, 0.25); }
.ed-clip-label { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); padding: 2px 7px; border-radius: 8px; font-size: 11px; font-variant-numeric: tabular-nums; color: #F4F3F8; background: rgba(23, 25, 35, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ed-clip-label:empty { display: none; }
.ed-clip.is-selected .ed-clip-strip { box-shadow: inset 0 0 0 1.5px var(--ed-accent), 0 0 14px var(--ed-accent-glow); }
.ed-clip:focus-visible { outline: none; }
.ed-clip:focus-visible .ed-clip-strip { box-shadow: inset 0 0 0 2px var(--ed-accent); }
.ed-cap { padding: 0 1px; }
.ed-cap span { position: absolute; inset: 0 1px; display: flex; align-items: center; padding: 0 10px; border-radius: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; color: var(--ed-text); background: var(--ed-glass-fill-hi); box-shadow: inset 0 0 0 1px var(--ed-track-rim), inset 0 1px 0 var(--ed-glass-highlight); }
.ed-cap.is-selected span { box-shadow: inset 0 0 0 1.5px var(--ed-accent), 0 0 12px var(--ed-accent-soft); }
.ed-wave { padding: 0 2px; }
.ed-wave::before { content: ''; position: absolute; inset: 0 2px; border-radius: 12px; background: var(--ed-track); box-shadow: inset 0 0 0 1px var(--ed-track-rim); }
.ed-wave svg { position: absolute; inset: 4px 8px; width: calc(100% - 16px); height: calc(100% - 8px); overflow: visible; }
.ed-wave path { stroke: var(--ed-text-2); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linecap: round; opacity: 0.85; }
.ed-wave.is-muted path { opacity: 0.25; }
.ed-playhead { position: absolute; top: -18px; bottom: -4px; width: 0; z-index: 4; pointer-events: none; }
.ed-playhead::before { content: ''; position: absolute; top: 0; bottom: 0; left: -0.75px; width: 1.5px; background: var(--ed-accent); box-shadow: 0 0 8px var(--ed-accent-glow); }
.ed-playhead i { position: absolute; top: -6px; left: -6px; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(60% 60% at 35% 30%, #fff, var(--ed-accent)); box-shadow: 0 0 10px var(--ed-accent-glow); }

/* ── Dialogs (export, aspect, more, keys) & scrim ── */
.ed-scrim { position: fixed; inset: 0; z-index: 30; background: var(--ed-scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: edFade 0.2s ease both; }
@keyframes edFade { from { opacity: 0; } }
.ed-dialog {
	--sg-fill: var(--ed-glass-fill-hi);
	position: fixed;
	z-index: 40;
	left: 50%;
	top: 50%;
	width: min(420px, calc(100vw - 32px));
	max-height: min(80dvh, 640px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transform: translate(-50%, -50%);
	color: var(--ed-text);
	animation: edDialogIn 0.2s ease both;
}
@keyframes edDialogIn { from { opacity: 0; transform: translate(-50%, -48%) scale(0.98); } }
.ed-dialog--aspect { top: 104px; left: auto; right: clamp(16px, 6vw, 104px); width: 280px; transform: none; animation-name: edPopIn; }
@keyframes edPopIn { from { opacity: 0; transform: translateY(-6px); } }
.ed-dialog-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 16px 6px 22px; }
.ed-dialog-title { margin: 0; font-size: 18px; font-weight: 500; }
.ed-dialog-body { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 8px 22px 22px; }
.ed-menu { display: flex; flex-direction: column; gap: 8px; }
.ed-cta { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; font-size: 16px; color: var(--ed-text); --sg-fill: var(--ed-glass-fill-hi); box-shadow: var(--ed-shadow-sm), var(--ed-export-halo); }
.ed-cta::before { --sg-rim-w: 1.6px; background: linear-gradient(120deg, rgba(255, 255, 255, 0.9), var(--ed-export-ring) 30%, rgba(175, 173, 190, 0.4) 55%, var(--ed-export-ring) 80%, rgba(255, 255, 255, 0.85)); }
.ed-export-status { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.ed-bar { height: 8px; border-radius: 999px; overflow: hidden; background: var(--ed-field); box-shadow: inset 0 0 0 1px var(--ed-field-rim); }
.ed-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ed-accent); box-shadow: 0 0 10px var(--ed-accent-glow); transition: width 0.2s linear; }

.ed-inspector.is-sheet, .ed-dialog { background: var(--sg-fill), var(--ed-sheet-base); }
.ed-toast { --sg-fill: var(--ed-glass-fill-hi); position: fixed; top: calc(84px + env(safe-area-inset-top)); left: 50%; z-index: 60; max-width: calc(100% - 32px); padding: 11px 18px; font: 400 13.5px/1.3 'Onest', system-ui, sans-serif; color: var(--ed-text); opacity: 0; transform: translate(-50%, -8px); pointer-events: none; transition: opacity 0.18s ease, transform 0.22s ease; }
.ed-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 699px) { .ed-toast { top: calc(66px + env(safe-area-inset-top)); } }

/* ============================================================
   Tablet (≤1179px): inspector becomes a right drawer
   ============================================================ */
@media (max-width: 1179px) {
	.ed-app { --ed-pad-x: clamp(16px, 4vw, 48px); grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-areas: "top top" "rail stage" "tl tl"; padding-inline: var(--ed-pad-x); }
	.ed-inspector.is-sheet {
		position: fixed;
		z-index: 35;
		top: 16px;
		right: 16px;
		bottom: 16px;
		width: min(360px, calc(100vw - 32px));
		max-height: none;
		transform: translateX(calc(100% + 24px));
		opacity: 0;
		visibility: hidden;
		transition: transform 0.22s ease, opacity 0.2s ease, visibility 0s linear 0.22s;
	}
	.ed-inspector.is-sheet.is-open { transform: none; opacity: 1; visibility: visible; transition: transform 0.22s ease, opacity 0.2s ease; }
	.ed-sheet-close { display: inline-grid; margin-left: 4px; }
	.ed-dialog--aspect { right: clamp(16px, 4vw, 48px); }
}

/* ============================================================
   Phone (≤699px): preview → timeline → bottom rail; sheets
   ============================================================ */
@media (max-width: 699px) {
	.ed-app {
		--tl-h: 150px;
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: 48px minmax(0, 1fr) var(--tl-h) auto;
		grid-template-areas: "top" "stage" "tl" "rail";
		gap: 10px;
		--ed-pad-x: 10px;
		padding: calc(10px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
	}
	.ed-mark { gap: 4px; }
	.ed-mark-sonya { display: none; }
	.ed-mark-app { font-size: 14px; letter-spacing: 0.32em; color: var(--ed-text); }
	.ed-top-actions { gap: 8px; }
	.ed-top .sg--btn { width: 42px; height: 42px; }
	.ed-top .sg--btn .ed-ico { width: 20px; height: 20px; }
	.ed-aspect { display: none; }      /* format lives in Video → Transform on phones */
	.ed-export { min-width: 0; height: 42px; padding: 0 16px; font-size: 15px; gap: 8px; }
	.ed-export .ed-ico { width: 20px; height: 20px; }
	.ed-rail { --sg-r: 26px; flex-direction: row; justify-content: space-between; align-self: stretch; gap: 2px; padding: 6px 8px; overflow: visible; }
	.ed-rail-item { flex: 1 1 0; min-width: 0; gap: 3px; padding: 2px 0; }
	.ed-rail-item .sg--tile, .ed-rail-item.is-active .sg--tile { --sg-r: 14px; width: 44px; height: 40px; margin: 0; }
	.ed-rail-item.is-active { padding: 2px 0; }
	.ed-art, .ed-rail-item.is-active .ed-art { width: 42px; }
	.ed-rail-item .ed-ico { width: 22px; height: 22px; }
	.ed-rail-label { font-size: 10.5px; }
	.ed-rail-item[data-rail="more"] .sg--tile { height: 40px; }
	.ed-frame { --sg-r: 30px; --ed-frame-rim-w: 8px; }
	.ed-playbar { height: 50px; gap: 10px; padding: 0 12px 0 4px; bottom: 14px; width: calc(100% - 28px); }
	.ed-play { width: 42px; height: 42px; }
	.ed-time { font-size: 12.5px; }
	.ed-timeline { --sg-r: 24px; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: 26px minmax(0, 1fr); column-gap: 10px; padding: 8px 12px 10px; }
	.ed-tl-tools .ed-mini { width: 20px; height: 26px; }
	.ed-tl-icons .sg--tile { --sg-r: 11px; width: 36px; }
	.ed-tl-icons .ed-ico { width: 18px; height: 18px; }
	.ed-tick b { font-size: 10px; bottom: 10px; }
	.ed-lane, .ed-clip-strip, .ed-wave::before { border-radius: 9px; }
	.ed-inspector.is-sheet {
		--sg-r: 28px;
		top: auto;
		left: 8px;
		right: 8px;
		bottom: calc(8px + env(safe-area-inset-bottom));
		width: auto;
		max-height: min(68dvh, 600px);
		transform: translateY(calc(100% + 24px));
	}
	.ed-tabs { margin: 12px 12px 0; }
	.ed-tab { height: 40px; font-size: 13.5px; }
	.ed-inspector-body { padding: 4px 18px 20px; }
	.ed-row:not(.ed-row--block) { grid-template-columns: 74px minmax(0, 1fr) 64px; }
	.ed-dialog { top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto; transform: none; max-height: 78dvh; animation-name: edSheetUp; }
	@keyframes edSheetUp { from { opacity: 0; transform: translateY(20px); } }
	.ed-dialog--aspect { top: auto; right: 8px; width: auto; }
}
@media (max-width: 359px) {
	.ed-rail-label { display: none; }
	.ed-rail { padding: 6px 4px; }
	.ed-rail-item .sg--tile { width: 38px; height: 38px; }
	.ed-art, .ed-rail-item.is-active .ed-art { width: 38px; }
	.ed-export span { display: none; }
	.ed-export { width: 44px; padding: 0; }
	.ed-time { font-size: 11.5px; }
	.ed-playbar { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
	.ed-app *, .ed-dialog, .ed-scrim, .ed-toast { animation: none !important; transition-duration: 0.01ms !important; }
	.sg { --mx: 22% !important; --my: 0% !important; }
}
