/* UCA BeautyFace editor - uca-theme-v1 (Nocturne) colours, Apple-style motion and materials */
:root {
  --bg: #0b0b10; --bg2: #121219; --glass: rgba(28, 29, 40, 0.72); --glass2: rgba(44, 45, 60, 0.6);
  --line: rgba(255, 255, 255, 0.08); --line2: rgba(255, 255, 255, 0.14);
  --text: var(--uca-text, #e9e9ed); --muted: var(--uca-muted, #9397ab); --dim: var(--uca-dim, #75798c);
  --accent: var(--uca-accent, #9184d9); --accent-l: var(--uca-accent-light, #b5abfc); --accent-t: var(--uca-accent-text, #d2cefd);
  --ok: var(--uca-ok, #7fd6a4); --warn: var(--uca-warn, #e8c27a);
  --spring: cubic-bezier(0.32, 0.72, 0, 1); --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --r1: 12px; --r2: 18px; --r3: 26px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="light"] { --bg: #f4f3f8; --bg2: #ffffff; --glass: rgba(255, 255, 255, 0.78); --glass2: rgba(236, 235, 245, 0.8); --line: rgba(0, 0, 0, 0.07); --line2: rgba(0, 0, 0, 0.12); --text: #17171f; --muted: #5d6072; --dim: #8a8d9e; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]):not([data-theme="night"])[data-theme="system"] { --bg: #f4f3f8; --bg2: #fff; --glass: rgba(255,255,255,.78); --glass2: rgba(236,235,245,.8); --line: rgba(0,0,0,.07); --line2: rgba(0,0,0,.12); --text: #17171f; --muted: #5d6072; --dim: #8a8d9e; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; display: block; }
#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; pointer-events: none; transform: scale(0.985); transition: opacity 0.38s var(--ease), transform 0.5s var(--spring); }
.screen.on { opacity: 1; pointer-events: auto; transform: none; }

/* buttons */
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: transform 0.18s var(--spring), background 0.2s, opacity 0.2s; }
.icon-btn:active { transform: scale(0.88); background: var(--line); }
.icon-btn:disabled { opacity: 0.28; pointer-events: none; }
.pill-btn { height: 36px; padding: 0 18px; border-radius: 18px; background: var(--accent); color: #fff; font-weight: 650; font-size: 15px; letter-spacing: 0.01em; box-shadow: 0 6px 20px rgba(145, 132, 217, 0.35); transition: transform 0.2s var(--spring), filter 0.2s; }
.pill-btn:active { transform: scale(0.94); filter: brightness(1.1); }
.glass-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--glass); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6); border: 1px solid var(--line); color: var(--text); transition: transform 0.2s var(--spring), background 0.2s; }
.glass-btn:active, .glass-btn.on { transform: scale(0.9); background: var(--accent); color: #fff; }

/* home: one screen, no scrolling. Deep space, aurora, stars, display type; the hero card takes the free space. */
#home { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100%; overflow: hidden; padding: calc(var(--safe-t) + 6px) 0 calc(var(--safe-b) + 10px); background: #04040a; color: #f2f1f7; isolation: isolate; }
.space { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.space canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.aurora { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; mix-blend-mode: screen; will-change: transform; }
.a1 { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: radial-gradient(circle, #6a4dff 0%, rgba(106, 77, 255, 0) 65%); animation: drift1 22s ease-in-out infinite alternate; }
.a2 { width: 60vmax; height: 60vmax; right: -25vmax; top: 10vmax; background: radial-gradient(circle, #ff5fae 0%, rgba(255, 95, 174, 0) 62%); animation: drift2 26s ease-in-out infinite alternate; opacity: 0.38; }
.a3 { width: 55vmax; height: 55vmax; left: 10vmax; bottom: -35vmax; background: radial-gradient(circle, #19d3ff 0%, rgba(25, 211, 255, 0) 60%); animation: drift3 30s ease-in-out infinite alternate; opacity: 0.3; }
@keyframes drift1 { to { transform: translate(18vmax, 12vmax) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-16vmax, 14vmax) scale(0.9); } }
@keyframes drift3 { to { transform: translate(12vmax, -14vmax) scale(1.2); } }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.015em; }
.brand img { border-radius: 8px; box-shadow: 0 4px 18px rgba(160, 130, 255, 0.45); }
.icon-btn.glassy { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: #fff; }
.home-text { padding: min(2.2vh, 18px) 20px min(1.8vh, 16px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 min(1.6vh, 14px); padding: 5px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: #cfc8ff; background: rgba(140, 120, 255, 0.12); border: 1px solid rgba(160, 140, 255, 0.25); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #7fffd4; box-shadow: 0 0 0 0 rgba(127, 255, 212, 0.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(127, 255, 212, 0); } 100% { box-shadow: 0 0 0 0 rgba(127, 255, 212, 0); } }
.display { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif; font-size: clamp(32px, min(11.5vw, 6.4vh), 76px); line-height: 0.98; letter-spacing: -0.05em; font-weight: 800; margin: 0 0 min(1.4vh, 12px); color: #fff; text-shadow: 0 10px 40px rgba(120, 90, 255, 0.25); }
.shine { background: linear-gradient(100deg, #a99bff 0%, #ff8fd0 30%, #ffd5a5 50%, #8fe9ff 70%, #a99bff 100%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
@keyframes shine { to { background-position: -220% 0; } }
.sub { font-size: clamp(14px, min(4vw, 2.1vh), 18px); line-height: 1.4; color: rgba(235, 233, 245, 0.7); margin: 0; letter-spacing: -0.01em; }
.hero-card { position: relative; margin: 0 20px; min-height: 0; border-radius: 28px; overflow: hidden; background: #111; box-shadow: 0 24px 70px rgba(80, 50, 200, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1); animation: float 7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
.hero-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.hc-after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--split, 50%)); }
.hc-line { position: absolute; top: 0; bottom: 0; left: var(--split, 50%); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 18px 2px rgba(200, 180, 255, 0.9); }
.hc-scan { position: absolute; left: 0; right: 0; height: 22%; top: -22%; background: linear-gradient(180deg, transparent, rgba(160, 140, 255, 0.16) 80%, rgba(220, 210, 255, 0.5) 99%, transparent); animation: sweep 3.6s cubic-bezier(.45, 0, .55, 1) infinite; mix-blend-mode: screen; }
.hc-tag { position: absolute; bottom: 12px; padding: 5px 11px; border-radius: 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: #fff; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.15); }
.hc-tag.l { left: 12px; } .hc-tag.r { right: 12px; }
.home-bottom { padding: min(2vh, 18px) 20px 0; display: grid; gap: min(1.6vh, 13px); }
.quick { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quick[hidden] { display: none; }
.quick-label { font-size: 13px; font-weight: 650; color: rgba(235, 233, 245, 0.65); white-space: nowrap; }
.quick-row { display: flex; gap: 8px; overflow: hidden; }
.dot-photo { width: clamp(38px, 5.6vh, 50px); height: clamp(38px, 5.6vh, 50px); border-radius: 50%; overflow: hidden; flex: none; border: 2px solid rgba(181, 171, 252, 0.7); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); transition: transform 0.25s var(--spring); }
.dot-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dot-photo:active { transform: scale(0.9); }
.home-actions { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.big-btn { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; height: clamp(50px, 7vh, 60px); padding: 0 16px; border-radius: 20px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: #fff; font-weight: 650; font-size: 17px; letter-spacing: -0.01em; cursor: pointer; transition: transform 0.25s var(--spring), background 0.2s; }
.big-btn.primary { background: linear-gradient(120deg, #7b61ff, #b465ff 55%, #ff7ac6); border: 0; box-shadow: 0 14px 40px rgba(150, 90, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.big-btn .glow { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%); transform: translateX(-100%); animation: btnshine 3.8s ease-in-out infinite 1.2s; }
@keyframes btnshine { 40%, 100% { transform: translateX(100%); } }
.big-btn:active { transform: scale(0.96); }
.capsule { justify-self: center; display: inline-flex; align-items: center; gap: 7px; margin: 0; padding: 6px 12px; border-radius: 20px; background: rgba(127, 214, 164, 0.1); border: 1px solid rgba(127, 214, 164, 0.25); color: #b9f0d2; font-size: 12px; font-weight: 600; text-align: center; }
.capsule svg { width: 14px; height: 14px; flex: none; }
#home .home-foot { display: flex; justify-content: center; gap: 16px; padding: 0; font-size: 11.5px; }
#home .home-foot a { color: rgba(235, 233, 245, 0.4); text-decoration: none; }
@media (max-height: 640px) { .sub, .eyebrow { display: none; } .capsule { font-size: 11px; } }
/* wide screens: text and buttons left, hero right */
@media (min-aspect-ratio: 1/1) and (min-width: 700px) {
  #home { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 20px; }
  .home-top { grid-column: 1 / 3; }
  .home-text { grid-column: 1; grid-row: 2; align-self: end; padding-left: max(28px, 6vw); }
  .home-bottom { grid-column: 1; grid-row: 3; padding: 0 0 2vh max(28px, 6vw); max-width: 560px; }
  .hero-card { grid-column: 2; grid-row: 2 / 4; margin: 1vh max(28px, 5vw) 3vh 0; }
  .display { font-size: clamp(40px, 6vw, 92px); }
}

.home-block { padding: 22px 0 0; }
.home-block h2 { font-size: 17px; margin: 0 22px 12px; letter-spacing: -0.01em; display: flex; gap: 8px; align-items: baseline; }
.home-block h2 small { color: var(--dim); font-weight: 500; font-size: 13px; }
.row-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 2px 22px 6px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.row-scroll::-webkit-scrollbar { display: none; }
.card { flex: none; width: 128px; height: 168px; border-radius: var(--r2); overflow: hidden; position: relative; scroll-snap-align: start; background: var(--bg2); border: 1px solid var(--line); transition: transform 0.25s var(--spring); }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:active { transform: scale(0.95); }
.card span { position: absolute; left: 8px; bottom: 8px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); color: #fff; }
.home-foot { display: flex; flex-wrap: wrap; gap: 18px; padding: 30px 22px 10px; font-size: 13px; }
.home-foot a { color: var(--dim); text-decoration: none; }

/* editor */
#editor { background: #08080c; }
:root[data-theme="light"] #editor { background: #e9e8ef; }
.ed-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 6px) 10px 6px; z-index: 3; }
.hist { display: flex; gap: 4px; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.viewport { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; will-change: transform; }
.viewport canvas { display: block; width: 100%; height: 100%; border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.stage-tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 10px; z-index: 2; }
.hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); padding: 8px 14px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); font-size: 13.5px; color: var(--text); border: 1px solid var(--line); white-space: nowrap; animation: pop 0.4s var(--spring); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -6px) scale(0.96); } }
.scan { position: absolute; inset: 0; display: grid; place-items: end center; pointer-events: none; padding-bottom: 26px; }
.scan p { margin: 0; padding: 9px 16px; border-radius: 18px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); font-size: 14px; border: 1px solid var(--line); }
.scan-bar { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(180deg, transparent, rgba(181, 171, 252, 0.18) 70%, rgba(220, 214, 255, 0.55) 99%, transparent); animation: sweep 1.6s var(--ease) infinite; }
@keyframes sweep { to { top: 100%; } }
.split-handle { position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; cursor: ew-resize; z-index: 2; touch-action: none; }
.split-handle::before { content: ""; position: absolute; left: 21px; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); }
.split-handle span { position: absolute; top: 50%; left: 4px; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; background: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); }
.split-handle span::before, .split-handle span::after { content: ""; position: absolute; top: 12px; border: 6px solid transparent; }
.split-handle span::before { left: 3px; border-right-color: #333; }
.split-handle span::after { right: 3px; border-left-color: #333; }

.dock { position: relative; z-index: 3; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25)); padding-bottom: var(--safe-b); }
.panel { min-height: 132px; padding: 8px 0 4px; position: relative; overflow: hidden; }
.panel-inner { animation: panelIn 0.42s var(--spring); }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } }
.tools { display: flex; gap: 2px; overflow-x: auto; padding: 6px 10px 10px; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding: 0 10px; position: relative; border-top: 1px solid var(--line); }
.tools::-webkit-scrollbar { display: none; }
.tool { flex: none; width: var(--tool-w, 70px); display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 0 4px; border-radius: 14px; color: var(--muted); font-size: 11.5px; font-weight: 550; letter-spacing: 0.01em; scroll-snap-align: start; transition: color 0.2s, transform 0.22s var(--spring), background 0.25s; }
.tool svg { width: 26px; height: 26px; }
.tool:active { transform: scale(0.9); }
.tool.on { color: var(--text); background: var(--line); }
.tool.on svg { color: var(--accent-l); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 14px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 14px; border-radius: 16px; background: var(--glass2); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; transition: background 0.2s, color 0.2s, transform 0.2s var(--spring); }
.chip:active { transform: scale(0.94); }
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-l); }
.chip.on .dot { background: var(--accent); }

/* strip of thumbnails */
.strip { display: flex; gap: 14px; overflow-x: auto; padding: 4px 14px 6px; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding: 0 14px; }
.strip::-webkit-scrollbar { display: none; }
.item { flex: none; width: var(--item-w, 66px); display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 550; text-align: center; line-height: 1.15; scroll-snap-align: start; transition: transform 0.22s var(--spring); }
.item:active { transform: scale(0.92); }
.item .th { width: 100%; aspect-ratio: 66 / 84; border-radius: 14px; overflow: hidden; background: var(--bg2); position: relative; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color 0.2s, transform 0.3s var(--spring); }
.item .th canvas, .item .th img { width: 100%; height: 100%; display: block; object-fit: cover; animation: fadeIn 0.35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }
.item .th.sw { display: grid; place-items: center; }
.item.on { color: var(--text); }
.item.on .th { outline-color: var(--accent-l); transform: scale(1.04); }
.item .none { width: 100%; height: 100%; display: grid; place-items: center; color: var(--dim); }

/* swatches */
.swatches { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.swatches::-webkit-scrollbar { display: none; }
.sw-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 8px rgba(0, 0, 0, 0.3); transition: transform 0.22s var(--spring); }
.sw-btn.on { transform: scale(1.12); }
.sw-btn.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--text); }
.sw-btn.custom { background: conic-gradient(#f66, #fd6, #6f9, #6cf, #a7f, #f6c, #f66); }
.sw-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* slider */
.slider { position: relative; height: 46px; margin: 0 18px; touch-action: none; cursor: grab; }
.slider .track { position: absolute; left: 0; right: 0; top: 21px; height: 4px; border-radius: 2px; background: var(--line2); }
.slider .fill { position: absolute; top: 21px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-l)); }
.slider .ticks { position: absolute; left: 0; right: 0; top: 30px; height: 6px; display: flex; justify-content: space-between; pointer-events: none; }
.slider .ticks i { width: 1px; height: 5px; background: var(--line2); }
.slider .ticks i.mid { height: 7px; background: var(--dim); }
.slider .thumb { position: absolute; top: 9px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(0, 0, 0, 0.1); transition: transform 0.2s var(--spring); }
.slider.drag .thumb { transform: scale(1.18); }
.slider .bubble { position: absolute; top: -18px; transform: translateX(-50%) scale(0.8); opacity: 0; padding: 2px 8px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; transition: opacity 0.2s, transform 0.25s var(--spring); pointer-events: none; }
.slider.drag .bubble { opacity: 1; transform: translateX(-50%) scale(1); }
.slider-row { display: flex; align-items: center; gap: 4px; }
.slider-row .slider { flex: 1; }
.slider-label { display: flex; justify-content: space-between; padding: 0 20px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.slider-label b { color: var(--text); font-variant-numeric: tabular-nums; }
.mini-reset { width: 34px; height: 34px; margin-right: 10px; border-radius: 50%; display: grid; place-items: center; color: var(--dim); }
.mini-reset svg { width: 18px; height: 18px; }

/* sheets */
.sheet-wrap { position: absolute; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 0.25s var(--ease); }
.sheet-wrap.closing { animation: fadeOut 0.25s var(--ease) forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--bg2); border-radius: var(--r3) var(--r3) 0 0; padding: 10px 18px calc(var(--safe-b) + 18px); animation: sheetIn 0.5s var(--spring); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4); }
.sheet-wrap.closing .sheet { animation: sheetOut 0.28s var(--ease) forwards; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto 12px; }
.sheet h3 { margin: 4px 0 14px; font-size: 20px; letter-spacing: -0.02em; }
.sheet .preview { width: 100%; max-height: 42vh; object-fit: contain; border-radius: var(--r2); background: #000; display: block; margin-bottom: 14px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions .wide { grid-column: span 2; }
.act { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border-radius: 15px; background: var(--glass2); border: 1px solid var(--line); font-weight: 650; font-size: 15px; transition: transform 0.2s var(--spring); }
.act:active { transform: scale(0.96); }
.act.primary { background: var(--accent); color: #fff; border: 0; }
.group { background: var(--glass2); border-radius: var(--r2); border: 1px solid var(--line); margin: 0 0 14px; overflow: hidden; }
.group .row { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 15px; gap: 10px; }
.group .row:last-child { border-bottom: 0; }
.group .row small { color: var(--dim); display: block; font-size: 12.5px; margin-top: 2px; }
.seg { display: inline-flex; background: var(--line); border-radius: 10px; padding: 2px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: background 0.2s, color 0.2s; }
.seg button.on { background: var(--bg2); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.note a { color: var(--accent-t); }

.toast { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 140px); transform: translateX(-50%) translateY(20px); opacity: 0; padding: 11px 18px; border-radius: 22px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 14px; pointer-events: none; transition: opacity 0.3s, transform 0.45s var(--spring); z-index: 30; white-space: nowrap; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* stage overlays (reshape regions, brushes, crop) */
.ov-region { fill: rgba(181, 171, 252, 0.13); stroke: rgba(255, 255, 255, 0.9); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ov-handle { fill: #fff; stroke: rgba(0, 0, 0, 0.25); stroke-width: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); pointer-events: auto; cursor: grab; }
.ov-arrow { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-dasharray: 3 3; animation: dash 1.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -12; } }
.ov-brush { fill: rgba(255, 255, 255, 0.12); stroke: #fff; stroke-width: 1.5; }
.ov-paint { fill: none; stroke: rgba(181, 171, 252, 0.55); stroke-linecap: round; stroke-linejoin: round; }
.ov-grid { stroke: rgba(255, 255, 255, 0.55); stroke-width: 0.8; }
.ov-crop { fill: none; stroke: #fff; stroke-width: 1.5; }
.ov-shade { fill: rgba(0, 0, 0, 0.55); fill-rule: evenodd; }
.ov-corner { stroke: #fff; stroke-width: 4; fill: none; stroke-linecap: round; pointer-events: auto; }
.ov-ring { fill: none; stroke: rgba(255, 255, 255, 0.95); stroke-width: 2; animation: ring 0.6s var(--ease) forwards; }
@keyframes ring { from { r: 2; opacity: 1; } to { opacity: 0; } }
.ov-dot { fill: rgba(220, 214, 255, 0.85); animation: dotIn 0.9s var(--ease) both; }
@keyframes dotIn { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* desktop: photo left, tools on the right */
@media (min-width: 900px) and (min-height: 560px) {
  #editor { display: grid; grid-template-columns: 1fr 400px; grid-template-rows: auto 1fr; }
  .ed-top { grid-column: 1 / 3; }
  .stage { grid-column: 1; grid-row: 2; }
  .dock { grid-column: 2; grid-row: 2; display: flex; flex-direction: column-reverse; justify-content: flex-end; background: var(--bg2); border-left: 1px solid var(--line); overflow-y: auto; }
  .tools { flex-wrap: wrap; overflow: visible; border-top: 0; border-bottom: 1px solid var(--line); padding: 12px; justify-content: flex-start; }
  .tool { width: 74px; }
  .panel { min-height: 0; padding-top: 14px; }
  .chips, .strip, .swatches { flex-wrap: wrap; overflow: visible; }
  .item { width: 74px; }
  .item .th { width: 74px; }
  .home-hero, .home-block h2 { margin-left: max(22px, calc(50% - 480px)); }
  .row-scroll { padding-left: max(22px, calc(50% - 480px)); }
  .home-foot { padding-left: max(22px, calc(50% - 480px)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
