* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; }

body {
  font: 400 var(--fs-md)/1.45 var(--font-ui);
  letter-spacing: 0;
  background: var(--bg-0);
  color: var(--text-1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ---------- icons ---------- */
svg.i {
  width: 14px;
  height: 14px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

/* ---------- form controls ---------- */
input[type="text"],
input[type="number"],
select {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font: 400 var(--fs-sm)/1.3 var(--font-mono);
  padding: 4px 7px;
  outline: 0;
  min-width: 0;
  transition: border-color 0.1s var(--ease);
}
select { font-size: var(--fs-sm); flex: 1; }

input:focus-visible, select:focus-visible {
  border-color: var(--accent);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238b929c' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
  padding-right: 22px;
  cursor: pointer;
}
select:hover { border-color: var(--border-3); }

/* custom range: thin filled track + square thumb (fill % via --p, set in JS) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 16px;
  background: transparent;
  cursor: ew-resize;
  --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--accent) 0 var(--p),
    var(--bg-4, #23262b) var(--p) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  border-radius: 2px;
  background: var(--text-1);
  border: 1px solid var(--bg-0);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s var(--ease), background 0.08s var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.2);
  background: #ffffff;
}
input[type="range"]:focus-visible { outline: 1px solid var(--accent-border); outline-offset: 2px; border: none; }
input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--bg-4, #23262b);
}
input[type="range"]::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 1px solid var(--bg-0);
  border-radius: 2px;
  background: var(--text-1);
}

input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 30px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  cursor: pointer;
  flex: none;
  transition: border-color 0.1s var(--ease);
}
input[type="color"]:hover { border-color: var(--border-3); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 1px; }

/* custom checkbox: crisp square + stroke check */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  flex: none;
  border: 1px solid var(--border-2);
  border-radius: 2px;
  background: var(--bg-1);
  cursor: pointer;
  transition: border-color 0.1s var(--ease), background 0.1s var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--border-3); }
input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='7' viewBox='0 0 9 7'><path d='M1 3.4L3.4 5.8 8 1' fill='none' stroke='%230b0c0e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}
input[type="checkbox"]:focus-visible { outline: 1px solid var(--accent-border); outline-offset: 1px; }
input[type="file"] { display: none; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border-radius: 4px;
  border: 2px solid var(--bg-1);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- utility text ---------- */
.hint {
  color: var(--text-3);
  font: 400 var(--fs-sm)/1.55 var(--font-text);
  margin-top: 7px;
}
.val {
  font: 500 var(--fs-xs)/1 var(--font-mono);
  color: var(--text-2);
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
kbd {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 0 4px;
  font: 500 var(--fs-xs)/1.5 var(--font-mono);
  color: var(--text-2);
}
