.brand span { color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 4px 0 8px; }
.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); vertical-align: -2px; margin-right: 2px; }
.lg.ever { background: var(--good); border-color: var(--good); }
.lg.down { background: var(--accent); border-color: var(--accent); }
.lg.warn { background: var(--warn); border-color: var(--warn); }

.kb-wrap { margin: 8px 0; user-select: none; }
.kb-blocks { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.kb-main { flex: 15 1 100%; min-width: 0; }
.kb-nav { flex: 3 1 90px; min-width: 0; }
.kb-num { flex: 4 1 120px; min-width: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.kb-num[hidden] { display: none; }
.kb-row { display: flex; gap: 3px; margin-bottom: 3px; }
.fn-row { margin-bottom: 10px; }
.key {
  flex: var(--w, 1) 1 0; min-width: 0; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 6px; background: var(--bg); color: var(--text);
  font-size: .72rem; font-weight: 600; overflow: hidden; white-space: nowrap; transition: background .08s;
}
.key.spacer { visibility: hidden; }
.key.opt { border-style: dashed; }
.key.ever { background: color-mix(in srgb, var(--good) 28%, var(--bg)); border-color: var(--good); }
.key.warn { background: color-mix(in srgb, var(--warn) 35%, var(--bg)); border-color: var(--warn); }
.key.down { background: var(--accent); border-color: var(--accent); color: #fff; }
.kb-num .key { height: auto; min-height: 38px; }
.toolbar { align-items: center; margin: 10px 0; }
.toolbar > * { flex: 0 0 auto; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: auto; }
@media (max-width: 560px) {
  .key { height: 30px; font-size: .55rem; border-radius: 4px; }
  .kb-row, .kb-num { gap: 2px; }
  .kb-num .key { min-height: 30px; }
}

.pad {
  height: 240px; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
  color: var(--text); cursor: crosshair; user-select: none; touch-action: none; margin: 8px 0;
}
.btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.mbtn { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--bg); text-align: center; }
.mbtn .n { font-size: .85rem; color: var(--muted); }
.mbtn .c { font-weight: 800; font-size: 1.1rem; }
.mbtn.down { background: var(--accent); border-color: var(--accent); }
.mbtn.down .n, .mbtn.down .c { color: #fff; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.swatch { border: 2px solid var(--border); border-radius: 10px; padding: 8px 14px; background: var(--c); font-weight: 700; cursor: pointer; color: #000; text-shadow: 0 0 3px #fff; }
.swatch:nth-child(1), .swatch:nth-child(3), .swatch:nth-child(5) { color: #fff; text-shadow: 0 0 3px #000; }
.stage { position: fixed; inset: 0; z-index: 1000; cursor: pointer; }
.stage[hidden] { display: none; }
.stage-hint { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 1rem; transition: opacity .6s; pointer-events: none; padding: 0 12px; }
.stage-hint.fade { opacity: 0; }
body.staging { overflow: hidden; }
