#settings {
  width: min(490px, calc(100vw - 20px));
  max-width: none; max-height: calc(100dvh - 20px);
  padding: 0; margin: auto; overflow: hidden;
  color: var(--text); background: #131614;
  border: 1px solid #414842; border-radius: 20px;
  box-shadow: 0 24px 90px #000c;
}
#settings::backdrop { background: #000a; }
#preferences { display: flex; flex-direction: column; max-height: inherit; }
.dialog-heading, .actions, .settings-tabs, .settings-preview { flex-shrink: 0; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 6px; }
.dialog-heading h1 { margin: 0; font-size: 22px; font-weight: 630; letter-spacing: -.04em; }
.settings-preview { margin: 6px 20px 12px; border: 1px solid #313a34; border-radius: 10px;
  background: #090b0a; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; }
.preview-meta { display: grid; gap: 5px; min-width: 0; }
.preview-label { color: var(--mint); font-size: 12px; font-weight: 650; }
#preview-state, .subtle, .mode-note { color: #adb6ae; font-size: 12px; }
.sample-clock { display: flex; gap: 4px; flex: none; }
.sample-clock .tile { width: 48px; height: 43px; border-radius: 4px; }
.settings-tabs { display: flex; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.settings-tabs button { border: 0; padding: 5px 0 10px; color: var(--muted); background: transparent;
  border-bottom: 2px solid transparent; font-size: 13px; font-weight: 600; }
.settings-tabs [aria-selected=true] { border-color: var(--mint); color: var(--text); }
.form-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0;
  scrollbar-color: #465048 #141714; padding: 17px 20px 16px; }
#preferences fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
#preferences legend, .focus-line h2 { padding: 0; font-size: 14px; font-weight: 650; margin: 0 0 9px; }
.focus-line { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 15px; }
.focus-line h2 { margin: 0 0 2px; }
.focus-line .step-field { flex-direction: row; align-items: center; gap: 8px; }
.step-field { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.value-box { display: flex; align-items: center; gap: 3px; background: #1c211d;
  border: 1px solid #3c453d; color: #bac3bc; border-radius: 6px; padding: 4px 8px; }
.value-box:focus-within { outline: 2px solid var(--mint); outline-offset: 1px; }
.value-box input { color: var(--text); background: transparent; width: 3.1em; padding: 1px 0;
  border: none; border-radius: 0; font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }
.value-box input:focus-visible { outline: 0; }
.value-box span { white-space: nowrap; font-size: 11px; }
.choices, .font-options { display: grid; gap: 5px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.choices label, .font-options label { position: relative; display: grid; place-items: center; cursor: pointer;
  min-height: 34px; border: 1px solid #3c453e; border-radius: 7px; background: #1a1e1b; color: #bcc3bd; font-size: 12px; }
.choices input, .font-options input { position: absolute; width: 100%; height: 100%; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.choices label:has(:checked), .font-options label:has(:checked) { background: #203429; color: #a8edbf; border-color: #538465; }
.choices label:has(:focus-visible), .font-options label:has(:focus-visible) { outline: 2px solid var(--mint); outline-offset: 2px; }
.mode-note { margin: 7px 0 12px; line-height: 1.4; }
.break-block { border-top: 1px solid var(--line); padding: 5px 0 12px; }
.break-block:last-child { border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.field-pair { display: grid; gap: 12px; grid-template-columns: 1.2fr 1fr; }
.field-pair:disabled { opacity: .5; }
.switch { display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 13px; cursor: pointer; }
.break-toggle { font-weight: 630; }
.switch input { appearance: none; flex: 0 0 32px; width: 32px; height: 18px; margin: 0;
  background: #272d29; border: 1px solid #5d685e; border-radius: 16px; cursor: pointer; }
.switch input::after { content: ''; display: block; margin: 2px; width: 12px; height: 12px; border-radius: 50%; background: #bcc3bd; }
.switch input:checked { border-color: var(--mint); background: var(--mint); }
.switch input:checked::after { transform: translateX(13px); background: #15321d; }
.font-options { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 14px; }
.font-options label { gap: 2px; min-height: 80px; padding: 8px 2px; }
.font-demo { color: var(--text); font-size: 30px; line-height: 1; font-weight: 700; }
.condensed { font-family: var(--clock-font); }.sans { font-family: "Segoe UI", sans-serif; }.mono { font-family: Consolas, monospace; }
#palette-help { margin: -3px 0 9px; }
.palette-options { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 10px; }
.palette-options label { display: flex; justify-content: center; gap: 6px; padding: 4px; }
.palette-swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }
@media(max-width: 340px) { .palette-options { grid-template-columns: repeat(2,minmax(0,1fr)); } }
.actions { display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-top: 1px solid var(--line); }
.actions button { padding: 8px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 13px; }
.actions button:hover { background: #303631; }.actions .save { background: var(--mint); color: #102417; font-weight: 650; }
.actions .save:hover { background: #a2efbd; }
#download { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; color: var(--muted); text-decoration: none; font-size: 12px; }
#download:hover { color: var(--mint); }
@media(max-width: 360px) {
  .form-body, .dialog-heading, .settings-tabs, .actions { padding-inline: 12px; }
  .settings-preview { margin-inline: 12px; padding-inline: 9px; }.field-pair { gap: 6px; }
  .value-box { padding-inline: 4px; }.value-box input { width: 2.8em; }
  #download span { display: none; }.sample-clock .tile { width: 38px; height: 33px; }
}
@media(max-width: 275px) { .field-pair { grid-template-columns: 1fr; }.focus-line .step-field { flex-direction:column; }
  .settings-preview { flex-wrap: wrap; }.focus-line { gap: 5px; }.actions { gap: 2px; }.actions button { padding-inline: 6px; } }
@media(max-height: 460px) { .settings-preview { margin-block: 0 5px; padding-block: 3px; }
  .dialog-heading { padding-block: 3px 0; }.sample-clock .tile { height: 28px; width: 38px; }
  .form-body { padding-block: 9px; }.actions { padding-block: 5px; } }

#save-error { margin: 0; padding: .5rem 1.25rem; color: #ffb6aa; font-size: .82rem; }
