/* ============================================================
   写歪歪 · 汉字字帖生成器
   纯 CSS 视觉层：品牌橙、纸张质感、田字格绘制
   ============================================================ */

:root {
  --orange: #ff6b35;
  --orange-2: #f7931e;
  --orange-soft: #fff4ee;
  --orange-soft-2: #ffe8da;
  --ink: #333333;
  --ink-strong: #25211f;
  --muted: #666666;
  --muted-light: #999999;
  --line: #e8e8e8;
  --line-soft: #f0f0f0;
  --bg: #f5f5f5;
  --paper: #ffffff;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-card: 0 18px 48px rgba(54, 39, 32, 0.075), 0 2px 8px rgba(54, 39, 32, 0.035);
  --shadow-paper: 0 30px 70px rgba(48, 37, 31, 0.17), 0 5px 18px rgba(48, 37, 31, 0.07);
  --gradient: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  --font-round: "YouYuan", "幼圆", "Yuanti SC", "STYuanti", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-kai: "KaiTi", "STKaiti", "Kaiti SC", "AR PL UKai CN", "Songti SC", serif;
  --header-h: 72px;
  --paper-width: 210mm;
  --paper-height: 297mm;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 6%, rgba(255, 107, 53, 0.075), transparent 28%),
    radial-gradient(circle at 92% 5%, rgba(247, 147, 30, 0.055), transparent 24%),
    var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: none;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }

::selection {
  color: #fff;
  background: var(--orange);
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d9d2cd;
  border: 2px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #c6bcb5; border: 2px solid transparent; background-clip: padding-box; }

/* ============================================================
   顶部导航
   ============================================================ */
.site-header {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 18px rgba(44, 32, 25, 0.035);
  backdrop-filter: saturate(1.25) blur(14px);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1520px;
  height: 100%;
  margin: 0 auto;
  padding: 0 30px;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 11px;
  border-radius: 12px;
  outline: none;
}
.brand:focus-visible { box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3); }

.brand-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #fff;
  border-radius: 13px 13px 16px 13px;
  background: var(--gradient);
  box-shadow: 0 7px 16px rgba(255, 107, 53, 0.29), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: rotate(-3deg);
  transition: transform 0.28s ease;
}
.brand:hover .brand-mark { transform: rotate(2deg) translateY(-1px); }
.brand-mark-char {
  font-family: var(--font-round);
  font-size: 21px;
  font-weight: 800;
  transform: rotate(3deg);
}
.brand-spark {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #ffd9a8;
}
.brand-spark-a { top: -2px; right: -2px; width: 7px; height: 7px; border: 2px solid #fff; }
.brand-spark-b { bottom: 1px; left: -3px; width: 5px; height: 5px; opacity: 0.8; }

.brand-name {
  display: inline-flex;
  align-items: baseline;
  color: var(--orange);
  font-family: var(--font-round);
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.brand-pro {
  margin-left: 7px;
  padding: 2px 7px;
  color: var(--orange);
  border: 1px solid rgba(255, 107, 53, 0.32);
  border-radius: 7px;
  background: var(--orange-soft);
  font-family: "Arial Rounded MT Bold", var(--font-body);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  transform: translateY(-1px);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 5px;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.nav-item:hover { color: var(--orange); background: #fff8f4; transform: translateY(-1px); }
.nav-item.is-active {
  color: var(--orange);
  border-color: rgba(255, 107, 53, 0.13);
  background: var(--orange-soft);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.07);
}
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #6d7d8c;
  background: #f1f5f7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 700;
}
.nav-icon-cn { color: #fff; background: var(--gradient); font-family: var(--font-kai); }
.nav-icon-en { color: #7b61b7; background: #eee9fb; font-family: Georgia, serif; }
.nav-item.is-active .nav-icon-math { color: var(--orange); background: #fff; }

.header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 18px;
}
.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  color: #4a413d;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.login-btn:hover {
  color: var(--orange);
  border-color: rgba(255, 107, 53, 0.35);
  box-shadow: 0 6px 16px rgba(255, 107, 53, 0.09);
  transform: translateY(-1px);
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.22s ease;
}
.back-link:hover { color: var(--orange); }
.back-arrow { font-size: 15px; transition: transform 0.22s ease; }
.back-link:hover .back-arrow { transform: translateX(-3px); }

/* ============================================================
   整体布局
   ============================================================ */
.app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding-top: var(--header-h);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px 30px 42px;
}

.ambient {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}
.ambient-one {
  top: 150px;
  left: -140px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.085), transparent 68%);
}
.ambient-two {
  top: 480px;
  right: -160px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(247, 147, 30, 0.07), transparent 68%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 35%) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

/* ============================================================
   左栏：控制面板
   ============================================================ */
.control-panel {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow: hidden;
  border: 1px solid rgba(72, 55, 46, 0.075);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-card);
}

.control-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 25px 25px 0;
  overflow-y: auto;
  scrollbar-width: thin;
}
.control-scroll::-webkit-scrollbar { width: 6px; }
.control-scroll::-webkit-scrollbar-thumb { background: #e2dbd6; border: 1px solid transparent; background-clip: padding-box; }

.control-heading { position: relative; padding-right: 62px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.title-line h1 {
  margin: 0;
  color: var(--ink-strong);
  font-family: var(--font-round);
  font-size: clamp(23px, 2vw, 28px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1.25;
}
.pro-pill {
  display: inline-block;
  padding: 3px 8px;
  color: #b94a1e;
  border: 1px solid #ffc6ac;
  border-radius: 6px;
  background: linear-gradient(135deg, #fff1e8, #ffe4d4);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transform: translateY(1px);
}
.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}
.reset-link {
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 0;
  color: var(--muted-light);
  font-size: 11px;
  transition: color 0.2s ease;
}
.reset-link:hover { color: var(--orange); }

.field-group { margin-top: 21px; }
.section-divider {
  height: 1px;
  margin: 21px 0 0;
  background: linear-gradient(90deg, transparent, var(--line) 12%, var(--line) 88%, transparent);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.field-label {
  color: #3e3734;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.char-counter {
  padding: 2px 8px;
  color: var(--orange);
  border-radius: 6px;
  background: var(--orange-soft);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mini-note { color: var(--muted-light); font-size: 11px; }

/* 输入框 */
.textarea-shell {
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #fcfbfa;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.textarea-shell:focus-within {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.09);
}
#charInput {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 180px;
  padding: 13px 14px 4px;
  resize: vertical;
  color: #2d2927;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.75;
}
#charInput::placeholder {
  color: #b2aaa5;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.7;
}
.textarea-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 8px 14px;
}
.textarea-tip { color: #b3aaa5; font-size: 10px; }
.clear-btn {
  padding: 2px 4px;
  color: var(--muted-light);
  font-size: 10.5px;
  transition: color 0.2s ease;
}
.clear-btn:hover { color: var(--orange); }

.quick-picks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.quick-label { color: #aaa29d; font-size: 10.5px; margin-right: 1px; }
.quick-chip {
  padding: 4px 9px;
  color: #7b706a;
  border: 1px solid #efebe8;
  border-radius: 99px;
  background: #fbfaf9;
  font-size: 10.5px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.quick-chip:hover {
  color: var(--orange);
  border-color: #ffd2bd;
  background: var(--orange-soft);
  transform: translateY(-1px);
}

/* 格子类型 */
.grid-type-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.grid-type {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 66px;
  padding: 8px 2px 7px;
  color: #766c66;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fbfaf9;
  font-size: 10.5px;
  font-weight: 600;
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.grid-type:hover { border-color: #ffc9b3; color: var(--orange); transform: translateY(-1px); }
.grid-type.is-active {
  color: var(--orange);
  border-color: var(--orange);
  background: #fff8f3;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.075), 0 5px 12px rgba(255, 107, 53, 0.06);
}
.mini-grid {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: 0.9;
}
.mini-grid i, .mini-grid b, .mini-grid em, .mini-grid u {
  position: absolute;
  pointer-events: none;
}
.mini-tian i, .mini-mi i, .mini-hui i {
  top: 50%;
  right: 0;
  left: 0;
  height: 0;
  border-top: 1px dashed currentColor;
}
.mini-tian b, .mini-mi b, .mini-hui b {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 1px dashed currentColor;
}
.mini-mi em {
  top: 50%;
  left: -5px;
  width: 37px;
  height: 0;
  border-top: 1px dashed currentColor;
  transform-origin: center;
}
.mini-mi em:first-of-type { transform: rotate(45deg); }
.mini-mi em:last-of-type { transform: rotate(-45deg); }
.mini-hui u {
  top: 25%;
  right: 25%;
  bottom: 25%;
  left: 25%;
  border: 1px dashed currentColor;
}
.mini-blank { border-style: solid; }

/* 排版方式 */
.layout-group { margin-top: 17px; }
.layout-label-row { margin-bottom: 9px; }
.inline-trace {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.inline-trace-label {
  color: #7d736c;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.inline-trace .switch { width: 42px; height: 23px; }
.inline-trace .switch-knob { width: 17px; height: 17px; }
.inline-trace .switch.is-on .switch-knob { transform: translateX(17px); }
.inline-trace .switch-text { font-size: 6px; }
.inline-trace .switch.is-on .switch-text { left: 5px; }
.layout-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.layout-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 53px;
  padding: 7px 9px;
  color: #766c66;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fbfaf9;
  text-align: left;
  transition: color 0.28s ease, border-color 0.28s ease, background 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
}
.layout-option:hover {
  color: var(--orange);
  border-color: #ffc9b3;
  background: #fffaf7;
  transform: translateY(-1px);
}
.layout-option.is-active {
  color: var(--orange);
  border-color: var(--orange);
  background: #fff8f3;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.07), 0 5px 12px rgba(255, 107, 53, 0.055);
}
.layout-thumb {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 33px;
  overflow: hidden;
  color: #b6ada7;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: #fff;
}
.layout-thumb-single {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
.layout-thumb-row {
  grid-template-columns: repeat(4, 1fr);
}
.layout-thumb i {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid #e7e1dd;
  border-bottom: 1px solid #e7e1dd;
  font-family: var(--font-kai);
  font-size: 7px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
}
.layout-thumb-row i { border-bottom: 0; }
.layout-thumb i:last-child { border-right: 0; }
.layout-thumb i.is-model { color: var(--orange); background: #fff3ec; }
.layout-option-copy { display: flex; flex-direction: column; min-width: 0; }
.layout-option-copy strong {
  color: #4d443f;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}
.layout-option-copy small {
  margin-top: 1px;
  overflow: hidden;
  color: #a49a94;
  font-size: 8px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layout-option.is-active .layout-option-copy strong { color: var(--orange); }

/* 参数 */
.param-group { display: flex; flex-direction: column; gap: 2px; }
.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 49px;
  padding: 8px 0;
}
.param-copy { display: flex; flex-direction: column; min-width: 0; }
.param-desc { margin-top: -1px; color: #aaa29d; font-size: 10px; line-height: 1.4; }

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 47%;
  max-width: 190px;
}
input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 99px;
  outline: none;
  background: linear-gradient(to right, var(--orange) 0 var(--range-progress, 25%), #eee9e5 var(--range-progress, 25%) 100%);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 2px 7px rgba(255, 107, 53, 0.4);
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.18s ease;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 2px 7px rgba(255, 107, 53, 0.4);
}
.range-value {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  min-width: 45px;
  padding: 3px 6px;
  color: var(--orange);
  border-radius: 6px;
  background: var(--orange-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.range-value span { margin-left: 1px; color: #c08b72; font-size: 8px; font-weight: 500; }

.select-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.select-shell:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.08); }
.select-shell select {
  width: 100%;
  padding: 7px 27px 7px 10px;
  color: #4b423d;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.select-shell svg {
  position: absolute;
  right: 8px;
  color: #9d948e;
  pointer-events: none;
}
.select-shell select option { background: #fff; color: #333; }

.stepper {
  display: flex;
  align-items: center;
  height: 31px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.stepper-btn {
  width: 30px;
  height: 100%;
  color: #8c827b;
  font-size: 16px;
  line-height: 1;
  transition: color 0.18s ease, background 0.18s ease;
}
.stepper-btn:hover { color: var(--orange); background: var(--orange-soft); }
.stepper input {
  width: 36px;
  height: 100%;
  padding: 0;
  color: #3d3531;
  border: 0;
  border-right: 1px solid #f1eeeb;
  border-left: 1px solid #f1eeeb;
  outline: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }

/* 开关 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 47px;
  height: 25px;
  padding: 0 5px;
  border: 1px solid #e2ddd9;
  border-radius: 99px;
  background: #e9e5e2;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(68, 50, 40, 0.2);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), width 0.2s ease;
}
.switch-text {
  position: absolute;
  right: 5px;
  color: #9a918b;
  font-family: Arial, sans-serif;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.03em;
  transition: color 0.3s ease, right 0.3s ease;
}
.switch.is-on {
  border-color: transparent;
  background: var(--gradient);
  box-shadow: 0 3px 10px rgba(255, 107, 53, 0.25);
}
.switch.is-on .switch-knob { transform: translateX(19px); }
.switch.is-on .switch-text {
  right: auto;
  left: 6px;
  color: rgba(255, 255, 255, 0.95);
}

/* 颜色 */
.color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 43px;
  padding: 6px 0;
}
.color-copy {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
}
.color-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.inline-swatches {
  display: flex;
  align-items: center;
  gap: 4px;
}
.inline-swatch {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--color);
  box-shadow: 0 0 0 1px #e7e1dd;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.inline-swatch:hover { transform: scale(1.18); box-shadow: 0 0 0 1px var(--orange); }
.inline-swatch.is-active { box-shadow: 0 0 0 2px var(--orange); }
.native-color {
  width: 31px;
  height: 31px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e4ddd8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.native-color:hover { border-color: #ffc1a6; box-shadow: 0 3px 9px rgba(255, 107, 53, 0.09); }
.native-color::-webkit-color-swatch-wrapper { padding: 3px; }
.native-color::-webkit-color-swatch { border: 0; border-radius: 5px; }
.native-color::-moz-color-swatch { border: 0; border-radius: 5px; }
.hex-input {
  width: 68px;
  height: 31px;
  padding: 0 6px;
  color: #6f6660;
  border: 1px solid #e9e2dd;
  border-radius: 7px;
  outline: 0;
  background: #faf8f7;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9.5px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.hex-input:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.08);
}
.hex-input.is-invalid {
  border-color: #e26969;
  background: #fff6f6;
  box-shadow: 0 0 0 3px rgba(226, 105, 105, 0.08);
}
.color-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  padding: 2px 0 3px;
  gap: 8px;
}
.color-reset {
  padding: 3px 7px;
  color: #ff6b35;
  border-radius: 5px;
  background: #fff3ed;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.2s ease, color 0.2s ease;
}
.color-reset:hover { color: #fff; background: var(--orange); }
.color-hint {
  color: #b0a69f;
  font-size: 8.5px;
  line-height: 1.4;
  text-align: right;
}

.margin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 13px;
  margin-top: 5px;
  border-top: 1px dashed #f0ebe8;
}
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid #eee8e4;
  border-radius: 8px;
  background: #f8f6f4;
}
.segmented button {
  min-width: 34px;
  padding: 4px 8px;
  color: #8f867f;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.segmented button:hover { color: var(--orange); }
.segmented button.is-active {
  color: var(--orange);
  background: #fff;
  box-shadow: 0 2px 6px rgba(66, 48, 38, 0.09);
}

/* 操作按钮 */
.action-area {
  position: relative;
  flex: 0 0 auto;
  padding: 14px 25px 19px;
  border-top: 1px solid #f4efec;
  background: #fff;
  box-shadow: 0 -10px 22px rgba(54, 39, 32, 0.025);
}
.action-area::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 28px;
  background: linear-gradient(to top, #fff 16%, rgba(255, 255, 255, 0));
  pointer-events: none;
}
.scroll-cue {
  position: absolute;
  z-index: 4;
  bottom: calc(100% + 2px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  color: #8c817a;
  border: 1px solid #eee6e1;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 12px rgba(54, 39, 32, 0.06);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.scroll-cue span { color: var(--orange); font-size: 12px; line-height: 1; }
.scroll-cue:hover { color: var(--orange); border-color: #ffd1bd; }
.scroll-cue.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}
.btn:active { transform: translateY(1px) scale(0.995); }
.btn-primary {
  width: 100%;
  color: #fff;
  border: 1px solid transparent;
  background: var(--gradient);
  box-shadow: 0 9px 20px rgba(255, 107, 53, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(255, 107, 53, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 9px;
}
.btn-secondary {
  color: var(--orange);
  border: 1.5px solid #ffc4aa;
  background: #fff;
}
.btn-secondary:hover {
  border-color: var(--orange);
  background: #fffaf7;
  box-shadow: 0 8px 18px rgba(255, 107, 53, 0.1);
  transform: translateY(-2px);
}
.action-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 12px 0 0;
  color: #b1a7a1;
  font-size: 9.5px;
}
.note-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7ac29d;
  box-shadow: 0 0 0 3px rgba(122, 194, 157, 0.13);
}

/* ============================================================
   右栏：预览
   ============================================================ */
.preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 16px);
  border: 1px solid rgba(72, 55, 46, 0.075);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 0 19px 0 22px;
  border-bottom: 1px solid #f0eeec;
  background: rgba(255, 255, 255, 0.97);
}
.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #403834;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #39b979;
  box-shadow: 0 0 0 4px rgba(57, 185, 121, 0.12);
  animation: livePulse 2.4s ease-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(57, 185, 121, 0.1); }
  45% { box-shadow: 0 0 0 6px rgba(57, 185, 121, 0.035); }
}
.paper-badge {
  padding: 2px 6px;
  color: #8e857f;
  border: 1px solid #e9e5e2;
  border-radius: 5px;
  background: #faf9f8;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}
.page-nav, .zoom-group {
  display: flex;
  align-items: center;
  gap: 3px;
}
.page-indicator {
  min-width: 75px;
  color: #7e746e;
  font-size: 10.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #7b716b;
  border: 1px solid #eeeae7;
  border-radius: 7px;
  background: #fff;
  font-size: 17px;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover:not(:disabled) {
  color: var(--orange);
  border-color: #ffd1bd;
  background: #fff8f4;
  transform: translateY(-1px);
}
.icon-btn:disabled { opacity: 0.36; cursor: not-allowed; }
.toolbar-separator { width: 1px; height: 20px; background: #eeeae7; }
.zoom-value {
  display: inline-block;
  min-width: 40px;
  color: #5d544f;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.fit-btn {
  padding: 4px 8px;
  color: #8d847e;
  border: 1px solid #eeeae7;
  border-radius: 6px;
  font-size: 9.5px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.fit-btn:hover { color: var(--orange); border-color: #ffd1bd; background: #fff8f4; }

.preview-stage {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  height: clamp(600px, calc(100vh - 205px), 880px);
  overflow: auto;
  padding: 26px;
  background-color: #efedea;
  background-image: radial-gradient(rgba(116, 100, 90, 0.13) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  scrollbar-width: thin;
}
.stage-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.18)),
    linear-gradient(180deg, rgba(68, 54, 46, 0.02), transparent 18%, transparent 82%, rgba(68, 54, 46, 0.025));
}
.paper-scaler {
  position: relative;
  flex: 0 0 auto;
  margin: auto;
  transition: width 0.18s ease-out, height 0.18s ease-out;
}
.paper {
  position: relative;
  width: var(--paper-width);
  height: var(--paper-height);
  overflow: hidden;
  border-radius: 2px;
  background: #fff;
  box-shadow: var(--shadow-paper);
  transform-origin: top left;
  transition: transform 0.16s ease-out;
  will-change: transform;
}
.paper::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.13) 0%, transparent 23%, transparent 77%, rgba(119, 98, 82, 0.018) 100%);
}

.preview-footbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 37px;
  padding: 0 21px;
  color: #a69c96;
  border-top: 1px solid #f1eeec;
  background: #fff;
  font-size: 9.5px;
}
.scroll-tip { display: inline-flex; align-items: center; gap: 5px; }
.preview-meta { color: #a19892; white-space: nowrap; }

/* ============================================================
   A4 字帖页面（预览与打印共用）
   ============================================================ */
.sheet-page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--paper-width);
  height: var(--paper-height);
  padding: var(--page-margin, 14mm);
  overflow: hidden;
  color: #2d2b29;
  background: #fff;
  font-family: var(--font-body);
}

.sheet-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10mm;
  height: 15mm;
  padding-bottom: 3.4mm;
  border-bottom: 0.45mm solid #f0e6df;
}
.sheet-head-left { display: flex; align-items: center; gap: 3mm; min-width: 0; }
.sheet-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 9mm;
  height: 9mm;
  color: #fff;
  border-radius: 2.6mm;
  background: var(--gradient);
  font-family: var(--font-round);
  font-size: 4.8mm;
  font-weight: 800;
  line-height: 1;
  transform: rotate(-3deg);
}
.sheet-title-wrap { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.sheet-title {
  margin: 0;
  color: #252220;
  font-family: var(--font-round);
  font-size: 5.1mm;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.18;
  white-space: nowrap;
}
.sheet-subtitle {
  margin-top: 0.8mm;
  color: #99928e;
  font-size: 2.35mm;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.sheet-fields {
  display: flex;
  align-items: flex-end;
  gap: 4mm;
  padding-bottom: 0.3mm;
  color: #8b837e;
  font-size: 2.6mm;
  white-space: nowrap;
}
.sheet-field { display: inline-flex; align-items: flex-end; gap: 1.4mm; }
.sheet-field i {
  display: inline-block;
  width: 18mm;
  height: 0;
  border-bottom: 0.25mm solid #d9d4d0;
}
.sheet-field.date i { width: 15mm; }

.sheet-content {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
  padding-top: 5mm;
  overflow: hidden;
}
.char-grid {
  display: grid;
  margin: 0 auto;
  align-self: flex-start;
  background: #fff;
}
.char-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--cell-size);
  height: var(--row-height, var(--cell-size));
  overflow: hidden;
  border-top: 0.3mm solid var(--grid-color, #e0e0e0);
  border-left: 0.3mm solid var(--grid-color, #e0e0e0);
  background: #fff;
  contain: layout paint;
}
/* 外框右侧 / 底部补线，避免双线 */
.char-cell.is-right { border-right: 0.3mm solid var(--grid-color, #e0e0e0); }
.char-cell.is-bottom { border-bottom: 0.3mm solid var(--grid-color, #e0e0e0); }

/* 拼音四线格高度由 JS 按汉字格比例设置，汉字格保持正方形 */
.cell-pinyin-lane {
  position: relative;
  z-index: 2;
  flex: 0 0 var(--pinyin-lane, 40%);
  overflow: hidden;
  border-bottom: 0.3mm solid var(--grid-color, #e0e0e0);
  background: #fff;
}
.cell-pinyin-lane::before,
.cell-pinyin-lane::after {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 0;
  border-top: 0.2mm dashed var(--grid-color, #e0e0e0);
  pointer-events: none;
}
.cell-pinyin-lane::before { top: 33.333%; }
.cell-pinyin-lane::after { top: 66.666%; }

.char-lane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.char-cell.no-pinyin .cell-pinyin-lane { display: none; }
.char-cell.no-pinyin .char-lane { height: 100%; }

.cell-lines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.cell-line {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  border-color: var(--inner-color, #ff6b35);
  opacity: 0.9;
}
.cell-line.h {
  top: 50%;
  right: 0;
  left: 0;
  height: 0;
  border-top: 0.25mm dashed var(--inner-color, #ff6b35);
}
.cell-line.v {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 0.25mm dashed var(--inner-color, #ff6b35);
}
.cell-line.d1, .cell-line.d2 {
  top: 50%;
  left: -20.7%;
  width: 141.4%;
  height: 0;
  border-top: 0.25mm dashed var(--inner-color, #ff6b35);
  transform-origin: center;
}
.cell-line.d1 { transform: rotate(45deg); }
.cell-line.d2 { transform: rotate(-45deg); }
.cell-line.box {
  top: 25%;
  right: 25%;
  bottom: 25%;
  left: 25%;
  border: 0.25mm dashed var(--inner-color, #ff6b35);
}
.cell-line.mi-diag-left { left: -20.7%; }
.cell-line.mi-diag-right { left: -20.7%; }

.cell-pinyin {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 3%;
  left: 3%;
  overflow: hidden;
  color: #5f5752;
  font-family: "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  font-size: var(--pinyin-size, 3mm);
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  transform: translateY(-50%);
  white-space: nowrap;
}
.char-cell.no-pinyin .cell-pinyin { display: none; }
.cell-pinyin.is-ghost { color: rgba(95, 87, 82, 0.26); }
.stroke-glyph {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: var(--stroke-size, 78%);
  height: var(--stroke-size, 78%);
  overflow: visible;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.stroke-glyph path { shape-rendering: geometricPrecision; }
.stroke-fallback.is-trace { color: rgba(59, 52, 48, 0.20); }
.cell-char {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  color: #252220;
  font-family: var(--font-kai);
  font-size: var(--char-size, 12.7mm);
  font-weight: 400;
  line-height: 1;
  text-align: center;
  transform: translate(-50%, -50%) translateY(var(--char-shift, 0));
  white-space: nowrap;
}
.char-cell.has-pinyin .cell-char { transform: translate(-50%, -50%); }
.char-cell.is-trace .cell-char {
  color: rgba(59, 52, 48, 0.20);
  -webkit-text-stroke: 0.10mm rgba(74, 65, 60, 0.18);
  text-shadow: 0 0 0.12mm rgba(74, 65, 60, 0.08);
  paint-order: stroke fill;
}
.char-cell.is-empty .cell-char,
.char-cell.is-empty .cell-pinyin,
.char-cell.is-empty .stroke-hint { display: none; }

.stroke-hint {
  position: absolute;
  z-index: 4;
  top: 3%;
  left: 3.5%;
  display: inline-flex;
  align-items: center;
  gap: 0.5mm;
  padding: 0.55mm 1.1mm 0.55mm 0.85mm;
  color: var(--inner-color, #ff6b35);
  border: 0.25mm solid var(--inner-color, #ff6b35);
  border-radius: 1.2mm;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: calc(var(--cell-size) * 0.12);
  font-weight: 700;
  line-height: 1;
  opacity: 0.92;
}
.stroke-hint svg { width: 2.1mm; height: 2.1mm; }
.stroke-hint span { font-size: 0.75em; }

.sheet-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  flex: 0 0 auto;
  height: 8mm;
  margin-top: 1.5mm;
  padding-top: 2.6mm;
  color: #aaa49f;
  border-top: 0.22mm solid #f0ece9;
  font-size: 2.45mm;
  letter-spacing: 0.04em;
}
.sheet-footer .footer-page { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-footer .footer-watermark {
  color: rgba(117, 108, 102, 0.52);
  font-family: var(--font-round);
  font-size: 2.7mm;
  letter-spacing: 0.1em;
  text-align: center;
}
.sheet-footer .footer-label { color: #b8b1ac; text-align: left; }

.empty-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60mm;
  color: #c5beb9;
  text-align: center;
}
.empty-sheet-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 23mm;
  height: 23mm;
  margin-bottom: 5mm;
  color: #e4ddd8;
  border: 0.4mm dashed #e7dfda;
  border-radius: 5mm;
  font-family: var(--font-kai);
  font-size: 12mm;
}
.empty-sheet p { margin: 0; color: #b7afa9; font-size: 3.2mm; letter-spacing: 0.08em; }
.empty-sheet small { margin-top: 2mm; color: #cec7c2; font-size: 2.4mm; }

/* ============================================================
   产品特色 / 页脚
   ============================================================ */
.feature-section {
  margin-top: 36px;
  padding: 32px 4px 6px;
}
.section-heading { margin-bottom: 20px; }
.section-kicker {
  color: var(--orange);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.section-heading h2 {
  margin: 5px 0 0;
  color: #322b28;
  font-family: var(--font-round);
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 900;
  letter-spacing: -0.04em;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.feature-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 22px 21px;
  overflow: hidden;
  border: 1px solid rgba(74, 56, 46, 0.075);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 9px 25px rgba(54, 39, 32, 0.035);
  transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.32s ease, background 0.32s ease;
}
.feature-card::after {
  content: "";
  position: absolute;
  right: -35px;
  bottom: -55px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 53, 0.055), transparent 68%);
  pointer-events: none;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 107, 53, 0.18);
  background: #fff;
  box-shadow: 0 18px 38px rgba(54, 39, 32, 0.075);
}
.feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  color: var(--orange);
  border-radius: 15px;
  background: linear-gradient(145deg, #fff6f0, #ffeadf);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 5px 13px rgba(255, 107, 53, 0.08);
}
.feature-icon-custom { color: #d5851c; background: linear-gradient(145deg, #fff9ec, #ffefd0); }
.feature-icon-print { color: #557b9c; background: linear-gradient(145deg, #f2f7fb, #e4eef6); }
.feature-copy { position: relative; min-width: 0; }
.feature-index {
  display: block;
  margin-bottom: 1px;
  color: #c9c1bb;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.feature-copy h3 {
  margin: 0;
  color: #38302c;
  font-family: var(--font-round);
  font-size: 15.5px;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.feature-copy p {
  margin: 5px 0 0;
  color: #8b817a;
  font-size: 11px;
  line-height: 1.8;
}

.site-footer {
  border-top: 1px solid rgba(77, 60, 50, 0.08);
  background: rgba(255, 255, 255, 0.55);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 25px 30px 23px;
  gap: 16px 24px;
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #fff;
  border-radius: 10px;
  background: var(--gradient);
  font-family: var(--font-round);
  font-size: 16px;
  font-weight: 800;
  transform: rotate(-3deg);
}
.footer-title { margin: 0; color: #5e534c; font-family: var(--font-round); font-size: 13px; font-weight: 900; }
.footer-desc { margin: 0; color: #aaa19a; font-size: 9.5px; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: #8f857e; font-size: 10.5px; transition: color 0.2s ease; }
.footer-links a:hover { color: var(--orange); }
.copyright {
  grid-column: 1 / -1;
  margin: 3px 0 0;
  padding-top: 12px;
  color: #b5ada7;
  border-top: 1px dashed rgba(120, 102, 90, 0.1);
  font-size: 9.5px;
}

/* ============================================================
   弹窗 / Toast / Loading
   ============================================================ */
.modal-backdrop {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(49, 39, 34, 0.38);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.22s ease-out;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  width: min(360px, 100%);
  padding: 27px 27px 22px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 21px;
  background: #fff;
  box-shadow: 0 25px 70px rgba(47, 35, 28, 0.25);
  text-align: center;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 29px;
  height: 29px;
  color: #a49b95;
  border-radius: 8px;
  font-size: 21px;
  line-height: 1;
  transition: color 0.2s ease, background 0.2s ease;
}
.modal-close:hover { color: var(--orange); background: #fff4ee; }
.modal-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 51px;
  height: 51px;
  margin: 0 auto 12px;
  color: #fff;
  border-radius: 16px;
  background: var(--gradient);
  box-shadow: 0 10px 22px rgba(255, 107, 53, 0.24);
  font-family: var(--font-round);
  font-size: 26px;
  font-weight: 900;
  transform: rotate(-3deg);
}
.modal-card h3 {
  margin: 0;
  color: #332b27;
  font-family: var(--font-round);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.modal-card p {
  margin: 8px 0 17px;
  color: #8c827b;
  font-size: 11.5px;
  line-height: 1.75;
}
.modal-login-btn { width: 100%; min-height: 42px; font-size: 12.5px; }
.modal-later {
  margin-top: 10px;
  padding: 5px;
  color: #a29993;
  font-size: 10.5px;
  transition: color 0.2s ease;
}
.modal-later:hover { color: var(--orange); }
.modal-note { display: block; margin-top: 10px; color: #c0b8b2; font-size: 8.5px; }

.toast {
  position: fixed;
  z-index: 400;
  bottom: 28px;
  left: 50%;
  max-width: calc(100vw - 40px);
  padding: 10px 18px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 99px;
  background: rgba(48, 40, 35, 0.9);
  box-shadow: 0 10px 24px rgba(41, 30, 24, 0.18);
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(8px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.loading-overlay {
  position: fixed;
  z-index: 500;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(49, 40, 35, 0.4);
  backdrop-filter: blur(4px);
}
.loading-overlay[hidden] { display: none; }
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 190px;
  padding: 25px 20px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(42, 31, 25, 0.22);
}
.spinner {
  width: 29px;
  height: 29px;
  margin-bottom: 12px;
  border: 3px solid #ffe1d2;
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card strong { color: #3d3530; font-size: 12.5px; }
.loading-card small { margin-top: 3px; color: #a59b95; font-size: 9.5px; }

/* 预览刷新小动效 */
.paper.is-refreshing { animation: paperFlash 0.38s ease-out; }
@keyframes paperFlash {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.25), var(--shadow-paper); }
  50% { box-shadow: 0 0 0 5px rgba(255, 107, 53, 0.1), var(--shadow-paper); }
  100% { box-shadow: var(--shadow-paper); }
}

/* ============================================================
   打印 / PDF 使用的隐藏全量页面
   ============================================================ */
.print-root {
  position: fixed;
  z-index: -1;
  top: 0;
  left: -12000px;
  width: var(--paper-width);
  background: #fff;
  pointer-events: none;
}
.print-root .sheet-page {
  page-break-after: always;
  break-after: page;
}
.print-root .sheet-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1180px) {
  .header-inner { gap: 18px; padding: 0 22px; }
  .page-shell { padding: 24px 22px 36px; }
  .control-scroll { padding: 22px 20px 0; }
  .action-area { padding: 13px 20px 18px; }
  .preview-stage { height: clamp(560px, calc(100vh - 205px), 800px); }
  .feature-card { padding: 19px 18px; gap: 13px; }
  .feature-icon { width: 46px; height: 46px; }
}

@media (max-width: 980px) {
  .main-nav { gap: 1px; }
  .nav-item { padding: 7px 10px; }
  .header-actions { gap: 10px; }
  .back-link span:last-child { display: none; }
  .back-link::after { content: "返回"; }
  .workspace { grid-template-columns: minmax(320px, 40%) minmax(0, 1fr); gap: 17px; }
  .page-shell { padding-right: 17px; padding-left: 17px; }
  .header-inner { padding: 0 17px; }
  .preview-toolbar { padding: 0 14px; gap: 8px; }
  .preview-title { font-size: 12px; }
  .toolbar-actions { gap: 7px; }
  .toolbar-separator, .fit-btn { display: none; }
  .page-indicator { min-width: 62px; }
  .preview-stage { padding: 18px; }
  .preview-footbar { padding: 0 15px; }
  .preview-meta { display: none; }
}

@media (max-width: 820px) {
  :root { --header-h: 63px; }
  .main-nav { display: none; }
  .header-inner { justify-content: space-between; }
  .brand-name { font-size: 20px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px 11px 14px 11px; }
  .back-link { display: none; }
  .login-btn { padding: 7px 11px; }
  .workspace { display: flex; flex-direction: column; }
  .control-panel {
    position: static;
    display: block;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .control-scroll {
    overflow: visible;
    padding: 19px 16px 0;
  }
  .action-area {
    padding: 15px 16px 18px;
  }
  .scroll-cue {
    display: none;
  }
  .preview-panel { width: 100%; }
  .preview-stage { height: min(78vw, 620px); min-height: 380px; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { align-items: center; }
  .site-footer .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .site-header { backdrop-filter: blur(10px); }
}

@media (max-width: 560px) {
  .page-shell { padding: 15px 12px 28px; }
  .header-inner { padding: 0 13px; gap: 10px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 18px; }
  .brand-mark { width: 33px; height: 33px; font-size: 17px; }
  .brand-pro { font-size: 8px; padding: 1px 5px; margin-left: 4px; }
  .login-btn span { display: none; }
  .login-btn { width: 34px; height: 34px; justify-content: center; padding: 0; }
  .control-panel { border-radius: 19px; }
  .control-scroll { padding: 19px 16px 0; }
  .action-area { padding: 13px 16px 16px; }
  .preview-panel { border-radius: 19px; }
  .control-heading { padding-right: 0; }
  .reset-link { position: static; display: inline-block; margin-top: 4px; }
  .title-line h1 { font-size: 23px; }
  .subtitle { font-size: 11.5px; }
  .grid-type-list { gap: 5px; }
  .grid-type { min-height: 62px; border-radius: 9px; }
  .mini-grid { width: 25px; height: 25px; }
  .mini-mi em { width: 34px; left: -5px; }
  .param-row { gap: 9px; }
  .range-wrap { width: 48%; }
  .quick-chip { padding: 3px 8px; }
  .preview-toolbar { flex-wrap: wrap; padding: 10px 12px; min-height: 55px; gap: 7px; }
  .preview-title { font-size: 11.5px; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .page-indicator { min-width: 56px; font-size: 9.5px; }
  .preview-stage { height: min(110vw, 520px); min-height: 360px; padding: 13px; }
  .preview-footbar { font-size: 9px; padding: 0 12px; }
  .feature-section { padding-top: 24px; }
  .feature-grid { gap: 11px; }
  .feature-card { padding: 17px 15px; border-radius: 15px; }
  .feature-copy p { font-size: 10.5px; }
  .footer-inner { padding: 21px 16px 18px; }
  .footer-links { gap: 12px; }
  .toast { bottom: 18px; font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   打印样式：只保留字帖
   ============================================================ */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html, body {
    width: 210mm;
    height: auto;
    min-height: 0;
    background: #fff !important;
  }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .app,
  .site-header,
  .page-shell,
  .site-footer,
  .modal-backdrop,
  .toast,
  .loading-overlay,
  .ambient {
    display: none !important;
  }
  .print-root {
    position: static !important;
    z-index: auto !important;
    left: auto !important;
    width: auto !important;
    background: #fff !important;
  }
  .print-root .sheet-page {
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
  }
  .print-root .sheet-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .paper::after { display: none !important; }
  .sheet-page * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
