/* ============================================================
 * app.css —— 页面布局 + 字帖渲染区样式
 * ========================================================== */
main { position: relative; z-index: 1; }
/* 保证 hidden 属性不被组件自身的 display 覆盖 */
[hidden] { display: none !important; }

/* ---------------- i18n 单语切换：按 data-lang 显示一门 ---------------- */
.i18n { display: inline-flex; flex-direction: column; line-height: 1.15; vertical-align: middle; }
.i18n .en, .i18n .zh { display: none; }
html[data-lang="en"] .i18n .en,
html[data-lang="zh"] .i18n .zh {
  display: inline; font-weight: inherit; font-size: inherit;
  opacity: 1; letter-spacing: 0; text-transform: none;
}

/* brand-text 在 EN 模式下用英文为主，ZH 模式下用中文为主 */
html[data-lang="en"] .brand-text strong { display: none; }
html[data-lang="en"] .brand-text em {
  font-size: 16px; font-weight: 600; opacity: 1; letter-spacing: .04em;
  text-transform: none; color: var(--ink); font-family: var(--font-serif);
}
html[data-lang="zh"] .brand-text em { display: none; }

/* 语言切换按钮 */
.lang-toggle {
  display: inline-flex; gap: 1px; padding: 2px;
  border-radius: 9px; background: var(--surface-2);
}
.lang-btn {
  padding: 4px 9px; border: 0; background: transparent; border-radius: 7px;
  font-size: 11px; color: var(--ink-3); cursor: pointer; font-weight: 550;
  transition: all .15s var(--ease); font-family: var(--font-serif);
}
.lang-btn.is-active {
  background: var(--surface); color: var(--ink); font-weight: 650;
  box-shadow: 0 1px 2px #1a181508;
}
.lang-btn:not(.is-active):hover { color: var(--ink); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(18px) saturate(1.7);
  -webkit-backdrop-filter: blur(18px) saturate(1.7);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 0 #1A181508, 0 8px 24px #1A181508; }
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; height: var(--topbar-h);
  padding: 0 14px; display: flex; align-items: center; gap: 26px;
}

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--ink); color: var(--paper); box-shadow: var(--sh-1);
}
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.brand-mark.sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-mark.sm svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-serif); font-size: 16px; font-weight: 600; letter-spacing: .04em; }
.brand-text em { font-style: normal; font-size: 10px; letter-spacing: .12em; color: var(--ink-3); text-transform: uppercase; }

.topnav { display: flex; gap: 4px; }
.topnav a {
  position: relative; padding: 7px 13px; border-radius: 9px;
  font-size: 13.5px; color: var(--ink-3); transition: all .18s var(--ease);
}
.topnav a:hover { color: var(--ink); background: var(--surface-2); }
.topnav a.is-active { color: var(--ink); font-weight: 600; }
.topnav a.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: 1px;
  height: 2px; border-radius: 2px; background: var(--accent);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------------- Hero ---------------- */
.hero { max-width: var(--maxw); margin: 0 auto; padding: 62px 26px 44px; }
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: 44px; align-items: center; }
.hero-copy h1 {
  margin: 18px 0 0; font-family: var(--font-serif);
  font-size: clamp(38px, 4.6vw, 58px); line-height: 1.22; font-weight: 600; letter-spacing: .01em;
}
.hero-copy h1 em { font-style: normal; color: var(--accent); position: relative; }
.hero-copy h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .08em; height: .16em;
  background: var(--accent); opacity: .16; border-radius: 2px;
}
.hero-sub { margin: 16px 0 0; max-width: 30em; font-size: 15px; line-height: 1.85; color: var(--ink-2); }
.hero-cta { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 30px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border); }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats b { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.hero-stats span { font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }

/* Hero 纸叠（2:3 纸卡 + 16 模板轮换） */
.hero-visual { position: relative; height: 500px; display: grid; place-items: center; }
.hero-visual .stack { position: relative; width: 292px; height: 438px; perspective: 1200px; }
.hero-visual .sheet {
  position: absolute; inset: 0; border-radius: 8px; background: #fff;
  box-shadow: var(--sh-paper); overflow: hidden; padding: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .55s var(--ease-out), box-shadow .55s var(--ease-out), opacity .55s var(--ease-out);
  transform-origin: 50% 100%;
}
.hero-visual .sheet-1 { transform: rotate(-2.4deg) translateY(0); z-index: 3; }
.hero-visual .sheet-2 { transform: rotate(3.6deg) translate(20px, 12px); z-index: 2; opacity: .94; }
.hero-visual .sheet-3 { transform: rotate(-6.5deg) translate(-26px, 26px); z-index: 1; opacity: .86; }
.hero-visual:hover .sheet-1 { transform: rotate(-1deg) translateY(-10px); box-shadow: 0 4px 8px #00000012, 0 16px 36px #00000014, 0 44px 90px #00000012; }
.hero-visual:hover .sheet-2 { transform: rotate(2.6deg) translate(52px, 6px); }
.hero-visual:hover .sheet-3 { transform: rotate(-8.5deg) translate(-58px, 20px); }
.hero-visual .sheet-2 .mini-sheet,
.hero-visual .sheet-3 .mini-sheet { opacity: .55; filter: saturate(.4); }

.hero-mini {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  animation: heroSheetIn .55s var(--ease-out);
}
.hero-mini > .mini-sheet { width: 100%; }
@keyframes heroSheetIn {
  from { opacity: 0; transform: translateY(14px) scale(.965) rotate(.6deg); }
}

.hero-badge {
  position: absolute; right: 6px; bottom: 24px; z-index: 4;
  display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-2);
  font-size: 12.5px; font-weight: 550; color: var(--ink-2);
  cursor: pointer; user-select: none; max-width: 240px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.hero-badge:hover { transform: translateY(-2px); border-color: var(--ink-4); box-shadow: var(--sh-3); }
.hero-badge:active { transform: scale(.97); }
.hero-badge > svg:first-child { width: 14px; height: 14px; fill: none; stroke: var(--jade); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hero-badge span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-badge-next {
  width: 13px; height: 13px; flex: none; fill: none; stroke: var(--ink-4);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s var(--ease), stroke .2s var(--ease);
}
.hero-badge:hover .hero-badge-next { transform: translateX(2px); stroke: var(--accent); }

/* ---------------- 段落标题 ---------------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 22px;
}
.section-title { font-family: var(--font-serif); font-size: 26px; font-weight: 600; letter-spacing: .01em; }
.section-desc { margin-top: 6px; font-size: 13.5px; color: var(--ink-3); }
.section-meta { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------------- 工作台 ---------------- */
.studio { max-width: var(--maxw); margin: 0 auto; padding: 26px 14px 44px; }
.studio-grid {
  display: grid; grid-template-columns: 366px minmax(0, 1fr); gap: 22px; align-items: start;
}

/* 面板 */
.panel {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 34px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden;
}
.panel-top { padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tpl-current {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--sh-1); transition: all .18s var(--ease); text-align: left;
}
.tpl-current:hover { border-color: var(--ink-4); transform: translateY(-1px); box-shadow: var(--sh-2); }
.tpl-current-ico {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: var(--accent-soft); color: var(--accent);
}
.tpl-current-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tpl-current-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tpl-current-copy b { font-size: 14px; font-weight: 600; }
.tpl-current-copy small { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-current-arrow { width: 15px; height: 15px; flex: none; color: var(--ink-4); }

.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.panel-scroll::-webkit-scrollbar { width: 9px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--ink-4); border-radius: 9px; border: 3px solid var(--surface); }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }

.block { padding: 14px 14px 4px; border-bottom: 1px solid var(--border); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.block-title { font-size: 12px; font-weight: 650; letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; }
.block-note { font-size: 11px; color: var(--ink-4); }

.content-input {
  width: 100%; min-height: 104px; resize: vertical; padding: 11px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; line-height: 1.8; letter-spacing: .04em;
  transition: all .18s var(--ease);
}
.content-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--surface); }
.input-hint {
  margin: -4px 0 4px; font-size: 11.5px; line-height: 1.45;
  color: var(--ink-3); min-height: 1.4em;
}
.quick-row { display: flex; align-items: center; gap: 6px; padding: 10px 0 12px; flex-wrap: wrap; }
.quick-label { font-size: 11.5px; color: var(--ink-4); margin-right: 2px; }
.quick {
  padding: 3px 9px; border-radius: 100px; font-size: 12px; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--border); transition: all .16s var(--ease);
}
.quick:hover { background: var(--surface-3); color: var(--ink); }

/* 拼音校对 */
.py-check {
  display: flex; flex-wrap: wrap; gap: 5px; max-height: 148px; overflow-y: auto;
  padding-bottom: 12px;
}
.py-check:empty::after { content: "输入汉字后自动标注拼音"; font-size: 12px; color: var(--ink-4); }
.py-item {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 40px; padding: 5px 6px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: all .16s var(--ease);
}
.py-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.py-item .py-c { font-family: var(--font-serif); font-size: 15px; line-height: 1.2; }
.py-item .py-p { font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.py-item.is-multi { border-color: #B1392C33; }
.py-item.is-multi .py-p { color: var(--accent); font-weight: 600; }
.py-item.is-multi .py-p::after { content: " ⇄"; opacity: .6; }

/* 设置分组 */
.settings { padding: 4px 0 8px; }
.pgroup { border-bottom: 1px solid var(--border); }
.pgroup:last-child { border-bottom: 0; }
.pgroup-head {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 13px 14px;
  font-size: 13px; font-weight: 600; transition: background .16s var(--ease);
}
.pgroup-head:hover { background: var(--surface-2); }
.pgroup-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink-4);
  transition: all .2s var(--ease);
}
.pgroup.is-open .pgroup-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pgroup-title { flex: 1; text-align: left; }
.pgroup-arrow { width: 14px; height: 14px; color: var(--ink-4); transition: transform .22s var(--ease); }
.pgroup.is-open .pgroup-arrow { transform: rotate(180deg); }
.pgroup-body {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s var(--ease);
  overflow: hidden;
}
.pgroup.is-open .pgroup-body { grid-template-rows: 1fr; }
.pgroup-body > * { min-height: 0; }
.pgroup-body-inner { padding: 0 14px 14px; }

.prow { padding: 0 14px 13px; }
.prow[hidden] { display: none; }
.row-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.row-stack .row-label { margin-bottom: 7px; font-size: 12.5px; }
.row-hint { margin-top: 5px; font-size: 11px; color: var(--ink-4); line-height: 1.5; }
.row-inline .row-hint { flex: 1; }

.panel-foot {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-foot .btn { flex: 1; }

/* 预览台 */
.stage {
  display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h) - 90px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-2); overflow: hidden;
}
.stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.stage-bar-left, .stage-bar-right { display: flex; align-items: center; gap: 8px; }
.seg-zoom {
  display: flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 9px;
}
.zoom-val {
  min-width: 46px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--ink-2); font-family: var(--font-mono);
}
.stage-divider { width: 1px; height: 16px; background: var(--border); }
.stage-info { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.stage-hint { font-size: 11.5px; color: var(--ink-4); }

.stage-canvas {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 30px 16px 44px;
  background: var(--stage-bg);
  background-image: radial-gradient(circle at 1px 1px, #1A181512 1px, transparent 0);
  background-size: 22px 22px;
}
.pages {
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  width: max-content; min-width: 100%; margin: 0 auto;
  transform-origin: top center; transition: transform .2s var(--ease);
}

/* ---------------- 字帖渲染区 ---------------- */
.cb-page {
  position: relative; flex: none; display: flex; flex-direction: column;
  background: #fff; color: #1a1a1a;
  box-shadow: 0 1px 2px #00000010, 0 8px 20px #00000012, 0 24px 48px #0000000F;
  border-radius: 2px;
}
.cb-page::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px #0000000D;
}
.cb-brand {
  position: absolute; bottom: 8px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 1; color: #555;
}
.cb-brand img { width: 24px; height: 24px; object-fit: contain; display: block; }
.cb-head { flex: none; padding-bottom: 4px; }
.cb-head-empty { height: 2px; }
.cb-title {
  text-align: center; font-family: var(--font-serif); font-size: 19px; font-weight: 600;
  letter-spacing: .12em; color: #1a1a1a;
}
.cb-fields {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 5px; font-size: 11px; color: #444;
}
.cb-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.cb-field { display: inline-flex; align-items: baseline; gap: 3px; }
.cb-field i { font-style: normal; letter-spacing: .04em; }
.cb-field u { display: inline-block; min-width: 52px; border-bottom: 1px solid #bbb; height: 1em; }
.cb-score { display: inline-flex; align-items: center; gap: 5px; }
.cb-score b { font-weight: 500; letter-spacing: .04em; }
.cb-stars s { text-decoration: none; font-size: 13px; color: #888; letter-spacing: 1px; }

.cb-body { flex: 1 1 auto; }
.cb-row { display: flex; }
.cb-row:last-child { margin-bottom: 0 !important; }

.cb-cell { position: relative; flex: none; }
.cb-cell .cb-grid-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cb-glyph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  line-height: 1; font-weight: 400; white-space: nowrap;
}
.cb-glyph-four { inset: 0 0 28%; align-items: flex-end; }
.cb-cell-v .cb-glyph { inset: 0; }

.cb-py { position: relative; flex: none; }
.cb-py .cb-grid-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cb-pinyin-row { display: flex; }
.cb-py-t {
  position: absolute; left: 0; right: 0; top: 52%; transform: translateY(-50%);
  text-align: center; font-family: var(--font-ui) !important;
  letter-spacing: .01em; line-height: 1; white-space: nowrap; font-size: inherit;
}
.cb-pattern, .cb-stroke { color: #888; }
.cb-pattern svg, .cb-stroke svg { width: 100%; height: 100%; }

/* 笔顺行：独立流式行，不与下方汉字格逐格对应；
   每个字的笔顺组左边缘对齐该字首格，组内各笔连续排列（间距由内联 margin-left 计算） */
.cb-stroke-row { display: flex; align-items: center; }
.cb-stroke-group { display: flex; align-items: center; flex: none; }
.cb-stroke-pic { display: block; flex: none; margin-right: 2px; }
.cb-stroke-pic:last-child { margin-right: 0; }

.cb-body-v { display: flex; flex-direction: row-reverse; justify-content: flex-start; height: 100%; }
.cb-col { display: flex; flex-direction: column; flex: none; }

.cb-foot {
  flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding-top: 6px; font-size: 11px; color: #555;
}
.cb-sign { display: inline-flex; align-items: baseline; gap: 4px; }
.cb-sign i { font-style: normal; }
.cb-sign u { display: inline-block; min-width: 46px; border-bottom: 1px solid #bbb; height: 1em; }
.cb-sign u.long { min-width: 78px; }
.cb-pagenum { font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* ---------------- 模板库 ---------------- */
.gallery, .materials, .guide { max-width: var(--maxw); margin: 0 auto; padding: 34px 14px; }
.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 16px;
}
.tpl-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); text-align: left;
  transition: transform .26s var(--ease-out), box-shadow .26s var(--ease-out), border-color .2s var(--ease);
}
.tpl-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), #B1392C0F, transparent 60%);
  transition: opacity .3s var(--ease);
}
.tpl-card:hover { transform: translateY(-4px); box-shadow: var(--sh-3); border-color: var(--border-2); }
.tpl-card:hover::before { opacity: 1; }
.tpl-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--sh-2); }

.tpl-preview {
  position: relative; height: 148px; padding: 14px 16px 10px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center; overflow: hidden;
}
.tpl-preview::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background: linear-gradient(to bottom, transparent, var(--surface-2));
}
.mini-sheet {
  width: 100%; background: #fff; border-radius: 2px; padding: 6px;
  box-shadow: 0 1px 2px #0001, 0 4px 10px #0001;
  transform: rotate(-.6deg); transition: transform .35s var(--ease-out);
  container-type: inline-size;
}
.tpl-card:hover .mini-sheet { transform: rotate(0) scale(1.04); }
.mini-row { display: flex; }
.mini-cell {
  position: relative; flex: 1; aspect-ratio: 1;
}
.mini-cell svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.mini-cell b {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: calc(58cqw / var(--cols, 6)); font-weight: 400; color: #333; line-height: 1;
}
.mini-cell.is-trace b { opacity: .22; }
.mini-py { height: 36%; position: relative; }
.mini-py span {
  position: absolute; left: 0; right: 0; top: 58%; transform: translateY(-50%);
  text-align: center; font-size: 4px; color: #555;
}

.tpl-card-body { padding: 13px 15px 15px; }
.tpl-card-top { display: flex; align-items: center; gap: 8px; }
.tpl-card-name { font-size: 14.5px; font-weight: 600; }
.tpl-tag {
  margin-left: auto; padding: 2px 7px; border-radius: 100px; font-size: 10.5px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.tpl-card-desc { margin-top: 5px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }

/* ---------------- 素材 ---------------- */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }
.mat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden; transition: all .22s var(--ease);
}
.mat-card:hover { border-color: var(--border-2); box-shadow: var(--sh-2); }
.mat-head {
  display: flex; align-items: center; gap: 9px; padding: 13px 15px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.mat-head b { font-size: 14px; font-weight: 600; }
.mat-head span { margin-left: auto; font-size: 11.5px; color: var(--ink-4); }
.mat-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 216px; overflow-y: auto; }
.mat-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px;
  border-radius: 8px; font-size: 13px; color: var(--ink-2); text-align: left;
  transition: all .14s var(--ease);
}
.mat-item:hover { background: var(--accent-soft); color: var(--ink); }
.mat-item::after { content: "＋"; margin-left: auto; font-size: 13px; color: var(--ink-4); opacity: 0; transition: opacity .14s; }
.mat-item:hover::after { opacity: 1; color: var(--accent); }

/* ---------------- 说明 ---------------- */
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); gap: 16px; }
.guide-card {
  position: relative; padding: 20px 20px 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  transition: all .22s var(--ease);
}
.guide-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--border-2); }
.guide-card .step {
  font-family: var(--font-serif); font-size: 26px; font-weight: 600; color: var(--accent); opacity: .28;
}
.guide-card h3 { margin-top: 6px; font-size: 15px; font-weight: 600; }
.guide-card p { margin-top: 7px; font-size: 13px; line-height: 1.8; color: var(--ink-2); }
.guide-card b { color: var(--accent); }

/* ---------------- 页脚 ---------------- */
.footer { position: relative; z-index: 1; border-top: 1px solid var(--border); background: var(--surface-2); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 34px 26px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 11px; }
.footer-brand strong { font-family: var(--font-serif); font-size: 14.5px; font-weight: 600; }
.footer-brand p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.footer-links { display: flex; gap: 18px; margin-left: auto; }
.footer-links a { font-size: 13px; color: var(--ink-3); transition: color .16s; }
.footer-links a:hover { color: var(--accent); }

.socials { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; padding-top: 2px; }
.social {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border-radius: 100px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 550; color: var(--ink-2); box-shadow: var(--sh-1);
  transition: transform .18s var(--ease), color .18s var(--ease),
    border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.social:hover {
  color: var(--accent); border-color: #B1392C40;
  transform: translateY(-1px); box-shadow: var(--sh-2);
}
.social svg {
  width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.social .i-github, .icon-btn .i-github { fill: currentColor; stroke: none; }
.footer-copy { width: 100%; padding-top: 18px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--ink-4); }

/* ---------------- 弹层内容 ---------------- */
.modal-mat-group { padding: 10px 8px 4px; }
.modal-mat-title { font-size: 12px; font-weight: 650; letter-spacing: .06em; color: var(--ink-3); padding: 6px 8px; }
.modal-mat-items { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 8px 10px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-visual { height: 460px; }
  .hero-visual .stack { width: 260px; height: 390px; }
  .studio-grid { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .stage { min-height: 70vh; }
}
@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .hero { padding: 40px 18px 30px; }
  .studio, .gallery, .materials, .guide { padding-left: 16px; padding-right: 16px; }
  .hero-stats { gap: 20px; }
  .hero-visual { height: 400px; }
  .hero-visual .stack { width: 220px; height: 330px; }
  .brand-text em { display: none; }
  .stage-canvas { padding: 18px 12px 30px; }
  .footer-inner { padding: 26px 16px; }
  .footer-links { margin-left: 0; width: 100%; }
}
