/* A small, practical settings sheet in the market's paper-and-ink palette. */
#settings-dialog {
  width: min(560px, calc(100% - 32px)); max-width: 560px;
  max-height: calc(100dvh - 24px); box-sizing: border-box;
  padding: 24px; overflow-y: auto; border: 2px solid #203b32;
  border-radius: 4px; background: #f5ebd5; color: #203b32;
  box-shadow: none; text-align: left;
}
#settings-dialog::backdrop { background: #102d25a6; backdrop-filter: none; }
.settings-header { position: relative; padding: 0 46px 17px 0; border-bottom: 1px solid #bcb49d; }
#settings-heading { margin: 0 0 7px; font-size: 28px; line-height: 1.2; font-weight: 850; letter-spacing: -.6px; }
#settings-save-note { margin: 0; font-size: 12px; line-height: 1.5; color: #53624d; word-break: keep-all; }
#settings-dialog .settings-close {
  position: absolute; top: 0; right: 0; width: 38px; height: 38px;
  min-width: 38px; min-height: 38px; padding: 8px;
  background: transparent; color: #203b32; border: 1px solid #a4ac96;
  border-radius: 3px; box-shadow: none;
}
.settings-close svg { width: 20px; height: 20px; }
.settings-body { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding: 20px 0; }
.settings-body > *, .settings-section { min-width: 0; }
.settings-section h3 { margin: 0 0 16px; font-size: 16px; line-height: 1.2; font-weight: 850; letter-spacing: -.2px; }
.settings-range-row + .settings-range-row { margin-top: 14px; }
.settings-range-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-range-label label { font-size: 13px; line-height: 1.4; font-weight: 650; }
.settings-range-label output { font-size: 13px; line-height: 1.4; font-weight: 800; font-variant-numeric: tabular-nums; }
#settings-dialog input[type="range"] {
  appearance: none; -webkit-appearance: none; display: block; width: 100%;
  height: 36px; margin: 1px 0 0; padding: 0; cursor: pointer;
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
  touch-action: pan-x;
}
#settings-dialog input[type="range"]::-webkit-slider-runnable-track { height: 5px; background: #c3c6ae; border-radius: 2px; }
#settings-dialog input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 24px; margin-top: -9.5px;
  border: 2px solid #203b32; border-radius: 3px; background: #f5ebd5;
}
#settings-dialog input[type="range"]::-moz-range-track { height: 5px; background: #c3c6ae; border-radius: 2px; }
#settings-dialog input[type="range"]::-moz-range-thumb { width: 16px; height: 20px; border: 2px solid #203b32; border-radius: 3px; background: #f5ebd5; }
#settings-dialog :is(button,input):focus-visible { outline: 3px solid #ac6f36; outline-offset: 3px; }
.settings-help { margin: 3px 0 0; color: #53624d; font-size: 11px; line-height: 1.5; word-break: keep-all; }
.settings-performance { margin-top: 22px; }
.settings-performance label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; cursor: pointer; }
.settings-performance input { width: 18px; height: 18px; margin: 0; accent-color: #183e34; }
.settings-performance kbd { margin-left: auto; padding: 1px 4px; font-size: 11px; }
#settings-performance-copy { margin-top: 8px; min-height: 32px; padding: 5px 9px; color: #203b32; background: transparent; border: 1px solid #82917b; border-radius: 3px; box-shadow: none; font-size: 12px; }
.performance-info { position: absolute; left: 16px; bottom: 14px; z-index: 22; display: grid; gap: 2px; padding: 8px 10px; border: 1px solid #d6c6a5; border-radius: 3px; background: #153b32ed; color: #fff5dc; font-size: 12px; line-height: 1.4; font-variant-numeric: tabular-nums; pointer-events: none; }
.performance-info[hidden] { display: none; }
.performance-info small { font-size: 10px; color: #cccdb5; }
@media (max-width: 850px), (pointer: coarse) {
  .performance-info { left: 50%; bottom: calc(8px + var(--mobile-safe-bottom, 0px)); transform: translateX(-50%); padding: 5px 8px; font-size: 10px; }
  .performance-info small { font-size: 9px; }
  .performance-key { display: none; }
}
.settings-layout-section { margin-top: 18px; }
.settings-layout-section h3 { margin-bottom: 10px; }
#settings-layout-button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 42px; padding: 8px 12px;
  color: #203b32; background: #fff9e9; border: 1px solid #82917b;
  border-radius: 3px; box-shadow: none; font-size: 13px; font-weight: 750;
}
#settings-layout-button svg { width: 17px; height: 17px; flex-shrink: 0; }
.settings-layout-section .settings-help { margin-top: 7px; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #bcb49d; padding-top: 15px; }
.settings-footer button { min-height: 42px; padding: 9px 14px; border-radius: 3px; font-size: 13px; line-height: 1.4; box-shadow: none; }
#settings-reset { padding-left: 0; background: transparent; color: #53624d; text-decoration: underline; text-underline-offset: 3px; }
#settings-done { min-width: 100px; border: 1px solid #183e34; background: #183e34; color: #fff5dc; font-weight: 800; }
#settings-done:hover { background: #285444; }
#settings-layout-button:hover { background: #eee3c9; }
@media (max-width: 850px), (pointer: coarse) {
  #settings-dialog { width: min(620px, calc(100% - 24px)); max-width: 620px; padding: 18px 22px; }
  #settings-dialog .settings-close { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }
  #settings-dialog button { min-height: 44px; }
}
@media (max-height: 450px) and (min-width: 500px) {
  #settings-dialog { padding: 14px 20px; max-height: calc(100dvh - 16px); }
  .settings-header { padding-bottom: 10px; }
  #settings-heading { font-size: 23px; margin-bottom: 4px; }
  #settings-save-note { font-size: 11px; }
  .settings-body { gap: 24px; padding: 13px 0 11px; }
  .settings-section h3 { font-size: 14px; margin-bottom: 9px; }
  .settings-range-row + .settings-range-row { margin-top: 8px; }
  .settings-layout-section { margin-top: 12px; }
  .settings-layout-section h3 { display: none; }
  .settings-layout-section .settings-help { margin-top: 4px; }
  .settings-footer { padding-top: 9px; }
  .settings-footer button { min-height: 40px; }
}
@media (max-width: 499px) {
  .settings-body { grid-template-columns: 1fr; gap: 20px; }
}
