:root {
  --bg: #0f1115;
  --panel: #171a21;
  --text: #e6eaf2;
  --muted: #a5adba;
  --accent: #4da3ff;
  --grid: #364152;
  --board: #e95454;
  --ok: #62d67a;
}
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
  height: 100%;
}
.panel {
  background: var(--panel);
  border: 1px solid #222633;
  border-radius: 10px;
  padding: 14px;
  overflow: auto;
}
.panel h2 { margin: 0 0 8px 0; font-size: 16px; }
fieldset {
  border: 1px solid #2a2f3b;
  border-radius: 8px;
  margin: 10px 0;
  padding: 10px;
}
legend { color: var(--muted); padding: 0 6px; }
label { display: block; margin: 8px 0 4px; color: var(--muted); }
input[type="number"], select, input[type="color"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #2a2f3b;
  border-radius: 8px;
  background: #0f1218;
  color: var(--text);
  outline: none;
}
input[type="checkbox"] { transform: translateY(1px); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #2a2f3b;
  background: #121623;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.btn.primary { background: linear-gradient(180deg, #1a2235, #141a29); border-color: #2a3246; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.hint { color: var(--muted); font-size: 12px; }
#canvasWrap {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  height: 100%;
}
#patternCanvas {
  background: #0b0e14;
  border-radius: 8px;
  border: 1px solid #222633;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px dashed #2a2f3b;
  padding: 6px 4px;
  text-align: left;
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 600; }
.swatch {
  width: 18px; height: 18px; border-radius: 4px; border: 1px solid #0008; display: inline-block;
}
.stats-header { display: flex; align-items:center; justify-content: space-between; gap: 8px; }
.divider { height: 1px; background: #202432; margin: 8px 0; }
.mode-group { display: none; }
.mode-group.active { display: block; }
.kbd { border: 1px solid #2a2f3b; background:#0d111a; padding:0 6px; border-radius:6px; font-size:12px;}

