/* Preferences stay compact; only story text uses the reader's chosen scale. */
:root { --reading-scale: 1; }
.speech-text { font-size: calc(17px * var(--reading-scale)); }
#narratorText { font-size: calc(16px * var(--reading-scale)); }
#log .history-dialogue, #log .history-narration { font-size: calc(15px * var(--reading-scale)); }
#suggest .chip { font-size: calc(14px * var(--reading-scale)); }
html[data-reading-contrast="high"] .speech,
html[data-reading-contrast="high"] .speech::after { background: #fff6df; border-color: #967747; color: #191711; }
html[data-reading-contrast="high"] #narrationBox { background: #152019; border-color: #ddc796; color: #fff7e5; }
html[data-reading-contrast="high"] #suggest .chip { background: #152019; color: #fff7e5; border-color: #ddc796; }
html[data-reading-contrast="high"] #narratorText:empty::after { color: #e2d6b9; }
html[data-reading-motion="reduced"] *,
html[data-reading-motion="reduced"] *::before,
html[data-reading-motion="reduced"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
#modalSettings { z-index: 75; padding: 20px; }
.preferences-card.card {
  width: 100%; max-width: 560px; padding: 26px 30px 22px; text-align: left;
  max-height: min(88dvh, 820px); background: #f3ecdc; border-color: #baaa88; scrollbar-width: thin;
}
.preferences-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.preferences-kicker { color: var(--vermilion); font-size: 11px; letter-spacing: .18em; margin-bottom: 7px; }
.preferences-heading h2 { font-size: 26px; font-weight: normal; letter-spacing: .12em; }
.preferences-heading .link-btn { font-size: 13px; text-decoration: none; padding: 7px 0 7px 10px; }
.preferences-preview { border: 1px solid #cbbb97; border-left: 3px solid var(--vermilion); background: #faf4e5; padding: 14px 17px; margin-bottom: 15px; }
.preferences-preview-label { color: #8a5b3d; font-size: 11px; letter-spacing: .12em; margin-bottom: 6px; }
.preferences-preview p { color: #302b22; font-size: calc(17px * var(--reading-scale)); line-height: 1.8; }
html[data-reading-contrast="high"] .preferences-preview { color: #191711; background: #fff6df; border-color: #967747; }
.preference-row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #c9bc9e85; }
.preference-row label, .preference-label { font-size: 15px; color: #3c3529; }
.preference-row small { display: block; color: #80745f; font-size: 11px; line-height: 1.6; margin-top: 4px; }
.preference-row select { width: 100%; font-family: inherit; color: #3c3529; border: 1px solid #bcab89; background: #faf4e8; font-size: 14px; padding: 8px 12px; border-radius: 2px; }
.preference-control { min-width: 0; }
.preference-control output { display: block; font-size: 12px; color: #796440; text-align: right; margin-bottom: 7px; }
.preference-control input[type="range"] { width: 100%; margin: 4px 0; accent-color: var(--vermilion); cursor: pointer; }
.preference-control input[type="range"]:disabled { opacity: .35; cursor: default; }
.preference-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.preference-control .preference-check { font-size: 11px; color: #74664f; margin-top: 8px; }
.preference-check input { width: 17px; height: 17px; accent-color: var(--vermilion); flex: 0 0 auto; }
.preference-toggle-row { grid-template-columns: 1fr; }
.preference-toggle-row .preference-check { display: flex; justify-content: space-between; width: 100%; }
.preferences-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.preferences-footer .btn-sub { margin: 0; padding: 9px 14px; font-size: 13px; }
.preferences-footer .btn-main { font-size: 14px; padding: 10px 25px; }
#preferencesSaveState { margin-top: 12px; color: #7b705b; font-size: 11px; line-height: 1.6; min-height: 18px; }
@media (max-width: 760px) {
  .speech-text, #narratorText { font-size: calc(14px * var(--reading-scale)); }
  #suggest .chip { font-size: calc(13px * var(--reading-scale)); }
  #modalSettings { padding: 12px; }
  .preferences-card.card { padding: 20px 20px 17px; max-height: calc(100dvh - 24px); }
  .preferences-heading { margin-bottom: 15px; }
  .preferences-heading h2 { font-size: 23px; }
  .preferences-preview p { font-size: calc(14px * var(--reading-scale)); }
  .preference-row { padding-block: 12px; gap: 15px; grid-template-columns: 1fr 1.05fr; }
  .preference-toggle-row { grid-template-columns: 1fr; }
  .preference-row label, .preference-label { font-size: 14px; }
  #screenTitle .atlas-header { flex-wrap: wrap; }
  #screenTitle .atlas-header-actions { margin-left: auto; }
  #screenTitle #btnSettingsHome { padding-inline: 6px; }
}
@media (max-height: 610px) and (min-width: 761px) {
  #narratorText { font-size: calc(14px * var(--reading-scale)); }
}
