:root { --ui-text-factor: 1; }
/* Browser-default form fonts do not inherit the document size. Theme rules
   retain precedence over this zero-specificity fallback. */
:where(button, input, select, textarea) { font-size: calc(13.333333px * var(--ui-text-factor)); }
.settings-text-size-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px; border: 1px solid #31534f; border-radius: 10px; background: #10282b; }
.settings-text-size-copy { flex: 1 1 220px; min-width: 0; }
.settings-text-size-copy b, .settings-text-size-copy small { display: block; }
.settings-text-size-copy b { color: #e0f4ec; font-size: calc(13px * var(--ui-text-factor)); }
.settings-text-size-copy small { margin-top: 5px; color: #a8c6c0; font-size: calc(11px * var(--ui-text-factor)); line-height: 1.4; }
.settings-text-size-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.settings-text-size-actions .settings-stepper { flex-shrink: 0; }
#settings-text-size-value { min-width: 4em; text-align: center; }
.settings-text-size-actions button { min-height: 32px; height: auto; padding: 6px 10px; font-size: calc(12px * var(--ui-text-factor)); cursor: pointer; }
.settings-text-size-actions button:disabled { opacity: .45; cursor: default; }
#settings-text-size-reset { border: 1px solid #486966; border-radius: 6px; color: #d8f2e8; background: #102023; }
#ui-text-size-status { position: fixed; z-index: 2147483000; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); box-sizing: border-box; padding: 10px 14px; border: 1px solid #5a998d; border-radius: 8px; background: #0b252aee; color: #e5fff5; text-align: center; font: 600 calc(12px * var(--ui-text-factor))/1.4 Arial, sans-serif; pointer-events: none; }
#ui-text-size-status[hidden] { display: none; }
/* Let enlarged labels wrap in menus, keeping dialog actions reachable. */
:root[data-ui-text-enlarged] .settings-section-title { flex-wrap: wrap; gap: 6px; }
:root[data-ui-text-enlarged] .settings-content { min-height: 0; overflow: auto; }
:root[data-ui-text-enlarged] .settings-footer { flex-wrap: wrap; gap: 8px; }
:root[data-ui-text-enlarged] .settings-stepper { width: auto; }
:root[data-ui-text-enlarged] .settings-stepper button { min-height: 1.8em; }
:root[data-ui-text-enlarged] #settings-system .settings-header { height: auto !important; padding-block: 14px !important; }
:root[data-ui-text-enlarged] #settings-system .settings-header h2 { overflow-wrap: anywhere; }
:root[data-ui-text-enlarged] #settings-system .settings-footer { height: auto !important; }
:root[data-ui-text-enlarged] #settings-system .settings-toggle-row > span:nth-child(2) { min-width: 0; }
:root[data-ui-text-enlarged] #settings-system .settings-toggle-row :is(b, small) { display: block; overflow-wrap: anywhere; }
:root[data-ui-text-enlarged] #settings-system .settings-stepper { height: auto !important; grid-template-columns: minmax(2.2em, auto) minmax(4em, auto) minmax(2.2em, auto) !important; width: fit-content !important; overflow: visible; font-size: calc(12px * var(--ui-text-factor)); }
:root[data-ui-text-enlarged] #settings-system .settings-stepper button { width: auto !important; height: auto !important; }
:root[data-ui-text-large] #settings-system .settings-content { grid-template-columns: minmax(0, 1fr) !important; }
:root[data-ui-text-large] #settings-system .settings-opacity-card { flex-wrap: wrap; gap: 10px; }
:root[data-ui-text-enlarged] #pokedex-system .pokedex-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, calc(130px * var(--ui-text-factor))), 1fr)) !important; }
:root[data-ui-text-enlarged] #pokedex-system .dex-tile,
:root[data-ui-text-enlarged] #pokedex-system .dex-tile > button { height: auto !important; max-height: none !important; min-height: calc(115px + 70px * var(--ui-text-factor)) !important; }
:root[data-ui-text-enlarged] #pokedex-system .pokedex-cards { grid-auto-rows: auto !important; }
:root[data-ui-text-enlarged] #pokedex-system .dex-tile > button { grid-template-rows: auto 76px auto auto auto !important; gap: 6px; }
:root[data-ui-text-enlarged] #pokedex-system .dex-tile-top { flex-wrap: wrap; gap: 4px; }
:root[data-ui-text-enlarged] #pokedex-system .dex-tile strong { white-space: normal !important; overflow-wrap: anywhere; }
:root[data-ui-text-enlarged] #inventory-category-tabs { display: flex !important; flex-wrap: wrap !important; height: auto !important; max-height: none !important; gap: 4px !important; }
:root[data-ui-text-enlarged] #inventory-category-tabs button { flex: 1 0 auto; width: auto !important; min-width: 4em; height: auto !important; min-height: 2em; padding: 5px !important; }
:root[data-ui-text-enlarged] .inventory-title { flex-wrap: wrap; height: auto !important; min-height: 44px; gap: 4px; }
:root[data-ui-text-enlarged] .inventory-title > span { min-width: 0; }
:root[data-ui-text-enlarged] #stage .mainbar-group-toggle { min-width: calc(52px + 20px * var(--ui-text-factor)); }
:root[data-ui-text-enlarged] #stage .mainbar-group-label { white-space: normal !important; overflow-wrap: anywhere; text-overflow: clip !important; max-height: none !important; line-height: 1.1 !important; }
