:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #110f10;
  color: #f5f0ec;
  --panel: #1c1819;
  --line: #3b3235;
  --muted: #b6aaaa;
  --red: #a51d35;
  --gold: #d4af63;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; }
button, input { font: inherit; }

button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242022;
  color: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) { background: #34282d; }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.primary {
  background: var(--red);
  border-color: transparent;
  font-weight: 600;
}

.primary:hover:not(:disabled) { background: #b92540; }

.panel {
  width: min(34rem, calc(100% - 32px));
  margin: clamp(24px, 10vh, 100px) auto;
  padding: clamp(14px, 4vw, 22px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.device-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  gap: 8px;
}

.device-list button {
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.device-list button[aria-pressed="true"] {
  border-color: #9b7945;
  background: #352a24;
}

.device-detail {
  display: block;
  color: var(--muted);
  font-size: .75rem;
}

.sliders { margin: 20px 0 12px; }
.slider-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: .85rem;
}

output { color: #edd8a8; font-variant-numeric: tabular-nums; }

input[type="range"] {
  --thumb: 16px;
  --track: 4px;
  --track-fill: linear-gradient(to right, var(--red) var(--fill, 0%), #4b4245 var(--fill, 0%));
  display: block;
  appearance: none;
  width: 100%;
  height: 30px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]:disabled { opacity: .45; cursor: default; }

input[type="range"]::-webkit-slider-runnable-track {
  height: var(--track);
  border-radius: 999px;
  background: var(--track-fill);
}

input[type="range"]::-moz-range-track {
  height: var(--track);
  border-radius: 999px;
  background: var(--track-fill);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: calc((var(--track) - var(--thumb)) / 2);
  border: 3px solid var(--red);
  border-radius: 50%;
  background: #ead8b4;
}

input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--thumb);
  height: var(--thumb);
  border: 3px solid var(--red);
  border-radius: 50%;
  background: #ead8b4;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .primary { flex: 1; }

.status { margin: 0; color: var(--muted); font-size: .85rem; }
.status.error { color: #ffadb8; }
.feedback:not(:empty) { margin-top: 12px; }

.utilities {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 13px;
}

.utilities button { min-height: 30px; padding: 4px 8px; font-size: .8rem; }
#profile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  color: var(--gold);
  font-size: .8rem;
}

#avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

dialog {
  width: min(25rem, calc(100% - 32px));
  max-width: none;
  padding: 18px;
  border: 1px solid #564146;
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  box-shadow: 0 14px 42px #0009;
}

dialog::backdrop {
  background: rgb(12 9 10 / 64%);
  backdrop-filter: blur(9px);
}

dialog label { display: block; margin-bottom: 8px; font-size: .85rem; }
.login-row { display: flex; gap: 8px; }

#password {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #110f10;
  color: inherit;
}
