/***** Studio 页面专用样式，从 prototype/css/desktop-common.css 提取 *****/

.studio-page { background: var(--bg-page); min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ===== 无限画布布局 ===== */
.studio-body--infinite { padding: 0; gap: 0; position: relative; }

/* ===== 浮动侧边栏 ===== */
.studio-sidebar.studio-sidebar--float {
  position: absolute;
  right: 0; top: 48px; bottom: 0;
  width: var(--sidebar-width);
  z-index: 50;
  border-left: 1px solid var(--border-color);
  background: var(--bg-primary);
}
.studio-sidebar--collapsed {
  position: absolute;
  right: 12px; top: 60px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.studio-sidebar--collapsed .ss-toggle-btn {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: #666666;
  cursor: pointer; font-size: 18px;
}
.studio-sidebar--float .ss-close {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px;
}
.studio-sidebar--float .ss-close:hover { color: var(--text-primary); }

/* ===== 画布区域 ===== */
.canvas-area {
  position: absolute; inset: 0;
  overflow: hidden;
  background: var(--surface-elevated);
}
.studio-infinite-viewer {
  width: 100%; height: 100%;
  background: var(--surface-elevated);
}
.viewport-content {
  position: relative;
  min-width: 100%;
  min-height: 100%;
  background-color: var(--surface-elevated);
  /* 网格由 .canvas-grid-layer / .canvas-axis-layer 渲染，保持与画布同步缩放 */
}

/* ===== 画布背景网格 ===== */
.canvas-grid-layer {
  position: absolute;
  left: -5000px;
  top: -5000px;
  width: 10000px;
  height: 10000px;
  pointer-events: none;
  z-index: 0;
  /* 20px 点阵 + 100px 主网格线，随 viewport 缩放保持屏幕视觉密度稳定 */
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.22) calc(2px / var(--zoom, 1)), transparent calc(2px / var(--zoom, 1))),
    linear-gradient(to right, rgba(0, 0, 0, 0.16) calc(1.5px / var(--zoom, 1)), transparent calc(1.5px / var(--zoom, 1))),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.16) calc(1.5px / var(--zoom, 1)), transparent calc(1.5px / var(--zoom, 1)));
  background-size:
    calc(20px / var(--zoom, 1)) calc(20px / var(--zoom, 1)),
    calc(100px / var(--zoom, 1)) calc(100px / var(--zoom, 1)),
    calc(100px / var(--zoom, 1)) calc(100px / var(--zoom, 1));
  background-position: center center;
}

.canvas-axis-layer {
  position: absolute;
  left: -5000px;
  top: -5000px;
  width: 10000px;
  height: 10000px;
  pointer-events: none;
  z-index: 0;
  /* 原点虚线坐标轴，虚线间隔随缩放保持屏幕视觉稳定 */
  background:
    repeating-linear-gradient(
      to right,
      rgba(0, 0, 0, 0.45) 0px,
      rgba(0, 0, 0, 0.45) calc(6px / var(--zoom, 1)),
      transparent calc(6px / var(--zoom, 1)),
      transparent calc(10px / var(--zoom, 1))
    ) 5000px 0 / calc(2px / var(--zoom, 1)) 100% no-repeat,
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.45) 0px,
      rgba(0, 0, 0, 0.45) calc(6px / var(--zoom, 1)),
      transparent calc(6px / var(--zoom, 1)),
      transparent calc(10px / var(--zoom, 1))
    ) 0 5000px / 100% calc(2px / var(--zoom, 1)) no-repeat;
}

/* ===== 画布图层 ===== */
.canvas-layer {
  position: absolute;
  z-index: 1;
  user-select: none;
  cursor: grab;
  transition: box-shadow 0.15s;
}
.canvas-layer:active { cursor: grabbing; }
.canvas-layer img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 4px;
  pointer-events: none;
}
.canvas-layer--selected {
  /* Moveable handles provide visual selection feedback */
}
.cl-dim {
  position: absolute;
  bottom: calc(-28px / var(--zoom, 1));
  left: 50%;
  transform: translateX(-50%) scale(calc(1 / var(--zoom, 1)));
  transform-origin: bottom center;
  background: #FFFFFFEE; color: #333333; font-size: 11px;
  padding: 3px 8px; border-radius: 4px; white-space: nowrap;
  pointer-events: none; border: 1px solid #E0E0E0;
}

/* ===== 底部工具栏 ===== */
.studio-bottom-bar {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 12px;
}
@media (max-width: 1365px) {
  .studio-bottom-bar {
    gap: 8px;
    padding: 6px 12px;
  }
}
.task-btn-wrap { position: relative; }
.task-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-blue); color: #000;
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.sc-zoom-slider,
input[type="range"].sc-zoom-slider {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 4px; background: #E8E8E8;
  border-radius: 2px; outline: none;
}
.sc-zoom-slider::-webkit-slider-thumb,
input[type="range"].sc-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-primary); cursor: pointer;
}
.sc-zoom-val { font-size: 13px; color: var(--text-secondary); min-width: 36px; text-align: right; }

/* ===== 左下角任务图标 + 上拉菜单 ===== */
.studio-task-trigger-wrap {
  position: absolute;
  left: 16px; bottom: 80px;
  z-index: 45;
}
.studio-task-trigger {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #666666;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.studio-task-trigger:hover { background: #F5F5F5; color: #333333; }
.studio-task-trigger:active { transform: scale(0.96); }
.studio-task-trigger .stt-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent-gold); color: #fff;
  font-size: 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.studio-task-popover {
  position: absolute;
  left: 0; bottom: calc(100% + 10px);
  width: 260px;
  max-height: 360px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.stp-header {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: #333333;
  border-bottom: 1px solid #E8E8E8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.stp-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.stp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s;
}
.stp-item:hover { background: rgba(0,0,0,0.03); }
.stp-item .stp-thumb {
  width: 32px; height: 32px; border-radius: 4px; object-fit: cover;
  border: 1px solid var(--border-color);
}
.stp-item .stp-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.stp-item .stp-type { font-size: 13px; color: var(--text-primary); }
.stp-item .stp-status { font-size: 11px; color: var(--text-muted); }
.stp-item .stp-progress {
  width: 60px; height: 3px; background: var(--border-color); border-radius: 2px; overflow: hidden;
}
.stp-item .stp-progress-bar {
  height: 100%; background: var(--accent-blue); border-radius: 2px;
  transition: width 0.3s;
}
.stp-item .stp-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 9999px; background: var(--bg-card);
  color: var(--text-muted);
}
.stp-item .stp-badge.done { background: #22c55e22; color: #22c55e; }
.stp-item .stp-badge.fail { background: #ef444422; color: #ef4444; }

/* ===== 顶部导航栏公告轮播 ===== */
.studio-nav-marquee {
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}
.snm-track {
  display: inline-block;
  animation: marqueeScroll 20s linear infinite;
  color: #888888;
  font-size: 13px;
}
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===== 项目库下拉面板 ===== */
.project-popover {
  position: absolute;
  top: calc(100% + 8px); left: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 0;
  z-index: 60;
  display: flex; flex-direction: column;
  max-height: 400px; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.project-popover .pp-header {
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-primary); border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}
.project-popover .pp-new {
  font-size: 12px; color: var(--accent-gold); cursor: pointer; background: transparent; border: none;
}
.project-popover .pp-list { display: flex; flex-direction: column; }
.project-popover .pp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; transition: background 0.15s;
}
.project-popover .pp-item:hover { background: var(--bg-card); }
.project-popover .pp-item.current { background: var(--bg-card); }
.project-popover .pp-item .pp-thumb {
  width: 40px; height: 40px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--border-color); background: var(--bg-input);
}
.project-popover .pp-item .pp-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.project-popover .pp-item .pp-name { font-size: 13px; color: var(--text-primary); }
.project-popover .pp-item .pp-date { font-size: 11px; color: var(--text-muted); }

/* ===== 导航栏项目下拉箭头 ===== */
.sn-proj-info { cursor: pointer; position: relative; }
.sn-proj-arrow {
  font-size: 12px; color: var(--text-muted); margin-left: auto;
  transition: transform 0.2s;
}
.sn-proj-arrow.open { transform: rotate(180deg); }

/* Nav */
.studio-nav {
  height: 48px; background: var(--bg-nav);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; flex-shrink: 0;
}
.studio-nav .sn-left { display: flex; align-items: center; gap: 10px; }
.studio-nav .sn-right { display: flex; align-items: center; gap: 8px; }
.studio-nav .sn-logo { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.studio-nav .sn-logo .logo-icon { width: 32px; height: 32px; background: var(--accent-blue); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 14px; color: #000; font-weight: bold; }
.studio-nav .sn-menu-btn { width: 36px; height: 36px; border-radius: 12px; background: #F0F0F0; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; color: var(--text-secondary); }
.studio-nav .sn-menu-btn:hover { background: #E8E8E8; color: var(--text-primary); }

/* ===== 导航菜单下拉 ===== */
.nav-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 12px;
  padding: 6px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: rgba(0,0,0,0.85);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-menu-item:hover {
  background: rgba(0,0,0,0.05);
  color: #000000;
}
.studio-nav .sn-proj-info { width: 234px; height: 48px; border-radius: 20px; background: #F5F5F5; display: flex; align-items: center; padding: 8px 12px; gap: 10px; font-size: 14px; color: var(--text-secondary); }
.studio-nav .sn-plus { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-primary); }
.studio-nav .sn-export { height: 36px; border-radius: 24px; background: #FFFFFF; color: #000; display: flex; align-items: center; justify-content: center; padding: 0 12px; gap: 4px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; }
.studio-nav .sn-btn { height: 36px; border-radius: 9999px; background: #F5F5F5; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; padding: 8px 16px; gap: 6px; font-size: 13px; cursor: pointer; border: none; }
.studio-nav .sn-avatar { width: 36px; height: 36px; border-radius: 50%; background: #E8E8E8; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-primary); }

/* Body */
.studio-body { flex: 1; display: flex; gap: 12px; padding: 12px 16px; overflow: hidden; background: var(--bg-primary); }

/* Sidebar */
.studio-sidebar {
  width: var(--sidebar-width); background: var(--surface-hover);
  border-radius: 32px; overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}

.studio-sidebar .ss-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px; position: relative; z-index: 1;
  font-size: 14px; font-weight: 600;
  gap: 8px;
}
.studio-sidebar .ss-head .chat-mode-switch {
  width: 160px;
  flex-shrink: 0;
}
.studio-sidebar .ss-mode { padding: 0 12px; position: relative; z-index: 1; }
.studio-sidebar .ss-chat {
  flex: 1; overflow-y: auto; background: var(--bg-secondary); gap: 12px; padding: 12px;
  display: flex; flex-direction: column; position: relative; z-index: 1;
}
.studio-sidebar .ss-chat::-webkit-scrollbar { width: 4px; }
.studio-sidebar .ss-chat::-webkit-scrollbar-track { background: transparent; }
.studio-sidebar .ss-chat::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }
.studio-sidebar .ss-chat::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }
.studio-sidebar .ss-input { padding: 4px 12px; position: relative; z-index: 1; display: flex; justify-content: center; }

/* Chat input inside sidebar */
.studio-chat-input {
  width: 100%;
  background: var(--bg-nav);
  border: 1px solid transparent;
  border-radius: 24px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.studio-chat-input textarea {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  resize: none;
  outline: none;
  width: 100%;
  min-height: 120px;
  font-family: inherit;
  position: relative;
  z-index: 1;
}
.studio-chat-input textarea::placeholder { color: var(--text-tertiary); }
.studio-chat-input .ci-enhance {
  width: 32px; height: 32px; border-radius: 9999px;
  background: #FFFFFF; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; color: #111111;
  position: absolute; top: 12px; right: 12px; z-index: 1;
}
.studio-chat-input .ci-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}
.studio-chat-input .ci-left { display: flex; align-items: center; gap: 4px; }
.studio-chat-input .ci-upload {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-chip); color: var(--text-secondary);
  cursor: pointer; border: none;
}
.studio-chat-input .ci-chip {
  height: 40px; border-radius: 12px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-chip); color: var(--text-secondary);
  cursor: pointer; border: none; padding: 0 10px;
  font-size: 14px;
}
.studio-chat-input .ci-right { display: flex; align-items: center; gap: 6px; }
.studio-chat-input .ci-cost { color: var(--accent-gold); font-size: 14px; font-weight: 700; }
.studio-chat-input .ci-gen {
  height: 40px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF1F; color: #666666;
  cursor: pointer; border: none; padding: 0 10px;
}
.studio-chat-input .ci-gen.active {
  background: #FFFFFF;
  color: #000;
}

/* Mode switch */
.chat-mode-switch {
  width: 100%;
  height: 40px;
  background: #E8E8E8;
  border-radius: 16px;
  padding: 4px;
  display: flex;
  gap: 4px;
  border: 1px solid #E8E8E8;
}
.chat-mode-switch .cms-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: #888888;
  padding: 0;
  white-space: nowrap;
}
.chat-mode-switch .cms-tab.active {
  background: #FFFFFF;
  color: #121212;
  font-weight: 600;
}

/* Canvas */
.studio-canvas-wrap {
  flex: 1; background: var(--bg-input);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column; gap: 12px;
  padding: 12px 16px 16px;
  overflow: hidden;
  position: relative;
}
.studio-canvas-area {
  flex: 1; background: var(--surface-elevated);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  border: 1px solid #F5F5F5; overflow: hidden;
  color: var(--text-muted); text-align: center;
}
.studio-canvas-bottom {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}

/* Canvas image selection */
.canvas-image-wrap {
  position: relative;
  display: inline-block;
}
.canvas-image-wrap img {
  display: block;
  border-radius: 4px;
  max-width: 100%;
}
.canvas-image-wrap.selected {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}
.canvas-image-wrap .ci-handle {
  position: absolute;
  width: 10px; height: 10px;
  background: var(--accent-blue);
  border-radius: 50%;
  border: 2px solid var(--bg-deepest);
}
.canvas-image-wrap .ci-handle.tl { top: -6px; left: -6px; }
.canvas-image-wrap .ci-handle.tr { top: -6px; right: -6px; }
.canvas-image-wrap .ci-handle.bl { bottom: -6px; left: -6px; }
.canvas-image-wrap .ci-handle.br { bottom: -6px; right: -6px; }
.canvas-image-dim {
  position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%);
  background: #FFFFFFEE; color: #333333; font-size: 11px;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}

/* Float menu */
.canvas-float-menu {
  position: fixed;
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 12px;
  padding: 6px 0;
  display: flex; flex-direction: column;
  z-index: 60; min-width: 150px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.cfm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 12px;
  color: #aaaaaa; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.cfm-item:hover { background: #2a2a2a; color: #ffffff; }
.cfm-item-disabled { opacity: 0.35; cursor: not-allowed; }
.cfm-item-disabled:hover { background: transparent; color: #aaaaaa; }
.cfm-divider { height: 1px; background: #333333; margin: 4px 10px; }
.cfm-chevron { font-size: 11px; color: #666666; margin-left: auto; }

/* Submenus */
.cfm-item { position: relative; }
.cfm-submenu {
  position: fixed;
  left: calc(100% + 4px); top: -6px;
  width: 180px;
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 10px;
  padding: 6px 0;
  display: flex; flex-direction: column;
  z-index: 30;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.cfm-submenu-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 12px;
  color: #aaaaaa; cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
  position: relative;
}
.cfm-submenu-item:hover { background: #2a2a2a; color: #ffffff; }
.cfm-submenu-item.active { color: #ffffff; background: #333333; }
.cfm-submenu-desc {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  width: 180px; margin-left: 8px;
  background: #1a1a1a; border: 1px solid #333333;
  border-radius: 8px; padding: 8px 10px;
  font-size: 11px; color: #888888; line-height: 1.5;
  display: none; z-index: 35;
}
.cfm-submenu-item:hover .cfm-submenu-desc { display: block; }
.cfm-submenu-nested {
  left: calc(100% + 4px); top: -6px;
  width: 120px;
}

/* AI Expand Panel */
.ai-expand-panel {
  position: fixed;
  left: 50%; top: 55%;
  transform: translate(-50%, -50%);
  width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 20px 24px 24px;
  display: flex; flex-direction: column; gap: 12px;
  z-index: 9999;
  box-shadow: 0 8px 32px color-mix(in srgb, var(--text-primary) 10%, transparent);
}
.aep-header {
  display: flex; align-items: center; justify-content: space-between;
}
.aep-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.aep-close {
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px; padding: 4px;
}
.aep-close:hover { color: var(--text-primary); }
.aep-hint { text-align: center; font-size: 12px; color: var(--text-muted); }
.aep-ratio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  justify-items: center;
}
.aep-ratio-row.row-2 {
  grid-template-columns: repeat(3, 1fr);
  justify-content: center;
}
.ratio-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 2px 1px; border-radius: 3px;
  cursor: pointer; color: #888888;
  font-size: 9px; transition: background 0.15s;
  min-width: 30px; border: none; background: transparent;
}
.ratio-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.ratio-btn.active { background: var(--bg-card); color: var(--text-primary); }
.aep-input-wrap { margin-top: 2px; }
.aep-input {
  width: 100%; min-height: 80px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 12px; color: var(--text-primary); font-size: 13px;
  resize: vertical; outline: none;
}
.aep-input::placeholder { color: var(--text-muted); }
.aep-footer { display: flex; justify-content: center; margin-top: 3px; }
.expand-action-btn {
  background: #ffffff; color: var(--text-primary); border: none;
  padding: 8px 28px; border-radius: 9999px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.expand-action-btn:hover { background: #eeeeee; }

/* 扩图比例预览 — 画布背景叠加层 */
.expand-preview-overlay {
  animation: expandPreviewIn 0.25s ease-out;
}
@keyframes expandPreviewIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.expand-preview-zone {
  background: repeating-linear-gradient(
    45deg,
    rgba(80, 80, 80, 0.25),
    rgba(80, 80, 80, 0.25) 4px,
    rgba(80, 80, 80, 0.15) 4px,
    rgba(80, 80, 80, 0.15) 8px
  );
  border-radius: 2px;
}
.expand-preview-border {
  border: 1.5px dashed rgba(150, 150, 150, 0.5);
  border-radius: 4px;
  animation: dashFlow 2s linear infinite;
}
@keyframes dashFlow {
  0% { border-color: rgba(150, 150, 150, 0.35); }
  50% { border-color: rgba(150, 150, 150, 0.6); }
  100% { border-color: rgba(150, 150, 150, 0.35); }
}
.expand-preview-label {
  animation: expandPreviewIn 0.3s ease-out 0.1s both;
}

/* Task button (outside toolbar) */
.task-btn-wrap .sc-tool {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; color: var(--text-secondary);
  cursor: pointer; border: 1px solid #E8E8E8;
  transition: background 0.2s, color 0.2s;
}
.task-btn-wrap .sc-tool:hover { background: #F0F0F0; color: var(--text-primary); }
.task-btn-wrap .sc-tool.active { background: #FFFFFF; color: #000000; }

/* Bottom Panels (erase / local-edit / crop) */
.studio-bottom-panel {
  position: fixed;
  left: 50%; top: 55%;
  transform: translate(-50%, -50%);
  width: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 20px;
  padding: 20px 24px 24px;
  display: flex; flex-direction: column; gap: 12px;
  z-index: 9999;
  box-shadow: 0 8px 32px color-mix(in srgb, var(--text-primary) 10%, transparent);
}
.sbp-header {
  display: flex; align-items: center; justify-content: space-between;
}
.sbp-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.sbp-close {
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px; padding: 4px;
}
.sbp-close:hover { color: var(--text-primary); }
.sbp-hint { font-size: 12px; color: var(--text-muted); }
.sbp-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
}
.sbp-tool-icon { font-size: 14px; color: var(--text-secondary); }
.sbp-slider {
  -webkit-appearance: none; appearance: none;
  width: 120px; height: 4px; background: var(--border-color);
  border-radius: 2px; outline: none;
}
.sbp-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-primary); cursor: pointer;
}
.sbp-slider-val { font-size: 12px; color: var(--text-muted); min-width: 36px; }
.sbp-undo {
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px;
}
.sbp-action {
  background: #ffffff; color: var(--text-primary); border: none;
  padding: 8px 28px; border-radius: 9999px;
  font-size: 13px; font-weight: 600; cursor: pointer; margin-left: auto;
}
.sbp-action:hover { background: #eeeeee; }
.sbp-upload-row {
  display: flex; align-items: center; gap: 6px;
}
.sbp-thumb {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; border: 1px solid var(--border-color);
}
.sbp-add-btn {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--bg-input); border: 1px dashed var(--border-color);
  color: var(--text-secondary); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sbp-input {
  width: 100%; min-height: 80px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 12px; color: var(--text-primary); font-size: 13px;
  resize: vertical; outline: none;
}
.sbp-input::placeholder { color: var(--text-muted); }
.sbp-footer { display: flex; justify-content: center; margin-top: 6px; }

/* Toolbar */
.sc-toolbar {
  display: flex; align-items: center; gap: 4px;
  height: 52px; border-radius: 20px;
  background: #FFFFFF; padding: 6px 10px;
  border: 1px solid #E8E8E8;
}
.sc-toolbar .sc-divider { width: 1px; height: 24px; background: #E8E8E8; margin: 0 4px; }
.sc-toolbar .sc-tool {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; border: none; transition: background 0.2s, color 0.2s;
}
.sc-toolbar .sc-tool:hover { background: #E8E8E8; color: var(--text-primary); }
.sc-toolbar .sc-tool.active {
  background: #FFFFFF;
  color: #000000;
}
.sc-zoom {
  display: flex; align-items: center; gap: 8px;
  height: 52px; border-radius: 20px;
  background: #FFFFFF; padding: 6px 14px;
  border: 1px solid #E8E8E8;
}
.sc-zoom .sc-zoom-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; border: none; transition: background 0.2s, color 0.2s;
}
.sc-zoom .sc-zoom-btn:hover { background: #E8E8E8; color: var(--text-primary); }
.sc-zoom .sc-divider { width: 1px; height: 24px; background: #E8E8E8; }

/* Chat button */
.chat-btn-wrap { position: relative; }
.sc-chat-btn {
  width: 52px; height: 52px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  background: #FFFFFF; color: var(--text-secondary);
  cursor: pointer; border: 1px solid #E8E8E8;
  transition: background 0.2s, color 0.2s;
}
.sc-chat-btn:hover { background: #F0F0F0; color: var(--text-primary); }

/* Chat popover */
.chat-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.chat-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.chat-popover-close {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 14px;
}
.chat-popover-close:hover { color: var(--text-primary); }
.chat-popover-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.chat-qr-img {
  width: 160px; height: 160px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}
.chat-qr-placeholder {
  width: 160px; height: 160px;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}
.chat-qr-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
}

/* Chat messages */
.chat-msg-ai { background: var(--bg-card); border-radius: var(--radius-md); padding: 12px; font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 0; }
.chat-msg-ai .msg-name { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.msg-name { font-weight: 600; color: var(--text-primary); }
.chat-msg-user { background: #EBF3FF; border-radius: var(--radius-md); padding: 12px; font-size: 14px; color: var(--text-primary); align-self: flex-end; max-width: 80%; margin-bottom: 0; }

/* Chat message row with avatar/icon */
.chat-msg-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.chat-msg-row--ai { justify-content: flex-start; }
.chat-msg-row--user { justify-content: flex-end; }

.chat-msg-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.chat-msg-avatar--model { border-radius: 6px; background: transparent; }
.chat-msg-avatar--model img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg-avatar--user { background: #E8E8E8; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.chat-msg-avatar--user img { width: 100%; height: 100%; object-fit: cover; }

/* Rotating tip animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-rotating-tip {
  color: var(--accent-gold);
  font-size: 12px;
  margin-top: 6px;
  animation: fadeIn 0.5s ease-out;
}

/* Model dropdown */
.model-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 0;
  min-width: 180px;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.model-dropdown-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
}
.model-dropdown-item:hover { background: var(--bg-card); color: var(--text-primary); }
.model-dropdown-item.active { color: var(--accent-gold); }

/* Crop ratio grid override */
.crop-grid { grid-template-columns: repeat(6, 1fr); }
.crop-grid.row-2 { grid-template-columns: repeat(5, 1fr); }

/* ===== 项目库下拉面板定位包装器 ===== */
.sn-popover-wrap {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
}

/* ===== 项目库下拉面板（project-library-popover） ===== */
.project-library-popover {
  width: 420px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 16px;
  padding: 16px;
  display: flex; flex-direction: column;
  max-height: 460px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.plp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.plp-header h3 { font-size: 16px; font-weight: 600; color: #333333; }
.plp-close {
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: none; color: rgba(0,0,0,0.5);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.plp-close:hover { color: #333333; }
.plp-list {
  display: flex; flex-direction: column;
  overflow-y: auto;
  gap: 8px;
}
.plp-empty {
  text-align: center;
  color: rgba(0,0,0,0.3);
  padding: 24px 0;
  font-size: 13px;
}
.plp-group { display: flex; flex-direction: column; }
.plp-group__label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(0,0,0,0.45);
  padding: 4px 2px;
  margin-bottom: 2px;
}
.plp-item {
  display: flex; align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  border-left: 2px solid transparent;
  transition: background 0.15s;
  gap: 0;
}
.plp-item:hover { background: rgba(0,0,0,0.04); }
.plp-item.plp-item--active {
  background: rgba(245,184,27,0.08);
  border-left-color: var(--accent-gold);
}
.plp-item__main {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  cursor: pointer;
}
.plp-item__thumb {
  width: 44px; height: 44px; border-radius: 8px;
  overflow: hidden; flex-shrink: 0;
  background: #F0F0F0;
  display: flex; align-items: center; justify-content: center;
}
.plp-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.plp-item__placeholder {
  display: flex; align-items: center; justify-content: center;
}
.plp-item__info { flex: 1; min-width: 0; }
.plp-item__name {
  font-size: 13px; color: #333333;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.4;
}
.plp-item__date { font-size: 11px; color: rgba(0,0,0,0.4); margin-top: 1px; }
.plp-item__input {
  font-size: 13px;
  color: #333333;
  background: rgba(0,0,0,0.05);
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
  width: 100%;
}
.plp-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.plp-item:hover .plp-item__actions { opacity: 1; }
.plp-action-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(0,0,0,0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
}
.plp-action-btn:hover {
  background: rgba(0,0,0,0.05);
  color: rgba(0,0,0,0.8);
}
.plp-action-btn--danger {
  opacity: 1 !important;
  color: #ef4444;
}
.plp-action-btn--danger:hover {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}
.plp-footer {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid #E8E8E8;
  flex-shrink: 0;
}
.plp-new-btn {
  width: 100%; height: 40px; border-radius: 12px;
  background: rgba(0,0,0,0.05);
  color: #333333; font-size: 14px; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s;
}
.plp-new-btn:hover { background: rgba(0,0,0,0.08); }

/* ===== 用户头像下拉菜单 ===== */
.user-menu-popover {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  width: 240px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 16px;
  padding: 12px;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.um-header {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 8px;
}
.um-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0,0,0,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: #333333; flex-shrink: 0;
}
.um-user-info { flex: 1; min-width: 0; }
.um-name { font-size: 14px; font-weight: 600; color: #333333; }
.um-id { font-size: 12px; color: rgba(0,0,0,0.4); margin-top: 2px; }
.um-balance {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; margin: 4px 0;
  background: rgba(245,184,27,0.08); border-radius: 10px;
}
.um-balance-label { font-size: 13px; color: rgba(0,0,0,0.6); }
.um-balance-value { font-size: 14px; font-weight: 600; color: var(--accent-gold); }
.um-divider { height: 1px; background: rgba(0,0,0,0.05); margin: 4px 0; }
.um-menu-list { display: flex; flex-direction: column; padding: 4px 0; }
.um-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: rgba(0,0,0,0.7);
  text-decoration: none; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.um-menu-item:hover { background: rgba(0,0,0,0.04); color: #000000; }
.um-logout {
  width: 100%; height: 36px; border-radius: 10px;
  background: rgba(239,68,68,0.1); color: #ef4444;
  border: none; cursor: pointer; font-size: 13px;
  transition: background 0.15s;
}
.um-logout:hover { background: rgba(239,68,68,0.2); }

/* ===== 图片编辑右侧面板 ===== */
.studio-sidebar--float.studio-sidebar--with-edit-panel { right: 200px; }
.image-edit-panel {
  position: fixed;
  right: 12px; top: 50%; transform: translateY(-50%);
  width: max-content; min-width: fit-content;
  background: color-mix(in srgb, var(--surface-default) 80%, transparent);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  z-index: 50;
  display: flex; flex-direction: column;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--text-primary) 8%, transparent);
  overflow: hidden;
}
.image-edit-panel .iep-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: rgba(0,0,0,0.5);
  cursor: pointer; z-index: 2;
}
.image-edit-panel .iep-close:hover { color: #333333; background: rgba(0,0,0,0.05); }
.image-edit-panel .iep-preview {
  padding: 12px 14px;
  border-bottom: 1px solid #E8E8E8;
  flex-shrink: 0;
}
.image-edit-panel .iep-preview img {
  width: 100%; height: auto;
  max-height: 160px; object-fit: cover;
  border-radius: 8px; border: 1px solid #E8E8E8;
  display: block;
}
.image-edit-panel .iep-actions {
  flex: 1; overflow-y: auto;
  padding: 10px 8px;
}
.image-edit-panel .iep-item {
  display: flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.image-edit-panel .iep-item:hover { background: var(--surface-hover); color: var(--text-secondary); }
.image-edit-panel .iep-divider {
  height: 1px; background: var(--surface-sunken);
  margin: 4px 0;
}

.em-preview-stage {
  position: relative;
  flex-shrink: 0;
}
.em-preview-frame {
  position: absolute;
  left: 0;
  top: 0;
  border: 1.5px dashed rgba(245, 184, 27, 0.85);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}
.em-source-image {
  position: absolute;
  z-index: 3;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.em-source-image:active {
  cursor: grabbing;
}
.em-expand-mask {
  position: absolute;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 1;
}

/* ===== 上传预览缩略图 ===== */
.ci-upload-preview {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; border: 1px solid rgba(0,0,0,0.1);
}
.ci-upload-remove {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.8); color: #FFFFFF; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; line-height: 1;
}

/* ── Text Layer ─────────────────────────────────────────────── */
.canvas-text-layer {
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  padding: 16px;
  user-select: none;
}
.canvas-text-layer:hover {
  border-color: #2B7FFF;
}
.canvas-text-layer.canvas-layer--selected {
  border-color: #2B7FFF;
  box-shadow: 0 0 0 2px rgba(43, 127, 255, 0.3);
}
.text-layer-content {
  color: #111111;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  max-height: 100%;
  overflow: auto;
}
.text-layer-action-btn {
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 6px;
  padding: 6px 12px;
  color: #111111;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.text-layer-action-btn:hover {
  background: #F5F5F5;
  border-color: #2B7FFF;
}

/* ===== 多图融合面板 ===== */
.mf-panel .mf-images {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0;
}
.mf-panel .mf-thumb-wrap {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--border-color); background: var(--bg-input);
}
.mf-panel .mf-thumb {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.mf-panel .mf-input-wrap { margin-top: 4px; }
.mf-panel .mf-input {
  width: 100%; min-height: 72px; background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 10px 12px; color: var(--text-primary); font-size: 13px;
  resize: vertical; outline: none;
}
.mf-panel .mf-input::placeholder { color: var(--text-muted); }
.mf-panel .mf-ratio-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.mf-panel .mf-label { font-size: 12px; color: var(--text-muted); }
.mf-panel .mf-ratio-options { display: flex; gap: 6px; flex-wrap: wrap; }
.mf-panel .mf-ratio-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  color: var(--text-secondary); background: var(--bg-input);
  border: 1px solid var(--border-color); cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mf-panel .mf-ratio-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.mf-panel .mf-ratio-btn.active { background: var(--bg-card); color: var(--text-primary); border-color: var(--accent-gold); }

/* ===== 蒙版绘制画布 ===== */
.mask-canvas {
  pointer-events: auto;
  touch-action: none;
}

/* 提示文字 */
.mask-hint {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
}

/* ===== 画布右键菜单（CanvasContextMenu） ===== */
.canvas-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}
.ccm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(0,0,0,0.85);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.ccm-item:hover { background: rgba(0,0,0,0.05); color: #333333; }
.ccm-item--checked { color: var(--accent-gold); }
.ccm-item--danger { color: #ef4444; }
.ccm-item--danger:hover { background: rgba(239,68,68,0.12); color: #ef4444; }
.ccm-item--disabled { opacity: 0.3; cursor: not-allowed; }
.ccm-item--disabled:hover { background: transparent; color: rgba(0,0,0,0.45); }
.ccm-check { margin-left: auto; font-size: 12px; color: var(--accent-gold); }
.ccm-shortcut { margin-left: auto; font-size: 11px; color: rgba(0,0,0,0.3); }
.ccm-divider { height: 1px; background: rgba(0,0,0,0.05); margin: 4px 0; }
.ccm-chevron { margin-left: auto; font-size: 14px; color: var(--text-muted); }

/* Submenu */
.ccm-item--has-submenu { position: relative; }
.ccm-submenu {
  position: absolute;
  left: calc(100% + 6px);
  top: -4px;
  min-width: 140px;
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  z-index: 10000;
}
.ccm-submenu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(0,0,0,0.85);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.ccm-submenu-item:hover { background: rgba(0,0,0,0.05); color: #333333; }

/* ── Moveable light-theme overrides ── */
.moveable-line.moveable-direction {
  background: var(--accent-blue) !important;
}
.moveable-control {
  background: var(--accent-blue) !important;
  border-color: #FFFFFF !important;
}
.moveable-control.moveable-origin {
  background: var(--accent-blue) !important;
  border-color: #FFFFFF !important;
}
.moveable-direction.moveable-rotation {
  border-color: var(--accent-blue) !important;
}
.moveable-direction.moveable-rotation::before {
  background: var(--accent-blue) !important;
}

