/* ==========================================================================
   纹陶记 · 陶艺工坊
   风格：墨青窑室 + 宣纸工序册 + 朱砂 / 青瓷点缀（与参考短视频的奶油砖红区分）
   ========================================================================== */

:root {
  --ink: #0b1210;
  --ink-2: #111b18;
  --ink-3: #172420;
  --paper: #f7f2e7;
  --paper-2: #efe7d6;
  --paper-3: #e4d9c3;
  --line: #d8cbb2;
  --line-soft: #e7ddc9;
  --text: #2b241c;
  --text-2: #6f6354;
  --text-3: #9b8d79;
  --accent: #a8462c;
  --accent-2: #c1633f;
  --accent-deep: #8b3520;
  --celadon: #7ea294;
  --celadon-2: #a9c4b8;
  --gold: #b99355;
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
  --serif: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- 总体布局 ---------- */
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 432px;
  grid-template-rows: 66px minmax(0, 1fr);
  grid-template-areas:
    "topbar topbar"
    "stage  panel";
  background: var(--ink);
}

/* ---------- 顶栏 ---------- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px 0 24px;
  background: linear-gradient(180deg, #0f1916 0%, #0c1412 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  position: relative;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 168px;
}

.brand-seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #f7e9dd;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 3px 10px rgba(0, 0, 0, .3);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: .16em;
  color: #f3ece0;
  font-weight: 600;
}
.brand-text em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .42em;
  color: rgba(243, 236, 224, .42);
  margin-top: 3px;
}

/* 步骤条 */
.steps {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .06);
}

.steps li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 15px 6px 7px;
  border-radius: 999px;
  color: rgba(243, 236, 224, .44);
  font-size: 13px;
  letter-spacing: .08em;
  transition: background .25s, color .25s;
  white-space: nowrap;
}

.steps li i {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, .22);
  color: inherit;
}

.steps li.done { color: var(--celadon-2); }
.steps li.done i {
  background: var(--celadon);
  border-color: var(--celadon);
  color: #0d1512;
  font-weight: 700;
}
.steps li.done i::before { content: "✓"; }
.steps li.done i { font-size: 0; }
.steps li.done i::before { font-size: 11px; }

.steps li.active {
  background: var(--paper);
  color: #2b241c;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
.steps li.active i {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

/* 工具按钮 */
.tools { display: flex; align-items: center; gap: 8px; min-width: 168px; justify-content: flex-end; }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  color: rgba(243, 236, 224, .72);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 999px;
  transition: .2s;
}
.tool:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tool:disabled { opacity: .3; cursor: not-allowed; }
.tool.round { width: 32px; padding: 0; justify-content: center; font-size: 15px; }

/* ---------- 操作台 ---------- */
.stage {
  grid-area: stage;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(58% 52% at 40% 26%, #2a3f38 0%, #18241f 46%, #0c1210 100%),
    linear-gradient(180deg, #101a17, #080d0b);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px),
    radial-gradient(80% 50% at 50% 100%, rgba(0, 0, 0, .45), transparent 70%);
  pointer-events: none;
}

/* 左上角技法标注 */
.stage-meta {
  position: absolute;
  top: 18px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 14px;
  border-radius: 11px;
  background: rgba(247, 242, 231, .9);
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  pointer-events: none;
  z-index: 3;
}
.stage-meta span {
  font-size: 9.5px;
  letter-spacing: .3em;
  color: var(--text-3);
}
.stage-meta b {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text);
}

#pot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#pot.dragging { cursor: grabbing; }
#pot.firing { cursor: progress; }

/* 剖面卡 */
.spec {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 198px;
  padding: 12px 13px 10px;
  border-radius: 14px;
  background: rgba(247, 242, 231, .94);
  border: 1px solid rgba(255, 255, 255, .4);
  box-shadow: var(--shadow);
  z-index: 3;
  transition: opacity .3s;
}
.spec.hide { opacity: 0; pointer-events: none; }

.spec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 7px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 6px;
}
.spec-head span {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .18em;
}
.spec-head em { font-style: normal; font-size: 9.5px; color: var(--text-3); letter-spacing: .06em; }

#profileMini { display: block; width: 100%; height: auto; }

.spec-nums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.spec-nums div { text-align: center; }
.spec-nums b {
  display: block;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.spec-nums span { font-size: 9.5px; color: var(--text-3); letter-spacing: .12em; }

/* 底部提示条 */
.hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(76%, 620px);
  padding: 9px 18px 9px 14px;
  border-radius: 999px;
  background: rgba(11, 18, 16, .72);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  color: rgba(243, 236, 224, .86);
  font-size: 12.5px;
  letter-spacing: .04em;
  line-height: 1.45;
  z-index: 3;
  pointer-events: none;
  transition: opacity .3s;
}
.hint i {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--celadon);
  box-shadow: 0 0 0 4px rgba(126, 162, 148, .18);
}
.hint b { color: var(--celadon-2); font-weight: 600; }
.hint.hide { opacity: 0; pointer-events: none; }

/* 缩放 */
.zoom {
  position: absolute;
  right: 18px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}
.zoom button {
  width: 38px;
  height: 30px;
  border-radius: 9px;
  font-size: 13px;
  color: rgba(243, 236, 224, .9);
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .13);
  backdrop-filter: blur(6px);
  transition: .2s;
}
.zoom button:hover { background: rgba(255, 255, 255, .18); }
.zoom button[data-zoom="reset"] { height: 24px; font-size: 10px; letter-spacing: 0; }

/* ---------- 藏品卡视图 ---------- */
.card-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 26px 26px 44px;
  z-index: 2;
}
.card-wrap[hidden] { display: none; }
#cardCanvas {
  max-height: calc(100% - 34px);
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, .48), 0 0 0 1px rgba(255, 255, 255, .12);
  touch-action: pan-y;
  cursor: grab;
}
.card-tip {
  margin: 0;
  font-size: 11.5px;
  color: rgba(243, 236, 224, .5);
  letter-spacing: .1em;
}

/* ---------- 右侧面板 ---------- */
.panel {
  grid-area: panel;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 26px 34px;
  background:
    linear-gradient(180deg, #f9f5eb, #f2ebdd 60%, #eee5d3),
    var(--paper);
  border-left: 1px solid rgba(0, 0, 0, .35);
  box-shadow: -22px 0 50px rgba(0, 0, 0, .35);
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(160, 140, 110, .4); border-radius: 4px; }

.panel-step { animation: panelIn .34s cubic-bezier(.2, .7, .3, 1); }
.panel-step[hidden] { display: none; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.step-meta {
  margin: 0;
  font-size: 10px;
  letter-spacing: .34em;
  color: var(--text-3);
}
.panel h2 {
  margin: 8px 0 9px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.1;
  color: #241e17;
}
.lead {
  margin: 0 0 18px;
  font-size: 12.8px;
  line-height: 1.72;
  color: var(--text-2);
}

.back {
  margin-top: 16px;
  padding: 6px 2px;
  font-size: 11.5px;
  color: var(--text-3);
  background: none;
  border: none;
  letter-spacing: .08em;
}
.back:hover { color: var(--accent); }

/* 字段 */
.field { margin-bottom: 17px; }
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.field-head > span {
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: .1em;
  color: #332b21;
}
.field-head em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: .02em;
  text-align: right;
}
.field-head em b {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.tip { margin: 7px 0 0; font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }

/* 选项卡按钮组 */
.opt-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.opt-grid.three { grid-template-columns: repeat(3, 1fr); }

.opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
  padding: 8px 4px 7px;
  border-radius: 11px;
  background: rgba(255, 253, 247, .78);
  border: 1px solid var(--line);
  transition: .18s;
  position: relative;
}
.opt:hover { border-color: #c2ae8c; background: #fffdf7; transform: translateY(-1px); }
.opt b { font-size: 11.5px; font-weight: 500; letter-spacing: .06em; color: #453a2c; }
.opt.on {
  border-color: var(--accent);
  background: #fdf4ec;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.opt.on b { color: var(--accent-deep); font-weight: 600; }

.opt .shape svg { width: 28px; height: 38px; fill: #b98f68; stroke: #7d5738; stroke-width: 1; }
.opt .shape svg ellipse { fill: #a97e56; }
.opt.on .shape svg { fill: #bf7449; }
.opt.on .shape svg ellipse { fill: #b06a44; }
.opt-grid.three .opt { min-height: 54px; flex-direction: row; gap: 7px; }

.dot { width: 12px; height: 12px; border-radius: 50%; background: #b08b64; border: 1px solid #8a6743; display: inline-block; }
.dot.s { width: 7px; height: 7px; }
.dot.m { width: 11px; height: 11px; }
.dot.l { width: 16px; height: 16px; }
.opt.on .dot { background: var(--accent); border-color: var(--accent-deep); }

/* 滑块 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d8c8ad, #cbb694);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: #fffdf8;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(120, 60, 30, .25);
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #d8c8ad;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fffdf8;
  border: 2px solid var(--accent);
  cursor: pointer;
}
input[type="range"]:disabled::-webkit-slider-thumb { border-color: #b9ab95; }
.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--text-3);
  letter-spacing: .04em;
  margin-top: 1px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 13px;
  letter-spacing: .08em;
  transition: .18s;
  white-space: nowrap;
}
.btn.primary {
  background: linear-gradient(180deg, #b4522f, #963a22);
  color: #fdf3e9;
  box-shadow: 0 6px 16px rgba(140, 52, 26, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
  flex: 1;
}
.btn.primary:hover { background: linear-gradient(180deg, #c05c37, #a14126); transform: translateY(-1px); }
.btn.primary:disabled { background: #c1b3a0; box-shadow: none; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: rgba(255, 253, 247, .85);
  border-color: var(--line);
  color: #4b4032;
}
.btn.ghost:hover { border-color: #bfa987; background: #fffdf7; }
.btn.big { width: 100%; height: 46px; font-size: 14px; letter-spacing: .18em; }
.btn.tiny { height: 30px; padding: 0 12px; font-size: 11.5px; border-radius: 8px; }
.btn.tiny.danger { color: var(--accent-deep); border: 1px solid #e0c6bb; background: #fbf1ec; }
.btn.tiny.ghost { border: 1px solid var(--line); background: transparent; }

.panel-foot { margin-top: 20px; display: flex; gap: 8px; }
.panel-foot.col { flex-direction: column; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }

/* 分段控件 */
.seg {
  display: flex;
  padding: 4px;
  border-radius: 11px;
  background: rgba(224, 212, 190, .55);
  border: 1px solid var(--line-soft);
  margin-bottom: 12px;
}
.seg button {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 12.5px;
  letter-spacing: .06em;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: .18s;
}
.seg button.on {
  background: #fffdf7;
  color: #2c241b;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(120, 100, 70, .14);
}
.seg.small { margin-bottom: 0; padding: 3px; flex: none; }
.seg.small button { height: 32px; padding: 0 14px; flex: none; font-size: 11.5px; }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  background: var(--celadon);
  color: #10201b;
  font-weight: 700;
}

/* 当前纹样 */
.current-pattern {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 11px;
  background: #f4e6d9;
  border: 1px solid #e6cfba;
  margin-bottom: 11px;
}
.current-pattern canvas {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  background: #d9bd9d;
  border: 1px solid #c3a17d;
  flex: none;
}
.current-pattern-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.current-pattern-text span { font-size: 9.5px; letter-spacing: .18em; color: var(--text-3); }
.current-pattern-text b { font-family: var(--serif); font-size: 15px; letter-spacing: .1em; color: #3a2c1f; }
.current-pattern-text em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 分类 chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button {
  height: 27px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .7);
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: .04em;
  transition: .16s;
}
.chips button:hover { border-color: #bfa987; }
.chips button.on {
  background: #2b2a26;
  border-color: #2b2a26;
  color: #f6efe2;
}

/* 纹样网格 */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pattern-card {
  padding: 7px 6px 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: .16s;
}
.pattern-card:hover { border-color: #bfa987; transform: translateY(-1px); }
.pattern-card.on {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
  background: #fdf3ea;
}
.pattern-card canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 7px;
  background: #d9bd9d;
  display: block;
}
.pattern-card b { font-size: 11.5px; font-weight: 500; letter-spacing: .08em; color: #3f3427; }
.pattern-card em {
  font-style: normal;
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: .02em;
  transform: scale(.96);
}

/* 纹带编辑 */
.band-editor {
  margin-top: 11px;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px dashed #cfbb9c;
  background: rgba(255, 253, 247, .7);
}
.band-editor[hidden] { display: none; }
.band-editor .field-head { margin-bottom: 6px; }
.mini-range {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-2);
  margin: 2px 0 8px;
}
.mini-range input { flex: 1; }
.mini-range b {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--accent);
  width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 已贴纹带列表 */
.band-list { display: flex; flex-direction: column; gap: 8px; }
.band-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .8);
  text-align: left;
}
.band-item.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.band-item canvas { width: 42px; height: 32px; border-radius: 6px; background: #d9bd9d; flex: none; }
.band-item .band-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.band-item .band-text b { font-size: 12px; font-weight: 500; color: #3f3427; letter-spacing: .06em; }
.band-item .band-text em { font-style: normal; font-size: 10px; color: var(--text-3); }
.band-item .band-del {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
}
.band-item .band-del:hover { color: var(--accent); border-color: #dbb4a4; }
.empty-note {
  padding: 22px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.7;
}

/* 自绘 */
.draw-pad {
  margin-top: 12px;
  padding: 10px;
  border-radius: 11px;
  border: 1px dashed #cfbb9c;
  background: rgba(255, 253, 247, .75);
}
.draw-pad[hidden] { display: none; }
.draw-pad-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 7px;
}
.draw-pad .draw-pad-head span { flex: none; }
#drawCanvas {
  width: 100%;
  height: 108px;
  border-radius: 8px;
  background: #d9bd9d;
  border: 1px solid #c3a17d;
  touch-action: none;
  display: block;
  cursor: crosshair;
}
.draw-pad > .btn { margin-top: 7px; width: 100%; }

/* 火焰 */
.flame-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.flame {
  text-align: left;
  padding: 11px 12px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .8);
  transition: .16s;
}
.flame:hover { border-color: #bfa987; }
.flame.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #fdf3ea; }
.flame.locked { opacity: .55; cursor: not-allowed; }
input[type="range"]:disabled { opacity: .5; cursor: not-allowed; }
.flame .swatch {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin-bottom: 7px;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .15);
}
.swatch.ox { background: radial-gradient(circle at 34% 30%, #f0c39c, #c98d5d 55%, #9e5a32); }
.swatch.red { background: radial-gradient(circle at 34% 30%, #d3d8cf, #9aa79b 55%, #6d7d70); }
.flame b {
  display: block;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .12em;
  margin-bottom: 4px;
}
.flame em {
  font-style: normal;
  display: block;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-2);
}

#curveCanvas {
  width: 100%;
  height: 96px;
  display: block;
  border-radius: 10px;
  background: rgba(255, 253, 247, .6);
  border: 1px solid var(--line-soft);
}

/* 成卡 */
.mini-card {
  width: 30px;
  height: 38px;
  border-radius: 3px;
  border: 1px solid #c3ab89;
  background: #f4ead8;
  position: relative;
  display: block;
}
.mini-card i { position: absolute; display: block; background: #b07a52; border-radius: 1px; }
.mini-card .m1 { left: 9px; top: 7px; width: 12px; height: 16px; border-radius: 40% 40% 45% 45%; }
.mini-card .m2 { left: 4px; bottom: 4px; width: 22px; height: 6px; background: #9c6a45; }
.mini-card .m3 { left: 3px; top: 5px; width: 24px; height: 20px; background: repeating-linear-gradient(45deg, #b07a52 0 1px, transparent 1px 3px); }
.mini-card .m4 { left: 3px; top: 6px; width: 24px; height: 22px; background: none; border: 2px solid #b07a52; border-radius: 40% 40% 20% 20%; }

.bg-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.bg {
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, .8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: .16s;
}
.bg:hover { border-color: #bfa987; }
.bg.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bg i {
  display: block;
  width: 100%;
  aspect-ratio: 1 / .82;
  border-radius: 6px;
  background: var(--c);
  border: 1px solid rgba(0, 0, 0, .12);
}
.bg b { font-size: 10.5px; font-weight: 500; letter-spacing: .06em; color: #4b4032; }

.text-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fffdf7;
  font-size: 13px;
  color: #2b241c;
  letter-spacing: .06em;
  outline: none;
  transition: .16s;
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(168, 70, 44, .09); }
.text-input::placeholder { color: #b9ab95; }
.seal-row .text-input { flex: 1; }

/* ---------- 提示气泡 ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 74px;
  transform: translate(-50%, 8px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(247, 242, 231, .96);
  color: #3a2f24;
  font-size: 12px;
  letter-spacing: .05em;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .32);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 9;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 帮助弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 9, .62);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 40;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(460px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px 28px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #faf6ec, #f1e9d9);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .4);
}
.modal-card h3 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: .18em;
  font-weight: 600;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 17px;
  line-height: 1;
  color: var(--text-2);
}
.help-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 11px; }
.help-list li { font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.help-list li b {
  display: block;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: .12em;
  color: #33291d;
  margin-bottom: 2px;
}
.modal-note {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ---------- 中等屏 ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: minmax(0, 1fr) 386px; }
  .brand-text em { display: none; }
  .steps li { padding: 6px 12px 6px 6px; }
}

/* ---------- 窄屏 / 手机 ---------- */
@media (max-width: 880px) {
  body { overflow: hidden; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 58px minmax(0, 1fr) minmax(0, 52vh);
    grid-template-areas:
      "topbar"
      "stage"
      "panel";
  }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-seal { width: 28px; height: 28px; font-size: 16px; }
  .brand-text strong { font-size: 16px; letter-spacing: .1em; }
  .steps { gap: 3px; padding: 4px; }
  .steps li { padding: 4px 8px 4px 5px; font-size: 11.5px; letter-spacing: .02em; gap: 5px; }
  .steps li i { width: 18px; height: 18px; font-size: 10px; }
  .tools { min-width: 0; gap: 4px; }
  .tool { padding: 0 8px; height: 28px; font-size: 11px; }
  .tool span { display: none; }
  .tool.round { width: 28px; }

  .stage-meta { top: 10px; left: 10px; padding: 6px 10px; }
  .stage-meta b { font-size: 12px; }
  .spec { top: 10px; right: 10px; width: 116px; padding: 7px 8px 6px; }
  .spec-head { padding-bottom: 4px; margin-bottom: 3px; }
  .spec-head span { font-size: 11px; }
  .spec-head em { font-size: 7.5px; }
  .spec-nums { margin-top: 3px; padding-top: 5px; }
  .spec-nums b { font-size: 11.5px; }
  .spec-nums span { font-size: 7.5px; }
  .hint { bottom: 16px; max-width: calc(100% - 34px); font-size: 10.5px; padding: 7px 13px 7px 11px; }
  .zoom { display: none; }
  .card-wrap { padding: 14px 14px 26px; }
  .card-tip { font-size: 10px; }

  .panel {
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, .4);
    padding: 16px 18px 26px;
    border-radius: 18px 18px 0 0;
    margin-top: -12px;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .4);
  }
  .panel h2 { font-size: 26px; }
  .lead { font-size: 12px; margin-bottom: 14px; }
  .pattern-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .pattern-card em { display: none; }
  .toast { bottom: calc(52vh + 12px); font-size: 11px; padding: 7px 14px; }

  /* 成卡时把操作台让给卡片 */
  body.card-mode .app { grid-template-rows: 58px minmax(0, 1fr) 46vh; }
  body.card-mode .hint { display: none; }
  body.card-mode .card-wrap { padding: 10px 10px 16px; gap: 6px; }
}

@media (max-width: 420px) {
  .steps li span { display: none; }
  .steps li { padding: 4px 6px; }
  .pattern-grid { grid-template-columns: repeat(3, 1fr); }
}
