@font-face {
  font-family: "Fredoka One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/fredoka-one.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --bg: #f1f4f2;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --surface-strong: #e9eeeb;
  --text: #202928;
  --muted: #68726f;
  --line: #d7dedb;
  --line-strong: #b9c5c0;
  --ink: #1d2929;
  --teal: #27877f;
  --teal-dark: #17665f;
  --coral: #e45b64;
  --coral-dark: #c74450;
  --yellow: #f4c84a;
  --blue: #4f7fbe;
  --shadow: 0 14px 36px rgba(31, 44, 41, 0.09);
  /* 原来第一项是 Inter，但项目从未加载过它（只有 Fredoka One 有 @font-face），
     于是数字走系统 SF Pro、汉字走 PingFang，两个家族混排显得不统一。
     把中文字体提前，让中西文出自同一家族。 */
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Infinite editor workspace */
body[data-view="editor"] {
  overflow: hidden;
}

.editor-center {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.editor-center .top-status {
  margin-left: 0;
}

.history-cluster {
  display: flex;
  gap: 5px;
}

.history-cluster .icon-button {
  height: 38px;
  min-height: 38px;
  width: 38px;
}

.workspace {
  gap: 10px;
  grid-template-columns: minmax(480px, 1fr) 324px;
  height: calc(100vh - 72px);
  max-width: none;
  padding: 10px;
}

.board-panel {
  position: relative;
}

.board-toolbar {
  min-height: 58px;
}

.recent-colors {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.recent-colors > span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 900;
}

.recent-color-list {
  align-items: center;
  display: flex;
  gap: 6px;
  min-height: 39px;
  min-width: 0;
  overflow: visible;
  padding: 0 2px 6px;
}

.recent-color-button {
  background: var(--recent-color, #ffffff);
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(34, 47, 47, 0.2);
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 950;
  height: 32px;
  line-height: 1;
  padding: 0;
  position: relative;
  width: 32px;
}

.recent-color-button.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #1f2a2b, 0 3px 8px rgba(31, 42, 43, 0.16);
}

.recent-color-button.active::after {
  background: #1f2a2b;
  border-radius: 999px;
  bottom: -7px;
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 18px;
}

.canvas-wrap {
  background: #f4f7fb;
  cursor: crosshair;
  overflow: hidden;
  position: relative;
  scrollbar-gutter: auto;
}

#patternCanvas {
  background: transparent;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

.editor-command-bar,
.selection-actions,
.floating-toolbox {
  align-items: stretch;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(213, 222, 231, 0.92);
  box-shadow: 0 8px 24px rgba(32, 48, 67, 0.14);
  display: flex;
  position: absolute;
  z-index: 8;
}

.editor-command-bar {
  border-radius: 8px;
  left: 50%;
  max-width: calc(100% - 28px);
  overflow-x: auto;
  top: 12px;
  transform: translateX(-50%);
}

.editor-command-bar button,
.selection-actions button,
.floating-toolbox .tool-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #647080;
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  justify-items: center;
  min-height: 58px;
  min-width: 66px;
  padding: 7px 9px;
}

.editor-command-bar button > span,
.selection-actions button > span,
.floating-toolbox .tool-button > span {
  font-size: 20px;
  line-height: 1;
}

.editor-command-bar .colors-tool-icon,
.editor-command-bar .grid-tool-icon,
.editor-command-bar .layers-tool-icon,
.editor-command-bar .locate-tool-icon,
.editor-command-bar .mirror-tool-icon,
.editor-command-bar .size-tool-icon,
.selection-actions .mirror-tool-icon,
.completion-actions .locate-tool-icon,
.completion-actions .grid-tool-icon,
.completion-actions .colors-tool-icon {
  display: inline-grid;
  height: 22px;
  place-items: center;
  width: 22px;
}

.editor-command-bar .colors-tool-icon svg,
.editor-command-bar .grid-tool-icon svg,
.editor-command-bar .layers-tool-icon svg,
.editor-command-bar .locate-tool-icon svg,
.editor-command-bar .mirror-tool-icon svg,
.editor-command-bar .size-tool-icon svg,
.selection-actions .mirror-tool-icon svg,
.completion-actions .locate-tool-icon svg,
.completion-actions .grid-tool-icon svg,
.completion-actions .colors-tool-icon svg {
  display: block;
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

.editor-command-bar .colors-tool-icon circle,
.completion-actions .colors-tool-icon circle {
  fill: currentColor;
  stroke: none;
}

.editor-command-bar .grid-tool-accent,
.editor-command-bar .tool-icon-accent,
.selection-actions .tool-icon-accent,
.completion-actions .tool-icon-accent,
.completion-actions .grid-tool-accent {
  stroke: #2f73df;
  stroke-width: 2.8;
}

.editor-command-bar .grid-tool-icon svg,
.editor-command-bar .layers-tool-icon svg,
.editor-command-bar .locate-tool-icon svg,
.editor-command-bar .mirror-tool-icon svg,
.editor-command-bar .size-tool-icon svg,
.selection-actions .mirror-tool-icon svg,
.completion-actions .locate-tool-icon svg,
.completion-actions .grid-tool-icon svg {
  stroke-width: 2.6;
}

.editor-command-bar small,
.selection-actions small,
.floating-toolbox small {
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.editor-command-bar button:hover,
.selection-actions button:hover,
.floating-toolbox .tool-button:hover {
  background: #eef4ff;
  color: #2868df;
}

.editor-command-bar button.active,
.floating-toolbox .tool-button.active,
.selection-actions button.active {
  background: #2868df;
  color: #ffffff;
}

.editor-command-bar .command-done {
  background: #2868df;
  color: #ffffff;
  margin-left: 5px;
}

.selection-summary {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d8e1ed;
  border-radius: 999px;
  color: #1d2734;
  font-size: 11px;
  font-weight: 900;
  padding: 8px 14px;
}

.selection-actions {
  border-radius: 8px;
  max-width: calc(100% - 28px);
  overflow-x: auto;
}

.selection-actions .danger-action {
  color: #e54d58;
}

.selection-actions .danger-action:hover {
  background: #fff0f1;
  color: #d63845;
}

.selection-actions .close-action {
  font-size: 30px;
  min-width: 58px;
}

.magic-tolerance-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #cfd9e7;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(32, 48, 67, 0.14);
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  width: min(228px, calc(100% - 32px));
}

.magic-tolerance-panel > div,
.magic-tolerance-panel > label {
  align-items: center;
  display: flex;
  gap: 6px;
}

.magic-tolerance-panel > div > span {
  font-size: 11px;
}

.magic-tolerance-panel > div strong {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.magic-tolerance-panel > label:first-of-type {
  font-size: 11px;
}

.magic-tolerance-panel > label:first-of-type input {
  flex: 1;
  min-height: 16px;
  min-width: 56px;
}

.magic-tolerance-panel > label:first-of-type b {
  font-size: 12px;
  min-width: 18px;
  text-align: right;
}

.magic-tolerance-panel p {
  color: var(--muted);
  font-size: 10px;
  margin: 0;
}

.floating-toolbox {
  border-radius: 8px;
  bottom: 18px;
  left: 50%;
  max-width: calc(100% - 28px);
  overflow-x: auto;
  transform: translateX(-50%);
}

.toolbox-handle {
  align-items: center;
  color: #9aa6b3;
  cursor: grab;
  display: flex;
  flex: 0 0 auto;
  font-size: 20px;
  justify-content: center;
  touch-action: none;
  width: 24px;
}

.toolbox-handle:active {
  cursor: grabbing;
}

.footer-brush-control {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 10px;
  font-weight: 800;
  gap: 7px;
  margin-left: auto;
  width: min(190px, 24vw);
}

.footer-brush-control input {
  flex: 1;
  min-width: 60px;
}

.footer-brush-control b {
  color: var(--ink);
  min-width: 12px;
}

.editor-detail-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(31, 46, 64, 0.2);
  display: grid;
  left: 18px;
  max-height: calc(100% - 108px);
  overflow: hidden;
  position: absolute;
  top: 86px;
  width: min(520px, calc(100% - 36px));
  z-index: 12;
}

.editor-detail-panel > header {
  align-items: center;
  border-bottom: 1px solid #e2e7ee;
  display: flex;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
}

.editor-detail-panel > header h2 {
  font-size: 18px;
  margin: 0 auto 0 0;
}

.editor-detail-panel > header > button:last-child {
  background: transparent;
  color: #697586;
  font-size: 27px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.panel-toggle {
  align-items: center;
  color: #667284;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
}

.panel-toggle input,
.switch-row input {
  accent-color: #3478ee;
}

.grid-settings-panel .panel-toggle input[type="checkbox"],
.grid-settings-panel .switch-row input[type="checkbox"] {
  appearance: none;
  background: #dfe3eb;
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.04);
  cursor: pointer;
  flex: 0 0 auto;
  height: 28px;
  margin: 0;
  min-height: 28px;
  padding: 0;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  width: 48px;
}

.grid-settings-panel .panel-toggle input[type="checkbox"]::before,
.grid-settings-panel .switch-row input[type="checkbox"]::before {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(31, 46, 64, 0.2);
  content: "";
  height: 22px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 0.18s ease;
  width: 22px;
}

.grid-settings-panel .panel-toggle input[type="checkbox"]:checked,
.grid-settings-panel .switch-row input[type="checkbox"]:checked {
  background: #3b82f6;
}

.grid-settings-panel .panel-toggle input[type="checkbox"]:checked::before,
.grid-settings-panel .switch-row input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.grid-settings-panel .panel-toggle input[type="checkbox"]:focus-visible,
.grid-settings-panel .switch-row input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
  outline: none;
}

.detail-panel-body {
  display: grid;
  gap: 13px;
  overflow: auto;
  padding: 14px;
}

.editor-detail-panel details {
  border-top: 1px solid #e4e9ef;
  padding-top: 10px;
}

.editor-detail-panel summary {
  color: #263140;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  padding: 4px 0 10px;
}

.detail-fields {
  display: grid;
  gap: 11px;
}

.detail-fields > p {
  color: var(--muted);
  font-size: 10px;
  margin: 0;
}

.detail-fields .switch-row {
  justify-content: space-between;
}

.background-field,
.color-field,
.inline-fields > label,
.grid-line-row > label,
.smart-color-limit > span {
  color: #667284;
  font-size: 11px;
  font-weight: 800;
}

.color-field {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.background-field {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(88px, 1fr) auto;
  position: relative;
}

.background-menu-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  color: #697586;
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  min-width: 84px;
  padding: 6px 9px;
}

.background-current-swatch {
  background: #f4f7fb;
  border: 1px solid #d8e0ea;
  border-radius: 6px;
  display: inline-block;
  height: 26px;
  width: 34px;
}

.background-color-menu {
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(31, 46, 64, 0.18);
  display: grid;
  gap: 12px;
  padding: 12px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(320px, calc(100vw - 72px));
  z-index: 18;
}

.background-preset-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, 34px);
}

.background-preset-grid button {
  background: var(--bg-option);
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

.background-preset-grid button.active {
  border-color: #3478ee;
  box-shadow: 0 0 0 2px rgba(52, 120, 238, 0.2);
}

.background-custom-row {
  align-items: center;
  border-top: 1px solid #e4e9ef;
  display: grid;
  gap: 10px;
  grid-template-columns: auto auto minmax(0, 1fr);
  padding-top: 11px;
}

.background-custom-row input[type="text"] {
  min-height: 34px;
  text-transform: uppercase;
}

input[type="color"] {
  border: 1px solid #d8e0ea;
  height: 34px;
  min-height: 34px;
  padding: 3px;
  width: 54px;
}

.inline-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-fields > label {
  display: grid;
  gap: 5px;
}

.board-size-presets {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.board-size-presets button,
.layer-actions button {
  background: #ffffff;
  border: 1px solid #d7dfe9;
  border-radius: 6px;
  color: #2868df;
  font-size: 11px;
  font-weight: 850;
  min-height: 34px;
}

.board-size-presets button.active {
  background: #eef5ff;
  border-color: #347be6;
  box-shadow: inset 0 0 0 1px rgba(52, 123, 230, 0.36);
}

.board-size-presets button.quick-feedback {
  background: #dceaff;
  transform: translateY(-1px);
}

.line-setting-row,
.grid-line-row {
  align-items: center;
  display: grid;
  gap: 8px;
}

.line-setting-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.line-setting-row.unified-line-row {
  grid-template-columns: minmax(86px, 1fr) minmax(190px, 260px);
}

.line-setting-row label {
  color: #667284;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
}

.grid-line-row {
  grid-template-columns: 58px minmax(108px, 1fr) 54px 78px 58px;
}

.grid-line-row.unified-grid-line-row {
  grid-template-columns: 64px minmax(118px, 1fr) minmax(190px, 260px);
}

.grid-line-row > label {
  align-items: center;
  display: flex;
  gap: 5px;
}

.grid-line-row input[type="number"] {
  min-height: 34px;
  width: 66px;
}

.grid-line-row select {
  min-height: 34px;
}

.line-setting-row input[type="number"],
.grid-line-row input[type="number"] {
  min-height: 34px;
}

.legacy-line-fields.is-hidden {
  display: none;
}

.line-control-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  color: #6b7482;
  cursor: pointer;
  display: grid;
  gap: 0;
  grid-template-columns: 60px minmax(82px, 1fr) 34px;
  min-height: 42px;
  overflow: hidden;
  padding: 0;
  touch-action: manipulation;
}

.line-control-button:hover,
.line-control-button.active {
  border-color: #8eb5f5;
  box-shadow: 0 0 0 2px rgba(52, 120, 238, 0.12);
}

.line-control-button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.55;
}

.line-control-color {
  align-items: center;
  border-right: 1px solid #e3e8ef;
  display: flex;
  gap: 3px;
  height: 100%;
  justify-content: center;
  min-height: 42px;
  pointer-events: none;
  position: relative;
}

.line-control-color::after {
  background: var(--active-line-color, #8d45ff);
  border-radius: 999px;
  bottom: 8px;
  content: "";
  height: 3px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 28px;
}

.line-control-color::before {
  color: #1f2937;
  content: "✎";
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  transform: translateY(-2px);
}

.line-control-preview {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  min-width: 0;
  padding: 0 12px;
  pointer-events: none;
}

.line-control-preview i {
  display: block;
  width: 100%;
}

.line-control-chevron {
  align-items: center;
  border-left: 1px solid #e3e8ef;
  display: flex;
  height: 100%;
  justify-content: center;
  pointer-events: none;
}

.line-control-menu {
  background: #ffffff;
  border: 1px solid #dfe5ee;
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(31, 46, 64, 0.18);
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  justify-self: stretch;
  margin-top: 6px;
  padding: 12px;
  position: static;
  width: 100%;
  z-index: 1;
}

.line-menu-section-title {
  color: #667284;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.line-color-presets {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, 1fr);
}

.line-color-presets button {
  background: var(--line-option);
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.line-color-presets button.active {
  border-color: #3478ee;
  box-shadow: 0 0 0 2px rgba(52, 120, 238, 0.18);
}

.line-custom-row {
  align-items: center;
  border-top: 1px solid #e4e9ef;
  display: grid;
  gap: 9px;
  grid-template-columns: auto auto minmax(0, 1fr);
  padding-top: 11px;
}

.line-custom-row span {
  color: #687386;
  font-weight: 850;
}

.line-custom-row input[type="text"] {
  min-height: 34px;
  text-transform: uppercase;
}

.line-style-options {
  border-top: 1px solid #e4e9ef;
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.line-style-options button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #687386;
  display: grid;
  font-weight: 850;
  grid-template-columns: minmax(0, 1fr) 48px;
  min-height: 36px;
  padding: 6px 8px;
}

.line-style-options button:hover,
.line-style-options button.active {
  background: #f4f8ff;
  color: #2f6ee5;
}

.line-style-options i {
  display: block;
  margin-right: 16px;
}

.line-width-options {
  border-top: 1px solid #e4e9ef;
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, 42px) minmax(0, 1fr);
  padding-top: 10px;
}

.line-width-options button {
  background: #f4f6f8;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #687386;
  font-weight: 850;
  min-height: 38px;
  padding: 0;
}

.line-width-options button.active {
  background: #3478ee;
  color: #ffffff;
}

.line-width-options input {
  min-height: 38px;
  text-align: center;
}

.special-grid-controls {
  display: grid;
  gap: 10px;
}

.special-grid-controls.disabled {
  opacity: 0.42;
}

.editor-detail-panel > footer {
  border-top: 1px solid #e2e7ee;
  display: flex;
  gap: 8px;
  padding: 11px 14px;
}

.editor-detail-panel > footer > * {
  flex: 1;
}

.color-stats-panel {
  width: min(420px, calc(100% - 36px));
}

.color-progress-label {
  border-bottom: 1px solid #e4e9ef;
  color: #697586;
  font-size: 13px;
  font-weight: 850;
  padding: 10px 16px;
}

.color-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.color-metrics > div {
  border: 1px solid #dde4ed;
  border-radius: 7px;
  display: grid;
  gap: 6px;
  min-height: 92px;
  place-content: center;
  text-align: center;
}

.color-metrics span {
  color: #3478ee;
  font-size: 11px;
  font-weight: 850;
}

.color-metrics strong {
  color: #1e2735;
  font-size: 28px;
}

.smart-color-limit {
  border-top: 1px solid #e4e9ef;
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.smart-color-limit > div {
  align-items: center;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  min-height: 48px;
}

.smart-color-limit button {
  background: transparent;
  color: #697586;
  font-size: 24px;
}

.smart-color-limit strong {
  text-align: center;
}

.color-list-heading {
  border-bottom: 1px solid #e2e7ee;
  color: #687486;
  display: flex;
  font-size: 11px;
  font-weight: 850;
  justify-content: space-between;
  padding: 8px 0;
}

.color-stats-list,
.layer-list {
  display: grid;
  gap: 8px;
}

.color-stat-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 28px minmax(60px, 1fr) 50px 32px 62px;
  min-height: 54px;
}

.color-stat-row.pending {
  background: #eef4ff;
  border-radius: 6px;
}

.color-stat-row .legend-swatch {
  height: 24px;
  width: 24px;
}

.color-stat-row button {
  background: #f5f7fa;
  border: 1px solid #dce3ec;
  border-radius: 5px;
  color: #697586;
  font-size: 10px;
  min-height: 32px;
  padding: 4px 6px;
}

.compact-detail-panel {
  width: min(330px, calc(100% - 36px));
}

.compact-detail-panel .detail-panel-body {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#sizePanel .detail-panel-body {
  grid-template-columns: 1fr;
}

.layers-panel {
  width: min(480px, calc(100% - 36px));
}

.panel-pin {
  background: transparent;
  color: #687486;
  font-size: 11px;
  font-weight: 850;
  padding: 6px 8px;
}

.panel-pin[aria-pressed="true"] {
  color: #2868df;
}

.layer-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px 14px;
}

.layer-import-wrap {
  min-width: 0;
  position: relative;
}

.layer-import-wrap > button {
  width: 100%;
}

.layer-import-menu {
  background: #ffffff;
  border: 1px solid #dbe3ed;
  border-radius: 7px;
  box-shadow: 0 12px 28px rgba(31, 46, 64, 0.18);
  display: grid;
  gap: 3px;
  left: 0;
  min-width: 150px;
  padding: 5px;
  position: absolute;
  top: calc(100% + 6px);
  width: max-content;
  z-index: 24;
}

.layer-import-menu button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #4f5d70;
  font-size: 12px;
  font-weight: 800;
  min-height: 34px;
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}

.layer-import-menu button:hover,
.layer-import-menu button:focus-visible {
  background: #eef4ff;
  color: #2868df;
}

.layer-actions button[aria-pressed="true"] {
  background: #2868df;
  color: #ffffff;
}

.layer-list {
  max-height: calc(100% - 120px);
  overflow: auto;
  padding: 0 14px 14px;
}

.layer-row {
  border: 1px solid #dbe3ed;
  border-radius: 7px;
  display: grid;
  gap: 10px;
  padding: 11px;
}

.layer-row.active {
  border-color: #4c8af1;
  box-shadow: 0 0 0 2px rgba(76, 138, 241, 0.14);
}

.layer-main {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 22px 18px 22px 42px minmax(90px, 1fr) auto 32px;
}

.layer-main button,
.layer-controls button {
  background: transparent;
  color: #6d7888;
  min-height: 30px;
  padding: 3px;
}

.layer-thumbnail {
  background: #f8fafc;
  border: 1px solid #dce3ec;
  border-radius: 5px;
  height: 42px;
  image-rendering: pixelated;
  width: 42px;
}

.layer-drag-handle {
  color: #a4afbe;
  cursor: grab;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.layer-name-input {
  border: 0;
  color: #2868df;
  font-weight: 850;
  min-height: 32px;
  padding: 4px;
}

.layer-type {
  background: #f0f3f7;
  border-radius: 5px;
  color: #717c8d;
  font-size: 9px;
  font-weight: 900;
  padding: 5px 7px;
}

.layer-controls {
  align-items: center;
  border-top: 1px solid #e5e9ef;
  display: flex;
  gap: 7px;
  padding-top: 9px;
}

.layer-controls label {
  align-items: center;
  color: #687486;
  display: flex;
  flex: 1;
  font-size: 10px;
  font-weight: 850;
  gap: 7px;
}

.layer-controls input[type="range"] {
  flex: 1;
  min-width: 56px;
}

.layer-row:not(.active) .layer-controls {
  display: none;
}

.layer-row:not(.active) {
  gap: 0;
  padding-bottom: 8px;
  padding-top: 8px;
}

.layer-row:not(.active) .layer-thumbnail {
  height: 36px;
  width: 36px;
}

.layer-row:not(.active) .layer-main {
  grid-template-columns: 22px 18px 22px 36px minmax(90px, 1fr) auto 32px;
}

.confirm-dialog {
  background: transparent;
  border: 0;
  padding: 0;
}

.confirm-dialog::backdrop {
  background: rgba(26, 37, 51, 0.38);
  backdrop-filter: blur(2px);
}

.confirm-card {
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(30, 43, 59, 0.2);
  display: grid;
  gap: 20px;
  padding: 22px;
  width: min(420px, calc(100vw - 28px));
}

.confirm-card strong {
  font-size: 18px;
}

.confirm-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 8px 0 0;
}

.confirm-card .button-row {
  justify-content: flex-end;
}

.home-save-card .button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-save-card .button-row button {
  min-height: 38px;
}

.inspector {
  min-height: 0;
}

.inspector-panel {
  max-height: 100%;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: minmax(420px, 1fr) 286px;
  }

  .editor-center .top-status span:nth-child(4) {
    display: none;
  }
}

@media (max-width: 900px) {
  body[data-view="editor"] {
    overflow: auto;
  }

  body[data-view="editor"] .topbar {
    position: sticky;
  }

  .editor-center {
    margin-left: auto;
  }

  .editor-center .top-status {
    display: none;
  }

  .workspace {
    display: grid;
    grid-template-areas: "board" "inspector";
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 72px);
  }

  .board-panel {
    grid-area: board;
    min-height: 700px;
  }

  .inspector {
    grid-area: inspector;
    max-height: 560px;
  }

  .editor-command-bar button,
  .selection-actions button,
  .floating-toolbox .tool-button {
    min-width: 60px;
  }

  .palette-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 6px;
  }

  .board-panel {
    min-height: 650px;
  }

  .board-toolbar {
    align-items: center;
    flex-direction: row;
    min-height: 64px;
  }

  .board-toolbar-actions .ghost-button {
    display: none;
  }

  .recent-colors > span {
    display: none;
  }

  .recent-color-list {
    max-width: 210px;
  }

  .footer-brush-control {
    display: none;
  }

  .canvas-wrap {
    min-height: 520px;
  }

  .editor-command-bar button,
  .selection-actions button,
  .floating-toolbox .tool-button {
    min-height: 54px;
    min-width: 56px;
    padding: 6px;
  }

  .editor-detail-panel {
    left: 8px;
    max-height: calc(100% - 104px);
    top: 78px;
    width: calc(100% - 16px);
  }

  .grid-line-row {
    grid-template-columns: 52px minmax(102px, 1fr) 48px;
  }

  .grid-line-row select {
    grid-column: 2 / -1;
  }

  .palette-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* 徽章现在要区分「图片 / 像素」，窄屏下缩小而不是藏掉 */
  .layer-type {
    font-size: 9px;
    padding: 2px 4px;
  }
}

/* Confirmed editor, palette, completion, and project library layout */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  display: grid;
  gap: 14px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 86px;
  padding: 8px 18px;
}

body[data-view="editor"][data-editor-mode="edit"] .brand-button {
  min-width: 174px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin: 0;
  min-width: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  flex: 0 0 auto;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .icon-button {
  background: #ffffff;
  border-color: #d9dfdc;
  color: #66716e;
  height: 44px;
  min-height: 44px;
  width: 40px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  background: #ffffff;
  border: 1px solid #d9dfdc;
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(29, 41, 41, 0.08);
  display: flex;
  flex: 0 1 auto;
  left: auto;
  max-width: 100%;
  overflow-x: auto;
  position: static;
  top: auto;
  transform: none;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button {
  min-height: 58px;
  min-width: 58px;
  padding: 6px 8px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span {
  font-size: 18px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  border-radius: 6px;
  margin: 3px;
  min-height: 52px;
}

body[data-view="editor"][data-editor-mode="edit"] .top-actions {
  flex: 0 0 auto;
}

body[data-view="editor"][data-editor-mode="edit"] .top-actions button {
  font-size: 11px;
  min-height: 42px;
  padding: 8px 10px;
  white-space: nowrap;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1fr);
  height: calc(100dvh - 86px);
  min-height: 0;
  padding: 8px;
}

body[data-view="editor"][data-editor-mode="edit"] .inspector {
  display: none !important;
}

body[data-view="editor"][data-editor-mode="edit"] .board-panel {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .board-toolbar {
  align-items: stretch;
  background: #ffffff;
  display: grid;
  gap: 0;
  min-height: 112px;
  padding: 0;
}

.palette-quick-row,
.recent-toolbar-row {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
}

.palette-quick-row {
  border-bottom: 1px solid #e4e9e7;
}

.switch-palette-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  color: #34403d;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  gap: 7px;
  min-height: 42px;
  padding: 8px 12px;
  white-space: nowrap;
}

.switch-palette-button:hover {
  background: #f2f7ff;
  border-color: #8fb1e9;
  color: #2868df;
}

.switch-palette-button > span {
  color: #4f7fbe;
  font-size: 17px;
}

.palette-quick-list {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 3px 2px 8px;
  scrollbar-width: thin;
}

.quick-palette-chip {
  background: var(--quick-color, #ffffff);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(31, 42, 42, 0.14);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  height: 36px;
  min-width: 36px;
  padding: 0;
  position: relative;
  width: 36px;
}

.quick-palette-chip.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #1f2a2b, 0 3px 8px rgba(31, 42, 43, 0.16);
}

.quick-palette-chip.active::after {
  background: #1f2a2b;
  border-radius: 999px;
  bottom: -8px;
  content: "";
  height: 2px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 18px;
}

.recent-toolbar-row {
  justify-content: space-between;
}

.recent-toolbar-row .recent-colors {
  flex: 1;
}

.recent-toolbar-row .board-toolbar-actions {
  flex: 0 0 auto;
}

.floating-brush-control {
  align-items: center;
  border-left: 1px solid #e0e6e3;
  border-right: 1px solid #e0e6e3;
  color: #66716e;
  display: grid;
  flex: 0 0 112px;
  gap: 2px;
  grid-template-columns: auto 1fr auto;
  min-height: 58px;
  padding: 6px 9px;
}

.floating-brush-control small,
.floating-brush-control b {
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.floating-brush-control input {
  accent-color: #2868df;
  min-width: 52px;
  width: 100%;
}

.floating-toolbox {
  max-width: calc(100% - 20px);
}

/* Palette chooser */
.palette-dialog,
.share-dialog {
  background: transparent;
  border: 0;
  max-height: 94dvh;
  max-width: none;
  padding: 0;
  width: min(820px, calc(100vw - 34px));
}

.palette-dialog {
  width: min(720px, calc(100vw - 34px));
}

.palette-dialog::backdrop,
.share-dialog::backdrop {
  background: rgba(24, 31, 34, 0.54);
  backdrop-filter: blur(2px);
}

.palette-dialog-card {
  background: #ffffff;
  border: 1px solid #dce2e0;
  border-radius: 8px;
  box-shadow: 0 20px 54px rgba(22, 31, 35, 0.22);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: 82dvh;
  overflow: hidden;
}

.palette-dialog-header,
.share-dialog-card > header {
  align-items: center;
  border-bottom: 1px solid #e2e7e5;
  display: flex;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 20px;
}

.palette-dialog-header h2,
.share-dialog-card h2 {
  align-items: center;
  display: flex;
  font-size: 22px;
  gap: 8px;
}

.palette-dialog-header h2 span {
  color: #347be6;
}

.dialog-close-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #68727f;
  font-size: 27px;
  height: 38px;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.dialog-close-button:hover {
  background: #f1f4f3;
  color: #202928;
}

.palette-dialog-controls {
  display: grid;
  padding: 14px 24px 12px;
}

.palette-dialog-search {
  align-items: center;
  border: 1px solid #d9e0dd;
  border-radius: 8px;
  color: #78827f;
  display: flex;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
}

.palette-dialog-search input {
  border: 0;
  flex: 1;
  font-size: 14px;
  min-height: 38px;
  outline: 0;
  padding: 0;
}

.palette-dialog-body {
  display: grid;
  gap: 14px;
  /* 96px 是给「只有品牌名」的旧样式量的；现在每行还要放色数，
     不加宽的话「291 色」会折成两行 */
  grid-template-columns: 132px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 0 16px 14px;
}

.palette-dialog-sidebar {
  border-right: 1px solid transparent;
  min-width: 0;
  padding-top: 10px;
}

.palette-dialog-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.palette-dialog-toolbar {
  border-bottom: 1px solid #e3e8e6;
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.palette-dialog-tabs,
.palette-preset-buttons {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.palette-dialog-brands {
  align-items: stretch;
  display: grid;
  gap: 5px;
}

.palette-dialog-brands > span {
  color: #68726f;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  margin-bottom: 4px;
}

.palette-dialog-brands button,
.palette-preset-buttons button {
  background: #ffffff;
  border: 1px solid #d9dfdc;
  border-radius: 7px;
  color: #66706e;
  font-size: 12px;
  font-weight: 850;
  min-height: 34px;
  padding: 6px 12px;
}

.palette-preset-buttons button.active {
  background: #347be6;
  border-color: #347be6;
  color: #ffffff;
}

/* 对话框左边这一列和导入页的品牌清单用同一套排版：去掉逐项方框，
   只留细分隔线，名字靠左、色数靠右，选中那项才上底色加左侧竖条。 */
.palette-dialog-brands {
  gap: 0;
}

.palette-dialog-brands button {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  border-radius: 7px;
  color: #243033;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 10px;
  position: relative;
  text-align: left;
  width: 100%;
}

.palette-dialog-brands button:last-child {
  border-bottom: 0;
}

.palette-dialog-brands button b {
  font-size: 13px;
  font-weight: 700;
}

.palette-dialog-brands button em {
  color: #96a0ac;
  flex: none;
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.palette-dialog-brands button:hover:not(.active) {
  background: #f4f8ff;
  color: #2868df;
}

.palette-dialog-brands button.active {
  background: #eef4ff;
  border-bottom-color: transparent;
  color: #2f73df;
}

.palette-dialog-brands button.active em {
  color: #5b8ad6;
}

.palette-dialog-brands button.active::before {
  background: #2f73df;
  border-radius: 2px;
  content: "";
  height: 17px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.palette-dialog-brands button.active b {
  padding-left: 9px;
}

.palette-dialog-tabs {
  gap: 4px;
}

.palette-dialog-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #65706d;
  font-size: 13px;
  font-weight: 850;
  min-height: 34px;
  padding: 6px 10px;
}

.palette-dialog-tabs button.active {
  border-bottom-color: #347be6;
  color: #347be6;
}

.palette-preset-buttons {
  padding-bottom: 0;
}

.palette-preset-buttons button {
  min-height: 32px;
  padding: 4px 10px;
}

.palette-group-list {
  min-height: 260px;
  overflow-y: auto;
  padding: 0 0 4px;
}

.palette-family {
  border-bottom: 1px solid #e4e8e6;
}

.palette-family summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 10px;
  /* 色系名 / 预览色点 / 计数：中间一列留伸缩，计数始终贴右 */
  grid-template-columns: auto minmax(0, 1fr) auto;
  list-style: none;
  /* 行距放开：原来 6px/2px 挤得每行只有 27px 高，十几个色系连成一片 */
  min-height: 44px;
  padding: 10px 6px;
}

.palette-family summary::-webkit-details-marker {
  display: none;
}

.palette-family summary strong {
  color: #202735;
  font-size: 13px;
}

.palette-family-count {
  color: #6a7480;
  font-size: 11px;
  font-weight: 750;
}

.palette-family-grid {
  display: grid;
  gap: 3px 4px;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  justify-content: start;
  padding: 0 4px 8px;
}

.palette-family-grid button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #6b7280;
  display: grid;
  font-size: 11px;
  gap: 2px;
  justify-items: center;
  min-height: 68px;
  padding: 5px 3px;
  position: relative;
}

.palette-family-grid button > span {
  background: var(--bead-color);
  border: 1px solid rgba(31, 41, 41, 0.1);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(25, 35, 34, 0.14);
  height: 32px;
  width: 32px;
}

.palette-family-grid button > strong {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.palette-family-grid button.active {
  border-color: #77a7ff;
  box-shadow: 0 0 0 2px rgba(52, 123, 230, 0.22);
}

.palette-dialog-empty,
.custom-palette-panel {
  color: #68726f;
  font-size: 13px;
  padding: 36px 24px;
  text-align: center;
}

.custom-palette-panel {
  min-height: 260px;
  overflow-y: auto;
}

.custom-palette-panel strong {
  color: #202928;
  display: block;
  font-size: 18px;
}

.custom-palette-panel p {
  margin: 10px auto 20px;
  max-width: 440px;
}

/* Share dialog */
.share-dialog {
  width: min(620px, calc(100vw - 34px));
}

.share-dialog-card {
  background: #ffffff;
  border: 1px solid #dce2e0;
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(22, 31, 35, 0.25);
  overflow: hidden;
}

.share-dialog-body {
  min-height: 190px;
  padding: 26px;
}

.share-export-tile {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce2e0;
  border-radius: 8px;
  color: #347be6;
  display: grid;
  gap: 10px;
  height: 128px;
  justify-items: center;
  width: 128px;
}

.share-export-tile:hover {
  background: #f4f8ff;
  border-color: #8cb4ef;
}

.share-export-tile > span {
  align-items: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(37, 77, 133, 0.12);
  display: flex;
  font-size: 27px;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.share-export-tile strong {
  font-size: 15px;
}

/* Independent project library */
body[data-view="projects"] {
  background: #f6f8f7;
}

body[data-view="projects"] .topbar {
  min-height: 72px;
}

body[data-view="projects"] .top-actions {
  margin-left: auto;
}

.projects-view {
  min-height: calc(100dvh - 72px);
  padding: 30px 24px 56px;
}

.projects-shell {
  margin: 0 auto;
  max-width: 1680px;
}

.projects-toolbar {
  align-items: center;
  border-bottom: 1px solid #dfe5e2;
  display: flex;
  gap: 22px;
  justify-content: space-between;
  padding: 0 4px 22px;
}

.projects-title-group,
.projects-controls,
.project-view-toggle {
  align-items: center;
  display: flex;
}


.project-count {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  color: #68726f;
  font-size: 11px;
  font-weight: 850;
  padding: 5px 8px;
}

.projects-controls {
  flex: 1;
  gap: 9px;
  justify-content: flex-end;
  min-width: 0;
}

.project-view-toggle {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  overflow: hidden;
}

.project-view-toggle button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #68726f;
  font-size: 18px;
  height: 42px;
  width: 42px;
}

.project-view-toggle button.active {
  background: #347be6;
  color: #ffffff;
}

.project-search {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  color: #7b8582;
  display: flex;
  flex: 0 1 300px;
  gap: 8px;
  min-width: 180px;
  padding: 0 12px;
}

.project-search input {
  border: 0;
  font-size: 12px;
  min-height: 40px;
  min-width: 0;
  outline: 0;
  padding: 0;
  width: 100%;
}

.project-select-button,
.project-create-button {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  color: #283331;
  font-size: 12px;
  font-weight: 800;
  min-height: 42px;
  padding: 8px 12px;
  white-space: nowrap;
}

.project-select-button.active {
  background: #eef5ff;
  border-color: #8eb5ee;
  color: #2868df;
}

.project-create-menu-wrap {
  position: relative;
}

.project-create-button {
  background: #347be6;
  border-color: #347be6;
  color: #ffffff;
}

.project-create-menu {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(28, 40, 37, 0.15);
  display: grid;
  min-width: 190px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 12;
}

.project-create-menu button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: #303b38;
  font-size: 12px;
  font-weight: 750;
  padding: 10px;
  text-align: left;
}

.project-create-menu button:hover {
  background: #f1f5f3;
}

.project-selection-bar {
  align-items: center;
  background: #eef5ff;
  border: 1px solid #c6d9f6;
  border-radius: 8px;
  color: #315887;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  margin-top: 14px;
  padding: 9px 12px;
}

.project-selection-bar button {
  background: #ffffff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  min-height: 32px;
  padding: 6px 10px;
}

.project-selection-actions {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.project-cancel-selection-button {
  border: 1px solid #9dbcf0;
  color: #2868df;
}

.project-delete-selection-button {
  border: 1px solid #ef9aa1;
  color: #c74450;
}

.project-collection {
  align-items: start;
  display: grid;
  gap: 16px;
  /* 上限用 1fr 而不是固定 220px，否则排满整数列后右侧会留一条死空白 */
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  padding: 22px 4px;
}

.projects-view .project-card {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  display: grid;
  grid-template-rows: 145px auto;
  min-height: 238px;
  overflow: visible;
  position: relative;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.projects-view .project-card:hover,
.projects-view .project-card.selected {
  border-color: #75a5ed;
  box-shadow: 0 8px 22px rgba(36, 77, 132, 0.1);
  transform: translateY(-1px);
}

.projects-view .project-card-checkbox {
  accent-color: #347be6;
  height: 18px;
  left: 10px;
  margin: 0;
  position: absolute;
  top: 12px;
  width: 18px;
  z-index: 5;
}

.project-card-status-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  left: 9px;
  pointer-events: none;
  position: absolute;
  right: 9px;
  top: 9px;
  z-index: 4;
}

.project-card-checkbox + .project-card-status-row {
  left: 36px;
}

.project-sync-badge {
  background: rgba(255, 247, 229, 0.96);
  border: 1px solid #efd39c;
  border-radius: 8px;
  color: #a96510;
  font-size: 10px;
  font-weight: 850;
  padding: 4px 7px;
}

.project-sync-badge.synced {
  background: rgba(234, 247, 240, 0.96);
  border-color: #b9dfc9;
  color: #157453;
}

.project-menu-button {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #dce3e0;
  border-radius: 6px;
  color: #65706d;
  font-size: 20px;
  height: 30px;
  line-height: 1;
  padding: 0;
  pointer-events: auto;
  width: 30px;
}

.project-thumbnail-button {
  background: #eef1ef;
  border: 0;
  border-radius: 8px 8px 0 0;
  display: block;
  height: 145px;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.projects-view .project-thumbnail {
  height: 145px;
  width: 100%;
}

.projects-view .project-card-body {
  align-items: start;
  display: grid;
  gap: 9px;
  grid-template-columns: 1fr;
  padding: 12px;
}

.project-card-title {
  background: transparent;
  border: 0;
  color: #212a29;
  font-size: 13px;
  font-weight: 850;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.project-card-meta {
  align-items: center;
  color: #7a8481;
  display: flex;
  flex-wrap: wrap;
  font-size: 10px;
  font-weight: 750;
  gap: 5px;
}

.project-card-meta span {
  background: #f5f7f6;
  border: 1px solid #e1e6e4;
  border-radius: 6px;
  padding: 3px 6px;
}

.project-card-meta span.made {
  background: #eaf7f0;
  border-color: #b9dfc9;
  color: #157453;
}

.project-card-menu {
  background: #ffffff;
  border: 1px solid #dce3e0;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(29, 41, 39, 0.18);
  display: grid;
  min-width: 146px;
  overflow: hidden;
  position: absolute;
  right: 8px;
  top: 43px;
  z-index: 11;
}

.project-card-menu button {
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid #edf0ef;
  border-radius: 0;
  color: #34403d;
  font-size: 11px;
  font-weight: 750;
  min-height: 38px;
  padding: 8px 12px;
  text-align: left;
}

.project-card-menu button:hover {
  background: #f2f5f4;
}

.project-card-menu button.danger {
  color: #d44752;
}

.project-collection.list-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 980px;
}

.project-collection.list-view .project-card {
  grid-template-columns: 176px minmax(0, 1fr);
  grid-template-rows: 112px;
  min-height: 112px;
}

.project-collection.list-view .project-thumbnail-button,
.project-collection.list-view .project-thumbnail {
  border-radius: 8px 0 0 8px;
  height: 112px;
}

.project-collection.list-view .project-card-body {
  align-content: center;
  padding-right: 52px;
}

.projects-view .project-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  width: 100%;
}

/* Completion toolbar and read-only panels */
.completion-actions button.active {
  background: #eef4ff;
  color: #2868df;
}

.completion-actions .completion-projects-button {
  width: 72px;
}

body[data-view="editor"][data-editor-mode="complete"] .editor-detail-panel {
  left: 14px;
  max-height: calc(100% - 28px);
  top: 14px;
  z-index: 16;
}

body[data-view="editor"][data-editor-mode="complete"] .color-stats-panel #removeNoiseButton,
body[data-view="editor"][data-editor-mode="complete"] .color-stats-panel .smart-color-limit,
body[data-view="editor"][data-editor-mode="complete"] .color-stats-panel footer,
body[data-view="editor"][data-editor-mode="complete"] .color-stats-panel [data-color-action] {
  display: none !important;
}

@media (max-width: 1450px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    gap: 9px;
    padding-left: 12px;
    padding-right: 12px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-button {
    min-width: 142px;
    width: 142px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button {
    min-width: 52px;
    padding-left: 5px;
    padding-right: 5px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions button {
    font-size: 10px;
    padding-left: 8px;
    padding-right: 8px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .topbar {
    display: grid;
    grid-template-areas:
      "brand actions"
      "summary summary";
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 142px;
    row-gap: 6px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-button {
    grid-area: brand;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions {
    grid-area: actions;
    justify-self: end;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-summary {
    grid-area: summary;
    justify-self: center;
    left: auto;
    position: static;
    top: auto;
    transform: none;
  }

  body[data-view="editor"][data-editor-mode="complete"] .workspace {
    height: calc(100dvh - 142px);
  }
}

@media (max-width: 1120px) {
  body[data-view="editor"][data-editor-mode="edit"] {
    overflow: hidden;
  }

  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    grid-template-areas:
      "brand actions"
      "commands commands";
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 146px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-button {
    grid-area: brand;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    grid-area: commands;
    justify-content: center;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions {
    grid-area: actions;
    justify-self: end;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 146px);
    min-height: 0;
  }

  .projects-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .projects-controls {
    justify-content: flex-start;
  }

  .project-search {
    flex: 1;
  }

  .palette-family-grid {
    gap: 12px 14px;
    grid-template-columns: repeat(6, 56px);
  }
}

@media (max-width: 720px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    gap: 6px;
    grid-template-areas:
      "brand actions"
      "commands commands";
    min-height: 140px;
    padding: 6px 8px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-button {
    min-width: 112px;
    width: 112px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-lockup {
    gap: 6px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-symbol {
    height: 34px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-wordmark-image {
    height: 25px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions {
    gap: 4px;
    overflow-x: auto;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions button {
    font-size: 0;
    height: 38px;
    min-height: 38px;
    padding: 6px 9px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions button span {
    font-size: 15px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    gap: 5px;
    justify-content: stretch;
    min-width: 0;
  }

  body[data-view="editor"][data-editor-mode="edit"] .history-cluster .icon-button {
    height: 40px;
    min-height: 40px;
    width: 34px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
    display: flex;
    flex: 1;
    left: auto;
    max-width: none;
    overflow-x: auto;
    padding: 0;
    position: static;
    right: auto;
    transform: none;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button {
    min-height: 48px;
    min-width: 46px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
    min-height: 42px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 140px);
    min-height: 0;
    padding: 4px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .board-panel {
    min-height: 0;
  }

  body[data-view="editor"][data-editor-mode="edit"] .canvas-wrap {
    min-height: 0;
  }

  .palette-quick-row,
  .recent-toolbar-row {
    padding-left: 8px;
    padding-right: 8px;
  }

  .recent-toolbar-row .board-toolbar-actions .ghost-button {
    display: none;
  }

  .floating-toolbox .tool-button {
    min-width: 54px;
  }

  .floating-brush-control {
    flex-basis: 96px;
  }

  .palette-dialog {
    width: calc(100vw - 16px);
  }

  .palette-dialog-card {
    max-height: 92dvh;
  }

  .palette-dialog-header,
  .share-dialog-card > header {
    min-height: 60px;
    padding: 12px 16px;
  }

  .palette-dialog-header h2,
  .share-dialog-card h2 {
    font-size: 20px;
  }

  .palette-dialog-controls {
    padding: 12px 14px 10px;
  }

  .palette-dialog-body {
    gap: 10px;
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .palette-dialog-sidebar {
    padding-top: 0;
  }

  .palette-dialog-brands {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .palette-dialog-brands > span {
    flex: 0 0 auto;
    font-size: 18px;
    margin: 0;
    padding-top: 14px;
  }

  .palette-dialog-brands button {
    flex: 0 0 auto;
    font-size: 16px;
    min-height: 46px;
    padding: 8px 14px;
  }

  .palette-group-list {
    padding-left: 0;
    padding-right: 0;
  }

  .palette-family-grid {
    gap: 10px 12px;
    grid-template-columns: repeat(4, 54px);
  }

  body[data-view="projects"] .topbar {
    min-height: 72px;
    padding: 8px 12px;
  }

  body[data-view="projects"] .brand-button {
    min-width: 130px;
    width: 130px;
  }

  .projects-view {
    min-height: calc(100dvh - 68px);
    padding: 20px 14px 42px;
  }

  .projects-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .project-search {
    min-width: 0;
  }

  .project-collection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding-left: 0;
    padding-right: 0;
  }

  .projects-view .project-card {
    grid-template-rows: 118px auto;
    min-height: 212px;
  }

  .project-thumbnail-button,
  .projects-view .project-thumbnail {
    height: 118px;
  }

  .project-card-meta span:last-child {
    display: none;
  }

  .project-collection.list-view .project-card {
    grid-template-columns: 124px minmax(0, 1fr);
  }

  body[data-view="editor"][data-editor-mode="complete"] .topbar {
    display: grid;
    grid-template-areas:
      "brand"
      "actions"
      "summary";
    grid-template-columns: minmax(0, 1fr);
    min-height: 198px;
    padding: 6px 8px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-button {
    width: 124px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions {
    justify-self: stretch;
    margin: 0;
    overflow-x: auto;
    width: 100%;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions button {
    flex: 0 0 50px;
    width: 50px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions .completion-projects-button {
    flex-basis: 68px;
    width: 68px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-summary {
    justify-self: stretch;
    width: 100%;
  }

  body[data-view="editor"][data-editor-mode="complete"] .workspace {
    height: calc(100dvh - 198px);
  }
}

@media (max-width: 430px) {
  .projects-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-select-button,
  .project-create-menu-wrap {
    grid-row: 2;
  }

  .project-search {
    grid-column: 1 / -1;
  }

  .project-collection {
    grid-template-columns: minmax(0, 1fr);
  }

  .projects-view .project-card {
    grid-template-rows: 160px auto;
  }

  .project-thumbnail-button,
  .projects-view .project-thumbnail {
    height: 160px;
  }

  .project-collection.list-view .project-card {
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: 104px;
  }

  .project-collection.list-view .project-thumbnail-button,
  .project-collection.list-view .project-thumbnail {
    height: 104px;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
.file-action {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-action:focus-visible {
  outline: 3px solid rgba(39, 135, 127, 0.22);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--ink);
  margin-bottom: 0;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.direct-header-title {
  color: #2f73df;
  flex: 1 1 auto;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  margin-left: 8px;
  text-align: left;
}

.console-header-title {
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
  margin-left: 18px;
  white-space: nowrap;
}

.header-console-button {
  flex: 0 0 auto;
  margin-left: -8px;
}

.brand-button {
  align-items: center;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  gap: 11px;
  min-width: 206px;
  padding: 0;
  text-align: left;
}

.brand-mark {
  background: var(--ink);
  border-radius: 8px;
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  grid-template-columns: repeat(2, 9px);
  height: 38px;
  place-content: center;
  width: 38px;
}

.brand-mark i {
  background: var(--surface);
  border-radius: 50%;
  display: block;
  height: 9px;
  width: 9px;
}

.brand-mark i:nth-child(1) {
  background: var(--yellow);
}

.brand-mark i:nth-child(2) {
  background: var(--surface);
}

.brand-mark i:nth-child(3) {
  background: var(--coral);
}

.brand-mark i:nth-child(4) {
  background: var(--teal);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 16px;
  line-height: 1.15;
}

.brand-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.top-actions,
.home-heading-actions,
.source-actions,
.button-row,
.export-actions,
.board-toolbar-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.top-status {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  margin-left: auto;
  overflow: hidden;
}

.top-status span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 10px 12px;
  white-space: nowrap;
}

.top-status span + span {
  border-left: 1px solid var(--line);
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.text-button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 13px;
  font-weight: 800;
  gap: 6px;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
  white-space: nowrap;
}

.primary-button {
  background: var(--ink);
  color: #ffffff;
}

.primary-button:hover {
  background: #30403f;
}

.ghost-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-button:hover {
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.ghost-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.danger-button {
  background: #fff0f1;
  border: 1px solid #f2c8cc;
  color: #a8323e;
}

.danger-button:hover {
  background: #fbe2e5;
}

.icon-button {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 19px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  width: 38px;
}

.icon-button:hover {
  background: var(--surface-strong);
}

.text-button {
  background: transparent;
  color: var(--teal-dark);
  min-height: 30px;
  padding: 4px 0;
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.file-action {
  user-select: none;
}

.eyebrow {
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  margin-bottom: 7px;
}

.home-view {
  margin: 0 auto;
  max-width: 1480px;
  padding: 42px 24px 54px;
}

.home-heading {
  align-items: end;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.home-heading h1 {
  font-size: 34px;
  line-height: 1.12;
}

.home-heading p:last-child {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  margin: 9px 0 0;
}

.module-launcher {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(31, 44, 41, 0.04);
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  padding: 0;
  text-align: left;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.module-button:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.module-preview-wrap {
  background: #edf1ef;
  display: block;
  height: 178px;
  overflow: hidden;
  position: relative;
}

.style-entry .module-preview-wrap {
  background: #e9f2ef;
}

.direct-entry .module-preview-wrap {
  background: #f7e9e8;
}

.sketch-entry .module-preview-wrap {
  background: #e9eef5;
}

.module-preview {
  display: block;
  height: 100%;
  image-rendering: pixelated;
  width: 100%;
}

.entry-kicker {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(29, 41, 41, 0.13);
  border-radius: 999px;
  bottom: 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  left: 12px;
  padding: 6px 9px;
  position: absolute;
}

.entry-copy {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 17px 18px 18px;
}

.entry-copy > strong {
  font-size: 22px;
  line-height: 1.15;
}

.entry-copy > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.entry-copy b {
  align-self: end;
  color: var(--teal-dark);
  font-size: 13px;
}

.projects-section {
  border-top: 1px solid var(--line);
  margin-top: 42px;
  padding-top: 25px;
}

.section-heading {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h2 {
  font-size: 20px;
}

.section-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-card,
.project-empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 196px;
}

.project-card {
  display: grid;
  grid-template-rows: 122px auto;
  overflow: hidden;
}

.project-thumbnail {
  background: #eef1ef;
  display: block;
  height: 122px;
  image-rendering: pixelated;
  width: 100%;
}

.project-card-body {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 12px;
}

.project-card-copy {
  min-width: 0;
}

.project-card-copy strong,
.project-card-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-card-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.project-card-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}

.project-card-actions {
  display: flex;
  gap: 5px;
}

.project-card-actions .icon-button {
  font-size: 15px;
  height: 32px;
  min-height: 32px;
  width: 32px;
}

.project-empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 130px;
  padding: 24px;
  text-align: center;
}

.setup-view {
  margin: 0 auto;
  max-width: 1380px;
  padding: 34px 24px 52px;
}

.setup-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.75fr);
}

.source-card,
.setup-panel,
.tool-rail,
.board-panel,
.inspector {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(31, 44, 41, 0.06);
  min-width: 0;
}

.source-card {
  padding: 14px;
}

.source-stage {
  aspect-ratio: 4 / 3;
  background: #edf1ef;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  min-height: 360px;
  overflow: hidden;
  position: relative;
}

.source-preview {
  display: block;
  height: 100%;
  width: 100%;
}

.source-preview-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  min-height: 32px;
  padding: 0 12px;
  position: absolute;
  right: 12px;
  top: 12px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  z-index: 3;
}

.source-preview-toggle:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.source-preview-toggle.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.source-preview-toggle:active {
  transform: translateY(1px);
}

.upload-overlay {
  align-items: center;
  background: rgba(247, 249, 248, 0.92);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  inset: 0;
  justify-content: center;
  padding: 32px;
  position: absolute;
  text-align: center;
}

.upload-overlay input,
#patternImport {
  display: none;
}

.upload-overlay strong {
  color: var(--ink);
  font-size: 18px;
  margin: 12px 0 5px;
}

.upload-overlay > span:last-child {
  font-size: 12px;
  font-weight: 700;
}

.upload-icon {
  align-items: center;
  background: var(--ink);
  border-radius: 50%;
  color: #ffffff;
  display: inline-flex;
  font-size: 24px;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.source-ready {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 4;
}

.source-ready .file-action {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(31, 44, 41, 0.08);
}

.source-actions {
  flex-wrap: wrap;
  padding-top: 12px;
}

.setup-panel {
  max-height: calc(100vh - 136px);
  overflow: auto;
  padding: 16px;
  position: sticky;
  top: 72px;
}

body[data-view="setup"][data-module="style"] {
  overflow: hidden;
}

body[data-view="setup"][data-module="style"] .app-shell,
body[data-view="setup"][data-module="direct"] .app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-view="setup"][data-module="style"] .setup-view {
  height: 100%;
  max-width: none;
  min-height: 0;
  overflow: hidden;
  padding: 18px clamp(14px, 2vw, 28px) 20px;
  width: 100%;
}

body[data-view="setup"][data-module="style"] .setup-layout {
  align-items: stretch;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 340px);
  height: 100%;
  min-height: 0;
}

body[data-view="setup"][data-module="style"] .source-card {
  display: grid;
  height: 100%;
  min-height: 0;
}

body[data-view="setup"][data-module="style"] .source-stage {
  aspect-ratio: auto;
  height: 100%;
  min-height: 0;
}

body[data-view="setup"][data-module="style"] .setup-panel {
  max-height: 100%;
  position: static;
}

body[data-view="setup"][data-module="style"] .setup-panel-header {
  display: none;
}

body[data-view="setup"][data-module="style"] .setup-panel .setup-group:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

body[data-view="setup"][data-module="direct"] {
  overflow: hidden;
}

.setup-view.direct-setup-active {
  max-width: none;
  padding: 12px;
}

body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 58px 12px 12px;
  width: 100%;
}

.setup-view.direct-align-active {
  max-width: none;
  padding: 12px;
}

.direct-wizard {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 1180px;
  position: relative;
}

.direct-recognition-overlay {
  align-items: center;
  backdrop-filter: blur(1.5px);
  background: rgba(246, 249, 248, 0.72);
  display: flex;
  inset: 72px 0 0;
  justify-content: center;
  pointer-events: auto;
  position: fixed;
  z-index: 29;
}

.direct-recognition-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #e2e8ef;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(31, 44, 41, 0.16);
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 20px 28px;
}

.direct-recognition-spinner {
  animation: direct-recognition-spin 0.8s linear infinite;
  border: 2.5px solid #dfe6ef;
  border-radius: 50%;
  border-top-color: #2868df;
  height: 26px;
  margin-bottom: 6px;
  width: 26px;
}

@keyframes direct-recognition-spin {
  to { transform: rotate(360deg); }
}

.direct-recognition-overlay strong {
  color: #1d2734;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.direct-recognition-overlay small {
  color: #8a94a4;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .direct-recognition-spinner { animation-duration: 2.4s; }
}

.direct-wizard.direct-recognizing .direct-stage[data-direct-panel="align"] {
  filter: saturate(0.88);
  user-select: none;
}

.direct-setup-active .direct-wizard {
  padding-top: 0;
}

.direct-wizard.direct-align-workspace {
  max-width: none;
  width: 100%;
}

.setup-view.direct-setup-active .direct-wizard {
  max-width: none;
  width: 100%;
}

body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-wizard {
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* 无外框：每个步骤按钮自己有底色和描边，外面再套一层框是多余的一圈。 */
.direct-stepper {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 8px 12px;
}

/* 识别流程从顶栏中间下沉为第二行。右上角的 控制台/上一步/下一步 仍沿用
   .direct-footer 的原位置和样式，这里只让步骤变成低噪声的进度提示。 */
.direct-setup-active .direct-stepper {
  align-items: center;
  background: rgba(247, 249, 248, 0.96);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(31, 44, 41, 0.04);
  height: 46px;
  left: 0;
  max-width: none;
  min-width: 0;
  overflow-x: auto;
  padding: 0 18px;
  pointer-events: none;
  position: fixed;
  top: 72px;
  transform: none;
  width: 100%;
  z-index: 19;
}

.direct-setup-active .direct-stepper > * {
  pointer-events: auto;
}

.direct-setup-active .direct-step-button {
  background: transparent;
  border-color: transparent;
  color: #68726f;
  gap: 6px;
  min-height: 28px;
  min-width: 0;
  padding: 2px 0;
}

.direct-setup-active .direct-step-button::before {
  background: #ffffff;
  border: 1px solid #9cbbee;
  border-radius: 50%;
  content: "";
  height: 8px;
  width: 8px;
}

/* 箭头也走 flex 居中：字形在行盒里本来就不居中，靠 line-height 对不准。 */
.direct-stepper > span {
  align-items: center;
  color: #7aa3e3;
  display: inline-flex;
  font-size: 18px;
  line-height: 1;
}

.direct-step-button,
.direct-outline-button,
.direct-board-sizes button,
.direct-icon-button,
.direct-round-button {
  background: #ffffff;
  border: 1px solid #b9cbe6;
  border-radius: 6px;
  color: #243033;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  min-height: 32px;
  padding: 5px 8px;
}

.direct-step-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-width: 92px;
  padding: 6px 12px;
}

.direct-step-button.reached {
  background: #eef5ff;
  border-color: #8eb2ea;
  color: #255da8;
}

.direct-step-button.active,
.direct-outline-button.active,
.direct-board-sizes button.active {
  background: #2f73df;
  border-color: #2f73df;
  color: #ffffff;
}

.direct-setup-active .direct-step-button.reached,
.direct-setup-active .direct-step-button.active {
  background: transparent;
  border-color: transparent;
}

.direct-setup-active .direct-step-button.reached {
  color: #255da8;
}

.direct-setup-active .direct-step-button.reached::before {
  background: #2f73df;
  border-color: #2f73df;
}

.direct-setup-active .direct-step-button.active {
  color: #1f2a37;
  font-weight: 950;
}

.direct-setup-active .direct-step-button.active::before {
  background: #2f73df;
  border-color: #2f73df;
  box-shadow: 0 0 0 4px #eef5ff;
}

.direct-setup-active .direct-stepper > span {
  background: #b9d2f7;
  flex: 0 0 38px;
  font-size: 0;
  height: 1px;
}

.direct-stage {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: min(620px, calc(100vh - 230px));
}

.direct-stage[data-direct-panel="align"] {
  gap: 12px;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: min(690px, calc(100vh - 186px));
}

.setup-view.direct-setup-active .direct-stage:not([data-direct-panel="proof"]):not(.direct-finish-stage) {
  gap: 12px;
  grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - 96px);
  min-height: 560px;
}

body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage:not(.is-hidden) {
  height: 100%;
  min-height: 0;
}

.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] {
  grid-template-columns: 228px minmax(0, 1fr);
  height: calc(100vh - 96px);
  min-height: 560px;
}

.direct-stage[data-direct-panel="proof"],
.direct-finish-stage {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}

.direct-stage[data-direct-panel="proof"] {
  gap: 8px;
  grid-template-rows: minmax(0, 2fr) minmax(240px, 1fr);
  height: calc(100vh - 104px);
}

.direct-side-panel,
.direct-main-panel,
.direct-replace-panel,
.direct-proof-area,
.direct-proof-workbench,
.direct-finish-preview {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(31, 44, 41, 0.05);
}

.direct-side-panel {
  align-content: start;
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

.direct-side-panel h2 {
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 4px;
}

.direct-advanced-panel label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 850;
  gap: 6px;
}

/* 九个牌子原来是九个同样大小的圆角方块摞在一起，眼睛没有落点，只能逐个读文字。
   改成一份清单：每项只用一条细分隔线隔开，名字靠左、色数靠右，
   只有选中那一项上底色。九项里只有一项是「重」的，一眼看得出当前选的是谁。
   排版和色盘对话框里的色系列表一致。 */
.direct-brand-list {
  background: transparent;
  border: 0;
  border-radius: 0;
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 0;
}

.direct-brand-list button {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  border-radius: 7px;
  color: #243033;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 10px;
  position: relative;
  text-align: left;
  width: 100%;
}

.direct-brand-list button:last-child {
  border-bottom: 0;
}

.direct-brand-list button b {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.direct-brand-list button em {
  color: #96a0ac;
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.direct-brand-list button:hover:not(.active),
.direct-brand-list button:focus-visible:not(.active) {
  background: #f4f8ff;
  color: #2868df;
  outline: 0;
}

.direct-brand-list button.active {
  background: #eef4ff;
  border-bottom-color: transparent;
  color: #2f73df;
}

.direct-brand-list button.active em {
  color: #5b8ad6;
}

/* 选中项左侧那道竖条 */
.direct-brand-list button.active::before {
  background: #2f73df;
  border-radius: 2px;
  content: "";
  height: 18px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.direct-brand-list button.active b {
  padding-left: 9px;
}

.direct-advanced-panel {
  max-height: min(620px, calc(100vh - 230px));
  overflow: auto;
}

.direct-advanced-panel .switch-row {
  color: var(--muted);
}

.direct-main-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
}

.direct-stage[data-direct-panel="align"] .direct-main-panel {
  gap: 0;
  padding: 10px;
  position: relative;
}

.setup-view.direct-setup-active .direct-main-panel,
.setup-view.direct-setup-active .direct-side-panel {
  height: 100%;
  min-height: 0;
}

.setup-view.direct-setup-active .direct-advanced-panel {
  max-height: none;
}

.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] .direct-main-panel,
.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] .direct-side-panel {
  min-height: 0;
}

/* 侧栏比这一屏高时自己滚，而不是被 overflow: hidden 裁掉——被裁掉的部分是够不着的，
   而整页滚动又是我们要避免的。 */
.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] .direct-side-panel {
  overflow-y: auto;
  scrollbar-width: thin;
}

.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] .direct-side-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.direct-upload-box,
.direct-crop-box,
.direct-align-box {
  background: #f6f8fa;
  border: 1px dashed #a9bad3;
  border-radius: 8px;
  min-height: min(560px, calc(100vh - 270px));
  overflow: hidden;
  position: relative;
}

.direct-stage[data-direct-panel="align"] .direct-align-box {
  min-height: min(650px, calc(100vh - 206px));
}

.setup-view.direct-setup-active .direct-upload-box,
.setup-view.direct-setup-active .direct-crop-box,
.setup-view.direct-setup-active .direct-align-box {
  height: 100%;
  min-height: 0;
}

.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"] .direct-align-box {
  height: 100%;
  min-height: 0;
}

.direct-preview-canvas,
.direct-finish-preview canvas {
  display: block;
  min-height: min(560px, calc(100vh - 270px));
  width: 100%;
}

.direct-preview-canvas {
  height: 100%;
}

.direct-finish-preview canvas {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #d7d7d7 25%, transparent 25%),
    linear-gradient(-45deg, #d7d7d7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d7d7d7 75%),
    linear-gradient(-45deg, transparent 75%, #d7d7d7 75%);
  background-position:
    0 0,
    0 var(--finish-checker-cell, 12px),
    var(--finish-checker-cell, 12px) calc(0px - var(--finish-checker-cell, 12px)),
    calc(0px - var(--finish-checker-cell, 12px)) 0;
  background-size:
    calc(var(--finish-checker-cell, 12px) + var(--finish-checker-cell, 12px))
    calc(var(--finish-checker-cell, 12px) + var(--finish-checker-cell, 12px));
  height: auto;
  image-rendering: pixelated;
  min-height: 0;
  width: auto;
}

.direct-import-image,
.direct-crop-image {
  display: block;
  height: 100%;
  inset: 0;
  object-fit: contain;
  object-position: center;
  position: absolute;
  width: 100%;
}

.direct-upload-overlay {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  color: #141819;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.direct-upload-overlay strong {
  background: #ffffff;
  border: 1px solid #2f73df;
  border-radius: 6px;
  color: #255da8;
  font-size: 14px;
  padding: 8px 16px;
}

.direct-wizard.source-loaded .direct-upload-overlay {
  display: none;
}





.direct-crop-box,
.direct-align-box,
.direct-finish-preview {
  align-items: center;
  display: grid;
  justify-items: center;
}

.direct-crop-box {
  cursor: move;
  touch-action: none;
}

.direct-align-viewport {
  cursor: grab;
  inset: 0;
  overflow: hidden;
  position: absolute;
  touch-action: none;
}

.direct-align-viewport.is-panning {
  cursor: grabbing;
}

.direct-align-viewport.is-aligning {
  cursor: move;
}

.direct-align-viewport.space-held {
  cursor: grab;
}

.direct-align-image {
  display: block;
  object-fit: initial;
  position: absolute;
  -webkit-user-drag: none;
  pointer-events: none;
  user-select: none;
}

.direct-align-grid {
  box-sizing: border-box;
  display: block;
  height: 100%;
  inset: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.direct-crop-frame {
  border: 3px solid #2f73df;
  box-shadow: 0 0 0 9999px rgba(20, 24, 25, 0.34);
  box-sizing: border-box;
  position: absolute;
  z-index: 2;
}

.direct-crop-frame::before,
.direct-crop-frame::after {
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.direct-crop-frame::before {
  background:
    linear-gradient(90deg, transparent 33.333%, rgba(255, 255, 255, 0.82) 33.333%, rgba(255, 255, 255, 0.82) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.82) 66.666%, rgba(255, 255, 255, 0.82) calc(66.666% + 1px), transparent calc(66.666% + 1px));
}

.direct-crop-frame::after {
  background:
    linear-gradient(transparent 33.333%, rgba(255, 255, 255, 0.82) 33.333%, rgba(255, 255, 255, 0.82) calc(33.333% + 1px), transparent calc(33.333% + 1px), transparent 66.666%, rgba(255, 255, 255, 0.82) 66.666%, rgba(255, 255, 255, 0.82) calc(66.666% + 1px), transparent calc(66.666% + 1px));
}

.direct-crop-frame span {
  background: #ffffff;
  border: 3px solid #2f73df;
  border-radius: 999px;
  box-sizing: border-box;
  height: 18px;
  position: absolute;
  width: 18px;
  z-index: 3;
}

.direct-crop-frame span[data-crop-handle="nw"] { cursor: nwse-resize; left: -10px; top: -10px; }
.direct-crop-frame span[data-crop-handle="n"] { cursor: ns-resize; left: 50%; top: -10px; transform: translateX(-50%); }
.direct-crop-frame span[data-crop-handle="ne"] { cursor: nesw-resize; right: -10px; top: -10px; }
.direct-crop-frame span[data-crop-handle="w"] { cursor: ew-resize; left: -10px; top: 50%; transform: translateY(-50%); }
.direct-crop-frame span[data-crop-handle="e"] { cursor: ew-resize; right: -10px; top: 50%; transform: translateY(-50%); }
.direct-crop-frame span[data-crop-handle="sw"] { bottom: -10px; cursor: nesw-resize; left: -10px; }
.direct-crop-frame span[data-crop-handle="s"] { bottom: -10px; cursor: ns-resize; left: 50%; transform: translateX(-50%); }
.direct-crop-frame span[data-crop-handle="se"] { bottom: -10px; cursor: nwse-resize; right: -10px; }

.direct-crop-box strong,
.direct-align-box strong,
.direct-finish-preview strong {
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  color: #384241;
  font-size: 15px;
  padding: 8px 12px;
  pointer-events: none;
  position: absolute;
  left: 14px;
  top: 14px;
  text-align: center;
  z-index: 1;
}

.direct-crop-box strong {
  background: rgba(255, 255, 255, 0.62);
  color: #255da8;
}

.direct-align-tools {
  gap: 8px;
}

.direct-align-tools .direct-outline-button {
  width: 100%;
}

.direct-tool-card {
  background: #ffffff;
  border: 1px solid #dde6f2;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.direct-compact-row {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.direct-card-head {
  align-items: center;
  color: #5d6878;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: space-between;
}

.direct-card-head strong {
  color: #243033;
  font-size: 13px;
}

.direct-card-head b,
.direct-card-head span {
  color: #2f73df;
  font-size: 13px;
  font-weight: 950;
}

.direct-card-head.is-red strong,
.direct-card-head.is-red span {
  color: #ff4e63;
}

.direct-card-head.is-blue strong,
.direct-card-head.is-blue span {
  color: #3b82f6;
}

.direct-calibration-grid {
  display: grid;
  gap: 6px 8px;
  grid-template-columns: 28px minmax(0, 1fr);
}

.direct-calibration-grid > span {
  align-self: center;
  color: #6d7888;
  font-size: 12px;
  font-weight: 900;
}

.direct-stepper-control {
  align-items: center;
  background: #f7f9fb;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  min-height: 30px;
  overflow: hidden;
}

.direct-stepper-control button {
  background: transparent;
  border: 0;
  color: #6d7888;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  height: 100%;
  min-height: 30px;
}

.direct-stepper-control b {
  color: #17202b;
  font-size: 17px;
  font-weight: 950;
  text-align: center;
}

.direct-mode-row {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.direct-nudge-pad {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  justify-items: center;
}

.direct-nudge-pad button {
  background: #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #333333;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  height: 30px;
  line-height: 1;
  width: 38px;
}

.direct-nudge-pad [data-direct-nudge="up"] { grid-area: up; }
.direct-nudge-pad [data-direct-nudge="left"] { grid-area: left; }
.direct-nudge-pad [data-direct-nudge="right"] { grid-area: right; }
.direct-nudge-pad [data-direct-nudge="down"] { grid-area: down; }

.direct-pixel-size {
  background: #f7f9fb;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  display: grid;
  justify-items: center;
  padding: 6px;
}

.direct-pixel-size b {
  color: #3b82f6;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}

.direct-pixel-size span {
  color: #243033;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 1px;
  margin-top: 3px;
}

.direct-icon-button {
  font-size: 20px;
}

.direct-check-row,
.direct-slider-row {
  color: #384241;
  font-size: 12px;
  font-weight: 850;
}

.direct-check-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.direct-check-row input {
  accent-color: #2f73df;
  height: 16px;
  width: 16px;
}

.direct-slider-row {
  display: grid;
  gap: 6px;
}

.direct-slider-row span {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.direct-slider-row input {
  accent-color: #2f73df;
  width: 100%;
}

.direct-view-zoom-card {
  padding: 8px;
}

.direct-view-zoom-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 44px 30px 1fr 30px;
}

.direct-view-zoom-row span {
  color: #233033;
  font-size: 13px;
  font-weight: 850;
}

.direct-view-zoom-row input {
  accent-color: #2f73df;
  min-width: 0;
}

.direct-view-zoom-row .direct-icon-button {
  min-height: 30px;
  padding: 0;
}

.direct-board-sizes {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.direct-board-sizes > span {
  color: #384241;
  font-size: 12px;
  font-weight: 850;
  grid-column: 1 / -1;
}

.direct-board-sizes button {
  padding: 7px 4px;
}

.direct-panel-title,
.direct-proof-help {
  color: #384241;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
  margin: 0;
  text-align: center;
}

.direct-stage[data-direct-panel="align"] .direct-panel-title {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(185, 203, 230, 0.72);
  border-radius: 6px;
  left: 50%;
  margin: 0;
  padding: 6px 10px;
  position: absolute;
  top: 12px;
  transform: translateX(-50%);
  z-index: 8;
}

.direct-proof-area {
  min-height: 0;
  overflow: auto;
  padding: 10px 10px 38px;
  position: relative;
}

.direct-proof-grid {
  align-content: start;
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fill, 54px);
  justify-content: start;
}

.direct-proof-cell {
  align-items: center;
  aspect-ratio: 1;
  background-color: var(--proof-color);
  background-image: var(--proof-thumb, none);
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(30, 41, 43, 0.22);
  border-radius: 6px;
  color: #141819;
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  justify-content: center;
  min-width: 0;
  position: relative;
}

.direct-proof-cell.selected {
  border-color: #2868df;
  box-shadow: inset 0 0 0 2px #ffffff, 0 0 0 2px rgba(40, 104, 223, 0.26);
}

.direct-proof-cell.selected::after {
  align-items: center;
  background: #ffffff;
  border: 1px solid #2868df;
  border-radius: 50%;
  color: #2868df;
  content: "✓";
  display: flex;
  font-size: 13px;
  height: 18px;
  justify-content: center;
  position: absolute;
  right: -5px;
  top: -5px;
  width: 18px;
  z-index: 4;
}

.direct-proof-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.direct-proof-controls {
  align-items: stretch;
  background: #ffffff;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 180px) minmax(420px, 0.95fr);
  height: 100%;
  min-height: 0;
  padding: 8px 10px 10px;
}

.direct-proof-left {
  align-content: start;
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.direct-proof-summary {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  font-size: 14px;
  font-weight: 900;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.2;
  padding: 8px 10px;
}

/* Which palette the codes above came from. The recognition flow hides the whole
   setup sidebar, so this was the one screen where the active brand decided every
   code on it and nothing said which brand that was. */
.direct-proof-palette {
  background: var(--surface-muted, #f1f4f7);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted, #5a6472);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  white-space: nowrap;
}

.direct-proof-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.direct-proof-center {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  place-self: start stretch;
  min-height: 44px;
  padding: 6px 8px;
}

.direct-proof-center span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.direct-proof-center b {
  color: var(--ink);
  margin-left: 2px;
}

.direct-change-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.direct-outline-button {
  font-size: 12px;
  min-height: 30px;
  padding: 6px 10px;
}

.direct-replace-panel {
  display: grid;
  gap: 8px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}

.direct-replace-head {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.direct-replace-head strong,
.direct-all-colors {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.direct-all-colors {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  min-width: max-content;
  white-space: nowrap;
}

.direct-all-colors input {
  height: 14px;
  width: 14px;
}

.direct-round-button {
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
}

.direct-proof-color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.direct-replacement-colors {
  align-content: start;
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.direct-replace-family {
  display: grid;
  gap: 8px;
}

.direct-replace-family-title {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  padding: 2px 0;
  text-align: left;
}

.direct-replace-family-title::after {
  content: "⌄";
  float: right;
  font-size: 15px;
}

.direct-replace-family.collapsed .direct-replace-family-title::after {
  content: "›";
}

.direct-replace-family-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
}

.direct-replace-chip,
.direct-color-chip {
  align-items: center;
  aspect-ratio: 1;
  background-color: var(--replace-color, var(--chip-color, #dfe4e8));
  background-image: none;
  border: 1px solid rgba(30, 41, 43, 0.22);
  border-radius: 7px;
  color: var(--replace-text-color, var(--chip-text-color, #26302f));
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  width: 42px;
}

.direct-color-chip {
  border-radius: 6px;
  width: 40px;
}

.direct-color-chip.empty {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #d8dcdf 25%, transparent 25%),
    linear-gradient(-45deg, #d8dcdf 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dcdf 75%),
    linear-gradient(-45deg, transparent 75%, #d8dcdf 75%);
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
}

.direct-proof-pager {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  bottom: 10px;
  box-shadow: 0 6px 18px rgba(31, 44, 41, 0.1);
  color: var(--ink);
  display: flex;
  gap: 8px;
  padding: 5px 8px;
  position: absolute;
  right: 12px;
}

.direct-proof-pager:empty {
  display: none;
}

.direct-proof-pager button {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  font-weight: 950;
  height: 24px;
  justify-content: center;
  padding: 0;
  width: 24px;
}

.direct-proof-pager button:disabled {
  color: #aeb8b4;
  cursor: not-allowed;
}

.direct-proof-pager span {
  font-size: 12px;
  font-weight: 950;
  min-width: 34px;
  text-align: center;
}

.direct-replace-chip.active,
.direct-color-chip.active {
  border-color: #2868df;
  box-shadow: 0 0 0 3px rgba(40, 104, 223, 0.2);
}

.direct-replace-actions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  padding-top: 8px;
}

.direct-primary-small {
  background: #2868df;
  border: 1px solid #2868df;
  border-radius: 7px;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 950;
  padding: 8px 12px;
}

.direct-primary-small:disabled {
  background: #dfe3e7;
  border-color: #dfe3e7;
  color: #96a0a8;
  cursor: not-allowed;
}

.direct-empty-note {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.direct-finish-stage {
  height: calc(100vh - 104px);
  justify-items: stretch;
}

.direct-finish-preview {
  display: grid;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
  width: 100%;
}

.direct-finish-viewport {
  --finish-checker-cell: 12px;
  background-color: #ffffff;
  background-image: none;
  border: 1px solid #e2e5e7;
  border-radius: 8px;
  display: grid;
  height: 100%;
  min-height: 0;
  overflow: auto;
  place-items: center;
  width: 100%;
}

.direct-footer {
  align-items: center;
  background: rgba(247, 249, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px;
  position: sticky;
  bottom: 12px;
  z-index: 12;
}

body[data-view="setup"][data-module="direct"] .top-actions {
  display: none;
}

body[data-view="setup"][data-module="direct"] .direct-footer {
  background: transparent;
  border: 0;
  border-radius: 0;
  bottom: auto;
  box-shadow: none;
  gap: 8px;
  padding: 0;
  position: fixed;
  right: 22px;
  top: 17px;
  z-index: 28;
}

body[data-view="setup"][data-module="direct"] .direct-footer .direct-outline-button {
  min-height: 38px;
  min-width: 82px;
  padding: 7px 14px;
}

.direct-footer #directNextButton,
.direct-footer #directSaveButton,
.direct-footer #directSaveEditButton {
  background: #2f73df;
  border-color: #2f73df;
  color: #ffffff;
}

.direct-footer #directNextButton:disabled {
  background: #d7dde0;
  border-color: #d7dde0;
  color: #7a8482;
  cursor: not-allowed;
}

.direct-step-button:disabled,
.direct-outline-button:disabled,
.direct-board-sizes button:disabled,
.direct-icon-button:disabled,
.direct-round-button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.direct-save-prompt {
  background: rgba(20, 24, 25, 0.9);
  border-radius: 8px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  left: 50%;
  min-width: 240px;
  padding: 16px 22px;
  position: fixed;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
}

.setup-panel-header,
.inspector-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.setup-panel-header > div,
.inspector-heading > div {
  display: grid;
  gap: 2px;
}

.setup-panel-header span,
.inspector-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-panel-header strong,
.inspector-heading strong {
  color: var(--ink);
  font-size: 15px;
}

.setup-group {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
}

.setup-group h2,
.inspector-panel h2 {
  font-size: 13px;
}

.palette-brand-picker {
  display: grid;
  gap: 7px;
}

.palette-brand-picker > span,
.palette-brand-picker label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
}

.palette-brand-combobox {
  display: grid;
  gap: 0;
}

.palette-brand-select {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-family: inherit;
  font-size: 14px;
  font-weight: 850;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.palette-brand-select:hover,
.palette-brand-select:focus-visible {
  border-color: var(--teal);
  outline: 0;
}

.palette-brand-select[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.palette-brand-menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 6px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: none;
  display: grid;
  gap: 4px;
  padding: 6px;
}

.palette-brand-menu button {
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 9px;
  text-align: left;
}

.palette-brand-menu button:hover,
.palette-brand-menu button:focus-visible {
  background: #f2f6f5;
  outline: 0;
}

.palette-brand-menu button.active {
  background: #eef5ff;
  color: #2868df;
}

.palette-brand-tabs {
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.85fr) minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1.3fr);
}

.palette-brand-button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #56625f;
  font-size: 9px;
  font-weight: 850;
  min-height: 34px;
  min-width: 0;
  overflow: hidden;
  padding: 5px 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-brand-button:hover {
  background: #edf3fb;
  border-color: #9fb9df;
  color: #255da8;
}

.palette-brand-button.active {
  background: #2868df;
  border-color: #2868df;
  color: #ffffff;
}

.inspector-brand-tabs {
  margin: 13px 0 10px;
}

.style-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.style-button {
  min-height: 34px;
  padding: 5px 4px;
}

.quick-size-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.style-button,
.size-button,
.ai-size-button {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #465552;
  font-size: 12px;
  font-weight: 800;
  min-height: 36px;
  padding: 6px;
}

.style-button:hover,
.size-button:hover,
.ai-size-button:hover {
  background: var(--surface-strong);
}

.style-button.active,
.size-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.ai-size-button.active {
  background: var(--yellow);
  border-color: #d4ab31;
  color: var(--ink);
}

.form-grid,
.compact-grid {
  display: grid;
  gap: 9px;
}

.two-column,
.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label,
.compact-grid label,
.field-label {
  color: var(--muted);
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 5px;
}

input,
select {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  min-height: 37px;
  outline: none;
  padding: 7px 9px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(39, 135, 127, 0.12);
}

input[type="range"] {
  /* accent-color 在此已失效：下方用 appearance:none 自绘轨道与滑块 */
  border: 0;
  padding: 0;
}

.range-control {
  display: grid;
  gap: 4px;
}

.range-control > span {
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  justify-content: space-between;
}

.range-control b {
  color: var(--ink);
}

.switch-list {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.switch-row {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
}

.switch-row input {
  accent-color: var(--teal);
  height: 16px;
  min-height: 0;
  width: 16px;
}

.setup-footer {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 0.8fr 1.2fr;
  margin-top: 15px;
  padding-top: 15px;
}

.workspace {
  display: grid;
  gap: 10px;
  grid-template-columns: 70px minmax(420px, 1fr) 324px;
  height: calc(100vh - 72px);
  margin: 0 auto;
  max-width: 1800px;
  min-height: 540px;
  padding: 10px;
}

.tool-rail {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px;
}

.tool-rail-group {
  display: grid;
  gap: 5px;
}

.tool-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 55px;
  padding: 6px 4px;
}

.tool-button > span {
  font-size: 20px;
  line-height: 1;
}

.tool-button small {
  font-size: 10px;
  font-weight: 800;
}

.tool-button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.tool-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.brush-control {
  align-items: center;
  color: var(--muted);
  display: grid;
  font-size: 9px;
  font-weight: 800;
  gap: 5px;
  justify-items: center;
}

.brush-control input {
  height: 62px;
  margin: 0;
  writing-mode: vertical-lr;
  width: 20px;
}

.brush-control b {
  color: var(--ink);
  font-size: 11px;
}

.board-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.board-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 60px;
  padding: 9px 11px;
}

.selected-color {
  align-items: center;
  display: flex;
  gap: 9px;
  min-width: 0;
}

.selected-color > span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selected-color small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.selected-color strong {
  color: var(--ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-swatch {
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  display: block;
  flex: 0 0 auto;
  height: 30px;
  width: 30px;
}

.canvas-wrap {
  background: #e7ece9;
  display: block;
  min-height: 0;
  overscroll-behavior: contain;
  overflow: auto;
  padding: 0;
  scrollbar-gutter: stable;
}

#patternCanvas {
  background: #fffdfa;
  border: 0;
  box-shadow: none;
  cursor: crosshair;
  display: block;
  flex: 0 0 auto;
  image-rendering: pixelated;
  touch-action: none;
}

.inspector {
  min-height: 0;
  overflow: hidden;
}

.inspector-tabs {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, 1fr);
  padding: 5px;
}

.inspector-tab {
  background: transparent;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-height: 35px;
}

.inspector-tab.active {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(31, 44, 41, 0.08);
  color: var(--ink);
}

.inspector-panel {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 129px);
  overflow: auto;
  padding: 14px;
}

.compact-switch {
  justify-self: end;
}

.search-input {
  width: 100%;
}

.palette-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-right: 2px;
}

.palette-chip {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: 4px;
  min-height: 50px;
  padding: 5px;
}

.palette-chip:hover {
  border-color: var(--line-strong);
}

.palette-chip.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.chip-color {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  height: 20px;
}

.chip-code {
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.action-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inspector-divider {
  border-top: 1px solid var(--line);
  height: 1px;
}

.full-button {
  width: 100%;
}

.metrics {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 0;
  padding: 9px;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 9px;
  font-weight: 900;
  margin-bottom: 4px;
}

.metrics strong {
  color: var(--ink);
  display: block;
  font-size: 17px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-list {
  display: grid;
  gap: 6px;
}

.legend-row {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 8px;
  grid-template-columns: 22px 54px 1fr;
  padding: 7px 8px;
}

.legend-swatch {
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  height: 20px;
  width: 20px;
}

.legend-code {
  font-size: 11px;
  font-weight: 900;
}

.legend-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.export-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-dialog {
  background: transparent;
  border: 0;
  padding: 0;
  width: min(760px, calc(100vw - 28px));
}

.history-dialog::backdrop {
  background: rgba(29, 41, 41, 0.38);
  backdrop-filter: blur(2px);
}

.history-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-height: min(680px, calc(100vh - 40px));
  overflow: hidden;
  padding: 16px;
}

.history-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.history-header > div {
  display: grid;
  gap: 2px;
}

.history-header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.history-header h2 {
  font-size: 18px;
}

.history-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.history-item {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
}

.history-item strong,
.history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  color: var(--ink);
  font-size: 13px;
}

.history-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 26px;
  text-align: center;
}

/* Sits in the line of sight, not at the foot of the window.
   On the align step the eye is on the grid in the middle of the canvas, so a
   toast pinned to the bottom edge was simply never looked at. Held a little
   above centre so it announces itself without covering the exact spot being
   inspected. */
.app-toast {
  background: var(--ink);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  left: 50%;
  letter-spacing: 0.01em;
  max-width: min(460px, calc(100vw - 48px));
  opacity: 0;
  padding: 14px 22px;
  pointer-events: none;
  position: fixed;
  text-align: center;
  top: 38%;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 50;
}

.app-toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .app-toast {
    transition: opacity 160ms ease;
    transform: translate(-50%, -50%);
  }

  .app-toast.visible {
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 1180px) {
  .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 68px minmax(380px, 1fr) 286px;
  }

  .board-toolbar-actions .ghost-button {
    font-size: 11px;
    padding: 7px 8px;
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    padding: 9px 14px;
  }

  .brand-button {
    min-width: 0;
  }

  .top-status {
    display: none;
  }

  .home-view,
  .setup-view {
    padding-left: 14px;
    padding-right: 14px;
  }

  .module-launcher {
    grid-template-columns: 1fr;
  }

  .module-entry-card {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) 1.2fr;
  }

  .module-preview-wrap {
    height: 100%;
    min-height: 180px;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-layout {
    grid-template-columns: 1fr;
  }

  body[data-view="setup"][data-module="style"] .setup-view {
    height: auto;
  }

  body[data-view="setup"][data-module="style"] .setup-layout {
    height: auto;
  }

  body[data-view="setup"][data-module="style"] .source-card {
    height: auto;
  }

  body[data-view="setup"][data-module="style"] .source-stage {
    height: auto;
    min-height: min(420px, calc(100svh - 180px));
  }

  .setup-panel {
    max-height: none;
    position: static;
  }

  .direct-stepper {
    justify-content: flex-start;
    max-width: none;
    min-width: 0;
    overflow-x: auto;
    position: static;
    transform: none;
    width: 100%;
  }

  .direct-stepper > span {
    flex: 0 0 auto;
  }

  .direct-step-button {
    flex: 0 0 auto;
  }

  .direct-setup-active .direct-stepper > span {
    flex: 0 0 38px;
  }

  .direct-stage {
    grid-template-columns: 1fr;
  }

  .direct-advanced-panel {
    max-height: none;
  }

  .direct-proof-controls {
    grid-template-columns: 1fr;
  }

  .direct-proof-center {
    justify-content: space-between;
  }

  .workspace {
    grid-template-areas:
      "board"
      "tools"
      "inspector";
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 72px);
  }

  .board-panel {
    grid-area: board;
    min-height: 620px;
  }

  .tool-rail {
    flex-direction: row;
    grid-area: tools;
  }

  .tool-rail-group {
    display: grid;
    flex: 1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .brush-control {
    align-content: center;
    grid-template-columns: auto minmax(90px, 1fr) auto;
    justify-items: stretch;
    margin-left: 10px;
    width: min(220px, 32vw);
  }

  .brush-control input {
    height: 24px;
    writing-mode: horizontal-tb;
    width: 100%;
  }

  .inspector {
    grid-area: inspector;
  }

  .inspector-panel {
    max-height: min(640px, 72vh);
  }

  .palette-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    position: static;
  }

  .brand-copy strong {
    font-size: 14px;
  }

  .top-actions {
    margin-left: auto;
  }

  .top-actions .ghost-button,
  .top-actions .primary-button {
    font-size: 11px;
    min-height: 34px;
    padding: 6px 8px;
  }

  .home-view {
    padding-top: 26px;
  }

  .home-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .home-heading h1 {
    font-size: 28px;
  }

  .home-heading-actions {
    flex-wrap: wrap;
  }

  .module-entry-card {
    display: block;
  }

  .module-preview-wrap {
    height: 150px;
    min-height: 0;
  }

  .entry-copy {
    min-height: 142px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: 132px minmax(0, 1fr);
    grid-template-rows: 112px;
    min-height: 112px;
  }

  .project-thumbnail {
    height: 112px;
  }

  .setup-view {
    padding-top: 24px;
  }

  .source-stage {
    min-height: 270px;
  }

  .two-column,
  .switch-list {
    grid-template-columns: 1fr;
  }

  .setup-footer {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 6px;
  }

  .board-panel {
    min-height: 520px;
  }

  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .board-toolbar-actions {
    flex-wrap: wrap;
  }

  .canvas-wrap {
    min-height: 350px;
    padding: 0;
  }

  .tool-rail {
    align-items: stretch;
    flex-direction: column;
  }

  .brush-control {
    grid-template-columns: auto 1fr auto;
    margin: 8px 4px 2px;
    width: auto;
  }

  .tool-button {
    min-height: 50px;
  }

  .palette-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .history-item {
    grid-template-columns: 1fr;
  }
}

/* GOGO entry and creation hub */
.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.landing-view {
  background: #ffffff;
  display: block;
  min-height: 100svh;
  overflow: visible;
  scroll-behavior: smooth;
}

.landing-topbar {
  align-items: center;
  background: #08090b;
  border-bottom: 1px solid #17191f;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 24px;
  min-height: 78px;
  padding: 0 clamp(24px, 7vw, 150px);
}

.landing-brand {
  background: transparent;
  border: 0;
  justify-self: start;
  padding: 0;
}

.landing-brand .brand-lockup {
  gap: 12px;
}

.landing-brand .brand-symbol {
  height: 58px;
}

.landing-brand .brand-wordmark-image {
  filter: invert(1);
  height: 46px;
}

.landing-nav {
  align-items: center;
  display: flex;
  gap: clamp(26px, 3vw, 54px);
  justify-content: center;
}

.landing-nav button,
.landing-nav a {
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 15px;
  font-weight: 750;
  min-height: 38px;
  padding: 0;
  text-decoration: none;
  white-space: nowrap;
}

.landing-nav button:hover,
.landing-nav button:focus-visible,
.landing-nav a:hover,
.landing-nav a:focus-visible,
.landing-nav a.active {
  color: #ffffff;
}

.landing-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-self: end;
}

.landing-account-nav {
  position: relative;
}

.landing-login-button,
.landing-language-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  min-height: 38px;
  min-width: 70px;
  padding: 7px 14px;
  white-space: nowrap;
}

.landing-language-picker {
  position: relative;
}

.landing-language-button {
  align-items: center;
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 10px;
  display: inline-flex;
  gap: 8px;
  font-size: 15px;
  font-weight: 750;
  height: 38px;
  justify-content: flex-start;
  min-height: 38px;
  min-width: 0;
  padding: 0 17px;
  width: auto;
}

.landing-language-button .landing-language-flag {
  font-size: 14px;
  line-height: 1;
}

.landing-language-button .landing-language-label {
  letter-spacing: 0;
  line-height: 1;
}

.landing-language-menu {
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.22);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  display: grid;
  gap: 3px;
  min-width: 132px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
}

.landing-language-menu button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #1f2937;
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 10px;
  grid-template-columns: 24px minmax(0, 1fr);
  min-height: 38px;
  padding: 0 11px;
  text-align: left;
}

.landing-language-menu button:hover,
.landing-language-menu button:focus-visible,
.landing-language-menu button.active {
  background: #dfe6ff;
  color: #1f2937;
}

.landing-language-menu button span {
  font-size: 15px;
  line-height: 1;
}

.landing-language-menu button strong {
  font-size: 15px;
  font-weight: 750;
  line-height: 1.1;
}

.landing-login-button:hover,
.landing-language-button:hover,
.landing-login-button:focus-visible,
.landing-language-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.48);
  color: #ffffff;
}

.landing-hero {
  align-items: center;
  background: url("./assets/landing-hero-bg-dog-left-v2.webp");
  background-position: center;
  background-size: cover;
  border: 0;
  border-radius: 0;
  display: grid;
  justify-items: center;
  margin: 0;
  min-height: calc(100svh - 78px);
  overflow: hidden;
  padding: clamp(54px, 11vh, 150px) 24px;
}

.landing-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  max-width: 900px;
  text-align: center;
  width: 100%;
}

.landing-content h1 {
  align-items: baseline;
  color: #17202b;
  display: flex;
  font-family: "Fredoka One", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-weight: 400;
  justify-content: center;
  letter-spacing: 0;
  line-height: 0.92;
  margin: 0;
  max-width: min(100%, 1100px);
  white-space: nowrap;
  width: 100%;
}

.landing-title-main {
  font-size: clamp(66px, 9.8vw, 146px);
}

.landing-title-sub {
  font-family: "Fredoka One", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-rounded, system-ui, sans-serif;
  font-size: clamp(66px, 9.8vw, 146px);
  font-weight: 900;
  margin-left: 0.16em;
  transform: translateY(-0.03em);
}

html[lang="zh-CN"] .landing-title-sub {
  font-family: "Yuanti SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-rounded, system-ui, sans-serif;
  -webkit-text-stroke: 0.012em currentColor;
}

.landing-content p {
  color: #2e6dcc;
  font-size: clamp(18px, 1.7vw, 28px);
  font-weight: 800;
  line-height: 1.5;
  margin: 26px 0 0;
}

.landing-enter-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d1a43a;
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(25, 38, 61, 0.08);
  color: #111820;
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  gap: 12px;
  justify-content: center;
  margin-top: 46px;
  min-height: 58px;
  min-width: 200px;
  padding: 14px 28px;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.landing-enter-button:hover {
  background: #f8fbff;
  box-shadow: 0 18px 44px rgba(25, 38, 61, 0.12);
  transform: translateY(-2px);
}

.landing-enter-button:active {
  transform: translateY(0);
}

.landing-page {
  align-items: center;
  background: url("./assets/landing-pages-bg.webp");
  background-position: center;
  background-size: cover;
  display: grid;
  min-height: 100svh;
  padding: clamp(72px, 11vh, 140px) clamp(24px, 7vw, 150px);
}

.landing-page-inner {
  align-items: center;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  max-width: 1280px;
  text-align: center;
  width: 100%;
}

.landing-page-copy {
  max-width: 920px;
  width: 100%;
}

.landing-page h2 {
  color: #111820;
  font-size: clamp(38px, 4.2vw, 58px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0;
  max-width: none;
  text-align: center;
}

.landing-page-copy p {
  color: #4d5968;
  font-size: clamp(16px, 1.35vw, 19px);
  font-weight: 650;
  line-height: 1.7;
  margin: 16px auto 0;
  max-width: 820px;
  text-align: center;
}

.landing-tool-grid,
.landing-step-grid,
.landing-blog-grid {
  display: grid;
  gap: 18px;
  margin-top: clamp(34px, 6vh, 64px);
  text-align: left;
  width: 100%;
}

.landing-tool-grid,
.landing-blog-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-tool-card,
.landing-step-grid article,
.landing-blog-grid article,
.landing-price-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 43, 56, 0.08);
}

.landing-tool-card {
  cursor: pointer;
  min-height: 260px;
  padding: 26px;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.landing-tool-card:hover {
  border-color: #f1bd2f;
  box-shadow: 0 20px 52px rgba(32, 43, 56, 0.12);
  transform: translateY(-2px);
}

.landing-tool-card:focus-visible,
.landing-tool-card:active,
.landing-tool-card.is-selected {
  border-color: #d69b00;
  box-shadow:
    0 0 0 4px rgba(244, 200, 74, 0.34),
    0 20px 52px rgba(32, 43, 56, 0.14);
  outline: 0;
  transform: translateY(-2px);
}

.landing-tool-icon {
  align-items: center;
  background: transparent;
  border-radius: 8px;
  color: #7a5b00;
  display: inline-flex;
  font-size: 28px;
  height: 68px;
  justify-content: center;
  overflow: visible;
  width: 68px;
}

.landing-tool-icon img {
  display: block;
  height: 82px;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  width: 82px;
}

.landing-tool-card:nth-child(2) .landing-tool-icon {
  background: transparent;
  color: #255da8;
}

.landing-tool-card:nth-child(3) .landing-tool-icon {
  background: transparent;
  color: #a23f49;
}

.landing-tool-card h3,
.landing-step-grid h3,
.landing-blog-grid h3 {
  color: #111820;
  font-size: 22px;
  line-height: 1.25;
  margin: 22px 0 0;
}

.landing-tool-card p,
.landing-step-grid p,
.landing-blog-grid p {
  color: #566273;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.65;
  margin: 12px 0 0;
}

.landing-tool-link,
.landing-tool-card button,
.landing-price-panel button {
  align-items: center;
  background: transparent;
  border: 0;
  color: #d19a00;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  gap: 8px;
  margin-top: 26px;
  padding: 0;
}

.pricing-cycle-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #dce4ee;
  border-radius: 999px;
  box-shadow: 0 16px 42px rgba(32, 43, 56, 0.08);
  display: inline-flex;
  gap: 6px;
  margin-top: 28px;
  padding: 6px;
}

.pricing-cycle-toggle button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #6a7482;
  display: inline-flex;
  font-size: 15px;
  font-weight: 900;
  gap: 8px;
  min-height: 42px;
  padding: 0 24px;
}

.pricing-cycle-toggle button.active {
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(32, 43, 56, 0.1);
  color: #111820;
}

.pricing-cycle-toggle span {
  background: #fff1bf;
  border-radius: 999px;
  color: #c48600;
  font-size: 12px;
  padding: 3px 8px;
}

.landing-pricing-page {
  padding-bottom: clamp(28px, 4vh, 48px);
  padding-top: clamp(34px, 5vh, 58px);
}

.landing-pricing-page h2 {
  font-size: clamp(34px, 3.6vw, 50px);
}

.landing-pricing-page .landing-page-copy p {
  font-size: clamp(14px, 1.1vw, 17px);
  line-height: 1.45;
  margin-top: 8px;
}

.landing-pricing-page .pricing-cycle-toggle {
  margin-top: 22px;
}

.landing-pricing-page .pricing-cycle-toggle button {
  min-height: 38px;
  padding: 0 22px;
}

.landing-price-grid {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(34px, 6vh, 58px);
  text-align: left;
  width: 100%;
}

.landing-price-panel {
  cursor: pointer;
  display: grid;
  gap: 14px;
  min-height: 430px;
  padding: 26px;
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.landing-pricing-page .landing-price-grid {
  margin-top: clamp(26px, 4vh, 38px);
}

.landing-pricing-page .landing-price-panel {
  gap: 10px;
  min-height: 0;
  padding: 20px;
}

.landing-price-panel:hover,
.landing-price-panel:focus-visible {
  border-color: #efbf3b;
  box-shadow:
    0 0 0 3px rgba(244, 200, 74, 0.2),
    0 20px 52px rgba(32, 43, 56, 0.12);
  outline: 0;
  transform: translateY(-4px);
}

.landing-price-panel.is-selected {
  border-color: #d69b00;
  box-shadow:
    0 0 0 5px rgba(244, 200, 74, 0.34),
    0 24px 64px rgba(32, 43, 56, 0.16);
  outline: 0;
  transform: translateY(-6px);
}

.landing-price-panel.featured {
  background:
    linear-gradient(180deg, rgba(255, 247, 220, 0.76), rgba(255, 255, 255, 0.9)),
    rgba(255, 255, 255, 0.9);
  border-color: #d99a00;
  box-shadow:
    0 0 0 1px rgba(217, 154, 0, 0.18),
    0 22px 58px rgba(32, 43, 56, 0.13);
  transform: translateY(-10px);
}

.landing-price-panel.featured.is-selected {
  box-shadow:
    0 0 0 5px rgba(244, 200, 74, 0.36),
    0 26px 68px rgba(32, 43, 56, 0.17);
  transform: translateY(-13px);
}

/* Pro 卡片默认就带 is-selected，悬停态必须比选中态再进一步，否则触碰毫无反应 */
.landing-price-panel.featured:hover,
.landing-price-panel.featured:focus-visible {
  border-color: #c98a00;
  box-shadow:
    0 0 0 7px rgba(244, 200, 74, 0.5),
    0 32px 78px rgba(32, 43, 56, 0.2);
  transform: translateY(-18px);
}

.landing-price-panel.price-plus.is-selected {
  border-color: #d65a67;
  box-shadow:
    0 0 0 5px rgba(214, 90, 103, 0.22),
    0 24px 64px rgba(32, 43, 56, 0.16);
}

.price-card-topline {
  align-items: center;
  color: #d19a00;
  display: flex;
  font-size: 24px;
  font-weight: 950;
  gap: 16px;
}

.price-card-topline::after {
  background: currentColor;
  content: "";
  flex: 1;
  height: 1px;
  opacity: 0.45;
}

.price-card-topline em {
  color: #d19a00;
  font-size: 13px;
  font-style: normal;
}

.price-dog-icon {
  display: block;
  filter: drop-shadow(0 5px 10px rgba(32, 43, 56, 0.12));
  height: 54px;
  object-fit: contain;
  width: 54px;
}

.landing-pricing-page .price-dog-icon {
  height: 44px;
  width: 44px;
}

.price-plus .price-card-topline {
  color: #d65a67;
}

.landing-price-panel > strong {
  color: #111820;
  font-size: clamp(24px, 2.35vw, 36px);
  line-height: 1.08;
}

.landing-pricing-page .landing-price-panel > strong {
  font-size: clamp(22px, 2vw, 32px);
}

.landing-price-panel > p {
  color: #566273;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.55;
  margin: -8px 0 0;
}

.landing-pricing-page .landing-price-panel > p {
  font-size: 13px;
  line-height: 1.35;
  margin-top: -4px;
}

.price-value {
  align-items: baseline;
  border-bottom: 1px solid #e0e6ed;
  display: flex;
  gap: 8px;
  padding: 12px 0 17px;
}

.landing-pricing-page .price-value {
  padding: 7px 0 11px;
}

.price-value span {
  color: #111820;
  font-size: clamp(36px, 3.35vw, 50px);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 0.95;
}

.landing-pricing-page .price-value span {
  font-size: clamp(34px, 3vw, 46px);
}

.price-value small {
  color: #6b7481;
  font-size: 16px;
  font-weight: 850;
}

.landing-pricing-page .price-value small {
  font-size: 14px;
}

.price-yearly-note {
  color: #d19a00;
  display: none;
  font-size: 14px;
  font-weight: 850;
  margin-top: -10px;
}

.landing-pricing-page .price-yearly-note {
  font-size: 12px;
  margin-top: -6px;
}

.landing-pricing-page[data-billing="yearly"] .price-yearly-note {
  display: block;
}

.price-meta {
  align-items: end;
  display: flex;
  justify-content: space-between;
}

.price-meta span {
  color: #6b7481;
  font-size: 13px;
  font-weight: 800;
}

.landing-pricing-page .price-meta span {
  font-size: 12px;
}

.price-meta strong {
  color: #111820;
  font-size: 25px;
  font-weight: 950;
  line-height: 1;
}

.landing-pricing-page .price-meta strong {
  font-size: 21px;
}

.landing-price-panel ul {
  color: #566273;
  display: grid;
  gap: 10px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.45;
  list-style: none;
  margin: 0;
  padding: 0;
}

.landing-pricing-page .landing-price-panel ul {
  gap: 7px;
  font-size: 13px;
  line-height: 1.32;
}

.landing-price-panel li::before {
  color: #d19a00;
  content: "✓";
  font-weight: 950;
  margin-right: 9px;
}

.landing-pricing-page .landing-price-panel li::before {
  margin-right: 7px;
}

.landing-price-panel li.is-disabled {
  color: #9aa5b4;
  opacity: 0.72;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.landing-price-panel li.is-disabled::before {
  color: #7d8796;
  content: "×";
}

.landing-price-panel button {
  align-self: end;
}

.landing-pricing-page .landing-price-panel button {
  font-size: 13px;
  margin-top: 12px;
}

.landing-step-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-step-grid article,
.landing-blog-grid article {
  min-height: 210px;
  padding: 28px;
}

.landing-blog-grid article {
  display: flex;
  flex-direction: column;
}

.landing-blog-tag {
  align-self: start;
  background: #f9df7e;
  border: 1px solid #e2bd3b;
  border-radius: 999px;
  color: #5c4300;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 8px 10px;
}

.landing-blog-grid ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.landing-blog-grid li {
  color: #2f3a48;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
  padding-left: 18px;
  position: relative;
}

.landing-blog-grid li::before {
  background: #2fb57a;
  border-radius: 50%;
  content: "";
  height: 7px;
  left: 0;
  position: absolute;
  top: 0.55em;
  width: 7px;
}

.landing-step-grid article > span {
  color: #d19a00;
  font-family: "Fredoka One", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-size: 36px;
  line-height: 1;
}

/* 三块面板叠在同一个网格格子里，格子高度取三者里最高的那块。
   原来是 display:none/grid 来回切，三块内容不一样高，一换页签整段就变高变矮——
   而这一屏的背景是 background-size: cover，高度一变背景就跟着重新缩放，
   看上去就是「背景在跳」。叠起来之后这一段高度是常数，背景纹丝不动。 */
.landing-flow-demo {
  display: grid;
  grid-template-rows: auto auto;
  margin-top: clamp(22px, 4vh, 42px);
  text-align: left;
  width: 100%;
}

.landing-flow-tabs {
  grid-column: 1;
  grid-row: 1;
}

.landing-flow-panel {
  grid-column: 1;
  grid-row: 2;
}

.landing-tutorial-page {
  padding-bottom: clamp(52px, 7vh, 86px);
  padding-top: clamp(54px, 7vh, 92px);
}

.landing-flow-tabs {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto 18px;
  max-width: 840px;
  padding: 8px;
}

.landing-flow-tabs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #566273;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  min-height: 48px;
  padding: 10px 14px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.landing-flow-tabs button:hover,
.landing-flow-tabs button:focus-visible {
  background: rgba(255, 255, 255, 0.86);
  border-color: #f1bd2f;
  color: #111820;
  outline: 0;
}

.landing-flow-tabs button.active {
  background: #111820;
  border-color: #111820;
  box-shadow: 0 12px 26px rgba(17, 24, 32, 0.14);
  color: #ffffff;
}

.landing-flow-panel {
  align-items: stretch;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 22px 56px rgba(32, 43, 56, 0.1);
  display: grid;
  gap: clamp(18px, 3vw, 34px);
  grid-template-columns: minmax(300px, 0.78fr) minmax(500px, 1.22fr);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  visibility: hidden;
  overflow: hidden;
  padding: clamp(18px, 2.5vw, 30px);
}

.landing-flow-panel.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.landing-flow-copy {
  align-content: center;
  display: grid;
  gap: 12px;
}

.landing-flow-copy > span {
  color: #d19a00;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0;
}

.landing-flow-copy h3 {
  color: #111820;
  font-size: clamp(24px, 2.15vw, 32px);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.16;
  margin: 0;
}

.landing-flow-copy p {
  color: #566273;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.65;
  margin: 0;
}

.landing-flow-steps {
  counter-reset: flow-step;
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}

.landing-flow-steps li {
  align-items: center;
  background: #f7f9fb;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  counter-increment: flow-step;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(84px, auto) minmax(0, 1fr);
  min-height: 50px;
  padding: 8px 10px;
}

.landing-flow-steps li::before {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 50%;
  color: #d19a00;
  content: counter(flow-step, decimal-leading-zero);
  display: flex;
  font-family: "Fredoka One", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-size: 13px;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.landing-flow-steps strong {
  color: #111820;
  font-size: 14px;
  line-height: 1.3;
}

.landing-flow-steps span {
  color: #667284;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

/* 原来是 stretch：右栏被拉到跟左栏一样高，而图只有比例决定的那点高度，
   剩下一大片灰底空着。改成 center——盒子只裹住图，多出来的高度让给外面。 */
.landing-flow-preview {
  align-self: center;
  background:
    linear-gradient(135deg, #f7fafc 0%, #edf3f7 100%);
  border: 1px solid #d7e1ec;
  border-radius: 8px;
  display: block;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.landing-real-preview {
  /* 跟着截图的实际比例走（2000×1112）。原来写死 1440/980，比例对不上时
     object-fit: contain 会在上下留两条空边——不剪切，但看着像没铺满。 */
  aspect-ratio: 2000 / 1112;
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(32, 43, 56, 0.14);
  display: block;
  margin: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.landing-real-preview img {
  display: block;
  height: 100%;
  object-fit: contain;
  object-position: center;
  width: 100%;
}

.landing-real-preview figcaption {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 224, 236, 0.92);
  border-radius: 8px;
  bottom: 14px;
  box-shadow: 0 12px 28px rgba(32, 43, 56, 0.12);
  display: flex;
  gap: 10px;
  left: 14px;
  max-width: calc(100% - 28px);
  padding: 10px 12px;
  position: absolute;
}

.landing-real-preview figcaption span {
  background: #111820;
  border-radius: 6px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 950;
  padding: 6px 8px;
}

.landing-real-preview figcaption strong {
  color: #344052;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.flow-browser-bar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dce4ee;
  display: flex;
  gap: 8px;
  padding: 0 16px;
}

.flow-browser-bar span {
  background: #dce4ee;
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.flow-browser-bar span:first-child {
  background: #e45b64;
}

.flow-browser-bar span:nth-child(2) {
  background: #f4c84a;
}

.flow-browser-bar span:nth-child(3) {
  background: #27877f;
}

.flow-browser-bar b {
  color: #657184;
  font-size: 12px;
  font-weight: 900;
  margin-left: 6px;
}

.flow-editor-mock {
  display: grid;
  gap: 14px;
  grid-template-columns: 52px minmax(210px, 1fr) 170px;
  padding: 24px;
}

.flow-tool-rail {
  align-self: center;
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px 8px;
}

.flow-tool-rail span {
  align-items: center;
  background: #f3f6fa;
  border-radius: 6px;
  color: #657184;
  display: flex;
  font-size: 18px;
  height: 34px;
  justify-content: center;
}

.flow-tool-rail span.active {
  background: #111820;
  color: #ffffff;
}

.flow-bead-board {
  align-self: center;
  aspect-ratio: 1;
  background:
    linear-gradient(#d8e2ec 1px, transparent 1px),
    linear-gradient(90deg, #d8e2ec 1px, transparent 1px),
    #ffffff;
  background-size: 10% 10%;
  border: 1px solid #cfdbe7;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(4, 1fr);
  justify-self: center;
  max-width: 320px;
  padding: clamp(58px, 8vw, 82px);
  width: 100%;
}

.flow-bead-board > span {
  aspect-ratio: 1;
  border-radius: 4px;
}

.flow-bead-board .bead {
  box-shadow: inset 0 -4px 0 rgba(17, 24, 32, 0.14);
}

.bead-yellow {
  background: #f4c84a;
}

.bead-coral {
  background: #e45b64;
}

.flow-palette-mock {
  align-self: center;
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.flow-palette-mock strong,
.flow-align-card strong,
.flow-proof-card strong,
.flow-style-settings strong {
  color: #111820;
  font-size: 14px;
  font-weight: 950;
}

.flow-palette-mock div {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

.flow-palette-mock i {
  background: var(--swatch);
  border: 1px solid #d5dee8;
  border-radius: 50%;
  display: block;
  height: 30px;
}

.flow-palette-mock small {
  color: #667284;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.flow-direct-mock,
.flow-generate-mock {
  align-content: center;
  display: grid;
  gap: 18px;
  padding: 24px;
}

.flow-direct-mock {
  grid-template-columns: minmax(220px, 1fr) 160px;
}

.flow-upload-sheet {
  background:
    linear-gradient(#d8e2ec 1px, transparent 1px),
    linear-gradient(90deg, #d8e2ec 1px, transparent 1px),
    linear-gradient(135deg, #fff7dd, #f2fbff);
  background-size: 24px 24px, 24px 24px, auto;
  border: 1px solid #d2dce8;
  border-radius: 8px;
  min-height: 260px;
  position: relative;
}

.flow-crop-frame {
  border: 3px solid #3478ee;
  border-radius: 8px;
  bottom: 34px;
  left: 38px;
  position: absolute;
  right: 38px;
  top: 34px;
}

.flow-crop-frame::before,
.flow-crop-frame::after {
  background: #3478ee;
  border: 3px solid #ffffff;
  border-radius: 50%;
  content: "";
  height: 14px;
  position: absolute;
  width: 14px;
}

.flow-crop-frame::before {
  left: -10px;
  top: -10px;
}

.flow-crop-frame::after {
  bottom: -10px;
  right: -10px;
}

.flow-align-card,
.flow-proof-card,
.flow-style-settings,
.flow-photo-card {
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 16px;
}

.flow-align-card span,
.flow-proof-card span,
.flow-style-settings span,
.flow-photo-card span {
  color: #667284;
  font-size: 12px;
  font-weight: 800;
}

.flow-mini-grid {
  aspect-ratio: 1;
  background:
    linear-gradient(#c7d9f4 1px, transparent 1px),
    linear-gradient(90deg, #c7d9f4 1px, transparent 1px),
    rgba(233, 241, 255, 0.76);
  background-size: 20% 20%;
  border-radius: 6px;
  min-height: 96px;
}

.flow-proof-card {
  align-self: end;
}

.flow-generate-mock {
  align-items: center;
  grid-template-columns: minmax(126px, 0.8fr) 38px minmax(170px, 1fr);
}

.flow-photo-card {
  justify-items: center;
}

.flow-photo-card img {
  display: block;
  height: 110px;
  object-fit: contain;
  width: 110px;
}

.flow-convert-arrow {
  color: #d19a00;
  font-size: 30px;
  font-weight: 950;
  text-align: center;
}

.flow-result-grid {
  aspect-ratio: 1;
  background:
    linear-gradient(#d8e2ec 1px, transparent 1px),
    linear-gradient(90deg, #d8e2ec 1px, transparent 1px),
    #ffffff;
  background-size: 16.66% 16.66%;
  border: 1px solid #cfdbe7;
  border-radius: 8px;
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(3, 1fr);
  padding: 48px;
}

.flow-result-grid i {
  background: #e45b64;
  border-radius: 4px;
  display: block;
}

.flow-result-grid i:nth-child(2n) {
  background: #f4c84a;
}

.flow-result-grid i:nth-child(3n) {
  background: #27877f;
}

.flow-style-settings {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-style-settings strong {
  grid-column: 1 / -1;
}

.brand-wordmark {
  min-width: 0;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-symbol,
.brand-wordmark-image {
  display: block;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-symbol {
  height: 42px;
  width: auto;
}

.brand-wordmark-image {
  height: 32px;
  width: auto;
}

body[data-view="home"] .brand-lockup {
  gap: 12px;
}

body[data-view="home"] .brand-symbol {
  height: 58px;
}

body[data-view="home"] .brand-wordmark-image {
  filter: invert(1);
  height: 46px;
}

.home-navigation {
  align-items: center;
  display: flex;
  gap: 30px;
  margin-left: auto;
}

.nav-link {
  align-items: center;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  font-size: 15px;
  font-weight: 650;
  gap: 5px;
  min-height: 38px;
  padding: 4px 0;
  white-space: nowrap;
}

body[data-view="home"] .nav-link:hover,
body[data-view="home"] .nav-link:focus-visible {
  color: #ffffff;
}

.nav-link:hover,
.nav-link[aria-expanded="true"] {
  color: #2868df;
}

body[data-view="home"] .nav-link:hover,
body[data-view="home"] .nav-link:focus-visible,
body[data-view="home"] .nav-link[aria-expanded="true"] {
  color: #ffffff;
}

.menu-trigger > span {
  font-size: 14px;
  transition: transform 160ms ease;
}

.menu-trigger[aria-expanded="true"] > span {
  transform: rotate(180deg);
}

.nav-menu {
  position: relative;
}

.dropdown-menu {
  background: #ffffff;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(26, 35, 48, 0.13);
  display: grid;
  gap: 4px;
  min-width: 248px;
  padding: 7px;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
}

.dropdown-menu::before {
  content: "";
  height: 12px;
  left: 0;
  position: absolute;
  right: 0;
  top: -12px;
}

.dropdown-menu button {
  background: transparent;
  border-radius: 6px;
  color: #18212b;
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: 62px;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.dropdown-menu button:hover {
  background: #f3f6f9;
}

.dropdown-menu strong {
  font-size: 14px;
}

.dropdown-menu span {
  color: #77818e;
  font-size: 11px;
  font-weight: 650;
}

.dropdown-menu .menu-secondary {
  border-top: 1px solid #e5e9ee;
  color: #69737f;
  min-height: 40px;
}

#loginButton {
  display: block;
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
}

#loginButton.is-signed-in {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  display: inline-flex;
  gap: 7px;
  max-width: none;
  min-height: 40px;
  padding: 4px 9px 4px 4px;
}

.landing-login-button.is-signed-in {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  max-width: none;
  min-height: 40px;
  min-width: 0;
  padding: 4px 9px 4px 4px;
}

.account-trigger-avatar,
.account-menu-avatar {
  align-items: center;
  background: #f1bd2f;
  background-position: center;
  background-size: cover;
  color: #111820;
  display: inline-flex;
  flex: 0 0 auto;
  font-weight: 850;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  text-transform: uppercase;
}

.account-trigger-avatar {
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.1);
  font-size: 14px;
  height: 30px;
  width: 30px;
}

.account-trigger-avatar.has-image,
.account-menu-avatar.has-image {
  color: transparent;
}

.account-trigger-caret {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  line-height: 1;
  transform: translateY(-1px);
}

.account-menu {
  gap: 6px;
  min-width: 320px;
  padding: 8px;
}

.account-menu-profile {
  background:
    linear-gradient(135deg, rgba(35, 29, 27, 0.96), rgba(98, 70, 50, 0.94)),
    radial-gradient(circle at 82% 15%, rgba(255, 255, 255, 0.18), transparent 26%);
  border-radius: 8px;
  color: #ffffff;
  overflow: hidden;
  padding: 14px;
}

.account-avatar-control {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 12px;
  grid-template-columns: 52px minmax(0, 1fr);
}

.account-avatar-control input {
  display: none;
}

.account-menu-avatar {
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  font-size: 22px;
  height: 52px;
  width: 52px;
}

.account-profile-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-profile-name-row {
  align-items: baseline;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.account-profile-copy strong {
  color: #ffffff;
  flex: 0 1 auto;
  font-size: 18px;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-profile-id {
  color: rgba(255, 255, 255, 0.72);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.account-menu .account-profile-meta {
  align-items: center;
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.account-menu .account-profile-meta b {
  color: #f1bd2f;
  font-size: inherit;
}

.account-menu .account-profile-meta span,
.account-menu .account-profile-action {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.account-menu .account-profile-meta [data-account-credits] {
  font-size: 11px;
}

body[data-view="home"] {
  background: #ffffff;
  overflow: hidden;
}

body[data-view="home"] .app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-view="home"] .topbar {
  background: #08090b;
  border-bottom: 1px solid #17191f;
  justify-content: flex-start;
  min-height: 78px;
  padding: 0 clamp(24px, 7vw, 150px);
  position: relative;
}

body[data-view="home"] .top-actions {
  display: none;
}

.home-view {
  background: #ffffff url("./assets/landing-pages-bg.webp") center bottom / cover no-repeat;
  height: 100%;
  margin: 0;
  max-width: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 82px 5vw 64px;
}

.creation-hub {
  align-content: center;
  display: grid;
  gap: 26px;
  min-height: calc(100svh - 200px);
  width: 100%;
}

.gallery-launch-card {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #121b24;
  cursor: pointer;
  display: grid;
  gap: 8px;
  justify-items: center;
  margin: 0 auto;
  max-width: 660px;
  min-height: 118px;
  padding: 50px 30px 22px;
  position: relative;
  text-align: center;
  transition: box-shadow 160ms ease;
  width: 100%;
}

.gallery-launch-card::before {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 43, 56, 0.08);
  content: "";
  inset: 0;
  position: absolute;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  z-index: 1;
}

.gallery-launch-card:hover::before {
  background: rgba(255, 255, 255, 0.9);
  border-color: #f1bd2f;
  box-shadow: 0 20px 52px rgba(32, 43, 56, 0.12);
}

.gallery-launch-card:focus-visible {
  outline: 0;
}

.gallery-launch-card:focus-visible::before,
.gallery-launch-card:active::before {
  border-color: #d69b00;
  box-shadow:
    0 0 0 4px rgba(244, 200, 74, 0.34),
    0 20px 52px rgba(32, 43, 56, 0.14);
}

.gallery-launch-card > strong {
  color: #101820;
  font-size: 26px;
  line-height: 1.15;
  position: relative;
  z-index: 2;
}

.gallery-launch-card > span:not(.gallery-dog-row) {
  color: #5a6571;
  font-size: 14px;
  font-weight: 700;
  position: relative;
  z-index: 2;
}

.gallery-dog-row {
  align-items: flex-end;
  display: flex;
  gap: 8px;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: -48px;
  transform: translateX(-50%);
  width: auto;
  z-index: 3;
}

.gallery-dog-row img {
  display: block;
  height: 70px;
  object-fit: contain;
  width: 70px;
}

.module-launcher {
  display: grid;
  gap: clamp(18px, 1.8vw, 24px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 1320px;
  width: 100%;
}

.module-button {
  align-content: start;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 43, 56, 0.08);
  color: #151c24;
  display: grid;
  gap: 26px;
  grid-template-columns: 1fr;
  min-height: 260px;
  overflow: visible;
  padding: 30px 30px 28px;
  position: relative;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.module-button:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: #f1bd2f;
  box-shadow: 0 20px 52px rgba(32, 43, 56, 0.12);
  transform: none;
}

.module-button:focus-visible,
.module-button:active,
.module-button.active {
  border-color: #d69b00;
  box-shadow:
    0 0 0 4px rgba(244, 200, 74, 0.34),
    0 20px 52px rgba(32, 43, 56, 0.14);
  outline: 0;
  transform: none;
}

.module-dog {
  display: block;
  height: 66px;
  object-fit: contain;
  width: 66px;
}

.module-button .entry-copy {
  display: grid;
  gap: 16px;
  min-height: 0;
  padding: 0;
}

.module-button .entry-copy > strong {
  color: #111820;
  font-size: 26px;
  line-height: 1.2;
}

.module-button .entry-copy > span {
  color: #525e6c;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

.module-button .entry-copy b {
  align-self: end;
  color: #c89400;
  font-size: 16px;
  font-weight: 900;
  margin-top: 8px;
  transition: color 160ms ease;
}

.module-button:hover .entry-copy b {
  color: #a97900;
}

.login-dialog {
  background: transparent;
  border: 0;
  padding: 0;
  width: min(420px, calc(100vw - 28px));
}

.login-dialog::backdrop {
  background: rgba(17, 24, 32, 0.42);
  backdrop-filter: blur(2px);
}

.login-card {
  background: #ffffff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  box-shadow: 0 22px 64px rgba(20, 29, 40, 0.22);
  display: grid;
  gap: 14px;
  padding: 20px;
}

.login-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.login-header > div {
  display: grid;
  gap: 3px;
}

.login-header span {
  color: #2868df;
  font-size: 11px;
  font-weight: 850;
}

.login-header h2 {
  font-size: 22px;
}

.login-card > .primary-button {
  margin-top: 4px;
  width: 100%;
}

@media (max-width: 1040px) {
  .module-button {
    gap: 22px;
    grid-template-columns: 1fr;
    min-height: 238px;
    padding: 28px 24px 26px;
  }

  .module-dog {
    height: 60px;
    width: 60px;
  }

  .module-button .entry-copy > strong {
    font-size: 22px;
  }
}

@media (max-width: 900px) {
  .landing-view {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .landing-topbar {
    grid-template-columns: 1fr auto;
    padding: 16px 22px;
  }

  .landing-nav {
    gap: 22px;
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 2px 0;
  }

  .landing-actions {
    align-self: start;
  }

  .landing-hero {
    margin: 0;
    padding: 74px 20px;
  }

  .landing-page {
    min-height: auto;
    padding: 72px 24px;
  }

  .landing-tool-grid,
  .landing-step-grid,
  .landing-blog-grid,
  .landing-price-grid {
    grid-template-columns: 1fr;
  }

  .landing-flow-tabs {
    max-width: none;
  }

  .landing-flow-panel {
    grid-template-columns: 1fr;
  }

  .landing-flow-preview {
    min-height: 360px;
  }

  .flow-editor-mock {
    grid-template-columns: 48px minmax(180px, 1fr) 150px;
    min-width: 0;
  }

  .landing-price-panel.featured {
    transform: none;
  }

  .landing-price-panel.is-selected,
  .landing-price-panel.featured.is-selected,
  .landing-price-panel.featured:focus-visible,
  .landing-price-panel.featured:hover {
    transform: none;
  }

  body[data-view="home"] .topbar {
    min-height: 78px;
    padding: 0 24px;
  }

  .home-navigation {
    gap: 20px;
  }

  .nav-link {
    font-size: 15px;
  }

  .home-view {
    min-height: calc(100svh - 78px);
    padding: 66px 24px 52px;
  }

  .creation-hub {
    gap: 22px;
    min-height: auto;
  }

  .gallery-launch-card {
    max-width: 420px;
    min-height: 108px;
    padding: 44px 22px 22px;
  }

  .gallery-dog-row {
    gap: 6px;
    top: -40px;
  }

  .gallery-dog-row img {
    height: 58px;
    width: 58px;
  }

  .module-launcher {
    gap: 14px;
    grid-template-columns: 1fr;
    max-width: 620px;
  }

  .module-button {
    gap: 20px;
    min-height: 220px;
    padding: 26px 24px 24px;
  }
}

@media (max-width: 620px) {
  .landing-topbar {
    gap: 14px;
    padding: 14px 16px;
  }

  .landing-brand .brand-lockup {
    gap: 8px;
  }

  .landing-brand .brand-symbol {
    height: 42px;
  }

  .landing-brand .brand-wordmark-image {
    height: 32px;
  }

  .landing-login-button,
  .landing-language-button {
    font-size: 12px;
    min-height: 34px;
    min-width: 54px;
    padding: 6px 10px;
  }

  .landing-language-button {
    font-size: 14px;
    gap: 7px;
    height: 36px;
    min-height: 36px;
    min-width: 0;
    padding: 0 14px;
    width: auto;
  }

  .landing-language-button .landing-language-flag {
    font-size: 13px;
  }

  .landing-language-menu {
    min-width: 126px;
    padding: 5px;
  }

  .landing-language-menu button {
    gap: 9px;
    grid-template-columns: 22px minmax(0, 1fr);
    min-height: 36px;
    padding: 0 10px;
  }

  .landing-language-menu button span {
    font-size: 14px;
  }

  .landing-language-menu button strong {
    font-size: 14px;
  }

  .landing-nav {
    gap: 18px;
  }

  .landing-nav button,
  .landing-nav a {
    font-size: 14px;
  }

  .landing-hero {
    background-position: 32% center;
    background-size: cover;
    margin: 0;
    padding: 66px 18px;
  }

  .landing-page {
    background-position: center;
    background-size: cover;
    padding: 58px 18px;
  }

  .landing-page h2 {
    font-size: 32px;
  }

  .landing-page-copy p {
    font-size: 15px;
  }

  .pricing-cycle-toggle {
    width: 100%;
  }

  .pricing-cycle-toggle button {
    flex: 1;
    justify-content: center;
    min-width: 0;
    padding: 0 12px;
  }

  .landing-tool-card,
  .landing-step-grid article,
  .landing-blog-grid article,
  .landing-price-panel {
    min-height: auto;
    padding: 22px;
  }

  .landing-flow-tabs {
    grid-template-columns: 1fr;
  }

  .landing-flow-tabs button {
    min-height: 42px;
  }

  .landing-flow-panel {
    padding: 18px;
  }

  .landing-flow-copy h3 {
    font-size: 24px;
  }

  .landing-flow-steps li {
    align-items: start;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .landing-flow-steps span {
    grid-column: 2;
  }

  .landing-flow-preview {
    min-height: auto;
    padding: 8px;
  }

  .landing-real-preview figcaption {
    align-items: start;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    border-right: 0;
    bottom: auto;
    box-shadow: none;
    display: grid;
    left: auto;
    max-width: none;
    padding: 10px;
    position: static;
  }

  .landing-real-preview figcaption span {
    justify-self: start;
  }

  .flow-editor-mock,
  .flow-direct-mock,
  .flow-generate-mock {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .flow-tool-rail {
    display: flex;
    justify-content: center;
  }

  .flow-tool-rail span {
    width: 34px;
  }

  .flow-bead-board {
    padding: 44px;
  }

  .flow-palette-mock div {
    grid-template-columns: repeat(6, 1fr);
  }

  .flow-generate-mock {
    justify-items: center;
  }

  .flow-convert-arrow {
    transform: rotate(90deg);
  }

  .flow-result-grid {
    max-width: 260px;
    padding: 42px;
    width: 100%;
  }

  .flow-style-settings {
    grid-template-columns: 1fr;
    justify-self: stretch;
  }

  .landing-content h1 {
    margin-top: 0;
  }

  .landing-title-main {
    font-size: clamp(39px, 11.2vw, 49px);
  }

  .landing-title-sub {
    font-size: clamp(39px, 11.2vw, 49px);
    margin-left: 0.12em;
  }

  .landing-content p {
    font-size: 15px;
    line-height: 1.6;
    margin-top: 16px;
  }

  .landing-enter-button {
    margin-top: 34px;
    min-height: 52px;
    min-width: 170px;
  }

  body[data-view="home"] .topbar {
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 0 16px;
  }

  body[data-view="home"] .brand-lockup {
    gap: 8px;
  }

  body[data-view="home"] .brand-symbol {
    height: 58px;
  }

  body[data-view="home"] .brand-wordmark-image {
    height: 46px;
  }

  .home-navigation {
    gap: 18px;
    justify-content: flex-end;
    width: auto;
  }

  .nav-link {
    font-size: 14px;
    min-height: 36px;
  }

  #loginButton {
    max-width: 82px;
  }

  .dropdown-menu {
    max-width: calc(100vw - 28px);
    min-width: 228px;
    right: -8px;
  }

  .home-view {
    min-height: calc(100svh - 78px);
    padding: 58px 18px 46px;
  }

  .gallery-launch-card {
    max-width: 300px;
    min-height: 96px;
    padding: 38px 18px 18px;
  }

  .gallery-launch-card > strong {
    font-size: 22px;
  }

  .gallery-dog-row {
    gap: 4px;
    top: -34px;
    width: auto;
  }

  .gallery-dog-row img {
    height: 50px;
    width: 50px;
  }

  .module-button {
    gap: 16px;
    grid-template-columns: 1fr;
    min-height: 204px;
    padding: 22px 20px 22px;
  }

  .module-dog {
    height: 54px;
    width: 54px;
  }

  .module-button .entry-copy > strong {
    font-size: 20px;
  }

  .module-button .entry-copy > span {
    font-size: 13px;
  }

  .module-button .entry-copy b {
    font-size: 15px;
    margin-top: 6px;
  }
}

/* ---- 拼豆内容中心 / SEO 博客模块 --------------------------------------- */
.blog-body {
  background:
    linear-gradient(180deg, rgba(244, 248, 251, 0.92), rgba(241, 244, 242, 1) 460px),
    var(--bg);
  color: var(--text);
}

.blog-body a {
  color: inherit;
}

.blog-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
}

.blog-topbar-cta {
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(244, 200, 74, 0.72);
  border-radius: 8px;
  color: #111820;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  text-decoration: none;
}

.blog-hub,
.article-page {
  margin: 0 auto;
  max-width: 1280px;
  padding: clamp(34px, 5vw, 74px) clamp(18px, 5vw, 72px) clamp(62px, 8vw, 110px);
}

.blog-hero {
  align-items: center;
  display: grid;
  gap: clamp(28px, 5vw, 72px);
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  min-height: 330px;
}

.blog-kicker,
.article-cta > span {
  color: #c48600;
  display: inline-flex;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
}

.blog-hero h1,
.article-hero h1 {
  color: #111820;
  font-size: clamp(38px, 5.8vw, 76px);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.02;
  margin: 14px 0 0;
}

.blog-hero p,
.article-hero > p {
  color: #4d5968;
  font-size: clamp(16px, 1.4vw, 19px);
  font-weight: 650;
  line-height: 1.8;
  margin: 18px 0 0;
  max-width: 760px;
}

.blog-hero-panel {
  aspect-ratio: 1;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 247, 220, 0.86)),
    #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(32, 43, 56, 0.12);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, 1fr);
  padding: clamp(18px, 3vw, 34px);
}

.blog-hero-panel span {
  background: var(--bead);
  border: 1px solid rgba(17, 24, 32, 0.15);
  border-radius: 50%;
  box-shadow:
    inset 0 5px 10px rgba(255, 255, 255, 0.42),
    inset 0 -5px 10px rgba(0, 0, 0, 0.08),
    0 7px 14px rgba(17, 24, 32, 0.08);
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 30px;
}

.blog-filter,
.blog-category,
.blog-tag {
  text-decoration: none;
}

.blog-filter {
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 999px;
  color: #566273;
  font-size: 14px;
  font-weight: 850;
  padding: 10px 14px;
}

.blog-filter:hover,
.blog-filter:focus-visible,
.blog-filter.active {
  border-color: #d69b00;
  color: #111820;
  box-shadow: 0 10px 24px rgba(32, 43, 56, 0.08);
}

.blog-layout {
  align-items: start;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) 290px;
}

.blog-result-line {
  color: #68726f;
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 14px;
}

.blog-result-line strong {
  color: #111820;
}

.blog-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.blog-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 43, 56, 0.07);
  display: grid;
  grid-template-rows: 190px minmax(0, 1fr);
  overflow: hidden;
}

.blog-card[hidden] {
  display: none;
}

.blog-card-cover {
  background: #edf3f8;
  display: block;
  overflow: hidden;
}

.blog-card-cover img {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
  width: 100%;
}

.blog-card:hover .blog-card-cover img {
  transform: scale(1.025);
}

.blog-card-body {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.blog-card-meta,
.article-meta-row {
  align-items: center;
  color: #68726f;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 750;
  gap: 10px;
}

.blog-category {
  background: #fff1bf;
  border: 1px solid #e2bd3b;
  border-radius: 999px;
  color: #6a4d00;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  padding: 7px 9px;
}

.blog-card h2 {
  font-size: 22px;
  line-height: 1.26;
  margin: 16px 0 0;
}

.blog-card h2 a {
  color: #111820;
  text-decoration: none;
}

.blog-card p {
  color: #566273;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.7;
  margin: 12px 0 0;
}

.blog-card-footer {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 22px;
}

.blog-card-footer span {
  color: #68726f;
  font-size: 13px;
  font-weight: 750;
}

.blog-readmore {
  color: #d19a00;
  font-size: 14px;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.blog-tag {
  background: #eef5f4;
  border: 1px solid #d7e5e2;
  border-radius: 999px;
  color: #286a64;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 9px;
}

.blog-search-intent,
.article-toc {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(32, 43, 56, 0.07);
  padding: 22px;
  position: sticky;
  top: 104px;
}

.blog-search-intent h2,
.article-toc strong {
  color: #111820;
  display: block;
  font-size: 17px;
  font-weight: 950;
  line-height: 1.25;
  margin: 0 0 14px;
}

.blog-search-intent div,
.article-toc nav,
.article-toc-mobile nav {
  display: grid;
  gap: 8px;
}

.blog-search-intent a,
.article-toc a,
.article-toc-mobile a {
  color: #566273;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  text-decoration: none;
}

.blog-search-intent a:hover,
.article-toc a:hover,
.article-toc-mobile a:hover {
  color: #111820;
}

.blog-empty {
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  color: #566273;
  font-weight: 750;
  margin: 0;
  padding: 22px;
}

.article-page {
  max-width: 1180px;
}

.article-shell {
  min-width: 0;
}

.article-hero {
  margin: 0 auto;
  max-width: 920px;
}

.article-back {
  color: #d19a00;
  display: inline-flex;
  font-size: 14px;
  font-weight: 950;
  margin-bottom: 18px;
  text-decoration: none;
}

.article-hero h1 {
  font-size: clamp(34px, 4.8vw, 64px);
  max-width: 960px;
}

.article-updated {
  color: #68726f;
  font-size: 13px;
  font-weight: 750;
  margin-top: 14px;
}

.article-cover {
  background: #edf3f8;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  box-shadow: 0 22px 58px rgba(32, 43, 56, 0.1);
  margin: 28px 0 0;
  overflow: hidden;
}

.article-cover img {
  display: block;
  max-height: 430px;
  object-fit: cover;
  width: 100%;
}

.article-layout {
  align-items: start;
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(0, 760px) 260px;
  justify-content: center;
  margin-top: 42px;
}

.article-content {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #dce4ee;
  border-radius: 8px;
  padding: clamp(22px, 4vw, 44px);
}

.article-content h2,
.article-content h3 {
  color: #111820;
  letter-spacing: 0;
  line-height: 1.25;
}

.article-content h2 {
  font-size: clamp(25px, 2.6vw, 34px);
  margin: 42px 0 14px;
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h3 {
  font-size: 21px;
  margin: 30px 0 10px;
}

.article-content p,
.article-content li {
  color: #2f3a48;
  font-size: 16px;
  font-weight: 520;
  line-height: 1.9;
}

.article-content p {
  margin: 0 0 18px;
}

.article-content ul,
.article-content ol {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  padding-left: 1.35em;
}

.article-content blockquote {
  background: #fff8dc;
  border-left: 4px solid #f4c84a;
  border-radius: 6px;
  color: #5c4300;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.8;
  margin: 24px 0;
  padding: 18px 20px;
}

.article-content pre {
  background: #111820;
  border-radius: 8px;
  color: #f7fbff;
  font-size: 14px;
  line-height: 1.65;
  margin: 24px 0;
  overflow-x: auto;
  padding: 18px;
}

.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.article-content p code,
.article-content li code {
  background: #eef5f4;
  border-radius: 5px;
  color: #17665f;
  padding: 2px 5px;
}

.article-table-wrap {
  border: 1px solid #dce4ee;
  border-radius: 8px;
  margin: 24px 0;
  overflow-x: auto;
}

.article-content table {
  border-collapse: collapse;
  min-width: 620px;
  width: 100%;
}

.article-content th,
.article-content td {
  border-bottom: 1px solid #e6ecef;
  color: #2f3a48;
  font-size: 15px;
  line-height: 1.6;
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

.article-content th {
  background: #f7f9f8;
  color: #111820;
  font-weight: 900;
}

.article-content tr:last-child td {
  border-bottom: 0;
}

.article-toc-mobile {
  background: #f7f9f8;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  margin-bottom: 28px;
  padding: 14px 16px;
}

.article-toc-mobile summary {
  color: #111820;
  cursor: pointer;
  font-size: 15px;
  font-weight: 950;
}

.article-toc-mobile nav {
  margin-top: 12px;
}

.article-cta {
  background:
    linear-gradient(135deg, rgba(255, 248, 222, 0.92), rgba(238, 246, 245, 0.96)),
    #ffffff;
  border: 1px solid #e4d59d;
  border-radius: 8px;
  margin-top: 42px;
  padding: clamp(20px, 3vw, 30px);
}

.article-cta h2 {
  font-size: clamp(24px, 2.4vw, 32px);
  margin: 10px 0;
}

.article-cta div {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.article-cta a {
  background: #ffffff;
  border: 1px solid #d8e1df;
  border-radius: 8px;
  color: #111820;
  font-size: 14px;
  font-weight: 900;
  min-height: 42px;
  padding: 11px 14px;
  text-decoration: none;
}

.article-cta a:first-child {
  background: #111820;
  border-color: #111820;
  color: #ffffff;
}

.article-related {
  margin-top: 42px;
}

.article-related > h2 {
  font-size: 28px;
  margin: 0 0 16px;
}

.article-related-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.article-related-grid a {
  background: #ffffff;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 18px;
  text-decoration: none;
}

.article-related-grid span {
  color: #c48600;
  font-size: 12px;
  font-weight: 950;
}

.article-related-grid strong {
  color: #111820;
  font-size: 16px;
  line-height: 1.35;
}

.article-related-grid small {
  color: #68726f;
  font-size: 12px;
  font-weight: 750;
}

@media (min-width: 961px) {
  .article-toc-mobile {
    display: none;
  }
}

@media (max-width: 1040px) {
  .blog-layout,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .blog-search-intent,
  .article-toc {
    position: static;
  }

  .article-toc {
    display: none;
  }
}

@media (max-width: 760px) {
  .blog-hero {
    grid-template-columns: 1fr;
  }

  .blog-hero-panel {
    max-width: 280px;
  }

  .blog-grid,
  .article-related-grid {
    grid-template-columns: 1fr;
  }

  .blog-card {
    grid-template-rows: 170px minmax(0, 1fr);
  }

  .article-content {
    background: transparent;
    border: 0;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 620px) {
  .blog-topbar .landing-actions {
    display: none;
  }

  .blog-hub,
  .article-page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .blog-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .blog-filter {
    flex: 0 0 auto;
  }
}

/* Final editor layout overrides */
body[data-view="editor"] {
  overflow: hidden;
}

body[data-view="editor"] .workspace {
  display: grid;
  gap: 10px;
  grid-template-areas: none;
  grid-template-columns: minmax(480px, 1fr) 324px;
  height: calc(100vh - 72px);
  margin: 0;
  max-width: none;
  min-height: 540px;
  padding: 10px;
}

body[data-view="editor"] .board-panel {
  display: grid;
  grid-area: auto;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  position: relative;
}

body[data-view="editor"] .canvas-wrap {
  background: #f4f7fb;
  display: block;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
}

body[data-view="editor"] #patternCanvas {
  background: transparent;
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

body[data-view="editor"] .tool-button {
  min-height: 58px;
}

body[data-view="editor"] .inspector {
  grid-area: auto;
  max-height: none;
  min-height: 0;
  overflow: hidden;
}

body[data-view="editor"] .inspector-panel {
  max-height: 100%;
  overflow: auto;
}

body[data-view="editor"] .palette-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body[data-view="editor"] .canvas-wrap:has(.grid-settings-panel:not(.is-hidden))::before {
  background: rgba(20, 28, 36, 0.34);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 11;
}

body[data-view="editor"] .grid-settings-panel,
body[data-view="editor"][data-editor-mode="complete"] .grid-settings-panel {
  border-radius: 18px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(820px, calc(100% - 42px), calc(100dvh - 112px));
  left: 50%;
  max-height: none;
  min-height: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 42px));
  z-index: 18;
}

body[data-view="editor"] .grid-settings-panel > header {
  min-height: 66px;
  padding: 13px 18px;
}

body[data-view="editor"] .grid-settings-panel > header h2 {
  font-size: 22px;
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body {
  align-content: start;
  display: block;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  padding: 16px 18px;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body > * + * {
  margin-top: 13px;
}

body[data-view="editor"] .grid-settings-panel details {
  border: 1px solid #e0e6ee;
  border-radius: 12px;
  display: block;
  overflow: hidden;
  padding-top: 0;
}

body[data-view="editor"] .grid-settings-panel summary {
  background: #f7f9fb;
  border-bottom: 1px solid #e0e6ee;
  padding: 12px 14px;
}

body[data-view="editor"] .grid-settings-panel details[open] summary {
  margin-bottom: 0;
}

body[data-view="editor"] .grid-settings-panel .detail-fields {
  display: grid;
  padding: 14px;
}

body[data-view="editor"] .grid-settings-panel > footer {
  background: rgba(255, 255, 255, 0.98);
  padding: 13px 18px;
}

.layer-row.selected {
  background: #eef4ff;
  border-color: #8eb5f5;
}

.editor-detail-panel .panel-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
}

.editor-detail-panel .panel-toggle input[type="checkbox"] {
  flex: 0 0 auto;
  height: 18px;
  min-height: 0;
  padding: 0;
  width: 18px;
}

.editor-detail-panel.layers-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  height: calc(100% - 108px);
}

.editor-detail-panel.layers-panel .layer-list {
  align-self: stretch;
  max-height: none;
  min-height: 0;
}

@media (max-width: 1040px) {
  body[data-view="editor"] .workspace {
    grid-template-columns: minmax(420px, 1fr) 286px;
  }
}

@media (max-width: 900px) {
  body[data-view="editor"] {
    overflow: auto;
  }

  body[data-view="editor"] .workspace {
    grid-template-areas: "board" "inspector";
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 72px);
  }

  body[data-view="editor"] .board-panel {
    grid-area: board;
    min-height: 700px;
  }

  body[data-view="editor"] .inspector {
    grid-area: inspector;
    max-height: 560px;
  }

  body[data-view="editor"] .palette-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body[data-view="editor"] .editor-command-bar {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    left: 10px;
    max-width: none;
    overflow: visible;
    padding: 4px;
    right: 10px;
    transform: none;
  }

  body[data-view="editor"] .editor-command-bar button {
    min-height: 52px;
    min-width: 0;
    padding: 5px 1px;
  }

  body[data-view="editor"] .editor-command-bar button > span {
    font-size: 17px;
  }

  body[data-view="editor"] .editor-command-bar small {
    font-size: 9px;
  }

  body[data-view="editor"] .editor-command-bar .command-done {
    margin-left: 2px;
  }
}

@media (max-width: 620px) {
  body[data-view="editor"] .workspace {
    padding: 6px;
  }

  body[data-view="editor"] .board-panel {
    min-height: 650px;
  }

  body[data-view="editor"] .canvas-wrap {
    min-height: 520px;
  }

  body[data-view="editor"] .board-toolbar {
    align-items: center;
    flex-direction: row;
  }

  body[data-view="editor"] .palette-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Read-only completion mode */
.completion-summary {
  align-items: center;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #dce3e0;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(26, 38, 36, 0.1);
  display: flex;
  gap: 12px;
  left: 50%;
  min-height: 60px;
  padding: 7px 10px 7px 14px;
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  z-index: 2;
}

.completion-mode-copy {
  display: grid;
  gap: 2px;
  min-width: 70px;
}

.completion-mode-copy strong {
  color: #15845f;
  font-size: 12px;
  line-height: 1.1;
}

.completion-mode-copy span {
  color: #7c8783;
  font-size: 10px;
  font-weight: 800;
}

.completion-size {
  align-items: baseline;
  border-left: 1px solid #e0e6e3;
  display: flex;
  gap: 5px;
  padding-left: 12px;
  white-space: nowrap;
}

.completion-size strong {
  color: #1f2928;
  font-size: 22px;
  line-height: 1;
}

.completion-size > span {
  color: #89928f;
  font-size: 14px;
  font-weight: 800;
}

.completion-size small {
  color: #6c7774;
  font-size: 10px;
  font-weight: 800;
  margin-left: 1px;
}

.completion-actions {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.completion-actions button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #4b5754;
  display: grid;
  gap: 3px;
  height: 54px;
  justify-items: center;
  padding: 5px 9px;
  width: 58px;
}

.completion-actions button > span {
  font-size: 19px;
  line-height: 1;
}

.completion-actions button small {
  font-size: 10px;
  font-weight: 850;
}

.completion-actions button:hover {
  background: #f2f5f4;
}

#sharePatternButton {
  background: #f0efff;
  color: #5b55d7;
}

#uploadPatternButton {
  background: #eaf3ff;
  color: #2c6dcc;
}

body[data-view="editor"][data-editor-mode="complete"] {
  overflow: hidden;
}

body[data-view="editor"][data-editor-mode="complete"] .topbar {
  min-height: 72px;
  padding-bottom: 7px;
  padding-top: 7px;
}

body[data-view="editor"][data-editor-mode="complete"] .top-actions,
body[data-view="editor"][data-editor-mode="complete"] .editor-center,
body[data-view="editor"][data-editor-mode="complete"] .board-toolbar,
body[data-view="editor"][data-editor-mode="complete"] .editor-command-bar,
body[data-view="editor"][data-editor-mode="complete"] .selection-summary,
body[data-view="editor"][data-editor-mode="complete"] .selection-actions,
body[data-view="editor"][data-editor-mode="complete"] .magic-tolerance-panel,
body[data-view="editor"][data-editor-mode="complete"] .floating-toolbox,
body[data-view="editor"][data-editor-mode="complete"] .inspector {
  display: none !important;
}

body[data-view="editor"][data-editor-mode="complete"] .workspace {
  display: block;
  height: calc(100dvh - 72px);
  min-height: 0;
  padding: 0;
}

body[data-view="editor"][data-editor-mode="complete"] .board-panel {
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

body[data-view="editor"][data-editor-mode="complete"] .canvas-wrap {
  border-radius: 0;
  height: 100%;
  min-height: 0;
}

body[data-view="editor"][data-editor-mode="complete"] #patternCanvas {
  cursor: grab !important;
}

body[data-view="editor"][data-editor-mode="complete"] #patternCanvas:active {
  cursor: grabbing !important;
}

@media (max-width: 1100px) {
  body[data-view="editor"][data-editor-mode="complete"] .topbar {
    display: grid;
    grid-template-areas:
      "brand actions"
      "summary summary";
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 136px;
    row-gap: 5px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-button {
    grid-area: brand;
  }

  .completion-actions {
    grid-area: actions;
    justify-self: end;
  }

  .completion-summary {
    grid-area: summary;
    justify-self: center;
    left: auto;
    min-height: 54px;
    position: static;
    top: auto;
    transform: none;
  }

  body[data-view="editor"][data-editor-mode="complete"] .workspace {
    height: calc(100dvh - 136px);
  }
}

@media (max-width: 620px) {
  body[data-view="editor"][data-editor-mode="complete"] .topbar {
    min-height: 126px;
    padding: 6px 8px;
    position: sticky;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-button {
    width: 126px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-lockup {
    gap: 7px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-symbol {
    height: 36px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-wordmark-image {
    height: 26px;
  }

  .completion-actions {
    gap: 3px;
  }

  .completion-actions button {
    height: 46px;
    padding: 4px 5px;
    width: 45px;
  }

  .completion-actions button > span {
    font-size: 16px;
  }

  .completion-actions button small {
    font-size: 9px;
  }

  .completion-summary {
    gap: 6px;
    justify-self: stretch;
    min-height: 52px;
    padding: 5px 6px 5px 9px;
  }

  .completion-mode-copy {
    min-width: 56px;
  }

  .completion-mode-copy strong {
    font-size: 10px;
  }

  .completion-mode-copy span,
  .completion-size small {
    font-size: 8px;
  }

  .completion-size {
    gap: 3px;
    padding-left: 7px;
  }

  .completion-size strong {
    font-size: 17px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .workspace {
    height: calc(100dvh - 126px);
    min-height: 0;
    padding: 0;
  }

  body[data-view="editor"][data-editor-mode="complete"] .board-panel,
  body[data-view="editor"][data-editor-mode="complete"] .canvas-wrap {
    min-height: 0;
  }
}

/* Narrow-screen fixes kept last to override legacy responsive rules. */
@media (max-width: 720px) {
  body[data-view="editor"][data-editor-mode="complete"] .topbar {
    display: grid;
    grid-template-areas:
      "brand"
      "actions"
      "summary";
    grid-template-columns: minmax(0, 1fr);
    min-height: 180px;
    padding: 6px 8px;
    row-gap: 5px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .brand-button {
    grid-area: brand;
    min-width: 118px;
    width: 118px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions {
    display: flex;
    gap: 2px;
    grid-area: actions;
    justify-self: stretch;
    justify-content: space-between;
    margin: 0;
    overflow: visible;
    width: 100%;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions button {
    flex: 1 1 0;
    height: 46px;
    min-width: 0;
    padding: 3px 2px;
    width: auto;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions .completion-projects-button {
    flex: 1.3 1 0;
    min-width: 0;
    width: auto;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions button > span {
    font-size: 15px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-actions button small {
    font-size: 8px;
  }

  body[data-view="editor"][data-editor-mode="complete"] .completion-summary {
    grid-area: summary;
    justify-self: stretch;
    left: auto;
    position: static;
    top: auto;
    transform: none;
    width: 100%;
  }

  body[data-view="editor"][data-editor-mode="complete"] .workspace {
    height: calc(100dvh - 180px);
  }
}

@media (max-width: 430px) {
  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    gap: 3px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
    gap: 2px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .history-cluster .icon-button {
    min-width: 28px;
    padding: 0;
    width: 28px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button {
    min-width: 39px;
    padding-left: 2px;
    padding-right: 2px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span {
    font-size: 15px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small {
    font-size: 8px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .tool-button {
    min-width: 43px;
    padding-left: 3px;
    padding-right: 3px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .tool-button > span {
    font-size: 17px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .floating-brush-control {
    flex-basis: 68px;
    grid-template-columns: 1fr auto;
    padding-left: 5px;
    padding-right: 5px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .floating-brush-control small {
    display: none;
  }

  body[data-view="editor"][data-editor-mode="edit"] .recent-colors > span {
    display: inline;
  }

  .projects-view .project-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-collection.list-view .project-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }
}

/* Latest editor header and tool refinements */
.removed-top-action {
  display: none !important;
}

.editor-back-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #18202d;
  display: inline-flex;
  font-size: 30px;
  height: 52px;
  justify-content: center;
  padding: 0;
  width: 52px;
}

.editor-back-button:hover {
  background: #f2f5f4;
}

body[data-view="editor"][data-editor-mode="edit"] .topbar {
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 72px;
  padding: 8px 18px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  grid-column: 2;
  justify-content: center;
  justify-self: center;
  width: min(760px, 100%);
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  display: flex;
  gap: 4px;
}

body[data-view="editor"][data-editor-mode="edit"] .top-actions {
  grid-column: 3;
  justify-self: end;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  background: #ffffff;
  border: 1px solid #d9dfdc;
  color: #1f2928;
  min-height: 42px;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton:hover {
  background: #f4f7f6;
  border-color: #c8d2cf;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 72px);
}

body[data-view="editor"][data-editor-mode="edit"] .board-toolbar .editor-back-button {
  background: #ffffff;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  flex: 0 0 auto;
  font-size: 24px;
  height: 42px;
  min-height: 42px;
  width: 42px;
}

body[data-view="editor"][data-editor-mode="edit"] .board-toolbar {
  grid-template-rows: auto;
  min-height: 64px;
}

body[data-view="editor"][data-editor-mode="edit"] .palette-quick-row {
  border-bottom: 0;
  gap: 8px;
  min-height: 64px;
  padding: 8px 12px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-toolbar-row {
  display: none !important;
}

.inline-recent-colors {
  align-items: center;
  border-left: 1px solid #e1e7e4;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 42px;
  padding-left: 10px;
}

.inline-recent-colors > span {
  color: #68726f;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list {
  flex: 0 1 auto;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip {
  height: 36px;
  min-width: 36px;
  width: 36px;
}

body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox {
  overflow: visible;
}

body[data-view="editor"][data-editor-mode="edit"] .floating-brush-control {
  border: 0;
  display: block;
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
  position: relative;
}

.brush-size-toggle {
  align-items: center;
  background: #ffffff;
  border: 0;
  border-radius: 6px;
  color: #66716e;
  display: grid;
  gap: 4px;
  height: 58px;
  justify-items: center;
  min-width: 72px;
  padding: 6px 8px;
}

.brush-size-toggle:hover,
.floating-brush-control.open .brush-size-toggle {
  background: #eef4ff;
  color: #2868df;
}

.brush-size-toggle > span {
  font-size: 16px;
  line-height: 1;
}

.brush-size-toggle small {
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.brush-size-popover {
  background: #ffffff;
  border: 1px solid #d9dfdc;
  border-radius: 8px;
  bottom: calc(100% + 10px);
  box-shadow: 0 12px 30px rgba(25, 35, 34, 0.18);
  display: none;
  left: 50%;
  padding: 12px 14px;
  position: absolute;
  transform: translateX(-50%);
  width: 168px;
  z-index: 25;
}

.brush-size-value {
  align-items: center;
  color: #66716e;
  display: flex;
  font-size: 12px;
  font-weight: 850;
  justify-content: space-between;
  margin-bottom: 8px;
}

.brush-size-value b {
  align-items: center;
  background: #2b9d91;
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 12px;
  height: 22px;
  justify-content: center;
  min-width: 22px;
  padding: 0 7px;
}

.floating-brush-control.open .brush-size-popover {
  display: block;
}

.brush-size-popover::after {
  background: #ffffff;
  border-bottom: 1px solid #d9dfdc;
  border-right: 1px solid #d9dfdc;
  bottom: -6px;
  content: "";
  height: 10px;
  left: 50%;
  position: absolute;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
}

.brush-size-popover input {
  accent-color: #2868df;
  width: 100%;
}

@media (max-width: 1120px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    grid-template-areas: "brand commands actions";
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 72px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-button {
    grid-area: brand;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    grid-area: commands;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions {
    grid-area: actions;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 72px);
  }
}

@media (max-width: 720px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    gap: 6px;
    grid-template-areas:
      "brand actions"
      "commands commands";
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 136px;
    padding: 6px 8px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .brand-button {
    grid-area: brand;
    min-width: 112px;
    width: 112px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .top-actions {
    justify-self: end;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    width: 100%;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 136px);
  }

  body[data-view="editor"][data-editor-mode="edit"] .palette-quick-row {
    flex-wrap: wrap;
    min-height: 104px;
  }

  .inline-recent-colors {
    order: 2;
  }

  body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list {
    order: 3;
    width: 100%;
  }

  .brush-size-toggle {
    min-width: 56px;
  }

  .brush-size-toggle small {
    font-size: 9px;
  }
}

/* Right-aligned independent editor commands */
body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  justify-content: flex-end;
  justify-self: end;
  width: auto;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 7px;
  overflow: visible;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  color: #405064;
  display: inline-grid;
  gap: 4px;
  height: 50px;
  justify-content: center;
  justify-items: center;
  margin: 0;
  min-height: 50px;
  min-width: 50px;
  padding: 6px 7px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button:hover,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done:hover {
  background: #f1f5fb;
  color: #2868df;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span {
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small {
  color: currentColor;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button.active {
  background: #edf4ff;
  color: #2868df;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  background: #2868df;
  border-radius: 18px;
  color: #ffffff;
  height: 58px;
  min-height: 58px;
  min-width: 58px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done.active {
  background: #2868df;
  color: #ffffff;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done:hover {
  background: #1f5ed0;
  color: #ffffff;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #405064;
  display: inline-grid;
  font-size: 11px;
  font-weight: 850;
  gap: 4px;
  height: 50px;
  justify-items: center;
  min-height: 50px;
  min-width: 50px;
  padding: 6px 7px;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton span {
  font-size: 18px;
  line-height: 1;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton small {
  color: currentColor;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton:hover,
body[data-view="editor"][data-editor-mode="edit"] #homeButton:focus-visible {
  background: #f1f5fb;
  color: #2868df;
}

@media (max-width: 1120px) {
  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    justify-content: flex-end;
    overflow-x: auto;
    width: 100%;
  }
}

@media (max-width: 720px) {
  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    justify-content: flex-start;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
    overflow-x: auto;
  }

  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
  body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
    flex: 0 0 auto;
    min-width: 48px;
    padding-left: 6px;
    padding-right: 6px;
  }
}

/* Keep undo and redo icons visually centered inside their buttons. */
body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button {
  align-items: center;
  display: inline-grid;
  justify-content: center;
  line-height: 1;
  padding: 0;
  place-items: center;
  text-align: center;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button svg {
  display: block;
  fill: none;
  height: 22px;
  margin: 0;
  overflow: visible;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

body[data-view="editor"][data-editor-mode="edit"] #undoButton svg {
  transform: translate(1.5px, -1px);
}

body[data-view="editor"][data-editor-mode="edit"] #redoButton svg {
  transform: translate(-1.5px, -1px);
}

/* Place undo and redo at the visual center of the editor header. */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  position: sticky;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  margin-left: auto;
}

@media (max-width: 720px) {
body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  left: auto;
  position: static;
  top: auto;
  transform: none;
}
}

/* Compact single-row editor header: palette controls move into the top blank area. */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  align-items: center;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 60px;
  padding: 4px 14px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  align-items: center;
  display: flex;
  gap: 12px;
  grid-column: 2;
  justify-content: flex-start;
  justify-self: stretch;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
  align-items: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dfe6e3;
  border-radius: 8px;
  display: flex;
  flex: 1 1 560px;
  gap: 5px;
  max-width: 640px;
  min-height: 40px;
  min-width: 240px;
  overflow: hidden;
  padding: 4px 7px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip .editor-back-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #18202d;
  flex: 0 0 auto;
  font-size: 22px;
  height: 32px;
  min-height: 32px;
  width: 32px;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  left: auto;
  position: static;
  top: auto;
  transform: none;
  z-index: auto;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button {
  background: #ffffff;
  border: 1px solid #dfe6e3;
  border-radius: 7px;
  color: #9aa3a0;
  height: 32px;
  min-height: 32px;
  width: 32px;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button svg {
  height: 18px;
  width: 18px;
}

body[data-view="editor"][data-editor-mode="edit"] #undoButton svg,
body[data-view="editor"][data-editor-mode="edit"] #redoButton svg {
  transform: none;
}

body[data-view="editor"][data-editor-mode="edit"] .switch-palette-button {
  border-radius: 7px;
  font-size: 11px;
  gap: 5px;
  min-height: 32px;
  padding: 5px 9px;
}

body[data-view="editor"][data-editor-mode="edit"] .switch-palette-button > span {
  font-size: 14px;
}

body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list {
  flex: 0 1 auto;
  gap: 5px;
  max-width: 210px;
  overflow: hidden;
  padding: 0 2px 4px;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip {
  border-radius: 7px;
  font-size: 10px;
  height: 30px;
  min-width: 30px;
  width: 30px;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip.active::after {
  bottom: -6px;
  width: 15px;
}

body[data-view="editor"][data-editor-mode="edit"] .inline-recent-colors {
  gap: 5px;
  min-height: 32px;
  padding-left: 7px;
}

body[data-view="editor"][data-editor-mode="edit"] .inline-recent-colors > span {
  font-size: 10px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-list {
  gap: 4px;
  min-height: 32px;
  padding: 0 1px 4px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button {
  font-size: 9px;
  height: 28px;
  width: 28px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button.active::after {
  bottom: -6px;
  width: 15px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  flex: 0 0 auto;
  gap: 4px;
  margin-left: auto;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done,
body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  border-radius: 10px;
  gap: 2px;
  height: 42px;
  min-height: 42px;
  min-width: 42px;
  padding: 4px 6px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span,
body[data-view="editor"][data-editor-mode="edit"] #homeButton span {
  font-size: 15px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small,
body[data-view="editor"][data-editor-mode="edit"] #homeButton small {
  font-size: 9px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  border-radius: 14px;
  height: 48px;
  min-height: 48px;
  min-width: 48px;
}

body[data-view="editor"][data-editor-mode="edit"] .top-actions {
  grid-column: 3;
  justify-self: end;
}

body[data-view="editor"][data-editor-mode="edit"] .board-toolbar {
  display: none;
}

body[data-view="editor"][data-editor-mode="edit"] .board-panel {
  grid-template-rows: minmax(0, 1fr);
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 60px);
  padding-top: 6px;
}

@media (max-width: 1180px) {
  body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
    max-width: 520px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list {
    max-width: 155px;
  }
}

@media (max-width: 860px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    grid-template-areas:
      "brand actions"
      "commands commands";
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 104px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    grid-area: commands;
    overflow-x: auto;
  }

  body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
    flex: 0 0 auto;
    max-width: none;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 104px);
  }
}

/* Final grid-settings switch style override */
body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"],
body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"] {
  appearance: none;
  background: #dfe3eb;
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(30, 41, 59, 0.04);
  cursor: pointer;
  flex: 0 0 48px;
  height: 28px;
  margin: 0;
  min-height: 28px;
  min-width: 48px;
  padding: 0;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease;
  width: 48px;
}

body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]::before,
body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]::before {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(31, 46, 64, 0.2);
  content: "";
  height: 22px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 0.18s ease;
  width: 22px;
}

body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]:checked,
body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]:checked {
  background: #3b82f6;
}

body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]:checked::before,
body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]:focus-visible,
body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
  outline: none;
}

/* DOCX cleanup pass 2026-07-27 */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 50px;
  padding: 4px 10px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  align-items: center;
  display: flex;
  gap: 10px;
  grid-column: 2;
  justify-content: space-between;
  justify-self: stretch;
  min-width: 0;
  width: 100%;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
  flex: 1 1 auto;
  gap: 5px;
  justify-content: flex-start;
  margin: 0;
  max-width: 760px;
  min-height: 36px;
  padding: 3px 6px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip .editor-back-button,
body[data-view="editor"][data-editor-mode="edit"] .switch-palette-button,
body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button {
  height: 30px;
  min-height: 30px;
  min-width: 30px;
  padding: 0 8px;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster {
  display: inline-flex;
  gap: 4px;
  justify-self: auto;
  left: auto;
  margin: 0;
  position: static;
  top: auto;
  transform: none;
}

body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list,
body[data-view="editor"][data-editor-mode="edit"] .recent-color-list {
  gap: 4px;
  min-height: 30px;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip {
  border-radius: 7px;
  font-size: 10px;
  height: 28px;
  min-width: 28px;
  width: 28px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button {
  border-radius: 999px;
  font-size: 9px;
  height: 26px;
  min-width: 26px;
  width: 26px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button.active::after,
body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip.active::after {
  bottom: -5px;
  height: 2px;
  width: 14px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  background: transparent;
  border: 0;
  box-shadow: none;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
  padding: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  background: transparent;
  border-color: transparent;
  border-radius: 11px;
  box-shadow: none;
  height: 38px;
  min-height: 38px;
  min-width: 38px;
  padding: 3px 6px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button:hover,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button:focus-visible,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button.active,
body[data-view="editor"][data-editor-mode="edit"] #homeButton:hover,
body[data-view="editor"][data-editor-mode="edit"] #homeButton:focus-visible {
  background: #f3f7ff;
  border-color: #dce6f5;
  box-shadow: 0 0 0 2px rgba(52, 120, 238, 0.1);
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  background: #2f6ee8;
  border-color: transparent;
  border-radius: 16px;
  color: #ffffff;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span,
body[data-view="editor"][data-editor-mode="edit"] #homeButton span {
  font-size: 15px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small,
body[data-view="editor"][data-editor-mode="edit"] #homeButton small {
  font-size: 9px;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 52px);
  padding-top: 4px;
}

body[data-view="editor"][data-editor-mode="edit"] .board-panel {
  grid-template-rows: minmax(0, 1fr);
}

body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox {
  align-items: stretch;
  bottom: 18px;
  flex-direction: row;
  gap: 4px;
  left: 50%;
  max-width: calc(100% - 28px);
  padding: 5px;
  right: auto;
  top: auto;
  transform: translateX(-50%);
  width: max-content;
}

body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .tool-button,
body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .brush-size-toggle {
  border-radius: 10px;
  height: 44px;
  min-height: 44px;
  min-width: 48px;
  padding: 3px;
  width: auto;
}

body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .tool-button > span,
body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox .brush-size-toggle > span {
  font-size: 17px;
}

body[data-view="editor"][data-editor-mode="edit"] .floating-toolbox small {
  font-size: 9px;
}

body[data-view="editor"][data-editor-mode="edit"] .toolbox-handle {
  height: 44px;
  min-height: 44px;
  width: 24px;
}

body[data-view="editor"][data-editor-mode="edit"] .brush-size-popover {
  bottom: calc(100% + 10px);
  left: 50%;
  right: auto;
  top: auto;
  transform: translateX(-50%);
}

body[data-view="editor"] .grid-settings-panel,
body[data-view="editor"][data-editor-mode="complete"] .grid-settings-panel {
  border-radius: 15px;
  display: grid;
  height: min(640px, calc(100% - 40px), calc(100dvh - 84px));
  max-height: calc(100dvh - 84px);
  overflow: hidden;
  width: min(560px, calc(100% - 48px));
}

body[data-view="editor"] .grid-settings-panel > header {
  min-height: 46px;
  padding: 8px 14px;
}

body[data-view="editor"] .grid-settings-panel > header h2 {
  font-size: 18px;
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body {
  max-height: none;
  overflow-y: auto;
  padding: 10px 12px;
}

body[data-view="editor"] .grid-settings-panel details {
  border-radius: 12px;
}

body[data-view="editor"] .grid-settings-panel summary {
  min-height: 36px;
  padding: 8px 10px;
}

body[data-view="editor"] .grid-settings-panel .detail-fields {
  gap: 8px;
  padding: 10px;
}

body[data-view="editor"] .grid-settings-panel > footer {
  gap: 8px;
  padding: 8px 12px;
}

body[data-view="editor"] .grid-settings-panel input,
body[data-view="editor"] .grid-settings-panel select,
body[data-view="editor"] .grid-settings-panel button {
  min-height: 32px;
}

body[data-view="editor"] .grid-settings-panel .color-menu,
body[data-view="editor"] .grid-settings-panel .line-control-menu {
  border-radius: 12px;
  gap: 8px;
  padding: 10px;
}

body[data-view="editor"] .grid-settings-panel .color-grid button,
body[data-view="editor"] .grid-settings-panel .line-color-presets button {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  height: 26px;
  min-height: 26px;
  width: 26px;
}

body[data-view="editor"] .line-control-color,
body[data-view="editor"] .line-control-preview,
body[data-view="editor"] .line-control-chevron {
  pointer-events: auto;
}

body[data-view="editor"] .line-control-button {
  grid-template-columns: 44px minmax(90px, 1fr) 28px;
  min-height: 34px;
}

body[data-view="editor"] .line-control-color {
  min-height: 34px;
}

body[data-view="editor"] .line-control-color::before {
  font-size: 18px;
}

body[data-view="editor"] .line-control-color::after {
  bottom: 5px;
  height: 3px;
  width: 24px;
}

body[data-view="editor"] .line-control-menu.mode-color .line-kind-section,
body[data-view="editor"] .line-control-menu.mode-line .line-color-section {
  display: none;
}

body[data-view="editor"] .line-control-menu.mode-color {
  max-width: 250px;
}

body[data-view="editor"] .line-control-menu.mode-line {
  max-width: 330px;
}

body[data-view="editor"] .line-style-options button {
  min-height: 30px;
}

body[data-view="editor"] .line-width-options button,
body[data-view="editor"] .line-width-options input {
  min-height: 30px;
}

/* 面板打开时罩在画布上的点击拦截层。
   图层 / 大小 / 颜色 三个面板要允许继续画画，所以只对网格和镜像生效，
   这份名单必须和 app.js 里的 canvasFriendlyPanels 保持一致。 */
body[data-view="editor"] .canvas-wrap:has(#gridSettingsPanel:not(.is-hidden))::before,
body[data-view="editor"] .canvas-wrap:has(#mirrorPanel:not(.is-hidden))::before {
  background: transparent;
  content: "";
  inset: 0;
  pointer-events: auto;
  position: absolute;
  z-index: 11;
}

body[data-view="editor"] .canvas-wrap:has(.grid-settings-panel:not(.is-hidden))::before {
  background: rgba(20, 28, 36, 0.34);
}

body[data-view="editor"][data-editor-mode="edit"] .board-toolbar {
  display: none !important;
}

body[data-view="editor"][data-editor-mode="edit"] .board-panel {
  grid-template-rows: minmax(0, 1fr) !important;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 48px);
  padding-top: 3px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
  max-width: 920px;
  min-height: 32px;
  overflow: visible;
  padding: 2px 5px 5px;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip .editor-back-button,
body[data-view="editor"][data-editor-mode="edit"] .switch-palette-button,
body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button {
  height: 28px;
  min-height: 28px;
  min-width: 28px;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip {
  height: 28px;
  min-width: 28px;
  width: 28px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button {
  height: 25px;
  min-width: 25px;
  width: 25px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  gap: 6px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  border-radius: 9px;
  height: 34px;
  min-height: 34px;
  min-width: 34px;
  padding: 2px 5px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done {
  border-radius: 14px;
  height: 40px;
  min-height: 40px;
  min-width: 40px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span,
body[data-view="editor"][data-editor-mode="edit"] #homeButton span {
  font-size: 14px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small,
body[data-view="editor"][data-editor-mode="edit"] #homeButton small {
  font-size: 8px;
}

body[data-view="editor"] .grid-settings-panel,
body[data-view="editor"][data-editor-mode="complete"] .grid-settings-panel {
  height: min(680px, calc(100% - 38px), calc(100dvh - 72px));
  max-height: calc(100dvh - 72px);
  width: min(640px, calc(100% - 44px));
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

body[data-view="editor"] .line-control-menu {
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(31, 46, 64, 0.18);
  gap: 8px;
  grid-column: auto;
  justify-self: auto;
  margin: 0;
  padding: 10px;
  position: fixed;
  z-index: 70;
}

body[data-view="editor"] .line-control-menu.mode-color {
  max-width: 252px;
}

body[data-view="editor"] .line-control-menu.mode-line {
  max-width: 304px;
}

body[data-view="editor"] .line-style-options {
  gap: 2px;
  padding-top: 8px;
}

body[data-view="editor"] .line-width-options {
  gap: 5px;
  grid-template-columns: repeat(5, 35px) minmax(64px, 1fr);
  padding-top: 8px;
}

body[data-view="editor"] .line-width-options button,
body[data-view="editor"] .line-width-options input {
  min-height: 28px;
}

body[data-view="editor"] .color-stats-panel {
  height: min(560px, calc(100% - 96px));
  left: auto;
  right: 14px;
  top: 64px;
  transform: none;
  width: min(300px, calc(100% - 28px));
  z-index: 18;
}

body[data-view="editor"] .color-stats-export-footer {
  display: none !important;
}

body[data-view="editor"] .layers-panel {
  height: min(420px, calc(100% - 96px));
  left: auto;
  right: 14px;
  top: 64px;
  transform: none;
  width: min(300px, calc(100% - 28px));
  z-index: 18;
}

body[data-view="editor"] .layers-panel .layer-actions {
  gap: 6px;
  padding: 8px 10px;
}

body[data-view="editor"] .layers-panel .layer-row {
  gap: 6px;
  padding: 8px;
}

body[data-view="editor"] .layers-panel .layer-main {
  gap: 5px;
  grid-template-columns: 18px 18px 34px minmax(70px, 1fr) auto 24px;
}

body[data-view="editor"] .layers-panel .layer-thumbnail {
  height: 34px;
  width: 34px;
}

@media (max-width: 860px) {
  body[data-view="editor"][data-editor-mode="edit"] .topbar {
    min-height: 92px;
  }

  body[data-view="editor"][data-editor-mode="edit"] .workspace {
    height: calc(100dvh - 92px);
  }
}

/* 新建空白画布修改3：layout and interaction cleanup */
body[data-view="editor"] .topbar {
  min-height: 48px;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 48px);
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) auto;
  gap: 12px;
  left: 92px;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
  justify-self: start;
  max-width: min(760px, 100%);
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions {
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 8px;
  justify-self: end;
  padding: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button,
body[data-view="editor"][data-editor-mode="complete"] #homeButton {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #435166;
  display: grid;
  gap: 2px;
  height: 36px;
  min-height: 36px;
  min-width: 36px;
  padding: 2px 7px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button:hover,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button:focus-visible,
body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button.active,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button:hover,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button:focus-visible,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button.active,
body[data-view="editor"][data-editor-mode="complete"] #homeButton:hover,
body[data-view="editor"][data-editor-mode="complete"] #homeButton:focus-visible {
  background: #f3f7ff;
  border-radius: 12px;
  color: #2868df;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar .command-done,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions .active,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button[data-completion-command].active {
  background: #2f6de4;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(47, 109, 228, 0.22);
  color: #ffffff;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar button > span,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions button > span,
body[data-view="editor"][data-editor-mode="complete"] #homeButton span {
  font-size: 16px;
  line-height: 1;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar small,
body[data-view="editor"][data-editor-mode="complete"] .completion-actions small,
body[data-view="editor"][data-editor-mode="complete"] #homeButton small {
  font-size: 10px;
  font-weight: 850;
  line-height: 1.15;
}

body[data-view="editor"][data-editor-mode="edit"] #homeButton {
  display: none !important;
}

body[data-view="editor"][data-editor-mode="complete"] .completion-summary {
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 12px;
  padding: 0;
}

body[data-view="editor"][data-editor-mode="complete"] .completion-mode-copy,
body[data-view="editor"][data-editor-mode="complete"] .completion-size {
  background: transparent;
  border: 0;
  box-shadow: none;
}

body[data-view="editor"] .grid-settings-panel,
body[data-view="editor"][data-editor-mode="complete"] .grid-settings-panel {
  border-radius: 18px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(760px, calc(100% - 32px), calc(100dvh - 64px));
  max-height: calc(100dvh - 64px);
  overflow: visible;
  width: min(660px, calc(100% - 40px));
}

body[data-view="editor"] .grid-settings-panel > header {
  min-height: 54px;
  padding: 10px 16px;
}

body[data-view="editor"] .grid-settings-panel > header h2 {
  font-size: 20px;
  font-weight: 900;
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 14px;
  scrollbar-gutter: stable;
}

body[data-view="editor"] .grid-settings-panel details {
  border-radius: 13px;
  overflow: visible;
}

body[data-view="editor"] .grid-settings-panel summary {
  font-size: 15px;
  min-height: 40px;
  padding: 9px 12px;
}

body[data-view="editor"] .grid-settings-panel .detail-fields {
  gap: 10px;
  padding: 12px;
}

body[data-view="editor"] .grid-settings-panel .detail-fields > p {
  font-size: 11px;
}

body[data-view="editor"] .grid-settings-panel .background-field,
body[data-view="editor"] .grid-settings-panel .color-field,
body[data-view="editor"] .grid-settings-panel .inline-fields > label,
body[data-view="editor"] .grid-settings-panel .line-setting-row > span,
body[data-view="editor"] .grid-settings-panel .grid-line-row > strong,
body[data-view="editor"] .grid-settings-panel .grid-line-row > span,
body[data-view="editor"] .grid-settings-panel .grid-line-row > label {
  color: #687486;
  font-size: 12px;
  font-weight: 800;
}

body[data-view="editor"] .grid-settings-panel input[type="checkbox"] {
  appearance: none;
  background: #d9dde5;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  height: 28px;
  min-height: 28px;
  position: relative;
  width: 52px;
}

body[data-view="editor"] .grid-settings-panel input[type="checkbox"]::before {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(26, 34, 45, 0.16);
  content: "";
  height: 24px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 140ms ease;
  width: 24px;
}

body[data-view="editor"] .grid-settings-panel input[type="checkbox"]:checked {
  background: #3b82f6;
}

body[data-view="editor"] .grid-settings-panel input[type="checkbox"]:checked::before {
  transform: translateX(24px);
}

body[data-view="editor"] .grid-settings-panel .background-field {
  grid-template-columns: minmax(90px, 1fr) auto;
}

body[data-view="editor"] .background-color-menu {
  max-width: calc(100% - 24px);
  right: 0;
  top: calc(100% + 8px);
  width: 292px;
  z-index: 90;
}

body[data-view="editor"] .line-setting-row.unified-line-row {
  grid-template-columns: minmax(96px, 1fr) minmax(220px, 304px);
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row {
  grid-template-columns: 72px minmax(128px, 1fr) minmax(220px, 304px);
  min-height: 46px;
}

body[data-view="editor"] .line-control-button {
  grid-template-columns: 54px minmax(110px, 1fr) 34px;
  min-height: 38px;
}

body[data-view="editor"] .line-control-color {
  min-height: 38px;
}

body[data-view="editor"] .line-control-menu {
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(31, 46, 64, 0.2);
  gap: 9px;
  margin: 0;
  padding: 10px;
  position: absolute;
  z-index: 95;
}

body[data-view="editor"] .line-control-menu.mode-color {
  max-width: 252px;
}

body[data-view="editor"] .line-control-menu.mode-line {
  max-width: 304px;
}

body[data-view="editor"] .grid-settings-panel > footer {
  padding: 10px 14px;
}

body[data-view="projects"] .projects-shell,
body[data-view="projects"] .project-collection,
body[data-view="projects"] .projects-view {
  overflow: visible;
}

body[data-view="projects"] .projects-toolbar {
  gap: 16px;
}

/* Anchored grid popovers: the trigger owns the placement, while this layer
   keeps menus above the settings scroll area and the dialog footer. */
body[data-view="editor"] > .anchored-popup {
  box-sizing: border-box;
  bottom: auto;
  left: 0;
  margin: 0;
  max-height: min(420px, calc(100dvh - 16px));
  max-width: calc(100vw - 16px);
  overflow: auto;
  position: fixed !important;
  right: auto;
  top: 0;
  transform: none;
  z-index: 120;
}

body[data-view="editor"] > .anchored-popup.background-color-menu {
  width: 292px;
}

body[data-view="editor"] > .anchored-popup.line-control-menu {
  width: 304px;
}

body[data-view="editor"] > .anchored-popup.line-control-menu.mode-color {
  width: 252px;
}

body[data-view="editor"] > .anchored-popup.line-control-menu.mode-color .line-kind-section,
body[data-view="editor"] > .anchored-popup.line-control-menu.mode-line .line-color-section {
  display: none;
}

body[data-view="projects"] .projects-controls {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  grid-template-columns: minmax(180px, 320px) auto auto;
}

body[data-view="projects"] .project-view-toggle {
  display: none;
}

body[data-view="projects"] .project-search {
  display: grid;
  flex: initial;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
}

body[data-view="projects"] .project-search input {
  order: 1;
  text-align: left;
}

body[data-view="projects"] .project-search span {
  order: 2;
  transform: scaleX(-1);
}

body[data-view="projects"] .project-card-menu {
  overflow: visible;
  z-index: 120;
}

body[data-view="projects"] .project-card-menu button {
  min-height: 34px;
}

.folder-card {
  min-height: 238px;
}

.folder-menu-button {
  position: absolute;
  right: 9px;
  top: 9px;
  z-index: 5;
}

.folder-open-button {
  align-content: center;
  background: #ffffff;
  border: 0;
  border-radius: 8px;
  color: #24302e;
  display: grid;
  gap: 10px;
  height: 100%;
  justify-items: center;
  padding: 22px 14px;
  text-align: center;
  width: 100%;
}

.folder-open-button:hover {
  background: #f7faf8;
}

.folder-glyph {
  align-items: center;
  background: #fbf0df;
  border-radius: 18px;
  color: #cc7400;
  display: flex;
  font-size: 34px;
  font-weight: 900;
  height: 74px;
  justify-content: center;
  width: 74px;
}

.folder-open-button strong {
  font-size: 15px;
  font-weight: 900;
}

.folder-open-button small {
  color: #7a8582;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 900px) {
  body[data-view="editor"][data-editor-mode="edit"] .editor-center {
    grid-template-columns: 1fr;
    left: 86px;
  }

  body[data-view="projects"] .projects-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  body[data-view="projects"] .projects-controls {
    grid-template-columns: 1fr;
  }
}

/* Final editor visibility guard: keep the compressed header fully inside the viewport. */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  align-items: center;
  min-height: 72px;
  overflow: visible;
  padding-bottom: 6px;
  padding-top: 6px;
}

body[data-view="editor"][data-editor-mode="edit"] .workspace {
  height: calc(100dvh - 72px);
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-column: 2;
  grid-template-columns: minmax(520px, 1fr) auto;
  justify-self: stretch;
  left: auto;
  min-width: 0;
  overflow: visible;
  position: static;
  right: auto;
  top: auto;
  transform: none;
  width: 100%;
}

body[data-view="editor"][data-editor-mode="edit"] .editor-palette-strip {
  flex: initial;
  max-width: min(720px, 100%);
  min-height: 44px;
  overflow: visible;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  justify-self: end;
}

body[data-view="editor"][data-editor-mode="edit"] .board-panel {
  min-height: 0;
  overflow: hidden;
}

body[data-view="editor"][data-editor-mode="edit"] .pattern-stage {
  height: 100%;
}

/* Keep the active color marker distinct from the chip border. */
body[data-view="editor"][data-editor-mode="edit"] .palette-quick-list {
  height: 28px;
  min-height: 28px;
  overflow: visible;
  padding-bottom: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip,
body[data-view="editor"][data-editor-mode="edit"] .recent-color-button {
  margin-bottom: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-list {
  height: 28px;
  min-height: 28px;
  padding-bottom: 0;
}

body[data-view="editor"][data-editor-mode="edit"] .inline-recent-colors {
  min-height: 28px;
}

body[data-view="editor"][data-editor-mode="edit"] .quick-palette-chip.active::after {
  bottom: -10px;
}

body[data-view="editor"][data-editor-mode="edit"] .recent-color-button.active::after {
  bottom: -9px;
}

/* Layer panel: mirror the compact active/collapsed layer workflow. */
body[data-view="editor"] .layers-panel {
  height: auto;
  max-height: min(620px, calc(100% - 28px));
  right: 14px;
  top: 14px;
  width: min(560px, calc(100% - 28px));
}

body[data-view="editor"] .layers-panel .layer-list {
  align-content: start;
  max-height: min(430px, calc(100dvh - 210px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 14px 14px;
  scrollbar-gutter: stable;
}

body[data-view="editor"] .editor-detail-panel.layers-panel {
  grid-template-rows: auto auto auto;
}

body[data-view="editor"] .layers-panel .layer-actions {
  gap: 8px;
  padding: 10px 14px;
}

body[data-view="editor"] .layers-panel .layer-main {
  grid-template-columns: 22px 18px 22px 42px minmax(120px, 1fr) auto 32px;
}

body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-main {
  grid-template-columns: 22px 18px 22px 36px minmax(120px, 1fr) auto 32px;
}

.layer-project-dialog {
  background: transparent;
  border: 0;
  padding: 0;
  width: min(520px, calc(100vw - 28px));
}

.layer-project-dialog::backdrop {
  background: rgba(24, 31, 34, 0.48);
  backdrop-filter: blur(2px);
}

.layer-project-card {
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  box-shadow: 0 20px 54px rgba(31, 46, 64, 0.24);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(620px, calc(100dvh - 40px));
  overflow: hidden;
}

.layer-project-card > header {
  align-items: center;
  border-bottom: 1px solid #e2e7ee;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 18px;
}

.layer-project-card > header div {
  display: grid;
  gap: 3px;
}

.layer-project-card > header span {
  color: #7a8696;
  font-size: 10px;
  font-weight: 850;
}

.layer-project-card h2 {
  color: #1e2735;
  font-size: 20px;
  margin: 0;
}

.layer-project-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 14px;
}

.layer-project-item {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  color: #1e2735;
  display: grid;
  gap: 12px;
  grid-template-columns: 84px minmax(0, 1fr) 18px;
  min-height: 72px;
  padding: 8px 10px;
  text-align: left;
}

.layer-project-item:hover,
.layer-project-item:focus-visible {
  border-color: #4c8af1;
  box-shadow: 0 0 0 2px rgba(76, 138, 241, 0.14);
}

.layer-project-thumbnail {
  background: #f7f9fb;
  border: 1px solid #e1e7ef;
  border-radius: 5px;
  image-rendering: pixelated;
  height: 56px;
  width: 84px;
}

.layer-project-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.layer-project-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-project-copy small {
  color: #7a8696;
  font-size: 11px;
  font-weight: 750;
}

.layer-project-item > span:last-child::after {
  color: #8b98a8;
  content: "›";
  font-size: 24px;
}

.layer-project-empty {
  color: #7a8696;
  margin: 28px 8px;
  text-align: center;
}

@media (max-width: 620px) {
  body[data-view="editor"] .layers-panel {
    height: auto;
    max-height: calc(100% - 18px);
    right: 9px;
    top: 9px;
    width: calc(100% - 18px);
  }

  body[data-view="editor"] .layers-panel .layer-list {
    max-height: min(430px, calc(100dvh - 190px));
  }

  body[data-view="editor"] .layers-panel .layer-main,
  body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-main {
    gap: 5px;
    grid-template-columns: 18px 15px 20px 34px minmax(70px, 1fr) auto 24px;
  }

  body[data-view="editor"] .layers-panel .layer-thumbnail,
  body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-thumbnail {
    height: 34px;
    width: 34px;
  }

  .layer-project-item {
    grid-template-columns: 72px minmax(0, 1fr) 16px;
  }

  .layer-project-thumbnail {
    height: 48px;
    width: 72px;
  }
}

/* Compact layer panel: keep the workflow intact while shrinking the floating panel. */
body[data-view="editor"] .layers-panel {
  border-radius: 8px;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: auto;
  max-height: min(340px, calc(100% - 28px));
  right: 14px;
  top: 14px;
  width: min(300px, calc(100% - 28px));
}

body[data-view="editor"] .layers-panel > header {
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px;
}

body[data-view="editor"] .layers-panel > header h2 {
  font-size: 20px;
  line-height: 1.15;
}

body[data-view="editor"] .layers-panel > header > button:last-child {
  font-size: 24px;
  min-height: 28px;
  width: 28px;
}

body[data-view="editor"] .layers-panel .panel-pin {
  font-size: 11px;
  min-height: 28px;
  padding: 4px 6px;
}

body[data-view="editor"] .layers-panel .layer-actions {
  gap: 6px;
  padding: 8px 10px;
}

body[data-view="editor"] .layers-panel .layer-actions button {
  font-size: 12px;
  min-height: 30px;
  padding: 4px 6px;
}

/* 多选时可见的是「合并图层 / 删除 / 取消」三个，原来写死 2 列会挤到第二行 */
body[data-view="editor"] .layers-panel.layer-multi-mode .layer-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-view="editor"] .layers-panel.layer-multi-mode .layer-import-wrap,
body[data-view="editor"] .layers-panel.layer-multi-mode #layerNewButton {
  display: none;
}

body[data-view="editor"] .layers-panel .layer-merge-button {
  background: #3478ee;
  border-color: #3478ee;
  color: #ffffff;
}

body[data-view="editor"] .layers-panel .layer-merge-button:hover,
body[data-view="editor"] .layers-panel .layer-merge-button:focus-visible {
  background: #2868df;
  border-color: #2868df;
}

body[data-view="editor"] .layers-panel.layer-multi-mode #layerMultiButton {
  background: #ffffff;
  border-color: #d7dfe9;
  color: #2868df;
}

body[data-view="editor"] .layers-panel .layer-list {
  gap: 6px;
  max-height: min(224px, calc(100dvh - 190px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 10px 10px;
}

body[data-view="editor"] .layers-panel .layer-row {
  border-radius: 7px;
  gap: 6px;
  padding: 8px;
}

body[data-view="editor"] .layers-panel .layer-main,
body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-main {
  gap: 4px;
  grid-template-columns: 22px 12px 18px 30px minmax(0, 1fr) auto 22px;
}

body[data-view="editor"] .layers-panel .layer-main > span:first-child {
  font-size: 14px;
  font-weight: 850;
}

body[data-view="editor"] .layers-panel .layer-drag-handle {
  font-size: 15px;
}

body[data-view="editor"] .layers-panel .layer-main button,
body[data-view="editor"] .layers-panel .layer-controls button {
  font-size: 12px;
  min-height: 24px;
  padding: 2px;
}

body[data-view="editor"] .layers-panel .layer-select-toggle {
  align-items: center;
  background: #ffffff;
  border: 1px solid #9aa7b7;
  border-radius: 3px;
  color: #ffffff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  justify-self: center;
  min-height: 0;
  padding: 0;
  width: 18px;
}

body[data-view="editor"] .layers-panel .layer-select-toggle.selected {
  background: #3478ee;
  border-color: #3478ee;
}

body[data-view="editor"] .layers-panel .layer-thumbnail,
body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-thumbnail {
  border-radius: 5px;
  height: 30px;
  width: 30px;
}

body[data-view="editor"] .layers-panel .layer-name-input {
  font-size: 14px;
  min-height: 26px;
  min-width: 0;
  padding: 2px;
}

body[data-view="editor"] .layers-panel .layer-type {
  border-radius: 5px;
  font-size: 8px;
  letter-spacing: 0;
  padding: 4px 6px;
}

body[data-view="editor"] .layers-panel .layer-controls {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr repeat(4, auto);
  padding-top: 7px;
}

body[data-view="editor"] .layers-panel .layer-controls label {
  font-size: 11px;
  gap: 5px;
  grid-column: 1 / -1;
  min-width: 0;
}

body[data-view="editor"] .layers-panel .layer-controls input[type="range"] {
  min-width: 78px;
}

body[data-view="editor"] .layers-panel .layer-controls b {
  font-size: 11px;
  min-width: 32px;
}

body[data-view="editor"] .layers-panel .layer-row:not(.active) {
  gap: 0;
  padding-bottom: 6px;
  padding-top: 6px;
}

body[data-view="editor"] .layers-panel .layer-row:not(.active) .layer-controls {
  display: none;
}

@media (max-width: 620px) {
  body[data-view="editor"] .layers-panel {
    max-height: min(340px, calc(100% - 18px));
    width: min(300px, calc(100% - 18px));
  }
}

/* Header zoom controls live immediately before the editor command group. */
body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls {
  align-items: center;
  align-self: center;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #dfe6e3;
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0;
  height: 36px;
  justify-content: center;
  margin-left: 0;
  overflow: hidden;
}

body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: #435166;
  display: flex;
  font-size: 18px;
  font-weight: 850;
  height: 36px;
  justify-content: center;
  min-height: 36px;
  padding: 0;
  width: 36px;
}

body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls button:hover,
body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls button:focus-visible {
  background: #f3f7ff;
  color: #2868df;
}

body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls span {
  align-items: center;
  border-left: 1px solid #e3e9ee;
  border-right: 1px solid #e3e9ee;
  color: #435166;
  display: flex;
  font-size: 11px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  min-width: 46px;
  padding: 0 8px;
  white-space: nowrap;
}

body[data-view="editor"]:not([data-editor-mode="edit"]) .top-zoom-controls,
body:not([data-view="editor"]) .top-zoom-controls {
  display: none;
}

@media (max-width: 1180px) {
  body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls span {
    min-width: 40px;
    padding: 0 6px;
  }
}

@media (max-width: 860px) {
  body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls {
    margin-left: 0;
  }
}

body[data-view="editor"][data-editor-mode="edit"] .editor-center {
  grid-template-columns: minmax(420px, 1fr) auto auto;
}

body[data-view="editor"][data-editor-mode="edit"] .top-zoom-controls {
  grid-column: 2;
  justify-self: end;
}

body[data-view="editor"][data-editor-mode="edit"] .header-command-bar {
  grid-column: 3;
  justify-self: end;
}

/* Keep the blank-canvas editor brand aligned with the setup pages. */
body[data-view="editor"][data-editor-mode="edit"] .topbar {
  padding-left: 22px;
}

body[data-view="editor"][data-editor-mode="edit"] .brand-button {
  min-width: 116px;
  transform: translateY(5px);
  width: 116px;
}

body[data-view="setup"][data-module="style"] .topbar,
body[data-view="setup"][data-module="direct"] .topbar {
  gap: 24px;
  justify-content: flex-start;
  min-height: 72px;
  padding: 7px 42px;
}

body[data-view="setup"][data-module="direct"] .topbar {
  padding-right: 330px;
}

body[data-view="setup"][data-module="style"] .brand-button,
body[data-view="setup"][data-module="direct"] .brand-button {
  flex: 0 0 auto;
  min-width: 136px;
  transform: none;
  width: auto;
}

body[data-view="setup"][data-module="style"] .direct-header-title,
body[data-view="setup"][data-module="direct"] .direct-header-title {
  color: #2f73df;
  flex: 0 1 auto;
  font-size: 28px;
  font-weight: 950;
  line-height: 1.15;
  margin-left: 10px;
  white-space: nowrap;
}

body[data-view="setup"][data-module="style"] .setup-header-hint {
  color: #68726f;
  flex: 1 1 auto;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  margin-left: 2px;
  min-width: 240px;
}

body[data-view="setup"][data-module="style"] .top-actions {
  margin-left: auto;
}

@media (max-width: 900px) {
  body[data-view="setup"][data-module="style"] .topbar,
  body[data-view="setup"][data-module="direct"] .topbar {
    gap: 12px;
    padding: 7px 16px;
  }

  body[data-view="setup"][data-module="direct"] .topbar {
    align-content: flex-start;
    flex-wrap: wrap;
    min-height: 72px;
  }

  body[data-view="setup"][data-module="style"] .direct-header-title,
  body[data-view="setup"][data-module="direct"] .direct-header-title {
    flex: 0 1 auto;
    font-size: 22px;
    margin-left: 0;
    order: 2;
  }

  body[data-view="setup"][data-module="direct"] .direct-credit-balance {
    order: 3;
  }

  body[data-view="setup"][data-module="direct"] .brand-button {
    flex-basis: 100%;
    order: 1;
  }

  body[data-view="setup"][data-module="style"] .setup-header-hint {
    flex-basis: 100%;
    font-size: 13px;
    min-width: 0;
  }

  body[data-view="setup"][data-module="style"] .setup-layout {
    align-content: start;
    display: block;
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body[data-view="setup"][data-module="style"] .source-card {
    height: auto;
    margin-bottom: 12px;
  }

  body[data-view="setup"][data-module="style"] .source-stage {
    height: auto;
    min-height: min(420px, calc(100dvh - 220px));
  }

  body[data-view="setup"][data-module="style"] .setup-panel {
    max-height: none;
  }
}

@media (max-width: 900px) {
  body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active {
    padding: 12px 16px;
  }

  body[data-view="setup"][data-module="direct"] .direct-setup-active .direct-stepper {
    left: auto;
    margin-left: -16px;
    margin-right: -16px;
    position: static;
    top: auto;
    width: calc(100% + 32px);
  }

  body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage:not(.is-hidden) {
    align-content: start;
    grid-template-columns: 1fr;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage:not(.is-hidden) > .direct-main-panel,
  body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage:not(.is-hidden) > .direct-side-panel {
    height: auto;
  }

  body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage:not([data-direct-panel="proof"]):not(.direct-finish-stage) > .direct-main-panel {
    min-height: min(560px, calc(100dvh - 180px));
  }
}


/* ---- 对齐页：图纸尺寸 / 分轴缩放 / 色块预览 ---- */

.direct-compact-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.direct-tool-note {
  color: #6b7686;
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
}

.direct-size-fields {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.direct-size-fields label {
  align-items: center;
  background: #f4f7fb;
  border: 1px solid #dde6f2;
  border-radius: 6px;
  color: #5d6878;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 4px;
  padding: 4px 6px;
}

.direct-size-fields input {
  background: transparent;
  border: 0;
  color: #1f2a37;
  font: inherit;
  font-weight: 900;
  min-width: 0;
  padding: 2px 0;
  width: 100%;
}

.direct-size-fields input:focus {
  outline: 2px solid #2f73df;
  outline-offset: 1px;
}

.direct-pattern-size-card .direct-board-sizes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Edge growth. Every other size control on this panel re-fits the grid to a
   rectangle and recomputes the cell, which is right when the detected pitch was
   wrong but destroys a pitch that is already correct. These add whole cells at
   the pitch that is there. */
/* 顶部的「图纸有多少格」——它不属于任何阶段，是使用者带进来的一个事实，
   两个阶段都消费它，所以常驻在最上面并稍作强调。 */
.direct-chart-size-card {
  border-color: #c9dcfb;
}

.direct-chart-size-card .direct-size-fields input {
  font-size: 15px;
}

/* 色块预览浮在画布右上角。它是拿来和图纸比对的，放在侧栏意味着每次比对
   都要横穿整个屏幕；贴在图纸边上，比对就只是一次短扫视。 */
.direct-tile-hud {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d7e2f0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 6px;
  padding: 8px;
  position: absolute;
  right: 10px;
  top: 10px;
  transition: opacity 140ms ease;
  width: 186px;
  z-index: 4;
}

/* 拖动画布或网格时让开，别挡住正在看的地方 */
.direct-align-viewport.is-panning ~ .direct-tile-hud,
.direct-align-viewport.is-aligning ~ .direct-tile-hud {
  opacity: 0.25;
}

.direct-tile-hud:hover {
  opacity: 1;
}

.direct-tile-hud-head {
  align-items: baseline;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.direct-tile-hud-head span {
  color: #2f73df;
  font-size: 11px;
  font-weight: 900;
}

.direct-tile-hud .direct-tile-preview {
  aspect-ratio: 1;
}

.direct-tile-hud-toggle {
  font-size: 11px;
}

.direct-tile-hud-toggle input {
  height: 13px;
  width: 13px;
}

.direct-tile-hud .direct-coverage-hint {
  font-size: 10px;
  padding: 4px 6px;
}

/* 按钮紧贴它的输入框，占满整行——两者的从属关系靠位置表达，不靠文字说明。 */
.direct-size-apply {
  width: 100%;
}

/* 阶段小标题：把一张卡片内的若干段落分开 */
.direct-phase-sub {
  align-items: baseline;
  border-top: 1px solid #eef3f9;
  color: #6b7686;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 6px;
}

.direct-phase-sub:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.direct-phase-sub b {
  color: #1f2a37;
  font-size: 13px;
  font-weight: 900;
}

/* 闸门。它现在是「网格范围」卡片的首行——一个组的标题式开关，勾上才启用
   下面的内容，是设置面板里最常见的写法。放在「单格格距」组的末行则相反：
   控件把自己所在的组关掉，读起来是拧的。 */
.direct-pitch-gate {
  align-items: flex-start;
  background: #eef4ff;
  border: 1px solid #c9dcfb;
  border-radius: 8px;
  cursor: pointer;
  gap: 8px;
  margin-bottom: 2px;
  padding: 8px 9px;
}

.direct-pitch-gate:has(input:checked) {
  background: #e6f6ec;
  border-color: #b4e0c4;
}

.direct-pitch-gate input {
  margin-top: 1px;
}

.direct-pitch-gate-text {
  display: grid;
  gap: 2px;
}

.direct-pitch-gate-text b {
  color: #1f2a37;
  font-size: 12px;
  font-weight: 900;
}

.direct-pitch-gate-text em {
  color: #6b7686;
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

/* 未锁定时只压暗加格控件。标题、格数读数、以及闸门那一行都保持全对比度——
   闸门是这张卡片上唯一需要用户注意的东西，压暗它等于把入口藏起来。 */
.direct-tool-card.is-locked-off .direct-grow-pad {
  opacity: 0.5;
  pointer-events: none;
}

/* 「应用」和宽高同行，占最右一列——按钮和它的输入框在一条线上，
   原来按钮独占一行，高度那一格右边还空出一块。 */
.direct-apply-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.direct-apply-row .direct-size-apply {
  padding: 0 16px;
  width: auto;
}

/* 格距的 ＋－ 和两个输入框同行，上下堆叠占最右一窄列——
   原来 ＋－ 单独占一行，右边空出一块，两个数字框也被挤窄。 */
.direct-pitch-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.direct-pitch-step {
  display: grid;
  gap: 3px;
  grid-template-rows: 1fr 1fr;
}

.direct-pitch-step button {
  line-height: 1;
  min-height: 0;
  padding: 0 10px;
}

/* 锁定后第一阶段收成这一条。点它就是解锁并展开。 */
.direct-aligned-summary {
  align-items: center;
  background: #e6f6ec;
  border: 1px solid #b4e0c4;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  padding: 10px 11px;
  text-align: left;
  width: 100%;
}

.direct-aligned-summary.is-hidden {
  display: none;
}

.direct-aligned-summary:hover {
  border-color: #8ecfa8;
}

.direct-aligned-summary-main {
  color: #16794a;
  font-size: 12px;
  font-weight: 900;
}

.direct-aligned-summary-sub {
  color: #5a7a68;
  flex: 1;
  font-size: 11px;
  font-weight: 700;
}

.direct-aligned-summary-sub b {
  color: #16794a;
  font-weight: 900;
}

.direct-aligned-summary-caret {
  color: #16794a;
  font-size: 13px;
  font-weight: 900;
}

/* 按钮紧贴它的输入框，占满整行——两者的从属关系靠位置表达，不靠文字说明。 */
.direct-size-apply {
  width: 100%;
}

/* 阶段小标题：把一张卡片内的若干段落分开 */
.direct-phase-sub {
  align-items: baseline;
  border-top: 1px solid #eef3f9;
  color: #6b7686;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 6px;
}

.direct-phase-sub:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.direct-phase-sub b {
  color: #1f2a37;
  font-size: 13px;
  font-weight: 900;
}

/* 闸门：两个阶段之间的分隔条，本身就是那个开关 */
.direct-pitch-gate {
  align-items: center;
  background: #eef4ff;
  border: 1px solid #c9dcfb;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 9px 10px;
}

.direct-pitch-gate:has(input:checked) {
  background: #e6f6ec;
  border-color: #b4e0c4;
}

.direct-pitch-gate input {
  accent-color: #2f73df;
  height: 16px;
  width: 16px;
}

.direct-pitch-gate-text {
  display: grid;
  gap: 2px;
}

.direct-pitch-gate-text b {
  color: #1f2a37;
  font-size: 12px;
  font-weight: 900;
}

.direct-pitch-gate-text em {
  color: #6b7686;
  font-size: 11px;
  font-style: normal;
  line-height: 1.4;
}

.direct-grow-pad {
  background: #f8fafc;
  border: 1px solid #dde6f2;
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-areas:
    "top top top"
    "left center right"
    "bottom bottom bottom";
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  padding: 8px;
}

.direct-grow-pad.is-hidden {
  display: none;
}

.direct-grow-row {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e3eaf4;
  border-radius: 7px;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  min-height: 34px;
  padding: 4px 5px 4px 8px;
}

.direct-grow-top {
  grid-area: top;
  justify-self: center;
  max-width: 100%;
  width: 118px;
}

.direct-grow-left {
  grid-area: left;
}

.direct-grow-right {
  grid-area: right;
}

.direct-grow-bottom {
  grid-area: bottom;
  justify-self: center;
  max-width: 100%;
  width: 118px;
}

.direct-grow-row > span {
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  min-width: 25px;
  text-align: left;
}

.direct-grow-stepper {
  background: #eef2f7;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(2, 24px);
  overflow: hidden;
}

.direct-grow-row .direct-grow-stepper {
  min-width: 49px;
}

.direct-grow-stepper .direct-icon-button {
  background: #ffffff;
  border: 0;
  border-radius: 0;
  color: #2f73df;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  min-height: 24px;
  padding: 0;
}

.direct-grow-stepper .direct-icon-button:hover {
  background: #eff6ff;
}

.direct-grow-stepper .direct-icon-button:disabled {
  background: #f8fafc;
  color: #c2c9d2;
}

.direct-grow-center {
  align-items: center;
  background: #ffffff;
  border: 1px dashed #cdd8e7;
  border-radius: 7px;
  color: #94a3b8;
  display: grid;
  grid-area: center;
  justify-items: center;
  min-height: 44px;
}

.direct-grow-center span,
.direct-grow-center b {
  font-size: 10px;
  line-height: 1.15;
}

.direct-grow-center b {
  color: #64748b;
  font-size: 12px;
  font-weight: 950;
}

@media (max-width: 520px) {
  .direct-grow-pad {
    grid-template-areas:
      "top top"
      "left right"
      "bottom bottom";
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .direct-grow-center {
    display: none;
  }
}

.direct-axis-zoom-row {
  align-items: center;
  display: grid;
  gap: 4px;
  grid-template-columns: auto 1fr 1fr auto 1fr 1fr;
}

.direct-axis-zoom-row > span {
  color: #5d6878;
  font-size: 11px;
  font-weight: 850;
}

.direct-tile-preview {
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%),
    linear-gradient(45deg, #eef2f7 25%, #ffffff 25%, #ffffff 75%, #eef2f7 75%);
  background-position: 0 0, 6px 6px;
  background-size: 12px 12px;
  border: 1px solid #dde6f2;
  border-radius: 6px;
  display: grid;
  min-height: 0;
  overflow: hidden;
  place-items: center;
}

.direct-tile-preview canvas {
  display: block;
  height: 132px;
  width: 100%;
}

.direct-tile-preview.is-hidden {
  display: none;
}

/* Amber corner dot on cells the colour match and the OCR disagreed about, or
   where two palette colours were nearly equidistant. ::before is used because
   .direct-proof-cell.selected already owns ::after for the check mark. */
.direct-proof-cell.uncertain::before {
  background: #f59e0b;
  border: 1px solid #ffffff;
  border-radius: 50%;
  content: "";
  height: 7px;
  left: 2px;
  position: absolute;
  top: 2px;
  width: 7px;
  z-index: 1;
}

.direct-coverage-hint {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  color: #9a3412;
  font-size: 11px;
  line-height: 1.5;
  margin: 0;
  padding: 6px 8px;
}

.direct-coverage-hint.is-hidden {
  display: none;
}

/* ── 会员与签到 ───────────────────────────────────────────────── */

/* 优先级要压过 .dropdown-menu button——那条规则把菜单里的每个按钮都排成
   min-height 62px、宽度 100% 的菜单项，签到这种行内小标签会被撑成一个大方块。 */
.account-menu .account-profile-meta .account-checkin-link {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  gap: 0;
  justify-items: center;
  min-height: 0;
  padding: 3px 10px;
  text-align: center;
  width: auto;
}

.account-menu .account-profile-meta .account-checkin-link:hover {
  background: rgba(255, 255, 255, 0.26);
}

.account-menu .account-profile-meta .account-checkin-link:disabled {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
  cursor: default;
}

.account-checkin-link:disabled {
  background: #f1f3f6;
  border-color: #e2e6ec;
  color: #9aa3af;
  cursor: default;
}

.checkin-dialog {
  background: transparent;
  border: 0;
  max-width: min(520px, calc(100vw - 32px));
  padding: 0;
  width: 100%;
}

.checkin-success-dialog {
  background: transparent;
  border: 0;
  max-width: min(420px, calc(100vw - 32px));
  padding: 0;
}

.checkin-dialog::backdrop,
.checkin-success-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.checkin-card {
  background: #ffffff;
  border-radius: 18px;
  display: grid;
  gap: 16px;
  overflow: hidden;
  padding: 28px 28px 26px;
  position: relative;
  text-align: center;
}

.checkin-ribbon {
  display: none;
}

.checkin-close {
  position: absolute;
  right: 10px;
  top: 14px;
}

.checkin-card h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 6px 0 0;
}

.checkin-reward {
  background: #fff7e6;
  border-radius: 999px;
  color: #a8630a;
  font-size: 14px;
  font-weight: 800;
  justify-self: center;
  margin: 0;
  padding: 7px 16px;
}

.checkin-reward b {
  font-weight: 900;
}

.checkin-calendar {
  border: 1px solid #e6ecf4;
  border-radius: 14px;
  display: grid;
  gap: 12px;
  padding: 20px 16px;
}

.checkin-month {
  font-size: 17px;
  font-weight: 900;
}

.checkin-weekdays,
.checkin-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.checkin-weekdays span {
  color: #9aa3af;
  font-size: 12px;
  font-weight: 800;
}

.checkin-day {
  align-items: center;
  aspect-ratio: 1;
  border-radius: 12px;
  color: #46566b;
  display: flex;
  font-size: 15px;
  font-weight: 800;
  justify-content: center;
}

.checkin-day.is-empty {
  visibility: hidden;
}

.checkin-day.is-done {
  background: linear-gradient(160deg, #3f7ff5, #2f5fe0);
  color: #ffffff;
}

.checkin-day.is-today {
  box-shadow: 0 0 0 2px #9dc0ff;
}

.checkin-submit {
  background: #2f73df;
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  padding: 14px;
}

.checkin-submit:disabled {
  background: #f1f3f6;
  color: #9aa3af;
  cursor: default;
}

/* 「今日不再提醒」是这张卡里唯一的次要开关，靠左下角放——弹窗里左下角
   历来就是「不再显示 / 记住我」这类选项的位置，一眼能看出它不是主按钮。 */
.checkin-hide-row {
  align-items: center;
  color: #6b7686;
  display: flex;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  justify-content: flex-start;
  justify-self: start;
  margin-top: -6px;
}

.checkin-hide-row input {
  height: 16px;
  width: 16px;
}

.checkin-success-card {
  background: #ffffff;
  border-radius: 18px;
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 34px 28px 24px;
  text-align: center;
}

.checkin-success-mark {
  align-items: center;
  background: #e9f8ef;
  border: 3px solid #22a45d;
  border-radius: 50%;
  color: #22a45d;
  display: flex;
  font-size: 40px;
  font-weight: 900;
  height: 88px;
  justify-content: center;
  width: 88px;
}

.checkin-success-card h2 {
  font-size: 26px;
  font-weight: 900;
  margin: 6px 0 0;
}

.checkin-success-card p {
  color: #6b7686;
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.checkin-success-button {
  background: #2f73df;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 900;
  margin-top: 8px;
  padding: 15px;
  width: 100%;
}

.direct-credit-balance {
  background: #fff7e6;
  border: 1px solid #f3ddb0;
  border-radius: 999px;
  color: #a8630a;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 11px;
  white-space: nowrap;
}

/* 会员专属工具：保留在工具栏里但标记出来，点击会说明为什么用不了。 */
.tool-button.is-member-locked {
  opacity: 0.55;
  position: relative;
}

.tool-button.is-member-locked::after {
  content: "🔒";
  font-size: 9px;
  position: absolute;
  right: 2px;
  top: 2px;
}

/* 价签：跟在按钮文字后面，压小减淡。按钮上最该被读到的是动作本身。 */
.button-cost-tag {
  font-size: 0.78em;
  font-weight: 700;
  margin-left: 5px;
  opacity: 0.72;
}


/* 选区相关的浮层堆在底部工具坞上方，而不是压在画布顶部。
   它们讲的都是「你刚选中了什么、能对它做什么」，压在选区上会挡住用户正要看的
   东西——尤其选区靠近画布顶部时，三层浮层会把它盖得一点不剩。
   竖向栈按 DOM 顺序自上而下：摘要、操作条、扩展容差，容差最贴近工具坞。 */
.canvas-bottom-stack {
  align-items: center;
  bottom: 104px;
  display: flex;
  /* DOM 顺序是「离工具坞由近到远」：贴上方时倒序渲染，贴下方时正序 */
  flex-direction: column-reverse;
  gap: 8px;
  left: 50%;
  max-width: calc(100% - 28px);
  pointer-events: none;
  position: absolute;
  transform: translateX(-50%);
  width: max-content;
  z-index: 9;
}

/* 三块面板由 .canvas-bottom-stack 排版，各自的绝对定位要交还给流式布局 */
.canvas-bottom-stack > * {
  max-width: 100%;
  pointer-events: auto;
  position: static;
}

.canvas-bottom-stack .magic-tolerance-panel {
  width: min(228px, 90vw);
}

/* ---- 描边面板 ---------------------------------------------------------- */
.outline-panel {
  width: min(380px, calc(100% - 36px));
}

.outline-panel-body {
  gap: 12px;
}

.outline-field {
  display: grid;
  gap: 7px;
}

.outline-field-label {
  align-items: baseline;
  color: #667284;
  display: flex;
  font-size: 12px;
  gap: 8px;
  letter-spacing: 0.02em;
}

.outline-hint {
  color: #8a94a4;
  font-size: 11px;
  font-weight: 500;
  margin-left: auto;
}

.outline-color-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 1px 6px;
  scrollbar-width: thin;
}

.outline-color-chip {
  border: 2px solid rgba(31, 46, 64, 0.14);
  border-radius: 7px;
  color: #1f2a2b;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  height: 34px;
  min-height: 0;
  padding: 0 8px;
}

.outline-color-chip.active {
  border-color: #2868df;
  box-shadow: 0 0 0 2px rgba(40, 104, 223, 0.22);
}

.outline-stepper-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.outline-stepper {
  display: grid;
  gap: 7px;
}

.outline-stepper-control {
  align-items: center;
  background: #f3f6fa;
  border: 1px solid #e0e6ee;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  height: 40px;
}

.outline-stepper-control button {
  background: transparent;
  color: #46536a;
  font-size: 18px;
  font-weight: 700;
  height: 100%;
  min-height: 0;
  padding: 0;
}

.outline-stepper-control button:disabled {
  color: #b9c1cd;
}

.outline-stepper-control b {
  font-size: 15px;
  text-align: center;
}

.outline-choice {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.outline-choice button {
  background: #f3f6fa;
  border: 1px solid #e0e6ee;
  border-radius: 8px;
  color: #46536a;
  font-size: 13px;
  font-weight: 600;
  min-height: 38px;
  padding: 0 6px;
}

.outline-choice button.active {
  background: #2868df;
  border-color: #2868df;
  color: #ffffff;
}

.outline-estimate {
  background: #f3f6fa;
  border-radius: 8px;
  color: #46536a;
  font-size: 12px;
  margin: 0;
  padding: 9px 11px;
}

/* ---- 画布浮层：禁止文字选中 -------------------------------------------- */
/* 在画布上拖动时，指针扫过这些浮层会把里面的文字选中，出现一片蓝色高亮 */
.canvas-bottom-stack,
.floating-toolbox,
.editor-command-bar,
#patternCanvas {
  -webkit-user-select: none;
  user-select: none;
}


/* ---- 线性图标（选区工具栏 + 底部工具坞统一）---------------------------- */
.tool-glyph {
  display: inline-grid;
  height: 22px;
  place-items: center;
  width: 22px;
}

.tool-glyph svg {
  display: block;
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.6;
  width: 22px;
}

.tool-glyph .tool-icon-accent {
  stroke: #2f73df;
  stroke-width: 2.8;
}

/* 按钮选中时底色是蓝的，强调色再用蓝就看不见了；清除是红的，蓝也不搭 */
.floating-toolbox .tool-button.active .tool-glyph .tool-icon-accent,
.selection-actions button.active .tool-glyph .tool-icon-accent,
.selection-actions .danger-action .tool-glyph .tool-icon-accent,
.editor-command-bar button.active .tool-glyph .tool-icon-accent {
  stroke: currentColor;
}

/* ---- 卫星组贴在工具坞下方时 -------------------------------------------- */
.canvas-bottom-stack.is-below {
  flex-direction: column;
}

/* ---- 描边面板：独立浮层，打开时居中，标题栏可拖动 ---------------------- */
.outline-panel {
  width: 340px;
  z-index: 14;
}

.outline-panel-handle {
  cursor: move;
  touch-action: none;
  user-select: none;
}

.outline-panel-handle button {
  cursor: pointer;
}

.outline-panel .detail-panel-body {
  overflow-y: auto;
}

/* ---- 图层面板改版：未选中的收成一行，选中的才展开 ---------------------- */
.layer-row .layer-main {
  align-items: center;
  display: flex;
  gap: 8px;
}

.layer-name-input {
  background: #fbfcfe;
  border: 1px solid #dde4ec;
  border-radius: 5px;
  flex: 1;
  font-size: 13px;
  min-width: 0;
  padding: 4px 8px;
}

.layer-name-input:focus {
  border-color: #2868df;
  outline: 0;
}

.layer-type {
  background: #e8f0fe;
  border-radius: 4px;
  color: #2b62c4;
  flex: none;
  font-size: 10px;
  padding: 2px 6px;
}

.layer-type.is-image {
  background: #fdf0dc;
  color: #a4690b;
}

.layer-row .layer-controls {
  border-top: 1px solid #e9edf3;
  display: grid;
  gap: 5px;
  margin-top: 6px;
  padding-top: 6px;
}

.layer-row .layer-slider {
  align-items: center;
  color: #667284;
  display: flex;
  font-size: 11px;
  gap: 7px;
}

.layer-row .layer-slider input[type="range"] {
  flex: 1;
  min-height: 14px;
  min-width: 56px;
}

.layer-row .layer-slider b {
  font-size: 11px;
  min-width: 30px;
  text-align: right;
}

.layer-row .layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.layer-row .layer-actions button {
  font-size: 11px;
  min-height: 23px;
  padding: 0 8px;
}

/* ---- 图层排序箭头：放在行内，不展开图层也能调顺序 ---------------------- */
.layer-order {
  display: grid;
  flex: none;
  gap: 1px;
}

.layer-order button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: #7d8798;
  display: flex;
  height: 17px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  width: 22px;
}

.layer-order button svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  width: 15px;
}

.layer-order button:hover:not(:disabled) {
  background: #eef4ff;
  color: #2868df;
}

.layer-order button:disabled {
  color: #d3d9e2;
}

/* 旧版图层面板留下的一批规则（5 列 grid、按钮行内边距）特异度更高，
   会盖掉新布局的紧缩设置，这里用同等层级把最终值定死。 */
body[data-view="editor"] .layers-panel .layer-row .layer-controls {
  gap: 5px;
  grid-template-columns: none;
  margin-top: 6px;
  padding: 6px 0 0;
}

body[data-view="editor"] .layers-panel .layer-row .layer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  grid-template-columns: none;
  padding: 0;
}

body[data-view="editor"] .layers-panel .layer-row .layer-actions button,
body[data-view="editor"] .layers-panel .layer-row .layer-controls button {
  font-size: 11px;
  min-height: 23px;
  padding: 0 8px;
}

body[data-view="editor"] .layers-panel .layer-row .layer-slider {
  font-size: 11px;
  gap: 6px;
}

/* ---- 我的图库标题移入顶栏，规格对齐控制台 ------------------------------ */
.projects-header-group {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  margin-left: 18px;
}

/* 控制台顶栏是深色底用白字，图库顶栏是浅色底，得换成深色字 */
.projects-header-title {
  color: #1d2734;
  margin-left: 0;
}

.projects-header-group .project-count {
  background: #f4f7fb;
}

/* ---- 我的图库顶栏：logo 与标题的排布对齐拼豆图纸识别 / 生成页 ---------- */
body[data-view="projects"] .topbar {
  gap: 24px;
  justify-content: flex-start;
  min-height: 72px;
  padding: 7px 42px;
}

body[data-view="projects"] .brand-button {
  flex: 0 0 auto;
  min-width: 136px;
  transform: none;
  width: auto;
}

body[data-view="projects"] .projects-header-group {
  flex: 0 1 auto;
  margin-left: 10px;
}

/* 窄屏只收 gap 和内边距，min-height 与 logo 宽度一路保持，和识别页一致 */
@media (max-width: 900px) {
  body[data-view="projects"] .topbar {
    gap: 12px;
    padding: 7px 16px;
  }

  body[data-view="projects"] .projects-header-title {
    font-size: 20px;
  }

  body[data-view="projects"] .projects-header-group {
    margin-left: 0;
  }
}

/* ---- 文件夹对话框 ------------------------------------------------------ */
.folder-name-card,
.folder-pick-card {
  display: grid;
  gap: 12px;
  min-width: min(320px, calc(100vw - 48px));
}

.folder-name-card strong,
.folder-pick-card strong {
  font-size: 16px;
}

#folderNameInput {
  border: 1px solid #d9dfe6;
  border-radius: 8px;
  font-size: 14px;
  min-height: 40px;
  padding: 8px 12px;
  width: 100%;
}

#folderNameInput:focus {
  border-color: #2868df;
  outline: 0;
}

.folder-pick-list {
  display: grid;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
}

.folder-pick-item {
  align-items: center;
  background: #fbfcfe;
  border: 1px solid #e2e7ee;
  border-radius: 8px;
  display: block;
  min-height: 44px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}

.folder-pick-item:hover {
  background: #eef4ff;
  border-color: #2868df;
}

/* ---- 图库卡片改版：文件夹拼贴预览 + 图纸卡精简底栏 -------------------- */
/* .project-card 的 grid-template-rows: 122px auto 会把绝对定位的菜单键
   也算进第一行，文件夹卡只有一个内容块，这里改成单行铺满 */
.project-card.folder-card {
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  position: relative;
}

/* 文件夹卡和图纸卡同高：上方拼贴占满剩余空间，底栏贴底 */
.projects-view .project-card.folder-card {
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-height: 238px;
}

.folder-card .folder-open-button {
  align-content: stretch;
  background: transparent;
  border: 0;
  border-radius: 10px;
  display: grid;
  gap: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  justify-items: stretch;
  padding: 0;
  text-align: left;
  width: 100%;
}

/* 旧的米色圆角色块样式只适用于原来那个大图标，这里全部覆盖掉 */
.folder-bar .folder-glyph {
  background: transparent;
  border-radius: 0;
  color: inherit;
  font-size: 0;
  height: 22px;
  width: 22px;
}

.folder-collage {
  align-content: center;
  background: #f2f3f5;
  border-radius: 10px 10px 0 0;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  padding: 10px;
  place-items: center;
}

/* 只有一两张时铺满整块，别硬套 2×2 在右下留一片空 */
.folder-collage:has(.folder-collage-cell:only-child),
.folder-collage.is-empty {
  grid-template-columns: 1fr;
}

.folder-collage-cell {
  display: block;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  width: 100%;
}

.folder-collage-empty {
  color: #9aa3ae;
  font-size: 12px;
}

.folder-bar {
  align-items: center;
  background: #ffffff;
  border-radius: 0 0 10px 10px;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
}

.folder-bar .folder-glyph {
  display: inline-grid;
  flex: none;
  height: 22px;
  place-items: center;
  width: 22px;
}

.folder-bar .folder-glyph svg {
  fill: #f0a532;
  height: 22px;
  stroke: none;
  width: 22px;
}

.folder-bar strong {
  color: #1d2734;
  flex: 1;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-bar small {
  color: #96a0ac;
  flex: none;
  font-size: 13px;
}

/* 同步状态改成右上角云形角标，替代原来的文字胶囊 */
.project-sync-badge {
  align-items: center;
  background: rgba(120, 130, 142, 0.85);
  border-radius: 50%;
  display: inline-grid;
  height: 26px;
  padding: 0;
  place-items: center;
  width: 26px;
}

.project-sync-badge svg {
  fill: #ffffff;
  height: 15px;
  stroke: none;
  width: 15px;
}

.project-sync-badge.synced {
  display: none;
}

.project-card-meta {
  align-items: center;
  color: #96a0ac;
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: space-between;
}

.project-card-size {
  align-items: center;
  display: inline-flex;
  gap: 5px;
}

.project-card-size svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 15px;
}

/* ---- 顶栏面包屑：文件夹名不再上下重复两遍 ------------------------------ */
.projects-header-title {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

/* 上级只是位置指示，用弱化的灰色，避免蓝色暗示可以点 */
.projects-crumb-root {
  color: #8e99a6;
  flex: none;
  font-weight: 800;
}

.projects-crumb-sep {
  color: #c3cad3;
  flex: none;
  font-weight: 400;
}

.projects-crumb-current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- 图纸卡底部紧缩：主体是图纸，文字信息让位 --------------------------
   图库页有一组 .projects-view 作用域的规则特异度更高，必须同级覆盖 */
.projects-view .project-card {
  grid-template-rows: 168px auto;
}

.projects-view .project-thumbnail,
.projects-view .project-thumbnail-button {
  height: 168px;
}

.projects-view .project-card-body {
  gap: 3px;
  grid-template-columns: minmax(0, 1fr);
  padding: 7px 10px 8px;
}

.projects-view .project-card-title {
  font-size: 12px;
}

.projects-view .project-card-meta {
  font-size: 11px;
  gap: 6px;
}

.projects-view .project-card-meta span {
  background: transparent;
  border: 0;
  padding: 0;
}

/* ---- 网格设置面板收窄：原来占了画布近一半宽 -------------------------- */
body[data-view="editor"] .grid-settings-panel,
body[data-view="editor"][data-editor-mode="complete"] .grid-settings-panel {
  height: min(560px, calc(100% - 40px), calc(100dvh - 84px));
  width: min(400px, calc(100% - 48px));
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body {
  gap: 10px;
  padding: 10px 12px;
}

body[data-view="editor"] .grid-settings-panel .detail-fields {
  gap: 8px;
}

/* 标签列原来吃掉 510px，剩下的控件被挤到最右边，中间一大片空 */
body[data-view="editor"] .grid-settings-panel .background-field {
  grid-template-columns: minmax(0, 1fr) auto;
}

body[data-view="editor"] .grid-settings-panel .switch-row,
body[data-view="editor"] .grid-settings-panel .panel-toggle {
  font-size: 12px;
  gap: 8px;
}

body[data-view="editor"] .grid-settings-panel details {
  padding-top: 8px;
}

body[data-view="editor"] .grid-settings-panel summary {
  font-size: 12px;
  padding: 4px 0;
}

body[data-view="editor"] .grid-settings-panel .field-label {
  font-size: 12px;
}

body[data-view="editor"] .grid-settings-panel input[type="text"],
body[data-view="editor"] .grid-settings-panel input[type="number"],
body[data-view="editor"] .grid-settings-panel select {
  font-size: 12px;
  min-height: 32px;
}

body[data-view="editor"] .grid-settings-panel > footer {
  gap: 6px;
  padding: 9px 12px;
}

body[data-view="editor"] .grid-settings-panel > footer button {
  font-size: 12px;
  min-height: 32px;
}

/* ===== 网格设置面板：配合 400px 宽度重排 ============================== */

/* 底部圆角：面板本身是 18px 圆角，但页脚有自己的白底又没被裁切，
   把两个下角盖成了直角 */
body[data-view="editor"] .grid-settings-panel {
  overflow: hidden;
}

body[data-view="editor"] .grid-settings-panel > footer {
  border-radius: 0 0 18px 18px;
}

/* ---- 开关：方案 D，细开关 + 开/关状态字 ---- */
body[data-view="editor"] .grid-settings-panel .switch-row,
body[data-view="editor"] .grid-settings-panel .panel-toggle {
  align-items: center;
  display: flex;
  gap: 8px;
}

body[data-view="editor"] .grid-settings-panel .switch-row > span:first-child,
body[data-view="editor"] .grid-settings-panel .panel-toggle {
  flex: 1;
}

body[data-view="editor"] .grid-settings-panel .switch-row::after,
body[data-view="editor"] .grid-settings-panel .panel-toggle::after {
  color: #9aa3ae;
  content: "关";
  flex: none;
  font-size: 11px;
  font-weight: 800;
  min-width: 14px;
  order: 8;
  text-align: right;
}

body[data-view="editor"] .grid-settings-panel .switch-row:has(input:checked)::after,
body[data-view="editor"] .grid-settings-panel .panel-toggle:has(input:checked)::after {
  color: #3b82f6;
  content: "开";
}

body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"],
body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"] {
  /* 别处同时设了 flex-basis、width 和 min-width，三个都要覆盖才收得下来 */
  flex: 0 0 36px;
  height: 20px;
  max-width: 36px;
  min-height: 20px;
  min-width: 36px;
  order: 9;
  width: 36px;
}

body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]::before,
body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]::before {
  height: 16px;
  left: 2px;
  width: 16px;
}

body[data-view="editor"] .grid-settings-panel .switch-row input[type="checkbox"]:checked::before,
body[data-view="editor"] .grid-settings-panel .panel-toggle input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

/* ---- 网格线：三列最小宽合计 436px，塞不进 400px 的面板，改成两行 ---- */
body[data-view="editor"] .grid-line-row.unified-grid-line-row {
  gap: 6px 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 8px 0;
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row > .line-control-button {
  grid-column: 1 / -1;
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row > strong,
body[data-view="editor"] .grid-line-row.unified-grid-line-row > .switch-row {
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row > .switch-row {
  flex: none;
  gap: 6px;
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row > label,
body[data-view="editor"] .grid-line-row.unified-grid-line-row > span {
  color: #6b7482;
  font-size: 12px;
  justify-self: end;
  white-space: nowrap;
}

body[data-view="editor"] .grid-line-row.unified-grid-line-row input[type="number"] {
  min-height: 30px;
  width: 58px;
}

/* ---- 线控件：铺满整行，预览段才有足够长度 ---- */
body[data-view="editor"] .line-control-button {
  grid-template-columns: 44px minmax(0, 1fr) 30px;
  min-height: 34px;
  width: 100%;
}

body[data-view="editor"] .line-control-preview {
  padding: 0 10px;
}

/* ---- 线型弹窗：跟随收窄后的面板一起缩小 -------------------------------- */
body[data-view="editor"] > .anchored-popup.line-control-menu {
  gap: 7px;
  padding: 9px 10px;
  width: 264px;
}

body[data-view="editor"] > .anchored-popup.line-control-menu.mode-color {
  width: 230px;
}

body[data-view="editor"] .line-control-menu .line-menu-section-title {
  font-size: 11px;
}

body[data-view="editor"] .line-control-menu .line-style-options,
body[data-view="editor"] .line-control-menu .line-width-options {
  gap: 4px;
  padding-top: 7px;
}

/* 线型行：预览线要占主要宽度，标签是辅助信息不该抢戏 */
body[data-view="editor"] .line-style-options button {
  align-items: center;
  border-radius: 7px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 38px;
  min-height: 26px;
  padding: 0 8px;
}

body[data-view="editor"] .line-style-options button > span {
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

body[data-view="editor"] .line-width-options {
  grid-template-columns: repeat(5, 1fr) minmax(0, 1.1fr);
}

body[data-view="editor"] .line-width-options button,
body[data-view="editor"] .line-width-options input {
  border-radius: 7px;
  font-size: 11px;
  min-height: 26px;
  padding: 0 2px;
}

/* ---- 折叠分区：修回内边距和圆角 ---------------------------------------- */
/* 上一轮为了压缩把 summary 的 padding 写成 4px 0，左右内边距被抹掉导致文字顶格 */
body[data-view="editor"] .grid-settings-panel summary {
  border-radius: 13px;
  font-size: 12px;
  padding: 7px 12px;
}

/* details 是 overflow: visible，summary 的底色会盖出圆角，
   所以圆角要画在 summary 自己身上：展开时只圆上面两角 */
body[data-view="editor"] .grid-settings-panel details[open] summary {
  border-radius: 13px 13px 0 0;
}

body[data-view="editor"] .grid-settings-panel details {
  padding-top: 0;
}

body[data-view="editor"] .grid-settings-panel .detail-panel-body > details + details {
  margin-top: 8px;
}

body[data-view="editor"] .grid-settings-panel details > .detail-fields {
  padding: 8px 12px 10px;
}

/* ---- 网格主题下拉：换掉原生 select（系统绘制的弹窗样式改不了）---------- */
.grid-theme-field {
  display: grid;
  gap: 5px;
}

.grid-theme-wrap {
  position: relative;
}

.grid-theme-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  color: #24303e;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  min-height: 32px;
  padding: 4px 10px;
  width: 100%;
}

.grid-theme-button:hover {
  border-color: #b9c6d8;
}

.grid-theme-menu {
  background: #ffffff;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(31, 46, 64, 0.18);
  display: grid;
  gap: 2px;
  left: 0;
  padding: 5px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
}

.grid-theme-menu button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #46536a;
  font-size: 12px;
  font-weight: 700;
  min-height: 30px;
  padding: 0 10px;
  text-align: left;
}

.grid-theme-menu button:hover {
  background: #eef4ff;
  color: #2868df;
}

.grid-theme-menu button.active {
  background: #2868df;
  color: #ffffff;
}

/* ---- 滑杆统一为细轨蓝色 + 数值胶囊（方案 2）--------------------------- */
/* input 本身保持 16px 高以留出点击区，可见轨道用伪元素画成 4px；
   直接把 input 压成 4px 的话触屏上几乎按不中 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  height: 16px;
  min-height: 16px;
  padding: 0;
  width: 100%;
}

/* 填充百分比由 syncRangeFill() 写进 --range-fill */
input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    #2868df 0 var(--range-fill, 0%),
    #dfe3eb var(--range-fill, 0%) 100%
  );
  border-radius: 99px;
  height: 4px;
}

input[type="range"]::-moz-range-track {
  background: linear-gradient(
    to right,
    #2868df 0 var(--range-fill, 0%),
    #dfe3eb var(--range-fill, 0%) 100%
  );
  border-radius: 99px;
  height: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #ffffff;
  border: 2px solid #2868df;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(31, 46, 64, 0.22);
  cursor: pointer;
  height: 13px;
  margin-top: -4.5px;
  width: 13px;
}

input[type="range"]::-moz-range-thumb {
  background: #ffffff;
  border: 2px solid #2868df;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(31, 46, 64, 0.22);
  cursor: pointer;
  height: 13px;
  width: 13px;
}

/* 别处给个别滑杆设过 min-height（如图层面板的 14px），统一回来 */
.layer-row .layer-slider input[type="range"],
.magic-tolerance-panel > label:first-of-type input {
  min-height: 16px;
}

input[type="range"]:focus-visible {
  outline: 0;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(40, 104, 223, 0.25);
}

input[type="range"]:disabled {
  cursor: default;
  filter: grayscale(1);
  opacity: 0.5;
}

/* 数值胶囊：不再和标签抢粗体 */
.range-value {
  background: #eef4ff;
  border-radius: 99px;
  color: #2868df;
  flex: none;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
}

/* 笔刷数值原本是墨绿实心胶囊、setup 页那几个继承正文深色，统一到同一套 */
.brush-size-value b.range-value,
.setup-panel .range-value,
.setup-view .range-value,
b.range-value {
  background: #eef4ff;
  border-radius: 99px;
  color: #2868df;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  height: auto;
  min-width: 34px;
  padding: 2px 9px;
}

/* ---- 撤销/重做：原来固定浅灰且无 :disabled 规则，可用与不可用长得一样 ---- */
body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button {
  color: #46536a;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button:hover:not(:disabled) {
  background: #eef4ff;
  border-color: #b9cdf0;
  color: #2868df;
}

body[data-view="editor"][data-editor-mode="edit"] .history-cluster .history-button:disabled {
  background: #f7f9fb;
  border-color: #e8edf3;
  color: #c3cad3;
  cursor: not-allowed;
}

/* ---- 裁剪步骤的一次性提示 ---------------------------------------------- */
/* 排版向「是否保存当前作品？」那种对话卡片看齐：加粗标题 ＋ 灰色说明 ＋
   底部一行操作，整体左对齐。「不再提示」从按钮改成勾选框，勾上不会立刻关掉，
   点「知道了」时才落盘。 */
.direct-crop-hint {
  align-items: stretch;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(30, 43, 59, 0.2);
  display: grid;
  gap: 18px;
  justify-items: stretch;
  left: 50%;
  padding: 22px;
  position: absolute;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 28px));
  z-index: 24;
}

.direct-crop-hint-copy strong {
  color: #1d2734;
  display: block;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

.direct-crop-hint p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  margin: 8px 0 0;
  text-align: left;
  white-space: normal;
}

.direct-crop-hint-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.direct-crop-hint-never {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
  user-select: none;
}

.direct-crop-hint button {
  background: #1d2734;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  flex: none;
  font-size: 13px;
  font-weight: 800;
  min-height: 38px;
  padding: 0 26px;
}

.direct-crop-hint button:hover {
  background: #12202c;
}

@media (max-width: 620px) {
  .direct-crop-hint {
    gap: 14px;
    min-height: 120px;
    padding: 20px 18px;
    width: min(460px, calc(100vw - 32px));
  }

  .direct-crop-hint p {
    font-size: 16px;
    white-space: normal;
  }
}

/* ── 色号校对页：左 2/3 色块、右 1/3 操作 ──────────────────────────────
   原来是上下两块（色块在上、工作台在下），色块区被挤成扁条，翻页特别频繁。
   改成左右分栏后色块区拿到整个高度，同时色块本身从 54px 缩到 36px，
   一页能装下的格子大约是原来的 3 倍。右栏在「挑格子」和「选替换色」
   两个状态间原地切换，两边的方格样式和位置一致，切换时视线不用重找。 */
.direct-stage[data-direct-panel="proof"] {
  gap: 10px;
  grid-template-columns: minmax(0, 3.5fr) minmax(248px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - 104px);
}

.direct-stage[data-direct-panel="proof"] .direct-proof-area {
  display: grid;
  gap: 8px;
  /* 翻页条那一行给死高度，网格的可用高度才不会随它有没有内容而变 */
  grid-template-rows: minmax(0, 1fr) 34px;
  overflow: hidden;
  padding: 10px;
}

/* 列数由 JS 按实际宽度算好写进 --proof-cols，格子用 1fr 把整行填满，
   每页恰好是 列 × 行 个格子，所以不会再留半行或者底下一条空带 */
.direct-stage[data-direct-panel="proof"] .direct-proof-grid {
  /* 行数是向下取整的，竖向总会剩下不到一格的余量；装满的整页把它摊到行间距里，
     底部就不会留一条空白带。没装满的页（最后一页）必须从顶部排起——否则两三行
     会被推成一上一下、中间空一大块。 */
  align-content: start;
  gap: 5px;
  grid-template-columns: repeat(var(--proof-cols, 10), minmax(0, 1fr));
  justify-content: stretch;
  min-height: 0;
  overflow: hidden;
}

.direct-stage[data-direct-panel="proof"] .direct-proof-grid .direct-empty-note {
  grid-column: 1 / -1;
}

.direct-stage[data-direct-panel="proof"] .direct-proof-pager {
  align-self: center;
  bottom: auto;
  justify-self: end;
  position: static;
  right: auto;
}

/* touch-action:none 让手指按在格子上直接开始连选，而不是拖动滚动条 */
.direct-stage[data-direct-panel="proof"] .direct-proof-cell {
  border-radius: 5px;
  font-size: 10px;
  touch-action: none;
}

.direct-stage[data-direct-panel="proof"] .direct-proof-cell.selected::after {
  font-size: 10px;
  height: 16px;
  right: -4px;
  top: -4px;
  width: 16px;
}

/* 两个子面板叠在同一个格子里，靠 is-hidden 决定谁露面 */
.direct-stage[data-direct-panel="proof"] .direct-proof-workbench {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

/* 提示语常驻第一行，「挑格子」和「选替换色」两块叠在第二行同一个格子里 */
.direct-stage[data-direct-panel="proof"] .direct-proof-workbench > .direct-proof-task {
  grid-area: 1 / 1;
}

.direct-stage[data-direct-panel="proof"] .direct-proof-side,
.direct-stage[data-direct-panel="proof"] .direct-replace-panel {
  grid-area: 2 / 1;
  min-height: 0;
  min-width: 0;
}

.direct-stage[data-direct-panel="proof"] .direct-replace-panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: auto;
  padding: 0;
}

/* 底部留 54px 给右下角那个问号浮标（38px 高 ＋ 18px 边距，再加一点余量）。
   被压缩的是色号方格那一行——它是弹性的，而且本来就可滚动。 */
.direct-proof-side {
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  padding: 0 0 54px;
}

.direct-stage[data-direct-panel="proof"] .direct-replace-panel {
  padding-bottom: 54px;
}

.direct-proof-task {
  background: var(--surface-muted, #f1f4f7);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
  padding: 8px 10px;
}

.direct-proof-task b {
  color: var(--ink);
  font-weight: 950;
}

.direct-proof-task b.direct-proof-task-code {
  background: var(--task-code-bg, #eef1f4);
  border: 1px solid rgba(30, 41, 43, 0.2);
  border-radius: 4px;
  color: var(--task-code-text, #26302f);
  padding: 1px 6px;
}

.direct-proof-side .direct-proof-summary {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  gap: 8px;
  padding: 0 2px 9px;
}

.direct-proof-side .direct-proof-color-list {
  align-content: start;
  gap: 9px 10px;
  overflow: auto;
  padding: 2px 4px 2px 0;
}

/* 方格保持正方形，豆数挂在正下方 */
.direct-color-chip-cell {
  display: grid;
  gap: 3px;
  justify-items: center;
  width: 40px;
}

.direct-color-chip-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.direct-color-chip-cell:has(.direct-color-chip.active) .direct-color-chip-count {
  color: #7b4b99;
}

/* 前 4 个按钮两个一行，排序/下一组/移除 挤在最后一行 */
.direct-proof-side .direct-proof-actions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding-top: 10px;
}

.direct-proof-side .direct-proof-actions > * {
  font-size: 11px;
  grid-column: span 3;
  letter-spacing: -0.01em;
  min-height: 28px;
  min-width: 0;
  padding: 5px 2px;
}

.direct-proof-side .direct-proof-center {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 0;
  padding: 10px 2px 0;
  place-self: auto;
}

.direct-proof-side .direct-proof-center > span {
  font-size: 13px;
  min-height: 0;
  padding: 0;
}

.direct-change-button {
  flex: none;
  min-height: 34px;
  padding: 0 18px;
}

.direct-change-button:disabled {
  background: #dfe3e7;
  border-color: #dfe3e7;
  color: #96a0a8;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .direct-stage[data-direct-panel="proof"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1.4fr) minmax(260px, 1fr);
    height: auto;
  }
}

/* 「全部色号」原来用的是系统原生复选框，各平台长得都不一样、还带一层
   浏览器自己的底色。这里自己画一个：方角圆润的小方块，勾上就填主色蓝，
   对勾用两笔边框旋转 45° 画出来，不依赖字体里的 ✓ 字形。 */
.direct-replace-panel .direct-all-colors {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  user-select: none;
}

/* 选择器都带上 [type="checkbox"]，比 .switch-row input / .direct-check-row input
   这些老规则更强一点，但仍然弱于 .grid-settings-panel 里的胶囊开关，
   网格设置面板那套不受影响。 */
.direct-all-colors input[type="checkbox"],
.direct-check-row input[type="checkbox"],
.checkin-hide-row input[type="checkbox"],
.direct-crop-hint-never input[type="checkbox"],
.export-option input[type="checkbox"],
.switch-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff;
  border: 1.5px solid #c6cdd4;
  border-radius: 5px;
  box-shadow: none;
  box-sizing: border-box;
  cursor: pointer;
  flex: none;
  height: 16px;
  margin: 0;
  min-height: 0;
  min-width: 0;
  padding: 0;
  position: relative;
  transition: background 0.12s ease, border-color 0.12s ease;
  width: 16px;
}

.direct-all-colors input[type="checkbox"]:hover,
.direct-check-row input[type="checkbox"]:hover,
.checkin-hide-row input[type="checkbox"]:hover,
.direct-crop-hint-never input[type="checkbox"]:hover,
.export-option input[type="checkbox"]:hover,
.switch-row input[type="checkbox"]:hover {
  border-color: #2868df;
}

.direct-all-colors input[type="checkbox"]:checked,
.direct-check-row input[type="checkbox"]:checked,
.checkin-hide-row input[type="checkbox"]:checked,
.direct-crop-hint-never input[type="checkbox"]:checked,
.export-option input[type="checkbox"]:checked,
.switch-row input[type="checkbox"]:checked {
  background: #2868df;
  border-color: #2868df;
}

.direct-all-colors input[type="checkbox"]:checked::after,
.direct-check-row input[type="checkbox"]:checked::after,
.checkin-hide-row input[type="checkbox"]:checked::after,
.direct-crop-hint-never input[type="checkbox"]:checked::after,
.export-option input[type="checkbox"]:checked::after,
.switch-row input[type="checkbox"]:checked::after {
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  content: "";
  height: 8px;
  left: 4.5px;
  position: absolute;
  top: 1.5px;
  transform: rotate(45deg);
  width: 4px;
}

.direct-all-colors input[type="checkbox"]:focus-visible,
.direct-check-row input[type="checkbox"]:focus-visible,
.checkin-hide-row input[type="checkbox"]:focus-visible,
.direct-crop-hint-never input[type="checkbox"]:focus-visible,
.export-option input[type="checkbox"]:focus-visible,
.switch-row input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(40, 104, 223, 0.35);
  outline-offset: 1px;
}

.direct-replace-panel .direct-all-colors:has(input:checked) {
  color: #2868df;
}

/* 右栏收窄了，替换面板里的方格也跟着排密一点 */
.direct-stage[data-direct-panel="proof"] .direct-replace-family-grid {
  gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
}

.direct-stage[data-direct-panel="proof"] .direct-replace-actions {
  gap: 8px;
}

/* ── 对齐页：画面设置 ────────────────────────────────────────────────
   原来两条拉杆只有一个百分比数字，看不出哪条管什么。名字和数值分踞
   一行的两端，拉杆独占下面一行，这样名字能写全、拉杆也拿到完整宽度。 */
.direct-view-slider {
  display: grid;
  gap: 4px;
}

.direct-view-slider + .direct-view-slider {
  margin-top: 8px;
}

.direct-view-slider-head {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
}

.direct-view-slider-head span:first-child {
  color: #5a6472;
  font-size: 12px;
  font-weight: 800;
}

.direct-view-slider-head span:last-child {
  color: #233033;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.direct-view-slider .direct-view-zoom-row {
  grid-template-columns: 30px 1fr 30px;
}

/* ── 对齐页：网格范围 ────────────────────────────────────────────────
   四组增减从「文字和按钮挤在一行的白卡片」改成「文字在上、按钮在下」的
   小块，卡片外壳去掉，四个方向就能贴到中间缩略图边上；中间那块原来是写死
   的虚线「边缘调格」占位，现在换成跟着 state.width×state.height 实时重画的
   缩略图，外圈一格用蓝色标出来，正是 ＋／− 会动的那一圈。 */
.direct-grow-pad {
  gap: 4px;
  /* 三列都收成内容宽再整体居中，左右两组按钮才会贴着缩略图，
     用 1fr 的话中间列会吃掉全部富余宽度、把按钮推到卡片两端 */
  grid-template-columns: auto auto auto;
  justify-content: center;
  padding: 10px 8px;
}

.direct-grow-row {
  /* 左右两组会被拉到和中间缩略图一样高，不居中的话文字顶在最上、
     按钮沉到最下，中间空一大截 */
  align-content: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  display: grid;
  gap: 3px;
  justify-items: center;
  min-height: 0;
  padding: 0;
}

.direct-grow-top,
.direct-grow-bottom {
  width: auto;
}

.direct-grow-row > span:first-child {
  min-width: 0;
  text-align: center;
}

.direct-grow-center {
  align-items: center;
  background: transparent;
  border: 0;
  justify-items: center;
  min-height: 0;
  padding: 0 2px;
  position: relative;
}

.direct-extent-preview {
  display: grid;
  place-items: center;
  width: 100%;
}

.direct-extent-preview svg {
  display: block;
  height: auto;
  max-width: 100%;
}

.direct-extent-lock {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 5px;
  color: #2f73df;
  font-size: 11px;
  font-weight: 900;
  left: 50%;
  padding: 2px 9px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

/* 没点过「知道了」之前拦住「下一步」，拦下来时整个提示框闪一下边框 */
@keyframes directCropHintPulse {
  0%, 100% { box-shadow: 0 16px 40px rgba(31, 44, 41, 0.16), 0 0 0 0 rgba(40, 104, 223, 0); }
  30% { box-shadow: 0 16px 40px rgba(31, 44, 41, 0.16), 0 0 0 5px rgba(40, 104, 223, 0.35); }
  65% { box-shadow: 0 16px 40px rgba(31, 44, 41, 0.16), 0 0 0 0 rgba(40, 104, 223, 0); }
}

.direct-crop-hint.is-flash {
  animation: directCropHintPulse 0.62s ease-in-out;
  border-color: #2868df;
}

@media (prefers-reduced-motion: reduce) {
  .direct-crop-hint.is-flash {
    animation: none;
    box-shadow: 0 16px 40px rgba(31, 44, 41, 0.16), 0 0 0 4px rgba(40, 104, 223, 0.35);
  }
}

/* 单格格距：藏掉原生数字框的上下箭头，旁边已经有 ＋／− 了，
   两套加减挤在一起既难点又难看 */
.direct-pitch-row input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.direct-pitch-row input[type="number"]::-webkit-outer-spin-button,
.direct-pitch-row input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

/* 工具卡标题左边一道竖条。原来标题 13px、下面的输入框文字 11px，只差 2px 又都很粗，
   往下扫时分不出哪是标题哪是内容。竖条是纯图形信号，不靠字号就能把标题拎出来，
   顺带标出每张卡的起点。颜色跟着 is-red / is-blue 变体走。 */
.direct-tool-card .direct-card-head strong {
  border-left: 3px solid #2f73df;
  line-height: 1.35;
  padding-left: 9px;
}

.direct-tool-card .direct-card-head.is-red strong {
  border-left-color: #ff4e63;
}

.direct-tool-card .direct-card-head.is-blue strong {
  border-left-color: #3b82f6;
}

/* 小步长同时管方向键和格距 ＋／−，所以放到卡片标题那一行的右端——
   位置上它就统管整张卡，不会被读成只管紧挨着的那一段。
   标题行是 space-between，不用额外对齐。 */
.direct-tool-card .direct-card-head .direct-fine-step-row {
  border-top: 0;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  font-size: 11px;
  font-weight: 800;
  gap: 6px;
  margin: 0;
  padding: 0;
}

/* 裁剪页的「示例」侧栏删掉了（两个示意槽从来没画过内容，重置裁剪也挪到了顶栏），
   这一步现在只剩裁剪框，让它吃满整行宽度。
   选择器要写这么长，是因为上面
   .setup-view.direct-setup-active .direct-stage:not([data-direct-panel="proof"]):not(.direct-finish-stage)
   已经占到 (0,5,0)，短选择器压不住它那条 340px 侧栏。 */
body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage[data-direct-panel="crop"] {
  grid-template-columns: minmax(0, 1fr);
}

/* 笔刷形状：六个图标两行摆开，选中的高亮，工具坞上的图标跟着换 */
.brush-shape-popover {
  width: 176px;
}

.brush-shape-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brush-shape-option {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dce3ec;
  border-radius: 7px;
  color: #46525f;
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 42px;
  padding: 0;
}

.brush-shape-option:hover {
  border-color: #2868df;
  color: #2868df;
}

.brush-shape-option.active {
  background: #eef4ff;
  border-color: #2868df;
  color: #2868df;
}

.brush-shape-option .tool-glyph {
  height: 26px;
  width: 26px;
}

/* 色系名后面的 5 颗预览色 */
.palette-family-preview {
  display: flex;
  gap: 5px;
  justify-self: start;
}

.palette-family-preview i {
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(24, 32, 44, 0.1);
  height: 13px;
  width: 13px;
}

/* 导入页只剩一列品牌清单，340px 是当初按「品牌名＋色数一行」量的，
   现在右边留了一大片白。收到约三分之二宽。 */
body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage[data-direct-panel="import"] {
  grid-template-columns: 227px minmax(0, 1fr);
}

/* 移动对象改成左右分栏：对象竖着排在左，方向键菱形留在右。
   原来是「一整条切换 ＋ 三行菱形」共五行，中间还空着一个洞；
   换成横向排布之后高度减半，菱形的方位感也保住了。 */
/* 富余宽度给左边那列（让网格／图片两个按钮撑开），而不是留在两者中间。
   这样方向键仍然贴右、左边仍然贴左，中间的空当只剩一个 gap。 */
.direct-move-split {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.direct-move-split .direct-mode-row {
  gap: 5px;
  grid-template-columns: minmax(0, 1fr);
}

/* 侧栏只有 228px，左边占掉一截之后按钮得收窄 */
.direct-move-split .direct-align-mode {
  font-size: 11px;
  min-height: 30px;
  padding: 5px 12px;
  white-space: nowrap;
}

.direct-move-split .direct-nudge-pad {
  gap: 3px;
  justify-self: center;
}

.direct-move-split .direct-nudge-pad button {
  font-size: 15px;
  height: 27px;
  width: 32px;
}

/* 按尺寸对齐：宽和高之间加一个真的「×」把它们连成一对尺寸；
   「应用」原来是个窄边框按钮，最该点的东西反而最不显眼，换成实心对勾。 */
.direct-apply-row {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
}

.direct-size-times {
  color: #96a0ac;
  font-size: 12px;
  line-height: 1;
  padding: 0 1px;
}

.direct-size-apply-icon {
  background: #2f73df;
  border: 1px solid #2f73df;
  border-radius: 7px;
  color: #ffffff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  min-height: 34px;
  width: 34px;
}

.direct-size-apply-icon:hover:not(:disabled) {
  background: #245fbb;
  border-color: #245fbb;
}

.direct-size-apply-icon:disabled {
  background: #dfe3e7;
  border-color: #dfe3e7;
  color: #96a0a8;
  cursor: not-allowed;
}

/* 单格格距：横竖已经联动，两个永远相同的数字框收成一个，
   加减并排放在右边。输入框因此拿到整行剩余宽度。 */
/* 框子按内容收窄，不再撑满整列——里面只有一个数字加单位，撑满就显得空 */
.direct-pitch-row {
  align-items: center;
  grid-template-columns: auto auto;
  justify-content: space-between;
}

/* 数字原来贴着左边、单位贴着右边，中间空一大段。改成「数字 ＋ 单位」作为
   一组整体居中，数字自己右对齐，这样小数点的位置也稳定，不会跳来跳去。 */
.direct-pitch-row label {
  gap: 5px;
  justify-content: center;
  padding: 3px 10px;
}

.direct-pitch-row label input {
  flex: 0 1 auto;
  min-height: 28px;
  min-width: 0;
  text-align: right;
  width: 56px;
}

.direct-pitch-row label small {
  color: #96a0ac;
  flex: none;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.direct-pitch-step {
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: none;
}

.direct-pitch-step .direct-icon-button {
  min-height: 34px;
  width: 34px;
}

/* 圆角小按钮里只有一个符号，原来靠 line-height 摆位：line-height 20px 装在
   34px 高的盒子里，字就贴着上沿，看着「没在方框中心」。改成 grid 居中，
   和盒子多高、padding 多少都无关。 */
.direct-icon-button {
  display: grid;
  line-height: 1;
  place-items: center;
}

/* 格距那两个符号换成 U+2212 减号和普通加号：全角的 －（U+FF0D）在多数字体里
   是按文字基线画的、不在数学中心，和 ＋ 并排就会一高一低。 */
.direct-pitch-step .direct-icon-button {
  font-size: 18px;
  padding: 0;
}

/* 对齐页侧栏。227px（比原来的 340 少三分之一）会把「按尺寸对齐」那一行压塌——
   宽高两个输入框只剩 27px，连三位数都放不下。这里先取 270px 作为不破坏内容的
   中间值，真正的宽度等那一行改完再定。 */
.direct-wizard.direct-align-workspace .direct-stage[data-direct-panel="align"],
body[data-view="setup"][data-module="direct"] .setup-view.direct-setup-active .direct-stage[data-direct-panel="align"] {
  grid-template-columns: 270px minmax(0, 1fr);
}

/* 方向键原来在自己那一列里居中，右边空出 64px，而同一张卡里其它行都是通栏，
   一眼看去就这一行「没到边」。改成靠右，整张卡的右边界就齐了。 */
.direct-move-split .direct-nudge-pad {
  justify-self: end;
}

/* .direct-apply-row .direct-size-apply 是 (0,2,0)，把裸类名的 34px 压掉了，
   所以对勾按钮一直是 48 宽。这里用同样的作用域拿回来。 */
.direct-apply-row .direct-size-apply-icon {
  padding: 0;
  width: 34px;
}

/* 装满的整页才摊余量，见 renderDirectProof 里的 is-full-page */
.direct-stage[data-direct-panel="proof"] .direct-proof-grid.is-full-page {
  align-content: space-between;
}

/* ── 新手导航 ────────────────────────────────────────────────────────
   遮罩只压暗、不拦操作：挖空的那块是 pointer-events:none，点下去直接落在
   真控件上。所以用户想跳着做也不会被卡住。 */
.tour-overlay {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 400;
}

.tour-overlay.is-hidden {
  display: none;
}

/* 原来这里用超大扩散阴影把四周压暗。去掉了：对齐那一步你必须盯着画布看格线
   压没压准，遮罩挡的正是唯一要看的东西。高亮环本来就够指明位置了。 */
.tour-spotlight {
  border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(55, 138, 221, 0.9), 0 0 0 7px rgba(55, 138, 221, 0.18);
  pointer-events: none;
  position: absolute;
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
}

.tour-bubble {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 18px 54px rgba(15, 23, 32, 0.32);
  display: grid;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px;
  pointer-events: auto;
  position: absolute;
  width: 300px;
}

.tour-bubble strong {
  color: #1d2734;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.tour-bubble p {
  color: #5a6472;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

.tour-foot {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 2px;
}

.tour-count {
  color: #96a0ac;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.tour-actions {
  display: flex;
  gap: 6px;
}

.tour-ghost,
.tour-primary {
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  padding: 0 12px;
}

.tour-ghost {
  background: transparent;
  border: 1px solid #dce3ec;
  color: #5a6472;
}

.tour-ghost:hover:not(:disabled) {
  border-color: #2868df;
  color: #2868df;
}

.tour-ghost:disabled {
  color: #c2cad4;
  cursor: not-allowed;
}

.tour-primary {
  background: #2868df;
  border: 1px solid #2868df;
  color: #ffffff;
}

.tour-primary:hover {
  background: #1f5cc4;
}

/* 全站固定在右下角的帮助浮标。z-index 压在导航遮罩之下，导航开着的时候
   不会盖住气泡。 */
.tour-replay-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #e3eaf4;
  border-radius: 50%;
  bottom: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 32, 0.16);
  color: #2f73df;
  cursor: pointer;
  display: flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  position: fixed;
  right: 18px;
  transition: box-shadow 160ms ease, transform 160ms ease;
  width: 38px;
  z-index: 380;
}

.tour-replay-button svg {
  height: 20px;
  width: 20px;
}

.tour-replay-button:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 32, 0.22);
  transform: translateY(-1px);
}

/* 校色页改成在面板底部留一条空带（见 .direct-proof-side），浮标不用再避让，
   全站保持同一个位置 */

/* ── 签到成功卡片 ────────────────────────────────────────────────────
   原来最大的字是「成功」，可它不携带信息；用户真正关心的积分反而是小灰字。
   改成积分当主角，下面一条七格的连签进度，并写清「再签几天有额外奖励」。 */
.checkin-success-card {
  gap: 0;
  padding: 26px 26px 22px;
  width: min(300px, calc(100vw - 40px));
}

.checkin-success-top {
  color: #8b95a3;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 4px;
}

.checkin-success-gain {
  align-items: baseline;
  color: #e8a13a;
  display: flex;
  gap: 3px;
  justify-content: center;
  margin: 0 0 16px;
}

.checkin-success-gain b {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}

.checkin-success-gain small {
  font-size: 14px;
  font-weight: 800;
}

.checkin-streak-track {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  width: 100%;
}

.checkin-streak-track i {
  background: #eef2f7;
  border-radius: 99px;
  flex: 1;
  height: 7px;
}

.checkin-streak-track i.is-done {
  background: #2f73df;
}

.checkin-streak-track i.is-now {
  background: #e8a13a;
}

.checkin-streak-hint {
  color: #8b95a3;
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 16px;
}

.checkin-streak-hint b {
  color: #c98a1e;
  font-weight: 900;
}

.checkin-success-card .checkin-success-button {
  background: #1d2734;
  border: 0;
  border-radius: 9px;
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  min-height: 40px;
  width: 100%;
}

.checkin-success-card .checkin-success-button:hover {
  background: #12202c;
}

/* 签到弹窗顶部补一行连签说明 */
.checkin-streak-note {
  color: #8b95a3;
  font-size: 11px;
  margin: 4px 0 0;
  text-align: center;
}

/* ── 选区状态条 ──────────────────────────────────────────────────────
   摘要和「取消」并排成一条。原来的关闭是工具栏右端一个光秃秃的 ×，
   看不出取消的是什么；改成带文字的胶囊，文案跟着当前工具走。 */
.selection-bar {
  align-items: center;
  display: flex;
  gap: 8px;
}

.selection-bar.is-hidden {
  display: none;
}

.selection-cancel {
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d8e1ed;
  border-radius: 999px;
  color: #1d2734;
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 900;
  gap: 5px;
  padding: 8px 14px;
  white-space: nowrap;
}

.selection-cancel span {
  color: #8b95a3;
  font-size: 13px;
  line-height: 1;
}

.selection-cancel:hover {
  border-color: #2868df;
  color: #2868df;
}

.selection-cancel:hover span {
  color: #2868df;
}

/* 魔棒／框选期间画布压一层蓝，明确「现在在选区状态」。
   pointer-events:none，不挡下面的绘制操作。 */
.canvas-wrap.is-selecting::after {
  background: rgba(47, 115, 223, 0.06);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

/* 魔棒面板里的「包含空格」 */
.magic-tolerance-panel .magic-blank-row {
  font-size: 11px;
  gap: 6px;
  margin-top: 2px;
}

/* 定价卡片：沿用原来的 .price-meta 外观，只是里面的数字换成了月度总量。
   下面补一行朴素的构成说明——总量里一部分是订阅保底给的，一部分要签到才有，
   不写清楚的话 Pro 宣传 340、不签到只有 100，落差 3.4 倍。 */
.price-breakdown {
  color: #8b95a3;
  font-size: 11px;
  line-height: 1.5;
  margin: 6px 0 0;
}

/* ── 导出选项对话框 ──────────────────────────────────────────────────
   三项各占一行，勾选框和输入框并排。勾没勾行高都是 34px，只在「可编辑」和
   「灰掉」之间切换——所以切换时对话框高度纹丝不动，不会像上下两行那样一勾
   就往下窜一截。 */
.export-options-card {
  width: min(400px, calc(100vw - 28px));
}

.export-options-list {
  display: grid;
  gap: 8px;
}

.export-option {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  min-height: 34px;
}

.export-option-label {
  color: #46525f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.export-option-field {
  background: #fafcff;
  border: 1px solid #dde6f2;
  border-radius: 6px;
  color: #243033;
  font-size: 12px;
  min-height: 32px;
  min-width: 0;
  padding: 0 9px;
  width: 100%;
}

/* 关掉的项：文字和输入框一起灰，但位置和高度都不变 */
.export-option:has(input[type="checkbox"]:not(:checked)) .export-option-label {
  color: #b3bcc7;
}

.export-option-field:disabled {
  background: #f4f6f9;
  border-color: #eceff3;
  color: #c2cad4;
  cursor: not-allowed;
}

.export-option-rule {
  background: #eef2f7;
  height: 1px;
  margin: 2px 0;
}

.export-member-badge {
  background: #fff4d9;
  border: 1px solid #f0dcae;
  border-radius: 999px;
  color: #c98a1e;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  white-space: nowrap;
}

.export-upsell {
  background: #fff9ec;
  border: 1px solid #f0dcae;
  border-radius: 7px;
  color: #9a7b3a;
  font-size: 11px;
  line-height: 1.55;
  margin: 0;
  padding: 9px 11px;
}

.export-upsell button {
  background: transparent;
  border: 0;
  color: #c98a1e;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  padding: 0;
}

.export-upsell button:hover {
  text-decoration: underline;
}


/* 识别的提示行跟着步骤换。强制单行 + 省略号：顶栏一旦被撑高，下面 position:fixed
   的步骤条（top:72px）和 calc(100vh - 96px) 的画布高度就全错位了。 */
body[data-view="setup"][data-module="direct"] .setup-header-hint {
  color: #68726f;
  flex: 1 1 auto;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  margin-left: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══ 说明模式 ═══════════════════════════════════════════════════════════
   平时界面上一个问号都没有——有名有姓的控件一百八十多个，撒一把问号进去会
   把版面弄碎。只有开了说明模式，写过说明的控件才亮起来。 */
.has-help {
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.55), 0 0 0 5px rgba(55, 138, 221, 0.14) !important;
  border-radius: 6px;
  cursor: help !important;
  position: relative;
}

.is-help-open {
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 1), 0 0 0 7px rgba(55, 138, 221, 0.24) !important;
}

/* 模式里所有点击都被拦在 document 捕获阶段，光标统一提示「这是在问，不是在用」 */
body.help-mode-on .has-help,
body.help-mode-on .has-help * {
  cursor: help !important;
}

.help-bubble {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 18px 54px rgba(15, 23, 32, 0.32);
  display: grid;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px;
  pointer-events: auto;
  position: fixed;
  width: 300px;
  z-index: 420;
}

.help-bubble.is-hidden {
  display: none;
}

.help-bubble strong {
  color: #1d2734;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.help-bubble p {
  color: #5a6472;
  font-size: 12px;
  line-height: 1.6;
  margin: 0;
}

/* 贴着右下角那个问号往上叠，不放屏幕正中间——编辑器的工具栏就在底部中间，
   放中间会把「点亮起的控件」这句话正在指的那排按钮盖住。 */
.help-mode-bar {
  align-items: center;
  background: #1d2734;
  border-radius: 999px;
  bottom: 96px;
  box-shadow: 0 12px 32px rgba(15, 23, 32, 0.28);
  color: #e7edf5;
  display: flex;
  font-size: 12px;
  gap: 10px;
  max-width: calc(100vw - 36px);
  padding: 8px 10px 8px 16px;
  position: fixed;
  right: 18px;
  z-index: 430;
}

.help-mode-bar.is-hidden {
  display: none;
}

.help-mode-tip {
  white-space: nowrap;
}

.help-mode-link,
.help-mode-exit {
  background: rgba(255, 255, 255, 0.14);
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  min-height: 0;
  padding: 5px 12px;
  white-space: nowrap;
}

.help-mode-link:hover,
.help-mode-exit:hover {
  background: rgba(255, 255, 255, 0.26);
}

.tour-replay-button.is-active {
  background: #2868df;
  border-color: #2868df;
  color: #ffffff;
}

@media (max-width: 900px) {
  .help-mode-tip {
    display: none;
  }
}

/* ── 识别那一格放五张：一步一张，点下面的小标签换 ────────────────────
   五张叠在同一个框里、只切 opacity，不用 display——切换时框的高度纹丝不动，
   不会因为换图把下面的内容顶一下。 */
.landing-shot-stack {
  position: relative;
}

.landing-shot-stack img {
  inset: 0;
  opacity: 0;
  position: absolute;
  transition: opacity 180ms ease;
}

.landing-shot-stack img.is-active {
  opacity: 1;
}

.landing-shot-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
}

.landing-shot-tabs button {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d6e0ec;
  border-radius: 999px;
  color: #5a6472;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  min-height: 0;
  padding: 6px 16px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.landing-shot-tabs button:hover {
  border-color: #2868df;
  color: #2868df;
}

.landing-shot-tabs button.active {
  background: #2868df;
  border-color: #2868df;
  color: #ffffff;
}

/* ── 窄屏提示 ──────────────────────────────────────────────────────
   实测编辑器在 904px 以下开始横向溢出（900 差 4px、768 差 136px、375 差 529px），
   顶栏和工具条会被切在屏幕外。落地页、控制台、识别和生成的设置页都有响应式，
   在 768 下零溢出，所以只挡编辑器这一处。 */
.narrow-home-hint {
  background: #fff8e6;
  border: 1px solid #f2dfae;
  border-radius: 10px;
  color: #8a6417;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 auto 14px;
  max-width: 520px;
  padding: 10px 14px;
  text-align: center;
}

/* fixed 能用的前提是先把 #workbench 藏掉——编辑器 904px 宽的内容会把布局视口
   撑开，而 fixed 是贴着布局视口算的，不藏就会变成 904 宽、卡片被推出屏幕。
   藏掉之后视口缩回设备宽度，这里就正常了。 */
.narrow-notice {
  align-items: center;
  background: rgba(247, 249, 248, 0.98);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 900;
}

.narrow-notice.is-hidden {
  display: none;
}

.narrow-notice-card {
  background: #ffffff;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #e3eaf4;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 32, 0.16);
  max-width: 420px;
  padding: 26px 24px 22px;
  text-align: center;
}

.narrow-notice-dog {
  height: 84px;
  margin-bottom: 6px;
  width: auto;
}

.narrow-notice-card strong {
  color: #1d2734;
  display: block;
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 10px;
}

.narrow-notice-card p {
  color: #5a6472;
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 8px;
}

.narrow-notice-sub {
  color: #8a94a3 !important;
  font-size: 12px !important;
}

.narrow-notice-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

/* 挡板亮着时藏掉编辑器：它的宽度会撑开布局视口，害得 position:fixed 的挡板
   跟着变宽、卡片被推出屏幕。藏掉之后视口缩回设备宽度，挡板就正常居中了。 */
body.narrow-blocked #workbench,
body.narrow-blocked #appHeader {
  display: none !important;
}

body.narrow-blocked {
  overflow: hidden;
}
