:root {
  --bg: #FAFAF9;
  --panel: #FFFFFF;
  --ink: #111111;
  --muted: #787774;
  --faint: #B4B2AE;
  --line: #EAEAEA;
  --stage: #F1F0ED;
  --green: #5F7A56;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 25% 15%, rgba(0, 0, 0, 0.04), transparent 60%),
              radial-gradient(700px 420px at 80% 90%, rgba(0, 0, 0, 0.03), transparent 60%),
              #EDECE8;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
img { display: block; }
input[type="range"] { accent-color: var(--ink); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── 手机框架 ── */
.phone {
  position: relative;
  width: 390px;
  height: min(844px, calc(100vh - 48px));
  background: var(--panel);
  border-radius: 40px;
  border: 1px solid #E2E1DE;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05), 0 40px 80px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  display: flex; flex-direction: column;
}
@media (max-width: 480px) {
  body { padding: 0; }
  .phone { width: 100%; height: 100%; border-radius: 0; border: none; box-shadow: none; }
}

/* ═══════════════════════════════════════════
   首页
   ═══════════════════════════════════════════ */

/* Banner */
.home-banner {
  flex: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
}
.home-banner[hidden] { display: none; }
.banner-track {
  display: flex;
  width: 100%; height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.banner-track::-webkit-scrollbar { display: none; }
.banner-slide {
  flex: none;
  width: 100%; height: 100%;
  scroll-snap-align: start;
}
.banner-slide img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.banner-dots {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
}
.banner-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: background 0.2s ease;
}
.banner-dot.active { background: #fff; }

.home-hero {
  flex: none;
  padding: 24px 24px 0;
  text-align: left;
}
.home-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.home-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.home-section {
  flex: none;
  padding: 0 20px;
  margin-top: 28px;
}
.home-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 14px;
}

/* 空间分类 2x4 网格 */
.home-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.home-cat {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 0 12px;
  border-radius: 12px;
  background: #F7F6F3;
  transition: background 0.15s ease;
}
.home-cat:active { background: #EDECE8; }
.home-cat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #E8E7E3;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.home-cat-name {
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.02em;
}

/* 案例集筛选 */
.home-filters {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.home-filters::-webkit-scrollbar { display: none; }
.home-filter {
  flex: none;
  height: 30px; padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: #F5F4F2;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.home-filter.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* 案例卡片 2 列 */
.home-cases {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-bottom: 100px;
}
.case-card {
  border-radius: 12px;
  overflow: hidden;
  background: #F7F6F3;
  border: 1px solid var(--line);
}
.case-thumb {
  aspect-ratio: 4 / 3;
  background: #EDECE8;
  display: flex; align-items: center; justify-content: center;
}
.case-thumb svg { opacity: 0.3; }
.case-info {
  padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.case-name {
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
}
.case-btn {
  height: 26px; padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  color: #fff;
  background: var(--ink);
  transition: background 0.15s ease;
}
.case-btn:active { background: #333; }

/* 底部导航 */
.bottom-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 80px;
  padding-bottom: 24px;
  display: flex; align-items: center; justify-content: center; gap: 60px;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 30%, #fff 100%);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px;
  color: var(--faint);
  transition: color 0.15s ease;
}
.nav-item.active { color: var(--ink); }
.nav-item svg { display: block; }

/* ═══════════════════════════════════════════
   编辑器
   ═══════════════════════════════════════════ */

.editor-topbar {
  flex: none;
  height: 52px;
  display: flex; align-items: center;
  padding: 0 12px 0 8px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.etb-back {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.15s ease;
}
.etb-back:active { background: #F3F2EF; }
.etb-title {
  flex: 1;
  font-size: 16px; font-weight: 600;
  text-align: center;
}
.etb-save {
  height: 32px; padding: 0 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: #fff;
  background: var(--ink);
  transition: background 0.15s ease;
}
.etb-save:active { background: #333; }

/* 画布 */
.editor-canvas-wrap {
  flex: none;
  height: 220px;
  margin: 12px 16px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--stage);
  border: 1px solid var(--line);
}
.editor-canvas {
  width: 100%; height: 100%;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background-size: cover;
  background-position: center;
  background-color: var(--stage);
}
.canvas-placeholder {
  opacity: 0.4;
}
.canvas-placeholder[hidden] { display: none; }

/* 尺寸标定 */
.calibration-dots {
  position: absolute; inset: 0;
}
.cal-dot {
  position: absolute;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--green);
  box-shadow: 0 0 0 3px rgba(95, 122, 86, 0.25), 0 2px 6px rgba(0,0,0,0.15);
  cursor: grab;
  touch-action: none;
  z-index: 3;
  transition: box-shadow 0.15s ease;
}
.cal-dot:active { cursor: grabbing; box-shadow: 0 0 0 5px rgba(95, 122, 86, 0.4), 0 2px 8px rgba(0,0,0,0.2); }
.cal-line {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* 选项卡 */
.editor-tabs {
  flex: none;
  display: flex;
  margin: 0 16px;
  background: #F5F4F2;
  border-radius: 10px;
  padding: 3px;
}
.etab {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.etab.active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* 面板 */
.editor-panel {
  display: flex; flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.epane {
  display: flex; flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}
.epane[hidden] { display: none; }

/* ── 模板面板 ── */
.tpl-grid {
  display: flex; flex-wrap: wrap;
  gap: 12px;
}
.tpl-item {
  flex: 0 0 calc((100% - 24px) / 3);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.tpl-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding-bottom: 75%;
  border-radius: 10px;
  background: #F3F2EF;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
  overflow: hidden;
}
.tpl-item.selected .tpl-thumb {
  border-color: var(--ink);
}
.tpl-thumb span {
  position: absolute;
  border-radius: 1px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.tpl-thumb svg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  opacity: 0.3;
}
.tpl-name {
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  line-height: 1.3;
}

/* ── 上传按钮 ── */
.eupload-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 66.67%;
  height: 48px;
  margin: 0 auto;
  border: none;
  border-radius: 12px;
  background: var(--ink);
  font-size: 14px;
  color: #fff;
  transition: opacity 0.15s ease;
}
.eupload-btn:active { opacity: 0.8; }
#bgBeforeUpload, #photosBeforeUpload {
  display: flex; flex-direction: column; justify-content: center;
  flex: 1; min-height: 0;
}
.eupload-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  line-height: 1.6;
}

/* ── 尺寸标定输入 ── */
.cal-dims {
  display: flex; gap: 10px;
  margin-bottom: 10px;
}
.cal-dim-row {
  flex: 1;
}
.cal-dim-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}
.cal-dim-input {
  display: flex; align-items: center;
  height: 36px; padding: 0 10px;
  border: 1px solid #E3E3E0; border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s ease;
}
.cal-dim-input:focus-within { border-color: var(--ink); }
.cal-dim-input input {
  flex: 1; min-width: 0;
  border: none; outline: none;
  font: inherit; font-size: 14px;
  background: transparent; color: var(--ink);
}
.cal-dim-unit {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  margin-left: 4px;
}

/* ── 图片调整滑块 ── */
.adjust-section {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.adjust-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.adjust-sliders {
  display: flex; flex-direction: column; gap: 6px;
}
.adjust-item {
  display: flex; align-items: center; gap: 8px;
}
.adj-btn {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 6px;
  background: #F5F4F2;
  border: 1px solid #E3E3E0;
  font-size: 14px; font-weight: 500;
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.adj-btn:active { border-color: var(--ink); color: var(--ink); }
.adj-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.adj-label {
  font-size: 11px;
  color: var(--muted);
}
.adj-range {
  width: 100%;
  height: 4px;
  cursor: pointer;
}

/* ── 照片尺寸列表 ── */
.size-list {
  display: flex; flex-direction: column; gap: 8px;
}
.size-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  transition: border-color 0.15s ease;
}
.size-item:active { border-color: var(--ink); }
.size-item.selected { border-color: var(--ink); border-width: 2px; }
.size-thumb {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 6px;
  background: #F3F2EF;
  display: flex; align-items: center; justify-content: center;
}
.size-thumb svg { opacity: 0.3; }
.size-name {
  flex: 1;
  font-size: 13px;
  color: var(--ink);
}

/* ── 相框面板 ── */
.frame-section {
  margin-bottom: 20px;
}
.frame-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.frame-toggle {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink);
}
.toggle-switch {
  position: relative;
  width: 44px; height: 26px;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-track {
  position: absolute; inset: 0;
  border-radius: 13px;
  background: #E3E3E0;
  transition: background 0.2s ease;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s ease;
}
.toggle-switch input:checked + .toggle-track {
  background: var(--ink);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(18px);
}

/* 间距选项 */
.spacing-chips {
  display: flex; gap: 8px;
}
.spacing-chip {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  background: #F5F4F2;
  border: 1.5px solid transparent;
  transition: all 0.15s ease;
}
.spacing-chip:active { border-color: var(--ink); }
.spacing-chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   我的页面
   ═══════════════════════════════════════════ */

.mine-hero {
  flex: none;
  padding: 44px 24px 20px;
  text-align: center;
}
.mine-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #F3F2EF;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.mine-name {
  font-size: 17px; font-weight: 600;
}
.mine-list {
  flex: 1;
  padding: 0 20px;
  overflow-y: auto;
}
.mine-item {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}
.mine-item:last-child { border-bottom: none; }
.mine-item-arrow {
  margin-left: auto;
  color: var(--faint);
}

/* ═══════════════════════════════════════════
   后台模板编辑器
   ═══════════════════════════════════════════ */

body#editor-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  background: #F5F4F2;
  overflow: hidden;
}

.layout {
  display: flex;
  height: calc(100vh - 56px);
}

.panel {
  width: 320px;
  flex: none;
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pane[hidden] { display: none; }

.pane-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pane-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  height: 30px;
  padding: 0 12px;
  border: 1px solid #E3E3E0;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.align-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.align-btn {
  height: 30px;
  border: 1px solid #E3E3E0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.align-btn:hover { border-color: var(--ink); }
.align-btn:active { background: var(--ink); color: #fff; border-color: var(--ink); }

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
  position: relative;
}
.swatch:hover { border-color: var(--ink); }
.swatch.active { border-color: var(--ink); }
.swatch.active::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 2px solid #fff;
  border-radius: 3px;
}

.field-row {
  display: flex;
  gap: 10px;
}
.field-row[hidden] { display: none; }

.field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-name {
  font-size: 11px;
  color: var(--muted);
}

.text-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #E3E3E0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
}
.text-input:focus {
  outline: none;
  border-color: var(--ink);
}

select.text-input {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='8' height='5' viewBox='0 0 8 5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%23787774' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.stage-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #EDECE8;
  display: flex;
  flex-direction: column;
}

.stage-scroll {
  flex: 1;
  overflow: auto;
  padding: 40px;
}

.stage {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  margin: 0 auto;
  transform-origin: 0 0;
}

.stage.grid-bg {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

.marquee {
  position: absolute;
  border: 1px dashed var(--ink);
  background: rgba(0,0,0,0.06);
  z-index: 100;
  pointer-events: none;
}

.add-frame-btn {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  height: 36px;
  padding: 0 20px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background 0.15s ease;
  z-index: 10;
}
.add-frame-btn:hover { background: #333; }

/* 画布工具栏 */
.canvas-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 20;
}
.ctb-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #E3E3E0;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: all 0.15s ease;
}
.ctb-btn:hover { border-color: var(--ink); }
.ctb-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.ctb-btn.active:hover { background: #333; }

.stage-meta {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  pointer-events: none;
}

.zoom-ctrl {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}

.zoom-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
}
.zoom-btn:hover { background: #F5F4F2; }

.zoom-range {
  width: 80px;
  height: 4px;
  cursor: pointer;
}

.zoom-pct {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  min-width: 36px;
  text-align: center;
}

.save-note {
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.kbd {
  display: inline-block;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: #F5F4F2;
  border: 1px solid #E3E3E0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  line-height: 18px;
}

/* 画布上的相框 */
.aframe {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.aframe:active { cursor: grabbing; }
.aframe.selected {
  outline: 2px solid #1A73E8;
  outline-offset: 1px;
  z-index: 5;
}

.aframe-mat {
  position: absolute;
}

.aframe-cell {
  position: absolute;
  background: #D6D5D1;
}

.frame-del-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #E05555;
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: none;
  padding: 0;
}
.aframe.selected .frame-del-btn { display: block; }
.frame-del-btn:hover { background: #C0392B; }

.frame-copy-btn {
  position: absolute;
  top: -10px;
  right: 16px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5F7A56;
  color: #fff;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  border: none;
  padding: 0;
}
.aframe.selected .frame-copy-btn { display: block; }
.frame-copy-btn:hover { background: #4A6344; }

/* 标尺 */
#rulerBtn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.ruler-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* CAD 标注线 */
.ruler-dim {
  position: absolute;
  pointer-events: none;
}

.ruler-ext {
  position: absolute;
  background: #1A73E8;
}

.ruler-ext-h {
  width: 1px;
}

.ruler-ext-v {
  height: 1px;
}

.ruler-dim-line {
  position: absolute;
  background: #1A73E8;
}

.ruler-dim-line-h {
  height: 1px;
}

.ruler-dim-line-v {
  width: 1px;
}

.ruler-arrow {
  position: absolute;
  width: 0;
  height: 0;
}

.ruler-arrow-l {
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 7px solid #1A73E8;
}

.ruler-arrow-r {
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid #1A73E8;
}

.ruler-arrow-t {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 7px solid #1A73E8;
}

.ruler-arrow-b {
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 7px solid #1A73E8;
}

.ruler-label {
  position: absolute;
  font-family: var(--mono);
  font-size: 10px;
  color: #1A73E8;
  background: rgba(255,255,255,0.92);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.ruler-spacing-label {
  position: absolute;
  font-family: var(--mono);
  font-size: 9px;
  color: #E37400;
  background: rgba(255,255,255,0.9);
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

.ruler-block {
  position: absolute;
  font-family: var(--mono);
  font-size: 10px;
  color: #1A73E8;
  background: rgba(255,255,255,0.92);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid #1A73E8;
}