/* sc.css — app chrome. Dark sidebar, light stage, so the tiling reads as artwork. */

:root {
  --bg: #16181c;
  --panel: #1d2026;
  --panel-2: #24282f;
  --line: #2f343c;
  --ink: #e9e7e3;
  --dim: #939aa5;
  --accent: #4bb3a6;
  --accent-ink: #06231f;
  --warn: #e0a83c;
  --bad: #e85d5d;
  --good: #5fb36b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-columns: 308px 1fr;
  height: 100%;
}

/* ------------------------------------------------------------------ sidebar */

#side {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}

header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
header p {
  margin: 5px 0 0;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.45;
}
header a { color: var(--accent); text-decoration: none; }
header a:hover { text-decoration: underline; }

.grp {
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.grp h2 {
  margin: 0 0 11px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}

.row { margin-bottom: 11px; }
.row:last-child { margin-bottom: 0; }
.row > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 5px;
  color: #c9ced6;
}
.num {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-size: 11.5px;
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: #3a4048;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
}
input[type="range"]::-moz-range-track { height: 3px; background: #3a4048; border-radius: 2px; }
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--panel);
}

/* segmented control */
.seg { display: flex; flex-wrap: wrap; gap: 3px; background: var(--panel-2); padding: 3px; border-radius: 7px; }
.seg button {
  flex: 1 1 40%;
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 11.5px;
  padding: 5px 4px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 620; }

/* checkboxes */
.chks { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #c9ced6; cursor: pointer; }
.chk input { accent-color: var(--accent); margin: 0; }

/* palettes */
.pals { display: flex; gap: 6px; margin-bottom: 11px; flex-wrap: wrap; }
.pal {
  display: flex;
  border: 1.5px solid transparent;
  border-radius: 5px;
  padding: 2px;
  background: var(--panel-2);
  cursor: pointer;
  gap: 1px;
}
.pal i { width: 9px; height: 18px; display: block; }
.pal:first-child i:first-child { border-radius: 2px 0 0 2px; }
.pal i:last-child { border-radius: 0 2px 2px 0; }
.pal.on { border-color: var(--accent); }

.picks {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 10px;
  margin: 2px 0 11px;
}
.pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--dim);
}
.pick input[type="color"] {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

/* buttons */
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #d6dae0;
  font: inherit;
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover { border-color: #4a515b; color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { border-color: var(--line); color: #d6dae0; }

.lib { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.saved { display: flex; gap: 4px; align-items: stretch; }
.saved .name { flex: 1; text-align: left; }
.saved .name.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 620;
}
.saved .x { padding: 6px 8px; color: var(--dim); }
.saved .x:hover { color: var(--bad); border-color: var(--bad); }

.note kbd {
  background: var(--panel-2);
  border-radius: 3px;
  padding: 0 4px;
  font: inherit;
  font-size: 10.5px;
  color: #d6dae0;
}

/* catalogue presets: a dense grid, since there are nine and they are the
   fastest route to seeing what the app is for */
.presets { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.btn.preset { padding: 6px 4px; font-size: 11px; text-align: center; }
.btn.preset.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 620;
}

/* readout */
.readout .r {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  font-size: 11.5px;
  color: var(--dim);
  border-bottom: 1px dotted #2a2e35;
}
.readout .r:last-of-type { border-bottom: 0; }
.val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  text-align: right;
}
.val.big { font-size: 15px; font-weight: 650; }
.val.good { color: var(--good); }
.val.bad { color: var(--bad); }

.note {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--dim);
}
.note b { color: #c2c8d0; font-weight: 600; }
#rWarn:not(:empty) { color: var(--warn); }

/* -------------------------------------------------------------------- stage */

#stage-wrap { position: relative; overflow: hidden; }
#stage { width: 100%; height: 100%; display: block; touch-action: none; }

#hint {
  position: absolute;
  left: 14px;
  bottom: 12px;
  background: rgba(22, 24, 28, 0.82);
  color: #c8ccd3;
  font-size: 11px;
  line-height: 1.6;
  padding: 8px 11px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
  pointer-events: none;
  max-width: 340px;
}
#hint kbd {
  background: #31363e;
  border-radius: 3px;
  padding: 0 4px;
  font: inherit;
  font-size: 10.5px;
  color: #e6e9ee;
}

.shop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
}
.shop-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #c9ced6;
}
.shop-field select {
  max-width: 220px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 6px;
  font: inherit;
}
.shop-field input[type="number"] {
  width: 58px;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 5px;
  font: inherit;
}
.stl-row {
  align-items: flex-end;
}
.stl-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid var(--line);
}
.stl-group-lab {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b919a;
  margin-right: 2px;
}
.shop-field.is-off,
.shop-field.is-off input,
.shop-field.is-off select {
  opacity: 0.38;
}
.shop-field.is-off input,
.shop-field.is-off select {
  pointer-events: none;
}
.stl-hint { margin: 0 0 8px; }
.btn-small { font-size: 11px; padding: 3px 8px; }
.shop-kind-hide { display: none !important; }

.stl-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 10, 12, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.stl-panel {
  width: min(860px, 100%);
  height: min(640px, 100%);
  background: #1d2026;
  border: 1px solid #2f343c;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #e9e7e3;
  border-bottom: 1px solid #2f343c;
}
.stl-btns { display: flex; gap: 6px; flex-shrink: 0; }
.stl-warn {
  padding: 7px 12px;
  background: #3a2e14;
  color: #e0a83c;
  font-size: 12px;
}
.stl-cv {
  flex: 1;
  width: 100%;
  min-height: 240px;
  display: block;
  background: #191b1f;
}
.stl-foot {
  margin: 0;
  padding: 7px 12px;
  font-size: 11px;
  color: #939aa5;
  border-top: 1px solid #2f343c;
}

.export-preview {
  margin: 8px 0 12px;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.export-preview-cv {
  display: block;
  width: 100%;
  height: auto;
  background: #fbfaf7;
  border-radius: 3px;
}

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr 46vh; }
  #side { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  #stage-wrap { order: 1; }
}
