/* Bagloom 统一字体层级、控件高度与内容对齐。 */
:root {
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-size: 15px;
  line-height: 1.65;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

input,
select,
textarea,
button {
  font-size: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #8aa783;
  outline-offset: 2px;
}

.language-switch {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid #c9cfc5;
  border-radius: 9px;
  background: #fffefa;
  color: #30483a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px #1e24160c;
  cursor: pointer;
}

.language-switch:hover {
  border-color: #8ca18a;
  background: #f4f7f1;
}

.language-switch:focus-visible {
  outline: 3px solid #8aa783;
  outline-offset: 2px;
}

/* 首页：统一导航、统计区与卡片的字号，避免小字造成层级不清。 */
.top-actions .language-switch { margin-left: 2px; }

.nav-label { font-size: 11px !important; }
.nav button { min-height: 42px; font-size: 14px !important; }
.nav-count { font-size: 11px !important; }
.side-note { font-size: 12px !important; }
.crumb { font-size: 13px !important; }
.local-chip { font-size: 12px !important; }
.dashboard { max-width: 1320px !important; }
.eyebrow { font-size: 11px !important; }
.intro h1 { font-size: clamp(30px, 3.1vw, 42px) !important; }
.intro p { font-size: 15px !important; }
.hero { min-height: 290px !important; }
.hero-inner { padding: 35px 38px 34px !important; }
.hero-kicker { font-size: 12px !important; }
.hero h2 { font-size: clamp(27px, 2.7vw, 36px) !important; }
.hero p { font-size: 14px !important; }
.button-primary,
.button-quiet { min-height: 42px; font-size: 13px !important; }
.stat { min-height: 78px; }
.stat-value { font-size: 21px !important; }
.stat-label { font-size: 12px !important; }
.section-head h2 { font-size: 20px !important; }
.section-head p,
.text-link { font-size: 13px !important; }
.module-grid { gap: 16px !important; }
.module-card { min-height: 158px !important; padding: 19px !important; }
.module-card h3 { font-size: 16px !important; }
.module-card p { max-width: 34em; font-size: 13px !important; }
.workflow { margin-top: 30px !important; }
.step { min-height: 68px; padding: 15px 18px !important; }
.step strong { font-size: 12px !important; }
.step span { font-size: 11px !important; }
.footnote { font-size: 12px !important; }
.stat-value,
.nav-count,
.number,
.count { font-variant-numeric: tabular-nums; }

/* 工作台：两列宽度可伸缩，表单、动作按钮和裁片行使用统一尺寸。 */
.studio-page header,
.design-gallery-page header { padding-top: 22px; }
.studio-page header h1 { font-size: clamp(30px, 3.2vw, 40px); line-height: 1.2; }
.studio-page header p { max-width: 900px; font-size: 15px; }
.studio-page .shell { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; max-width: 1380px; }
.studio-page .panel { border-radius: 17px; }
.studio-page .stage-top { padding: 22px 24px 0; }
.studio-page .stage h2,
.studio-page .controls h2 { font-size: 22px; line-height: 1.3; }
.studio-page .muted { font-size: 14px; }
.studio-page .controls { padding: 24px; }
.studio-page .section { padding-top: 19px; margin-top: 20px; }
.studio-page .field { min-width: 155px; gap: 7px; }
.studio-page .field label { font-size: 13px; }
.studio-page .field select,
.studio-page .field input { min-height: 44px; padding: 9px 12px; font-size: 14px; }
.studio-page .button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.studio-page .button-row .btn { min-height: 42px; padding: 9px 11px; font-size: 13px; }
.studio-page .layout-preview-card { min-height: 92px; gap: 14px; padding: 12px 14px; }
.studio-page .layout-preview-card strong { font-size: 14px; }
.studio-page .layout-preview-card small { font-size: 12px; }
.studio-page .layout-preview-image { width: 70px; height: 76px; }
.studio-page .layout-gallery { gap: 7px; }
.studio-page .layout-choice { padding: 6px 4px; }
.studio-page .layout-choice svg { height: 54px; }
.studio-page .layout-choice span { min-height: 28px; font-size: 11px; line-height: 1.3; }
.studio-page .part-list { gap: 9px; }
.studio-page .part-row { min-height: 58px; gap: 10px; padding: 9px 11px; }
.studio-page .part-row strong { font-size: 14px; }
.studio-page .part-row small { font-size: 12px; }
.studio-page .material-button { min-height: 42px; padding: 6px 9px; font-size: 13px; }
.studio-page .transform-button { min-height: 34px; font-size: 12px; }
.studio-page .pill { min-height: 38px; font-size: 13px; }
.studio-page .notice { font-size: 14px; }
.studio-page .small-note { font-size: 13px; }

/* 图库：标题、筛选工具、图片和说明使用固定节奏，卡片内容顶端对齐。 */
.reference-page main,
.fabric-page main { max-width: 1320px; }
.reference-page h1,
.fabric-page h1 { font-size: clamp(30px, 3.4vw, 40px); line-height: 1.2; }
.reference-page h2,
.fabric-page h2 { font-size: clamp(23px, 2.4vw, 29px); }
.reference-page .grid { grid-auto-rows: 1fr; align-items: stretch; }
.reference-page .card { display: flex; flex-direction: column; min-height: 100%; padding: 14px; border-radius: 12px; }
.reference-page .card img { height: clamp(190px, 22vw, 250px); }
.reference-page .card h3 { font-size: 16px; line-height: 1.4; }
.reference-page .card p { font-size: 13px; line-height: 1.6; }
.fabric-page .intro { font-size: 15px; }
.fabric-page .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.fabric-page .card { border-radius: 12px; }
.fabric-page .card h3 { font-size: 19px; line-height: 1.4; }
.fabric-page .mode { font-size: 14px; line-height: 1.5; }
.fabric-page .pair img { height: clamp(175px, 20vw, 240px); }
.fabric-page .pair figcaption { font-size: 13px; }

.design-gallery-page header h1 { font-size: clamp(30px, 3.5vw, 42px); }
.design-gallery-page header p { font-size: 15px; }
.design-gallery-page .toolbar { gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.design-gallery-page .toolbar label { font-size: 14px; }
.design-gallery-page .toolbar select,
.design-gallery-page .toolbar input { min-height: 42px; font-size: 14px; }
.design-gallery-page main { max-width: 1480px; margin: 0 auto; }
.design-gallery-page .grid { align-items: stretch; gap: 20px; }
.design-gallery-page .card { display: flex; flex-direction: column; height: 100%; }
.design-gallery-page .bag { flex: none; }
.design-gallery-page .card-body { flex: 1; padding: 10px 17px 18px; }
.design-gallery-page .card-body h3 { font-size: 18px; line-height: 1.4; }
.design-gallery-page .theme { font-size: 14px; }
.design-gallery-page .codes,
.design-gallery-page .spotlight { font-size: 13px; }
.design-gallery-page .tips { max-width: none; font-size: 15px; }
.design-gallery-page .favorite-filter {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  min-width: 0;
  padding: 6px 11px;
  border: 1px solid #d7d8cc;
  border-radius: 9px;
  background: #fffefa;
  color: #454b42;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  appearance: none;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
.design-gallery-page .favorite-filter:hover,
.design-gallery-page .favorite-filter.active { border-color: #b98550; background: #fbf3e8; }
.design-gallery-page .favorite-filter-icon { color: #98622f; font-size: 17px; }
.design-gallery-page .favorite-count {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: #eeeae1;
  color: #624a31;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.design-gallery-page .favorite-filter.active .favorite-count { background: #eed8bb; }
.design-gallery-page .empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid #e3d4bf;
  border-radius: 12px;
  background: #fffaf2;
  color: #5e5549;
}
.design-gallery-page .empty-state[hidden] { display: none; }
.design-gallery-page .empty-state p { margin: 0; font-size: 14px; }
.design-gallery-page .empty-reset {
  flex: none;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid #c8b79d;
  border-radius: 8px;
  background: #fff;
  color: #604b33;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.design-gallery-page .empty-reset:hover { background: #f5ecdd; }

/* 页面内的文字链接使用统一的颜色、下划线和悬停反馈。 */
body:not(.dashboard-page) a[href]:not(.module-card):not(.button-primary):not(.button-quiet):not(.tools-link):not(.favorite) {
  color: #3f654d;
  font-weight: 600;
  text-decoration-color: #a8b9a8;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .16s ease, text-decoration-color .16s ease;
}

body:not(.dashboard-page) a[href]:not(.module-card):not(.button-primary):not(.button-quiet):not(.tools-link):not(.favorite):hover {
  color: #244a34;
  text-decoration-color: currentColor;
}

.tools-link {
  display: inline-flex !important;
  align-items: center;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid #d6dfd2;
  border-radius: 8px;
  background: #f6f8f3;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.tools-link:hover {
  border-color: #aebfa9;
  background: #edf3e9;
  text-decoration: none;
}

.design-gallery-page header a[href] {
  color: #f1d7a8 !important;
  text-decoration-color: #bca77e !important;
}

.design-gallery-page header a[href]:hover {
  color: #fff0cf !important;
}

.reference-page main > p:nth-of-type(2),
.fabric-page main > p:not(.intro) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.reference-page main > p:nth-of-type(2) a,
.fabric-page main > p:not(.intro) a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid #d7ded3;
  border-radius: 8px;
  background: #fffefa;
  text-decoration: none;
}

.reference-page main > p:nth-of-type(2) a:hover,
.fabric-page main > p:not(.intro) a:hover {
  border-color: #a8b9a8;
  background: #f2f6ef;
}

.reference-page .card a:has(img),
.fabric-page .card a:has(img),
.design-gallery-page .card a:has(svg) {
  color: inherit;
  text-decoration: none;
}

.reference-page .card img,
.fabric-page .pair img {
  display: block;
}

.reference-page .card h3,
.fabric-page .card h3,
.design-gallery-page .card-body h3 {
  text-wrap: pretty;
}

.toolbar label,
.field label {
  line-height: 1.35;
}

select,
input:not([type="checkbox"]):not([type="radio"]),
.btn,
.button-primary,
.button-quiet {
  min-height: 42px;
}

.button-primary,
.button-quiet {
  text-decoration: none;
}

.button-primary:hover,
.button-quiet:hover {
  text-decoration: none;
}

@media (max-width: 900px) {
  .studio-page .shell { grid-template-columns: minmax(0, 1fr); }
  .studio-page .stage { position: static; }
}

@media (max-width: 720px) {
  .top-actions .language-switch { min-width: 74px; min-height: 36px; padding: 7px 10px; }
  .crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard { padding: 24px 18px max(32px, env(safe-area-inset-bottom)) !important; }
  .intro h1 { font-size: clamp(28px, 7vw, 36px) !important; }
  .intro p { font-size: 14px !important; }
  .hero { min-height: 300px !important; }
  .hero-inner { padding: 26px 22px !important; }
  .hero h2 { font-size: clamp(25px, 6vw, 31px) !important; }
  .hero p { font-size: 14px !important; }
  .stats { gap: 9px !important; }
  .stat { min-height: 72px; padding: 12px 10px !important; }
  .stat-label { font-size: 11px !important; }
  .module-grid { gap: 11px !important; }
  .module-card { min-height: 148px !important; padding: 14px !important; }
  .module-card h3 { font-size: 14px !important; }
  .module-card p { font-size: 12px !important; }
  .step { min-height: 62px; }
  .reference-page .card img { height: 220px; }
  .fabric-page .grid { grid-template-columns: minmax(0, 1fr); }
  .fabric-page .pair img { height: clamp(160px, 44vw, 220px); }
  .design-gallery-page header { padding: 22px 18px; }
  .design-gallery-page .toolbar { padding: 10px 16px; }
  .design-gallery-page .favorite-filter { min-height: 44px; }
  .design-gallery-page main { padding: 18px 16px 42px; }
}

@media (max-width: 570px) {
  .studio-page header { padding: 18px 16px; }
  .studio-page header h1 { font-size: 27px; }
  .studio-page header p { font-size: 14px; }
  .studio-page .shell { gap: 14px; padding: 14px 12px 36px; }
  .studio-page .controls { padding: 18px; }
  .studio-page .stage-top { padding: 18px 18px 0; }
  .studio-page .layout-choice span { min-height: 0; font-size: 11px; }
  .studio-page .button-row .btn { min-height: 44px; }
  .reference-page main,
  .fabric-page main { padding-right: 16px; padding-left: 16px; }
  .reference-page h1,
  .fabric-page h1 { font-size: 28px; }
  .reference-page h2,
  .fabric-page h2 { font-size: 23px; }
}
