:root {
  --pad: 16px;
  --gap: 12px;
  --radius: 10px;
  --border: 1px;
  --control-h: 42px;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font: 13px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
}

body[data-theme="light"] {
  background: #ffffff;
  color: #111111;
  color-scheme: light;
}

body[data-theme="dark"] {
  background: #111111;
  color: #eeeeee;
  color-scheme: dark;
}

#prefsRoot {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: var(--pad);
  overflow: hidden;
}

#header {
  text-align: center;
  margin-bottom: 10px;
}

#headerTitle {
  font-size: 22px;
  font-weight: 700;
}

.section {
  margin-top: 20px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.95;
  margin-bottom: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field {
  display: block;
  margin-bottom: var(--gap);
}

.label {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.95;
  margin-bottom: 6px;
}

input[type="text"], select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: var(--border) solid rgba(127,127,127,0.35);
  background: rgba(127,127,127,0.08);
  min-height: var(--control-h);
  height: auto;
  color: inherit;
  outline: none;
  font-size: 14px;
  line-height: 20px;
}

body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] select {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}

body[data-theme="light"] select option {
  background: #ffffff;
  color: #111111;
}

body[data-theme="dark"] select option {
  background: #1e1e1e;
  color: #eeeeee;
}

input[type="text"]:focus, select:focus {
  border-color: rgba(53,132,228,0.85);
  box-shadow: 0 0 0 3px rgba(53,132,228,0.25);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  border: var(--border) solid rgba(127,127,127,0.35);
  background: rgba(127,127,127,0.08);
}

body[data-theme="dark"] .segmented {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}

.segmented button {
  appearance: none;
  border: 1px solid transparent;
  margin: 0;
  padding: 10px 10px;
  min-height: var(--control-h);
  font: inherit;
  color: inherit;
  background: transparent;
}

.segmented button + button {
  border-left: var(--border) solid rgba(127,127,127,0.35);
}

body[data-theme="dark"] .segmented button + button {
  border-left-color: rgba(255,255,255,0.18);
}

.segmented button[aria-pressed="true"] {
  background: rgba(53,132,228,0.32);
  border-color: rgba(53,132,228,0.60);
  font-weight: 700;
}

body[data-theme="dark"] .segmented button[aria-pressed="true"] {
  background: rgba(53,132,228,0.48);
  border-color: rgba(53,132,228,0.70);
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-row .label { margin: 0; }
.field-row input[type="color"] { margin-left: auto; }
.field-row select { width: 180px; max-width: 180px; }

.bg-color-field {
  margin-bottom: 18px;
}

.select-compact {
  appearance: none;
  -webkit-appearance: none;
  width: 180px;
  max-width: 180px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  min-height: 0;
  line-height: 16px;
  height: auto;
  border: 1px solid rgba(127,127,127,0.35);
  background: rgba(127,127,127,0.08);
  color: inherit;
  outline: none;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-row input[type="range"] {
  width: 100%;
}

.slider-value {
  min-width: 44px;
  text-align: right;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

#restoreDefaults {
  appearance: none;
  -webkit-appearance: none;
  border: var(--border) solid rgba(127,127,127,0.35);
  background: rgba(127,127,127,0.08);
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: default;
}

body[data-theme="dark"] #restoreDefaults {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.18);
}

#restoreDefaults:focus {
  border-color: rgba(53,132,228,0.85);
  box-shadow: 0 0 0 3px rgba(53,132,228,0.25);
}
