:root {
  --green: #07c160;       /* 主强调色 */
  --green-d: #06ad56;
  --ink: #1f2329;
  --muted: #8a8f99;
  --line: #e6e8eb;
  --bg: #f5f7f8;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
a { color: var(--green-d); }
.muted { color: var(--muted); font-size: 13px; }
.wrap { width: 90%; margin: 0 auto; }

/* 头部 */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); padding: 22px 0; }
.logo { margin: 0; font-size: 24px; }
.tagline { margin: 4px 0 0; color: var(--muted); }

/* 工具区：左栏控制面板（宽按视口比例）+ 右栏图片处理区 */
.tool { margin: 24px 0; }
.tool-grid { display: grid; grid-template-columns: clamp(300px, 25vw, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px){ .tool-grid { grid-template-columns: 1fr; } }

/* 两栏均纵向排列 */
.col-left, .col-right { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }

/* 右栏：左半处理区 ∥ 右半文字预览区，等宽等高；标题行行高固定保证衬底顶边齐平 */
.work-row { display: flex; gap: 16px; align-items: stretch; min-width: 0; height: clamp(300px, 52vh, 600px); }
.work-cell { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.cell-cap { flex: none; margin: 0; font-size: 13px; color: var(--muted); line-height: 20px; height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px){
  .work-row { flex-direction: column; height: auto; }
  .work-cell { min-height: 0; }
  .drop-zone { flex: none; height: clamp(200px, 30vh, 320px); }
  .crop-stage { flex: none; height: clamp(300px, 46vh, 560px); }
  .text-preview { flex: none; height: clamp(240px, 36vh, 480px); }
}

.drop-zone {
  flex: 1; min-height: 0;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  text-align: center; cursor: pointer; padding: 24px;
  transition: border-color .15s, background .15s;
}
.drop-zone.drag { border-color: var(--green); background: #f0fff7; }
.drop-icon { font-size: 34px; margin: 0 0 8px; }

/* 重新上传按钮（图片加载后显示，上传区本身隐藏） */
.reupload {
  padding: 8px 14px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.reupload:hover { border-color: var(--green); color: var(--green-d); }

/* 输出尺寸区块标题 */
.block-title { font-size: 13px; font-weight: 600; color: var(--ink); margin: 6px 0 2px; }
.tiny { margin: 0 0 10px; }

/* 比例实时读数 */
.ratio-readout {
  margin-top: 10px; font-size: 13px; background: #f0fff7;
  border: 1px solid #cdeede; color: #06ad56; border-radius: 8px; padding: 8px 10px;
}

/* 文字预览（叠层拖拽）：衬底填满半区，内层贴合图片；空态提示居中 */
.text-preview { flex: 1; min-height: 0; display: flex; }
.tp-image-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; width: 100%; background: #2b2f36; border-radius: var(--radius); padding: 8px; }
.tp-inner { position: relative; max-width: 100%; line-height: 0; }
.tp-inner > img { display: block; max-width: 100%; width: auto; height: auto; border-radius: 6px; }
.tp-overlay { position: absolute; inset: 0; pointer-events: none; }
.tp-empty { position: absolute; inset: 0; margin: 0; padding: 16px; display: flex; align-items: center; justify-content: center; text-align: center; color: #9aa3ad; font-size: 13px; line-height: 1.7; pointer-events: none; }
.tp-text {
  position: absolute; pointer-events: auto; cursor: move; line-height: 1.25;
  white-space: pre-wrap; word-break: break-word; user-select: none;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.tp-text.sel { outline: 1px dashed var(--green); outline-offset: 2px; }
.tp-text.tiled { opacity: .5; }

/* 文字图层面板 */
.layer-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.btn-mini { padding: 6px 10px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn-mini:hover { border-color: var(--green); color: var(--green-d); }
.tpl-sel { flex: 1; min-width: 120px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.layer-list { list-style: none; padding: 0; margin: 0 0 10px; }
.layer-item { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; background: #fff; }
.layer-item.active { border-color: var(--green); background: #f0fff7; }
.li-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-btn { border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--muted); padding: 2px 4px; }
.li-btn:hover { color: var(--green-d); }
.li-btn.del:hover { color: #e54d42; }
.layer-editor { border-top: 1px dashed var(--line); padding-top: 12px; }
textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; resize: vertical; font-family: inherit; }

.crop-stage {
  position: relative;
  flex: 1; min-height: 0; overflow: hidden;
  background: #2b2f36;
  border-radius: var(--radius);
  padding: 8px;
}
.crop-stage .cropper-container { max-height: 100%; }
.crop-stage img { max-width: 100%; display: block; }

/* 控制面板 */
.col-right { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; margin-bottom: 12px; }
.field > span { color: var(--muted); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
select, input[type="number"] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; background: #fff; color: var(--ink);
}
input[type="range"] { width: 100%; accent-color: var(--green); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.custom-hint {
  font-size: 13px; color: #2b6cb0; background: #eef5ff;
  border: 1px solid #cfe2ff; border-radius: 8px; padding: 10px; margin-bottom: 12px;
}

.est { font-size: 13px; color: var(--ink); margin: 4px 0 12px; }
.est span { font-weight: 600; color: var(--green-d); }

.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--green); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--green-d); }

/* 底部下载按钮（导出结果即所见，底部仅保留下载） */
.btn-download {
  display: block; text-align: center; padding: 12px; border-radius: 10px;
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 600;
}
.btn-download:hover { opacity: .9; }

/* 特性区 */
.features { margin: 32px 0; }
.features h2 { font-size: 20px; margin: 24px 0 12px; }
.feat-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 860px){ .feat-grid { grid-template-columns: 1fr; } }
.feat-grid li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feat-grid h3 { margin: 0 0 6px; font-size: 15px; }
.feat-grid p { margin: 0; font-size: 13px; color: #4a5057; }

.spec-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.spec-table th, .spec-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.spec-table th { background: #f0f2f4; }
.spec-table tr:last-child td { border-bottom: none; }

.site-footer { text-align: center; padding: 8px 0 32px; }
