:root {
  --bg: #000;
  --panel: #0e0e10;
  --panel-hi: #18181b;
  --line: #26262b;
  --text: #fafafa;
  --muted: #8a8a93;
  --accent: #fff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px calc(48px + env(safe-area-inset-bottom));
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.power {
  flex: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-hi);
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background .15s ease, border-color .15s ease;
}
.power .knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .16s ease, background .16s ease;
}
.power[data-checked] { background: #103a1c; border-color: #1f7a3a; }
.power[data-checked] .knob { transform: translateX(22px); background: #2ecc71; }
.power:focus-visible { outline: 2px solid #5b8cff; outline-offset: 2px; }
.power:disabled { opacity: .5; cursor: default; }

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.error {
  background: #2a1213;
  border: 1px solid #5b1f22;
  color: #ffb4b4;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.control {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.ctl-label { font-size: 13px; font-weight: 550; color: var(--text); }
.ctl-val {
  font-size: 13px;
  color: var(--muted);
  width: 3ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.slider:focus-visible { outline: 2px solid #5b8cff; outline-offset: 4px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 12px;
}

.card {
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}
.card:hover { background: var(--panel-hi); }
.card:active { transform: scale(0.98); }
.card:focus-visible { outline: 2px solid #5b8cff; outline-offset: 2px; }

.card[data-pressed] {
  border-color: var(--accent);
  background: var(--panel-hi);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.preview {
  width: 84px;
  height: 84px;
  image-rendering: pixelated;
  border-radius: 8px;
  background: #000;
  border: 1px solid var(--line);
  display: block;
}

.label {
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: -0.01em;
}
