/* Issue #321 app-shell appearance: accent palettes, density and explicit
   light/dark choice. Everything here is opt-in.
   用户要求把「默认」配色和「经典」对调，所以 default 不再留空：它现在带的是
   经典（番茄）配色的强调色，选「默认」看到的就是以前选「经典」的那套颜色。 */
:root[data-app-accent="default"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #ff806b;
  --m3-on-primary: #2a0f0a;
  --m3-primary-container: #5c1f14;
  --m3-on-primary-container: #ffd9d1;
  --m3-secondary: #e0a82e;
  --m3-on-secondary: #241a04;
  --m3-secondary-container: #4a380a;
  --m3-on-secondary-container: #f7e3ae;
  --accent: #e85d47;
  --accent-2: #e0a82e;
  --accent-text: #ff806b;
  --accent-2-text: #efbd4d;
  --on-accent: #2a0f0a;
  --danger: #e76363;
  --danger-text: #ff9b9b;
}

:root[data-app-accent="field"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #6ee7a8;
  --m3-on-primary: #04361f;
  --m3-primary-container: #14532d;
  --m3-on-primary-container: #b6f5d0;
  --m3-surface: #101614;
  --m3-on-surface: #e4f2ea;
  --m3-surface-variant: #3c4a42;
  --m3-on-surface-variant: #c5d5cb;
  --m3-surface-container-lowest: #0b100e;
  --m3-surface-container-low: #171e1a;
  --m3-surface-container: #1c2621;
  --m3-surface-container-high: #26312b;
  --m3-surface-container-highest: #313c36;
  --m3-outline: #8a9a90;
  --m3-outline-variant: #3c4a42;
  --m3-secondary: #b6e6c6;
  --m3-on-secondary: #123a24;
  --m3-secondary-container: #1f4a32;
  --m3-on-secondary-container: #cdf3dc;
  --m3-tertiary: #9ad6ff;
  --m3-on-tertiary: #00344f;
  --m3-tertiary-container: #0b4a6b;
  --m3-on-tertiary-container: #c6e9ff;
  --accent: #6ee7a8;
  --accent-2: #9ad6ff;
  --accent-text: #6ee7a8;
  --accent-2-text: #9ad6ff;
  --on-accent: #04361f;
  --mint: #6ee7a8;
  --mint-text: #8ef0bd;
  --info: #9ad6ff;
}

:root[data-app-accent="lemon"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #f5d648;
  --m3-on-primary: #3a2f00;
  --m3-primary-container: #524500;
  --m3-on-primary-container: #ffe98a;
  --m3-surface: #16140c;
  --m3-on-surface: #f6efd8;
  --m3-surface-variant: #4a4330;
  --m3-on-surface-variant: #d8ceb0;
  --m3-surface-container-lowest: #100e08;
  --m3-surface-container-low: #201c12;
  --m3-surface-container: #272216;
  --m3-surface-container-high: #322c1e;
  --m3-surface-container-highest: #3d3626;
  --m3-outline: #a89878;
  --m3-outline-variant: #4a4330;
  --m3-secondary: #e3d08a;
  --m3-on-secondary: #372c00;
  --m3-secondary-container: #4a3f10;
  --m3-on-secondary-container: #f4e6a8;
  --m3-tertiary: #ffbe8a;
  --m3-on-tertiary: #4a2400;
  --m3-tertiary-container: #663a12;
  --m3-on-tertiary-container: #ffd9b8;
  --accent: #f5d648;
  --accent-2: #ffbe8a;
  --accent-text: #f5d648;
  --accent-2-text: #ffbe8a;
  --on-accent: #3a2f00;
  --mint: #f5d648;
  --mint-text: #ffe98a;
  --info: #ffbe8a;
}

:root[data-app-accent="ink"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #e6e6e6;
  --m3-on-primary: #1a1a1a;
  --m3-primary-container: #3a3a3a;
  --m3-on-primary-container: #f0f0f0;
  --m3-surface: #121212;
  --m3-on-surface: #e8e8e8;
  --m3-surface-variant: #444444;
  --m3-on-surface-variant: #c8c8c8;
  --m3-surface-container-lowest: #0c0c0c;
  --m3-surface-container-low: #1a1a1a;
  --m3-surface-container: #212121;
  --m3-surface-container-high: #2c2c2c;
  --m3-surface-container-highest: #383838;
  --m3-outline: #8e8e8e;
  --m3-outline-variant: #444444;
  --m3-secondary: #c4c4c4;
  --m3-on-secondary: #1f1f1f;
  --m3-secondary-container: #333333;
  --m3-on-secondary-container: #e4e4e4;
  --m3-tertiary: #9c9c9c;
  --m3-on-tertiary: #1f1f1f;
  --m3-tertiary-container: #2c2c2c;
  --m3-on-tertiary-container: #d6d6d6;
  --accent: #e6e6e6;
  --accent-2: #9c9c9c;
  --accent-text: #e6e6e6;
  --accent-2-text: #9c9c9c;
  --on-accent: #1a1a1a;
  --mint: #b9b9b9;
  --mint-text: #d2d2d2;
  --info: #9c9c9c;
}

:root[data-app-accent="dusk"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #b9a7ff;
  --m3-on-primary: #22124d;
  --m3-primary-container: #3b2a75;
  --m3-on-primary-container: #e4dcff;
  --m3-surface: #12101a;
  --m3-on-surface: #ebe6f7;
  --m3-surface-variant: #453e5c;
  --m3-on-surface-variant: #cdc4e0;
  --m3-surface-container-lowest: #0c0a12;
  --m3-surface-container-low: #1a1724;
  --m3-surface-container: #211d2c;
  --m3-surface-container-high: #2c2738;
  --m3-surface-container-highest: #383244;
  --m3-outline: #988eae;
  --m3-outline-variant: #453e5c;
  --m3-secondary: #cbb8f2;
  --m3-on-secondary: #2a1a4f;
  --m3-secondary-container: #402f66;
  --m3-on-secondary-container: #e8ddff;
  --m3-tertiary: #ffb3c8;
  --m3-on-tertiary: #4d0d26;
  --m3-tertiary-container: #6a1a3c;
  --m3-on-tertiary-container: #ffd9e3;
  --accent: #b9a7ff;
  --accent-2: #ffb3c8;
  --accent-text: #b9a7ff;
  --accent-2-text: #ffb3c8;
  --on-accent: #22124d;
  --mint: #7fe0c4;
  --mint-text: #a5f0da;
  --info: #b9a7ff;
}

:root[data-app-accent="sakura"]:not([data-theme="light"]):not([data-theme="classic"]) {
  --m3-primary: #ffa3c0;
  --m3-on-primary: #4a0f27;
  --m3-primary-container: #6b1e3e;
  --m3-on-primary-container: #ffd9e6;
  --m3-surface: #181014;
  --m3-on-surface: #f8e8ee;
  --m3-surface-variant: #543844;
  --m3-on-surface-variant: #e4c8d4;
  --m3-surface-container-lowest: #110c10;
  --m3-surface-container-low: #22161c;
  --m3-surface-container: #2a1c24;
  --m3-surface-container-high: #36242e;
  --m3-surface-container-highest: #422e38;
  --m3-outline: #b08a98;
  --m3-outline-variant: #543844;
  --m3-secondary: #e9b6c9;
  --m3-on-secondary: #44213a;
  --m3-secondary-container: #5a3348;
  --m3-on-secondary-container: #f7d8e5;
  --m3-tertiary: #ffc0a3;
  --m3-on-tertiary: #4a2000;
  --m3-tertiary-container: #66330f;
  --m3-on-tertiary-container: #ffdfcb;
  --accent: #ffa3c0;
  --accent-2: #ffc0a3;
  --accent-text: #ffa3c0;
  --accent-2-text: #ffc0a3;
  --on-accent: #4a0f27;
  --mint: #8fe3c8;
  --mint-text: #b0f0de;
  --info: #ffa3c0;
}

/* The accent attribute belongs to the root. Inherit its selected roles instead
   of letting the Windows shell override them, or self-referencing a variable. */
:root[data-app-accent]:not([data-theme="light"]):not([data-theme="classic"]) body.windows-shell,
:root[data-theme="light"][data-app-accent]:not([data-app-accent="default"]) body.windows-shell {
  --m3-primary: inherit;
  --m3-on-primary: inherit;
  --m3-primary-container: inherit;
  --m3-on-primary-container: inherit;
  --m3-secondary: inherit;
  --m3-on-secondary: inherit;
  --m3-secondary-container: inherit;
  --m3-on-secondary-container: inherit;
}

/* A selected segment needs a visible marker even when light-theme surfaces
   have similar luminance. The inset line does not change control geometry. */
body.windows-shell .format-toggle-button.active,
body.windows-shell .format-toggle-button[aria-pressed="true"] {
  background: var(--m3-primary-container);
  color: var(--m3-on-primary-container);
  box-shadow: inset 0 -3px 0 var(--m3-primary);
}

:root[data-theme="light"][data-app-accent="field"],
body.windows-shell[data-theme="light"][data-app-accent="field"] {
  --m3-primary: #1f6b3f;
  --m3-on-primary: #ffffff;
  --m3-primary-container: #bff2d3;
  --m3-on-primary-container: #0a3d21;
  --m3-surface: #f3faf5;
  --m3-on-surface: #161d19;
  --m3-surface-variant: #d5e6db;
  --m3-on-surface-variant: #3c4a42;
  --m3-surface-container-lowest: #ffffff;
  --m3-surface-container-low: #edf6f0;
  --m3-surface-container: #e4f0e8;
  --m3-surface-container-high: #dbe9e0;
  --m3-surface-container-highest: #d2e2d8;
  --m3-outline: #6c7b72;
  --m3-outline-variant: #bbcbc1;
  --m3-secondary: #4f6357;
  --m3-on-secondary: #ffffff;
  --m3-secondary-container: #d2e8da;
  --m3-on-secondary-container: #1d3527;
  --m3-tertiary: #3a6374;
  --m3-on-tertiary: #ffffff;
  --m3-tertiary-container: #cfe9f5;
  --m3-on-tertiary-container: #16323e;
  --accent: #1f6b3f;
  --accent-2: #3a6374;
  --accent-text: #1f6b3f;
  --accent-2-text: #2c5261;
  --on-accent: #ffffff;
  --mint: #168268;
  --mint-text: #106b57;
  --info: #286aa8;
}

:root[data-theme="light"][data-app-accent="lemon"],
body.windows-shell[data-theme="light"][data-app-accent="lemon"] {
  --m3-primary: #7a6100;
  --m3-on-primary: #ffffff;
  --m3-primary-container: #ffe98a;
  --m3-on-primary-container: #3f3400;
  --m3-surface: #fbf8ef;
  --m3-on-surface: #1d1b12;
  --m3-surface-variant: #e8e0c8;
  --m3-on-surface-variant: #4a4330;
  --m3-surface-container-lowest: #ffffff;
  --m3-surface-container-low: #f5f0e2;
  --m3-surface-container: #efe8d4;
  --m3-surface-container-high: #e7dfc8;
  --m3-surface-container-highest: #dfd6ba;
  --m3-outline: #7a7058;
  --m3-outline-variant: #cfc6ae;
  --m3-secondary: #635b3f;
  --m3-on-secondary: #ffffff;
  --m3-secondary-container: #efe4bc;
  --m3-on-secondary-container: #3a3419;
  --m3-tertiary: #8a4a12;
  --m3-on-tertiary: #ffffff;
  --m3-tertiary-container: #ffdcbd;
  --m3-on-tertiary-container: #4a2400;
  --accent: #7a6100;
  --accent-2: #8a4a12;
  --accent-text: #6a5400;
  --accent-2-text: #7a3f0d;
  --on-accent: #ffffff;
  --mint: #7a6100;
  --mint-text: #5c4a00;
  --info: #8a4a12;
}

:root[data-theme="light"][data-app-accent="ink"],
body.windows-shell[data-theme="light"][data-app-accent="ink"] {
  --m3-primary: #2b2b2b;
  --m3-on-primary: #ffffff;
  --m3-primary-container: #dedede;
  --m3-on-primary-container: #1a1a1a;
  --m3-surface: #f7f7f7;
  --m3-on-surface: #1a1a1a;
  --m3-surface-variant: #e0e0e0;
  --m3-on-surface-variant: #444444;
  --m3-surface-container-lowest: #ffffff;
  --m3-surface-container-low: #f0f0f0;
  --m3-surface-container: #e8e8e8;
  --m3-surface-container-high: #e0e0e0;
  --m3-surface-container-highest: #d6d6d6;
  --m3-outline: #747474;
  --m3-outline-variant: #c4c4c4;
  --m3-secondary: #4d4d4d;
  --m3-on-secondary: #ffffff;
  --m3-secondary-container: #e6e6e6;
  --m3-on-secondary-container: #262626;
  --m3-tertiary: #5f5f5f;
  --m3-on-tertiary: #ffffff;
  --m3-tertiary-container: #eaeaea;
  --m3-on-tertiary-container: #2a2a2a;
  --accent: #2b2b2b;
  --accent-2: #5f5f5f;
  --accent-text: #2b2b2b;
  --accent-2-text: #4a4a4a;
  --on-accent: #ffffff;
  --mint: #3d3d3d;
  --mint-text: #2a2a2a;
  --info: #4d4d4d;
}

:root[data-theme="light"][data-app-accent="dusk"],
body.windows-shell[data-theme="light"][data-app-accent="dusk"] {
  --m3-primary: #5b3fc4;
  --m3-on-primary: #ffffff;
  --m3-primary-container: #e4dcff;
  --m3-on-primary-container: #2a1a63;
  --m3-surface: #f7f4fc;
  --m3-on-surface: #1b1724;
  --m3-surface-variant: #e4dced;
  --m3-on-surface-variant: #463f56;
  --m3-surface-container-lowest: #ffffff;
  --m3-surface-container-low: #f1ecf8;
  --m3-surface-container: #eae4f4;
  --m3-surface-container-high: #e2daee;
  --m3-surface-container-highest: #d9d0e6;
  --m3-outline: #776e88;
  --m3-outline-variant: #c8bfd4;
  --m3-secondary: #5d5470;
  --m3-on-secondary: #ffffff;
  --m3-secondary-container: #e6dff5;
  --m3-on-secondary-container: #2b2438;
  --m3-tertiary: #8c4059;
  --m3-on-tertiary: #ffffff;
  --m3-tertiary-container: #ffd9e3;
  --m3-on-tertiary-container: #4a0f26;
  --accent: #5b3fc4;
  --accent-2: #8c4059;
  --accent-text: #5136b3;
  --accent-2-text: #7a3750;
  --on-accent: #ffffff;
  --mint: #2f6f60;
  --mint-text: #235449;
  --info: #4a3ba8;
}

:root[data-theme="light"][data-app-accent="sakura"],
body.windows-shell[data-theme="light"][data-app-accent="sakura"] {
  --m3-primary: #a83260;
  --m3-on-primary: #ffffff;
  --m3-primary-container: #ffd9e6;
  --m3-on-primary-container: #4a0f27;
  --m3-surface: #fdf6f8;
  --m3-on-surface: #22161b;
  --m3-surface-variant: #f0dce4;
  --m3-on-surface-variant: #564048;
  --m3-surface-container-lowest: #ffffff;
  --m3-surface-container-low: #faeef2;
  --m3-surface-container: #f6e6ec;
  --m3-surface-container-high: #f0dce4;
  --m3-surface-container-highest: #e8d2dc;
  --m3-outline: #8a6e78;
  --m3-outline-variant: #d8c0ca;
  --m3-secondary: #74565f;
  --m3-on-secondary: #ffffff;
  --m3-secondary-container: #f7d8e5;
  --m3-on-secondary-container: #3a2630;
  --m3-tertiary: #8a4a12;
  --m3-on-tertiary: #ffffff;
  --m3-tertiary-container: #ffdcbd;
  --m3-on-tertiary-container: #4a2400;
  --accent: #a83260;
  --accent-2: #8a4a12;
  --accent-text: #972c58;
  --accent-2-text: #7a3f0d;
  --on-accent: #ffffff;
  --mint: #1f6b5f;
  --mint-text: #185449;
  --info: #a83260;
}

/* Issue #321 appearance option groups hold 3-6 choices. They used to need their
   own width and column overrides; the base .format-toggle now auto-fits its
   columns and the settings field rule above stretches it to the field, so those
   overrides are gone. Accent and density stay as wrapping pills, which reads
   better for six swatches. */
#settingsAppAccent,
#settingsAppDensity {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

#settingsAppAccent .format-toggle-button,
#settingsAppDensity .format-toggle-button {
  width: auto;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--m3-outline);
  border-radius: var(--m3-shape-full);
}

/* Density. Only spacing tokens change; no component markup is touched, so the
   "page looks too busy" complaint is answered without a template rewrite. */
:root {
  --density-gap: 1;
  --density-pad: 1;
  --density-radius: 1;
  --density-row: 1;
}

:root[data-app-density="compact"] {
  --density-gap: 0.7;
  --density-pad: 0.75;
  --density-radius: 0.85;
  --density-row: 0.82;
}

:root[data-app-density="roomy"] {
  --density-gap: 1.25;
  --density-pad: 1.2;
  --density-radius: 1.1;
  --density-row: 1.15;
}

.view-stack,
.settings-grid,
.app-shell {
  gap: calc(var(--density-gap) * 1rem);
}

/* Issue #391: the tab bar carries .panel-shell too, and this density padding
   (loaded after responsive.css) silently replaced the navigation-bar
   reservation there — the fixed bottom bar then sat on top of the Android
   3-button keys. The tab bar keeps its own padding rules in shell.css and
   responsive.css, so the density rules must not touch it. The reader header
   is excluded for the same reason: its padding reserves the safe area and the
   in-page Android status strip (components.css / responsive.css), and the
   compact preset's 0.75rem used to win and slide the back button under the
   strip, leaving only its lower half visible. Every full-screen top bar now
   carries .safe-top-chrome (safe-area.css), so the exclusion is by that class:
   a new full-screen page cannot be caught by the presets again.
   #436: the reader footer is excluded too. It also carries .panel-shell, and
   the preset's flat padding replaced its bottom reservation
   (calc(... + --reader-bottom-inset) in components.css / responsive.css), so
   neither the navigation bar nor the user's 额外底部留白 ever reached the book
   reader's bottom bar; its labels were drawn under the Android keys. The
   footer keeps the preset's spacing below, plus the reservation. */
.view-stack > .view,
.settings-card,
.panel-shell:not(.tabbar):not(.safe-top-chrome):not(.reader-footer) {
  padding: calc(var(--density-pad) * 1.05rem);
}

:root[data-app-density="compact"] .view-stack > .view,
:root[data-app-density="compact"] .settings-card,
:root[data-app-density="compact"] .panel-shell:not(.tabbar):not(.safe-top-chrome):not(.reader-footer) {
  padding: 0.75rem;
}

:root[data-app-density="roomy"] .view-stack > .view,
:root[data-app-density="roomy"] .settings-card,
:root[data-app-density="roomy"] .panel-shell:not(.tabbar):not(.safe-top-chrome):not(.reader-footer) {
  padding: 1.25rem;
}

/* #436：阅读器底栏沿用密度预设的间距，底部再加上安全区域（导航栏 +
   额外底部留白，见 --reader-bottom-inset），左右让开横屏时的挖孔和导航栏。 */
#readerFooter {
  --reader-footer-pad: calc(var(--density-pad) * 1.05rem);
}

:root[data-app-density="compact"] #readerFooter {
  --reader-footer-pad: 0.75rem;
}

:root[data-app-density="roomy"] #readerFooter {
  --reader-footer-pad: 1.25rem;
}

.reader-overlay #readerFooter {
  padding:
    var(--reader-footer-pad)
    calc(var(--reader-footer-pad) + var(--safe-area-right, 0px))
    calc(var(--reader-footer-pad) + var(--reader-bottom-inset, var(--safe-area-bottom, 0px)))
    calc(var(--reader-footer-pad) + var(--safe-area-left, 0px));
}

.settings-card,
.panel-shell {
  border-radius: calc(var(--radius-lg) * var(--density-radius));
}

.view-stack > .view > * + *,
.settings-card > * + * {
  margin-top: calc(var(--density-gap) * 0.75rem);
}

/* Issue #321: when the platform status bar is restored the in-page strip steps
   aside, so nothing reserves its height. Collapsing the shared token is enough:
   the app shell and the other paddings all derive from it, and the real status
   bar inset arrives from MainActivity as --native-inset-top (#436). */
body:not(.immersive-system-bars) {
  --mobile-system-bar-height: 0px;
}

body:not(.immersive-system-bars) .mobile-system-bar {
  display: none !important;
}

/* Issue #354: the always-hidden status bar switch (#351) only stopped the
   native inset reservation. The band the reporter could still see over the
   reader header is the strip this app draws itself, which looks exactly like a
   system status bar and kept eating the title because nothing consulted
   hide_status_bar here. Collapse it the same way immersive-off does, so every
   padding derived from the token collapses with it. */
body.hide-status-bar {
  --mobile-system-bar-height: 0px;
}

body.hide-status-bar .mobile-system-bar {
  display: none !important;
}

/* Issue #462: some ROMs (iReader Neo 2 / Android 10 e-ink) keep the platform
   status bar on screen in immersive mode. MainActivity then reserves its real
   height as --native-inset-top and flags it, and the in-page strip steps aside
   exactly like immersive-off, instead of painting a second bar under it. */
body.platform-status-bar-shown {
  --mobile-system-bar-height: 0px;
}

body.platform-status-bar-shown .mobile-system-bar {
  display: none !important;
}

/* Issue #433：墨水屏界面优化。纯黑白、无阴影、无动画；压过所有明暗和配色。 */
:root[data-eink-ui="on"],
:root[data-eink-ui="on"] body {
  color-scheme: light !important;
  --bg-0: #ffffff !important;
  --bg-1: #ffffff !important;
  --bg-2: #ffffff !important;
  --panel: #ffffff !important;
  --panel-2: #ffffff !important;
  --panel-3: #ffffff !important;
  --panel-strong: #ffffff !important;
  --overlay-soft: #ffffff !important;
  --text: #000000 !important;
  --text-2: #000000 !important;
  --text-3: #000000 !important;
  --muted: #000000 !important;
  --line: #000000 !important;
  --line-strong: #000000 !important;
  --accent: #000000 !important;
  --accent-2: #000000 !important;
  --accent-text: #000000 !important;
  --accent-2-text: #000000 !important;
  --on-accent: #ffffff !important;
  --mint: #000000 !important;
  --mint-text: #000000 !important;
  --info: #000000 !important;
  --shadow: none !important;
  --m3-elevation-1: none !important;
  --m3-elevation-2: none !important;
  --m3-elevation-3: none !important;
  --m3-primary: #000000 !important;
  --m3-on-primary: #ffffff !important;
  --m3-primary-container: #ffffff !important;
  --m3-on-primary-container: #000000 !important;
  --m3-secondary: #000000 !important;
  --m3-on-secondary: #ffffff !important;
  --m3-secondary-container: #ffffff !important;
  --m3-on-secondary-container: #000000 !important;
  --m3-tertiary: #000000 !important;
  --m3-on-tertiary: #ffffff !important;
  --m3-tertiary-container: #ffffff !important;
  --m3-on-tertiary-container: #000000 !important;
  --m3-surface: #ffffff !important;
  --m3-on-surface: #000000 !important;
  --m3-surface-variant: #ffffff !important;
  --m3-on-surface-variant: #000000 !important;
  --m3-surface-container-lowest: #ffffff !important;
  --m3-surface-container-low: #ffffff !important;
  --m3-surface-container: #ffffff !important;
  --m3-surface-container-high: #ffffff !important;
  --m3-surface-container-highest: #ffffff !important;
  --m3-outline: #000000 !important;
  --m3-outline-variant: #000000 !important;
  --m3-scrim: rgba(255, 255, 255, 0.9) !important;
  --scrollbar-thumb: #000000 !important;
  --scrollbar-thumb-strong: #000000 !important;
  --scrollbar-track: #ffffff !important;
  background: #ffffff !important;
  color: #000000 !important;
}

:root[data-eink-ui="on"] body *,
:root[data-eink-ui="on"] body *::before,
:root[data-eink-ui="on"] body *::after {
  animation: none !important;
  transition: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

:root[data-eink-bold="on"] body {
  -webkit-text-stroke: 0.35px currentColor;
}

:root[data-eink-border="on"] body :is(button, input, select, textarea, [class*="card"], [class*="panel"], [class*="chip"], [class*="tab"], .text-input) {
  border-width: 2px !important;
  border-color: #000000 !important;
}

.eink-ui-settings {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

/* Issue #472: side margins on phones, set by the user with a slider (local
   setting, 0-24px, default 18px = unchanged). --mobile-gutter is the distance
   from the screen edge (inside the safe area) to the cards. It is split over
   the same layers as the default layout: page frame max(0, g - 12px), page
   min(g, 12px), so 18px gives the default 6px + 12px and 6px gives the old
   "narrow margins" switch (0 + 6px). Card padding follows from 8px (g <= 6px)
   to 12px (g >= 18px). The attribute is only set when the value is not the
   default. The reader keeps its own margins; tablets, landscape and desktop
   are unchanged. */
.mobile-gutter-settings {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.mobile-gutter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3.5em;
  align-items: center;
  column-gap: 10px;
  max-width: 520px;
}

.mobile-gutter-reset {
  grid-column: 1 / -1;
  justify-self: start;
}

.mobile-gutter-row input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
}

.mobile-gutter-row output {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Tablets and phones in landscape: the slider has no effect there, so it is
   shown greyed out and cannot be dragged; app.js toggles .is-inactive and the
   "only on a phone in portrait" line when the screen turns. */
.mobile-gutter-settings.is-inactive .mobile-gutter-row input[type="range"]:disabled {
  opacity: 0.4;
  filter: grayscale(1);
  cursor: not-allowed;
}

.mobile-gutter-settings.is-inactive .mobile-gutter-row output,
.mobile-gutter-settings.is-inactive > .field-label {
  opacity: 0.55;
}

.mobile-gutter-inactive-hint[hidden] {
  display: none;
}

body:not(.mobile-shell) .mobile-gutter-settings {
  display: none;
}

/* Keep this condition the same as MOBILE_GUTTER_MEDIA in app.js. */
@media (max-width: 720px) and (orientation: portrait) {
  :root[data-mobile-gutter="custom"] body.mobile-shell .app-shell {
    padding-left: calc(var(--safe-area-left, 0px) + max(0px, var(--mobile-gutter, 18px) - 12px));
    padding-right: calc(var(--safe-area-right, 0px) + max(0px, var(--mobile-gutter, 18px) - 12px));
  }

  :root[data-mobile-gutter="custom"] body.mobile-shell .view-stack > .view {
    padding-left: min(var(--mobile-gutter, 18px), 12px);
    padding-right: min(var(--mobile-gutter, 18px), 12px);
  }

  :root[data-mobile-gutter="custom"] body.mobile-shell .view-stack > .view .panel-shell:not(.tabbar):not(.safe-top-chrome):not(.reader-footer) {
    padding-left: clamp(8px, calc(6px + var(--mobile-gutter, 18px) / 3), 12px);
    padding-right: clamp(8px, calc(6px + var(--mobile-gutter, 18px) / 3), 12px);
  }
}
