/* ============ 拼豆工坊 · 奶油糖果手作风 ============ */
:root {
  --paper: #fbf4e7;
  --paper-deep: #f4e7d3;
  --card: #fffdf7;
  --ink: #3f2e23;
  --ink-2: #7c6453;
  --ink-3: #a89280;
  --line: #ecdec9;
  --line-strong: #e0cdb2;
  --pink: #ef7691;
  --pink-deep: #d9508a;
  --coral: #f0855f;
  --mint: #57bfa4;
  --butter: #f4c24c;
  --sky: #74a9e6;
  --lilac: #b49be0;
  --shadow-sm: 0 4px 12px rgba(112, 80, 50, 0.08);
  --shadow: 0 14px 30px rgba(112, 80, 50, 0.1);
  --shadow-lg: 0 26px 60px rgba(92, 62, 38, 0.16);
  --radius: 22px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, #fde8ef 0%, rgba(253, 232, 239, 0) 55%),
    radial-gradient(900px 500px at 95% 0%, #e8f4ec 0%, rgba(232, 244, 236, 0) 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(160, 128, 95, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(#000 0%, rgba(0, 0, 0, 0.25) 60%, transparent 100%);
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: 0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

button { font-family: inherit; color: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(251, 244, 231, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(224, 205, 178, 0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px 6px;
  cursor: pointer;
  text-align: left;
}

.brand-beads {
  display: grid;
  grid-template-columns: repeat(2, 12px);
  gap: 3px;
}
.brand-beads i {
  display: block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  position: relative;
}
.brand-beads i::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 0.98rem; letter-spacing: 0.04em; }
.brand-text small { font-size: 0.66rem; color: var(--ink-3); letter-spacing: 0.08em; }

.nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 253, 247, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.nav-btn {
  position: relative;
  border: 0;
  background: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-btn:hover { color: var(--ink); background: rgba(239, 118, 145, 0.08); }
.nav-btn.is-active { background: var(--ink); color: #fff8ee; }

.nav-count {
  display: inline-block;
  min-width: 17px;
  padding: 0 4px;
  margin-left: 5px;
  border-radius: 99px;
  background: var(--pink);
  color: #fff;
  font-size: 0.66rem;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s, color 0.2s;
}
.icon-btn:hover { transform: translateY(-1px); color: var(--ink); }
.icon-btn[aria-pressed="false"] { color: var(--ink-3); text-decoration: line-through; }

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(16px, 4vw, 40px) 80px;
}

.view { animation: fade-up 0.45s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pink-deep);
  font-weight: 700;
}

/* ---------- 首页 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  padding: clamp(12px, 2vw, 24px) 0 clamp(28px, 4vw, 44px);
}

.hero h1 {
  margin: 10px 0 14px;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.lede {
  max-width: 34em;
  color: var(--ink-2);
  font-size: 0.98rem;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-stats {
  display: flex;
  gap: 26px;
  margin-top: 26px;
}
.hero-stats li { display: flex; align-items: baseline; gap: 6px; }
.hero-stats b { font-size: 1.4rem; font-weight: 800; }
.hero-stats span { font-size: 0.76rem; color: var(--ink-3); letter-spacing: 0.04em; }

.hero-art { position: relative; display: flex; justify-content: center; }
.art-board {
  position: relative;
  width: min(100%, 340px);
  padding: 18px;
  background: linear-gradient(160deg, #fffdf7, #f7ecdb);
  border-radius: 28px;
  box-shadow: var(--shadow);
  transform: rotate(-2.4deg);
  border: 1px solid var(--line);
}
.art-board canvas { display: block; width: 100%; height: auto; border-radius: 16px; }
.art-tape {
  position: absolute;
  top: -12px; left: 50%;
  width: 92px; height: 24px;
  margin-left: -46px;
  background: rgba(244, 194, 76, 0.55);
  transform: rotate(3deg);
  border-radius: 3px;
}
.art-note {
  position: absolute;
  right: 2px; bottom: -6px;
  padding: 10px 14px;
  background: #fffdf7;
  border-radius: 14px;
  font-size: 0.78rem;
  color: var(--ink-2);
  line-height: 1.5;
  transform: rotate(4deg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

/* 继续拼 */
.continue-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  margin-bottom: 34px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.continue-card canvas {
  width: 72px; height: 72px;
  border-radius: 14px;
  background: var(--paper-deep);
}
.continue-copy { flex: 1 1 180px; min-width: 0; }
.continue-copy h2 { font-size: 1.1rem; margin: 2px 0 6px; }
.mini-progress {
  height: 6px;
  border-radius: 99px;
  background: var(--paper-deep);
  overflow: hidden;
  max-width: 320px;
}
.mini-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--pink), var(--butter));
  transition: width 0.4s;
}
.continue-meta { font-size: 0.76rem; color: var(--ink-3); margin-top: 5px; }

/* 图纸柜 */
.gallery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.gallery-head h2 { font-size: 1.5rem; }
.gallery-head p { color: var(--ink-2); font-size: 0.84rem; margin-top: 4px; }

.chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.8);
  color: var(--ink-2);
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.18s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff8ee;
}

.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
  gap: 18px;
}

.p-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
  text-align: left;
  padding: 0;
}
.p-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.p-card:focus-visible { outline: 3px solid rgba(239, 118, 145, 0.45); outline-offset: 2px; }
.p-card h3 { color: var(--ink); }

.p-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.75), transparent 60%),
    var(--paper-deep);
  padding: 14px;
}
.p-thumb canvas { width: 100%; height: auto; max-height: 100%; }
.p-badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 3px 9px;
  font-size: 0.66rem;
  border-radius: 99px;
  background: rgba(255, 253, 247, 0.94);
  color: var(--ink-2);
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
}
.p-badge.done { background: var(--mint); border-color: var(--mint); color: #08352a; }
.p-badge.going { background: var(--butter); border-color: var(--butter); color: #4a3405; }
.p-badge.best {
  left: auto;
  right: 10px;
  background: var(--ink);
  border-color: var(--ink);
  color: #fff8ee;
  letter-spacing: 0.02em;
}

.p-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.p-body h3 { font-size: 1rem; }
.p-mood { font-size: 0.76rem; color: var(--ink-3); }
.p-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.7rem;
  color: var(--ink-2);
  margin-top: 2px;
}
.p-meta span {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 7px;
}
.p-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--ink-3);
}
.stars { letter-spacing: 0.12em; color: var(--butter); font-size: 0.78rem; }
.stars .off { color: var(--line-strong); }

.gallery-empty { text-align: center; color: var(--ink-2); padding: 40px 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 11px 20px;
  min-height: 44px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s, box-shadow 0.2s, background 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #f3869c, #e9627f);
  color: #fff;
  box-shadow: 0 8px 18px rgba(217, 80, 138, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 24px rgba(217, 80, 138, 0.34); transform: translateY(-1px); }

.btn-ghost {
  background: rgba(255, 253, 247, 0.85);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { background: #fff; }

.btn-soft { background: var(--paper-deep); color: var(--ink); }
.btn-soft:hover { background: #f0dfc8; }
.btn-quiet { background: none; color: var(--ink-2); padding-left: 8px; padding-right: 8px; }
.btn-quiet:hover { color: var(--ink); background: rgba(0, 0, 0, 0.03); }
.btn-wide { width: 100%; }

/* ---------- 拼豆台 ---------- */
.wb-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.wb-title { flex: 1 1 160px; min-width: 0; }
.wb-title h2 { font-size: 1.3rem; }

/* 难度条 */
.wb-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.mode-switch {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(90, 60, 30, 0.16);
}
.wb-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.wb-stats > span { display: inline-flex; align-items: center; gap: 5px; }
.wb-stats b {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-ico { font-size: 0.72rem; opacity: 0.75; }
.wb-stats .stat-clock { display: none; }
.wb-stats.is-challenge .stat-clock { display: inline-flex; }
.wb-guide {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(87, 191, 164, 0.16);
  color: #2c7563;
  font-size: 0.74rem;
}
.wb-guide.is-warn { background: rgba(226, 80, 74, 0.13); color: #b2403a; }
.wb-title p { font-size: 0.76rem; color: var(--ink-3); margin-top: 2px; }

.wb-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px;
  background: rgba(255, 253, 247, 0.8);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.tool {
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.tool:hover { background: var(--paper); color: var(--ink); }
.tool.is-active { background: var(--ink); color: #fff8ee; }
.tool:disabled { opacity: 0.35; cursor: not-allowed; }

.wb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 18px;
  align-items: start;
}

.board-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: clamp(12px, 2vw, 20px);
  box-shadow: var(--shadow-sm);
}

.board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 6px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#boardCanvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 0 auto;
  border-radius: 18px;
  touch-action: none;
  cursor: crosshair;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.board-tip {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  padding: 5px 12px;
  font-size: 0.7rem;
  color: var(--ink-2);
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid var(--line);
  border-radius: 99px;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.board-tip.is-hidden { opacity: 0; }

.board-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--ink-3);
  margin-top: 10px;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.dot-pink { background: var(--pink); }
.dot-mint { background: var(--mint); }
.dot-sky { background: var(--sky); }

.wb-rail { display: flex; flex-direction: column; gap: 12px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.panel-head h3 { font-size: 0.92rem; }
.panel-head span { font-size: 0.68rem; color: var(--ink-3); }

.color-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

.color-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
  min-width: 0;
}
.color-chip:hover { border-color: var(--line-strong); }
.color-chip.is-active {
  border-color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(63, 46, 35, 0.08);
}
.color-chip.is-done { opacity: 0.45; }
.color-chip .bead {
  width: 18px; height: 18px;
  flex: 0 0 18px;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
.color-chip .bead::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--card);
}
.color-chip .chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.color-chip .chip-text b { font-size: 0.72rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.color-chip .chip-text small { font-size: 0.62rem; color: var(--ink-3); }

.progress-panel { display: flex; align-items: center; gap: 14px; }
.ring-wrap { position: relative; width: 76px; height: 76px; flex: 0 0 76px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--paper-deep); stroke-width: 8; }
.ring-fg {
  fill: none;
  stroke: var(--pink);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 207.3;
  stroke-dashoffset: 207.3;
  transition: stroke-dashoffset 0.35s ease;
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.ring-label b { font-size: 1rem; }
.ring-label span { font-size: 0.6rem; color: var(--ink-3); }
.progress-copy { min-width: 0; }
.progress-copy p { font-size: 0.8rem; }
.progress-copy b { font-size: 1rem; }
.muted { color: var(--ink-3); font-size: 0.72rem !important; margin-top: 2px; }
.rail-note { font-size: 0.7rem; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* ---------- 造图工坊 ---------- */
.studio-head { max-width: 720px; margin-bottom: 26px; }
.studio-head h1 { margin: 8px 0 12px; font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.studio-stage { display: flex; flex-direction: column; gap: 16px; padding: clamp(14px, 2vw, 20px); }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 340px;
  padding: 30px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(239, 118, 145, 0.07), transparent 60%),
    var(--paper);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--pink); background: #fff8f3; }
.dropzone h2 { font-size: 1.1rem; margin-top: 4px; }
.dropzone p { font-size: 0.78rem; color: var(--ink-3); }
.drop-icon { font-size: 2rem; }
.dropzone .btn { margin-top: 12px; }

.preview-frame {
  background:
    repeating-conic-gradient(#f4e7d3 0 25%, #fffdf7 0 50%) 0 0 / 24px 24px;
  border-radius: 18px;
  padding: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
}
#studioCanvas { display: block; width: 100%; max-width: 520px; height: auto; border-radius: 10px; background: #fff; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.preview-bar p { font-size: 0.76rem; color: var(--ink-2); }

.palette-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.72rem;
}
.palette-item i {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  border-radius: 50%;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}
.palette-item b { font-weight: 600; }
.palette-item span { color: var(--ink-3); margin-left: auto; font-variant-numeric: tabular-nums; }

.studio-controls { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
}
.control-label span { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.control-hint { font-size: 0.68rem; color: var(--ink-3); margin-top: -2px; }

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 7px 0;
  border-radius: 9px;
  font-size: 0.8rem;
  color: var(--ink-2);
  cursor: pointer;
}
.segmented button.is-active { background: var(--ink); color: #fff8ee; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #f7d9c4, #f0b2c0);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fffdf7;
  border: 2px solid var(--pink);
  box-shadow: 0 2px 6px rgba(217, 80, 138, 0.25);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fffdf7;
  border: 2px solid var(--pink);
  cursor: pointer;
}

.switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui {
  width: 38px; height: 22px;
  flex: 0 0 38px;
  border-radius: 99px;
  background: var(--paper-deep);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background 0.2s;
  margin-top: 2px;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + .switch-ui { background: var(--pink); border-color: var(--pink); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--sky); outline-offset: 2px; }
.switch-text { font-size: 0.8rem; font-weight: 600; line-height: 1.35; }
.switch-text small { display: block; font-size: 0.68rem; font-weight: 400; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.control-actions { gap: 8px; }

/* ---------- 作品 ---------- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.work-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.work-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 26px 18px;
  background: radial-gradient(circle at 50% 30%, #fffdf7, var(--paper-deep));
  min-height: 210px;
}
.work-stage img { max-width: 100%; max-height: 170px; filter: drop-shadow(0 8px 12px rgba(90, 60, 40, 0.18)); }
.work-stage .mount-ring {
  position: absolute;
  top: 18px; left: 50%;
  width: 30px; height: 30px;
  margin-left: -15px;
  border: 5px solid #cfae75;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}
.work-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.work-body h3 { font-size: 0.98rem; }
.work-meta { font-size: 0.7rem; color: var(--ink-3); }
.work-actions { display: flex; gap: 8px; margin-top: 8px; }
.work-actions .btn { flex: 1; padding: 8px 10px; min-height: 36px; font-size: 0.76rem; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  border: 2px dashed var(--line-strong);
  border-radius: 26px;
  background: rgba(255, 253, 247, 0.55);
}
.empty-state span { font-size: 2.2rem; }
.empty-state h2 { margin: 8px 0 6px; font-size: 1.2rem; }
.empty-state p { color: var(--ink-2); font-size: 0.84rem; margin-bottom: 18px; }

/* ---------- 熨烫 ---------- */
.iron-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(58, 40, 28, 0.55);
  backdrop-filter: blur(8px);
  overflow-y: auto;
}
.iron-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: fade-up 0.4s ease both;
}
.iron-board {
  position: relative;
  padding: 18px;
  background: linear-gradient(160deg, #fdf6e8, #f2e3cc);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
#ironCanvas { display: block; width: min(78vw, 420px); height: auto; border-radius: 12px; }
.iron-paper {
  position: absolute;
  inset: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  mix-blend-mode: screen;
}
.iron-paper.is-on { opacity: 1; }
.iron-prop {
  position: absolute;
  top: 0; left: 50%;
  transform: translate(-50%, -40%);
  opacity: 0;
  transition: opacity 0.3s;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}
.iron-prop.is-on { opacity: 1; }
.steam { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
.steam.is-on { opacity: 1; }
.steam i {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  animation: steam-rise 1.4s linear infinite;
  top: 40%;
}
.steam i:nth-child(1) { left: 34%; animation-delay: 0s; }
.steam i:nth-child(2) { left: 50%; animation-delay: 0.45s; }
.steam i:nth-child(3) { left: 66%; animation-delay: 0.9s; }
@keyframes steam-rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0; }
  30% { opacity: 0.85; }
  100% { transform: translateY(-140px) scale(1.8); opacity: 0; }
}
.iron-caption {
  color: #fff6e6;
  font-size: 0.88rem;
  letter-spacing: 0.1em;
  background: rgba(43, 42, 40, 0.45);
  padding: 6px 16px;
  border-radius: 99px;
}

.finish-panel {
  width: min(100%, 460px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 26px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.45s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to { opacity: 1; transform: none; }
}
.finish-panel h2 { font-size: 1.7rem; margin: 4px 0 14px; }
.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 10px;
  border-radius: 16px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  margin: -4px 0 14px;
}
.grade-badge b {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff8ee;
  font-size: 1.15rem;
  line-height: 1;
}
.grade-badge span { font-size: 0.78rem; color: var(--ink-2); }
.mounts { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.mount {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 6px 13px;
  border-radius: 99px;
  font-size: 0.76rem;
  cursor: pointer;
  color: var(--ink-2);
}
.mount.is-active { background: var(--ink); border-color: var(--ink); color: #fff8ee; }

.piece-wrap {
  position: relative;
  display: grid;
  place-items: center;
  padding: 26px 20px;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 25%, #fffdf7, #f3e5cf);
  margin-bottom: 14px;
  min-height: 220px;
}
.piece-wrap img {
  display: block;
  max-width: min(100%, 300px);
  max-height: 220px;
  filter: drop-shadow(0 10px 14px rgba(90, 60, 40, 0.22));
  transition: transform 0.3s;
}
.piece-wrap::after {
  content: "";
  position: absolute;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 5px solid #cfae75;
  top: 4px; left: 50%;
  margin-left: -17px;
  opacity: 0;
  transition: opacity 0.25s;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.piece-wrap.mount-keychain::after { opacity: 1; }
.piece-wrap.mount-magnet { background: radial-gradient(circle at 50% 25%, #eef6f1, #dfeee6); }
.piece-wrap.mount-magnet img { filter: drop-shadow(0 6px 8px rgba(40, 70, 60, 0.2)); }
.piece-wrap.mount-coaster { background: radial-gradient(circle at 50% 30%, #fff6e2, #f2e0bd); }
.piece-wrap.mount-coaster img { max-width: min(100%, 260px); }
.piece-wrap.mount-pendant { background: radial-gradient(circle at 50% 25%, #f8effc, #ecdcf5); }
.piece-wrap.mount-pendant::after {
  opacity: 1;
  width: 6px; height: 26px;
  border: 0;
  border-radius: 4px;
  background: #cfae75;
  top: 0;
}

.name-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  font-size: 0.76rem;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.name-field input {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  min-height: 44px;
}
.name-field input:focus { outline: 2px solid rgba(239, 118, 145, 0.5); outline-offset: 1px; }
.finish-actions { display: flex; gap: 8px; }
.finish-actions .btn { flex: 1; }
.finish-note { font-size: 0.68rem; color: var(--ink-3); margin-top: 10px; }

/* ---------- 页脚 / toast ---------- */
.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 26px 20px 40px;
  font-size: 0.74rem;
  color: var(--ink-2);
  border-top: 1px solid rgba(224, 205, 178, 0.6);
  max-width: 860px;
  margin: 0 auto;
}
.foot .muted { font-size: 0.7rem !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 80;
  background: var(--ink);
  color: #fff8ee;
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .art-board { width: min(72%, 300px); }
  .wb-layout { grid-template-columns: 1fr; }
  .wb-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
  .wb-rail .panel:first-child { grid-column: 1 / -1; }
  .wb-rail .btn-wide { grid-column: 1 / -1; }
  .rail-note { grid-column: 1 / -1; }
  .color-rail { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); max-height: none; }
  .studio-layout { grid-template-columns: 1fr; }
  .studio-controls { position: static; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 9px 12px; }
  .brand { padding: 2px 0; flex: 0 0 auto; }
  .brand-text small { display: none; }
  .nav {
    margin-left: 0; order: 2; flex: 1 1 auto; min-width: 0;
    overflow-x: auto; justify-content: flex-end;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .icon-btn { order: 3; flex: 0 0 38px; }
  .nav-btn { padding: 7px 10px; font-size: 0.78rem; }
  .stage { padding-bottom: 56px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .art-board { width: min(70%, 250px); }
  .art-note { right: 0; bottom: -10px; font-size: 0.7rem; }
  .pattern-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .gallery-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .gallery-head h2 { font-size: 1.3rem; }
  .gallery-head p { font-size: 0.8rem; }
  .chips {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    margin-inline: calc(-1 * clamp(16px, 4vw, 40px));
    padding: 3px clamp(16px, 4vw, 40px) 5px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 9px 16px;
    font-size: 0.83rem;
    display: inline-flex;
    align-items: center;
  }
  .wb-status { gap: 8px; margin-bottom: 12px; }
  .mode-btn { padding: 8px 14px; }
  .wb-stats { margin-left: 0; flex: 1 1 100%; justify-content: space-between; }
  .p-body { padding: 10px 11px 12px; }
  .p-mood { display: none; }
  .p-meta span:nth-child(3) { display: none; }
  .wb-rail { grid-template-columns: 1fr; }
  .color-rail { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .wb-tools { width: 100%; justify-content: space-between; }
  .tool { width: 38px; height: 38px; }
  .board-tip { display: none; }
  .finish-panel { padding: 18px; }
  .continue-card { gap: 12px; padding: 12px 14px; }
  .continue-card canvas { width: 58px; height: 58px; }
}

@media (max-width: 460px) {
  .hero-stats { gap: 18px; }
  .nav-btn { padding: 6px 9px; font-size: 0.76rem; }
  .brand-text strong { font-size: 0.88rem; }
  .color-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mounts { gap: 5px; }
  .mount { padding: 5px 10px; font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
