*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --page-bg: #8b8b8b;
  --page-bg-light: #d7d7d2;
  --page-bg-dark: #3c3c3c;
  --canvas-bg: #0a0a0a;
  --canvas-bg-image: none;
  --bg: #0a0a0a;
  --frame-bg: #0a0a0a;
  --fg: #f5f5f0;
  --muted: rgba(245, 245, 240, 0.45);
  --accent: #e8e4dc;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --btn-radius: 4px;
  --btn-radius-sm: 3px;
  --surface-radius: 5px;
  --sidebar-toggle-width: 1.65rem;
  --sidebar-toggle-width-hover: 2.35rem;
  --sidebar-toggle-height: 2.35rem;
  --sidebar-toggle-icon-size: 1.12rem;
  --sidebar-toggle-radius: 10px;
  --duration: 1s;
  --img-border: rgba(255, 255, 255, 0.92);
  --img-outline-width: 2px;
  --img-radius: 3px;
  --img-fit: cover;
  --wrap-perspective-default: 1200px;
  --global-img-brightness: 1;
  --canvas-width: 1280px;
  --canvas-height: 720px;
  --canvas-aspect-w: 16;
  --canvas-aspect-h: 9;
  --image-sidebar-width: 360px;
  --control-panel-width: 292px;
  --animation-timeline-left: calc(50vw - 380px);
  --animation-timeline-top: calc(100vh - 300px);
  --animation-timeline-width: 760px;
  --animation-timeline-height: 244px;
  --animation-timeline-collapsed-height: 34px;
  --font-picker-width: 300px;
  --control-group-indent: 0.62rem;
  --slide-strip-width: 118px;
  --safe-top: 0px;
  --safe-right: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
  --img-placeholder: #3d3d3d;
  --img-shadow-angle: 135deg;
  --img-shadow-distance: 24px;
  --img-shadow-color: #000000;
  --img-shadow: 0 18px 22px rgba(0, 0, 0, 0.34);
  --img-shadow-hover: 0 20px 26px rgba(0, 0, 0, 0.38);
  --img-drop-shadow: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.34));
  --img-drop-shadow-hover: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.38));
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: var(--page-bg-dark);
  }
}

body.page-bg-light {
  --page-bg: var(--page-bg-light);
}

body.page-bg-dark {
  --page-bg: var(--page-bg-dark);
}

html, body {
  height: 100%;
  overflow: hidden;
  background-color: var(--page-bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 5.2rem 2.2rem 5rem;
  transition: padding 0.32s var(--ease-out);
}

/* ── Top bar ── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.5rem;
  pointer-events: none;
}

.logo {
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-weight: 500;
}

.counter {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  line-height: 1;
  letter-spacing: 0.08em;
  padding: 0.35rem 0;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.top-theme-btn,
.top-cache-info-btn,
.top-reset-cache-btn {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.top-theme-btn:hover,
.top-cache-info-btn:hover,
.top-reset-cache-btn:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.08);
}

.top-theme-btn .icon,
.top-cache-info-btn .icon,
.top-reset-cache-btn .icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-theme-btn .icon-theme-light,
.top-theme-btn .icon-theme-dark {
  display: none;
}

.top-theme-btn[data-theme="light"] .icon-theme-system,
.top-theme-btn[data-theme="light"] .icon-theme-dark {
  display: none;
}

.top-theme-btn[data-theme="light"] .icon-theme-light {
  display: block;
}

.top-theme-btn[data-theme="dark"] .icon-theme-system,
.top-theme-btn[data-theme="dark"] .icon-theme-light {
  display: none;
}

.top-theme-btn[data-theme="dark"] .icon-theme-dark {
  display: block;
}

.stage-fullscreen-btn .icon-exit-fullscreen {
  display: none;
}

.stage-fullscreen-btn[aria-pressed="true"] .icon-enter-fullscreen {
  display: none;
}

.stage-fullscreen-btn[aria-pressed="true"] .icon-exit-fullscreen {
  display: block;
}

#current {
  color: var(--fg);
  font-weight: 500;
}

/* ── Stage ── */
.showcase {
  position: relative;
  width: min(var(--canvas-width), calc(var(--canvas-height) * var(--canvas-aspect-w) / var(--canvas-aspect-h)), calc(100vw - 4.4rem), calc((100vh - 12rem) * var(--canvas-aspect-w) / var(--canvas-aspect-h)));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  overflow: visible;
  transition: width 0.32s var(--ease-out);
}

.showcase-stage-wrap {
  position: relative;
  width: 100%;
  overflow: visible;
}

.showcase-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin-top: -0.35rem;
}

.showcase-toolbar {
  position: relative;
  z-index: 210;
  width: 100%;
  margin-bottom: 0;
  overflow: visible;
}

.showcase-toolbar-row,
.showcase-footer-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.showcase-toolbar-strip,
.showcase-footer-strip-spacer {
  flex: 0 0 var(--slide-strip-width);
  width: var(--slide-strip-width);
}

.showcase-toolbar-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
}

.showcase-toolbar-canvas,
.showcase-toolbar-strip {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.showcase-toolbar-shapes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  box-sizing: border-box;
  width: calc(100% - (var(--slide-strip-width) + 0.85rem));
  margin-left: calc(var(--slide-strip-width) + 0.85rem);
  padding: 0.28rem 0.55rem 0px;
  border-bottom: none;
}

.showcase-toolbar-shapes .showcase-toolbar-btn {
  position: relative;
  width: 1.85rem;
  min-width: 1.85rem;
  height: 1.65rem;
  padding: 0;
}

.showcase-toolbar-shapes .showcase-toolbar-btn[aria-label]::after {
  content: attr(aria-label);
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.28rem 0.5rem;
  border-radius: 0.4rem;
  background: rgba(20, 20, 24, 0.96);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 60;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.showcase-toolbar-shapes .showcase-toolbar-btn[aria-label]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.showcase-toolbar-shapes .showcase-toolbar-btn .icon {
  width: 1rem;
  height: 1rem;
}

.showcase-toolbar-shapes .showcase-toolbar-btn.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--fg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

body.shape-draw-mode .slide.active .slide-inner {
  cursor: crosshair;
}

body.shape-draw-mode .slide.active .slide-inner > .img-wrap:not(.position-dragging) {
  pointer-events: none;
}

body.shape-draw-mode .slide.active .slide-inner > .group-selection-frame {
  pointer-events: none;
}

.shape-rubber-band {
  position: absolute;
  z-index: 120;
  pointer-events: none;
  border: 1.5px solid rgba(140, 190, 255, 0.95);
  background: rgba(120, 170, 255, 0.32);
  border-radius: 2px;
  box-sizing: border-box;
}

.shape-rubber-band[data-kind="rect"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(180, 220, 255, 0.95);
}

.shape-rubber-band[data-kind="ellipse"] {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(180, 220, 255, 0.95);
  border-radius: 50%;
}

.shape-rubber-band[data-kind="text"] {
  background: rgba(255, 255, 255, 0.08);
  border-style: dashed;
  border-color: rgba(200, 220, 255, 0.85);
}

.shape-rubber-band[data-kind="line"] {
  background: transparent;
  border-style: solid;
  border-width: 0 0 2px;
  border-color: rgba(120, 180, 255, 0.95);
  height: 0 !important;
}

body.shape-pen-mode .slide.active .slide-inner,
body.shape-anchor-mode .slide.active .slide-inner {
  cursor: crosshair;
}

body.shape-pen-mode .slide.active .slide-inner > .img-wrap:not(.position-dragging),
body.shape-anchor-mode .slide.active .slide-inner > .img-wrap:not(.position-dragging) {
  pointer-events: none;
}

body.shape-path-edit-mode .slide.active .slide-inner > .img-wrap:not(.position-dragging) {
  pointer-events: none;
}

body.shape-path-edit-mode .path-edit-overlay {
  pointer-events: auto;
}

.path-pen-preview {
  position: absolute;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  overflow: visible;
}

.path-pen-preview .path-pen-control-line {
  stroke: rgba(150, 200, 255, 0.9);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.path-pen-preview .path-pen-handle {
  fill: #ffffff;
  stroke: rgba(80, 150, 255, 0.95);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.path-pen-preview .path-pen-anchor {
  fill: #ffffff;
  stroke: rgba(80, 150, 255, 0.95);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

body.shape-pen-mode .img-wrap.shape-draft[data-shape-kind="path"] {
  pointer-events: none;
}

body.shape-pen-mode .img-wrap.shape-draft.selected:not(.position-dragging) .img-selection-frame {
  display: none;
}

body.shape-pen-mode .img-wrap.shape-draft[data-shape-kind="path"].shape-placeholder .img-stack::after,
body.shape-pen-mode .img-wrap.shape-draft[data-shape-kind="path"].image-missing .img-stack::after {
  display: none !important;
}

body.shape-draw-mode .img-wrap.pen-empty-slot-hidden,
body.shape-draw-mode .img-wrap.shape-placeholder.image-missing:not(.shape-draft):not(.shape-item),
body.shape-pen-mode .img-wrap.pen-empty-slot-hidden,
body.shape-pen-mode .img-wrap.shape-placeholder.image-missing:not(.shape-draft):not(.shape-item) {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.shape-draw-mode .img-wrap.pen-empty-slot-hidden .img-selection-frame,
body.shape-draw-mode .img-wrap.shape-placeholder.image-missing .img-selection-frame,
body.shape-pen-mode .img-wrap.pen-empty-slot-hidden .img-selection-frame,
body.shape-pen-mode .img-wrap.shape-placeholder.image-missing .img-selection-frame {
  display: none !important;
}

.path-edit-overlay {
  position: absolute;
  inset: 0;
  z-index: 145;
  pointer-events: none;
  overflow: visible;
}

.path-edit-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.path-edit-guide {
  fill: none;
  stroke: rgba(120, 180, 255, 0.45);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.path-edit-control-line {
  stroke: rgba(150, 200, 255, 0.75);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.path-edit-anchor {
  fill: #ffffff;
  stroke: rgba(60, 130, 255, 0.98);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: move;
}

.path-edit-anchor.is-selected {
  fill: rgba(60, 130, 255, 0.95);
  stroke: #ffffff;
}

.path-edit-handle {
  fill: rgba(140, 190, 255, 0.95);
  stroke: #ffffff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
  cursor: grab;
}

.slide[data-shapes-enabled="1"] .slide-inner {
  /* 形状与图片共用绝对定位编辑层 */
}

.shape-wrap {
  position: absolute;
  left: calc(var(--drag-xr, 0) * 100%);
  top: calc(var(--drag-yr, 0) * 100%);
  width: calc(var(--wrap-wr, 0.08) * 100%);
  height: calc(var(--wrap-hr, 0.08) * 100%);
  z-index: var(--order, 12);
  transform:
    perspective(900px)
    scale(var(--user-scale, 1))
    rotateY(var(--perspective-rotate-y, 0deg))
    rotateX(var(--perspective-rotate-x, 0deg))
    rotateZ(var(--user-rotate, 0deg));
  transform-origin: center center;
  pointer-events: auto;
  touch-action: none;
}

.shape-wrap .shape-canvas {
  width: 100%;
  height: 100%;
  min-height: 100%;
  pointer-events: auto;
}

.shape-wrap .shape-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.img-wrap.shape-item .img-stack .img-fill,
.img-wrap.shape-item .img-stack img {
  display: none !important;
}

.img-wrap[data-is-svg-embedded="1"] .img-stack .img-fill,
.img-wrap[data-is-svg-embedded="1"] .img-stack img {
  display: none !important;
}

.img-wrap .svg-embed-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100%;
  pointer-events: auto;
}

.img-wrap .svg-embed-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.img-wrap.shape-item .img-stack {
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
}

.img-wrap:not(.shape-item)[data-outline-align="outer"] .img-stack {
  border: none;
  outline: calc(var(--img-outline-width) / var(--user-scale, 1)) solid var(--img-border);
  outline-offset: 0;
  box-shadow: none;
}

.img-wrap:not(.shape-item)[data-outline-align="inner"] .img-stack {
  border: none;
  outline: none;
  box-shadow: inset 0 0 0 calc(var(--img-outline-width) / var(--user-scale, 1)) var(--img-border);
}

.img-wrap:not(.shape-item)[data-outline-align="center"] .img-stack,
.img-wrap:not(.shape-item):not([data-outline-align]) .img-stack {
  outline: none;
  box-shadow: none;
}

.img-wrap.style-off-outline:not(.shape-item) .img-stack {
  border-width: 0;
  border-color: transparent;
  outline: none;
  box-shadow: none;
}

.canvas-marquee-rect {
  position: absolute;
  z-index: 120;
  border: 1px solid rgba(120, 200, 255, 0.95);
  background: rgba(120, 200, 255, 0.1);
  pointer-events: none;
  box-sizing: border-box;
}

/* CAD 交叉选择（从右往左）：绿色虚线框 */
.canvas-marquee-rect.is-crossing {
  border-style: dashed;
  border-color: rgba(120, 235, 150, 0.95);
  background: rgba(120, 235, 150, 0.12);
}

.app,
.stage-frame,
.stage,
.slide,
.slide-inner,
.showcase-toolbar,
.top-bar {
  user-select: none;
  -webkit-user-select: none;
}

.app ::selection {
  background: transparent;
  color: inherit;
}

.shape-text,
.shape-text * {
  user-select: text;
  -webkit-user-select: text;
}

.shape-text ::selection,
.shape-text *::selection {
  background: rgba(120, 200, 255, 0.35);
  color: inherit;
}

input,
textarea,
select,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

.outline-align-options {
  gap: 0.18rem;
  justify-content: flex-end;
}

.outline-align-option {
  gap: 0;
  min-width: 1.55rem;
  min-height: 1.55rem;
  justify-content: center;
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.62);
}

.outline-align-option:hover,
.outline-align-option:has(.fit-check-input:checked) {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.outline-align-option .fit-check-box {
  display: none;
}

.outline-align-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  stroke: currentColor;
  flex-shrink: 0;
}

.img-wrap.shape-item .shape-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100%;
  pointer-events: auto;
}

.img-wrap.shape-item .shape-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.img-wrap.shape-item .shape-text,
.shape-wrap.shape-item .shape-text {
  width: 100%;
  min-height: 100%;
  padding: 0.35rem 0.5rem;
  box-sizing: border-box;
  outline: none;
  color: var(--shape-text-color, rgba(255, 255, 255, 0.92));
  caret-color: rgba(120, 200, 255, 0.95);
  font-family: var(--shape-font-family, var(--font, inherit));
  font-size: var(--shape-font-size, clamp(14px, 2.2vw, 28px));
  font-weight: var(--shape-font-weight, 500);
  font-style: var(--shape-font-style, normal);
  text-decoration: var(--shape-text-decoration, none);
  line-height: var(--shape-line-height, 1.35);
  letter-spacing: var(--shape-letter-spacing, 0px);
  text-align: var(--shape-text-align, left);
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  user-select: text;
}

.img-wrap.shape-item .shape-text:focus,
.img-wrap.shape-item.is-text-editing .shape-text,
.shape-wrap.shape-item .shape-text:focus,
.shape-wrap.shape-item.is-text-editing .shape-text {
  outline: none;
}

.shape-canvas.shape-text-point .shape-text {
  min-height: auto;
  white-space: pre;
  text-align: var(--shape-text-align, left);
}

.shape-canvas.shape-text-area .shape-text {
  overflow: hidden;
  height: 100%;
}

/* 点状文本：宽高随文字自适应（从左上角锚点向外扩展） */
.shape-wrap[data-shape-kind="text"][data-text-mode="point"] {
  width: max-content;
  height: max-content;
  min-width: 1ch;
}

.shape-wrap[data-shape-kind="text"][data-text-mode="point"] .shape-canvas,
.shape-wrap[data-shape-kind="text"][data-text-mode="point"] .shape-text {
  width: max-content;
  min-height: auto;
  height: auto;
}

/* 点状文本编辑中只显示光标，不显示 8 点选择框 */
body.position-edit-mode .shape-wrap[data-text-mode="point"].is-text-editing .img-selection-frame {
  opacity: 0 !important;
  pointer-events: none !important;
}
.shape-radius-handle {
  position: absolute;
  z-index: 14;
  width: calc(11px / var(--user-scale, 1));
  height: calc(11px / var(--user-scale, 1));
  margin: calc(-5.5px / var(--user-scale, 1)) 0 0 calc(-5.5px / var(--user-scale, 1));
  border: calc(1px / var(--user-scale, 1)) solid rgba(0, 148, 255, 0.98);
  background: #fff;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  cursor: nwse-resize;
  touch-action: none;
  transition: opacity 0.16s var(--ease-out);
}

body.position-edit-mode .shape-wrap[data-shape-kind="rect"].selected:not(.is-text-editing) .shape-radius-handle {
  opacity: 1;
  pointer-events: auto;
}

body.position-edit-mode .shape-wrap[data-shape-kind="rect"].is-group-selected-member .shape-radius-handle {
  opacity: 0;
  pointer-events: none;
}

.control-card[data-preview-group="font"].is-disabled,
.control-card[data-preview-group="shapeFill"].is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.control-field-text-color {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.text-color-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.text-color-swatch {
  width: 1.75rem;
  height: 1.4rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.35rem;
  background: none;
  cursor: pointer;
}

.text-color-swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.text-color-swatch::-webkit-color-swatch { border: none; border-radius: 0.2rem; }

.text-color-reset {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.text-color-reset:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.style-off-shapeFill .shape-canvas svg [fill]:not([fill="none"]) {
  opacity: 0.15;
}

/* 形状模糊：backdrop-filter 必须在没有 filter 的层上，img-stack 的 drop-shadow 会阻断模糊 */
.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .img-stack {
  overflow: hidden;
  border-radius: var(--img-radius);
  filter: none !important;
  background: transparent;
}

.img-wrap.shape-item[data-shape-kind="ellipse"].has-shape-blur:not(.style-off-shapeBlur) .img-stack {
  border-radius: 50%;
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .img-stack::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  backdrop-filter: blur(var(--shape-backdrop-blur, 12px));
  -webkit-backdrop-filter: blur(var(--shape-backdrop-blur, 12px));
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .shape-canvas {
  position: relative;
  z-index: 1;
  background: transparent;
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .shape-canvas svg,
.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .shape-canvas .shape-text {
  position: relative;
  z-index: 1;
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur):not(.style-off-shadow) .shape-canvas svg {
  filter: var(--img-drop-shadow, none);
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur) .shape-canvas svg [fill]:not([fill="none"]) {
  fill-opacity: 0.35;
}

.img-wrap.style-off-shapeBlur.has-shape-blur .img-stack::before {
  display: none;
}

.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur):hover .img-stack,
.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur).position-dragging .img-stack,
.img-wrap.shape-item.has-shape-blur:not(.style-off-shapeBlur).resizing .img-stack {
  filter: none !important;
}

.control-card[data-preview-group="shapeBlur"].is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.img-wrap.style-off-font .shape-text,
.shape-wrap.style-off-font .shape-text {
  opacity: 0.2;
}

.img-wrap.has-explicit-bbox {
  width: calc(var(--wrap-wr, 0.2) * var(--slide-w));
  height: calc(var(--wrap-hr, 0.2) * var(--slide-h));
  aspect-ratio: unset;
  scale: 1;
}

.img-wrap.instant-layout,
.img-wrap.wheel-scaling {
  transition: none !important;
}

.img-wrap.instant-layout .img-stack,
.img-wrap.wheel-scaling .img-stack {
  transition: none !important;
}

.img-wrap.has-explicit-bbox .img-stack {
  width: 100%;
  height: 100%;
  min-height: 100%;
  aspect-ratio: unset;
}

.img-wrap.shape-item .img-stack {
  background: transparent;
}

.img-wrap.shape-item .ghost {
  background-color: transparent;
}

.img-wrap.shape-item[data-shape-kind="text"].selected .img-stack,
.img-wrap.shape-item[data-shape-kind="text"].is-text-editing .img-stack {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(160, 200, 255, 0.45);
}

.shape-wrap.shape-item[data-shape-kind="text"].selected,
.shape-wrap.shape-item[data-shape-kind="text"].is-text-editing,
.img-wrap.shape-item[data-shape-kind="text"].selected,
.img-wrap.shape-item[data-shape-kind="text"].is-text-editing {
  box-shadow: inset 0 0 0 1px rgba(160, 200, 255, 0.45);
}

/* 文本框：编辑时隐藏选择框；未编辑时选择框不挡内部文字点击 */
body.position-edit-mode .shape-wrap[data-shape-kind="text"].is-text-editing .img-selection-frame,
body.position-edit-mode .img-wrap[data-shape-kind="text"].is-text-editing .img-selection-frame {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 编辑中若悬停到边缘，允许显示选择框与8点，便于结束编辑并调整 */
body.position-edit-mode .shape-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .img-selection-frame,
body.position-edit-mode .img-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .img-selection-frame {
  opacity: 1 !important;
  pointer-events: none !important;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected:not(.is-text-editing) .img-selection-frame,
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected:not(.is-text-editing) .img-selection-frame {
  opacity: 1 !important;
  pointer-events: none;
}

/* 文本框：默认不显示 8 点，悬停蓝线时才显示 8 点并进入可移动调整态 */
body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected:not(.is-text-editing) .img-selection-handle,
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected:not(.is-text-editing) .img-selection-handle {
  opacity: 0;
  pointer-events: none;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing) .img-selection-handle,
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing) .img-selection-handle,
body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected.resizing:not(.is-text-editing) .img-selection-handle,
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected.resizing:not(.is-text-editing) .img-selection-handle {
  opacity: 1;
  pointer-events: auto;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .img-selection-handle,
body.position-edit-mode .img-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .img-selection-handle {
  opacity: 1;
  pointer-events: auto;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing),
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing) {
  cursor: move;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot,
body.position-edit-mode .img-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot {
  cursor: move;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing) .shape-text,
body.position-edit-mode .img-wrap[data-shape-kind="text"].selected.text-edge-hot:not(.is-text-editing) .shape-text {
  cursor: move;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .shape-text,
body.position-edit-mode .img-wrap[data-shape-kind="text"].is-text-editing.text-edge-hot .shape-text {
  cursor: move;
}

body.position-edit-mode .shape-wrap[data-shape-kind="text"] .shape-text,
body.position-edit-mode .img-wrap[data-shape-kind="text"] .shape-text {
  cursor: text;
}

/* 选择工具状态：文本框默认可移动 */
body.position-edit-mode:not(.shape-draw-mode) .shape-wrap[data-shape-kind="text"]:not(.is-text-editing) .shape-text,
body.position-edit-mode:not(.shape-draw-mode) .img-wrap[data-shape-kind="text"]:not(.is-text-editing) .shape-text {
  cursor: move;
}

.img-wrap.has-explicit-bbox.shape-item .shape-canvas {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

.img-wrap.has-explicit-bbox.shape-item .shape-canvas svg {
  overflow: hidden;
}

.img-wrap.shape-item .shape-text:empty::before,
.shape-wrap.shape-item .shape-text:empty::before {
  content: '文本';
  color: rgba(255, 255, 255, 0.35);
}

.showcase-toolbar-canvas,
.showcase-footer-canvas {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.showcase-toolbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  width: 100%;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.showcase-toolbar-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.9rem;
  margin-top: 0.22rem;
  padding: 0.18rem 0.5rem 0.08rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.showcase-toolbar-secondary-main {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.showcase-toolbar-secondary .showcase-align-distribute-control {
  padding-left: 0;
  padding-right: 0;
}

.showcase-toolbar-secondary-toggle {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}

.showcase-toolbar-secondary-toggle .icon-expand {
  display: none;
}

.showcase-toolbar-secondary.is-collapsed {
  min-height: 1.5rem;
  padding-top: 0.08rem;
  padding-bottom: 0.04rem;
}

.showcase-toolbar-secondary.is-collapsed .showcase-toolbar-secondary-main {
  display: none;
}

.showcase-toolbar-secondary.is-collapsed .showcase-toolbar-secondary-toggle .icon-collapse {
  display: none;
}

.showcase-toolbar-secondary.is-collapsed .showcase-toolbar-secondary-toggle .icon-expand {
  display: block;
}

.showcase-toolbar-start,
.showcase-toolbar-end {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  z-index: 2;
  position: relative;
}

/* ── Footer 放大镜控件 ── */
.showcase-footer-loupe {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  justify-self: end;
  padding-left: 0.5rem;
  flex-shrink: 0;
}

.footer-loupe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: none;
  border-radius: 0.28rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.footer-loupe-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
}

.footer-loupe-btn[aria-pressed="true"] {
  color: rgba(120, 200, 255, 1);
  background: rgba(120, 200, 255, 0.15);
}

.footer-loupe-btn .icon {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-loupe-zoom-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

#toolbarLoupeZoom {
  width: 4.8rem;
  height: 0.22rem;
  accent-color: rgba(120, 200, 255, 0.9);
  cursor: pointer;
}

.footer-loupe-zoom-val {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.55);
  min-width: 2rem;
  white-space: nowrap;
}

/* ── 放大镜悬浮层 ── */
body.loupe-active .stage-frame,
body.loupe-active .slide,
body.loupe-active .slide-inner {
  cursor: crosshair;
}

/* 放大镜圆形外框 */
.loupe-wrap {
  position: absolute;
  z-index: 9100;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  border: 2px solid rgba(120, 200, 255, 0.92);
  box-shadow: 0 6px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.35);
  background: #0a0a0a;
}

.loupe-wrap[hidden] {
  display: none;
}

/* 放大镜内容容器（承载缩放变换） */
.loupe-inner {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  pointer-events: none;
  transform-origin: 0 0;
}

/* 克隆的幻灯片内容 */
.loupe-slide-clone {
  pointer-events: none !important;
  user-select: none !important;
}

/* 准星标记 */
.loupe-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 1px solid rgba(120, 200, 255, 0.7);
  border-radius: 50%;
  pointer-events: none;
}

/* 移除之前加的 loupe-overlay / loupe-canvas 元素（不再使用） */
.loupe-overlay {
  display: none;
}

.showcase-toolbar-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: auto;
}

.showcase-align-distribute-control {
  gap: 0.2rem;
  padding: 0 0.35rem;
}

.showcase-align-distribute-control .showcase-toolbar-btn {
  width: 1.35rem;
  height: 1.35rem;
}

.showcase-toolbar-playback {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  pointer-events: auto;
}

.stage-playback-rail-export {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  pointer-events: auto;
}

.stage-playback-rail-export .showcase-export-expand-btn {
  align-self: flex-end;
}

.showcase-export-control {
  gap: 0.55rem;
  padding-left: 0.35rem;
  padding-right: 0.15rem;
  align-items: center;
}

.showcase-export-control > .showcase-toolbar-label {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.showcase-export-control > .showcase-toolbar-check {
  display: inline-flex;
  align-items: center;
  height: 0.92rem;
}

.showcase-export-control:not(:has(input:checked)) > .showcase-toolbar-label {
  color: rgba(255, 255, 255, 0.38);
  transition: color 0.18s var(--ease-out);
}

.showcase-export-control:has(input:checked) > .showcase-toolbar-label {
  color: rgba(255, 255, 255, 0.92);
  transition: color 0.18s var(--ease-out);
}

.showcase-export-control:hover:not(:has(input:checked)) > .showcase-toolbar-label {
  color: rgba(255, 255, 255, 0.55);
}

.showcase-export-control:has(input:checked):hover > .showcase-toolbar-label {
  color: #fff;
}

.showcase-toolbar-check {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  user-select: none;
}

.showcase-toolbar-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 0.92rem;
  height: 0.92rem;
  margin: 0;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0.22rem;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: border-color 0.18s var(--ease-out);
}

.showcase-toolbar-check input[type="checkbox"]::before {
  content: '';
  width: 0.44rem;
  height: 0.24rem;
  border: 2px solid transparent;
  border-left-color: rgba(255, 255, 255, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.9);
  transform: rotate(-45deg) scale(0);
  transform-origin: center;
  margin-top: -0.06rem;
  transition: transform 0.14s var(--ease-out);
}

.showcase-toolbar-check input[type="checkbox"]:checked {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.showcase-toolbar-check input[type="checkbox"]:checked::before {
  transform: rotate(-45deg) scale(1);
}

.showcase-toolbar-check input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.showcase-toolbar-btn-text {
  width: auto;
  min-width: 0;
  height: 1.85rem;
  padding: 0 0.55rem 0 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: calc(var(--btn-radius) + 2px);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.82);
}

.showcase-toolbar-btn-text .icon {
  width: 0.92rem;
  height: 0.92rem;
}

.showcase-toolbar-btn-text:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.96);
}

.showcase-toolbar-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.showcase-image-layer-control {
  padding-right: 0;
}

.showcase-toolbar-group {
  display: inline-flex;
  align-items: center;
  column-gap: 0.38rem;
  min-width: 0;
  padding: 0 0.5rem;
}

.showcase-toolbar-group:first-child {
  padding-left: 0;
}

.showcase-toolbar-group:last-child {
  padding-right: 0;
}

.showcase-toolbar-divider {
  flex-shrink: 0;
  width: 1px;
  height: 1.35rem;
  background: rgba(255, 255, 255, 0.14);
}

.showcase-image-count-control {
  padding-left: 0;
  gap: 0.55rem;
}

.showcase-toolbar-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
  padding: 0;
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.55);
}

.showcase-toolbar-counter-sep {
  flex-shrink: 0;
  opacity: 0.72;
}

.showcase-toolbar-counter #current {
  color: var(--fg);
  font-weight: 500;
}

.showcase-toolbar-label {
  flex-shrink: 0;
  margin-right: -0.18rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.04em;
}

.showcase-toolbar-value {
  min-width: 2.35rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.showcase-toolbar-btn {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transform-origin: center center;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.showcase-toolbar-btn .icon {
  width: 0.82rem;
  height: 0.82rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.showcase-toolbar-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  transform: scale(1.12);
}

.showcase-toolbar-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.showcase-toolbar-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.showcase-toolbar-btn:disabled:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  transform: none;
}

.showcase-toolbar-btn-danger:hover:not(:disabled) {
  background: rgba(255, 96, 96, 0.14);
  color: rgba(255, 170, 170, 0.95);
}

.showcase-bg-control {
  position: relative;
}

/* 工具栏快捷字体下拉 */
.showcase-font-quick {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.showcase-font-quick-control {
  position: relative;
}

.showcase-font-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  width: auto;
  min-width: 6rem;
  max-width: 9rem;
  padding: 0 0.5rem;
  justify-content: space-between;
}

.showcase-font-quick-btn:hover:not(:disabled),
.showcase-font-quick-btn:active:not(:disabled) {
  transform: none;
}

.showcase-font-quick-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.92);
}

.showcase-font-quick-caret {
  flex: none;
  width: 0.74rem;
  height: 0.74rem;
  opacity: 0.7;
}

.showcase-font-quick-menu {
  position: absolute;
  top: calc(100% + 0.36rem);
  left: 0;
  z-index: 340;
  min-width: 14rem;
  min-height: 16rem;
  max-height: 22rem;
  overflow-y: auto;
  padding: 0.42rem 0.36rem 0.36rem;
  border-radius: 0.6rem;
  background: rgba(20, 20, 22, 0.97);
  border: 1px solid rgba(140, 200, 255, 0.28);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.showcase-font-quick-menu::-webkit-scrollbar {
  width: 8px;
}

.showcase-font-quick-menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.showcase-font-quick-menu::-webkit-scrollbar-thumb {
  background: rgba(140, 200, 255, 0.42);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.showcase-font-quick-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 200, 255, 0.62);
}

.showcase-font-quick-search {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 0.32rem;
  margin-bottom: 0.14rem;
  background: rgba(20, 20, 22, 0.97);
}

.showcase-font-quick-search-input {
  width: 100%;
  height: 1.7rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.42rem;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.76rem;
  padding: 0 0.55rem;
}

.showcase-font-quick-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.showcase-font-quick-search-input:focus {
  outline: none;
  border-color: rgba(120, 200, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(120, 200, 255, 0.35) inset;
}

.showcase-font-quick-menu[hidden] {
  display: none;
}

.showcase-font-quick-item,
.showcase-font-quick-more {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: none;
  border-radius: 0.42rem;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.8rem;
  line-height: 1.45;
  min-height: 2rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.showcase-font-quick-item:hover,
.showcase-font-quick-more:hover {
  background: rgba(255, 255, 255, 0.1);
}

.showcase-font-quick-item.active {
  background: rgba(120, 200, 255, 0.2);
  color: #fff;
}

.showcase-font-quick-more {
  margin-top: 0.16rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  color: rgba(140, 200, 255, 0.95);
  font-weight: 600;
}

.showcase-font-quick-empty {
  padding: 0.4rem 0.55rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.76rem;
}

.showcase-font-quick-size {
  height: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.32rem;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.7rem;
  outline: none;
}

.showcase-font-quick-size-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.showcase-font-quick-size {
  width: 3rem;
  text-align: center;
  padding: 0 1rem 0 0.25rem;
  font-variant-numeric: tabular-nums;
}

.showcase-font-quick-size-unit {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.52);
  pointer-events: none;
}

.showcase-font-quick-color {
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.3rem;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.showcase-font-quick-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.showcase-font-quick-color::-webkit-color-swatch {
  border: none;
  border-radius: 0.22rem;
}

.showcase-bg-drop-hint {
  position: absolute;
  bottom: calc(100% + 0.32rem);
  left: 50%;
  z-index: 320;
  transform: translateX(-50%);
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.94);
  border: 1px solid rgba(140, 200, 255, 0.42);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.66rem;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.showcase-bg-drop-hint[hidden] {
  display: none;
}

.showcase-bg-control.is-drag-over {
  box-shadow: inset 0 0 0 1px rgba(140, 200, 255, 0.45);
  border-radius: var(--btn-radius);
}

.stage-frame.is-image-drop-target {
  box-shadow: inset 0 0 0 2px rgba(140, 200, 255, 0.38);
}

.showcase-bg-control .showcase-toolbar-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.12);
}

.showcase-bg-swatch {
  display: block;
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: var(--canvas-bg);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.showcase-bg-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 10.5rem;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--surface-radius);
  background: rgba(18, 18, 18, 0.94);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}

.showcase-bg-popover[hidden] {
  display: none;
}

.showcase-bg-slide-thumbs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.32rem;
}

.showcase-bg-slide-thumbs[hidden] {
  display: none;
}

.showcase-bg-preview-item {
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.showcase-bg-preview-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.showcase-bg-popover-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.62);
}

.showcase-bg-popover-field input[type="color"] {
  width: 2rem;
  height: 1.65rem;
  padding: 0.1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.showcase-bg-popover-btn {
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.showcase-bg-popover-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

.showcase-bg-popover-btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
}

.showcase-bg-popover-actions-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.showcase-bg-popover-actions-row .showcase-bg-popover-btn:not(.showcase-bg-popover-btn-icon) {
  flex: 1;
  min-width: 0;
}

.showcase-bg-popover-btn-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  min-height: 2rem;
  padding: 0;
}

.showcase-bg-popover-btn-icon .icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.showcase-footer-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 0.75rem;
}

.showcase-footer-geometry {
  justify-self: start;
  min-width: 0;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.showcase-footer-meta {
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: center;
  gap: 0 0.95rem;
  min-width: 0;
}

.showcase-footer-nav,
.showcase-footer-play {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: calc(var(--btn-radius) + 2px);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s;
}

.showcase-footer-nav {
  background: transparent;
}

.showcase-footer-play {
  background: rgba(255, 255, 255, 0.1);
}

.showcase-footer-nav .icon,
.showcase-footer-play .icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.showcase-footer-play .icon-pause,
.showcase-footer-play .icon-play {
  width: 1.32rem;
  height: 1.32rem;
}

.showcase-footer-play .icon-play {
  display: none;
  fill: currentColor;
  stroke: none;
}

.showcase-footer-play[aria-pressed="true"] .icon-pause {
  display: none;
}

.showcase-footer-play[aria-pressed="true"] .icon-play {
  display: block;
}

.showcase-footer-nav:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.showcase-footer-play:hover {
  border-color: rgba(255, 255, 255, 0.32);
  color: var(--fg);
}

.showcase-footer-nav:active,
.showcase-footer-play:active {
  transform: scale(0.94);
}

.showcase-export-expand-btn {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-start;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem 0 0;
  overflow: hidden;
  gap: 0;
  transition:
    width 0.32s var(--ease-out),
    min-width 0.32s var(--ease-out),
    padding 0.32s var(--ease-out),
    gap 0.28s var(--ease-out),
    border-color 0.2s,
    background 0.2s,
    transform 0.2s;
}

.showcase-export-expand-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.88);
  transition:
    max-width 0.32s var(--ease-out),
    opacity 0.24s var(--ease-out);
}

.showcase-export-expand-btn:hover {
  width: 6.75rem;
  min-width: 6.75rem;
  padding: 0 0.6rem 0 0.62rem;
  gap: 0.38rem;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.stage-fullscreen-btn.showcase-export-expand-btn:hover {
  width: 7.35rem;
  min-width: 7.35rem;
}

.showcase-export-expand-btn:hover .showcase-export-expand-label {
  max-width: 4.5rem;
  opacity: 1;
}

.stage-fullscreen-btn:hover .showcase-export-expand-label {
  max-width: 5.25rem;
}

.stage-fullscreen-btn:not([aria-pressed="true"]) .stage-fullscreen-label-exit {
  display: none;
}

.stage-fullscreen-btn[aria-pressed="true"] .stage-fullscreen-label-enter {
  display: none;
}

.showcase-export-expand-btn .icon {
  flex-shrink: 0;
}

.footer-meta-item {
  display: inline-grid;
  grid-template-columns: auto auto;
  column-gap: 0.38rem;
  align-items: baseline;
  flex-shrink: 0;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.footer-meta-label {
  flex-shrink: 0;
  opacity: 0.72;
}

.footer-meta-autoplay {
  display: inline-flex;
  align-items: center;
  column-gap: 0.34rem;
  cursor: pointer;
}

.footer-meta-autoplay input {
  width: 0.82rem;
  height: 0.82rem;
  margin: 0;
  cursor: pointer;
  accent-color: rgba(120, 200, 255, 0.95);
}

.footer-meta-autoplay:not(:has(input:checked)) .footer-meta-label {
  opacity: 0.42;
}

.footer-meta-autoplay:has(input:checked) .footer-meta-label {
  opacity: 1;
  color: rgba(255, 255, 255, 0.86);
}

.footer-meta-value {
  display: inline-block;
  color: rgba(255, 255, 255, 0.86);
  text-align: left;
  white-space: nowrap;
}

#footerDwellTime {
  width: 3.55rem;
}

#footerSlideElapsed {
  width: 4.1rem;
}

.footer-meta-total {
  display: inline-grid;
  grid-template-columns: 4.1rem auto 4.1rem;
  align-items: baseline;
  column-gap: 0.22rem;
  width: 8.85rem;
}

.footer-meta-time {
  text-align: left;
}

.footer-meta-sep {
  text-align: center;
  color: rgba(255, 255, 255, 0.42);
}

.stage-shell {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
}

.stage-canvas-area {
  position: relative;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.stage-playback-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(100% + 0.85rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

.stage-playback-rail .stage-playback-rail-export {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
}

.stage-playback-rail-top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  pointer-events: auto;
}

.slide-strip {
  flex: 0 0 var(--slide-strip-width);
  width: var(--slide-strip-width);
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.slide-strip-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  padding: 0.15rem 0.35rem 0.15rem 0.05rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) rgba(255, 255, 255, 0.04);
}

.slide-strip-scroll::-webkit-scrollbar {
  width: 6px;
}

.slide-strip-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

.slide-strip-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18));
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slide-strip-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.28));
}

.slide-strip-scroll::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.62);
}

.slide-strip-item {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.34rem;
  padding: 0.38rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  cursor: grab;
  user-select: none;
  transition:
    border-color 0.22s var(--ease-out),
    background 0.22s var(--ease-out),
    box-shadow 0.22s var(--ease-out),
    transform 0.22s var(--ease-out),
    opacity 0.18s var(--ease-out);
}

.slide-strip-item.is-dragging {
  opacity: 0.42;
  cursor: grabbing;
  transform: scale(0.97);
}

.slide-strip-item.is-drag-over {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.slide-strip-item.is-bg-drag-over {
  border-color: rgba(140, 200, 255, 0.72);
  background: rgba(140, 200, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(140, 200, 255, 0.28);
}

.slide-strip-item:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.slide-strip-item.active {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.28);
}

.slide-strip-item.is-selected {
  border-color: rgba(96, 168, 255, 0.72);
  background: rgba(48, 112, 220, 0.2);
  box-shadow:
    0 0 0 1px rgba(96, 168, 255, 0.38),
    0 0 0 3px rgba(96, 168, 255, 0.12);
}

.slide-strip-item.active.is-selected {
  border-color: rgba(140, 200, 255, 0.95);
  background: rgba(56, 128, 240, 0.28);
  box-shadow:
    0 0 0 1px rgba(160, 210, 255, 0.55),
    0 0 0 3px rgba(96, 168, 255, 0.2),
    0 8px 22px rgba(0, 0, 0, 0.28);
}

.slide-strip-item.is-selected:not(.active):hover {
  border-color: rgba(120, 188, 255, 0.88);
  background: rgba(48, 112, 220, 0.28);
}

.slide-strip-item.is-disabled {
  opacity: 0.34;
  pointer-events: none;
}

.slide-strip-add {
  appearance: none;
  font: inherit;
  width: 100%;
  cursor: pointer;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.02);
}

.slide-strip-add:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.slide-strip-add-preview {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.slide-strip-add-icon {
  width: 1.35rem;
  height: 1.35rem;
  stroke: rgba(255, 255, 255, 0.44);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.18s var(--ease-out);
}

.slide-strip-add:hover .slide-strip-add-icon {
  stroke: rgba(255, 255, 255, 0.86);
}

.slide-strip-preview {
  position: relative;
  width: 100%;
  aspect-ratio: var(--canvas-aspect-w) / var(--canvas-aspect-h);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.slide-strip-thumb {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.slide-strip-thumb-content {
  position: absolute;
  inset: 0.34rem;
  pointer-events: none;
}

.slide-strip-thumb-content.is-single {
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-strip-thumb-content.is-single .slide-strip-thumb-img {
  width: 68%;
  height: 68%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.38);
}

.slide-strip-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  filter: saturate(0.92) contrast(0.96);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.slide-strip-thumb-content.is-grid {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.slide-strip-thumb-content.is-grid[data-count="2"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.slide-strip-thumb-content.is-grid[data-count="3"] {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.slide-strip-thumb-content.is-grid[data-count="3"] .slide-strip-thumb-img:first-child {
  grid-column: 1 / -1;
}

.slide-strip-thumb.is-empty::after {
  content: '空';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.34);
}

.slide-strip-num {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  color: rgba(255, 255, 255, 0.52);
}

.slide-strip-item.active .slide-strip-num {
  color: rgba(255, 255, 255, 0.92);
}

.stage-frame {
  position: relative;
  width: 100%;
  --slide-w: 1px;
  --slide-h: 1px;
  aspect-ratio: var(--canvas-aspect-w) / var(--canvas-aspect-h);
  overflow: hidden;
  background-color: var(--canvas-bg);
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  isolation: isolate;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.34),
    0 42px 120px rgba(0, 0, 0, 0.28);
}

/* 编辑模式也裁剪画布外内容；选框/手柄在 slide 内，不受影响 */

.slide-time-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 24;
  height: 3px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.1);
}

.slide-time-progress-bar {
  display: block;
  height: 100%;
  width: calc(var(--slide-time-progress, 0) * 100%);
  background: linear-gradient(90deg, rgba(72, 199, 116, 0.85), rgba(96, 220, 140, 0.98));
  transform-origin: left center;
}

body.fullscreen-mode .app {
  padding: 0;
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
}

body.fullscreen-mode.image-sidebar-open .app {
  padding-left: 0;
}

body.fullscreen-mode .top-bar,
body.fullscreen-mode .control-panel,
body.fullscreen-mode .image-sidebar,
body.fullscreen-mode .slide-strip,
body.fullscreen-mode .stage-playback-rail,
body.fullscreen-mode .showcase-toolbar,
body.fullscreen-mode .showcase-footer,
body.fullscreen-mode .gallery-toast,
body.fullscreen-mode .image-list-hover-card,
body.fullscreen-mode .image-folder-dropdown-panel,
body.fullscreen-mode .rotate-handle,
body.fullscreen-mode .resize-handle {
  display: none !important;
}

body.fullscreen-mode .showcase {
  display: flex;
  flex-direction: column;
  width: min(100vw, calc(100dvh * var(--canvas-aspect-w) / var(--canvas-aspect-h)));
  height: min(100dvh, calc(100vw * var(--canvas-aspect-h) / var(--canvas-aspect-w)));
  max-width: 100vw;
  max-height: 100dvh;
  gap: 0;
  margin: 0;
}

body.fullscreen-mode.image-sidebar-open .showcase {
  width: min(100vw, calc(100dvh * var(--canvas-aspect-w) / var(--canvas-aspect-h)));
}

body.fullscreen-mode .showcase-stage-wrap {
  width: min(100vw, calc(100dvh * var(--canvas-aspect-w) / var(--canvas-aspect-h)));
  height: min(100dvh, calc(100vw * var(--canvas-aspect-h) / var(--canvas-aspect-w)));
}

body.fullscreen-mode .stage-shell {
  display: block;
  width: 100%;
  height: 100%;
}

body.fullscreen-mode .stage-canvas-area {
  display: block;
  width: 100%;
  height: 100%;
}

body.fullscreen-mode .stage-frame {
  width: 100%;
  height: 100%;
  aspect-ratio: var(--canvas-aspect-w) / var(--canvas-aspect-h);
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gallery-modal[hidden] {
  display: none !important;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.gallery-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 2rem));
  padding: 1.35rem 1.4rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(18, 18, 18, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.gallery-modal-title {
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.94);
}

.gallery-modal-desc {
  margin: 0 0 1.15rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.68);
}

.gallery-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
}

.gallery-modal-btn {
  min-width: 5.2rem;
  padding: 0.52rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}

.gallery-modal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.gallery-modal-btn-danger {
  border-color: rgba(255, 96, 96, 0.42);
  background: rgba(180, 48, 48, 0.28);
  color: #ffd8d8;
}

.gallery-modal-btn-danger:hover {
  background: rgba(200, 56, 56, 0.38);
  border-color: rgba(255, 120, 120, 0.55);
}

.gallery-modal-btn-primary {
  border-color: rgba(120, 180, 255, 0.45);
  background: rgba(48, 112, 220, 0.35);
}

.gallery-modal-btn-primary:hover {
  background: rgba(56, 128, 240, 0.48);
  border-color: rgba(140, 200, 255, 0.55);
}

.gallery-modal-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gallery-modal-panel-wide {
  width: min(480px, calc(100vw - 2rem));
}

.export-video-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.export-video-fieldset {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.export-video-fieldset legend {
  padding: 0 0.25rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
}

.export-video-radio {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.export-video-radio:first-of-type {
  margin-top: 0.15rem;
}

.export-video-field {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
}

.export-video-field input,
.export-video-field select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
}

.export-video-progress {
  margin-bottom: 1rem;
}

.export-video-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.export-video-progress-bar::after {
  content: '';
  display: block;
  width: calc(var(--export-progress, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(80, 150, 255, 0.85), rgba(120, 200, 255, 0.95));
  transition: width 0.25s var(--ease-out);
}

.export-video-progress-text {
  margin: 0.45rem 0 0;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.62);
}

body.is-video-exporting {
  cursor: wait;
}

body.is-video-exporting .showcase-toolbar,
body.is-video-exporting .slide-strip,
body.is-video-exporting .stage-playback-rail,
body.is-video-exporting .control-panel {
  pointer-events: none;
  opacity: 0.72;
}

.gallery-modal-panel-tall {
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
}

.cache-info-json {
  flex: 1;
  min-height: 12rem;
  max-height: min(58vh, 520px);
  margin: 0 0 1rem;
  padding: 0.85rem 0.95rem;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  color: rgba(255, 255, 255, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
  tab-size: 2;
}

.stage {
  width: 100%;
  height: 100%;
  position: relative;
}

.safe-guides {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
}

body.position-drag-active .safe-guides,
body.safe-area-edit-active .safe-guides {
  opacity: 1;
}

body.safe-area-edit-active .safe-guides {
  pointer-events: none;
}

body.safe-area-edit-active .safe-area-editor {
  pointer-events: auto;
}

body.safe-area-edit-active .safe-zone {
  display: block;
}

.safe-area-editor {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.safe-area-box {
  position: absolute;
  top: var(--safe-top);
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  border: 2px dashed rgba(140, 200, 255, 0.92);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.safe-area-handle {
  position: absolute;
  z-index: 3;
  display: block;
  pointer-events: auto;
  touch-action: none;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.safe-area-handle-top,
.safe-area-handle-bottom {
  left: 50%;
  width: 2.4rem;
  height: 0.42rem;
  margin-left: -1.2rem;
  border-radius: 999px;
  cursor: ns-resize;
}

.safe-area-handle-top {
  top: 0;
  transform: translateY(-50%);
}

.safe-area-handle-bottom {
  bottom: 0;
  transform: translateY(50%);
}

.safe-area-handle-left,
.safe-area-handle-right {
  top: 50%;
  width: 0.42rem;
  height: 2.4rem;
  margin-top: -1.2rem;
  border-radius: 999px;
  cursor: ew-resize;
}

.safe-area-handle-left {
  left: 0;
  transform: translateX(-50%);
}

.safe-area-handle-right {
  right: 0;
  transform: translateX(50%);
}

body.safe-area-dragging .safe-area-handle {
  background: rgba(140, 200, 255, 0.98);
}

.safe-line {
  position: absolute;
  display: none;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
}

.safe-line-top {
  top: var(--safe-top);
  left: 0;
  right: 0;
  height: 1px;
}

.safe-line-right {
  top: 0;
  right: var(--safe-right);
  bottom: 0;
  width: 1px;
}

.safe-line-bottom {
  left: 0;
  right: 0;
  bottom: var(--safe-bottom);
  height: 1px;
}

.safe-line-left {
  top: 0;
  left: var(--safe-left);
  bottom: 0;
  width: 1px;
}

.safe-zone {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.safe-zone-top {
  top: 0;
  left: 0;
  right: 0;
  height: var(--safe-top);
  border-bottom: 1px solid rgba(255, 255, 255, 0.78);
}

.safe-zone-right {
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--safe-right);
  border-left: 1px solid rgba(255, 255, 255, 0.78);
}

.safe-zone-bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--safe-bottom);
  border-top: 1px solid rgba(255, 255, 255, 0.78);
}

.safe-zone-left {
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--safe-left);
  border-right: 1px solid rgba(255, 255, 255, 0.78);
}

.stage-frame:not(.has-safe-top) .safe-zone-top,
.stage-frame:not(.has-safe-right) .safe-zone-right,
.stage-frame:not(.has-safe-bottom) .safe-zone-bottom,
.stage-frame:not(.has-safe-left) .safe-zone-left {
  display: none;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.slide-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--slide-bg-color, var(--canvas-bg, #0a0a0a));
  background-image: var(--slide-bg-image, none);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.slide.slide-disabled {
  display: none;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

/* 退场时保持可见，让退出动画完整播放 */
.slide.exiting {
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  z-index: 6;
}

.slide.active.entering {
  z-index: 5;
}

/* 应用分布后清除预设布局 transform，避免与 drag 偏移冲突 */
.slide.dist-flattened .img-wrap {
  transform: none !important;
  animation: none !important;
  filter: none;
  align-self: auto;
  opacity: 1;
}

.slide-inner:has(> .img-wrap:nth-child(2):not(.layer-item)) {
  display: block;
}

.slide-inner:has(> .img-wrap:nth-child(2):not(.layer-item)) > .img-wrap:not(.layer-item):not([data-pos-origin="tl"]) {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: calc(-50% + var(--drag-xr, 0) * var(--slide-w)) calc(-50% + var(--drag-yr, 0) * var(--slide-h));
}

/* 左上角坐标系：编辑模式 / 分布扁平化 / 已迁移元素 */
body.position-edit-mode .slide.active .slide-inner,
.slide.dist-flattened .slide-inner {
  display: block;
}

.slide.dist-flattened .slide-inner > .img-wrap,
body.position-edit-mode .slide.active .slide-inner > .img-wrap,
.slide-inner > .img-wrap[data-pos-origin="tl"] {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  translate: calc(var(--drag-xr, 0) * var(--slide-w)) calc(var(--drag-yr, 0) * var(--slide-h));
  transform: none;
}

.slide.dist-flattened .layer-item,
body.position-edit-mode .slide.active .layer-item,
.layer-item[data-pos-origin="tl"] {
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
  translate: calc(var(--drag-xr, 0) * var(--slide-w)) calc(var(--drag-yr, 0) * var(--slide-h));
  filter: brightness(var(--global-img-brightness, 1));
}

.slide.dist-flattened .slide-inner:has(> .img-wrap:nth-child(2):not(.layer-item)) > .img-wrap:not(.layer-item),
body.position-edit-mode .slide-inner:has(> .img-wrap:nth-child(2):not(.layer-item)) > .img-wrap:not(.layer-item) {
  left: 0;
  top: 0;
  translate: calc(var(--drag-xr, 0) * var(--slide-w)) calc(var(--drag-yr, 0) * var(--slide-h));
}

.slide-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  overflow: hidden;
}

/* 扇形 / 层次页：父级共享透视；single/duo/trio 每张图自带 perspective() */
.slide-inner.perspective-stage,
.slide-inner.depth-stage,
.slide-inner.pattern-stage {
  perspective: var(--wrap-perspective, var(--wrap-perspective-default, 1200px));
  perspective-origin: 50% 55%;
}

.slide.dist-flattened .slide-inner {
  perspective: none;
}

/* ── Aspect ratios ── */
.img-wrap[data-ratio="16-9"]  { aspect-ratio: 16 / 9;  --ar-num: 1.7778; }
.img-wrap[data-ratio="16-10"] { aspect-ratio: 16 / 10; --ar-num: 1.6; }
.img-wrap[data-ratio="4-3"]   { aspect-ratio: 4 / 3;   --ar-num: 1.3333; }
.img-wrap[data-ratio="9-16"]  { aspect-ratio: 9 / 16;  --ar-num: 0.5625; }
.img-wrap[data-ratio="3-4"]   { aspect-ratio: 3 / 4;   --ar-num: 0.75; }
.img-wrap[data-ratio="auto"] {
  aspect-ratio: var(--auto-ar-w, 16) / var(--auto-ar-h, 9);
  --ar-num: var(--auto-ar-num, 1.7778);
}

.stage-frame.has-safe-top .slide .img-wrap,
.stage-frame.has-safe-right .slide .img-wrap,
.stage-frame.has-safe-bottom .slide .img-wrap,
.stage-frame.has-safe-left .slide .img-wrap {
  max-width: calc(100% - var(--safe-left) - var(--safe-right));
  max-height: calc(100% - var(--safe-top) - var(--safe-bottom));
}

/* ── Image wrapper base ── */
.img-wrap {
  --wrap-perspective: var(--wrap-perspective-default, 1200px);
  --depth-mult: 1;
  --perspective-rotate-y: 0deg;
  --perspective-rotate-x: 0deg;
  --perspective-rotate-z: 0deg;
  --perspective-depth: 0px;
  position: relative;
  overflow: visible;
  perspective: var(--wrap-perspective, 1200px);
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  cursor: pointer;
  pointer-events: auto;
  translate: calc(var(--drag-xr, 0) * var(--slide-w)) calc(var(--drag-yr, 0) * var(--slide-h));
  rotate: var(--user-rotate, 0deg);
  scale: var(--user-scale, 1);
  border-radius: var(--img-radius);
  width: min(var(--slot-w, 50%), calc(var(--slot-max-h, 70%) * var(--ar-num, 1.7778)));
  height: auto;
  flex-shrink: 0;
  transition:
    transform 0.55s var(--ease-out),
    translate 0.2s var(--ease-out),
    rotate 0.2s var(--ease-out),
    scale 0.2s var(--ease-out),
    box-shadow 0.55s var(--ease-out),
    width 0.45s var(--ease-out),
    filter 0.45s var(--ease-out);
}

.img-wrap:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging) {
  filter: none;
}

.img-wrap:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging) .img-stack {
  filter:
    brightness(var(--global-img-brightness))
    var(--img-drop-shadow-hover, var(--img-drop-shadow, none));
}

.img-wrap.shape-item:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging) .img-stack {
  filter:
    brightness(var(--global-img-brightness))
    var(--img-drop-shadow, none);
}

.img-wrap.image-hidden {
  display: none !important;
}

.img-wrap.shape-placeholder .img-stack .img-fill,
.img-wrap.shape-placeholder .img-stack img {
  display: none;
}

.img-wrap.image-missing .img-stack .img-fill,
.img-wrap.image-missing .img-stack img,
.img-wrap .img-stack .img-fill:not([src]),
.img-wrap .img-stack img:not([src]),
.img-wrap .img-stack .img-fill[src=""],
.img-wrap .img-stack img[src=""] {
  display: none;
}

.img-wrap.image-missing .img-stack::after,
.img-wrap.shape-placeholder .img-stack::after {
  content: attr(data-size-label);
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08), transparent 42%);
  color: rgba(255, 255, 255, 0.66);
  font-size: clamp(11px, 2.1vw, 18px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.38);
}

body.position-edit-mode .slide.live .img-wrap,
body.position-edit-mode .slide.active .img-wrap {
  cursor: grab;
  touch-action: none;
}

body.position-edit-mode .img-wrap.position-dragging,
body.position-edit-mode .img-wrap.resizing {
  cursor: grabbing;
  transition: box-shadow 0.2s, width 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}

body.position-edit-mode .img-wrap.position-dragging .img-stack,
body.position-edit-mode .img-wrap.resizing .img-stack {
  filter:
    brightness(var(--global-img-brightness))
    var(--img-drop-shadow, none);
}

body.position-edit-mode .img-wrap.position-dragging::after,
body.position-edit-mode .img-wrap.resizing::after {
  box-shadow: none;
}

body.position-edit-mode .slide.active .img-wrap,
body.position-edit-mode .slide.active .layer-item,
body.position-edit-mode .slide.active .ghost,
body.position-edit-mode .slide.active .img-stack .img-fill,
body.position-edit-mode .slide.active .img-stack img,
body.position-edit-mode .slide.active .reveal-mask,
body.position-edit-mode .slide.exiting .img-wrap,
body.position-edit-mode .slide.exiting .layer-item,
body.position-edit-mode .slide.exiting .ghost,
body.position-edit-mode .slide.exiting .img-stack .img-fill,
body.position-edit-mode .slide.exiting .img-stack img {
  animation: none !important;
}

.img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--img-radius);
  pointer-events: none;
  box-shadow: none;
}

.img-wrap.image-missing::after,
.img-wrap.shape-placeholder::after {
  display: none;
}

.img-wrap:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging)::after {
  box-shadow: none;
}

.img-stack {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: inherit;
  overflow: hidden;
  transform:
    translateZ(var(--perspective-depth, 0px))
    rotateY(var(--perspective-rotate-y, 0deg))
    rotateX(var(--perspective-rotate-x, 0deg))
    rotateZ(var(--perspective-rotate-z, 0deg));
  transform-style: preserve-3d;
  transform-origin: center center;
  border: calc(var(--img-outline-width) / var(--user-scale, 1)) solid var(--img-border);
  border-radius: var(--img-radius);
  box-shadow: none;
  background: var(--img-placeholder);
  filter:
    brightness(var(--global-img-brightness))
    var(--img-drop-shadow, none);
  transition: transform 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}

.img-wrap[data-ratio="16-9"]  .img-stack { aspect-ratio: 16 / 9; }
.img-wrap[data-ratio="16-10"] .img-stack { aspect-ratio: 16 / 10; }
.img-wrap[data-ratio="4-3"]   .img-stack { aspect-ratio: 4 / 3; }
.img-wrap[data-ratio="9-16"]  .img-stack { aspect-ratio: 9 / 16; }
.img-wrap[data-ratio="3-4"]   .img-stack { aspect-ratio: 3 / 4; }
.img-wrap[data-ratio="auto"] .img-stack {
  aspect-ratio: var(--auto-ar-w, 16) / var(--auto-ar-h, 9);
}

/* ── Motion ghosts (残影) ── */
.ghost {
  position: absolute;
  inset: 0;
  background-color: var(--img-placeholder);
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0;
  border-radius: 1px;
}

/* 只让带有具体 keyframe 的残影短暂显示，避免静态留下穿插痕迹。 */
.slide.entering .ghost,
.slide.exiting .ghost {
  opacity: 0;
}

.ghost-1 { filter: blur(6px); z-index: 0; }
.ghost-2 { filter: blur(14px); z-index: 0; }
.ghost-3 { filter: blur(22px); z-index: 0; }

.img-stack .img-fill,
.img-stack img {
  position: relative;
  z-index: 1;
}

.img-wrap.style-off-perspective .img-stack {
  transform: none;
}

.img-wrap.style-off-outline .img-stack {
  border-width: 0;
  border-color: transparent;
  border-radius: 0;
}

.img-wrap.style-off-shadow {
  --img-drop-shadow: none !important;
  --img-drop-shadow-hover: none !important;
}

.img-wrap.style-off-fill {
  --global-img-brightness: 1 !important;
  --img-fit: cover !important;
}

.img-wrap.style-off-fill .img-fill,
.img-wrap.style-off-fill img {
  transform: none !important;
  object-position: 50% 50% !important;
}

.img-wrap .img-fill,
.img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--img-fit);
  object-position: 50% 50%;
  transform:
    translate(var(--img-fill-tx, 0px), var(--img-fill-ty, 0px))
    scale(var(--img-fill-scale, var(--img-inner-scale, 1)));
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
  background: var(--img-placeholder);
  transition: transform 0.65s var(--ease-out), filter 0.5s var(--ease-out), opacity 0.4s;
}

body.style-focus-dragging .img-wrap .img-fill,
body.style-focus-dragging .img-wrap img {
  transition: none;
  animation: none !important;
}

.img-wrap.selected::after {
  box-shadow: none;
}

.img-selection-frame {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
  overflow: visible;
  transition: opacity 0.16s var(--ease-out);
}

body.position-edit-mode .img-wrap.selected .img-selection-frame,
body.position-edit-mode .img-wrap.resizing .img-selection-frame,
body.position-edit-mode .shape-wrap.selected .img-selection-frame,
body.position-edit-mode .shape-wrap.resizing .img-selection-frame {
  opacity: 1;
}

body.position-edit-mode .img-wrap.is-group-selected-member.selected .img-selection-frame,
body.position-edit-mode .shape-wrap.is-group-selected-member.selected .img-selection-frame {
  opacity: 0;
  pointer-events: none;
}

.group-selection-frame {
  position: absolute;
  z-index: 14;
  pointer-events: none;
  box-sizing: border-box;
}

.group-selection-frame:not([hidden]) {
  pointer-events: auto;
}

.group-selection-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border: calc(1px / var(--user-scale, 1)) solid rgba(0, 168, 255, 0.96);
  box-shadow: 0 0 0 calc(0.5px / var(--user-scale, 1)) rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.group-selection-frame .img-selection-handle {
  z-index: 15;
}

.img-selection-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border: calc(1px / var(--user-scale, 1)) solid rgba(0, 168, 255, 0.96);
  box-shadow: 0 0 0 calc(0.5px / var(--user-scale, 1)) rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.img-selection-handle {
  position: absolute;
  z-index: 13;
  width: calc(8px / var(--user-scale, 1));
  height: calc(8px / var(--user-scale, 1));
  margin: calc(-4px / var(--user-scale, 1)) 0 0 calc(-4px / var(--user-scale, 1));
  border: calc(1px / var(--user-scale, 1)) solid rgba(0, 148, 255, 0.98);
  background: #fff;
  box-shadow: 0 0 0 calc(1px / var(--user-scale, 1)) rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  touch-action: none;
}

.img-selection-handle[data-handle='nw'] { top: 0; left: 0; cursor: nwse-resize; }
.img-selection-handle[data-handle='n'] { top: 0; left: 50%; cursor: ns-resize; }
.img-selection-handle[data-handle='ne'] { top: 0; left: 100%; cursor: nesw-resize; }
.img-selection-handle[data-handle='e'] { top: 50%; left: 100%; cursor: ew-resize; }
.img-selection-handle[data-handle='se'] { top: 100%; left: 100%; cursor: nwse-resize; }
.img-selection-handle[data-handle='s'] { top: 100%; left: 50%; cursor: ns-resize; }
.img-selection-handle[data-handle='sw'] { top: 100%; left: 0; cursor: nesw-resize; }
.img-selection-handle[data-handle='w'] { top: 50%; left: 0; cursor: ew-resize; }

.img-selection-handle:hover {
  background: rgba(0, 168, 255, 0.16);
}

body.position-edit-mode .img-wrap.selected .img-selection-frame,
body.position-edit-mode .img-wrap.resizing .img-selection-frame,
body.position-edit-mode .img-wrap.rotating .img-selection-frame,
body.position-edit-mode .shape-wrap.selected .img-selection-frame,
body.position-edit-mode .shape-wrap.resizing .img-selection-frame,
body.position-edit-mode .shape-wrap.rotating .img-selection-frame {
  pointer-events: auto;
}

/* Illustrator-style corner rotate hit areas — cursor only, no extra glyph */
.img-selection-rotate-zone {
  position: absolute;
  z-index: 12;
  width: calc(28px / var(--user-scale, 1));
  height: calc(28px / var(--user-scale, 1));
  pointer-events: auto;
  touch-action: none;
  background: transparent;
}

.img-selection-rotate-zone[data-handle='nw'] {
  top: calc(-22px / var(--user-scale, 1));
  left: calc(-22px / var(--user-scale, 1));
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M7 7a8 8 0 1 1 0 10'/%3E%3Cpath d='M7 7h3M7 7v3'/%3E%3C/svg%3E") 12 12, grab;
}

.img-selection-rotate-zone[data-handle='ne'] {
  top: calc(-22px / var(--user-scale, 1));
  right: calc(-22px / var(--user-scale, 1));
  left: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M17 7a8 8 0 1 1 0 10'/%3E%3Cpath d='M17 7h-3M17 7v3'/%3E%3C/svg%3E") 12 12, grab;
}

.img-selection-rotate-zone[data-handle='se'] {
  bottom: calc(-22px / var(--user-scale, 1));
  right: calc(-22px / var(--user-scale, 1));
  top: auto;
  left: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M17 17a8 8 0 1 1 0-10'/%3E%3Cpath d='M17 17h-3M17 17v-3'/%3E%3C/svg%3E") 12 12, grab;
}

.img-selection-rotate-zone[data-handle='sw'] {
  bottom: calc(-22px / var(--user-scale, 1));
  left: calc(-22px / var(--user-scale, 1));
  top: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.75' stroke-linecap='round'%3E%3Cpath d='M7 17a8 8 0 1 1 0-10'/%3E%3Cpath d='M7 17h3M7 17v-3'/%3E%3C/svg%3E") 12 12, grab;
}

.img-wrap.rotating::after {
  box-shadow:
    0 0 0 calc(4px / var(--user-scale, 1)) rgba(255, 255, 255, 0.58),
    0 0 calc(42px / var(--user-scale, 1)) rgba(255, 255, 255, 0.38),
    var(--img-shadow-hover);
}

.rotate-handle {
  position: absolute;
  top: -1.05rem;
  right: -1.05rem;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(18, 18, 18, 0.86);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  cursor: grab;
  backdrop-filter: blur(12px);
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
}

.rotate-handle svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.position-edit-mode .img-wrap.selected .rotate-handle,
body.position-edit-mode .img-wrap.rotating .rotate-handle,
body.position-edit-mode .img-wrap.selected .resize-handle,
body.position-edit-mode .img-wrap.resizing .resize-handle,
body.position-edit-mode .shape-wrap.selected .rotate-handle,
body.position-edit-mode .shape-wrap.rotating .rotate-handle {
  opacity: 1;
  pointer-events: auto;
}

.rotate-handle:hover,
.img-wrap.rotating .rotate-handle {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.resize-handle {
  position: absolute;
  right: -0.85rem;
  bottom: -0.85rem;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--btn-radius);
  background: rgba(18, 18, 18, 0.86);
  color: #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  cursor: nwse-resize;
  backdrop-filter: blur(12px);
  transition: opacity 0.2s, transform 0.2s, background 0.2s;
}

.resize-handle svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.resize-handle:hover,
.img-wrap.resizing .resize-handle {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

.img-wrap.resizing {
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.58),
    0 0 42px rgba(255, 255, 255, 0.38),
    var(--img-shadow-hover);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 4;
  border-radius: 1px;
}

.drop-overlay span {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg);
}

.img-wrap.drag-over .drop-overlay {
  opacity: 1;
}

/* ── Layout: Single — 悬浮透视 + 残影纵深 ── */
[data-layout="single"] .img-wrap {
  --slot-w: 72%;
  --slot-max-h: 78%;
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateX(1deg);
}

[data-layout="single"] .img-wrap:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(1deg) rotateX(-1deg) translateY(-8px);
}

[data-layout="single"] .img-wrap:hover img {
  transform: scale(1.06);
}

[data-layout="single"].entering .ghost-1 { animation: singleGhost1 var(--duration) var(--ease-out) both; }
[data-layout="single"].entering .ghost-2 { animation: singleGhost2 var(--duration) var(--ease-out) both; }
[data-layout="single"].entering .ghost-3 { animation: singleGhost3 var(--duration) var(--ease-out) both; }
[data-layout="single"].entering .img-wrap { animation: singleEnter var(--duration) var(--ease-out) both; }
[data-layout="single"].exiting .img-wrap { animation: singleExit 0.65s var(--ease-in-out) both; }
[data-layout="single"].exiting .ghost-1 { animation: singleExitGhost1 0.65s var(--ease-in-out) both; }
[data-layout="single"].exiting .ghost-2 { animation: singleExitGhost2 0.65s var(--ease-in-out) 0.08s both; }
[data-layout="single"].exiting .ghost-3 { animation: singleExitGhost3 0.65s var(--ease-in-out) 0.14s both; }

@keyframes singleEnter {
  from { opacity: 0; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-18deg) translateZ(-280px) scale(0.78); filter: blur(10px); }
  60%  { filter: blur(3px); }
  to   { opacity: 1; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateX(1deg); filter: none; }
}

@keyframes singleGhost1 {
  0%   { opacity: 0.5; transform: translateZ(-120px) translateX(-40px) scale(0.9); }
  100% { opacity: 0; transform: none; }
}

@keyframes singleGhost2 {
  0%   { opacity: 0.35; transform: translateZ(-220px) translateX(-80px) scale(0.82); }
  100% { opacity: 0; transform: none; }
}

@keyframes singleGhost3 {
  0%   { opacity: 0.2; transform: translateZ(-320px) translateX(-120px) scale(0.74); }
  100% { opacity: 0; transform: none; }
}

@keyframes singleExit {
  to {
    opacity: 0;
    transform: rotateY(calc(12deg * var(--exit-dir, 1))) translateZ(-220px) translateX(calc(-80px * var(--exit-dir, 1))) scale(0.82);
    filter: blur(16px);
  }
}

@keyframes singleExitGhost1 {
  from { opacity: 0.4; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(calc(-50px * var(--exit-dir, 1))) scale(1.04); filter: blur(16px); }
}

@keyframes singleExitGhost2 {
  from { opacity: 0.25; }
  to   { opacity: 0; transform: translateY(calc(-90px * var(--exit-dir, 1))) scale(1.08); filter: blur(24px); }
}

@keyframes singleExitGhost3 {
  from { opacity: 0.15; }
  to   { opacity: 0; transform: translateY(calc(-130px * var(--exit-dir, 1))) scale(1.12); filter: blur(30px); }
}

/* ── Layout: Duo ── */
[data-layout="duo"] .slide-inner {
  gap: 2rem;
  padding: 6vh 5vw;
}

[data-layout="duo"] .featured {
  --slot-w: 52%;
  --slot-max-h: 70%;
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-4deg);
  z-index: 2;
}

[data-layout="duo"] .secondary {
  --slot-w: 36%;
  --slot-max-h: 52%;
  align-self: flex-end;
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(6deg) translateY(-2vh);
  filter: brightness(0.92);
}

[data-layout="duo"] .featured:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(0deg) translateY(-12px) scale(1.03);
  filter: brightness(1.05);
}

[data-layout="duo"] .featured:hover img {
  transform: scale(1.04) translateX(4px);
}

[data-layout="duo"] .secondary:hover {
  opacity: 1;
  filter: brightness(1);
  animation: duoSwing 2.2s var(--ease-in-out) infinite;
}

@keyframes duoSwing {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateZ(-2deg) translateY(-16px) scale(1.05); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateZ(2deg) translateY(-18px) scale(1.05); }
}

[data-layout="duo"].entering .featured { animation: duoEnterMain var(--duration) var(--ease-out) 0.08s both; }
[data-layout="duo"].entering .featured .ghost-1 { animation: duoTrailMain1 var(--duration) var(--ease-out) 0.08s both; }
[data-layout="duo"].entering .featured .ghost-2 { animation: duoTrailMain2 var(--duration) var(--ease-out) 0.08s both; }
[data-layout="duo"].entering .secondary { animation: duoEnterSub var(--duration) var(--ease-out) 0.22s both; }
[data-layout="duo"].entering .secondary .ghost-1 { animation: duoTrailSub1 var(--duration) var(--ease-out) 0.22s both; }
[data-layout="duo"].exiting .featured { animation: duoExitMain 0.65s var(--ease-in-out) both; }
[data-layout="duo"].exiting .secondary { animation: duoExitSub 0.65s var(--ease-in-out) 0.1s both; }
[data-layout="duo"].exiting .featured .ghost-1 { animation: duoExitGhost 0.65s var(--ease-in-out) both; }
[data-layout="duo"].exiting .secondary .ghost-1 { animation: duoExitGhost 0.65s var(--ease-in-out) 0.12s both; }

@keyframes duoEnterMain {
  from { opacity: 0; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-28deg) translateX(-120px); filter: blur(8px); }
  to   { opacity: 1; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-4deg); filter: none; }
}

@keyframes duoTrailMain1 {
  0%   { opacity: 0.45; transform: translateX(-80px) scale(0.95); filter: blur(8px); }
  100% { opacity: 0; transform: none; }
}

@keyframes duoTrailMain2 {
  0%   { opacity: 0.3; transform: translateX(-140px) scale(0.9); filter: blur(16px); }
  100% { opacity: 0; transform: none; }
}

@keyframes duoEnterSub {
  from { opacity: 0; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(30deg) translateX(100px) rotateZ(8deg); filter: blur(10px); }
  to   { opacity: 1; transform: perspective(var(--wrap-perspective, 1200px)) rotateY(6deg) translateY(-2vh); filter: brightness(0.92); }
}

@keyframes duoTrailSub1 {
  0%   { opacity: 0.4; transform: translateX(70px) rotateZ(5deg); filter: blur(12px); }
  100% { opacity: 0; transform: none; }
}

@keyframes duoExitMain {
  to {
    opacity: 0;
    transform: translateX(calc(-120px * var(--exit-dir, 1))) rotateY(calc(-22deg * var(--exit-dir, 1))) scale(0.88);
    filter: blur(16px);
  }
}

@keyframes duoExitSub {
  to {
    opacity: 0;
    transform: translateX(calc(90px * var(--exit-dir, 1))) rotateY(calc(28deg * var(--exit-dir, 1))) rotateZ(6deg) scale(0.8);
    filter: blur(12px);
  }
}

@keyframes duoExitGhost {
  from { opacity: 0.35; }
  to   { opacity: 0; transform: translateX(-40px); filter: blur(20px); }
}

/* ── Layout: Trio ── */
[data-layout="trio"] .slide-inner {
  gap: 1.5rem;
  padding: 8vh 4vw;
}

[data-layout="trio"] .side {
  --slot-w: 28%;
  --slot-max-h: 48%;
  filter: brightness(0.9);
  transition: all 0.6s var(--ease-out);
}

[data-layout="trio"] .side.left {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(18deg) translateZ(-80px);
}

[data-layout="trio"] .side.right {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-18deg) translateZ(-80px);
}

[data-layout="trio"] .center {
  --slot-w: 44%;
  --slot-max-h: 62%;
  z-index: 3;
  transform: perspective(var(--wrap-perspective, 1200px)) translateZ(40px);
}

[data-layout="trio"] .side:hover {
  filter: brightness(0.98);
  transform: perspective(var(--wrap-perspective, 1200px))
    rotateY(var(--side-hover-y, 18deg))
    translateZ(-40px)
    translateX(var(--side-hover-x, 0));
}

[data-layout="trio"] .side.left:hover  { --side-hover-y: 28deg; --side-hover-x: -12px; }
[data-layout="trio"] .side.right:hover { --side-hover-y: -28deg; --side-hover-x: 12px; }

[data-layout="trio"] .center:hover {
  transform: translateZ(80px) scale(1.04);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.08);
}

[data-layout="trio"] .center:hover img {
  transform: scale(1.05);
  filter: saturate(1.15);
}

[data-layout="trio"].entering .center     { animation: trioEnterCenter var(--duration) var(--ease-spring) both; }
[data-layout="trio"].entering .center .ghost-1 { animation: trioBurstGhost1 var(--duration) var(--ease-out) both; }
[data-layout="trio"].entering .center .ghost-2 { animation: trioBurstGhost2 var(--duration) var(--ease-out) both; }
[data-layout="trio"].entering .center .ghost-3 { animation: trioBurstGhost3 var(--duration) var(--ease-out) both; }
[data-layout="trio"].entering .side.left  { animation: trioEnterSideL var(--duration) var(--ease-out) 0.18s both; }
[data-layout="trio"].entering .side.right { animation: trioEnterSideR var(--duration) var(--ease-out) 0.18s both; }
[data-layout="trio"].entering .side .ghost-1 { animation: trioSideGhost var(--duration) var(--ease-out) 0.18s both; }
[data-layout="trio"].exiting .center { animation: trioExitCenter 0.58s var(--ease-in-out) both; }

@keyframes trioEnterCenter {
  from { opacity: 0; transform: translateZ(-260px) scale(0.65); filter: blur(12px); }
  70%  { filter: blur(2px); }
  to   { opacity: 1; transform: translateZ(40px); filter: none; }
}

@keyframes trioBurstGhost1 {
  0%   { opacity: 0.5; transform: scale(1.3); filter: blur(10px); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes trioBurstGhost2 {
  0%   { opacity: 0.35; transform: scale(1.55); filter: blur(18px); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes trioBurstGhost3 {
  0%   { opacity: 0.2; transform: scale(1.8); filter: blur(28px); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes trioEnterSideL {
  from { opacity: 0; transform: rotateY(55deg) translateX(-100px) translateZ(-180px); filter: blur(8px); }
  to   { opacity: 1; transform: rotateY(18deg) translateZ(-80px); filter: brightness(0.9); }
}

@keyframes trioEnterSideR {
  from { opacity: 0; transform: rotateY(-55deg) translateX(100px) translateZ(-180px); filter: blur(8px); }
  to   { opacity: 1; transform: rotateY(-18deg) translateZ(-80px); filter: brightness(0.9); }
}

@keyframes trioSideGhost {
  0%   { opacity: 0.4; transform: translateX(var(--ghost-x, 0)) scale(0.92); filter: blur(14px); }
  100% { opacity: 0; transform: none; }
}

[data-layout="trio"].entering .side.left .ghost-1  { --ghost-x: -60px; }
[data-layout="trio"].entering .side.right .ghost-1 { --ghost-x: 60px; }

[data-layout="trio"].exiting .side.left  { animation: trioExitSideL 0.62s var(--ease-in-out) both; }
[data-layout="trio"].exiting .side.right { animation: trioExitSideR 0.62s var(--ease-in-out) both; }

@keyframes trioExitCenter {
  to { opacity: 0; transform: translateZ(-180px) scale(0.78); filter: blur(18px); }
}

@keyframes trioExitSideL {
  to {
    opacity: 0;
    transform: rotateY(42deg) translateX(calc(-90px * var(--exit-dir, 1))) translateZ(-220px) scale(0.72);
    filter: blur(14px);
  }
}

@keyframes trioExitSideR {
  to {
    opacity: 0;
    transform: rotateY(-42deg) translateX(calc(90px * var(--exit-dir, 1))) translateZ(-220px) scale(0.72);
    filter: blur(14px);
  }
}

/* ── Layout: Fan ── */
.perspective-stage {
  perspective: var(--wrap-perspective, var(--wrap-perspective-default, 1200px));
  perspective-origin: 50% 60%;
  transform-style: preserve-3d;
}

[data-layout="fan"] .fan-item {
  position: absolute;
  --slot-w: 28%;
  --slot-max-h: 42%;
  transition: transform 0.7s var(--ease-out), opacity 0.5s, filter 0.5s, width 0.45s var(--ease-out);
}

[data-layout="fan"] .fan-item[data-fan="0"] {
  transform: rotateY(28deg) translateX(-38vw) translateZ(-120px);
  filter: brightness(0.92);
  z-index: 2;
}

[data-layout="fan"] .fan-item[data-fan="1"] {
  --slot-w: 34%;
  --slot-max-h: 50%;
  transform: translateZ(80px);
  z-index: 5;
}

[data-layout="fan"] .fan-item[data-fan="2"] {
  transform: rotateY(-28deg) translateX(38vw) translateZ(-120px);
  filter: brightness(0.92);
  z-index: 2;
}

[data-layout="fan"] .fan-item[data-fan="3"] {
  --slot-w: 24%;
  --slot-max-h: 36%;
  transform: rotateY(0deg) translateY(28vh) translateZ(-200px) scale(0.85);
  filter: brightness(0.88);
  z-index: 1;
}

[data-layout="fan"] .fan-item[data-fan="0"]:hover {
  transform: rotateY(38deg) translateX(-38vw) translateZ(-60px) scale(1.06);
  filter: brightness(1.05);
}

[data-layout="fan"] .fan-item[data-fan="1"]:hover {
  transform: translateZ(120px) scale(1.05) rotateX(-2deg);
}

[data-layout="fan"] .fan-item[data-fan="1"]:hover img {
  transform: scale(1.04);
}

[data-layout="fan"] .fan-item[data-fan="2"]:hover {
  transform: rotateY(-38deg) translateX(38vw) translateZ(-60px) scale(1.06);
  filter: brightness(1.05);
}

[data-layout="fan"] .fan-item[data-fan="3"]:hover {
  transform: rotateY(0deg) translateY(22vh) translateZ(-120px) scale(0.95);
  filter: brightness(0.98);
}

[data-layout="fan"].entering .fan-item[data-fan="0"] { animation: fanEnter0 var(--duration) var(--ease-out) 0.2s both; }
[data-layout="fan"].entering .fan-item[data-fan="0"] .ghost-1 { animation: fanGhost0 var(--duration) var(--ease-out) 0.2s both; }
[data-layout="fan"].entering .fan-item[data-fan="1"] { animation: fanEnter1 var(--duration) var(--ease-out) both; }
[data-layout="fan"].entering .fan-item[data-fan="1"] .ghost-1 { animation: fanGhost1a var(--duration) var(--ease-out) both; }
[data-layout="fan"].entering .fan-item[data-fan="1"] .ghost-2 { animation: fanGhost1b var(--duration) var(--ease-out) both; }
[data-layout="fan"].entering .fan-item[data-fan="2"] { animation: fanEnter2 var(--duration) var(--ease-out) 0.2s both; }
[data-layout="fan"].entering .fan-item[data-fan="2"] .ghost-1 { animation: fanGhost2 var(--duration) var(--ease-out) 0.2s both; }
[data-layout="fan"].entering .fan-item[data-fan="3"] { animation: fanEnter3 var(--duration) var(--ease-out) 0.35s both; }
[data-layout="fan"].entering .fan-item[data-fan="3"] .ghost-1 { animation: fanGhost3 var(--duration) var(--ease-out) 0.35s both; }
[data-layout="fan"].exiting .fan-item[data-fan="0"] { animation: fanExit0 0.62s var(--ease-in-out) both; }
[data-layout="fan"].exiting .fan-item[data-fan="1"] { animation: fanExit1 0.62s var(--ease-in-out) both; }
[data-layout="fan"].exiting .fan-item[data-fan="2"] { animation: fanExit2 0.62s var(--ease-in-out) both; }
[data-layout="fan"].exiting .fan-item[data-fan="3"] { animation: fanExit3 0.62s var(--ease-in-out) both; }
[data-layout="fan"].exiting .ghost-1 { animation: fanExitGhost 0.62s var(--ease-in-out) both; }

@keyframes fanExit0 {
  to { opacity: 0; transform: rotateY(45deg) translateX(calc(-50vw * var(--exit-dir, 1))) translateZ(-280px); filter: blur(16px); }
}

@keyframes fanExit1 {
  to { opacity: 0; transform: translateZ(-350px) scale(0.55); filter: blur(20px); }
}

@keyframes fanExit2 {
  to { opacity: 0; transform: rotateY(-45deg) translateX(calc(50vw * var(--exit-dir, 1))) translateZ(-280px); filter: blur(16px); }
}

@keyframes fanExit3 {
  to { opacity: 0; transform: translateY(40vh) translateZ(-400px) rotateX(25deg) scale(0.6); filter: blur(18px); }
}

@keyframes fanEnter1 {
  from { opacity: 0; transform: translateZ(-320px) scale(0.65); filter: blur(14px); }
  to   { opacity: 1; transform: translateZ(80px); filter: none; }
}

@keyframes fanGhost1a {
  0%   { opacity: 0.45; transform: scale(1.2) translateZ(-100px); filter: blur(12px); }
  100% { opacity: 0; transform: none; }
}

@keyframes fanGhost1b {
  0%   { opacity: 0.28; transform: scale(1.45) translateZ(-180px); filter: blur(22px); }
  100% { opacity: 0; transform: none; }
}

@keyframes fanEnter0 {
  from { opacity: 0; transform: rotateY(60deg) translateX(-70vw) translateZ(-300px); filter: blur(10px); }
  to   { opacity: 1; transform: rotateY(28deg) translateX(-38vw) translateZ(-120px); filter: brightness(0.92); }
}

@keyframes fanGhost0 {
  0%   { opacity: 0.4; transform: translateX(-50vw); filter: blur(16px); }
  100% { opacity: 0; transform: none; }
}

@keyframes fanEnter2 {
  from { opacity: 0; transform: rotateY(-60deg) translateX(70vw) translateZ(-300px); filter: blur(10px); }
  to   { opacity: 1; transform: rotateY(-28deg) translateX(38vw) translateZ(-120px); filter: brightness(0.92); }
}

@keyframes fanGhost2 {
  0%   { opacity: 0.4; transform: translateX(50vw); filter: blur(16px); }
  100% { opacity: 0; transform: none; }
}

@keyframes fanEnter3 {
  from { opacity: 0; transform: translateY(55vh) translateZ(-420px) rotateX(20deg); filter: blur(12px); }
  to   { opacity: 1; transform: rotateY(0deg) translateY(28vh) translateZ(-200px) scale(0.85); filter: brightness(0.88); }
}

@keyframes fanGhost3 {
  0%   { opacity: 0.35; transform: translateY(40vh); filter: blur(20px); }
  100% { opacity: 0; transform: none; }
}

@keyframes fanExitGhost {
  from { opacity: 0.3; }
  to   { opacity: 0; transform: scale(1.2); filter: blur(28px); }
}

[data-layout="fan"] .fan-item:not(.featured):hover {
  opacity: 0.8;
}

/* ── Layout: Reveal — 遮罩揭示 + 色散残影 ── */
[data-layout="reveal"] .reveal-wrap {
  --slot-w: 68%;
  --slot-max-h: 76%;
  transform: rotateX(2deg);
}

[data-layout="reveal"] .reveal-wrap:hover {
  transform: rotateX(0deg) rotateY(3deg) translateY(-6px);
}

[data-layout="reveal"] .reveal-wrap:hover img {
  transform: scale(1.03);
  filter: contrast(1.05);
}

[data-layout="reveal"].entering .reveal-wrap { animation: revealWrapEnter var(--duration) var(--ease-out) both; }
[data-layout="reveal"].entering .reveal-wrap .ghost-1 { animation: revealGhost1 1.1s var(--ease-out) both; }
[data-layout="reveal"].entering .reveal-wrap .ghost-2 { animation: revealGhost2 1.1s var(--ease-out) both; }
[data-layout="reveal"].entering .reveal-wrap img { animation: revealImg var(--duration) var(--ease-out) both; }
[data-layout="reveal"].entering .reveal-mask { animation: revealMask 1.1s var(--ease-in-out) both; }
[data-layout="reveal"].exiting .reveal-wrap { animation: revealExit 0.65s var(--ease-in-out) both; }
[data-layout="reveal"].exiting .reveal-wrap img { animation: revealExitImg 0.65s var(--ease-in-out) both; }
[data-layout="reveal"].exiting .reveal-mask { animation: revealExitMask 0.65s var(--ease-in-out) both; }
[data-layout="reveal"].exiting .ghost-1 { animation: revealExitGhost 0.65s var(--ease-in-out) both; }

@keyframes revealWrapEnter {
  from { opacity: 0; transform: rotateX(8deg) scale(0.92); }
  to   { opacity: 1; transform: rotateX(2deg); }
}

@keyframes revealGhost1 {
  0%   { opacity: 0.5; transform: translateX(-30px) scaleX(1.08); filter: blur(8px); }
  40%  { opacity: 0.35; transform: translateX(-15px); filter: blur(4px); }
  100% { opacity: 0; transform: none; }
}

@keyframes revealGhost2 {
  0%   { opacity: 0.35; transform: translateX(-50px) scaleX(1.12); filter: blur(16px); }
  100% { opacity: 0; transform: none; }
}

@keyframes revealExit {
  to {
    opacity: 0;
    transform: rotateY(calc(-12deg * var(--exit-dir, 1))) scale(0.86);
    filter: blur(12px);
  }
}

@keyframes revealExitImg {
  to { transform: scale(1.12); filter: brightness(0.3) blur(6px); }
}

@keyframes revealExitMask {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); transform-origin: right center; }
}

@keyframes revealExitGhost {
  from { opacity: 0.4; }
  to   { opacity: 0; transform: translateX(calc(50px * var(--exit-dir, 1))) scale(1.12); filter: blur(22px); }
}

.reveal-mask {
  position: absolute;
  inset: 0;
  background: var(--bg);
  transform-origin: left center;
  pointer-events: none;
  z-index: 2;
}

/* 退场/入场时移除 live，悬停时暂停待机动画 */
.img-wrap:hover,
.layer-item:hover {
  animation-play-state: paused !important;
}

@keyframes revealMask {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@keyframes revealImg {
  from { transform: scale(1.18); filter: brightness(0.45) blur(4px); }
  to   { transform: scale(1); filter: brightness(1) blur(0); }
}

/* ══════════════════════════════════════
   待机态 — 浮动 / 透视呼吸 (live)
   ══════════════════════════════════════ */

.slide.live[data-layout="single"] .img-wrap {
  animation: idleSingle 8s ease-in-out infinite;
}

.slide.live .img-wrap.selected:not(.layer-item) {
  animation-play-state: paused !important;
}

@keyframes idleSingle {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateX(1deg) translateY(0); }
  33%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(2deg) rotateX(-1.5deg) translateY(-12px); }
  66%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-1deg) rotateX(2deg) translateY(-6px); }
}

.slide.live[data-layout="duo"] .featured {
  animation: idleDuoMain 7s ease-in-out infinite;
}

.slide.live[data-layout="duo"] .secondary {
  animation: idleDuoSub 5.5s ease-in-out infinite;
}

@keyframes idleDuoMain {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-4deg) translateY(0); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-1deg) rotateX(2deg) translateY(-10px); }
}

@keyframes idleDuoSub {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(6deg) translateY(-2vh) rotateZ(-1deg); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(4deg) translateY(-3.5vh) rotateZ(1.5deg); }
}

.slide.live[data-layout="trio"] .center {
  animation: idleTrioCenter 6s ease-in-out infinite;
}

.slide.live[data-layout="trio"] .side.left {
  animation: idleTrioSideL 7.5s ease-in-out infinite;
}

.slide.live[data-layout="trio"] .side.right {
  animation: idleTrioSideR 7.5s ease-in-out infinite;
}

@keyframes idleTrioCenter {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) translateZ(40px) scale(1); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) translateZ(55px) scale(1.02) rotateX(-1deg); }
}

@keyframes idleTrioSideL {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(18deg) translateZ(-80px); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(22deg) translateZ(-65px) translateY(-5px); }
}

@keyframes idleTrioSideR {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-18deg) translateZ(-80px); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-22deg) translateZ(-65px) translateY(-5px); }
}

.slide.live[data-layout="fan"] .fan-item[data-fan="0"] { animation: idleFan0 6.5s ease-in-out infinite; }
.slide.live[data-layout="fan"] .fan-item[data-fan="1"] { animation: idleFan1 5s ease-in-out infinite; }
.slide.live[data-layout="fan"] .fan-item[data-fan="2"] { animation: idleFan2 6.5s ease-in-out infinite; }
.slide.live[data-layout="fan"] .fan-item[data-fan="3"] { animation: idleFan3 7s ease-in-out infinite; }

@keyframes idleFan0 {
  0%, 100% { transform: rotateY(28deg) translateX(-38vw) translateZ(-120px); }
  50%      { transform: rotateY(32deg) translateX(-38vw) translateZ(-95px) translateY(-8px); }
}

@keyframes idleFan1 {
  0%, 100% { transform: translateZ(80px) rotateX(0deg); }
  50%      { transform: translateZ(95px) rotateX(-2deg) translateY(-6px); }
}

@keyframes idleFan2 {
  0%, 100% { transform: rotateY(-28deg) translateX(38vw) translateZ(-120px); }
  50%      { transform: rotateY(-32deg) translateX(38vw) translateZ(-95px) translateY(-8px); }
}

@keyframes idleFan3 {
  0%, 100% { transform: rotateY(0deg) translateY(28vh) translateZ(-200px) scale(0.85); }
  50%      { transform: rotateY(3deg) translateY(26vh) translateZ(-175px) scale(0.87); }
}

.slide.live[data-layout="reveal"] .reveal-wrap {
  animation: idleReveal 9s ease-in-out infinite;
}

@keyframes idleReveal {
  0%, 100% { transform: perspective(var(--wrap-perspective, 1200px)) rotateX(2deg) rotateY(0deg); }
  50%      { transform: perspective(var(--wrap-perspective, 1200px)) rotateX(0deg) rotateY(2deg) translateY(-8px); }
}

.slide.live .layer-item {
  animation: idleLayer 6s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.85s);
}

@keyframes idleLayer {
  0%, 100% {
    transform:
      translate(-50%, -50%)
      translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1)))
      rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
      rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
      scale(var(--scale, 1))
      translateY(0);
  }
  50% {
    transform:
      translate(-50%, -50%)
      translateZ(calc((var(--lz, 0px) + 18px) * var(--depth-mult, 1)))
      rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1) + 4deg * var(--depth-mult, 1)))
      rotateX(calc(var(--rx, 0deg) + 2deg))
      rotateZ(calc(var(--rz, 0deg) + 2deg))
      scale(var(--scale, 1))
      translateY(-7px);
  }
}

.slide.live .layer-item.featured {
  animation: idleLayerFeatured 5.5s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.6s);
}

@keyframes idleLayerFeatured {
  0%, 100% {
    transform:
      translate(-50%, -50%)
      translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1)))
      rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
      rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
      scale(var(--scale, 1));
  }
  50% {
    transform:
      translate(-50%, -50%)
      translateZ(calc((var(--lz, 0px) + 28px) * var(--depth-mult, 1)))
      rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1) + 2deg * var(--depth-mult, 1)))
      rotateX(calc(var(--rx, 0deg) - 1deg))
      rotateZ(calc(var(--rz, 0deg) + 1deg))
      scale(calc(var(--scale, 1) * 1.02));
  }
}

.slide.live .img-stack .img-fill,
.slide.live .img-stack img {
  animation: idleKenBurns 14s ease-in-out infinite;
}

@keyframes idleKenBurns {
  0%, 100% {
    transform:
      translate(var(--img-fill-tx, 0px), var(--img-fill-ty, 0px))
      scale(var(--img-fill-scale, var(--img-inner-scale, 1)));
  }
  50% {
    transform:
      translate(var(--img-fill-tx, 0px), var(--img-fill-ty, 0px))
      scale(calc(var(--img-fill-scale, var(--img-inner-scale, 1)) * 1.04));
  }
}

/* 深度布局退场方向 */
[data-layout="cascade"].exiting .layer-item {
  animation: cascadeExit var(--duration) var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.05s);
}

@keyframes cascadeExit {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-300px * var(--depth-mult, 1))) translateX(calc(-60px * var(--exit-dir, 1))) scale(0.7);
    filter: blur(16px);
  }
}

[data-layout="stack"].exiting .layer-item {
  animation: stackExitItem 0.62s var(--ease-in-out) both;
  animation-delay: calc((7 - var(--order, 0)) * 0.06s);
}

@keyframes stackExitItem {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-400px * var(--depth-mult, 1))) rotateY(calc(30deg * var(--exit-dir, 1))) rotateX(-15deg) scale(0.55);
    filter: blur(18px);
  }
}

[data-layout="scatter"].exiting .layer-item {
  animation: scatterExitItem 0.65s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.04s);
}

@keyframes scatterExitItem {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-250px * var(--depth-mult, 1))) rotateY(calc(40deg * var(--exit-dir, 1))) scale(0.5);
    filter: blur(20px);
  }
}

[data-layout="orbit"].exiting .layer-item {
  animation: orbitExitItem 0.65s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.05s);
}

@keyframes orbitExitItem {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-350px * var(--depth-mult, 1))) rotateY(calc(120deg * var(--exit-dir, 1))) scale(0.4);
    filter: blur(16px);
  }
}

[data-layout="gallery"].exiting .layer-item {
  animation: galleryExitItem 0.62s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.045s);
}

@keyframes galleryExitItem {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-280px * var(--depth-mult, 1))) rotateX(20deg) scale(0.72);
    filter: blur(14px);
  }
}

/* ── Navigation ── */
.nav-dots {
  position: static;
  transform: none;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
  z-index: 100;
}

.nav-dots button {
  width: 7px;
  height: 7px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}

.nav-dots button.active {
  background: #fff;
  transform: scale(1.4);
}

/* ── Left Image Sidebar ── */
.image-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  width: var(--image-sidebar-width);
  max-width: calc(100vw - 3rem);
  height: 100vh;
  transform: translateX(0);
  transition: transform 0.32s var(--ease-out);
}

body.image-sidebar-resizing .image-sidebar,
body.image-sidebar-resizing .app,
body.image-sidebar-resizing .showcase,
body.control-panel-resizing .control-panel,
body.control-panel-resizing .app,
body.control-panel-resizing .showcase {
  transition: none;
}

.image-sidebar-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  padding: 0.75rem 0.75rem 0.7rem 0.85rem;
  background: rgba(18, 18, 18, 0.72);
  box-shadow: 14px 0 46px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.image-sidebar.collapsed .image-sidebar-body {
  pointer-events: none;
  visibility: hidden;
}

.image-sidebar.collapsed {
  transform: translateX(calc(-100% + var(--sidebar-toggle-width)));
}

body.image-sidebar-dragging .image-sidebar {
  pointer-events: none;
  transform: translateX(calc(-100% + var(--sidebar-toggle-width)));
}

.image-sidebar-toggle {
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--sidebar-toggle-width));
  width: var(--sidebar-toggle-width);
  min-height: var(--sidebar-toggle-height);
  border: none;
  border-radius: 0 var(--sidebar-toggle-radius) var(--sidebar-toggle-radius) 0;
  padding: 0;
  transform: translateY(-50%);
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    width 0.22s var(--ease-out),
    left 0.32s var(--ease-out),
    right 0.32s var(--ease-out);
  pointer-events: auto;
}

.image-sidebar.collapsed .image-sidebar-toggle {
  left: calc(100% - var(--sidebar-toggle-width));
  right: auto;
  border-radius: 0 var(--sidebar-toggle-radius) var(--sidebar-toggle-radius) 0;
}

.image-sidebar-toggle:hover {
  width: var(--sidebar-toggle-width-hover);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.image-sidebar-toggle-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transition: transform 0.32s var(--ease-out);
}

.image-sidebar-toggle-icon .icon {
  width: var(--sidebar-toggle-icon-size);
  height: var(--sidebar-toggle-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-sidebar:not(.collapsed) .image-sidebar-toggle-icon {
  transform: rotate(180deg);
}

.image-sidebar-header {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding-bottom: 0.45rem;
}

.image-sidebar-folder-row {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  width: 100%;
  min-width: 0;
}

.image-sidebar-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.image-sidebar-folder {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-width: 0;
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.image-sidebar-folder-icon {
  flex-shrink: 0;
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-sidebar-folder > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.image-sidebar-count {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.42);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.image-sidebar-count-current {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

.image-sidebar-count-sep {
  margin: 0 0.42rem;
  color: rgba(255, 255, 255, 0.28);
}

.image-sidebar-count-total {
  color: rgba(255, 255, 255, 0.42);
}

.image-folder-path-field {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.image-folder-path-input {
  flex: 1;
  min-width: 0;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-right: none;
  border-radius: var(--btn-radius) 0 0 var(--btn-radius);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1.2;
  cursor: text;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  transition: border-color 0.18s, opacity 0.18s;
}

.image-folder-path-input:focus {
  overflow-x: auto;
  text-overflow: clip;
  outline: none;
}

.image-folder-path-input::placeholder {
  color: rgba(255, 255, 255, 0.34);
}

.image-folder-path-input.is-loading {
  opacity: 0.62;
}

.image-folder-path-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: none;
  border-radius: 0 var(--btn-radius) var(--btn-radius) 0;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
}

.image-folder-path-btn .icon {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.image-folder-path-field:focus-within .image-folder-path-input,
.image-folder-path-field:focus-within .image-folder-path-btn {
  border-color: rgba(255, 255, 255, 0.28);
}

.image-folder-path-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.image-folder-path-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.gallery-context-menu {
  position: fixed;
  z-index: 360;
  min-width: 10.5rem;
  padding: 0.28rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--surface-radius);
  background: rgba(14, 14, 14, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(14px);
}

.gallery-context-menu[hidden] {
  display: none;
}

.gallery-context-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-context-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: none;
  border-radius: var(--btn-radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}

.gallery-context-menu-item:hover:not(:disabled),
.gallery-context-menu-item:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.gallery-context-menu-item:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.gallery-context-menu-shortcut {
  flex-shrink: 0;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.42);
}

.gallery-context-menu-sep {
  height: 1px;
  margin: 0.28rem 0.35rem;
  background: rgba(255, 255, 255, 0.1);
}

.gallery-toast {
  position: fixed;
  z-index: 370;
  left: 50%;
  bottom: 1.35rem;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.48rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--surface-radius);
  background: rgba(14, 14, 14, 0.94);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.gallery-toast[hidden] {
  display: none;
}

.image-folder-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
}

.image-folder-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  width: 100%;
  min-width: 0;
  height: 2rem;
  min-height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--btn-radius);
  background: rgba(0, 0, 0, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.74rem;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s, color 0.18s;
}

.image-folder-dropdown-trigger:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.image-folder-dropdown-trigger:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.image-folder-dropdown-trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.image-folder-dropdown-trigger[aria-expanded="true"] {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.image-folder-dropdown-trigger-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: rgba(255, 255, 255, 0.72);
}

.image-folder-dropdown-trigger-icon .icon {
  width: 0.92rem;
  height: 0.92rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-folder-dropdown-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-folder-dropdown-chevron {
  flex-shrink: 0;
  width: 0.82rem;
  height: 0.82rem;
  fill: none;
  stroke: rgba(255, 255, 255, 0.48);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s var(--ease-out);
}

.image-folder-dropdown-trigger[aria-expanded="true"] .image-folder-dropdown-chevron {
  transform: rotate(180deg);
  stroke: rgba(255, 255, 255, 0.72);
}

.image-folder-dropdown-panel {
  position: fixed;
  z-index: 350;
  min-width: 20rem;
  width: max-content;
  max-width: min(32rem, calc(100vw - 1.5rem));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--surface-radius);
  background: rgba(16, 16, 16, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
}

.image-folder-dropdown-panel[hidden] {
  display: none;
}

.image-folder-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 0.28rem;
  max-height: min(16rem, 42vh);
  overflow-y: auto;
}

.image-folder-dropdown-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.image-folder-dropdown-scroll::-webkit-scrollbar {
  width: 7px;
}

.image-folder-dropdown-scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.28rem 0;
}

.image-folder-dropdown-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.image-folder-dropdown-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

.image-folder-dropdown-scroll::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.42);
  background-clip: padding-box;
}

.image-folder-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  width: 100%;
  min-width: 0;
  padding: 0.42rem 0.48rem;
  padding-left: calc(0.48rem + var(--folder-depth, 0) * 0.72rem);
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}

.image-folder-dropdown-item:hover,
.image-folder-dropdown-item:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.96);
}

.image-folder-dropdown-item[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.image-folder-dropdown-item-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: rgba(255, 255, 255, 0.62);
}

.image-folder-dropdown-item[aria-selected="true"] .image-folder-dropdown-item-icon {
  color: rgba(255, 255, 255, 0.92);
}

.image-folder-dropdown-item-icon .icon {
  width: 0.92rem;
  height: 0.92rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-folder-dropdown-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-folder-dropdown-item-count {
  flex-shrink: 0;
  min-width: 1.35rem;
  padding: 0.08rem 0.35rem;
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.image-folder-dropdown-item[aria-selected="true"] .image-folder-dropdown-item-count {
  background: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
}

.image-sidebar-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.5rem;
}

.image-sidebar-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding-top: 0.55rem;
  margin-top: 0.45rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 18, 18, 0.55);
}

.image-sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 5;
  width: 6px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.image-sidebar-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.18s;
}

.image-sidebar-resizer:hover::after,
body.image-sidebar-resizing .image-sidebar-resizer::after {
  background: rgba(255, 255, 255, 0.34);
}

.image-list-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.image-list-viewport::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.image-list-viewport:focus-visible {
  outline: none;
  box-shadow: none;
}

.image-list-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.image-list-viewport[data-view="list"] .image-list-window {
  gap: 0.18rem;
  padding: 0.18rem;
}

.image-list-viewport[data-view="list"] .image-list-item {
  flex: 1 1 0;
  min-height: 48px;
  height: auto;
  max-height: 88px;
}

.image-list-viewport[data-view="grid"] .image-list-row-grid {
  flex: 1 1 0;
  min-height: 0;
}

.image-list-viewport[data-view="grid"] .image-list-item-grid {
  height: 100%;
}

.image-sidebar-view-tabs {
  display: flex;
  align-items: center;
  gap: 0.12rem;
  flex-shrink: 0;
}

.image-view-tab {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.image-view-tab .icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-view-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

.image-view-tab:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
}

.image-view-tab.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.image-view-tab.active:hover,
.image-view-tab.active:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.image-view-tab:active {
  transform: scale(0.96);
}

.image-list-scroll {
  display: none;
}

.image-list-inner {
  display: none;
}

.image-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: 72px;
  padding: 0.32rem 0.38rem;
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s;
}

.image-list-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.image-list-item.active {
  background: rgba(255, 255, 255, 0.1);
}

.image-list-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 100%;
  min-width: 40px;
  min-height: 40px;
  max-width: 72px;
  max-height: 72px;
  aspect-ratio: 1;
  border-radius: var(--btn-radius);
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}

.image-list-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  transition: transform 0.32s var(--ease-out);
}

.image-list-item:nth-child(odd):hover .image-list-thumb img {
  transform: rotate(-3deg);
}

.image-list-item:nth-child(even):hover .image-list-thumb img {
  transform: rotate(3deg);
}

.image-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.image-list-name {
  font-size: 0.72rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.88);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-list-sub,
.image-list-index {
  font-size: 0.64rem;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.38);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-list-empty {
  padding: 1rem 0.65rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.38);
  text-align: center;
}

.image-list-hover-card {
  position: fixed;
  z-index: 340;
  width: min(17.5rem, calc(100vw - 1.5rem));
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--surface-radius);
  background: rgba(14, 14, 14, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.image-list-hover-card[hidden] {
  display: none;
}

.image-list-hover-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 6rem;
  max-height: min(16rem, 42vh);
  margin-bottom: 0.45rem;
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.image-list-hover-preview-img {
  display: block;
  max-width: 100%;
  max-height: min(16rem, 42vh);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}

.image-list-hover-info {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.image-list-hover-path {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.88);
  word-break: break-all;
}

.image-list-hover-details {
  margin: 0;
  font-size: 0.64rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.48);
  font-variant-numeric: tabular-nums;
}

.image-list-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.image-list-item-grid {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(var(--grid-row-height, 7.25rem) - 0.35rem);
  padding: 0.2rem;
  border: none;
  border-radius: var(--btn-radius);
  background: transparent;
  overflow: hidden;
  transition: background 0.18s;
}

.image-list-item-grid:hover {
  background: rgba(255, 255, 255, 0.06);
}

.image-list-item-grid.active {
  background: rgba(255, 255, 255, 0.1);
}

.image-list-thumb-grid {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  background: transparent;
}

.image-list-thumb-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform-origin: center center;
  transition: transform 0.32s var(--ease-out);
}

.image-list-item-grid:nth-child(odd):hover .image-list-thumb-grid img {
  transform: rotate(-3deg);
}

.image-list-item-grid:nth-child(even):hover .image-list-thumb-grid img {
  transform: rotate(3deg);
}

.image-list-grid-index {
  position: absolute;
  right: 0.35rem;
  bottom: 0.3rem;
  padding: 0.08rem 0.35rem;
  border-radius: var(--btn-radius-sm);
  background: rgba(0, 0, 0, 0.52);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.62rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.image-list-viewport[data-view="grid"] .image-list-item-grid.active {
  background: rgba(255, 255, 255, 0.1);
}

.image-list-viewport[data-view="grid"] .image-list-item-grid.active .image-list-grid-index {
  background: rgba(255, 255, 255, 0.88);
  color: rgba(0, 0, 0, 0.82);
}

/* ── Bottom Animation Timeline ── */
.animation-timeline-dock {
  position: fixed;
  left: var(--animation-timeline-left);
  top: var(--animation-timeline-top);
  z-index: 520;
  width: var(--animation-timeline-width);
  height: var(--animation-timeline-height);
  min-width: 520px;
  min-height: var(--animation-timeline-collapsed-height);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.88);
  color: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  overflow: hidden;
  transition: height 0.22s var(--ease-out), opacity 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

body.animation-timeline-collapsed .animation-timeline-dock {
  height: var(--animation-timeline-collapsed-height);
}

.animation-timeline-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: var(--animation-timeline-collapsed-height);
  padding: 0.25rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: move;
  user-select: none;
}

.animation-timeline-resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 16px;
  height: 16px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: nwse-resize;
  touch-action: none;
}

.animation-timeline-resizer::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
  transition: background 0.18s;
}

.animation-timeline-resizer:hover::after,
body.animation-timeline-resizing .animation-timeline-resizer::after {
  border-color: rgba(0, 168, 255, 0.72);
}

body.animation-timeline-collapsed .animation-timeline-resizer {
  display: none;
}

body.animation-timeline-collapsed .animation-timeline-head {
  border-bottom-color: transparent;
}

.animation-timeline-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border: none;
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.animation-timeline-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.animation-timeline-toggle-icon {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s var(--ease-out);
}

body.animation-timeline-collapsed .animation-timeline-toggle-icon {
  transform: rotate(180deg);
}

.animation-timeline-title-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.animation-timeline-title {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.animation-timeline-page {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.66rem;
  white-space: nowrap;
}

.animation-timeline-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.animation-timeline-step {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.66rem;
  white-space: nowrap;
}

.animation-timeline-step input {
  width: 3.4rem;
  min-height: 1.45rem;
  padding: 0 0.32rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: inherit;
  font-size: 0.68rem;
}

.animation-timeline-body {
  display: grid;
  grid-template-columns: minmax(150px, 0.72fr) minmax(260px, 1.7fr) minmax(210px, 0.9fr);
  gap: 0;
  height: calc(100% - var(--animation-timeline-collapsed-height));
  min-height: 0;
}

body.animation-timeline-collapsed .animation-timeline-body {
  display: none;
}

.animation-timeline-list,
.animation-timeline-main,
.animation-timeline-params {
  min-height: 0;
  overflow: auto;
}

.animation-timeline-list {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.45rem;
}

.animation-timeline-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.42rem;
  width: 100%;
  min-height: 2.15rem;
  margin-bottom: 0.28rem;
  padding: 0.3rem 0.42rem;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.76);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.animation-timeline-row:hover,
.animation-timeline-row.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.animation-timeline-row-index {
  color: rgba(255, 255, 255, 0.36);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

.animation-timeline-row-main {
  min-width: 0;
}

.animation-timeline-row-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}

.animation-timeline-row-meta {
  display: block;
  margin-top: 0.08rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.62rem;
}

.animation-timeline-main {
  position: relative;
  padding: 0.45rem 0.6rem 0.6rem;
}

.animation-timeline-ruler {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 1.25rem;
  margin-bottom: 0.32rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px) 0 0 / 20% 100%;
}

.animation-ruler-mark {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.58rem;
  font-variant-numeric: tabular-nums;
}

.animation-timeline-track {
  position: relative;
  height: 2.15rem;
  margin-bottom: 0.28rem;
  border-radius: var(--btn-radius-sm);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px) 0 0 / 20% 100%,
    rgba(255, 255, 255, 0.025);
}

.animation-timeline-bar {
  position: absolute;
  top: 0.34rem;
  min-width: 0.45rem;
  height: 1.42rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--btn-radius-sm);
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.74), rgba(139, 92, 246, 0.78));
  color: #fff;
  font-size: 0.58rem;
  line-height: 1.35rem;
  padding: 0 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.animation-timeline-bar.is-enter {
  background: linear-gradient(135deg, rgba(0, 168, 255, 0.78), rgba(79, 70, 229, 0.72));
}

.animation-timeline-bar.is-idle {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.78), rgba(236, 72, 153, 0.68));
}

.animation-timeline-bar.is-exit {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.78), rgba(239, 68, 68, 0.72));
}

.animation-timeline-bar.is-loop {
  border-style: dashed;
}

.animation-timeline-bar:hover,
.animation-timeline-bar.active {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.22);
}

.animation-timeline-bar.is-empty-animation {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.46);
}

.animation-timeline-empty {
  position: absolute;
  inset: 2.1rem 0.6rem 0.6rem;
  display: none;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--btn-radius);
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.72rem;
}

.animation-timeline-empty.active {
  display: grid;
}

.animation-timeline-params {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.55rem var(--panel-inset-right) 0.7rem var(--panel-inset-left);
}

.animation-timeline-params-head {
  margin-bottom: 0.42rem;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.animation-timeline-params .object-animation-grid {
  display: grid;
  gap: 0.52rem;
}

.animation-timeline-params select,
.animation-timeline-params input[type="number"] {
  width: 100%;
}

/* ── Right Parameter Sidebar ── */
.control-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  width: min(var(--control-panel-width), calc(100vw - 3rem));
  height: 100vh;
  color: #f6f6f6;
  transform: translateX(0);
  transition: transform 0.32s var(--ease-out), width 0.32s var(--ease-out);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
  pointer-events: none;
}

.panel-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: rgba(14, 14, 14, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.28);
  opacity: 1;
  position: relative;
  z-index: 1;
  isolation: isolate;
  pointer-events: auto;
  --panel-inset-top: 25px;
  --panel-inset-right: 25px;
  --panel-inset-bottom: 0.55rem;
  --panel-inset-left: 15px;
  --panel-style-ratio: 0.42;
}

.panel-header {
  flex-shrink: 0;
  padding: 0 var(--panel-inset-right) 0 var(--panel-inset-left);
  transition: opacity 0.2s var(--ease-out);
}

.panel-preview-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: var(--panel-inset-top) var(--panel-inset-right) 0.35rem var(--panel-inset-left);
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.panel-preview-bar-body {
  width: 100%;
  padding: 0;
  overflow: hidden;
  max-height: 7.5rem;
}

.panel-preview-bar.is-collapsed {
  margin-top: 0;
  margin-bottom: 0;
}

.panel-preview-bar.is-collapsed .panel-preview-bar-fold {
  margin-top: 0;
}

.panel-preview-bar.is-collapsed .panel-preview-bar-body {
  display: none;
}

.panel-preview-bar-fold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.1rem 0 0.15rem;
  padding: 0.15rem 1rem 0.2rem;
  border: none;
  border-radius: var(--btn-radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.panel-preview-bar-fold:hover {
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.05);
}

.panel-preview-bar-fold-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.18s var(--ease-out);
}

.panel-preview-bar.is-collapsed .panel-preview-bar-fold-icon {
  transform: rotate(180deg);
}

.style-preview-empty {
  display: grid;
  gap: 0.28rem;
  place-content: center;
  width: 100%;
  height: 7.5rem;
  max-height: 7.5rem;
  margin: 0;
  padding: 0.35rem 0.25rem;
  text-align: center;
}

.style-preview-empty-size {
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.02em;
}

.style-preview-empty-page {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.46);
  font-variant-numeric: tabular-nums;
}

.style-preview-empty[hidden] {
  display: none;
}

.style-preview-context-menu [role="menuitemradio"].is-active {
  color: #fff;
  background: rgba(0, 168, 255, 0.18);
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.panel-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s var(--ease-out);
}

.panel-body:has(.panel-style-pane:hover) .panel-header,
.panel-body:has(.panel-style-pane:hover) .panel-main,
.panel-body:has(.panel-style-pane:focus-within) .panel-header,
.panel-body:has(.panel-style-pane:focus-within) .panel-main {
  opacity: 0.55;
}

.panel-body:has(.panel-header:hover) .panel-style-pane,
.panel-body:has(.panel-main:hover) .panel-style-pane,
.panel-body:has(.panel-header:focus-within) .panel-style-pane,
.panel-body:has(.panel-main:focus-within) .panel-style-pane {
  opacity: 0.55;
}

.panel-splitter {
  flex: 0 0 auto;
  height: 1px;
  box-sizing: content-box;
  padding: 6px 0;
  margin: calc(0.35rem - 6px) 0;
  border-radius: 0;
  background-color: rgba(255, 255, 255, 0.08);
  background-clip: content-box;
  cursor: row-resize;
  touch-action: none;
  transition: background-color 0.15s;
}

.panel-splitter:hover,
body.panel-splitter-dragging .panel-splitter {
  background-color: rgba(0, 168, 255, 0.45);
}

.panel-style-pane {
  flex: 0 0 calc(var(--panel-style-ratio, 0.42) * 100%);
  min-height: 8.5rem;
  max-height: 78%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity 0.2s var(--ease-out);
}

.panel-style-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.1rem var(--panel-inset-right) 0.45rem var(--panel-inset-left);
}

.panel-style-head-title {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.88);
}

.panel-style-tabs {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.18rem;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 0;
}

.style-tab-btn {
  min-height: 1.35rem;
  min-width: 3.35rem;
  padding: 0 0.72rem;
  border: none;
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.52);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.style-tab-btn:hover {
  color: rgba(255, 255, 255, 0.88);
}

.style-tab-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.panel-style-pane[data-style-tab] .control-section-style .control-card-collapsible[data-style-tab] {
  display: none;
}

.panel-style-pane[data-style-tab="text"] .control-section-style .control-card-collapsible[data-style-tab="text"],
.panel-style-pane[data-style-tab="image"] .control-section-style .control-card-collapsible[data-style-tab="image"],
.panel-style-pane[data-style-tab="shape"] .control-section-style .control-card-collapsible[data-style-tab="shape"],
.panel-style-pane[data-style-tab="animation"] .control-section-style .control-card-collapsible[data-style-tab="animation"] {
  display: block;
}

.panel-style-pane[data-style-tab="shape"] [data-preview-group="shapeFill"] { order: 1; }
.panel-style-pane[data-style-tab="shape"] [data-preview-group="shapeBlur"] { order: 2; }
.panel-style-pane[data-style-tab="shape"] [data-preview-group="appearance"] { order: 3; }
.panel-style-pane[data-style-tab="shape"] [data-preview-group="shadow"] { order: 4; }
.panel-style-pane[data-style-tab="shape"] [data-preview-group="perspective"] { order: 5; }

.panel-style-pane[data-style-tab] .control-section-style .control-card-collapsible[data-style-tab] + .control-card-collapsible[data-style-tab] {
  border-top: none;
}

.panel-style-pane[data-style-tab="text"] .control-section-style .control-card-collapsible[data-style-tab="text"] + .control-card-collapsible[data-style-tab="text"],
.panel-style-pane[data-style-tab="image"] .control-section-style .control-card-collapsible[data-style-tab="image"] + .control-card-collapsible[data-style-tab="image"],
.panel-style-pane[data-style-tab="shape"] .control-section-style .control-card-collapsible[data-style-tab="shape"] + .control-card-collapsible[data-style-tab="shape"],
.panel-style-pane[data-style-tab="animation"] .control-section-style .control-card-collapsible[data-style-tab="animation"] + .control-card-collapsible[data-style-tab="animation"] {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.shape-fill-color-band {
  position: relative;
  height: 2rem;
  margin-top: 0.15rem;
}

.shape-fill-color-band-track {
  position: absolute;
  inset: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  background: linear-gradient(90deg, #ffffff, #0066ff);
}

.shape-fill-color-stop {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.shape-fill-color-stop input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.shape-fill-color-stop-chip {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

.shape-fill-color-stop-start {
  left: 0.75rem;
}

.shape-fill-color-stop-end {
  left: calc(100% - 0.75rem);
}

.shape-fill-color-band[data-fill-type="solid"],
.shape-fill-color-band[data-fill-type="none"] {
  display: none;
}

.panel-style-pane.is-focused {
  box-shadow: inset 0 1px 0 rgba(0, 168, 255, 0.28);
}

.panel-style-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.panel-style-scroll .control-section-style {
  display: grid;
  gap: 0;
  border: none;
  background: transparent;
  padding: 0.15rem 0 var(--panel-inset-bottom) 0;
}

.panel-style-scroll .control-section-style.active {
  display: grid;
}

.panel-scroll::-webkit-scrollbar,
.panel-style-scroll::-webkit-scrollbar {
  width: 7px;
}

.panel-scroll::-webkit-scrollbar-track,
.panel-style-scroll::-webkit-scrollbar-track {
  background: transparent;
  margin: 0.35rem 0;
}

.panel-scroll::-webkit-scrollbar-thumb,
.panel-style-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.panel-scroll::-webkit-scrollbar-thumb:hover,
.panel-style-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

.panel-scroll::-webkit-scrollbar-thumb:active,
.panel-style-scroll::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.42);
  background-clip: padding-box;
}

.control-panel.collapsed .panel-body {
  display: none;
  pointer-events: none;
}

.control-panel.collapsed {
  width: var(--sidebar-toggle-width);
  transform: translateX(0);
  overflow: hidden;
}

.control-panel-resizer {
  position: absolute;
  top: 0;
  left: -3px;
  z-index: 6;
  width: 6px;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
  pointer-events: auto;
}

.control-panel-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.18s;
}

.control-panel-resizer:hover::after,
body.control-panel-resizing .control-panel-resizer::after {
  background: rgba(255, 255, 255, 0.34);
}

.control-panel.collapsed .control-panel-resizer {
  display: none;
}

.panel-toggle {
  position: absolute;
  top: 50%;
  left: calc(-1 * var(--sidebar-toggle-width));
  width: var(--sidebar-toggle-width);
  min-height: var(--sidebar-toggle-height);
  border: none;
  border-radius: var(--sidebar-toggle-radius) 0 0 var(--sidebar-toggle-radius);
  padding: 0;
  background: rgba(18, 18, 18, 0.82);
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translateY(-50%);
  backdrop-filter: blur(14px);
  pointer-events: auto;
  z-index: 2;
  transition:
    background 0.2s,
    color 0.2s,
    width 0.22s var(--ease-out),
    left 0.32s var(--ease-out),
    right 0.32s var(--ease-out);
}

.panel-toggle:hover {
  width: var(--sidebar-toggle-width-hover);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.panel-toggle:active {
  background: rgba(255, 255, 255, 0.14);
}

.panel-toggle-icon {
  display: grid;
  place-items: center;
  transform: rotate(0deg);
  transition: transform 0.32s var(--ease-out);
}

.panel-toggle .icon {
  width: var(--sidebar-toggle-icon-size);
  height: var(--sidebar-toggle-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.control-panel.collapsed .panel-toggle-icon {
  transform: rotate(180deg);
}

.control-panel.collapsed .panel-toggle {
  left: auto;
  right: 0;
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.2rem;
  margin-bottom: 5px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.tab-btn {
  min-height: 1.42rem;
  padding: 0 0.35rem;
  border: none;
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.56);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab-btn:hover {
  color: #fff;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.control-section {
  display: none;
  gap: 0.55rem;
  align-content: start;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--btn-radius);
  padding: 0.65rem 0.55rem;
  background: transparent;
}

.control-section.active {
  display: grid;
}

.control-section h3 {
  display: none;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.control-section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.68rem;
}

.control-card > .control-section-grid {
  padding-left: var(--control-group-indent);
  padding-top: 15px;
}

.control-card-collapsible {
  padding-top: 0;
}

.control-card-collapsible .control-card-head,
.control-card-collapsible .control-card-head-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.38rem;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
}

.control-card-collapsible .control-card-head.safe-area-card-head,
.control-card-collapsible .control-card-head.canvas-size-card-head,
.control-card-collapsible .control-card-head.outline-card-head,
.control-card-collapsible .control-card-head.shadow-card-head,
.control-card-collapsible .control-card-head.style-effect-card-head {
  width: 100%;
  padding: 0.45rem 0;
  justify-content: space-between;
  cursor: default;
  gap: 0.5rem;
}

.control-card-collapsible > button.control-card-head,
.control-card-collapsible .control-card-head-toggle {
  cursor: pointer;
  font: inherit;
}

.control-card-collapsible .control-card-head .control-card-title {
  margin: 0;
}

.control-card-collapsible.is-collapsed .control-card-head {
  margin-bottom: 0;
}

.control-card-collapsible .control-card-body {
  display: grid;
  grid-template-rows: 1fr;
  min-height: 0;
  padding-top: 15px;
  transition: grid-template-rows 0.18s var(--ease-out), padding-top 0.18s var(--ease-out);
}

.control-card-collapsible.is-collapsed .control-card-body {
  grid-template-rows: 0fr;
  padding-top: 0;
}

.control-card-collapsible .control-card-body > .control-section-grid {
  min-height: 0;
  overflow: hidden;
}

.control-card-collapsible .control-card-body .control-section-grid {
  padding-left: calc(0.85rem + 0.38rem);
}

.control-card-chevron {
  flex-shrink: 0;
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: rgba(255, 255, 255, 0.42);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(90deg);
  transition: transform 0.18s var(--ease-out);
}

.control-card-collapsible.is-collapsed .control-card-chevron {
  transform: rotate(0deg);
}

.control-card-collapsible .control-card-head-toggle {
  width: auto;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.control-section-play .control-card-collapsible,
.control-section-layout .control-card-collapsible,
.control-section-animation .control-card-collapsible,
.control-section-canvas .control-card-collapsible {
  padding-block: 0.5rem;
  padding-inline: var(--panel-inset-left) var(--panel-inset-right);
  margin-inline: 0;
  border-top: none;
  border-radius: 0;
  transition: background-color 0.18s var(--ease-out);
}

.control-section-play .control-card-collapsible + .control-card-collapsible,
.control-section-layout .control-card-collapsible + .control-card-collapsible,
.control-section-animation .control-card-collapsible + .control-card-collapsible,
.control-section-canvas .control-card-collapsible + .control-card-collapsible {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.control-section-play,
.control-section-layout,
.control-section-animation,
.control-section-canvas {
  gap: 0;
}

.control-section-style .control-card-collapsible {
  padding-block: 0.5rem;
  padding-inline: var(--panel-inset-left) var(--panel-inset-right);
  margin-inline: 0;
  border-top: none;
  border-radius: 0;
  transition: background-color 0.18s var(--ease-out);
}

.control-section-style .control-card-collapsible + .control-card-collapsible {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.control-section-play .control-section-grid,
.control-section-layout .control-section-grid,
.control-section-animation .control-section-grid,
.control-section-canvas .control-section-grid,
.control-section-style .control-section-grid {
  gap: 0.52rem;
}

.control-section-layout .safe-area-grid {
  gap: 0.42rem 0.95rem;
}

.safe-area-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.canvas-size-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.canvas-size-card-head .control-card-title {
  margin: 0;
}

.canvas-size-ratio {
  font-size: 0.62rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
}

.control-section-canvas .control-card-collapsible:hover .canvas-size-ratio,
.control-section-canvas .control-card-collapsible:focus-within .canvas-size-ratio {
  color: rgba(255, 255, 255, 0.52);
}

.safe-area-card-head .control-card-title {
  margin: 0;
}

.safe-area-show-check {
  white-space: nowrap;
}

.control-field-action .control-hint {
  margin-top: 0.35rem;
}

.control-card-title {
  margin: 0 0 0.42rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.52);
  transition: color 0.18s var(--ease-out);
}

.control-card-collapsible:hover .control-card-head .control-card-title,
.control-card-collapsible:focus-within .control-card-head .control-card-title,
.control-card-collapsible:hover .control-card-head-toggle .control-card-title,
.control-card-collapsible:focus-within .control-card-head-toggle .control-card-title {
  color: rgba(255, 255, 255, 0.95);
}

.control-section-style .control-card-collapsible .control-card-head,
.control-section-play .control-card-collapsible .control-card-head,
.control-section-layout .control-card-collapsible .control-card-head,
.control-section-animation .control-card-collapsible .control-card-head,
.control-section-canvas .control-card-collapsible .control-card-head {
  margin-bottom: 0;
  padding: 0.2rem 0;
}

.control-section-style,
.control-section-play,
.control-section-layout,
.control-section-animation,
.control-section-canvas {
  gap: 0;
  border: none;
}

.control-section-style .control-section-grid {
  gap: 0.52rem;
}

.control-section-play .control-card-collapsible:hover,
.control-section-play .control-card-collapsible:focus-within,
.control-section-layout .control-card-collapsible:hover,
.control-section-layout .control-card-collapsible:focus-within,
.control-section-animation .control-card-collapsible:hover,
.control-section-animation .control-card-collapsible:focus-within,
.control-section-canvas .control-card-collapsible:hover,
.control-section-canvas .control-card-collapsible:focus-within,
.control-section-style .control-card-collapsible:hover,
.control-section-style .control-card-collapsible:focus-within {
  background-color: rgba(255, 255, 255, 0.045);
}

.control-section-play .control-card-collapsible .control-card-head .control-card-title,
.control-section-layout .control-card-collapsible .control-card-head .control-card-title,
.control-section-animation .control-card-collapsible .control-card-head .control-card-title,
.control-section-canvas .control-card-collapsible .control-card-head .control-card-title,
.control-section-style .control-card-collapsible .control-card-head .control-card-title {
  color: rgba(255, 255, 255, 0.4);
}

.control-section-play .control-card-collapsible:hover .control-card-head .control-card-title,
.control-section-play .control-card-collapsible:focus-within .control-card-head .control-card-title,
.control-section-layout .control-card-collapsible:hover .control-card-head .control-card-title,
.control-section-layout .control-card-collapsible:focus-within .control-card-head .control-card-title,
.control-section-animation .control-card-collapsible:hover .control-card-head .control-card-title,
.control-section-animation .control-card-collapsible:focus-within .control-card-head .control-card-title,
.control-section-canvas .control-card-collapsible:hover .control-card-head .control-card-title,
.control-section-canvas .control-card-collapsible:focus-within .control-card-head .control-card-title,
.control-section-style .control-card-collapsible:hover .control-card-head .control-card-title,
.control-section-style .control-card-collapsible:focus-within .control-card-head .control-card-title {
  color: rgba(255, 255, 255, 0.95);
}

.control-section-play .control-card-chevron,
.control-section-layout .control-card-chevron,
.control-section-animation .control-card-chevron,
.control-section-canvas .control-card-chevron,
.control-section-style .control-card-chevron {
  stroke: rgba(255, 255, 255, 0.28);
  transition: stroke 0.18s var(--ease-out);
}

.control-section-play .control-card-collapsible:hover .control-card-chevron,
.control-section-play .control-card-collapsible:focus-within .control-card-chevron,
.control-section-layout .control-card-collapsible:hover .control-card-chevron,
.control-section-layout .control-card-collapsible:focus-within .control-card-chevron,
.control-section-animation .control-card-collapsible:hover .control-card-chevron,
.control-section-animation .control-card-collapsible:focus-within .control-card-chevron,
.control-section-canvas .control-card-collapsible:hover .control-card-chevron,
.control-section-canvas .control-card-collapsible:focus-within .control-card-chevron,
.control-section-style .control-card-collapsible:hover .control-card-chevron,
.control-section-style .control-card-collapsible:focus-within .control-card-chevron {
  stroke: rgba(255, 255, 255, 0.55);
}

.control-section-play .control-field-label,
.control-section-layout .control-field-label,
.control-section-animation .control-field-label,
.control-section-canvas .control-field-label,
.control-section-style .control-field-label,
.control-section-style .shadow-controls-head .control-field-label {
  color: rgba(255, 255, 255, 0.36);
  transition: color 0.15s var(--ease-out);
}

.control-section-play .control-value,
.control-section-play .control-field b,
.control-section-play .control-output,
.control-section-layout .control-value,
.control-section-layout .control-field b,
.control-section-layout .control-output,
.control-section-animation .control-value,
.control-section-animation .control-field b,
.control-section-animation .control-output,
.control-section-canvas .control-value,
.control-section-canvas .control-field b,
.control-section-canvas .control-output,
.control-section-style .control-value,
.control-section-style .control-field b,
.control-section-style .shadow-controls-head .control-value {
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.15s var(--ease-out);
}

.control-section-play .control-field:hover > .control-field-label,
.control-section-play .control-field:focus-within > .control-field-label,
.control-section-layout .control-field:hover > .control-field-label,
.control-section-layout .control-field:focus-within > .control-field-label,
.control-section-animation .control-field:hover > .control-field-label,
.control-section-animation .control-field:focus-within > .control-field-label,
.control-section-canvas .control-field:hover > .control-field-label,
.control-section-canvas .control-field:focus-within > .control-field-label,
.control-section-style .control-field:hover > .control-field-label,
.control-section-style .control-field:focus-within > .control-field-label,
.control-section-style .control-field-fit:hover > .control-field-label,
.control-section-style .control-field-fit:focus-within > .control-field-label,
.control-section-style .shadow-controls-head:hover .control-field-label,
.control-section-style .shadow-controls-head:focus-within .control-field-label {
  color: rgba(255, 255, 255, 0.92);
}

.control-section-play .control-field:hover > .control-value,
.control-section-play .control-field:focus-within > .control-value,
.control-section-play .control-field:hover b,
.control-section-play .control-field:focus-within b,
.control-section-play .control-field:hover > .control-output,
.control-section-play .control-field:focus-within > .control-output,
.control-section-layout .control-field:hover > .control-value,
.control-section-layout .control-field:focus-within > .control-value,
.control-section-layout .control-field:hover b,
.control-section-layout .control-field:focus-within b,
.control-section-layout .control-field:hover > .control-output,
.control-section-layout .control-field:focus-within > .control-output,
.control-section-canvas .control-field:hover > .control-value,
.control-section-canvas .control-field:focus-within > .control-value,
.control-section-canvas .control-field:hover b,
.control-section-canvas .control-field:focus-within b,
.control-section-canvas .control-field:hover > .control-output,
.control-section-canvas .control-field:focus-within > .control-output,
.control-section-style .control-field:hover > .control-value,
.control-section-style .control-field:focus-within > .control-value,
.control-section-style .control-field:hover b,
.control-section-style .control-field:focus-within b,
.control-section-style .shadow-controls-head:hover .control-value,
.control-section-style .shadow-controls-head:focus-within .control-value {
  color: rgba(255, 255, 255, 0.95);
}

.control-section-play .control-field input[type="range"],
.control-section-layout .control-field input[type="range"],
.control-section-canvas .control-field input[type="range"],
.control-section-style .control-field input[type="range"] {
  --range-track-bg: rgba(255, 255, 255, 0.1);
  --range-thumb-bg: rgba(255, 255, 255, 0.58);
}

.control-section-play .control-field:hover input[type="range"],
.control-section-play .control-field:focus-within input[type="range"],
.control-section-layout .control-field:hover input[type="range"],
.control-section-layout .control-field:focus-within input[type="range"],
.control-section-canvas .control-field:hover input[type="range"],
.control-section-canvas .control-field:focus-within input[type="range"],
.control-section-style .control-field:hover input[type="range"],
.control-section-style .control-field:focus-within input[type="range"] {
  --range-track-bg: rgba(255, 255, 255, 0.2);
  --range-thumb-bg: rgba(255, 255, 255, 0.92);
}

.control-section-style .outline-color-input,
.control-section-style .control-field-inline input[type="color"] {
  opacity: 0.72;
  transition: opacity 0.15s var(--ease-out);
}

.control-section-style .control-field:hover .outline-color-input,
.control-section-style .control-field:focus-within .outline-color-input,
.control-section-style .control-field-inline:hover input[type="color"],
.control-section-style .control-field-inline:focus-within input[type="color"] {
  opacity: 1;
}

.control-section-play .fit-check-option,
.control-section-layout .fit-check-option,
.control-section-canvas .fit-check-option,
.control-section-style .fit-check-option {
  color: rgba(255, 255, 255, 0.48);
}

.control-section-play .fit-check-option:hover,
.control-section-play .fit-check-option:has(.fit-check-input:checked),
.control-section-layout .fit-check-option:hover,
.control-section-layout .fit-check-option:has(.fit-check-input:checked),
.control-section-canvas .fit-check-option:hover,
.control-section-canvas .fit-check-option:has(.fit-check-input:checked),
.control-section-style .fit-check-option:hover,
.control-section-style .fit-check-option:has(.fit-check-input:checked) {
  color: rgba(255, 255, 255, 0.92);
}

.control-section-play .fit-check-box,
.control-section-layout .fit-check-box,
.control-section-canvas .fit-check-box,
.control-section-style .fit-check-box {
  border-color: rgba(255, 255, 255, 0.22);
}

.control-section-play .fit-check-option:hover .fit-check-box,
.control-section-play .fit-check-option:focus-within .fit-check-box,
.control-section-layout .fit-check-option:hover .fit-check-box,
.control-section-layout .fit-check-option:focus-within .fit-check-box,
.control-section-layout .control-card-collapsible:hover .fit-check-box,
.control-section-layout .control-card-collapsible:focus-within .fit-check-box,
.control-section-canvas .fit-check-option:hover .fit-check-box,
.control-section-canvas .fit-check-option:focus-within .fit-check-box,
.control-section-style .fit-check-option:hover .fit-check-box,
.control-section-style .fit-check-option:focus-within .fit-check-box,
.control-section-style .control-field-fit:hover .fit-check-box,
.control-section-style .control-field-fit:focus-within .fit-check-box {
  border-color: rgba(255, 255, 255, 0.34);
}

.control-section-style .control-field-fit:hover .fit-check-option,
.control-section-style .control-field-fit:focus-within .fit-check-option {
  color: rgba(255, 255, 255, 0.62);
}

.control-section-style .shadow-controls-row .control-field,
.control-section-style .shadow-controls-row .control-field-label,
.control-section-style .shadow-controls-row .control-value,
.control-section-style .shadow-controls-row .control-field b {
  font-size: 0.68rem;
  line-height: 1.2;
}

.control-section-style .shadow-controls-row .control-field-slider {
  row-gap: 0.1rem;
  column-gap: 0.28rem;
}

.control-section-style .shadow-controls-row .control-field-slider > .control-value,
.control-section-style .shadow-controls-row .control-field b {
  min-width: 2.35rem;
  font-weight: 500;
}

.control-section-style .shadow-controls-row .control-field-slider > input[type="range"] {
  min-height: 1rem;
}

.control-section-style .control-field-slider {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 0.18rem;
  column-gap: 0.38rem;
  align-items: center;
}

.control-section-style .control-field-slider > .control-field-label {
  grid-column: 1;
  grid-row: 1;
}

.control-section-style .control-field-slider > .control-value {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  min-width: 0;
}

.control-section-style .control-field-slider > input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

.control-section-play .control-field-slider,
.control-section-layout .control-field-slider,
.control-section-canvas .control-field-slider {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  row-gap: 0.18rem;
  column-gap: 0.38rem;
  align-items: center;
}

.control-section-play .control-field-slider > .control-field-label,
.control-section-layout .control-field-slider > .control-field-label,
.control-section-canvas .control-field-slider > .control-field-label {
  grid-column: 1;
  grid-row: 1;
}

.control-section-play .control-field-slider > .control-value,
.control-section-layout .control-field-slider > .control-value,
.control-section-canvas .control-field-slider > .control-value {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  min-width: 0;
}

.control-section-play .control-field-slider > input[type="range"],
.control-section-layout .control-field-slider > input[type="range"],
.control-section-canvas .control-field-slider > input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

.control-section-play .control-field,
.control-section-play .control-field-label,
.control-section-play .control-value,
.control-section-play .control-field b,
.control-section-play .control-output,
.control-section-layout .control-field,
.control-section-layout .control-field-label,
.control-section-layout .control-value,
.control-section-layout .control-field b,
.control-section-layout .control-output,
.control-section-canvas .control-field,
.control-section-canvas .control-field-label,
.control-section-canvas .control-value,
.control-section-canvas .control-field b,
.control-section-canvas .control-output {
  font-size: 0.68rem;
  line-height: 1.2;
}

.control-section-play .control-hint,
.control-section-layout .control-hint,
.control-section-canvas .control-hint {
  font-size: 0.62rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.42);
}

.outline-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.shadow-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.style-effect-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.style-effect-card-head-actions {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  flex-shrink: 0;
}

.style-effect-show-check {
  flex-shrink: 0;
  white-space: nowrap;
}

.control-section-style .style-effect-show-check {
  color: rgba(255, 255, 255, 0.48);
}

.control-section-style .control-card-collapsible:hover .style-effect-show-check,
.control-section-style .control-card-collapsible:focus-within .style-effect-show-check {
  color: rgba(255, 255, 255, 0.92);
}

.control-section-style .style-effect-show-check .fit-check-box,
.control-section-style .style-effect-show-check:has(.fit-check-input:checked) .fit-check-box,
.control-section-style .style-effect-show-check:hover .fit-check-box,
.control-section-style .style-effect-show-check:focus-within .fit-check-box {
  background: transparent;
}

.control-section-style .style-effect-show-check:has(.fit-check-input:checked) .fit-check-box {
  border-color: rgba(255, 255, 255, 0.62);
}

.control-section-style .style-effect-show-check:has(.fit-check-input:checked) .fit-check-box::after {
  border-color: rgba(255, 255, 255, 0.92);
}

.outline-card-head .outline-color-input,
.shadow-card-head .shadow-color-input {
  flex-shrink: 0;
  width: 1.65rem;
  min-width: 1.65rem;
  min-height: 1.28rem;
  height: 1.28rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.15s var(--ease-out);
}

.outline-card-head .outline-color-input:hover,
.outline-card-head .outline-color-input:focus-visible,
.shadow-card-head .shadow-color-input:hover,
.shadow-card-head .shadow-color-input:focus-visible {
  opacity: 1;
}

.control-section-style .control-card-collapsible:hover .outline-card-head .outline-color-input,
.control-section-style .control-card-collapsible:focus-within .outline-card-head .outline-color-input,
.control-section-style .control-card-collapsible:hover .shadow-card-head .shadow-color-input,
.control-section-style .control-card-collapsible:focus-within .shadow-card-head .shadow-color-input {
  opacity: 1;
}

.control-field-pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.42rem 0.95rem;
  min-width: 0;
}

.control-field-pair-row[hidden],
.control-field-pair-row.is-fill-param-hidden,
.shape-fill-color-band[hidden] {
  display: none !important;
}

.control-field-pair-row .control-field-slider > .control-value {
  font-size: 0.68rem;
}

.control-field-pair-row .control-field-inline {
  grid-template-columns: minmax(2rem, auto) 1fr;
  align-items: center;
  column-gap: 0.28rem;
}

.control-section-layout .control-field-pair-row .control-field-inline,
.control-section-canvas .control-field-pair-row .control-field-inline {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 0.16rem;
  align-items: stretch;
  column-gap: 0;
}

.control-section-layout .control-field-pair-row .control-field-inline > .control-field-label,
.control-section-canvas .control-field-pair-row .control-field-inline > .control-field-label {
  grid-column: 1;
  grid-row: 1;
}

.control-section-layout .control-field-pair-row .control-field-inline > select,
.control-section-layout .control-field-pair-row .control-field-inline > .control-input-wrap,
.control-section-layout .control-field-pair-row .control-field-inline > output,
.control-section-canvas .control-field-pair-row .control-field-inline > select,
.control-section-canvas .control-field-pair-row .control-field-inline > .control-input-wrap,
.control-section-canvas .control-field-pair-row .control-field-inline > output {
  grid-column: 1;
  grid-row: 2;
  justify-self: stretch;
  width: 100%;
}

.control-section-play .play-section-grid {
  gap: 0.42rem;
}

.control-section-play .play-section-grid .control-field-pair-row .control-field-inline,
.control-section-play .play-section-grid-single > .control-field-inline {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: center;
  column-gap: 0.28rem;
  min-width: 0;
}

.control-section-play .play-section-grid .control-field-pair-row .control-field-inline > .control-field-label,
.control-section-play .play-section-grid-single > .control-field-inline > .control-field-label {
  grid-column: 1;
  grid-row: 1;
  white-space: nowrap;
}

.control-section-play .play-section-grid .control-field-pair-row .control-field-inline > select,
.control-section-play .play-section-grid .control-field-pair-row .control-field-inline > .control-input-wrap,
.control-section-play .play-section-grid .control-field-pair-row .control-field-inline > output,
.control-section-play .play-section-grid-single > .control-field-inline > select,
.control-section-play .play-section-grid-single > .control-field-inline > .control-input-wrap,
.control-section-play .play-section-grid-single > .control-field-inline > output {
  grid-column: 2;
  grid-row: 1;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.control-section-play .play-section-grid .control-field-pair-row .control-field-inline > output,
.control-section-play .play-section-grid-single > .control-field-inline > output {
  text-align: right;
}

.control-section-play .play-section-grid .control-input-wrap {
  min-width: 0;
  width: 100%;
  justify-content: stretch;
}

.control-section-play .play-section-grid .control-input-wrap input {
  width: 100%;
  min-width: 0;
  padding-left: 0.45rem;
  padding-right: 2.15rem;
  text-align: right;
}

.control-section-play .play-section-grid .control-input-suffix {
  right: 0.35rem;
  left: auto;
}

.control-section-layout .control-field-inline > output,
.control-section-canvas .control-field-inline > output {
  justify-self: start;
  text-align: left;
  width: auto;
}

.control-section-layout .control-input-wrap,
.control-section-canvas .control-input-wrap {
  min-width: 0;
  justify-content: flex-start;
}

.control-section-layout .control-input-wrap input,
.control-section-canvas .control-input-wrap input {
  width: 100%;
  min-width: 0;
  padding-left: 0.45rem;
  padding-right: 2.15rem;
  text-align: left;
}

.control-section-layout .control-input-suffix,
.control-section-canvas .control-input-suffix {
  right: 1.35rem;
  left: auto;
}

.control-field-pair-row .control-field-inline input[type="color"] {
  justify-self: end;
  width: 1.65rem;
  min-height: 1.45rem;
}

.outline-color-input {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.outline-color-input::-webkit-color-swatch-wrapper {
  padding: 1px;
}

.outline-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.control-section-style .control-field-slider > input[type="range"] {
  min-height: 1.2rem;
}

.fit-check-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem 1rem;
}

.fit-check-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.fit-check-option:hover {
  color: rgba(255, 255, 255, 0.92);
}

.fit-check-option:has(.fit-check-input:checked) {
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
}

.fit-check-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.fit-check-box {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 3px;
  background: transparent;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.fit-check-option:has(.fit-check-input:checked) .fit-check-box {
  background: #8fa3bc;
  border-color: #8fa3bc;
}

.fit-check-option:has(.fit-check-input:checked) .fit-check-box::after {
  content: '';
  width: 4px;
  height: 7px;
  margin-top: -1px;
  border: solid rgba(18, 18, 18, 0.92);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.fit-check-text {
  line-height: 1.2;
}

.showcase-image-style-quick {
  gap: 0.24rem;
}

.showcase-shape-fill-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.showcase-shape-fill-btn {
  width: 1.85rem;
  min-width: 1.85rem;
  height: 1.65rem;
  padding: 0.18rem;
}

.showcase-shape-fill-btn:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.showcase-shape-fill-preview {
  display: block;
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.showcase-shape-fill-preview-solid {
  background: #ffffff;
}

.showcase-shape-fill-preview-band {
  width: 1.15rem;
  background: linear-gradient(90deg, #ffffff, #0066ff);
}

.showcase-shape-fill-preview-band[hidden],
.showcase-shape-fill-preview-solid[hidden] {
  display: none !important;
}

.showcase-shape-fill-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 11.5rem;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--surface-radius);
  background: rgba(18, 18, 18, 0.94);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(12px);
}

.showcase-shape-fill-popover[hidden] {
  display: none;
}

.showcase-shape-fill-popover-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
}

.showcase-shape-fill-type-btn {
  padding: 0.16rem 0.42rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.showcase-shape-fill-type-btn:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.22);
}

.showcase-shape-fill-type-btn.active {
  background: rgba(120, 180, 255, 0.16);
  border-color: rgba(120, 180, 255, 0.42);
  color: rgba(220, 235, 255, 0.96);
}

.showcase-shape-fill-popover-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.62);
}

.showcase-shape-fill-popover-field input[type="color"] {
  width: 2rem;
  height: 1.65rem;
  padding: 0.1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.showcase-shape-fill-popover-field input[type="range"] {
  flex: 1;
  min-width: 0;
}

.showcase-shape-fill-popover-field b {
  min-width: 2rem;
  text-align: right;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}

.showcase-shape-fill-popover-field select {
  flex: 1;
  min-width: 0;
  padding: 0.22rem 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.68rem;
}

.showcase-shape-fill-popover-gradient {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.showcase-shape-fill-popover-gradient[hidden] {
  display: none;
}

.showcase-shape-fill-popover-band {
  width: 100%;
  height: 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(90deg, #ffffff, #0066ff);
}

.showcase-shape-fill-popover-stops {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.showcase-shape-fill-stop input[type="color"] {
  width: 2rem;
  height: 1.65rem;
  padding: 0.1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.showcase-shape-fill-control:hover .showcase-shape-fill-btn:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.showcase-style-icon-btn:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.showcase-style-quick-cluster {
  display: inline-flex;
  align-items: center;
  gap: 0.04rem;
  padding: 0 0.1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--btn-radius) + 1px);
  transition: background 0.18s, border-color 0.18s;
}

.showcase-style-quick-cluster:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
}

.showcase-style-quick-cluster.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.showcase-style-quick-cluster .showcase-toolbar-btn:hover:not(:disabled) {
  background: transparent;
  transform: none;
}

.showcase-style-quick-cluster:hover:not(.is-disabled) .showcase-toolbar-btn:not(:disabled) {
  color: rgba(255, 255, 255, 0.92);
}

.showcase-style-quick-cluster .showcase-toolbar-value-compact {
  min-width: auto;
  padding-right: 0.12rem;
}

.showcase-toolbar-value-compact {
  min-width: 2.1rem;
  font-size: 0.72rem;
}

.showcase-toolbar-color-btn {
  position: relative;
  overflow: hidden;
}

.showcase-toolbar-color-btn input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.showcase-toolbar-color-btn.is-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.showcase-outline-color-swatch {
  display: block;
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: #ffffff;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

.showcase-outline-color-btn:hover:not(.is-disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.showcase-toolbar-wheel-hint {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 12;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.showcase-toolbar-wheel-hint.is-anchored {
  right: auto;
  top: auto;
}

.control-section[data-tab-panel="canvas"] {
  border: none;
  padding: 0;
  gap: 0;
}

.control-groups {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.control-group:not(:last-child) {
  padding-bottom: 1rem;
  margin-bottom: 0.15rem;
}

.control-group {
  border: none;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}

.control-group-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: color 0.2s;
}

.control-group-title::before {
  content: '';
  order: 2;
  flex: 1;
  min-width: 0.75rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.control-group-title::-webkit-details-marker {
  display: none;
}

.control-group-title::after {
  content: '';
  order: 3;
  flex-shrink: 0;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.4;
  transition: transform 0.2s, opacity 0.2s;
}

.control-group[open] > .control-group-title::after {
  transform: rotate(-135deg);
}

.control-group-title:hover {
  color: rgba(255, 255, 255, 0.95);
}

.control-group-title:hover::after {
  opacity: 0.65;
}

.control-group-body {
  padding: 0.45rem 0 0.55rem var(--control-group-indent);
  border-top: none;
}

.control-group-body .control-section-grid {
  gap: 0.72rem;
}

.span-2 {
  grid-column: auto;
}

.safe-area-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.38rem;
}

.canvas-size-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.38rem;
}

.control-group-body .safe-area-grid,
.control-group-body .canvas-size-grid {
  gap: 0.58rem;
}

.control-field input.input-plain {
  -moz-appearance: textfield;
}

.control-field input.input-plain::-webkit-outer-spin-button,
.control-field input.input-plain::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.control-secondary-btn {
  width: 100%;
  min-height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.control-secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.control-inline-btn {
  min-height: 1.55rem;
  padding: 0 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.control-inline-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.control-inline-btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.object-animation-card {
  order: 0;
}

.object-animation-grid select,
.object-animation-grid input[type="number"] {
  width: 100%;
}

.style-focus-editor {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-height: 7.5rem;
  grid-area: 1 / 1;
}

.style-focus-editor[hidden] {
  display: none;
}

.style-focus-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 7.5rem;
  max-height: 7.5rem;
  min-height: 7.5rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  touch-action: none;
  overflow: hidden;
}

.style-focus-stage > .style-preview-empty,
.style-focus-stage > .style-focus-editor {
  grid-area: 1 / 1;
}

.style-focus-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  transform:
    perspective(900px)
    translateZ(var(--preview-depth, 0px))
    rotateY(var(--preview-rotate-y, 0deg))
    rotateX(var(--preview-rotate-x, 0deg))
    rotateZ(var(--preview-rotate-z, 0deg));
  transform-style: preserve-3d;
  transform-origin: center center;
  filter:
    brightness(var(--preview-brightness, 1))
    var(--preview-drop-shadow, none);
  transition: transform 0.28s var(--ease-out), filter 0.22s var(--ease-out);
}

.style-focus-frame {
  position: relative;
  width: auto;
  height: min(7.5rem, 100%);
  max-width: 100%;
  max-height: min(7.5rem, 100%);
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: var(--img-radius);
  background: transparent;
  box-shadow: inset 0 0 0 var(--img-outline-width) var(--img-border);
  pointer-events: none;
}

.style-focus-clip {
  position: absolute;
  inset: var(--img-outline-width);
  overflow: hidden;
  border-radius: max(0px, calc(var(--img-radius) - var(--img-outline-width)));
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}

.style-focus-clip.is-dragging {
  cursor: grabbing;
}

.style-focus-clip .img-fill,
.style-focus-clip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: var(--img-fit);
  object-position: 50% 50%;
  transform:
    translate(var(--preview-fill-tx, 0px), var(--preview-fill-ty, 0px))
    scale(var(--preview-fill-scale, 1));
  transform-origin: center center;
  pointer-events: none;
  user-select: none;
}

/* 预览栏：指向模式下仅显示悬停分组的样式 */
.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="perspective"] .style-focus-shell {
  filter: none;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="perspective"] .style-focus-frame {
  box-shadow: none;
  border-radius: var(--img-radius);
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="perspective"] .style-focus-clip img {
  transform: none !important;
  object-fit: cover;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="appearance"] .style-focus-shell {
  transform: none;
  filter: brightness(var(--preview-brightness, 1));
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="appearance"] .style-focus-clip img {
  transform: none !important;
  object-fit: cover;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="fill"] .style-focus-shell {
  transform: none;
  filter: none;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="fill"] .style-focus-frame {
  box-shadow: none;
  --img-outline-width: 0px;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="fill"] .style-focus-clip {
  inset: 0;
  border-radius: var(--img-radius);
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="shadow"] .style-focus-shell {
  transform: none;
  filter: var(--preview-drop-shadow, none);
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="shadow"] .style-focus-frame {
  box-shadow: none;
  --img-outline-width: 0px;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="shadow"] .style-focus-clip {
  inset: 0;
}

.panel-preview-bar[data-preview-mode="focused"][data-preview-highlight="shadow"] .style-focus-clip img {
  transform: none !important;
  object-fit: cover;
  filter: none;
}

.fit-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem;
}

.fit-tab {
  min-height: 1.65rem;
  border: none;
  border-radius: var(--btn-radius);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.56);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.fit-tab:hover {
  color: #fff;
}

.fit-tab.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.control-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.66);
}

.control-field > span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  min-width: 0;
  line-height: 1.25;
}

.control-field-label {
  min-width: 0;
}

.control-value {
  grid-column: 3;
  justify-self: end;
  min-width: 2.85rem;
  text-align: right;
  color: #fff;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.control-field b {
  color: #fff;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* 标签 + 滑块 + 数值：三列右对齐 */
.control-field-slider {
  grid-template-columns: minmax(3.1rem, auto) minmax(0, 1fr) 2.85rem;
  align-items: center;
  column-gap: 0.38rem;
  overflow: hidden;
}

.control-field-slider > .control-field-label {
  grid-column: 1;
}

.control-field-slider > input[type="range"] {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
}

.control-field-slider > .control-value {
  grid-column: 3;
}

/* 标签 + 滑块 + 数字输入：单行紧凑 */
.control-field:has(.number-slider-row) {
  grid-template-columns: minmax(3.1rem, auto) minmax(0, 1fr) 4.2rem;
  align-items: center;
  column-gap: 0.38rem;
}

.control-field:has(.number-slider-row) > span {
  grid-column: 1;
}

.control-field:has(.number-slider-row) .number-slider-row {
  display: contents;
}

.control-field:has(.number-slider-row) .number-slider {
  grid-column: 2;
  min-height: 1.65rem;
}

.control-field:has(.number-slider-row) .number-input-wrap {
  grid-column: 3;
  justify-self: end;
  width: 4.2rem;
  min-height: 1.65rem;
}

/* 标签 + 控件：数值/输入右对齐 */
.control-field-inline {
  grid-template-columns: minmax(3.1rem, 1fr) auto;
  align-items: center;
  column-gap: 0.38rem;
}

.control-field-inline > span {
  grid-column: 1;
}

.control-field-inline > select,
.control-field-inline > .control-input-wrap,
.control-field-inline > output {
  grid-column: 2;
  justify-self: end;
}

.control-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 4.8rem;
}

.control-input-wrap input {
  width: 100%;
  min-width: 3.6rem;
  padding-right: 1.45rem;
  text-align: right;
}

.control-input-suffix {
  position: absolute;
  right: 0.35rem;
  pointer-events: none;
  font-size: 0.66rem;
  color: rgba(255, 255, 255, 0.42);
}

.control-output {
  min-width: 3.6rem;
  text-align: right;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.control-field:has(> select),
.control-field:has(> output),
.control-field:has(> .input-plain),
.control-field:has(> input[type="color"]) {
  grid-template-columns: minmax(3.1rem, 1fr) auto;
  align-items: center;
  column-gap: 0.38rem;
}

.control-field:has(> select) > span,
.control-field:has(> output) > span,
.control-field:has(> .input-plain) > span,
.control-field:has(> input[type="color"]) > span {
  grid-column: 1;
}

.control-field:has(> select) > select,
.control-field:has(> output) > output,
.control-field:has(> .input-plain) > .input-plain {
  grid-column: 2;
  justify-self: end;
  text-align: right;
}

.control-field:has(> input[type="color"]) {
  grid-template-columns: minmax(3.1rem, 1fr) 2.65rem;
}

.control-field:has(> input[type="color"]) > input[type="color"] {
  grid-column: 2;
  justify-self: end;
  width: 2.65rem;
  min-height: 1.65rem;
}

.control-field:has(.fit-check-options),
.control-field:has(.fit-tabs),
.control-field-fit {
  grid-template-columns: minmax(3.1rem, auto) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.38rem;
  margin-bottom: 0.45rem;
}

.control-field:has(.fit-check-options) > span,
.control-field:has(.fit-tabs) > span {
  grid-column: 1;
}

.control-field:has(.fit-check-options) .fit-check-options,
.control-field:has(.fit-tabs) .fit-tabs {
  grid-column: 2;
  justify-self: end;
}

.shadow-controls-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.62rem;
  align-items: center;
  min-width: 0;
}

.shadow-controls-col-dial {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 4.35rem;
}

.shadow-controls-col-params {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.shadow-controls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.28rem;
  width: 100%;
}

.shadow-controls-head .control-value {
  grid-column: auto;
  min-width: 0;
  flex-shrink: 1;
  text-align: right;
}

.shadow-angle-dial {
  position: relative;
  width: 4.35rem;
  height: 4.35rem;
  margin: 0;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.55);
  cursor: grab;
  touch-action: none;
  user-select: none;
  --shadow-dial-radius: 1.28rem;
}

.shadow-angle-dial:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.42);
  outline-offset: 3px;
}

.shadow-angle-dial.is-dragging {
  cursor: grabbing;
}

.shadow-angle-dial-track {
  display: block;
  width: 100%;
  height: 100%;
}

.shadow-angle-dial-ray {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: calc(var(--shadow-dial-radius) - 0.15rem);
  margin-left: -1px;
  margin-top: calc(-1 * (var(--shadow-dial-radius) - 0.15rem));
  transform-origin: 50% 100%;
  transform: rotate(var(--shadow-dial-angle, 135deg));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.shadow-angle-dial-ray::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.control-field.span-2,
.control-field.control-field-action {
  grid-template-columns: 1fr !important;
  align-items: stretch;
}

.control-field.span-2 > span {
  grid-column: auto;
}

.control-field input,
.control-field select,
.control-field output {
  width: 100%;
  min-height: 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--btn-radius-sm);
  padding: 0.28rem 0.5rem;
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font: inherit;
  font-size: 0.72rem;
}

.control-field select {
  color-scheme: dark;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 1.75rem;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.55)' stroke='none' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.75rem;
}

.control-field select:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.08);
}

.control-field select:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.control-field select option {
  background-color: #141414;
  color: #f2f2f2;
}

.control-field select option:checked {
  background-color: #262626;
  color: #fff;
}

.control-field-font-family {
  grid-template-columns: minmax(3.1rem, auto) minmax(0, 1fr);
}

.control-field-font-family > select {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  text-align: left;
  font-size: 0.82rem;
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.control-field-font-family > select option {
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.2rem 0.35rem;
}

.control-field-font-stack {
  display: grid;
  min-width: 0;
}

.font-family-weight-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0.42rem;
  align-items: center;
}

.font-family-weight-row .font-family-select,
.font-family-weight-row #shapeFontFamilySelect,
.font-family-weight-row #shapeFontWeightSelect {
  width: 100%;
  min-width: 0;
  min-height: 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--btn-radius-sm);
  padding: 0.28rem 1.75rem 0.28rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  color-scheme: dark;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.55)' stroke='none' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.75rem;
  text-align: left;
}

.font-family-weight-row #shapeFontWeightSelect {
  padding-right: 1.45rem;
  font-size: 0.72rem;
}

.font-family-trigger-wrap {
  position: relative;
  min-width: 0;
}

.font-family-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.font-family-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 1.65rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--btn-radius-sm);
  padding: 0.28rem 1.75rem 0.28rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.55)' stroke='none' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.75rem;
  transition: border-color 0.15s, background-color 0.15s;
}

.font-family-trigger:hover,
.font-family-trigger:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background-color: rgba(255, 255, 255, 0.09);
  outline: none;
}

.font-family-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-panel.font-picker-open .font-family-trigger {
  border-color: rgba(120, 180, 255, 0.55);
  background-color: rgba(120, 180, 255, 0.1);
}

.font-picker-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: min(var(--font-picker-width, 300px), calc(100vw - var(--control-panel-width) - 2rem));
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  background: rgba(12, 12, 12, 0.94);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.35);
  z-index: 0;
}

.font-picker-panel[hidden] {
  display: none !important;
}

.font-picker-head {
  flex-shrink: 0;
  padding: 0.85rem 0.75rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.font-picker-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.font-picker-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

.font-picker-close {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: var(--btn-radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.font-picker-close svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.font-picker-close:hover,
.font-picker-close:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  outline: none;
}

.font-picker-search {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: 0.8rem;
}

.font-picker-search::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.font-picker-search:focus {
  outline: none;
  border-color: rgba(120, 180, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
}

.font-picker-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.5rem;
}

.font-picker-filter {
  padding: 0.18rem 0.48rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.font-picker-filter:hover {
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.18);
}

.font-picker-filter.active {
  background: rgba(120, 180, 255, 0.16);
  border-color: rgba(120, 180, 255, 0.42);
  color: rgba(220, 235, 255, 0.96);
}

.font-picker-count {
  margin: 0.42rem 0 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.42);
}

.font-picker-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.font-picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  padding: 0.42rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--btn-radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.font-picker-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.font-picker-item[aria-selected="true"] {
  background: rgba(120, 180, 255, 0.12);
  border-color: rgba(120, 180, 255, 0.35);
}

.font-picker-item-name {
  width: 100%;
  font-size: 0.78rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-picker-item-preview {
  width: 100%;
  font-size: 1.05rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-size-style-row {
  align-items: center;
}

.control-field-text-style {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 0;
}

.control-field-text-style .text-style-options {
  justify-content: flex-end;
}

.text-style-options {
  gap: 0.18rem;
  justify-content: flex-end;
}

.control-section-style .text-style-option,
.text-style-option {
  gap: 0;
  min-width: 1.55rem;
  min-height: 1.55rem;
  justify-content: center;
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.62);
}

.control-section-style .text-style-option:hover,
.control-section-style .text-style-option:has(.fit-check-input:checked),
.text-style-option:hover,
.text-style-option:has(.fit-check-input:checked) {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.text-style-option .fit-check-box {
  display: none;
}

.text-style-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex-shrink: 0;
}

.text-align-options {
  gap: 0.18rem;
  justify-content: flex-end;
}

.control-section-style .text-align-option,
.text-align-option {
  gap: 0;
  min-width: 1.55rem;
  min-height: 1.55rem;
  justify-content: center;
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.62);
}

.control-section-style .text-align-option:hover,
.control-section-style .text-align-option:has(.fit-check-input:checked),
.text-align-option:hover,
.text-align-option:has(.fit-check-input:checked) {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.text-align-option .fit-check-box {
  display: none;
}

.text-align-icon {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  flex-shrink: 0;
}

.control-field input[type="color"] {
  min-height: 1.65rem;
  padding: 0.15rem;
  cursor: pointer;
}

.control-field input[type="range"],
.control-field .number-slider {
  --range-track-h: 2px;
  --range-thumb-w: 11px;
  --range-thumb-h: 7px;
  --range-thumb-radius: 3px;
  --range-track-bg: rgba(255, 255, 255, 0.16);
  --range-thumb-bg: rgba(255, 255, 255, 0.92);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.1rem;
  min-height: 1.1rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.control-field input[type="range"]:focus-visible {
  outline: none;
}

.control-field input[type="range"]::-webkit-slider-runnable-track {
  height: var(--range-track-h);
  border: none;
  border-radius: 999px;
  background: var(--range-track-bg);
}

.control-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--range-thumb-w);
  height: var(--range-thumb-h);
  margin-top: calc((var(--range-track-h) - var(--range-thumb-h)) / 2);
  border: none;
  border-radius: var(--range-thumb-radius);
  background: var(--range-thumb-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: background 0.15s, transform 0.15s;
}

.control-field input[type="range"]:hover::-webkit-slider-thumb {
  background: #fff;
}

.control-field input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.06);
}

.control-field input[type="range"]::-moz-range-track {
  height: var(--range-track-h);
  border: none;
  border-radius: 999px;
  background: var(--range-track-bg);
}

.control-field input[type="range"]::-moz-range-thumb {
  width: var(--range-thumb-w);
  height: var(--range-thumb-h);
  border: none;
  border-radius: var(--range-thumb-radius);
  background: var(--range-thumb-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: background 0.15s, transform 0.15s;
}

.control-field input[type="range"]:hover::-moz-range-thumb {
  background: #fff;
}

.control-field input[type="range"]:active::-moz-range-thumb {
  transform: scale(1.06);
}

.control-field input[type="range"]::-moz-range-progress {
  height: var(--range-track-h);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.control-field-action {
  grid-column: 1 / -1;
}

.control-primary-btn {
  width: 100%;
  min-height: 1.85rem;
  padding: 0.28rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.control-primary-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.control-primary-btn:active {
  transform: scale(0.99);
}

.control-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.52);
}

.number-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.65rem;
  align-items: center;
  gap: 0.45rem;
}

.control-field .number-input-wrap {
  position: relative;
  width: 4.65rem;
  min-height: 1.65rem;
}

.control-field .number-input {
  width: 100%;
  min-height: 1.65rem;
  padding: 0.28rem 1.35rem 0.28rem 0.35rem;
  text-align: right;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.control-field .number-input::-webkit-outer-spin-button,
.control-field .number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.number-stepper {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 1.2rem;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 var(--btn-radius-sm) var(--btn-radius-sm) 0;
  overflow: hidden;
}

.number-step-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.number-step-btn svg {
  width: 0.55rem;
  height: 0.55rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.number-step-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.number-step-btn:active {
  background: rgba(255, 255, 255, 0.24);
}

.control-field input[type="number"]:not(.number-input) {
  padding-right: 1.45rem;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

.control-field input[type="number"]:not(.number-input)::-webkit-outer-spin-button,
.control-field input[type="number"]:not(.number-input)::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.control-field input[readonly] {
  color: rgba(255, 255, 255, 0.72);
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-content: end;
}

.checkbox-field input {
  width: 1rem;
  min-height: 1rem;
  accent-color: #fff;
}

.checkbox-field span {
  display: block;
}

.panel-action {
  min-height: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--btn-radius-sm);
  background: rgba(255, 255, 255, 0.045);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.play-state-btn {
  min-height: 2.35rem;
}

body.position-edit-mode .play-state-btn {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.panel-action:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sequence-together .slide.entering .img-wrap,
.sequence-together .slide.entering .layer-item {
  animation-delay: 0s !important;
}

.sequence-stagger .slide.entering .img-wrap,
.sequence-stagger .slide.entering .layer-item {
  animation-delay: calc(var(--order, 0) * var(--appear-delay, 0.08s)) !important;
}

.slide.entering [data-anim-enter]:not([data-anim-enter="none"]) > .img-stack,
.slide.entering [data-anim-enter]:not([data-anim-enter="none"]) > .shape-canvas,
.slide.exiting [data-anim-exit]:not([data-anim-exit="none"]) > .img-stack,
.slide.exiting [data-anim-exit]:not([data-anim-exit="none"]) > .shape-canvas,
.slide.live [data-anim-idle]:not([data-anim-idle="none"]) > .img-stack,
.slide.live [data-anim-idle]:not([data-anim-idle="none"]) > .shape-canvas,
.slide .img-wrap.is-object-anim-preview > .img-stack,
.slide .shape-wrap.is-object-anim-preview > .shape-canvas,
.slide .img-wrap.is-emphasis-playing[data-anim-emphasis]:not([data-anim-emphasis="none"]) > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis]:not([data-anim-emphasis="none"]) > .shape-canvas {
  animation-duration: var(--object-anim-duration, 0.8s) !important;
  animation-delay: var(--object-anim-delay, 0s) !important;
  animation-timing-function: var(--object-anim-ease, ease-out) !important;
  animation-fill-mode: both !important;
  animation-iteration-count: 1 !important;
  transform-origin: center center;
  will-change: transform, opacity, filter, clip-path, stroke-dashoffset;
}

.slide .img-wrap.is-object-anim-preview > .img-stack,
.slide .shape-wrap.is-object-anim-preview > .shape-canvas {
  animation-name: var(--object-preview-animation) !important;
}

.slide.entering [data-anim-enter="fade"] > .img-stack,
.slide.entering [data-anim-enter="fade"] > .shape-canvas { animation-name: objectFadeIn !important; }
.slide.entering [data-anim-enter="fade-up"] > .img-stack,
.slide.entering [data-anim-enter="fade-up"] > .shape-canvas { animation-name: objectFadeUp !important; }
.slide.entering [data-anim-enter="fade-down"] > .img-stack,
.slide.entering [data-anim-enter="fade-down"] > .shape-canvas { animation-name: objectFadeDown !important; }
.slide.entering [data-anim-enter="fly-left"] > .img-stack,
.slide.entering [data-anim-enter="fly-left"] > .shape-canvas { animation-name: objectFlyLeft !important; }
.slide.entering [data-anim-enter="fly-right"] > .img-stack,
.slide.entering [data-anim-enter="fly-right"] > .shape-canvas { animation-name: objectFlyRight !important; }
.slide.entering [data-anim-enter="scale-pop"] > .img-stack,
.slide.entering [data-anim-enter="scale-pop"] > .shape-canvas { animation-name: objectScalePop !important; }
.slide.entering [data-anim-enter="rotate-in"] > .img-stack,
.slide.entering [data-anim-enter="rotate-in"] > .shape-canvas { animation-name: objectRotateIn !important; }
.slide.entering [data-anim-enter="draw"] > .img-stack,
.slide.entering [data-anim-enter="draw"] > .shape-canvas { animation-name: objectDrawIn !important; }

.slide.exiting [data-anim-exit="fade-out"] > .img-stack,
.slide.exiting [data-anim-exit="fade-out"] > .shape-canvas { animation-name: objectFadeOut !important; }
.slide.exiting [data-anim-exit="fade-up-out"] > .img-stack,
.slide.exiting [data-anim-exit="fade-up-out"] > .shape-canvas { animation-name: objectFadeUpOut !important; }
.slide.exiting [data-anim-exit="fade-down-out"] > .img-stack,
.slide.exiting [data-anim-exit="fade-down-out"] > .shape-canvas { animation-name: objectFadeDownOut !important; }
.slide.exiting [data-anim-exit="scale-out"] > .img-stack,
.slide.exiting [data-anim-exit="scale-out"] > .shape-canvas { animation-name: objectScaleOut !important; }
.slide.exiting [data-anim-exit="rotate-out"] > .img-stack,
.slide.exiting [data-anim-exit="rotate-out"] > .shape-canvas { animation-name: objectRotateOut !important; }
.slide.exiting [data-anim-exit="flash-out"] > .img-stack,
.slide.exiting [data-anim-exit="flash-out"] > .shape-canvas { animation-name: objectFlashOut !important; }

.slide.live [data-anim-idle="shake"] > .img-stack,
.slide.live [data-anim-idle="shake"] > .shape-canvas { animation-name: objectShake !important; }
.slide.live [data-anim-idle="pulse"] > .img-stack,
.slide.live [data-anim-idle="pulse"] > .shape-canvas { animation-name: objectPulse !important; }
.slide.live [data-anim-idle="breathe"] > .img-stack,
.slide.live [data-anim-idle="breathe"] > .shape-canvas { animation-name: objectBreathe !important; }
.slide.live [data-anim-idle="swing"] > .img-stack,
.slide.live [data-anim-idle="swing"] > .shape-canvas { animation-name: objectSwing !important; }
.slide.live [data-anim-idle="bounce"] > .img-stack,
.slide.live [data-anim-idle="bounce"] > .shape-canvas { animation-name: objectBounce !important; }
.slide.live [data-anim-idle-repeat="infinite"] > .img-stack,
.slide.live [data-anim-idle-repeat="infinite"] > .shape-canvas {
  animation-iteration-count: infinite !important;
}

.slide .img-wrap.is-emphasis-playing[data-anim-emphasis="shake"] > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis="shake"] > .shape-canvas { animation-name: objectShake !important; }
.slide .img-wrap.is-emphasis-playing[data-anim-emphasis="pulse"] > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis="pulse"] > .shape-canvas { animation-name: objectPulse !important; }
.slide .img-wrap.is-emphasis-playing[data-anim-emphasis="breathe"] > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis="breathe"] > .shape-canvas {
  animation-name: objectBreathe !important;
  animation-iteration-count: 2 !important;
}
.slide .img-wrap.is-emphasis-playing[data-anim-emphasis="swing"] > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis="swing"] > .shape-canvas { animation-name: objectSwing !important; }
.slide .img-wrap.is-emphasis-playing[data-anim-emphasis="bounce"] > .img-stack,
.slide .shape-wrap.is-emphasis-playing[data-anim-emphasis="bounce"] > .shape-canvas { animation-name: objectBounce !important; }

@keyframes objectFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes objectFadeUp {
  from { opacity: 0; transform: translateY(34px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes objectFadeDown {
  from { opacity: 0; transform: translateY(-34px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes objectFlyLeft {
  from { opacity: 0; transform: translateX(-72px); filter: blur(8px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}

@keyframes objectFlyRight {
  from { opacity: 0; transform: translateX(72px); filter: blur(8px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}

@keyframes objectScalePop {
  0% { opacity: 0; transform: scale(0.72); }
  68% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes objectRotateIn {
  from { opacity: 0; transform: rotate(-18deg) scale(0.88); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

@keyframes objectDrawIn {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    filter: blur(0);
  }
}

@keyframes objectFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes objectFadeUpOut {
  from { opacity: 1; transform: translateY(0); filter: blur(0); }
  to { opacity: 0; transform: translateY(-34px); filter: blur(6px); }
}

@keyframes objectFadeDownOut {
  from { opacity: 1; transform: translateY(0); filter: blur(0); }
  to { opacity: 0; transform: translateY(34px); filter: blur(6px); }
}

@keyframes objectScaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.72); }
}

@keyframes objectRotateOut {
  from { opacity: 1; transform: rotate(0) scale(1); }
  to { opacity: 0; transform: rotate(16deg) scale(0.86); }
}

@keyframes objectFlashOut {
  0% { opacity: 1; transform: scale(1); }
  30% { opacity: 0.18; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(0.92); filter: blur(8px); }
}

@keyframes objectShake {
  0%, 100% { transform: translateX(0); }
  15%, 45%, 75% { transform: translateX(-8px); }
  30%, 60%, 90% { transform: translateX(8px); }
}

@keyframes objectPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes objectBreathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.04); filter: brightness(1.12); }
}

@keyframes objectSwing {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(8deg); }
  40% { transform: rotate(-7deg); }
  60% { transform: rotate(5deg); }
  80% { transform: rotate(-3deg); }
}

@keyframes objectBounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-20px); }
  65% { transform: translateY(6px); }
}

/* ══════════════════════════════════════
   后 5 张 — 多图层次布局 (3–8 张)
   ══════════════════════════════════════ */

.depth-stage {
  perspective: var(--wrap-perspective-default, 1200px);
  perspective-origin: 50% 48%;
  transform-style: preserve-3d;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.layer-item {
  --depth-mult: 1;
  position: absolute;
  left: calc(50% + var(--lx-r, 0) * var(--slide-w));
  top: calc(50% + var(--ly-r, 0) * var(--slide-h));
  opacity: 1;
  filter: brightness(var(--layer-bright, 1));
  z-index: var(--layer-z, auto);
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transform:
    translate(-50%, -50%)
    translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1)))
    rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
    rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
    rotateZ(calc(var(--rz, 0deg) * var(--depth-mult, 1)))
    scale(var(--scale, 1));
  transition:
    transform 0.65s var(--ease-out),
    opacity 0.5s var(--ease-out),
    filter 0.5s var(--ease-out),
    box-shadow 0.5s var(--ease-out),
    width 0.45s var(--ease-out);
}

.layer-item.featured {
  filter: brightness(1.05);
  box-shadow: 0 0 60px rgba(255, 255, 255, 0.06);
}

.layer-item:not(.featured) {
  --layer-bright: 0.94;
}

.layer-item:hover {
  --layer-bright: 1;
}

.layer-item.featured:hover {
  transform:
    translate(-50%, -50%)
    translateZ(calc((var(--lz, 0px) + 40px) * var(--depth-mult, 1)))
    rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
    rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
    rotateZ(calc(var(--rz, 0deg) * var(--depth-mult, 1)))
    scale(calc(var(--scale, 1) * 1.04));
}

.layer-item:not(.featured):hover {
  transform:
    translate(-50%, -50%)
    translateZ(calc((var(--lz, 0px) + 55px) * var(--depth-mult, 1)))
    rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
    rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
    rotateZ(calc(var(--rz, 0deg) * var(--depth-mult, 1)))
    scale(calc(var(--scale, 1) * 1.08));
  filter: brightness(1);
}


/* ── Cascade 瀑布层次 ── */
[data-layout="cascade"].entering .layer-item {
  animation: cascadeEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.07s);
}

[data-layout="cascade"].entering .layer-item .ghost-1 {
  animation: cascadeGhost var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.07s);
}

[data-layout="cascade"].exiting .layer-item .ghost-1 {
  animation: cascadeExitGhost 0.58s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.04s);
}

@keyframes cascadeEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-420px * var(--depth-mult, 1))) translateX(calc(var(--lx-r, 0) * var(--slide-w) * -0.5)) scale(0.55);
    filter: blur(16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry, 0deg)) scale(var(--scale, 1));
    filter: brightness(var(--layer-bright, 1));
  }
}

@keyframes cascadeGhost {
  0%   { opacity: 0.45; transform: translateX(-30px) scale(0.9); filter: blur(10px); }
  100% { opacity: 0; transform: none; }
}

@keyframes cascadeExitGhost {
  to { opacity: 0; transform: translateX(calc(-40px * var(--exit-dir, 1))); filter: blur(18px); }
}

/* ── Stack 叠卡 ── */
[data-layout="stack"].entering .layer-item {
  animation: stackEnter var(--duration) var(--ease-spring) both;
  animation-delay: calc(var(--order, 0) * 0.09s);
}

[data-layout="stack"].entering .layer-item .ghost-2 {
  animation: stackGhost var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.09s);
}

[data-layout="stack"].exiting .layer-item .ghost-1 {
  animation: stackExitGhost 0.55s var(--ease-in-out) both;
}

@keyframes stackEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-500px * var(--depth-mult, 1))) rotateY(25deg) rotateX(-12deg) scale(0.5);
    filter: blur(18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)) scale(var(--scale, 1));
    filter: brightness(var(--layer-bright, 1));
  }
}

@keyframes stackGhost {
  0%   { opacity: 0.4; transform: translateY(40px) rotateZ(6deg); filter: blur(14px); }
  100% { opacity: 0; transform: none; }
}

@keyframes stackExitGhost {
  to { opacity: 0; transform: translateY(50px) rotateZ(8deg); filter: blur(20px); }
}

[data-layout="stack"] .layer-item:hover {
  animation: stackHover 0.6s var(--ease-out) forwards;
}

@keyframes stackHover {
  to {
    transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(0deg) rotateX(0deg) scale(calc(var(--scale, 1) * 1.06));
  }
}

/* ── Scatter 散落 ── */
[data-layout="scatter"].entering .layer-item {
  animation: scatterEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.06s);
}

[data-layout="scatter"].entering .layer-item .ghost-1 {
  animation: scatterGhost var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.06s);
}

[data-layout="scatter"].exiting .layer-item .ghost-1 {
  animation: scatterExitGhost 0.58s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.03s);
}

@keyframes scatterEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-380px * var(--depth-mult, 1))) rotateY(calc(var(--ry, 0deg) * 2)) scale(0.4);
    filter: blur(20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry, 0deg)) scale(var(--scale, 1));
    filter: brightness(var(--layer-bright, 1));
  }
}

@keyframes scatterGhost {
  0%   { opacity: 0.5; transform: scale(1.25); filter: blur(12px); }
  100% { opacity: 0; transform: none; }
}

@keyframes scatterExitGhost {
  to { opacity: 0; transform: scale(1.3); filter: blur(22px); }
}

[data-layout="scatter"] .layer-item.featured:hover {
  transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(0deg) scale(calc(var(--scale, 1) * 1.05));
}

/* ── Orbit 轨道 ── */
[data-layout="orbit"].entering .layer-item {
  animation: orbitEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.08s);
}

[data-layout="orbit"].entering .layer-item:first-child .ghost-1,
[data-layout="orbit"].entering .layer-item:first-child .ghost-2 {
  animation: orbitBurst 1s var(--ease-out) both;
}

[data-layout="orbit"].exiting .layer-item .ghost-1 {
  animation: orbitExitGhost 0.58s var(--ease-in-out) both;
}

@keyframes orbitEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-450px * var(--depth-mult, 1))) rotateY(180deg) scale(0.3);
    filter: blur(16px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry, 0deg)) scale(var(--scale, 1));
    filter: brightness(var(--layer-bright, 1));
  }
}

@keyframes orbitBurst {
  0%   { opacity: 0.55; transform: scale(2); filter: blur(20px); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes orbitExitGhost {
  to { opacity: 0; transform: scale(1.5); filter: blur(24px); }
}

[data-layout="orbit"] .layer-item:first-child:hover {
  animation: orbitPulse 2s var(--ease-in-out) infinite;
}

@keyframes orbitPulse {
  0%, 100% { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) scale(var(--scale, 1)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) scale(calc(var(--scale, 1) * 1.03)); }
}

/* ── Gallery 景深墙 ── */
[data-layout="gallery"].entering .layer-item {
  animation: galleryEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.065s);
}

[data-layout="gallery"].entering .layer-item .ghost-1 {
  animation: galleryGhost var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.065s);
}

[data-layout="gallery"].exiting .layer-item .ghost-1 {
  animation: galleryExitGhost 0.55s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.04s);
}

@keyframes galleryEnter {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateZ(calc(-400px * var(--depth-mult, 1))) rotateX(18deg) scale(0.65);
    filter: blur(14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)) scale(var(--scale, 1));
    filter: brightness(var(--layer-bright, 1));
  }
}

@keyframes galleryGhost {
  0%   { opacity: 0.4; transform: translateY(30px); filter: blur(10px); }
  100% { opacity: 0; transform: none; }
}

@keyframes galleryExitGhost {
  to { opacity: 0; transform: translateY(-40px); filter: blur(16px); }
}

[data-layout="gallery"] .layer-item.featured:hover {
  transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateX(0deg) rotateZ(var(--rz, 0deg)) scale(calc(var(--scale, 1) * 1.04));
}

/* ══════════════════════════════════════
   第 11–15 张 — 规律排版布局
   ══════════════════════════════════════ */

.pattern-stage {
  perspective: var(--wrap-perspective-default, 1200px);
  perspective-origin: 50% 48%;
  transform-style: preserve-3d;
  overflow: visible;
}

/* ── ring-focus 透视环绕 ── */
[data-layout="ring-focus"].entering .layer-item:first-child {
  animation: ringCenterEnter var(--duration) var(--ease-spring) both;
}

[data-layout="ring-focus"].entering .layer-item:not(:first-child) {
  animation: ringSatEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.06s);
}

[data-layout="ring-focus"].exiting .layer-item:first-child {
  animation: ringCenterExit 0.65s var(--ease-in-out) both;
}

[data-layout="ring-focus"].exiting .layer-item:not(:first-child) {
  animation: ringSatExit 0.65s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.04s);
}

.slide.live[data-layout="ring-focus"] .layer-item:first-child {
  animation: idleRingCenter 6s ease-in-out infinite;
}

.slide.live[data-layout="ring-focus"] .layer-item:not(:first-child) {
  animation: idleRingSat 7s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.5s);
}

@keyframes ringCenterEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-400px * var(--depth-mult, 1))) scale(0.5); filter: blur(16px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) scale(var(--scale)); filter: none; }
}

@keyframes ringSatEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-350px * var(--depth-mult, 1))) rotateY(calc(var(--ry) * 2)) scale(0.4); filter: blur(14px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); filter: brightness(var(--layer-bright, 1)); }
}

@keyframes ringCenterExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-300px * var(--depth-mult, 1))) scale(0.7); filter: blur(18px); }
}

@keyframes ringSatExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-250px * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 30deg * var(--exit-dir, 1))) scale(0.5); filter: blur(16px); }
}

@keyframes idleRingCenter {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(0deg) rotateX(0deg) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(3deg) rotateX(-2deg) scale(calc(var(--scale) * 1.02)); }
}

@keyframes idleRingSat {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 5deg)) rotateZ(calc(var(--rz) + 3deg)) scale(var(--scale)); }
}

/* ── pyramid 大到小层叠 ── */
[data-layout="pyramid"].entering .layer-item {
  animation: pyramidEnter var(--duration) var(--ease-out) both;
  animation-delay: calc((10 - var(--order, 0)) * 0.05s);
}

[data-layout="pyramid"].exiting .layer-item {
  animation: pyramidExit 0.62s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.05s);
}

.slide.live[data-layout="pyramid"] .layer-item {
  animation: idlePyramid 8s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.7s);
}

@keyframes pyramidEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-450px * var(--depth-mult, 1))) rotateX(20deg) scale(1.3); filter: blur(16px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); filter: brightness(var(--layer-bright, 1)); }
}

@keyframes pyramidExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-380px * var(--depth-mult, 1))) rotateX(-15deg) rotateZ(calc(15deg * var(--exit-dir, 1))) scale(0.6); filter: blur(18px); }
}

@keyframes idlePyramid {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 2deg)) rotateZ(calc(var(--rz) + 1.5deg)) scale(var(--scale)); }
}

/* ── tunnel 透视隧道 ── */
[data-layout="tunnel"].entering .layer-item {
  animation: tunnelEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.055s);
}

[data-layout="tunnel"].exiting .layer-item {
  animation: tunnelExit 0.65s var(--ease-in-out) both;
  animation-delay: calc((10 - var(--order, 0)) * 0.035s);
}

.slide.live[data-layout="tunnel"] .layer-item {
  animation: idleTunnel 7.5s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.6s);
}

@keyframes tunnelEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-500px * var(--depth-mult, 1))) rotateY(calc(var(--ry) * 2)) scale(0.35); filter: blur(18px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); filter: brightness(var(--layer-bright, 1)); }
}

@keyframes tunnelExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-420px * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 40deg * var(--exit-dir, 1))) scale(0.4); filter: blur(20px); }
}

@keyframes idleTunnel {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 3deg)) rotateX(calc(var(--rx) - 2deg)) scale(var(--scale)); }
}

/* ── arc-rows 弧形多行 ── */
[data-layout="arc-rows"].entering .layer-item {
  animation: arcEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.06s);
}

[data-layout="arc-rows"].exiting .layer-item {
  animation: arcExit 0.62s var(--ease-in-out) both;
  animation-delay: calc((10 - var(--order, 0)) * 0.04s);
}

.slide.live[data-layout="arc-rows"] .layer-item {
  animation: idleArc 6.5s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.55s);
}

@keyframes arcEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateY(80px) translateZ(calc(-300px * var(--depth-mult, 1))) rotateX(25deg) scale(0.6); filter: blur(14px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); filter: brightness(var(--layer-bright, 1)); }
}

@keyframes arcExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateY(-60px) translateZ(calc(-280px * var(--depth-mult, 1))) rotateX(-20deg) scale(0.65); filter: blur(16px); }
}

@keyframes idleArc {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateY(calc(var(--ry) + 4deg)) translateY(-5px) scale(var(--scale)); }
}

/* ── spiral 螺旋 ── */
[data-layout="spiral"].entering .layer-item {
  animation: spiralEnter var(--duration) var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 0.07s);
}

[data-layout="spiral"].exiting .layer-item {
  animation: spiralExit 0.65s var(--ease-in-out) both;
  animation-delay: calc(var(--order, 0) * 0.045s);
}

.slide.live[data-layout="spiral"] .layer-item:first-child {
  animation: idleSpiralCenter 5.5s ease-in-out infinite;
}

.slide.live[data-layout="spiral"] .layer-item:not(:first-child) {
  animation: idleSpiralArm 8s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * -0.65s);
}

@keyframes spiralEnter {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-400px * var(--depth-mult, 1))) rotateZ(calc(var(--rz) + 90deg)) scale(0.3); filter: blur(16px); }
  to   { opacity: 1; transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); filter: brightness(var(--layer-bright, 1)); }
}

@keyframes spiralExit {
  to { opacity: 0; transform: translate(-50%, -50%) translateZ(calc(-350px * var(--depth-mult, 1))) rotateZ(calc(var(--rz) - 60deg * var(--exit-dir, 1))) scale(0.45); filter: blur(18px); }
}

@keyframes idleSpiralCenter {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateZ(2deg) scale(calc(var(--scale) * 1.02)); }
}

@keyframes idleSpiralArm {
  0%, 100% { transform: translate(-50%, -50%) translateZ(var(--lz, 0px)) rotateY(var(--ry)) rotateX(var(--rx)) rotateZ(var(--rz)) scale(var(--scale)); }
  50%      { transform: translate(-50%, -50%) translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1))) rotateZ(calc(var(--rz) + 6deg)) rotateY(calc(var(--ry) + 3deg)) scale(var(--scale)); }
}

/* 15 张圆点导航 */
.nav-dots {
  flex-wrap: wrap;
  max-width: 90vw;
  justify-content: center;
  row-gap: 0.45rem;
}

/* ── Responsive ── */
/* Canvas editing: no hover highlight / scale on images; 8-point selection frame. */
.rotate-handle,
.resize-handle {
  display: none !important;
}

body.position-edit-mode .img-wrap:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging) {
  filter: none;
}

body.position-edit-mode .img-wrap:hover:not(.selected):not(.rotating):not(.resizing):not(.position-dragging)::after {
  box-shadow: none;
}

body.position-edit-mode [data-layout="single"] .img-wrap:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-2deg) rotateX(1deg);
}

body.position-edit-mode [data-layout="single"] .img-wrap:hover .img-fill,
body.position-edit-mode [data-layout="single"] .img-wrap:hover img,
body.position-edit-mode [data-layout="duo"] .featured:hover .img-fill,
body.position-edit-mode [data-layout="duo"] .featured:hover img,
body.position-edit-mode [data-layout="trio"] .center:hover .img-fill,
body.position-edit-mode [data-layout="trio"] .center:hover img,
body.position-edit-mode [data-layout="trio"] .side:hover .img-fill,
body.position-edit-mode [data-layout="trio"] .side:hover img,
body.position-edit-mode [data-layout="fan"] .fan-item:hover .img-fill,
body.position-edit-mode [data-layout="fan"] .fan-item:hover img,
body.position-edit-mode [data-layout="reveal"] .reveal-wrap:hover .img-fill,
body.position-edit-mode [data-layout="reveal"] .reveal-wrap:hover img,
body.position-edit-mode .layer-item:hover .img-fill,
body.position-edit-mode .layer-item:hover img,
body.position-edit-mode .img-wrap:hover .img-fill,
body.position-edit-mode .img-wrap:hover img {
  transform:
    translate(var(--img-fill-tx, 0px), var(--img-fill-ty, 0px))
    scale(var(--img-fill-scale, var(--img-inner-scale, 1)));
  filter: none;
}

body.position-edit-mode [data-layout="duo"] .featured:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-4deg);
  filter: brightness(1.05);
}

body.position-edit-mode [data-layout="duo"] .secondary:hover {
  animation: none;
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(6deg) translateY(-2vh);
  filter: brightness(0.92);
}

body.position-edit-mode [data-layout="trio"] .side.left:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(18deg) translateZ(-80px);
  filter: brightness(0.9);
}

body.position-edit-mode [data-layout="trio"] .side.right:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) rotateY(-18deg) translateZ(-80px);
  filter: brightness(0.9);
}

body.position-edit-mode [data-layout="trio"] .center:hover {
  transform: perspective(var(--wrap-perspective, 1200px)) translateZ(40px);
  box-shadow: none;
}

body.position-edit-mode [data-layout="fan"] .fan-item[data-fan="0"]:hover {
  transform: rotateY(28deg) translateX(-38vw) translateZ(-120px);
  filter: brightness(0.92);
}

body.position-edit-mode [data-layout="fan"] .fan-item[data-fan="1"]:hover {
  transform: translateZ(80px);
}

body.position-edit-mode [data-layout="fan"] .fan-item[data-fan="2"]:hover {
  transform: rotateY(-28deg) translateX(38vw) translateZ(-120px);
  filter: brightness(0.92);
}

body.position-edit-mode [data-layout="fan"] .fan-item[data-fan="3"]:hover {
  transform: rotateY(0deg) translateY(28vh) translateZ(-200px) scale(0.85);
  filter: brightness(0.88);
}

body.position-edit-mode [data-layout="fan"] .fan-item:not(.featured):hover {
  opacity: 1;
}

body.position-edit-mode [data-layout="reveal"] .reveal-wrap:hover {
  transform: rotateX(2deg);
}

body.position-edit-mode [data-layout="stack"] .layer-item:hover {
  animation: none;
}

body.position-edit-mode .layer-item:not(.featured):hover {
  --layer-bright: 0.94;
  filter: brightness(0.94);
}

body.position-edit-mode .layer-item.featured:hover,
body.position-edit-mode .layer-item:not(.featured):hover {
  transform:
    translate(-50%, -50%)
    translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1)))
    rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
    rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
    rotateZ(calc(var(--rz, 0deg) * var(--depth-mult, 1)))
    scale(var(--scale, 1));
}

body.position-edit-mode [data-layout="scatter"] .layer-item.featured:hover,
body.position-edit-mode [data-layout="gallery"] .layer-item.featured:hover {
  transform:
    translate(-50%, -50%)
    translateZ(calc(var(--lz, 0px) * var(--depth-mult, 1)))
    rotateY(calc(var(--ry, 0deg) * var(--depth-mult, 1)))
    rotateX(calc(var(--rx, 0deg) * var(--depth-mult, 1)))
    rotateZ(calc(var(--rz, 0deg) * var(--depth-mult, 1)))
    scale(var(--scale, 1));
}

body.position-edit-mode .slide.dist-flattened .img-wrap:hover {
  transform: none !important;
  filter: none;
}

body.position-edit-mode .slide.dist-flattened .img-wrap:hover .img-stack {
  box-shadow: var(--img-shadow);
}

body.position-edit-mode .slide.dist-flattened .img-wrap:hover .img-fill,
body.position-edit-mode .slide.dist-flattened .img-wrap:hover img {
  transform:
    translate(var(--img-fill-tx, 0px), var(--img-fill-ty, 0px))
    scale(var(--img-fill-scale, var(--img-inner-scale, 1)));
}

body.position-edit-mode .img-wrap .img-fill,
body.position-edit-mode .img-wrap img {
  transition: filter 0.5s var(--ease-out), opacity 0.4s;
}

@media (max-width: 768px) {
  .app {
    padding: 4rem 0.8rem 4.6rem;
  }

  .image-sidebar {
    max-width: calc(100vw - 2rem);
  }

  .top-bar { padding: 1rem 1.2rem; }

  [data-layout="single"] .img-wrap,
  [data-layout="reveal"] .reveal-wrap {
    --slot-w: 86%;
    --slot-max-h: 72%;
  }

  [data-layout="duo"] .slide-inner {
    flex-direction: column;
    gap: 1rem;
  }

  [data-layout="duo"] .featured,
  [data-layout="duo"] .secondary {
    --slot-w: 78%;
    --slot-max-h: 44%;
    transform: none;
    align-self: center;
  }

  [data-layout="trio"] .slide-inner {
    flex-wrap: wrap;
    justify-content: center;
  }

  [data-layout="trio"] .center {
    --slot-w: 76%;
    --slot-max-h: 46%;
    order: -1;
    transform: none;
  }

  [data-layout="trio"] .side {
    --slot-w: 42%;
    --slot-max-h: 34%;
    transform: none;
    opacity: 0.8;
  }

  [data-layout="fan"] .fan-item {
    --slot-w: 38%;
    --slot-max-h: 36%;
  }

  [data-layout="fan"] .fan-item[data-fan="0"] { transform: translateX(-22vw) translateY(-8vh); }
  [data-layout="fan"] .fan-item[data-fan="1"] { --slot-w: 48%; --slot-max-h: 42%; transform: translateY(-2vh); }
  [data-layout="fan"] .fan-item[data-fan="2"] { transform: translateX(22vw) translateY(-8vh); }
  [data-layout="fan"] .fan-item[data-fan="3"] { transform: translateY(18vh); }

  :root {
    --slide-strip-width: 92px;
  }

  .slide-strip-item {
    padding: 0.28rem;
    border-radius: 10px;
  }

  .slide-strip-num {
    font-size: 0.62rem;
  }

  .control-panel {
    width: min(var(--control-panel-width), calc(100vw - 2.8rem));
    right: 0;
    bottom: 0;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .control-section-grid {
    grid-template-columns: 1fr;
  }

  .panel-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: var(--surface-radius);
  }

  .tab-btn {
    min-height: 1.48rem;
  }

  .depth-stage .layer-item,
  .pattern-stage .layer-item {
    --slot-w: 34%;
    --slot-max-h: 36%;
  }

  [data-layout="ring-focus"] .layer-item:first-child,
  [data-layout="tunnel"] .layer-item:nth-child(n),
  [data-layout="pyramid"] .layer-item:first-child {
    --slot-w: 46%;
    --slot-max-h: 44%;
  }
}

/* ── Layer canvas states ── */
.img-wrap.layer-canvas-hidden {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.position-edit-mode .img-wrap.layer-locked {
  pointer-events: none;
}

.img-wrap.layer-locked.selected .img-selection-frame {
  opacity: 0 !important;
  pointer-events: none !important;
}

.panel-scroll:has(.control-section-layers.active) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-scroll:has(.control-section-layers.active) .control-grid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Layers panel (PS-like) ── */
.control-section-layers {
  gap: 0;
  padding: 0;
  min-height: 0;
  flex: 1 1 auto;
  border: none;
  background: transparent;
}

.control-section-layers.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.layers-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.panel-scroll .control-section:not(.control-section-layers) {
  border: none;
  background: transparent;
  padding: 0.15rem 0 var(--panel-inset-bottom) 0;
  gap: 0;
}

.layers-panel-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  position: relative;
  padding: 0.2rem var(--panel-inset-right) 0.2rem var(--panel-inset-left);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.layer-drop-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  margin: 0;
  border-radius: 999px;
  background: rgba(0, 168, 255, 0.95);
  box-shadow: 0 0 6px rgba(0, 168, 255, 0.55);
  pointer-events: none;
  z-index: 5;
  transform: translateY(-1px);
}

.layer-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  margin: 0;
  padding: 0.28rem 0.3rem;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}

.layer-row:last-child {
  border-bottom: none;
}

.layer-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.layer-row.is-selected {
  background: rgba(0, 168, 255, 0.18);
  box-shadow: inset 3px 0 0 rgba(0, 168, 255, 0.92);
}

.layer-row.is-selected .layer-row-name {
  color: #fff;
  font-weight: 500;
}

.layer-row.is-hidden {
  opacity: 0.48;
}

.layer-row.is-hidden .layer-row-name {
  color: rgba(255, 255, 255, 0.38);
}

.layer-row.is-locked .layer-row-name {
  font-style: italic;
}

.layer-row.is-dragging {
  opacity: 0.42;
}

.layer-row.is-drop-target {
  background: rgba(0, 168, 255, 0.08);
}

.layer-row-thumb {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: none;
}

.layer-row-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.layer-row-type-icon {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.05);
  border: none;
}

.layer-row-name {
  padding-left: 0.4rem;
  font-size: 0.76rem;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.layer-row-name-input {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.06rem 0.32rem;
  border: 1px solid rgba(0, 168, 255, 0.55);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.2;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(0, 168, 255, 0.18);
}

.layer-row.is-rename-active {
  background: rgba(0, 168, 255, 0.14);
  box-shadow: inset 3px 0 0 rgba(0, 168, 255, 0.92);
}

.layer-row.is-rename-active.is-selected {
  background: rgba(0, 168, 255, 0.2);
}

.layer-row-action {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 1;
}

.layer-row-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.layer-row-visible {
  margin-right: 0.05rem;
}

.layer-row-lock {
  margin-left: 0.05rem;
}

.layer-row-action svg {
  width: 0.82rem;
  height: 0.82rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.layers-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.1rem var(--panel-inset-right) 0 var(--panel-inset-left);
  border-top: none;
  background: transparent;
  flex-shrink: 0;
}

.layers-toolbar-btn {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.layers-toolbar-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.layers-toolbar-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.layers-toolbar-btn svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: currentColor;
  stroke: none;
  transition: fill 0.15s, opacity 0.15s;
}

.layers-toolbar-btn-danger {
  color: rgba(255, 160, 160, 0.55);
}

.layers-toolbar-btn-danger:hover:not(:disabled) {
  background: rgba(220, 60, 60, 0.16);
  color: #ffd0d0;
}

.layers-toolbar-sep {
  width: 1px;
  height: 0.78rem;
  margin: 0 0.05rem 0 auto;
  background: rgba(255, 255, 255, 0.07);
}

.layer-thumb-preview {
  position: fixed;
  z-index: 12000;
  pointer-events: none;
  padding: 0.35rem;
  border-radius: var(--surface-radius);
  background: rgba(18, 18, 18, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.layer-thumb-preview img {
  display: block;
  max-width: min(42vw, 320px);
  max-height: min(42vh, 240px);
  border-radius: 3px;
}

.layer-row-tooltip {
  position: fixed;
  z-index: 12001;
  pointer-events: none;
  max-width: min(72vw, 420px);
  padding: 0.45rem 0.55rem;
  border-radius: var(--btn-radius);
  background: rgba(16, 16, 16, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}
