/* ============================================================
   Annotate — dark glass UI with aurora background
   ============================================================ */
:root {
  --bg: #07070d;
  --bg-2: #0e0e19;
  --glass: rgba(22, 22, 38, 0.62);
  --glass-2: rgba(32, 32, 54, 0.7);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --text: #ecebf7;
  --muted: #9a98b8;
  --faint: #66648a;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --grad: linear-gradient(135deg, var(--violet), var(--cyan));
  --grad-warm: linear-gradient(135deg, var(--pink), var(--violet));
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--stroke) inset;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px;
  background: var(--glass-2); border: 1px solid var(--stroke-2); border-bottom-width: 2px;
  font: 600 11px/18px var(--mono); text-align: center; color: var(--text);
}
code { font-family: var(--mono); font-size: 12px; color: var(--cyan); }
::selection { background: rgba(139, 92, 246, 0.45); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.2); }

/* ---------- animated background ---------- */
/* Only transform/opacity are animated so everything runs on the GPU compositor at the display refresh rate. */
.aurora { position: fixed; inset: -20%; z-index: 0; opacity: 0.6; pointer-events: none; overflow: hidden; contain: strict; }
.aurora i { position: absolute; width: 50vmax; height: 50vmax; border-radius: 50%; will-change: transform; backface-visibility: hidden; }
.aurora i:nth-child(1) { background: radial-gradient(closest-side, rgba(124, 58, 237, 0.9), rgba(124, 58, 237, 0.35) 45%, transparent); top: 0; left: 0; animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { background: radial-gradient(closest-side, rgba(8, 145, 178, 0.9), rgba(8, 145, 178, 0.35) 45%, transparent); bottom: 0; right: 0; animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { background: radial-gradient(closest-side, rgba(219, 39, 119, 0.6), rgba(219, 39, 119, 0.2) 45%, transparent); top: 30%; right: 20%; width: 38vmax; height: 38vmax; animation: drift3 38s ease-in-out infinite alternate; }
.aurora i:nth-child(4) { background: radial-gradient(closest-side, rgba(79, 70, 229, 0.8), rgba(79, 70, 229, 0.3) 45%, transparent); bottom: 10%; left: 25%; width: 34vmax; height: 34vmax; animation: drift1 44s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate3d(28vw, 22vh, 0) scale(1.25) rotate(40deg); } }
@keyframes drift2 { to { transform: translate3d(-30vw, -18vh, 0) scale(0.85) rotate(-30deg); } }
@keyframes drift3 { 50% { transform: translate3d(-20vw, 20vh, 0) scale(1.3); } to { transform: translate3d(10vw, -10vh, 0) scale(0.9); } }
.gridlines {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.35; overflow: hidden;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.gridlines::before {
  content: ""; position: absolute; inset: -48px 0 0 -48px;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  will-change: transform;
  animation: gridpan 60s linear infinite;
}
@keyframes gridpan { to { transform: translate3d(48px, 48px, 0); } }

.glass {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--stroke-2);
  background: rgba(255, 255, 255, 0.04); font-weight: 600; letter-spacing: 0.01em; overflow: hidden;
  transition: transform 0.25s var(--spring), background 0.2s, border-color 0.2s, box-shadow 0.3s;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.24); transform: translateY(-1px); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 30px -8px rgba(139, 92, 246, 0.7); }
.btn.primary::before {
  content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.7s var(--smooth);
}
.btn.primary:hover::before { transform: translateX(120%); }
.btn.primary:hover { box-shadow: 0 10px 40px -6px rgba(34, 211, 238, 0.6); }
.btn.accent { background: linear-gradient(135deg, #10b981, #22d3ee); border-color: transparent; color: #04121a; }
.btn.danger { color: var(--red); border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }
.btn.danger:hover { background: rgba(251, 113, 133, 0.18); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; }
.btn.small svg { width: 15px; height: 15px; }
.btn.wide { width: 100%; padding: 12px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background 0.2s, color 0.2s, transform 0.25s var(--spring);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); transform: scale(1.08); }
.icon-btn:active { transform: scale(0.9); }
.ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.35); transform: scale(0); animation: ripple 0.6s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 38px 32px 28px; text-align: center; animation: rise 0.8s var(--spring) both; }
.login-card h1 { margin: 14px 0 4px; font-size: 28px; letter-spacing: -0.02em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card p { margin: 0 0 24px; }
.login-card.shake { animation: shake 0.5s; }
.login-error { color: var(--red); min-height: 20px; margin: 14px 0 0 !important; font-size: 13px; }
.login.leaving { animation: fadeOut 0.5s var(--smooth) forwards; }
.login.leaving .login-card { animation: zoomAway 0.5s var(--smooth) forwards; }
@keyframes zoomAway { to { transform: scale(1.15); opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.field { position: relative; display: block; margin-bottom: 14px; text-align: left; }
.field input {
  width: 100%; padding: 20px 14px 8px; border-radius: 12px; border: 1px solid var(--stroke-2);
  background: rgba(0, 0, 0, 0.25); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2); }
.field span { position: absolute; left: 15px; top: 15px; color: var(--muted); pointer-events: none; transition: all 0.2s var(--smooth); }
.field input:focus + span, .field input:not(:placeholder-shown) + span { top: 6px; font-size: 11px; color: var(--cyan); }

.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 6px 20px -6px rgba(139, 92, 246, 0.8); position: relative; }
.logo svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 5; }
.logo circle { fill: #fff; stroke: none; animation: pulseDot 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.logo.big { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto; animation: floaty 4s ease-in-out infinite; }
.logo.big svg { width: 46px; height: 46px; }
.logo::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; background: var(--grad); filter: blur(12px); opacity: 0.5; z-index: -1; animation: glow 3s ease-in-out infinite; }
@keyframes pulseDot { 50% { transform: scale(0.6); } }
@keyframes floaty { 50% { transform: translateY(-8px) rotate(-4deg); } }
@keyframes glow { 50% { opacity: 0.9; } }

/* ---------- layout ---------- */
.app {
  position: relative; z-index: 1; height: 100vh; height: 100dvh; padding: 12px; gap: 12px;
  display: grid; grid-template-columns: 236px minmax(0, 1fr) 326px; grid-template-rows: 64px minmax(0, 1fr);
  grid-template-areas: "top top top" "film stage side";
}
.enter { animation: rise 0.8s var(--spring) both; animation-delay: calc(var(--d) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 24px, 0) scale(0.98); } }

.topbar { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 0 12px 0 14px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-by { display: flex; gap: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0; }
.brand-by a, .login-credit a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: color 0.2s, transform 0.3s var(--spring); }
.brand-by a:hover, .login-credit a:hover { color: var(--cyan); transform: translateY(-1px); }
.brand-by svg { width: 12px; height: 12px; }
.login-credit { margin: 10px 0 0 !important; font-size: 12px; color: var(--faint); }
.brand-name { background: linear-gradient(90deg, #fff, #c4b5fd, #67e8f9, #fff); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmerText 8s linear infinite; }
@keyframes shimmerText { to { background-position: 300% 0; } }

.folders { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
.chip {
  display: flex; align-items: center; gap: 9px; min-width: 0; max-width: 260px; padding: 6px 12px 6px 10px; border-radius: 12px;
  border: 1px dashed var(--stroke-2); background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.25s, background 0.25s, transform 0.3s var(--spring);
}
.chip:hover { border-color: var(--violet); background: rgba(139, 92, 246, 0.1); transform: translateY(-1px); }
.chip svg { color: var(--violet); }
.chip.out svg { color: var(--cyan); }
.chip.set { border-style: solid; }
.chip-text { display: flex; flex-direction: column; min-width: 0; text-align: left; line-height: 1.15; }
.chip-text small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); font-weight: 700; }
.chip-text b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.bump { animation: bump 0.6s var(--spring); }
@keyframes bump { 40% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.25); } }
.flow-arrow { width: 36px; height: 12px; color: var(--faint); stroke-dasharray: 4 4; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -8; } }

.modes { position: relative; display: flex; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.modes button { position: relative; z-index: 1; display: flex; align-items: center; gap: 7px; padding: 7px 13px; border: 0; background: none; color: var(--muted); font-weight: 600; border-radius: 10px; transition: color 0.3s; }
.modes button svg { width: 16px; height: 16px; transition: transform 0.4s var(--spring); }
.modes button:hover { color: var(--text); }
.modes button:hover svg { transform: rotate(-12deg) scale(1.15); }
.modes button.on { color: #fff; }
.mode-pill { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 10px; background: var(--grad); box-shadow: 0 6px 22px -6px rgba(139, 92, 246, 0.9); transition: transform 0.5s var(--spring), width 0.5s var(--spring); }

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.progress { display: flex; align-items: center; gap: 8px; padding-right: 6px; }
.progress svg { width: 36px; height: 36px; transform: rotate(-90deg); }
.progress circle { fill: none; stroke-width: 3.5; }
.progress .track { stroke: rgba(255, 255, 255, 0.08); }
.progress .bar { stroke: var(--green); stroke-dasharray: 94.25; stroke-dashoffset: 94.25; transition: stroke-dashoffset 0.9s var(--smooth); filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.7)); }
.progress div { display: flex; flex-direction: column; line-height: 1.1; }
.progress b { font-size: 13px; font-variant-numeric: tabular-nums; }
.progress small { font-size: 11px; color: var(--muted); }

/* ---------- panels ---------- */
.filmstrip, .side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.filmstrip { grid-area: film; padding: 14px 10px 10px; }
.side { grid-area: side; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 4px 10px; }
h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 15px; display: flex; align-items: center; gap: 6px; }
h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: rgba(139, 92, 246, 0.2); color: #c4b5fd; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.count.pop { animation: bump 0.5s var(--spring); }

.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.seg button { border: 0; background: none; padding: 4px 8px; white-space: nowrap; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); transition: all 0.25s var(--smooth); }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; padding: 7px 4px; font-size: 12.5px; }

.search { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 0 4px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); transition: border-color 0.2s; }
.search:focus-within { border-color: var(--violet); }
.search svg { width: 15px; height: 15px; color: var(--faint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 13px; }

.fs-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start; padding: 2px 4px 6px; scroll-behavior: smooth; }
.fs-item {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 2px solid transparent; padding: 0;
  background: rgba(255, 255, 255, 0.04); transition: transform 0.35s var(--spring), border-color 0.25s, box-shadow 0.3s;
  animation: tileIn 0.5s var(--spring) both; animation-delay: calc(var(--i, 0) * 25ms);
}
@keyframes tileIn { from { opacity: 0; transform: scale(0.7) translateY(10px); } }
.fs-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 0.4s, transform 0.5s var(--smooth); }
.fs-item img.loaded { opacity: 1; }
.fs-item:hover { transform: translateY(-2px) scale(1.04); z-index: 1; }
.fs-item:hover img { transform: scale(1.08); }
.fs-item.active { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3), 0 8px 24px -6px rgba(139, 92, 246, 0.8); }
.fs-item .fs-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; font-size: 10.5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: linear-gradient(transparent, rgba(0,0,0,0.85)); }
.fs-item .fs-check { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--green); display: grid; place-items: center; transform: scale(0); transition: transform 0.45s var(--spring); box-shadow: 0 2px 10px rgba(52, 211, 153, 0.6); }
.fs-item .fs-check svg { width: 12px; height: 12px; stroke: #052e1f; stroke-width: 3.5; }
.fs-item.done .fs-check { transform: scale(1); }
.fs-item.done img { filter: saturate(0.5) brightness(0.8); }
.fs-empty { grid-column: 1 / -1; text-align: center; padding: 30px 10px; color: var(--faint); font-size: 13px; }

/* ---------- stage ---------- */
.stage { grid-area: stage; position: relative; overflow: hidden; min-height: 0; background: rgba(8, 8, 16, 0.55); }
.stage::before { /* checkerboard for transparent pixels */
  content: ""; position: absolute; inset: 0; opacity: 0.25; pointer-events: none;
  background: repeating-conic-gradient(rgba(255,255,255,0.03) 0 25%, transparent 0 50%) 0 0 / 22px 22px;
}
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; gap: 6px; }
.empty h2 { margin: 18px 0 2px; font-size: 22px; letter-spacing: -0.02em; }
.empty p { max-width: 360px; margin: 0 0 18px; }
.empty-orb { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.6), rgba(34, 211, 238, 0.15)); box-shadow: 0 0 60px rgba(139, 92, 246, 0.4); animation: floaty 5s ease-in-out infinite; position: relative; }
.empty-orb::before, .empty-orb::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 1px solid rgba(139, 92, 246, 0.35); animation: ring 3s ease-out infinite; }
.empty-orb::after { animation-delay: 1.5s; }
.empty-orb svg { width: 40px; height: 40px; }
@keyframes ring { from { transform: scale(0.8); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.mode-hint, .img-name {
  position: absolute; top: 14px; padding: 6px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(10px);
  font-size: 12.5px; color: var(--muted); pointer-events: none; border: 1px solid var(--stroke); transition: opacity 0.3s, transform 0.4s var(--spring);
}
.mode-hint { left: 14px; max-width: calc(100% - 28px - 220px); }
.mode-hint b { color: var(--text); }
.img-name { right: 14px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 11.5px; }
.mode-hint:empty, .img-name:empty { opacity: 0; transform: translateY(-8px); }
.mode-hint.flash { animation: flashHint 0.6s var(--spring); }
@keyframes flashHint { from { transform: translateY(-10px) scale(0.95); opacity: 0; } }

.stage-bar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px;
  border-radius: 16px; background: rgba(18, 18, 32, 0.78); white-space: nowrap; max-width: calc(100% - 20px); overflow-x: auto;
  animation: barIn 0.9s var(--spring) 0.4s both;
}
@keyframes barIn { from { transform: translate(-50%, 40px); opacity: 0; } }
.stage-bar .sep { width: 1px; height: 22px; background: var(--stroke-2); margin: 0 4px; }
.counter { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.zoom-val { min-width: 54px; border: 0; background: none; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); border-radius: 8px; padding: 6px 4px; }
.zoom-val:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.done-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; margin-left: 4px; border-radius: 9px; background: rgba(52, 211, 153, 0.14); color: var(--green); font-size: 12px; font-weight: 700; animation: popIn 0.5s var(--spring); }
.done-badge svg { width: 14px; height: 14px; stroke-width: 3; }
.stage-bar .btn { margin-left: 4px; }
@keyframes popIn { from { transform: scale(0.4); opacity: 0; } }

.loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; gap: 8px; pointer-events: none; }
.loader i { width: 12px; height: 12px; border-radius: 50%; background: var(--grad); animation: bounce 0.9s var(--spring) infinite; }
.loader i:nth-child(2) { animation-delay: 0.12s; }
.loader i:nth-child(3) { animation-delay: 0.24s; }
@keyframes bounce { 50% { transform: translateY(-16px) scale(0.8); opacity: 0.6; } }

/* ---------- label popup ---------- */
.label-pop {
  position: absolute; z-index: 6; width: 300px; padding: 8px; border-radius: 16px;
  background: rgba(20, 20, 36, 0.88); backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(139, 92, 246, 0.45), 0 0 40px -10px rgba(139, 92, 246, 0.6);
  animation: popUp 0.45s var(--spring);
  transform-origin: top center;
}
.label-pop.above { transform-origin: bottom center; }
.label-pop.leaving { animation: popDown 0.2s ease-in forwards; }
@keyframes popUp { from { opacity: 0; transform: translateY(8px) scale(0.85); } }
@keyframes popDown { to { opacity: 0; transform: scale(0.9); } }
.pop-row { display: flex; align-items: center; gap: 8px; padding: 2px 2px 2px 8px; }
.pop-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 10px currentColor; flex: none; transition: background 0.3s; }
#labelInput { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; font-weight: 600; padding: 8px 0; }
#labelInput::placeholder { color: var(--faint); font-weight: 500; }
.pop-go { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; transition: transform 0.3s var(--spring); }
.pop-go:hover { transform: scale(1.1) rotate(-6deg); }
.suggest { display: flex; flex-direction: column; gap: 2px; max-height: 210px; overflow-y: auto; }
.suggest:not(:empty) { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--stroke); }
.sug { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; border: 0; background: none; text-align: left; font-size: 13px; animation: slideIn 0.3s var(--smooth) both; animation-delay: calc(var(--i) * 30ms); }
.sug i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sug .sug-key { margin-left: auto; }
.sug small { color: var(--faint); }
.sug:hover, .sug.on { background: rgba(139, 92, 246, 0.22); }
.sug mark { background: none; color: var(--cyan); font-weight: 700; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-8px); } }
.pop-hint { font-size: 11px; color: var(--faint); padding: 6px 8px 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.pop-hint kbd { font-size: 10px; min-width: 18px; line-height: 15px; padding: 0 4px; }

/* ---------- side tabs ---------- */
.tabs { position: relative; display: flex; gap: 2px; margin: 10px 10px 0; padding: 4px; border-radius: 13px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.tabs button { position: relative; z-index: 1; flex: 1; border: 0; background: none; padding: 7px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-radius: 9px; transition: color 0.3s; display: flex; align-items: center; justify-content: center; gap: 5px; }
.tabs button.on { color: #fff; }
.tabs .count { height: 16px; min-width: 16px; font-size: 10px; padding: 0 4px; }
.tab-pill { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.11); transition: transform 0.5s var(--spring), width 0.5s var(--spring); }
.tab-panels { position: relative; flex: 1; min-height: 0; }
.tab-panel { position: absolute; inset: 0; overflow-y: auto; padding: 4px 16px 18px; opacity: 0; visibility: hidden; transform: translateX(20px); transition: opacity 0.35s var(--smooth), transform 0.45s var(--smooth), visibility 0s 0.35s; }
.tab-panel.on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.tab-panel.left { transform: translateX(-20px); }
.note { font-size: 12px; color: var(--faint); margin: 14px 0 0; }

.histogram { width: 100%; height: 80px; margin: 14px 0 6px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.sliders { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; font-size: 13px; }
.slider span { color: var(--muted); font-weight: 500; }
.slider output { font: 600 12px var(--mono); color: var(--text); min-width: 38px; text-align: right; transition: color 0.2s, transform 0.3s var(--spring); }
.slider.changed output { color: var(--cyan); }
.slider.active output { transform: scale(1.2); }
.slider input { grid-column: 1 / -1; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 6px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--violet), var(--cyan)) 0 / var(--fill, 50%) 100% no-repeat, rgba(255, 255, 255, 0.08);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.35), 0 4px 10px rgba(0, 0, 0, 0.5); transition: transform 0.25s var(--spring), box-shadow 0.25s;
}
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.35); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.3); box-shadow: 0 0 0 8px rgba(34, 211, 238, 0.25), 0 4px 10px rgba(0, 0, 0, 0.5); }

.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 14px; }
.tog {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: left;
  transition: all 0.3s var(--smooth);
}
.tog svg { width: 16px; height: 16px; transition: transform 0.5s var(--spring); }
.tog .fill { fill: currentColor; stroke: none; }
.tog:hover { color: var(--text); border-color: var(--stroke-2); background: rgba(255, 255, 255, 0.07); }
.tog:hover svg { transform: rotate(-15deg) scale(1.15); }
.tog:active { transform: scale(0.95); }
.tog.on { color: #fff; border-color: rgba(139, 92, 246, 0.6); background: rgba(139, 92, 246, 0.2); box-shadow: 0 0 20px -6px rgba(139, 92, 246, 0.8) inset; }
.tog.spin svg { animation: spin 0.6s var(--spring); }
@keyframes spin { from { transform: rotate(-180deg) scale(0.5); } }

.switch { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { position: relative; width: 36px; height: 21px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); flex: none; transition: background 0.3s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform 0.4s var(--spring), width 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }
.switch:active i::after { width: 19px; }
.switch input:checked + i { background: var(--grad); }
.switch input:checked + i::after { transform: translateX(15px); }
.switch:active input:checked + i::after { transform: translateX(11px); }
.switch span { flex: 1; }

/* labels panel */
.add-label { display: flex; gap: 6px; }
.add-label input, .num-field input {
  flex: 1; min-width: 0; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--stroke-2); background: rgba(0, 0, 0, 0.25); outline: 0; transition: border-color 0.2s, box-shadow 0.2s;
}
.add-label input:focus, .num-field input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }
.add-label .icon-btn { background: var(--grad); color: #fff; }
.presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.preset {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 6px 5px 6px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); font-size: 13px; font-weight: 600;
  animation: popIn 0.4s var(--spring) both; transition: transform 0.3s var(--spring), border-color 0.2s, background 0.2s;
}
.preset:hover { transform: translateY(-2px); border-color: var(--c); }
.preset.active { background: color-mix(in srgb, var(--c) 22%, transparent); border-color: var(--c); box-shadow: 0 0 16px -4px var(--c); }
.preset kbd { background: var(--c); color: #0b0b14; border: 0; min-width: 18px; line-height: 16px; font-size: 10.5px; }
.preset .x { width: 18px; height: 18px; border-radius: 6px; border: 0; background: none; color: var(--faint); display: grid; place-items: center; padding: 0; }
.preset .x:hover { background: rgba(251, 113, 133, 0.2); color: var(--red); }
.preset .x svg { width: 12px; height: 12px; }
.preset.removing { animation: popOut 0.3s ease-in forwards; }
@keyframes popOut { to { transform: scale(0.5); opacity: 0; } }

.label-stats { display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background 0.2s; }
.stat-row:hover { background: rgba(255,255,255,0.05); }
.stat-row b { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.stat-row .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.stat-row .bar i { display: block; height: 100%; width: var(--w); background: var(--c); border-radius: 4px; transform-origin: left; animation: grow 0.9s var(--smooth) both; }
@keyframes grow { from { transform: scaleX(0); } }

.shapes-box { margin-top: 8px; }
.shapes-box h4 { margin-top: 12px; }
.shape-list { display: flex; flex-direction: column; gap: 4px; }
.shape-item { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 10px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.04); font-size: 13px; animation: slideIn 0.35s var(--spring) both; transition: background 0.2s, border-color 0.2s; cursor: pointer; }
.shape-item i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.shape-item small { color: var(--faint); margin-left: auto; }
.shape-item.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.shape-item .x { border: 0; background: none; color: var(--faint); padding: 2px; border-radius: 6px; display: grid; }
.shape-item .x:hover { color: var(--red); }
.shape-item .x svg { width: 14px; height: 14px; }
.shape-list .muted { font-size: 12px; }

/* history */
.hist-head { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0 10px; }
.hist-head p { margin: 0; flex: 1; }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 7px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke); cursor: pointer;
  transition: transform 0.3s var(--spring), background 0.2s, border-color 0.2s, opacity 0.3s;
  animation: histIn 0.5s var(--spring) both;
}
@keyframes histIn { from { opacity: 0; transform: translateY(-14px) scale(0.95); } }
.hist-item:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--stroke-2); transform: translateX(-2px); }
.hist-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 9px; background: rgba(0,0,0,0.3); }
.hist-main { min-width: 0; }
.hist-main .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { padding: 1px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.hist-main small { display: block; color: var(--faint); font-size: 11px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.hist-item .icon-btn:hover { color: var(--red); background: rgba(251, 113, 133, 0.14); transform: rotate(-60deg) scale(1.1); }
.hist-item.removing { animation: removeItem 0.5s var(--smooth) forwards; pointer-events: none; }
@keyframes removeItem { 30% { transform: translateX(-10px); } to { transform: translateX(110%); opacity: 0; height: 0; padding: 0; margin: -4px 0; border-width: 0; } }
.hist-item.flash { animation: histIn 0.5s var(--spring) both, flashBorder 1.6s ease-out; }
@keyframes flashBorder { 0%, 30% { border-color: var(--green); box-shadow: 0 0 20px -4px var(--green); } }

.num-field { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.num-field span { flex: 1; }
.num-field input { flex: 0 0 90px; text-align: right; font-variant-numeric: tabular-nums; }
#qualitySlider { margin-top: 12px; }
#qualitySlider.disabled { opacity: 0.35; pointer-events: none; }
#sizeField.disabled { opacity: 0.35; pointer-events: none; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(4, 4, 10, 0.55); backdrop-filter: blur(6px); animation: fadeIn 0.3s ease both; }
.modal.leaving { animation: fadeOut 0.25s ease forwards; }
.modal.leaving .modal-card { animation: cardOut 0.25s ease-in forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes cardOut { to { transform: scale(0.94) translateY(10px); opacity: 0; } }
.modal-card { width: min(680px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; padding: 18px 20px 20px; background: rgba(20, 20, 34, 0.9); animation: cardIn 0.5s var(--spring) both; }
@keyframes cardIn { from { transform: scale(0.9) translateY(20px); opacity: 0; } }
.modal-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-card h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }

.picker { height: min(620px, calc(100vh - 32px)); position: relative; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); font-size: 13px; }
.crumbs button { border: 0; background: none; padding: 3px 7px; border-radius: 7px; color: var(--muted); }
.crumbs button:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 700; }
.crumbs span { color: var(--faint); }
.dir-list { flex: 1; overflow-y: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 3px; }
.dir {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; border: 1px solid transparent; background: none; text-align: left;
  animation: slideIn 0.35s var(--smooth) both; animation-delay: calc(var(--i) * 22ms); transition: background 0.2s, border-color 0.2s, transform 0.3s var(--spring);
}
.dir:hover { background: rgba(139, 92, 246, 0.12); border-color: rgba(139, 92, 246, 0.35); transform: translateX(4px); }
.dir svg { color: var(--violet); }
.dir.up svg { color: var(--muted); }
.dir span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir small { color: var(--faint); font-size: 12px; }
.dir small.has { color: var(--cyan); }
.dir { cursor: pointer; outline: none; }
.dir:focus-visible { border-color: var(--violet); }
.dir-del {
  display: grid; place-items: center; width: 30px; height: 30px; margin: -4px -6px -4px 0; padding: 0; border: 0; border-radius: 9px;
  background: none; color: var(--faint); opacity: 0; transform: scale(0.7); transition: opacity 0.2s, transform 0.3s var(--spring), background 0.2s, color 0.2s;
}
.dir-del svg { width: 16px; height: 16px; color: inherit; }
.dir:hover .dir-del, .dir:focus-within .dir-del, .dir-del:focus-visible { opacity: 1; transform: none; }
.dir-del:hover { background: rgba(251, 113, 133, 0.18); color: var(--red); transform: scale(1.1) rotate(-8deg); }
.dir.deleting { animation: dirOut 0.42s var(--smooth) forwards; pointer-events: none; }
@keyframes dirOut { 30% { transform: translate3d(-6px, 0, 0); } to { transform: translate3d(60px, 0, 0) scale(0.95); opacity: 0; } }
@media (hover: none) { .dir-del { opacity: 1; transform: none; } }
.dir-empty { text-align: center; color: var(--faint); padding: 40px 0; }

.confirm { width: min(440px, 100%); text-align: center; padding: 26px 24px 20px; }
.confirm h2 { margin: 14px 0 4px; word-break: break-word; }
.confirm p { margin: 6px 0; }
.mono { font-family: var(--mono); }
.warn-text { color: var(--amber); }
.danger-orb { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(251, 113, 133, 0.14); color: var(--red); box-shadow: 0 0 0 8px rgba(251, 113, 133, 0.06); animation: popIn 0.5s var(--spring); }
.danger-orb svg { width: 30px; height: 30px; }
.confirm-field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 4px; text-align: left; font-size: 12.5px; color: var(--muted); }
.confirm-field input { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--stroke-2); background: rgba(0, 0, 0, 0.3); outline: 0; font-family: var(--mono); transition: border-color 0.2s, box-shadow 0.2s; }
.confirm-field input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.2); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn.danger.solid { background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { box-shadow: 0 8px 26px -8px rgba(244, 63, 94, 0.8); }
.modal-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--stroke); }
.footer-left, .footer-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upload-bar { position: relative; height: 30px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); overflow: hidden; margin-bottom: 10px; }
.upload-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--grad); transition: width 0.3s var(--smooth); }
.upload-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent); animation: sweep 1.2s linear infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.upload-bar span { position: relative; display: block; text-align: center; line-height: 30px; font-size: 12.5px; font-weight: 600; }
.drop-hint { position: absolute; inset: 10px; border-radius: var(--radius); border: 2px dashed var(--cyan); background: rgba(34, 211, 238, 0.12); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.drop-hint svg { width: 40px; height: 40px; animation: floaty 1.5s ease-in-out infinite; }
.picker.dragging .drop-hint { opacity: 1; }

.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 6px; }
.export-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--stroke-2); background: rgba(255, 255, 255, 0.03);
  color: inherit; text-decoration: none; cursor: pointer; animation: tileIn 0.45s var(--spring) both; animation-delay: calc(var(--i) * 50ms);
  transition: transform 0.35s var(--spring), border-color 0.2s, background 0.2s, box-shadow 0.3s;
}
.export-card:hover { transform: translateY(-4px); border-color: var(--violet); background: rgba(139, 92, 246, 0.1); box-shadow: 0 14px 30px -12px rgba(139, 92, 246, 0.7); }
.export-card b { font-size: 14.5px; }
.export-card span { font-size: 12px; color: var(--muted); }
.export-card.disabled { opacity: 0.38; pointer-events: none; }

.help { width: min(760px, 100%); overflow-y: auto; }
.help-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-modes div { padding: 12px 14px; border-radius: 13px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke); }
.help-modes p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; margin-top: 16px; font-size: 13px; }
.keys div { display: flex; align-items: center; gap: 4px; padding: 4px 0; border-bottom: 1px dashed var(--stroke); }
.keys span { margin-left: auto; color: var(--muted); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 10px 12px 10px 14px; border-radius: 14px;
  background: rgba(24, 24, 40, 0.92); backdrop-filter: blur(16px); box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--stroke-2);
  font-size: 13px; animation: toastIn 0.5s var(--spring) both; position: relative; overflow: hidden;
}
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--c, var(--violet)); transform-origin: left; animation: toastTimer var(--t, 3.5s) linear forwards; }
@keyframes toastTimer { to { transform: scaleX(0); } }
.toast .ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--violet)) 22%, transparent); color: var(--c, var(--violet)); flex: none; }
.toast .ic svg { width: 14px; height: 14px; stroke-width: 3; }
.toast.ok { --c: var(--green); }
.toast.err { --c: var(--red); }
.toast.warn { --c: var(--amber); }
.toast button { margin-left: 6px; border: 0; background: rgba(255, 255, 255, 0.1); padding: 4px 10px; border-radius: 8px; font-weight: 700; font-size: 12px; }
.toast button:hover { background: rgba(255, 255, 255, 0.2); }
.toast.leaving { animation: toastOut 0.35s ease-in forwards; }
@keyframes toastIn { from { transform: translateX(110%) scale(0.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(110%); opacity: 0; } }

/* flying crop + particles */
.fly, .spark { will-change: transform, opacity; }
.fly { position: fixed; z-index: 70; pointer-events: none; border-radius: 6px; box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 20px 50px rgba(0, 0, 0, 0.6); }
.spark { position: fixed; z-index: 71; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; }
.flash-stage::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--green), inset 0 0 60px rgba(52, 211, 153, 0.25); animation: fadeOut 0.8s ease-out forwards; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .app { grid-template-columns: 200px minmax(0, 1fr) 300px; }
  .modes button span { display: none; }
  .chip { max-width: 180px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto 64vh 180px auto; grid-template-areas: "top" "stage" "film" "side"; padding: 8px; gap: 8px; }
  .topbar { flex-wrap: wrap; padding: 10px; gap: 10px; }
  .flow-arrow, .progress div { display: none; }
  .folders { order: 3; flex-basis: 100%; }
  .chip { flex: 1; max-width: none; }
  .fs-list { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .side { min-height: 520px; }
  .help-modes, .keys { grid-template-columns: 1fr; }
  .mode-hint { max-width: calc(100% - 28px); }
  .img-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
