/* 手温卡房 · 编辑台 */

:root {
  --paper: #efe6d4;
  --paper-2: #faf5e8;
  --ink: #23252b;
  --mute: #8b826f;
  --line: #d7cbb2;
  --red: #c2472f;
  --gold: #b8873f;
  --serif: "Songti SC", "STSong", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, "Courier New", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(60% 40% at 8% 0%, #fbf4e3 0%, rgba(251, 244, 227, 0) 70%),
    radial-gradient(50% 40% at 100% 12%, #eef0e4 0%, rgba(238, 240, 228, 0) 70%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background-image:
    radial-gradient(rgba(110, 90, 60, .11) .7px, transparent .8px),
    radial-gradient(rgba(255, 255, 255, .55) .6px, transparent .7px);
  background-size: 4px 4px, 7px 7px;
  background-position: 0 0, 3px 2px;
}

/* ---------- 顶栏 ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: rgba(239, 230, 212, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(180, 160, 125, .28);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-seal {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff6e4;
  font-family: var(--serif);
  font-size: 18px;
  border-radius: 2px;
  transform: rotate(-3deg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-family: var(--serif); font-size: 16px; letter-spacing: .12em; }
.brand-txt i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 8px;
  letter-spacing: .2em;
  color: var(--mute);
  margin-top: 2px;
}
.top-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  color: var(--mute);
  display: none;
}
@media (min-width: 640px) { .top-note { display: block; } }

/* ---------- 版心 ---------- */
.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 7.4vw, 46px);
  line-height: 1.32;
  letter-spacing: .03em;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(transparent 64%, rgba(194, 71, 47, .22) 64%);
  padding: 0 2px;
}
.hero-sub {
  margin: 10px 0 0;
  max-width: 34em;
  font-size: 13.5px;
  line-height: 1.9;
  color: #6c6453;
}

/* ---------- 步骤条头 ---------- */
.band { margin-top: 26px; }
.band-hd {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 10px;
}
.band-hd b {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--red);
}
.band-hd span { font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.band-hd i {
  font-style: normal;
  font-size: 11px;
  color: var(--mute);
  margin-left: 2px;
}
.band-hd::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ---------- 模板条 ---------- */
.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.tpl {
  flex: 0 0 auto;
  width: 148px;
  text-align: left;
  padding: 11px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(250, 245, 232, .72);
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: transform .16s ease, background .16s, border-color .16s, box-shadow .16s;
}
.tpl:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(120, 95, 55, .1); }
.tpl b {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .18em;
  color: var(--red);
}
.tpl span {
  display: block;
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .04em;
}
.tpl i {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 10.5px;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tpl.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #f7f0df;
  box-shadow: 3px 3px 0 rgba(35, 37, 43, .16);
}
.tpl.on b { color: #dfa24c; }
.tpl.on i { color: #b3a98f; }
.tpl.done::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4c8f68;
  box-shadow: 0 0 0 2px rgba(250, 245, 232, .9);
}

/* ---------- 布局 ---------- */
.cols { margin-top: 18px; display: block; }

/* ---------- 预览台 ---------- */
.stage-col { min-width: 0; }
.stage {
  position: relative;
  height: min(56vh, 470px);
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #e9dfca;
  box-shadow: inset 0 0 0 8px #efe6d4, 0 18px 40px -26px rgba(90, 70, 40, .45);
  overflow: hidden;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(160, 138, 100, .3);
  pointer-events: none;
  z-index: 4;
}
.stage-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  opacity: 0;
  transition: opacity .3s ease;
  background: transparent;
  z-index: 2;
}
.stage-frame.on { opacity: 1; }
.stage-load {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(250, 245, 232, .95);
  color: var(--mute);
  font-size: 12px;
  letter-spacing: .06em;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.stage-load.on { opacity: 1; }

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 4px 0;
  font-size: 12px;
  color: var(--mute);
}
.gesture { line-height: 1.6; }
.linkbtn {
  flex: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--red);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(194, 71, 47, .4);
  white-space: nowrap;
}

/* ---------- 表单 ---------- */
.side-hd { margin-top: 22px; }
@media (min-width: 900px) { .side-hd { margin-top: 0; } }

.panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(250, 245, 232, .92);
  padding: 16px;
  box-shadow: 0 10px 26px -22px rgba(90, 70, 40, .5);
}

.field + .field { margin-top: 17px; }
.field-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.field-hd label { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.field-hd small {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  color: var(--mute);
  font-weight: 400;
}
.inp {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 9px 0 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
.inp::placeholder { color: #b7ab93; }
.inp:focus { outline: 0; border-color: var(--red); background: rgba(255, 255, 255, .35); }
textarea.inp {
  min-height: 86px;
  line-height: 1.75;
  resize: vertical;
  border: 1px solid var(--line);
  padding: 9px 10px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .4);
}
textarea.inp:focus { border-color: var(--red); }

.photo-row { display: flex; align-items: center; gap: 12px; }
.thumb {
  width: 58px;
  height: 72px;
  flex: none;
  border: 1px dashed #c9ba9b;
  border-radius: 2px;
  background: #f1e8d5 center/cover no-repeat;
}
.thumb.has { border-style: solid; border-color: #ddcfb6; box-shadow: 0 3px 8px rgba(90, 70, 40, .14); }
.photo-meta { flex: 1; min-width: 0; font-size: 11px; color: var(--mute); line-height: 1.6; }
.photo-actions { display: flex; gap: 10px; margin-top: 4px; }
.sbtn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .5);
  color: var(--ink);
  border-radius: 3px;
  padding: 5px 10px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.sbtn:hover { border-color: #bfae8e; }
.sbtn.plain { border: 0; background: none; color: var(--red); text-decoration: underline; padding: 5px 0; }

/* ---------- 生成 ---------- */
.prev-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 3px;
  background: #eef4e9;
  color: #3e6b4f;
  font-size: 12px;
}
.prev-link button {
  border: 0;
  background: none;
  color: #2f6b45;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.go {
  width: 100%;
  margin-top: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 15px;
  border: 0;
  border-radius: 3px;
  background: var(--ink);
  color: #f8f1e0;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .05em;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(35, 37, 43, .15);
  transition: transform .14s, box-shadow .14s, background .2s;
}
.go b { font-family: var(--mono); font-size: 9px; letter-spacing: .18em; color: #dfa24c; font-weight: 500; }
.go span { flex: 1; text-align: left; }
.go i { font-style: normal; font-size: 15px; color: #dfa24c; transition: transform .2s; }
.go:hover i { transform: translate(2px, -2px); }
.go:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(35, 37, 43, .15); }
.go[disabled] { opacity: .55; cursor: progress; transform: none; }

.status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--mute);
  text-align: center;
}
.status.err { color: #b03a27; }

/* ---------- 结果 ---------- */
.result {
  margin-top: 12px;
  border: 1px dashed #c4b291;
  background: #f8f1e0;
  padding: 14px;
  animation: pop .4s cubic-bezier(.2, .9, .2, 1) both;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.res-hd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.res-hd span { font-size: 13px; font-weight: 600; }
.res-hd b { font-family: var(--mono); font-size: 9px; color: var(--mute); letter-spacing: .08em; }
#link {
  width: 100%;
  border: 1px solid #ddcfb4;
  border-radius: 3px;
  background: #fffdf6;
  color: #4a4538;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  padding: 8px 10px;
  resize: vertical;
  word-break: break-all;
}
.res-row { display: flex; gap: 8px; margin-top: 8px; }
.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}
.btn.ink { background: var(--red); border-color: var(--red); color: #fff7e8; font-weight: 600; }
.btn.ink:hover { background: #ad3d28; }
.btn.ghost:hover { border-color: #bfae8e; }
.res-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--mute);
}

.fine {
  margin: 14px 2px 0;
  font-size: 11px;
  line-height: 1.85;
  color: var(--mute);
}

/* ---------- 页脚 ---------- */
.ft {
  position: relative;
  z-index: 1;
  border-top: 1px solid rgba(180, 160, 125, .3);
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  color: #a79a80;
}

/* ---------- 电脑：左印样右表单 ---------- */
@media (min-width: 900px) {
  .wrap { padding: 28px 28px 48px; }
  .hero h1 { font-size: 44px; }
  .cols {
    display: grid;
    grid-template-columns: minmax(0, 1.28fr) minmax(340px, 400px);
    gap: 30px;
    align-items: start;
    margin-top: 20px;
  }
  .stage-col { position: sticky; top: 74px; }
  .stage { height: calc(100vh - 380px); min-height: 430px; max-height: 640px; }
  .rail { flex-wrap: wrap; overflow: visible; }
  .tpl { width: calc((100% - 32px) / 5); min-width: 132px; }
  .side .band-hd { margin-bottom: 8px; }
}
