/* Keep the mode control visible on the homepage and chapter pages. */
#mdbook-menu-bar .left-buttons { display: flex; align-items: center; }
.color-mode-control { display: inline-flex; gap: 2px; padding: 3px; margin-inline: 6px; border: 1px solid var(--theme-popup-border); border-radius: 10px; background: var(--theme-popup-bg); line-height: normal; }
.color-mode-control button { padding: 5px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--fg); font-size: 12px; white-space: nowrap; cursor: pointer; }
.color-mode-control button[aria-pressed="true"] { background: var(--links); color: var(--bg); }
.color-mode-control button:disabled { cursor: not-allowed; opacity: .45; }
#mdbook-theme-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(660px, calc(100vw - var(--sidebar-width) - 40px));
    max-height: min(70dvh, 540px); overflow-y: auto; padding: 6px;
    box-sizing: border-box;
}
html:not(.sidebar-visible) #mdbook-theme-list { width: min(660px, calc(100vw - 32px)); }
#mdbook-theme-list .theme { height: 100%; white-space: normal; text-wrap: balance; }
@media (max-width: 1100px) {
    #mdbook-theme-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    #mdbook-theme-list, html:not(.sidebar-visible) #mdbook-theme-list { width: calc(100vw - 32px); }
    #mdbook-theme-list .theme { gap: 6px; padding-inline-end: 8px; }
}
#mdbook-theme-list .theme { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 7px 14px; }
.theme-dual-mode { font-size: 18px; color: var(--links); line-height: 1; }
html[data-book-theme] { --search-mark-bg: color-mix(in srgb, var(--links) 25%, var(--bg)); }
html[data-color-mode="light"] { --color-scheme: light; }
html[data-color-mode="dark"] { --color-scheme: dark; }
html[data-book-theme]:not([data-book-theme="light"]):not([data-book-theme="rust"]):not([data-book-theme="coal"]):not([data-book-theme="navy"]):not([data-book-theme="ayu"]) .hljs { background: var(--obs-code-bg); color: var(--obs-code-fg); }
html[data-book-theme] main h1 { color: var(--obs-h1, var(--fg)); }
html[data-book-theme] main h2 { color: var(--obs-h2, var(--fg)); }
html[data-book-theme] main h3 { color: var(--obs-h3, var(--fg)); }
html[data-book-theme] main h4 { color: var(--obs-h4, var(--fg)); }
html[data-book-theme] main h5 { color: var(--obs-h5, var(--fg)); }
html[data-book-theme] main h6 { color: var(--obs-h6, var(--fg)); }
@media (max-width: 600px) {
    .color-mode-control { margin-inline: 2px; }
    .color-mode-control button { padding: 6px; }
    #mdbook-menu-bar .menu-title { display: none; }
}
@media print { .color-mode-control { display: none; } }
/* Reserve the checkmark column so selecting a theme never moves its label. */
#mdbook-theme-list .theme { position: relative; justify-content: flex-start; padding-inline-start: 24px; }
#mdbook-theme-list .theme-selected::before { position: absolute; inset-inline-start: 7px; margin: 0; width: 12px; }
.theme-dual-mode { margin-inline-start: auto; }
