/* ========== 工作台样式 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg-1);
  color: var(--fg);
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 13px;
}
.mono { font-family: ui-monospace, monospace; }

/* 顶栏 */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-0);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.tb-left { display: flex; align-items: center; gap: 10px; }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px;
  color: var(--pink-deep);
}
.logo .mark {
  width: 24px; height: 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
}
.logo .mark i { border-radius: 50%; }
.logo .mark i:nth-child(1) { background: var(--pink); }
.logo .mark i:nth-child(2) { background: var(--yellow); }
.logo .mark i:nth-child(3) { background: var(--mint); }
.logo .mark i:nth-child(4) { background: var(--sky); }
.logo .mark i:nth-child(5) { background: var(--purple); }
.logo .mark i:nth-child(6) { background: var(--coral); }
.logo .mark i:nth-child(7) { background: var(--pink-deep); }
.logo .mark i:nth-child(8) { background: var(--purple-deep); }
.logo .mark i:nth-child(9) { background: var(--mint); }
.tb-right { display: flex; align-items: center; gap: 10px; }

/* 按钮系统 */
.btn {
  font-weight: 600; font-size: 12px;
  padding: 0 16px; min-height: 34px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  cursor: pointer; transition: .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary {
  background: var(--grad-main); color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-pink);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-pink-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: var(--bg-0); color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover:not(:disabled) { border-color: var(--pink-deep); color: var(--pink-deep); background: var(--pink-soft); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 0 12px; min-height: 30px; font-size: 11px; }

/* 主体三栏 */
.body {
  display: grid;
  grid-template-columns: 268px 1fr 284px;
  height: calc(100vh - 60px);
}
.panel {
  background: var(--bg-2);
  display: flex; flex-direction: column;
  min-height: 0; /* 关键：允许 grid 子项在固定高度行内收缩，防止内容撑高导致 panel-fixed 被挤出可视区 */
  overflow: hidden;
}
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
.panel-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.panel-scroll::-webkit-scrollbar { width: 5px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.panel-fixed {
  flex-shrink: 0; /* 固定区域不被压缩，始终钉在左栏底部 */
  padding: 14px 18px;
  background: var(--bg-0);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 12px -6px rgba(44,62,80,.08); /* 浮动感：向上投影与滚动区分离 */
  position: relative; z-index: 2;
}

.sec { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sec:last-child { border: none; }
.sec-label {
  font-size: 11px; color: var(--fg-2);
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.sec-label .hint { color: var(--fg-3); font-size: 10px; text-transform: none; letter-spacing: 0; font-weight: 500; }

/* 图片预览区 */
.img-preview {
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: var(--r-md);
  width: 100%; aspect-ratio: 1 / 1;
  display: grid; place-items: center; cursor: pointer;
  transition: .2s; overflow: hidden; position: relative;
}
.img-preview:hover { border-color: var(--pink-deep); }
.img-preview.drag { border-color: var(--pink-deep); background: var(--pink-soft); transform: scale(1.01); }
.img-preview .empty-ic { font-size: 36px; margin-bottom: 8px; opacity: .5; }
.img-preview .empty-txt { font-size: 11px; color: var(--fg-3); font-weight: 600; }
.img-preview .img-wrap { width: 100%; height: 100%; display: grid; place-items: center; position: relative; }
.img-preview .img-wrap img { max-width: 100%; max-height: 100%; object-fit: cover; display: block; }
/* 非正方形图片的最大边框（正方形参照线） */
.img-preview .square-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(100%, 100%); aspect-ratio: 1 / 1; border: 1px dashed rgba(255,92,141,.45); border-radius: 4px; pointer-events: none; }
.img-preview .reupload {
  position: absolute; top: 6px; right: 6px;
  background: rgba(255,255,255,.9); border: 1px solid var(--line);
  border-radius: var(--r-full); padding: 3px 8px;
  font-size: 10px; font-weight: 600; color: var(--fg-2);
  cursor: pointer; opacity: 0; transition: .15s; z-index: 2;
}
.img-preview:hover .reupload { opacity: 1; }
.img-preview .reupload:hover { color: var(--pink-deep); border-color: var(--pink-deep); }
/* 预览信息条 */
.preview-meta {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.preview-meta .pm-tag {
  flex: 1; min-width: 0; text-align: center;
  background: var(--bg-2); border-radius: var(--r-full);
  padding: 5px 8px; font-size: 10px; color: var(--fg-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview-meta .pm-tag .v { color: var(--fg); font-weight: 700; font-family: ui-monospace, monospace; margin-left: 3px; }

/* 图片操作按钮组 */
.img-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.ia-btn {
  background: var(--bg-0); border: 1px solid var(--line-strong);
  border-radius: var(--r-full); padding: 0 12px; min-height: 34px;
  font-size: 11px; font-weight: 600; color: var(--fg-2);
  cursor: pointer; transition: .15s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.ia-btn:hover:not(:disabled) { color: var(--pink-deep); border-color: var(--pink-deep); background: var(--pink-soft); }
.ia-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 滑块行 */
.slider-row { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.slider-row .top { display: flex; align-items: center; justify-content: space-between; }
.slider-row .lbl { font-size: 11px; color: var(--fg-2); font-weight: 600; }
.slider-row .slider-input {
  width: 42px; background: var(--bg-0); border: 1px solid var(--line-strong);
  color: var(--pink-deep); font-family: ui-monospace, monospace;
  font-size: 10px; padding: 4px 6px; border-radius: var(--r-sm);
  outline: none; text-align: center; font-weight: 600; transition: .15s;
}
.slider-row .slider-input:focus { border-color: var(--pink-deep); box-shadow: 0 0 0 3px var(--pink-soft); }
.slider {
  width: 100%; -webkit-appearance: none; height: 6px;
  background: var(--bg-3); border-radius: var(--r-full); outline: none; transition: .15s;
}
.slider:hover { background: var(--line-strong); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--pink-deep); cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 2px 6px -1px rgba(255,92,141,.4);
}

/* 下拉选择 */
.select-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.select-row .lbl { font-size: 11px; color: var(--fg-2); font-weight: 600; flex-shrink: 0; }
.select {
  background: var(--bg-0); border: 1px solid var(--line-strong); color: var(--fg);
  font-size: 11px; font-weight: 600; padding: 7px 10px; border-radius: var(--r-sm);
  outline: none; cursor: pointer; flex: 1; text-align: right;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23A0AEC0' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center; padding-right: 24px; transition: .15s;
}
.select:focus, .select:hover { border-color: var(--pink-deep); }

/* 应用调整按钮 */
.regen-btn {
  width: 100%; padding: 0 16px; min-height: 34px;
  background: var(--grad-main); color: #fff; border: none;
  border-radius: var(--r-full); font-weight: 700; font-size: 12px;
  cursor: pointer; transition: .2s; box-shadow: var(--shadow-pink);
}
.regen-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-pink-hover); }
.regen-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* 开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.switch-row .lbl { font-size: 11px; color: var(--fg-2); font-weight: 600; }
.switch { position: relative; width: 38px; height: 22px; cursor: pointer; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--bg-3); border-radius: var(--r-full); transition: .2s; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--pink-deep); }
.switch input:checked + .track .thumb { transform: translateX(16px); }

/* 标签式选择 */
.segment-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.segment-row .lbl { font-size: 11px; color: var(--fg-2); font-weight: 600; }
.segment { display: flex; gap: 0; background: var(--bg-3); border-radius: var(--r-full); padding: 3px; overflow: hidden; }
.segment button {
  padding: 0 14px; min-height: 28px; border: none; background: transparent;
  font-size: 11px; font-weight: 600; color: var(--fg-2);
  cursor: pointer; transition: .15s; border-radius: var(--r-full);
}
.segment button.on { background: var(--bg-0); color: var(--pink-deep); box-shadow: var(--shadow-sm); }

/* 批量替换面板 */
.replace-panel { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-top: 10px; }
.replace-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.replace-row .sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; cursor: pointer; transition: .15s; }
.replace-row .sw:hover { transform: scale(1.1); }
.replace-row .sw.active { border-color: var(--pink-deep); }
.replace-row .code { font-family: ui-monospace, monospace; font-size: 11px; color: var(--fg-2); width: 32px; font-weight: 600; }
.replace-row .arr { color: var(--fg-3); }
.replace-panel .cnt { font-size: 11px; color: var(--fg-3); margin-bottom: 10px; }
.replace-panel .cnt span { color: var(--pink-deep); font-weight: 700; }
.replace-panel .execute {
  width: 100%; padding: 0 16px; min-height: 34px;
  background: var(--grad-main); color: #fff; border: none;
  border-radius: var(--r-full); font-weight: 700; font-size: 12px;
  cursor: pointer; transition: .2s; box-shadow: var(--shadow-pink);
}
.replace-panel .execute:hover { transform: translateY(-1px); box-shadow: var(--shadow-pink-hover); }

/* 中栏：画布区 */
.canvas-area {
  background: var(--bg-1);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  background-image: radial-gradient(circle, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* 画布顶部工具栏 */
.canvas-toolbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; border-bottom: 1px solid var(--line);
  background: var(--bg-0); flex-shrink: 0; box-shadow: var(--shadow-sm);
}
.ct-left { display: flex; align-items: center; gap: 4px; }
.ct-tool {
  width: 34px; height: 34px; border-radius: var(--r-full);
  border: 1px solid transparent; background: transparent; color: var(--fg-2);
  display: grid; place-items: center; cursor: pointer;
  font-size: 15px; transition: .15s; position: relative;
}
.ct-tool:hover { background: var(--bg-2); color: var(--pink-deep); }
.ct-tool.on { background: var(--pink-soft); color: var(--pink-deep); border-color: var(--pink); }
.ct-tool:disabled { opacity: .3; cursor: not-allowed; }
.ct-tool .kbd { position: absolute; bottom: 1px; right: 2px; font-family: ui-monospace, monospace; font-size: 8px; opacity: .5; }
.ct-divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.ct-right { display: flex; align-items: center; gap: 6px; }

/* 带下拉的工具按钮 */
.ct-tool-group { position: relative; display: flex; align-items: center; }
.ct-tool-arrow {
  width: 14px; height: 34px; border: none; background: transparent;
  color: var(--fg-3); cursor: pointer; font-size: 8px;
  display: grid; place-items: center;
  border-radius: 0 var(--r-full) var(--r-full) 0; transition: .15s; margin-left: -2px;
}
.ct-tool-arrow:hover { color: var(--pink-deep); }
.ct-tool-arrow.on { color: var(--pink-deep); background: var(--pink-soft); }
.ct-tool-group .ct-tool { border-radius: var(--r-full) 0 0 var(--r-full); }

/* 下拉面板 */
.ct-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--bg-0); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow-lg);
  z-index: 50; min-width: 172px; display: none;
}
.ct-dropdown.show { display: block; }
.ct-dropdown::before {
  content: ""; position: absolute; top: -5px; left: 12px;
  width: 8px; height: 8px; background: var(--bg-0);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg);
}
.ct-dropdown .dd-title { font-size: 10px; color: var(--fg-3); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.ct-dropdown .dd-slider { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.ct-dropdown .dd-slider input[type=range] { flex: 1; -webkit-appearance: none; height: 4px; background: var(--bg-3); border-radius: 2px; outline: none; }
.ct-dropdown .dd-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--pink-deep); cursor: pointer; }
.ct-dropdown .dd-slider .val { font-family: ui-monospace, monospace; font-size: 10px; color: var(--pink-deep); width: 16px; text-align: right; font-weight: 600; }

/* 颜色下拉面板 */
.dd-colors-used { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dd-colors-all { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-height: 120px; overflow-y: auto; }
.dd-colors-all::-webkit-scrollbar { width: 4px; }
.dd-colors-all::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.dd-chip { width: 20px; height: 20px; border-radius: 50%; cursor: pointer; transition: .12s; border: 2px solid transparent; }
.dd-chip:hover { transform: scale(1.2); }
.dd-chip.on { outline: 2px solid var(--pink-deep); outline-offset: 1px; }

.ct-btn {
  width: 34px; height: 34px; border-radius: var(--r-full);
  border: 1px solid var(--line-strong); background: var(--bg-0); color: var(--fg-2);
  display: grid; place-items: center; cursor: pointer; font-size: 13px; transition: .15s;
}
.ct-btn:hover:not(:disabled) { color: var(--pink-deep); border-color: var(--pink-deep); background: var(--pink-soft); }
.ct-btn:disabled { opacity: .4; cursor: not-allowed; }

.ct-zoom { display: flex; align-items: center; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-full); padding: 3px; }
.ct-zoom button { width: 24px; height: 24px; border: none; background: transparent; color: var(--fg-2); border-radius: 50%; cursor: pointer; font-size: 12px; }
.ct-zoom button:hover { color: var(--pink-deep); }
.ct-zoom .val { font-family: ui-monospace, monospace; font-size: 11px; color: var(--fg-2); width: 46px; text-align: center; cursor: pointer; }

/* 画布舞台 */
.canvas-stage { flex: 1; display: grid; place-items: center; padding: 36px; overflow: auto; position: relative; }
.canvas-stage.panning { cursor: grab; }
.canvas-stage.panning.active { cursor: grabbing; }
.canvas-stage.drag-over { background: var(--pink-soft); }
.canvas-wrap { transform-origin: center center; transition: transform .15s ease-out; }

/* 空状态引导 */
.empty-guide { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; text-align: center; padding: 40px; max-width: 520px; }
.empty-guide .icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 8px; }
.empty-guide .icon-grid i { width: 16px; height: 16px; border-radius: 50%; animation: pulse 2s ease-in-out infinite; }
.empty-guide .icon-grid i:nth-child(1) { background: var(--pink); animation-delay: 0s; }
.empty-guide .icon-grid i:nth-child(2) { background: var(--yellow); animation-delay: .1s; }
.empty-guide .icon-grid i:nth-child(3) { background: var(--mint); animation-delay: .2s; }
.empty-guide .icon-grid i:nth-child(4) { background: var(--sky); animation-delay: .3s; }
.empty-guide .icon-grid i:nth-child(5) { background: var(--purple); animation-delay: .4s; }
.empty-guide .icon-grid i:nth-child(6) { background: var(--coral); animation-delay: .5s; }
.empty-guide .icon-grid i:nth-child(7) { background: var(--pink-deep); animation-delay: .6s; }
.empty-guide .icon-grid i:nth-child(8) { background: var(--purple-deep); animation-delay: .7s; }
.empty-guide .icon-grid i:nth-child(9) { background: var(--mint); animation-delay: .8s; }
.empty-guide .icon-grid i:nth-child(10) { background: var(--pink); animation-delay: .9s; }
.empty-guide .icon-grid i:nth-child(11) { background: var(--yellow); animation-delay: 1s; }
.empty-guide .icon-grid i:nth-child(12) { background: var(--sky); animation-delay: 1.1s; }
.empty-guide .icon-grid i:nth-child(13) { background: var(--coral); animation-delay: 1.2s; }
.empty-guide .icon-grid i:nth-child(14) { background: var(--purple); animation-delay: 1.3s; }
.empty-guide .icon-grid i:nth-child(15) { background: var(--pink-deep); animation-delay: 1.4s; }
.empty-guide .icon-grid i:nth-child(16) { background: var(--mint); animation-delay: 1.5s; }
.empty-guide .icon-grid i:nth-child(17) { background: var(--yellow); animation-delay: 1.6s; }
.empty-guide .icon-grid i:nth-child(18) { background: var(--pink); animation-delay: 1.7s; }
.empty-guide .icon-grid i:nth-child(19) { background: var(--sky); animation-delay: 1.8s; }
.empty-guide .icon-grid i:nth-child(20) { background: var(--coral); animation-delay: 1.9s; }
.empty-guide .icon-grid i:nth-child(21) { background: var(--purple); animation-delay: 2s; }
.empty-guide .icon-grid i:nth-child(22) { background: var(--pink-deep); animation-delay: 2.1s; }
.empty-guide .icon-grid i:nth-child(23) { background: var(--mint); animation-delay: 2.2s; }
.empty-guide .icon-grid i:nth-child(24) { background: var(--yellow); animation-delay: 2.3s; }
.empty-guide .icon-grid i:nth-child(25) { background: var(--pink); animation-delay: 2.4s; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .6; } 50% { transform: scale(1.3); opacity: 1; } }
.empty-guide h3 { font-weight: 700; font-size: 24px; color: var(--fg); }
.empty-guide p { font-size: 14px; color: var(--fg-2); line-height: 1.7; max-width: 360px; }
.upload-btn {
  background: var(--grad-main); color: #fff; border: none;
  border-radius: var(--r-full); padding: 0 28px; min-height: 40px;
  font-weight: 700; font-size: 13px; cursor: pointer; transition: .2s;
  box-shadow: var(--shadow-pink);
}
.upload-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-pink-hover); }
.empty-formats { display: flex; justify-content: center; gap: 8px; margin-top: 4px; }
.empty-formats span { font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-3); background: var(--bg-2); padding: 3px 8px; border-radius: var(--r-full); }
.empty-tip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--purple-deep); background: var(--purple-soft); padding: 8px 14px; border-radius: var(--r-full); margin-top: 8px; }

/* 裁剪蒙层 */
.crop-overlay { position: absolute; inset: 0; background: rgba(58,50,43,.6); display: none; align-items: center; justify-content: center; z-index: 20; backdrop-filter: blur(4px); }
.crop-overlay.show { display: flex; }
.crop-modal { background: var(--bg-0); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-lg); width: 80vw; height: 80vh; display: flex; flex-direction: column; }
.crop-modal h4 { font-weight: 700; font-size: 16px; margin-bottom: 14px; color: var(--fg); display: flex; align-items: center; justify-content: space-between; }
.crop-ratios { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.crop-ratios button { height: 28px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--bg-0); font-size: 11px; font-weight: 600; color: var(--fg-2); cursor: pointer; transition: .15s; }
.crop-ratios button:hover { border-color: var(--pink); color: var(--pink-deep); }
.crop-ratios button.active { background: var(--pink); border-color: var(--pink); color: #fff; }
.crop-stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: auto; }
.crop-stage { position: relative; display: inline-block; background: var(--bg-0); border-radius: var(--r-md); overflow: hidden; }
.crop-stage img { display: block; max-width: 70vw; max-height: 50vh; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(58,50,43,.5); cursor: move; }
.crop-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--pink-deep); border-radius: 50%; }
.crop-handle.tl { top: -7px; left: -7px; cursor: nwse-resize; }
.crop-handle.tr { top: -7px; right: -7px; cursor: nesw-resize; }
.crop-handle.bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
.crop-handle.br { bottom: -7px; right: -7px; cursor: nwse-resize; }
.crop-info { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.95); padding: 6px 12px; border-radius: var(--r-full); font-family: ui-monospace, monospace; font-size: 11px; color: var(--fg); box-shadow: var(--shadow-sm); }
.crop-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* 矩形选框 */
.rect-select { position: absolute; border: 2px solid var(--pink-deep); background: rgba(232,120,140,.15); pointer-events: none; z-index: 5; }

/* 拼豆画布 */
.bead-canvas {
  display: grid; gap: 0; background: var(--bg-0);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  border-radius: var(--r-md); padding: 4px; position: relative;
}
.bead-canvas.show-grid { gap: 1px; background: var(--line); }
.bead-canvas i { aspect-ratio: 1; position: relative; cursor: crosshair; transition: transform .08s; }
.bead-canvas.shape-square i { border-radius: 3px; }
.bead-canvas.shape-round i { border-radius: 50%; }
.bead-canvas.show-grid.shape-square i { outline: 1px solid rgba(232,227,220,.6); outline-offset: -1px; }
.bead-canvas i:hover { transform: scale(1.2); z-index: 2; box-shadow: 0 4px 12px -2px rgba(0,0,0,.2); }
.bead-canvas.show-code i::after { content: attr(data-code); position: absolute; inset: 0; display: grid; place-items: center; font-family: ui-monospace, monospace; font-size: 6px; color: rgba(0,0,0,.6); font-weight: 600; pointer-events: none; }
.bead-canvas.show-code i.dark::after { color: rgba(255,255,255,.7); }
.bead-canvas.drawing-rect { cursor: crosshair; }

/* 底部状态栏 */
.canvas-status { height: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-top: 1px solid var(--line); background: var(--bg-0); flex-shrink: 0; }
.cs-left, .cs-right { display: flex; align-items: center; gap: 8px; font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-3); }
.cs-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-full); color: var(--fg-2); font-weight: 600; font-size: 10px; }
.cs-tag .v { color: var(--pink-deep); font-family: ui-monospace, monospace; }
.cs-tag.live .v { color: var(--success); font-weight: 700; }
.cs-tool-hint { font-size: 10px; color: var(--fg-3); font-weight: 600; }
.cs-tool-hint kbd { font-family: ui-monospace, monospace; font-size: 9px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px; padding: 1px 4px; color: var(--fg-2); }

/* 悬浮信息 */
.hover-info { position: fixed; background: var(--bg-0); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 6px 10px; font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-2); pointer-events: none; z-index: 100; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-md); }
.hover-info .sw { width: 12px; height: 12px; border-radius: 50%; }
.hover-info .code { color: var(--pink-deep); font-weight: 600; }

/* 右栏：用量统计 */
.usage-list { display: flex; flex-direction: column; gap: 0; max-height: 180px; overflow-y: auto; padding-right: 4px; }
.usage-list::-webkit-scrollbar { width: 4px; }
.usage-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.usage-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: .1s; }
.usage-row:hover { background: var(--bg-3); margin: 0 -8px; padding: 6px 8px; border-radius: var(--r-sm); }
.usage-row:last-child { border: none; }
.usage-row .sw { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,.08); }
.usage-row .code { font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-2); width: 32px; font-weight: 600; }
.usage-row .bar { flex: 1; height: 5px; background: var(--bg-3); border-radius: var(--r-full); overflow: hidden; }
.usage-row .bar i { display: block; height: 100%; background: var(--pink-deep); border-radius: var(--r-full); }
.usage-row .cnt { font-family: ui-monospace, monospace; font-size: 10px; color: var(--pink-deep); width: 28px; text-align: right; font-weight: 700; }

.total-card { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow-sm); margin-top: 10px; }
.total-card .lbl { font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.total-card .val { font-size: 14px; color: var(--pink-deep); font-weight: 700; }

/* 导出 */
.export-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.export-tab {
  flex: 1; font-size: 11px; font-weight: 600;
  padding: 0 8px; min-height: 34px; border-radius: var(--r-full);
  background: var(--bg-3); color: var(--fg-2);
  border: 1px solid transparent; cursor: pointer; transition: .15s;
  text-align: center; display: flex; align-items: center; justify-content: center;
}
.export-tab:hover:not(.on) { border-color: var(--line-strong); }
.export-tab.on { background: var(--bg-0); color: var(--pink-deep); box-shadow: var(--shadow-sm); border-color: var(--line); }
.export-options { display: flex; flex-direction: column; gap: 8px; }
.export-opt { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--fg); }
.export-opt .name { font-weight: 500; }
.export-opt .val { font-family: ui-monospace, monospace; font-size: 10px; color: var(--pink-deep); font-weight: 600; cursor: pointer; }
.export-checkbox { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fg); font-weight: 500; cursor: pointer; }
.export-checkbox input { accent-color: var(--pink-deep); }
.export-preview { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px; text-align: center; font-family: ui-monospace, monospace; font-size: 10px; color: var(--fg-3); margin-top: 8px; }

/* Toast */
.toast {
  position: fixed; bottom: 50px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: #fff;
  padding: 10px 20px; border-radius: var(--r-full);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; transition: .3s; z-index: 200; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success .ic { color: var(--success); }
.toast .ic { font-size: 16px; }

/* 响应式 */
@media(max-width:1100px) { .body { grid-template-columns: 240px 1fr 256px; } }
@media(max-width:860px) { .body { grid-template-columns: 1fr; } .panel.left, .panel.right { display: none; } }
