/*
  Settings panel. Feels like a device settings sheet, not an admin form.
  Desktop: right-side panel. Mobile: full-height bottom sheet.
*/

.settings-scrim {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  z-index: 45;
}

.settings {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100%);
  background: var(--paper-surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -6px 0 24px var(--surface-shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
  font-family: var(--ui-font);
  color: var(--ink);
}

.settings__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.settings__title {
  font-size: 1.05rem;
  font-weight: 700;
}

.settings__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 18px 24px;
}

.settings__section {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 0;
}
.settings__section:last-child { border-bottom: none; }

.settings__section > h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}

.field label {
  font-size: 0.92rem;
  color: var(--ink-soft);
  flex: 0 0 auto;
}

.field__control {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.field select,
.field input[type="range"] {
  font: inherit;
}

.field select {
  min-height: 38px;
  padding: 6px 10px;
  background: var(--paper-bg);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  max-width: 190px;
}

.field input[type="range"] {
  width: 150px;
  accent-color: var(--ink-soft);
}

.field__value {
  min-width: 46px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* Segmented control for small option sets (mode, intensity, contrast). */
.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented button {
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-right: 1px solid var(--line-soft);
  background: var(--paper-bg);
  min-height: 38px;
}
.segmented button:last-child { border-right: none; }

.segmented button[aria-pressed="true"] {
  background: var(--ink-soft);
  color: var(--paper-bg);
}

/* Font selector shows each font rendered as a sample line. */
.field select.font-select option {
  font-size: 1rem;
}

/* Advanced diagnostics stays collapsed by default. */
.settings details {
  margin-top: 4px;
}
.settings summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  list-style: none;
}
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: "▸ "; }
.settings details[open] summary::before { content: "▾ "; }

.log-view {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--code-bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--mono-font);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.settings__footer {
  display: flex;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.kbd-ref {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.kbd-ref kbd {
  font-family: var(--mono-font);
  font-size: 0.78em;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper-bg);
}
