/* Bead Pattern Maker — shared EN/ZH studio UI */
.bd-app { margin-bottom: 8px; }
.bd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .bd-layout { grid-template-columns: 1fr; }
}

.bd-stage-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}
.bd-stage {
  position: relative;
  overflow: auto;
  max-height: min(72vh, 820px);
  background:
    linear-gradient(45deg, #d8d4cc 25%, transparent 25%),
    linear-gradient(-45deg, #d8d4cc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d4cc 75%),
    linear-gradient(-45deg, transparent 75%, #d8d4cc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #ece8e0;
  border-radius: 10px;
  touch-action: none;
}
html[data-theme="dark"] .bd-stage { background-color: #2a2a2e; }
.bd-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.bd-compare.is-solo { grid-template-columns: 1fr; }
.bd-pane { min-width: 0; }
.bd-caption {
  font-size: 12px; font-weight: 600; color: var(--text2);
  text-align: center; margin: 0 0 4px;
}
.bd-compare.is-solo .bd-caption { display: none; }
#bdCanvas { display: block; margin: 12px auto; cursor: crosshair; }
#bdOrig {
  display: block; margin: 12px auto; pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
@media (max-width: 720px) {
  .bd-compare:not(.is-solo) { grid-template-columns: 1fr; }
}

.bd-tools {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center;
}
.bd-tools button, .bd-side button {
  font: inherit; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.bd-tools button.active {
  background: var(--dark-btn); border-color: var(--dark-btn); color: var(--bg);
}
.bd-tools button:disabled { opacity: .4; cursor: not-allowed; }

.bd-side {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
@media (min-width: 901px) {
  .bd-side {
    position: sticky; top: 80px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}
.bd-side h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text2); margin: 0 0 10px;
}
.bd-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--text2); }
.bd-field input[type="number"], .bd-field select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.bd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bd-stats { font-size: 12.5px; color: var(--text2); margin: 8px 0 12px; line-height: 1.5; }
.bd-stats strong { color: var(--text); }

.bd-bom { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bd-bom-item {
  display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center;
  width: 100%; text-align: left; font: inherit; font-size: 12.5px;
  border: 1px solid transparent; background: transparent; color: var(--text);
  border-radius: 8px; padding: 4px 6px; cursor: pointer;
}
.bd-bom-item.active, .bd-bom-item:hover { border-color: var(--border); background: var(--bg); }
.bd-swatch {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.bd-swatch.clear {
  background: radial-gradient(circle at 35% 30%, #fff, #c9d4dc 55%, #9aa8b0);
}
.bd-code { font-weight: 600; }
.bd-name { color: var(--text2); font-weight: 400; }
.bd-count { font-variant-numeric: tabular-nums; color: var(--text2); }

.bd-status { min-height: 18px; font-size: 12.5px; color: var(--text2); margin: 10px 0 0; text-align: center; }
.bd-status.err { color: #c45c55; }
.bd-panel[hidden], .bd-app[hidden], .bd-pane[hidden] { display: none !important; }
.bd-current {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text2); margin-bottom: 8px;
}
.bd-tools .bd-toggle { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 6px; }

