/* ============================================================
   印章大全 —— 前台样式
   全部引用站点 :root 变量，换主题色时自动跟随
   ============================================================ */

.sml-wrap {
  font-family: -apple-system, "PingFang SC", "Microsoft Yahei", sans-serif;
  color: var(--brown, #5a4430);
}

.sml-head { margin-bottom: 22px; }
.sml-head .page-title { margin: 0 0 8px; }
.sml-sub {
  font-size: 13.5px;
  color: #8d8375;
  letter-spacing: .3px;
}

/* ---------------- 布局 ---------------- */
.sml-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------------- 左侧模板库 ---------------- */
.sml-side {
  background: #fffdf8;
  border: 1px solid var(--border-line, #d9cbb8);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 14px rgba(90, 68, 48, .05);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.sml-group-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.sml-gtab {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 3px;
  font-size: 12px;
  white-space: nowrap;
  font-family: inherit;
  color: var(--brown, #5a4430);
  background: #faf6ee;
  border: 1px solid #efe4d2;
  border-radius: 8px;
  cursor: pointer;
  transition: all .18s;
}
.sml-gtab:hover { border-color: var(--light-gold, #c8a878); color: var(--dark-red, #8c2323); }
.sml-gtab.active {
  background: linear-gradient(135deg, var(--dark-red, #8c2323), #b04a3c);
  border-color: var(--dark-red, #8c2323);
  color: #fff;
  font-weight: 600;
}

.sml-model-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 2px;
  margin: -2px;
}
.sml-model {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  background: #fff;
  border: 1px solid #efe6d8;
  border-radius: 10px;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.sml-model:hover { border-color: var(--light-gold, #c8a878); transform: translateY(-1px); }
.sml-model.active {
  border-color: var(--dark-red, #8c2323);
  box-shadow: 0 0 0 1px var(--dark-red, #8c2323) inset, 0 4px 12px rgba(140, 35, 35, .12);
  background: #fffaf5;
}
.sml-model-thumb { display: block; line-height: 0; }
.sml-model-thumb canvas { max-width: 100%; height: auto; }
.sml-model-name {
  font-size: 11.5px;
  color: var(--brown, #5a4430);
  line-height: 1.3;
  text-align: center;
}
.sml-model.active .sml-model-name { color: var(--dark-red, #8c2323); font-weight: 600; }

.sml-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 26px 8px;
  font-size: 12.5px;
  color: #a89f94;
}

/* ---------------- 右侧主区 ---------------- */
.sml-main { min-width: 0; }

.sml-stage {
  background:
    linear-gradient(#fffdf8, #fffdf8) padding-box,
    repeating-linear-gradient(45deg, #f3ece0 0 8px, #f7f1e6 8px 16px) border-box;
  border: 1px solid var(--border-line, #d9cbb8);
  border-radius: 14px;
  padding: 16px 14px 10px;
  margin-bottom: 16px;
  box-shadow: 0 2px 14px rgba(90, 68, 48, .05);
}
.sml-stage-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-width: 380px;
  margin: 0 auto;
  padding: 4px;
}
.sml-stage-inner canvas {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(140, 35, 35, .1));
}
.sml-stage-tools {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #e8ddcb;
}
.sml-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #7d7367;
  cursor: pointer;
}
.sml-switch input { accent-color: var(--dark-red, #8c2323); width: 15px; height: 15px; }

/* ---------------- 表单 ---------------- */
.sml-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  background: #fffdf8;
  border: 1px solid var(--border-line, #d9cbb8);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 14px rgba(90, 68, 48, .05);
}
.sml-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sml-field-wide { grid-column: 1 / -1; }
/* 单选项横排（导出尺寸等） */
.sml-field.sml-inline {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}
.sml-field.sml-inline > label { flex-shrink: 0; }
.sml-field.sml-inline select { max-width: 300px; }
.sml-field label {
  font-size: 12.5px;
  color: #7d7367;
  font-weight: 600;
  letter-spacing: .2px;
}
.sml-field label b { color: var(--dark-red, #8c2323); font-weight: 600; }
.sml-field input[type="text"],
.sml-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--brown, #5a4430);
  background: #fff;
  border: 1px solid #e4d8c6;
  border-radius: 8px;
  outline: none;
  transition: all .18s;
}
.sml-field input[type="text"]:focus,
.sml-field select:focus {
  border-color: var(--light-gold, #c8a878);
  box-shadow: 0 0 0 3px rgba(200, 168, 120, .16);
}
.sml-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1.2fr;
  gap: 14px;
}

/* 颜色 */
.sml-colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sml-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--dot);
  box-shadow: 0 0 0 1px #e0d3c0;
  cursor: pointer;
  padding: 0;
  transition: transform .15s;
}
.sml-dot:hover { transform: scale(1.1); }
.sml-dot.active { box-shadow: 0 0 0 2px var(--dark-red, #8c2323); }
.sml-custom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #8d8375;
  cursor: pointer;
}
.sml-custom input[type="color"] {
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid #e0d3c0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* 滑杆 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: #ece2d2;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--dark-red, #8c2323);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(140, 35, 35, .3);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--dark-red, #8c2323); border: 2px solid #fff; cursor: pointer;
}

/* ---------------- 版式微调 ---------------- */
.sml-tune {
  grid-column: 1 / -1;
  border: 1px solid #e6dac8;
  border-radius: 12px;
  background: #fffdf8;
  overflow: hidden;
}
.sml-tune.open { border-color: var(--light-gold, #c8a878); }

.sml-tune-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.sml-tune-head:hover { background: #fbf6ed; }
.sml-tune-t {
  font-size: 13px;
  font-weight: 700;
  color: var(--brown, #5a4430);
  letter-spacing: .4px;
  flex-shrink: 0;
}
.sml-tune-d {
  font-size: 12px;
  color: #9a9186;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sml-tune-x {
  flex-shrink: 0;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #b3a795;
  transition: transform .2s;
}
.sml-tune.open .sml-tune-x { transform: rotate(180deg); }

.sml-tune-body {
  padding: 0 14px 14px;
  border-top: 1px dashed #ece2d2;
}

/* 预设 */
.sml-presets { display: flex; gap: 8px; padding: 12px 0 4px; flex-wrap: wrap; }
.sml-presets button {
  flex: 1 1 0;
  min-width: 60px;
  padding: 7px 4px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--brown, #5a4430);
  background: #fff;
  border: 1px solid #e2d6c3;
  border-radius: 8px;
  cursor: pointer;
  transition: all .16s;
}
.sml-presets button:hover { border-color: var(--light-gold, #c8a878); color: var(--dark-red, #8c2323); }
.sml-presets button.active {
  color: #fff;
  background: var(--dark-red, #8c2323);
  border-color: var(--dark-red, #8c2323);
}

/* 旋钮组 */
.sml-knob-group { margin-top: 14px; }
.sml-knob-group h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #9a9186;
  letter-spacing: 1.2px;
}
.sml-knobs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
.sml-knob { min-width: 0; }
.sml-knob.is-off { opacity: .38; }
.sml-knob-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.sml-knob-top label { font-size: 12.5px; color: #7d7367; font-weight: 600; }
.sml-knob-top b {
  font-size: 12px;
  font-weight: 600;
  color: var(--dark-red, #8c2323);
  font-variant-numeric: tabular-nums;
}
.sml-knob input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 6px 0;
  background: #eadfce;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.sml-knob input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  background: var(--dark-red, #8c2323);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(140, 35, 35, .3);
  cursor: pointer;
}
.sml-knob input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  background: var(--dark-red, #8c2323);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
}
.sml-knob input[type="range"]:disabled { cursor: default; }
.sml-knob input[type="range"]:disabled::-webkit-slider-thumb { background: #b9ae9d; box-shadow: none; }

.sml-tune-tip {
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.75;
  color: #9a9186;
  background: #faf6ee;
  border-radius: 8px;
  padding: 9px 11px;
}

.sml-hint {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #9a9186;
  line-height: 1.7;
  background: #faf6ee;
  border-left: 3px solid var(--light-gold, #c8a878);
  border-radius: 0 8px 8px 0;
  padding: 9px 12px;
}

/* ---------------- 按钮 ---------------- */
.sml-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.sml-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: .5px;
  color: #fff;
  background: linear-gradient(135deg, var(--dark-red, #8c2323), #b04a3c);
  border: 1px solid var(--dark-red, #8c2323);
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  box-shadow: 0 4px 12px rgba(140, 35, 35, .18);
}
.sml-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.sml-btn:disabled { opacity: .6; cursor: default; transform: none; }
.sml-btn-ghost {
  color: var(--brown, #5a4430);
  background: #fff;
  border-color: var(--border-line, #d9cbb8);
  box-shadow: none;
}
.sml-btn-ghost:hover { color: var(--dark-red, #8c2323); border-color: var(--light-gold, #c8a878); }

.sml-result { margin-top: 14px; }
.sml-ok {
  font-size: 13px;
  color: #2a6330;
  background: #f1f7f0;
  border: 1px solid #cfe3ca;
  border-radius: 10px;
  padding: 12px 14px;
  line-height: 1.9;
}
.sml-ok a { color: var(--dark-red, #8c2323); text-decoration: none; border-bottom: 1px solid rgba(140, 35, 35, .3); }
.sml-linkbtn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--dark-red, #8c2323);
  cursor: pointer;
  border-bottom: 1px solid rgba(140, 35, 35, .3);
}
.sml-err {
  font-size: 13px;
  color: #a0433c;
  background: #fdf2f1;
  border: 1px solid #f0d2cf;
  border-radius: 10px;
  padding: 11px 14px;
}

/* ---------------- 浮动入口 ----------------
   站点「在线客服」悬浮球固定在 right:22px / bottom:24px，z-index 高达 2147483000；
   入口必须落在它上方，否则会被完全盖住（表现为「看不到 / 点了没反应」）。 */
#smlFloatBtn {
  position: fixed;
  right: 20px;
  bottom: 150px;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px 10px 12px;
  background: linear-gradient(135deg, var(--dark-red, #8c2323), #a8433a);
  color: #f7ece0;
  border: none;
  border-radius: 24px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(140, 35, 35, .3);
  transition: transform .2s, box-shadow .2s;
}
#smlFloatBtn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(140, 35, 35, .36); }
.sml-float-ico { font-size: 16px; line-height: 1; }

/* ---------------- 单枚展示页 ---------------- */
.sml-view-wrap { padding: 10px 0 30px; }
.sml-view-card {
  max-width: 620px;
  margin: 0 auto;
  background: #fffdf8;
  border: 1px solid var(--border-line, #d9cbb8);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 4px 22px rgba(90, 68, 48, .07);
  text-align: center;
}
.sml-view-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px; }
.sml-view-head .page-title { margin: 0; font-size: 20px; }
.sml-view-badge {
  font-size: 11.5px;
  color: #8d8375;
  background: #f4efe6;
  border-radius: 10px;
  padding: 2px 9px;
}
.sml-view-canvas {
  background: #fbf7ee;
  border: 1px dashed #e2d6c2;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 16px;
}
.sml-view-canvas img { max-width: 100%; height: auto; }
.sml-view-meta { font-size: 13px; color: #7d7367; line-height: 1.9; word-break: break-all; }
.sml-view-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0 10px; }
.sml-view-foot { font-size: 12px; color: #a89f94; margin-top: 6px; }
.sml-view-desc { font-size: 13.5px; color: #8d8375; line-height: 1.9; margin: 6px 0 4px; }
.sml-view-noimg {
  padding: 40px;
  color: #a89f94;
  background: #faf6ee;
  border-radius: 12px;
  margin-bottom: 16px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .sml-layout { grid-template-columns: 1fr; }
  /* 单列时模板库限高内滚：否则 34 个模板会把预览区挤到屏幕外 */
  .sml-side { position: static; max-height: none; }
  .sml-model-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sml-form { grid-template-columns: 1fr; }
  .sml-row { grid-template-columns: 1fr; }
  .sml-float-txt { display: none; }
  .sml-knobs { grid-template-columns: 1fr; gap: 10px; }
  /* 单列时舞台会撑满整屏，印章过大会把表单挤到很下面 */
  .sml-stage canvas { max-width: 260px; height: auto; }
}

@media (max-width: 560px) {
  .sml-model-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sml-btn { flex: 1 1 auto; padding: 11px 14px; }
}
