:root {
  color-scheme: dark;
  --bg-0: #0f181e;
  --bg-1: #16232b;
  --bg-2: #1c2c36;
  --bg-sunken: #111c23;
  --scrim: rgba(4, 9, 13, 0.66);
  --line-1: rgba(195, 228, 232, 0.07);
  --line-2: rgba(195, 228, 232, 0.11);
  --line-3: rgba(195, 228, 232, 0.20);
  --ink-1: #edf4f4;
  --ink-2: #bccbc9;
  --ink-3: #869896;
  --ink-4: #5e706e;
  --accent: #72d8c4;
  --accent-tint: rgba(114, 216, 196, 0.13);
  --accent-solid: #42bfa8;
  --amber: #ebb782;
  --amber-tint: rgba(235, 183, 130, 0.13);
  --up: #88d6a3;
  --up-tint: rgba(136, 214, 163, 0.13);
  --down: #eb9a92;
  --down-tint: rgba(235, 154, 146, 0.13);
  --warn: #dfb972;
  --warn-tint: rgba(223, 185, 114, 0.13);
  --chart-line: #5fd4a8;
  --chart-glow: rgba(95, 212, 168, 0.28);
  --chart-guide: rgba(95, 212, 168, 0.56);
  --chart-dot-ring: #111c23;
  --pill: rgba(195, 222, 226, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg-0); }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--ink-1);
  font: 14px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: 0.42; cursor: default; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Global Sticky Header (blur isolated on ::before so mobile fixed nav is never trapped) */
header {
  position: sticky;
  top: 0;
  z-index: 14;
  height: 56px;
  border-bottom: 1px solid var(--line-1);
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(15, 24, 30, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.bar {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-1);
  flex: none;
}
.brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}
nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 100%;
}
nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color 140ms var(--ease);
}
.navBadge {
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}
@media (hover: hover) {
  nav button:hover { color: var(--ink-1); }
}
nav button[aria-pressed="true"] {
  color: var(--ink-1);
  font-weight: 600;
}
nav button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.headStats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.headStats b { color: var(--ink-2); font-weight: 600; }
.appDlBtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(114, 216, 196, 0.34);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.appDlBtn svg { width: 13px; height: 13px; flex: none; }
@media (hover: hover) {
  .appDlBtn:hover {
    background: rgba(114, 216, 196, 0.22);
    border-color: rgba(114, 216, 196, 0.55);
  }
}
.themeBtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--pill);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), color 140ms var(--ease);
}
.themeBtn svg { width: 13.5px; height: 13.5px; flex: none; }
.themeBtn .thMoon { color: var(--amber); }
.themeBtn .thSun { color: #d97706; }
html:not([data-theme="light"]) .themeBtn .thSun { display: none; }
html[data-theme="light"] .themeBtn .thMoon { display: none; }
@media (hover: hover) {
  .themeBtn:hover {
    background: var(--bg-2);
    border-color: var(--line-3);
    color: var(--ink-1);
  }
}

/* Main Layout */
main, footer {
  max-width: 1400px;
  margin: 0 auto;
  padding-inline: 24px;
}
main {
  padding-top: 16px;
  padding-bottom: 24px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  column-gap: 20px;
  align-items: start;
}
main > .filters { grid-column: 1; grid-row: 1 / span 12; }
main > :not(.filters) { grid-column: 2; min-width: 0; }
body.sideCollapsed main { grid-template-columns: minmax(0, 1fr); }
body.sideCollapsed main > :not(.filters) { grid-column: 1; }
body.sideCollapsed .filters { display: none; }

/* Banner (.mast) with 4 anime characters + left-dark right-clear gradient scrim */
.mast {
  position: relative;
  overflow: hidden;
  min-height: 122px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1) url(search-1440.webp) center 38% / cover no-repeat;
  display: flex;
  align-items: center;
}
.rankMode .mast { background-image: url(rank-1440.webp); }
.sweepMode .mast { background-image: url(night-1440.webp); }
.debutMode .mast { background-image: url(debut-1440.webp); }
.mast::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(92deg, rgba(12, 20, 26, 0.96) 0%, rgba(12, 20, 26, 0.86) 42%, rgba(12, 20, 26, 0.34) 76%, rgba(12, 20, 26, 0.14) 100%),
    linear-gradient(180deg, rgba(12, 20, 26, 0.12) 0%, rgba(12, 20, 26, 0.42) 100%);
}
.mastInner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 540px;
}
.mastHead {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.mast h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-1);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
.mastSub {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-2);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
}
.helpBtn {
  background: rgba(16, 27, 34, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--accent);
  border: 1px solid rgba(114, 216, 196, 0.28);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.helpBtn[aria-expanded="true"], .helpBtn:hover {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.5);
}
.modeHelp {
  margin-top: 9px;
  padding: 10px 13px;
  border-radius: 10px;
  background: rgba(14, 24, 30, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-3);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.62;
}
.modeHelp p { margin: 0 0 5px; }
.modeHelp p:last-child { margin: 0; }
.rankMode #searchForm { display: none; }

.search {
  margin: 11px 0 0;
  height: 40px;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border-radius: 11px;
  background: rgba(14, 23, 29, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(195, 228, 232, 0.16);
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.search:focus-within {
  border-color: rgba(114, 216, 196, 0.5);
  background: rgba(14, 23, 29, 0.9);
}
.searchIcon {
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  flex: none;
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink-1);
  font-size: 13.5px;
  padding: 0;
  outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-solid);
  color: #0b1b18;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  flex: none;
  transition: filter 140ms var(--ease);
}
.search button:hover { filter: brightness(1.06); }

.mastRankBar {
  margin-top: 11px;
  min-height: 40px;
  width: fit-content;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  padding: 5px 11px;
  border-radius: 11px;
  background: rgba(14, 23, 29, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(195, 228, 232, 0.16);
}
.mastRankBar .rankDateLbl {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
}
.popBtn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12.5px;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.popBtn:hover, .popBtn[aria-expanded="true"] {
  border-color: var(--line-3);
}
.popVal {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.popChev {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--ink-3);
  transition: transform 140ms var(--ease);
}
.popBtn[aria-expanded="true"] .popChev {
  transform: rotate(180deg);
  color: var(--accent);
}
#rankDateBtn {
  height: 28px;
  padding: 0 9px;
}
#dayBtn {
  height: 28px;
  padding: 0 9px;
}
#rankState {
  font-size: 12px;
  color: var(--ink-2);
}
#rankRetry {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  border: 0;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.rankDateWrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Segmented Mode Bars (below banner) */
.modeBar {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
}
.modeGroup {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.modeGroup > strong {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
}
.segOpts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-sunken);
  flex-wrap: wrap;
}
.segOpts button {
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.4;
  background: transparent;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.segOpts button:hover { color: var(--ink-1); }
.segOpts button[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.modeBar select {
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12.5px;
}
.modeNote {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: auto;
}
.modeFoot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.modeFoot .modeNote { margin-left: 0; }
.modeResetBtn {
  display: none;
  flex: none;
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: var(--amber-tint);
  color: var(--amber);
  font-size: 11.5px;
  font-weight: 600;
}

/* Left Sticky Sidebar & Filter Pills */
.filters {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  position: sticky;
  top: 70px;
  max-height: calc(100dvh - 86px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sideHead {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-1);
}
.sideHead b {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-1);
}
.sideToggleBtn {
  border: 0;
  background: var(--pill);
  color: var(--ink-3);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12px;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.sideToggleBtn:hover { background: var(--bg-2); color: var(--ink-1); }

.sheetTitle { display: none; }
.filtersMain {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(195, 228, 232, 0.16) transparent;
}
.filtersMain::-webkit-scrollbar { width: 5px; }
.filtersMain::-webkit-scrollbar-thumb { background: rgba(195, 228, 232, 0.16); border-radius: 99px; }

.filterrow {
  padding: 11px 0;
  border-bottom: 1px solid var(--line-1);
}
.filterrow:last-of-type { border-bottom: 0; }
.filterHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.filterHead strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
}
.secToggle {
  border: 0;
  background: transparent;
  padding: 1px 4px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}
.secToggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.grpHeadBtn {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  color: inherit;
}
.grpHeadBtn .grpMeta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-4);
  margin-left: auto;
}
.grpHeadBtn .grpMeta.on { color: var(--accent); font-weight: 600; }
.grpHeadBtn .grpChevron {
  font-size: 11px;
  color: var(--ink-4);
  transition: transform 140ms var(--ease);
}
.filterrow.grpCollapsed .filterHead { margin-bottom: 0; }
.filterrow.grpCollapsed .grpBody { display: none; }
.filterrow.grpCollapsed .grpChevron { transform: rotate(-90deg); }

.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opts button {
  border: 0;
  border-radius: 7px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.35;
  padding: 5px 9px;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
@media (hover: hover) {
  .opts button:hover {
    background: rgba(195, 222, 226, 0.14);
    color: var(--ink-1);
  }
}
.opts button[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(114, 216, 196, 0.36);
}
.opts button small {
  font-size: 11px;
  color: var(--ink-4);
  margin-left: 4px;
}
.opts button[aria-pressed="true"] small { color: rgba(114, 216, 196, 0.78); }

#category, #allCats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
#category button, #allCats button {
  width: 100%;
  text-align: center;
  padding: 5px 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#catpanel { margin-top: 6px; }
#catpanel .panelend {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
#closeCats {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  background: var(--pill);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
#closeCats:hover { background: var(--accent-tint); text-decoration: none; }

.custom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
}
.custom label { display: inline-flex; align-items: center; gap: 4px; }
.custom input {
  width: 64px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  padding: 0 7px;
  color: var(--ink-1);
  font-size: 12.5px;
}
#ageScope, #scoreScope, #statusScope {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-4);
  line-height: 1.45;
}

.sideSavedBar {
  flex: none;
  padding: 10px 14px;
  border-top: 1px solid var(--line-1);
  background: var(--bg-sunken);
}
.sideSavedBtns {
  display: flex;
  gap: 8px;
}
.sideSavedBtns button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.sideSavedBtns button:hover { background: var(--bg-2); color: var(--ink-1); }
#savedNotice {
  display: block;
  font-size: 11.5px;
  color: var(--accent);
  margin-top: 5px;
}
#savedNotice:empty { display: none; }
#sheetWarning {
  font-size: 12px;
  color: var(--warn);
  padding: 6px 0 0;
}
#sheetWarning:empty { display: none; }
.sheetFoot { display: none; }

/* Tag Panel (Desktop centered floating modal) */
@media (min-width: 681px) {
  body.deskTagOpen::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 24;
    background: var(--scrim);
    backdrop-filter: blur(4px);
  }
  .tagpanel {
    position: fixed;
    z-index: 25;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 40px));
    max-height: min(600px, calc(100dvh - 80px));
    background: var(--bg-1);
    border: 1px solid var(--line-3);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .tagSubHead {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-1);
  }
  .tagSubHead b { font-size: 15px; font-weight: 650; }
  .subBack, .subClear {
    border: 0;
    background: var(--pill);
    color: var(--ink-2);
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 12.5px;
  }
  .tagSubTop {
    flex: none;
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--line-1);
  }
  .tagSearchWrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 11px;
    border-radius: 9px;
    background: var(--bg-sunken);
    border: 1px solid var(--line-2);
  }
  .tagSearchWrap input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink-1);
    font-size: 13px;
    outline: none;
  }
  .tagSubMeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--ink-4);
  }
  #allTags.taggrid {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px 16px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    align-content: start;
  }
  #allTags.taggrid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 6px;
    min-height: 46px;
  }
  #allTags.taggrid button small {
    margin: 2px 0 0;
    font-size: 10.5px;
  }
  .tagpanel .panelend {
    flex: none;
    display: flex;
    justify-content: flex-end;
    padding: 10px 16px;
    background: var(--bg-sunken);
    border-top: 1px solid var(--line-1);
  }
  .tagpanel .panelend .sheetApply {
    height: 34px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent-solid);
    color: #0b1b18;
    font-size: 13px;
    font-weight: 650;
  }
}

.tagSelChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tagSelChip {
  border: 0;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

/* Results Sticky Toolbar & Active Filter Bar */
.results {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin: 14px 0 8px;
  padding: 6px 0;
}
.resLeft {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.results h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  line-height: 1.35;
}
.results h2 .cntNum {
  font-weight: 700;
  color: var(--ink-1);
}
#introScope {
  font-size: 12px;
  color: var(--ink-3);
}
.syncBadge {
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-tint);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 4px;
  font-weight: 500;
}
.syncBadge.warn {
  color: var(--warn);
  background: var(--warn-tint);
}
.syncRetryBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 10px;
  margin-left: 4px;
  vertical-align: middle;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.syncRetryBtn:hover {
  background: var(--accent-solid);
  color: #0b1b18;
}
.empty .syncRetryBtn {
  margin: 12px auto 0;
  display: inline-flex;
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
}
.viewtools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.expandSideBtn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  display: none;
}
body.sideCollapsed .expandSideBtn { display: inline-flex; align-items: center; }
.sortWrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
}
#sortBtn {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 12.5px;
}
.viewSeg {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 2px;
  border-radius: 8px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  gap: 2px;
}
.viewSeg button {
  height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.viewSeg button[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.quickReset {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: var(--amber-tint);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.activeBar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--bg-1);
  border: 1px solid var(--line-1);
}
.activeLbl {
  font-size: 12px;
  color: var(--ink-4);
  flex: none;
}
.activeBar .opts button[data-remove] {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 500;
}
.activeBar .quiet {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  padding: 2px 6px;
}
.activeBar .quiet:hover { color: var(--ink-1); }

#warning {
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-tint);
  border-radius: 9px;
  padding: 7px 12px;
  margin-bottom: 10px;
}
#warning:empty { display: none; }

/* Quick Filter Bar (mobile only) */
.quick { display: none; }

/* Book Card Grid */
.list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
@media (min-width: 1440px) {
  body.sideCollapsed .list:not(.dense) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.denseHead { display: none; }

.book {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
@media (hover: hover) {
  .book:hover {
    background: var(--bg-2);
    border-color: var(--line-3);
  }
}
.book.trendOpen {
  grid-column: 1 / -1;
}

.lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: start;
}
.leadMain { min-width: 0; }
.book h3 {
  margin: 0 0 4px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.38;
  overflow-wrap: anywhere;
  display: flex;
  align-items: flex-start;
  gap: 7px;
}
.rankPosBadge {
  flex: none;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  background: var(--accent-tint);
  color: var(--accent);
}
.rankPosBadge.top3 {
  background: var(--amber-tint);
  color: var(--amber);
}
.book h3 a.nameLink {
  color: var(--ink-1);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 140ms var(--ease);
}
@media (hover: hover) {
  .book:hover h3 a.nameLink { color: var(--accent); }
}
.bookmeta {
  display: flex;
  align-items: center;
  gap: 4px 7px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
}
.bookmeta .primary {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.bookmeta .primary:hover { text-decoration: underline; text-underline-offset: 3px; }
.spec {
  margin-top: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px 7px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-3);
}
.scoreBadge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex: none;
  white-space: nowrap;
}
.scoreBadge .scoreNum {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.scoreBadge.high .scoreNum { color: var(--amber); }
.scoreBadge.good .scoreNum { color: var(--accent); }
.scoreBadge.mid .scoreNum { color: var(--ink-2); }
.scoreBadge .scoreCnt {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
}
.specSep {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--line-3);
  flex: none;
}
.specMeta {
  color: var(--ink-3);
}
.denseScore { display: none; }
.list.dense .denseScore {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
  font-weight: 600;
}
.list.dense .denseScore.high { color: var(--amber); }
.list.dense .denseScore.good { color: var(--accent); }
.list.dense .denseScore.mid { color: var(--ink-2); }
.list.dense .denseScore .scoreCnt {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.list.sortByComments .scoreBadge .scoreCnt,
.list.dense.sortByComments .denseScore .scoreCnt {
  color: var(--accent);
  font-weight: 600;
}
.list.sortByScore .scoreBadge {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--amber-tint);
}
.list.sortByScore .scoreBadge.good { background: var(--accent-tint); }
.list.sortByScore .scoreBadge.mid { background: var(--pill); }

/* Rank Mode Declutter & Simple 100-Book Full-Width Layout */
.rankMode #count,
.rankMode .sortWrap,
.rankMode .viewSeg { display: none; }
.rankMode .results:not(.hasRankTool) { display: none; }
body.rankSimple main { grid-template-columns: minmax(0, 1fr); }
body.rankSimple main > :not(.filters) { grid-column: 1; }
body.rankSimple .filters,
body.rankSimple .expandSideBtn,
body.rankSimple .quick,
body.rankSimple .results,
body.rankSimple .activeBar { display: none !important; }
@media (min-width: 1440px) {
  body.rankSimple .list:not(.dense) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tinted Tag Chips with subtle right fade mask */
.cardTags {
  margin-top: 7px;
  overflow: hidden;
}
.tagline {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 88%, transparent 100%);
  padding-right: 12px;
}
.tagline::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  text-decoration: none;
  border: 0;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11.5px;
  line-height: 1.4;
  background: var(--pill);
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.chip:hover {
  background: var(--accent-tint);
  color: var(--accent);
}
.chip.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

/* Right-placed Cover with underlying vertical Songti CSS Tiqian fallback */
.cover {
  position: relative;
  display: block;
  width: 72px;
  aspect-ratio: 3 / 4;
  border-radius: 7px;
  overflow: hidden;
  text-decoration: none;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  flex: none;
}
.coverImg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tiqian {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 6px;
  background: linear-gradient(155deg, #1a2d36 0%, #101b22 100%);
}
.tiqian[data-tone="1"] { background: linear-gradient(155deg, #1b2f2d 0%, #101b1b 100%); }
.tiqian[data-tone="2"] { background: linear-gradient(155deg, #28231d 0%, #151412 100%); }
.tiqian[data-tone="3"] { background: linear-gradient(155deg, #212534 0%, #12151f 100%); }
.tqCat {
  font-style: normal;
  font-size: 9.5px;
  color: var(--ink-3);
  border: 1px solid rgba(195, 228, 232, 0.14);
  border-radius: 3px;
  padding: 1px 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tqTitle {
  writing-mode: vertical-rl;
  font-family: "SimSun", "Songti SC", "STSong", Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #dce7e7;
  line-height: 1.2;
  max-height: 58px;
  overflow: hidden;
}

/* Rank History & Radar Strips (Borderless low-saturation tinted pills) */
.rankHistory {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.5;
}
.rhItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rhPill {
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.rhPill.active.read { background: var(--amber-tint); color: var(--amber); }
.rhPill.active { background: var(--accent-tint); color: var(--accent); }
.rhPill.dropped { background: var(--pill); color: var(--ink-3); }
.rhItem em { font-style: normal; color: var(--ink-3); }

.radarBadge {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--bg-sunken);
  font-size: 11.5px;
  color: var(--ink-2);
}
.radarBadge .rTag {
  font-style: normal;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.rTag.on { background: var(--accent-tint); color: var(--accent); }
.rTag.off { background: var(--pill); color: var(--ink-3); }
.rTag.new { background: var(--amber-tint); color: var(--amber); }
.radarBadge .rGain { margin-left: auto; color: var(--up); font-weight: 600; }
.radarBadge .rGain.muted { color: var(--ink-4); font-weight: 400; }

/* Option A: In-Card Inline Synopsis Expand */
.blurb {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  margin: 9px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.62;
  cursor: pointer;
  transition: color 140ms var(--ease);
}
.blurb:hover { color: var(--ink-1); }
.book.introOpen .blurb { display: none; }
.blurbFull {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  cursor: pointer;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
@media (hover: hover) {
  .blurbFull:hover { border-color: var(--line-3); }
}
.blurbParas p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.blurbParas p.blurbHook {
  color: var(--accent);
  font-size: 13px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-1);
}
.blurbParas p:last-child { margin-bottom: 0; }
.blurbFoot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.blurbFold {
  border: 0;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--accent);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Card Metrics Row (Row 1) & Action Split Row (Row 2) */
.book .aud {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  min-width: 0;
}
.audMetrics {
  display: flex;
  align-items: center;
  gap: 4px 7px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}
.audMain {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
  flex: none;
}
.audLbl { font-size: 11.5px; color: var(--ink-4); }
.aud b {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}
.deltaPill {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.35;
}
.deltaPill.up { background: var(--up-tint); color: var(--up); }
.deltaPill.down { background: var(--down-tint); color: var(--down); }
.deltaPill.flat { background: var(--pill); color: var(--ink-3); }
.wordDiff {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
}
.wordDiff.idle { color: var(--ink-4); }
.wordDiff.stale {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--warn-tint);
  color: var(--warn);
  font-weight: 600;
}
.trend {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 25px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(114, 216, 196, 0.22);
  background: rgba(114, 216, 196, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.trend:hover, .trend[aria-expanded="true"] {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
}
.cardActions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.cardActionsRight {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.readApp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(114, 216, 196, 0.32);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}
.readApp:hover {
  background: rgba(114, 216, 196, 0.22);
  border-color: rgba(114, 216, 196, 0.55);
}

/* Trend Sparkline Panel */
.trendBox {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  font-size: 12px;
}
.trendMetrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.tmCell {
  min-width: 0;
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--bg-1);
  cursor: pointer;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.tmCell:hover { border-color: var(--line-3); }
.tmCell.active {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
}
.tmCell small { display: block; color: var(--ink-3); font-size: 11px; }
.tmCell b { display: block; font-size: 14px; font-weight: 700; margin-top: 1px; color: var(--ink-1); }
.tmCell em { display: block; font-style: normal; font-size: 11px; }
.tmCell .up { color: var(--up); }
.tmCell .down { color: var(--down); }
.tmCell .flat { color: var(--ink-4); }
.trendChart {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
}
.tcReadout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  flex-wrap: wrap;
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  margin-bottom: 9px;
  font-size: 12px;
}
.tcReadMain {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}
.tcDate {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--accent-tint);
  color: var(--chart-line);
  font-weight: 700;
  font-size: 11.5px;
}
.tcSep { color: var(--ink-4); }
.tcVal { font-weight: 700; color: var(--ink-1); }
.tcDelta { font-weight: 600; }
.tcDelta.up { color: var(--up); }
.tcDelta.down { color: var(--down); }
.tcDelta.flat { color: var(--ink-3); }
.tcReadMeta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-4);
}
.tcStage {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 124px;
  margin-top: 6px;
}
.tcYAxis {
  flex: none;
  width: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 0;
  text-align: right;
  font-size: 10.5px;
  color: var(--ink-4);
  line-height: 1;
}
.tcCanvas {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  touch-action: pan-y;
  cursor: crosshair;
  user-select: none;
  border-radius: 6px;
}
.tcCanvas:focus-visible {
  outline: 1.5px solid var(--chart-line);
  outline-offset: 2px;
}
.tcSvg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tcOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tcGuide {
  position: absolute;
  top: 4%;
  bottom: 4%;
  width: 0;
  border-left: 1px dashed var(--chart-guide);
  transform: translateX(-0.5px);
}
.tcDot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chart-dot-ring);
  border: 1.8px solid var(--chart-line);
  transform: translate(-50%, -50%);
}
.tcDot.active { opacity: 0; }
.tcActiveDot {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--chart-line);
  border: 2.5px solid var(--chart-dot-ring);
  box-shadow: 0 0 0 4px var(--chart-glow);
  transform: translate(-50%, -50%);
}
.tcExtreme {
  position: absolute;
  font-size: 10px;
  line-height: 1.2;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  white-space: nowrap;
  transform: translate(-50%, -145%);
}
.tcExtreme.edgeL { transform: translate(-10%, -145%); }
.tcExtreme.edgeR { transform: translate(-90%, -145%); }
.tcXAxis {
  position: relative;
  height: 18px;
  margin: 4px 0 0 54px;
  font-size: 10.5px;
  color: var(--ink-4);
}
.tcXTick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.tcXTick.edgeL { transform: translateX(0); }
.tcXTick.edgeR { transform: translateX(-100%); }
.trendEmpty { color: var(--ink-3); font-size: 12px; }

/* Dense View: Desktop 7-Column Data Table (56px rows) */
.list.dense {
  display: block;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  overflow: hidden;
}
.list.dense .denseHead {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 76px 88px 124px 88px 148px;
  gap: 12px;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line-2);
  font-size: 11.5px;
  color: var(--ink-4);
  font-weight: 600;
}
.list.dense .denseHead .dhNum { text-align: right; }
.list.dense .book {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line-1);
  padding: 8px 16px;
  min-height: 56px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 76px 88px 124px 88px 148px;
  gap: 3px 12px;
  align-items: center;
  background: transparent;
  cursor: pointer;
}
.list.dense .book:last-child { border-bottom: 0; }
@media (hover: hover) {
  .list.dense .book:hover { background: var(--bg-2); }
}
.denseIdx { display: none; }
.list.dense .denseIdx {
  display: block;
  grid-column: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-4);
  text-align: center;
}
.list.dense .denseIdx.top3 { color: var(--amber); }
.list.dense .lead,
.list.dense .leadMain,
.list.dense .aud,
.list.dense .audMetrics { display: contents; }
.list.dense .cover,
.list.dense .cardTags,
.list.dense .rankHistory,
.list.dense .radarBadge,
.list.dense .blurb,
.list.dense .blurbFull,
.list.dense .audLbl,
.list.dense .spec,
.list.dense .readApp { display: none; }
.list.dense .leadMain h3 {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  font-size: 14.5px;
  align-self: end;
}
.list.dense .leadMain h3 a.nameLink {
  -webkit-line-clamp: 1;
}
.list.dense .bookmeta {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  font-size: 11.5px;
}
.denseWords { display: none; }
.list.dense .denseWords {
  display: block;
  grid-column: 3;
  grid-row: 1 / 3;
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-3);
}
.list.dense .audMain {
  grid-column: 4;
  grid-row: 1 / 3;
  justify-content: flex-end;
}
.list.dense .audMain b { font-size: 14.5px; }
.list.dense .deltaPill {
  grid-column: 5;
  grid-row: 1 / 3;
  justify-self: end;
}
.list.dense .wordDiff {
  grid-column: 6;
  grid-row: 1 / 3;
  text-align: right;
}
.list.dense .trend {
  grid-column: 7;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
}
.list.dense .cardActions {
  grid-column: 7;
  grid-row: 2;
  justify-self: end;
  align-self: center;
  margin-top: 0;
  gap: 4px;
}
.list.dense .cardActionsRight {
  gap: 4px;
}
.list.dense .cardMoreBtn,
.list.dense .cardSaveBtn {
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11px;
}
.list.dense .trendBox {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 6px;
}

/* Skeleton Loader Cards */
.book.skelCard { pointer-events: none; }
.skelLine {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-2) 25%, rgba(195, 228, 232, 0.1) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: skelPulse 1.4s infinite linear;
}
@keyframes skelPulse { to { background-position: -200% 0; } }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 18px;
  border-radius: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}

/* Pager, Coverage & Footer */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 12px;
}
.pager button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
  font-size: 13px;
}
.pager button:hover:not(:disabled) { background: var(--bg-2); color: var(--ink-1); }
.pager label { font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.pageinput {
  width: 56px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  padding: 0 7px;
  text-align: center;
  color: var(--ink-1);
}
.pager span { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 680px) {
  .pager { margin-bottom: 24px; }
}

/* WeChat Modal */
.wxModal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.wxCard {
  width: min(100%, 400px);
  background: var(--bg-1);
  border: 1px solid var(--line-3);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.72);
  color: var(--ink-1);
}
.wxTipTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}
.wxCard h3 { margin: 0 0 8px; font-size: 17px; color: var(--ink-1); }
.wxDesc { margin: 0 0 11px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.wxBookBox {
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  margin-bottom: 12px;
}
.wxBookBox b { color: var(--accent); display: block; font-size: 14px; margin-bottom: 3px; }
.wxBookBox small { color: var(--ink-3); font-size: 12px; }
.wxBtns { display: flex; gap: 8px; flex-wrap: wrap; }
.wxBtns button, .wxBtns a {
  flex: 1 1 auto;
  text-align: center;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--ink-1);
}
.wxBtns a.wxPrimary,
.wxBtns button.wxPrimary {
  background: var(--accent-solid);
  color: #0b1b18;
  border-color: var(--accent-solid);
}
.appHead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.appHead img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
}
.appHead h3 { margin: 0 0 3px; font-size: 17px; }
.appVerPill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 1px 8px;
  border-radius: 999px;
}
.appPerks {
  margin: 0 0 14px;
  padding: 10px 12px 10px 26px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}
.appPerks li + li { margin-top: 4px; }
.appPerks strong { color: var(--ink-1); }
.appNote {
  display: block;
  margin-top: 9px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.iosSteps {
  margin: 0;
  padding: 10px 12px 10px 26px;
  border-radius: 10px;
  background: rgba(114, 216, 196, 0.07);
  border: 1px solid rgba(114, 216, 196, 0.2);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.iosSteps strong { color: var(--accent); }
.wxClose {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
}

/* Medium Breakpoint (681px - 1179px): Single Column + Left Drawer Sidebar */
@media (min-width: 681px) and (max-width: 1179px) {
  main { grid-template-columns: minmax(0, 1fr); }
  main > :not(.filters) { grid-column: 1; }
  .expandSideBtn { display: inline-flex; align-items: center; }
  .filters {
    position: fixed;
    top: 56px;
    left: -320px;
    bottom: 0;
    z-index: 20;
    width: 300px;
    max-height: none;
    border-radius: 0 14px 0 0;
    transition: left 200ms var(--ease);
  }
  body.sheetOpen::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 19;
    background: var(--scrim);
  }
  body.sheetOpen .filters { left: 0; }
  .list:not(.dense) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 681px) and (max-width: 900px) {
  .list:not(.dense) { grid-template-columns: 1fr; }
}

/* Mobile-First Layout (<=680px) */
@media (max-width: 680px) {
  header { height: 48px; }
  .bar, main, footer { padding-inline: 12px; }
  .bar { gap: 8px; }
  .brand { font-size: 15.5px; gap: 7px; }
  .brand img { width: 26px; height: 26px; border-radius: 7px; }
  .deskOnly { display: none; }
  .headStats { font-size: 11.5px; gap: 5px; }
  .appDlBtn { height: 27px; padding: 0 9px; font-size: 11.5px; gap: 4px; }
  .appDlBtn svg { width: 12px; height: 12px; }
  .themeBtn { width: 27px; height: 27px; padding: 0; }
  .themeBtn .themeLbl { display: none; }
  .themeBtn svg { width: 14px; height: 14px; }
  main { display: block; padding-top: 10px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  footer { padding-bottom: 18px; }

  /* Bottom 4-Tab Fixed Nav */
  nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: auto;
    z-index: 15;
    background: rgba(16, 28, 34, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-2);
    padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
    gap: 4px;
  }
  nav button {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 2px;
    gap: 2px;
    border-radius: 9px;
    font-size: 12.5px;
    color: var(--ink-3);
  }
  .navBadge {
    min-width: 14px;
    height: 14px;
    padding: 0 3.5px;
    font-size: 9.5px;
  }
  nav button[aria-pressed="true"] {
    background: var(--accent-tint);
    color: var(--accent);
  }
  nav button[aria-pressed="true"]::after { display: none; }

  /* Compact Anime Banner */
  .mast {
    min-height: 120px;
    padding: 13px 13px 12px;
    border-radius: 14px;
    background-image: url(search-720.webp);
    background-position: 70% 34%;
  }
  .rankMode .mast { background-image: url(rank-720.webp); }
  .sweepMode .mast { background-image: url(night-720.webp); }
  .debutMode .mast { background-image: url(debut-720.webp); }
  .mast::before {
    background:
      linear-gradient(95deg, rgba(12, 20, 26, 0.95) 0%, rgba(12, 20, 26, 0.78) 48%, rgba(12, 20, 26, 0.25) 86%),
      linear-gradient(180deg, rgba(12, 20, 26, 0.14) 0%, rgba(12, 20, 26, 0.56) 100%);
  }
  .mastInner { max-width: 100%; }
  .mast h1 { font-size: 20px; }
  .mastSub { display: none; }
  .search {
    margin-top: 14px;
    height: 42px;
    max-width: 100%;
    padding: 4px 4px 4px 11px;
  }
  .search button { height: 32px; padding: 0 13px; }
  .mastRankBar { margin-top: 14px; max-width: 100%; }

  /* Mode Segmented Bar Below Banner */
  .modeBar {
    margin-top: 8px;
    padding: 8px 10px;
    gap: 7px 10px;
  }
  .modeGroup {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .modeGroup .segOpts {
    flex: 1;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .modeGroup .segOpts::-webkit-scrollbar { display: none; }
  #rankKinds.segOpts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  #rankFields .modeGroup:not(:first-child) {
    width: auto;
    flex: 1 1 auto;
    justify-content: flex-start;
  }
  #rankFields .modeGroup:not(:first-child) .segOpts {
    flex: 0 1 auto;
  }
  .modeNote { margin-left: 0; font-size: 11.5px; }
  .modeFoot {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .modeResetBtn { display: inline-flex; align-items: center; }

  /* 3-Segment Mobile Quick Filter Bar */
  .quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 9px 0 8px;
    border-radius: 10px;
    background: var(--bg-1);
    border: 1px solid var(--line-2);
    overflow: hidden;
  }
  .quick button {
    border: 0;
    background: transparent;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    padding: 0 6px;
  }
  .quick button + button { border-left: 1px solid var(--line-1); }
  .quick button::after {
    content: "";
    width: 5px;
    height: 5px;
    border-right: 1.5px solid var(--accent);
    border-bottom: 1.5px solid var(--accent);
    transform: translateY(-2px) rotate(45deg);
    flex: none;
  }
  .quickBadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent-solid);
    color: #0b1b18;
    font-size: 10.5px;
    font-weight: 700;
  }
  .quick #brief { display: none; }

  /* Results Toolbar on Mobile */
  .results { margin: 6px 0 8px; padding: 2px 0; gap: 6px; flex-wrap: nowrap; }
  .results.hasSyncAlert { flex-wrap: wrap; }
  .resLeft { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; gap: 6px; }
  .results.hasSyncAlert .resLeft { flex-wrap: wrap; }
  .sortWrap { flex: 0 1 auto; min-width: 0; gap: 4px; font-size: 11.5px; }
  .sortWrap > span { flex: none; }
  .results h2 { font-size: 12px; flex: 0 0 auto; white-space: nowrap; }
  .results.hasSyncAlert h2 { white-space: normal; }
  #introScope { display: none; }
  .expandSideBtn { display: none !important; }
  .viewtools { flex: none; flex-wrap: nowrap; gap: 6px; }
  body:not(.rankMode) #quickReset { display: none !important; }
  #sortBtn, .viewSeg, .quickReset { height: 30px; }
  #sortBtn { max-width: 100%; padding: 0 7px; gap: 4px; font-size: 12px; }
  #rankDateBtn { max-width: 174px; }
  .viewSeg button { height: 24px; padding: 0 8px; font-size: 12px; }
  .activeBar { margin-bottom: 10px; padding: 6px 10px; }

  /* Mobile Card List & 2-Line Compact List */
  .list { grid-template-columns: 1fr; gap: 10px; }
  .book { padding: 13px 13px 11px; }
  .lead { grid-template-columns: minmax(0, 1fr) 68px; gap: 10px; }
  .cover { width: 68px; }
  .book h3 { font-size: 15.5px; }
  .spec { font-size: 11.5px; gap: 2px 6px; }
  .scoreBadge .scoreNum { font-size: 12px; }
  .aud b { font-size: 16.5px; }
  .book .aud { gap: 4px 6px; }
  .audMetrics { gap: 4px 6px; }
  .deltaPill { padding: 1px 5px; font-size: 10.5px; }
  .wordDiff { font-size: 10.5px; }
  .tcStage { height: 114px; }
  .tcYAxis { width: 42px; font-size: 10px; }
  .tcXAxis { margin-left: 48px; font-size: 10px; }
  .tcHint { display: none; }
  .tcReadout { padding: 6px 8px; font-size: 11.5px; }
  .list.dense .denseHead { display: none; }
  .list.dense .book {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 2px 8px;
    padding: 10px 12px;
    min-height: 54px;
  }
  .list.dense .denseIdx { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .list.dense .leadMain h3 { grid-column: 2; grid-row: 1; font-size: 14px; }
  .list.dense .audMain { grid-column: 3; grid-row: 1; align-self: center; }
  .list.dense .audMain b { font-size: 14px; }
  .list.dense .bookmeta { grid-column: 2; grid-row: 2; }
  .list.dense .scoreCnt { display: none; }
  .list.dense.sortByComments .scoreCnt { display: inline; }
  .list.dense .deltaPill { display: none; }
  .list.dense .denseWords { display: none; }
  .list.dense .wordDiff { display: none; }
  .list.dense .trend { grid-column: 3; grid-row: 2; justify-self: end; align-self: center; }
  .list.dense .cardActions { display: none; }

  /* Mobile Bottom Sheet Filter Drawer (zero nested black box / zero double scrollbars) */
  .filters { display: none; }
  .sheetOpen { overflow: hidden; }
  .sheetOpen::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 20;
    background: var(--scrim);
    backdrop-filter: blur(4px);
  }
  .sheetOpen .filters {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 21;
    max-height: 85dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    background: var(--bg-1);
    overflow: hidden;
  }
  .sideHead, .sideSavedBar { display: none; }
  .sheetTitle {
    flex: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 12px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line-1);
  }
  .sheetTitle::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: rgba(195, 228, 232, 0.22);
  }
  .sheetTitleLeft { display: flex; align-items: center; gap: 8px; }
  .sheetTitle b { font-size: 15.5px; font-weight: 700; color: var(--ink-1); }
  .selBadge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-tint);
    color: var(--accent);
  }
  #closeSheet {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: var(--pill);
    color: var(--ink-2);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .filtersMain { padding: 8px 16px 16px; }
  /* Keep all secondary groups visible without desktop collapse inside mobile sheet */
  .filterrow.grpCollapsed .grpBody { display: block; }
  .filterrow.grpCollapsed .filterHead { margin-bottom: 7px; }
  .grpHeadBtn { pointer-events: none; }
  .grpHeadBtn .grpMeta { display: none; }

  /* Uniform 3-col grids for primary filters on mobile */
  #catpanel { margin-top: 8px; }
  #channel, #category, #allCats, #quickTags {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  #channel button, #category button, #allCats button, #quickTags button {
    width: 100%;
    text-align: center;
    padding: 7px 6px;
    min-height: 34px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #quickTags button {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sheetFoot {
    flex: none;
    display: flex;
    gap: 10px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-sunken);
    border-top: 1px solid var(--line-2);
  }
  .sheetReset {
    flex: 0 0 auto;
    height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 11px;
    background: var(--pill);
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 600;
  }
  .sheetApply {
    flex: 1;
    height: 42px;
    border: 0;
    border-radius: 11px;
    background: var(--accent-solid);
    color: #0b1b18;
    font-size: 14px;
    font-weight: 700;
  }

  /* 292-Tag Sub-Page Inside Mobile Bottom Sheet */
  body.mobileTagView .filters {
    visibility: hidden;
    pointer-events: none;
  }
  body.mobileTagView .tagpanel {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 22;
    max-height: 85dvh;
    border-radius: 20px 20px 0 0;
    background: var(--bg-1);
    overflow: hidden;
  }
  .tagSubHead {
    flex: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 16px 11px;
    border-bottom: 1px solid var(--line-1);
  }
  .tagSubHead::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: rgba(195, 228, 232, 0.22);
  }
  .tagSubHead b { font-size: 15px; font-weight: 700; color: var(--ink-1); }
  .subBack, .subClear {
    border: 0;
    background: transparent;
    padding: 4px 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
  }
  .subClear { color: var(--ink-3); font-weight: 500; }
  .tagSubTop {
    flex: none;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--line-1);
  }
  .tagSearchWrap {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    background: var(--bg-sunken);
    border: 1px solid var(--line-2);
  }
  .tagSearchWrap input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--ink-1);
    font-size: 13.5px;
    outline: none;
  }
  .tagSubMeta {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--ink-4);
  }
  #allTags.taggrid {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 16px 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
  }
  #allTags.taggrid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 5px;
    min-height: 48px;
  }
  #allTags.taggrid button small {
    margin: 2px 0 0;
    font-size: 10.5px;
  }
  .tagpanel .panelend {
    flex: none;
    display: block;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg-sunken);
    border-top: 1px solid var(--line-2);
  }
  .tagpanel .panelend .sheetApply {
    width: 100%;
    height: 42px;
  }
}

@media (max-width: 375px) {
  .bar { gap: 6px; padding-inline: 10px; }
  .appDlBtn { padding: 0 8px; }
}

/* Light Theme: Scheme 3「豆沙竹青」 */
html[data-theme="light"] {
  color-scheme: light;
  --bg-0: #dce7e3;
  --bg-1: #f9fcfb;
  --bg-2: #eff6f4;
  --bg-sunken: #e4eeea;
  --scrim: rgba(14, 34, 30, 0.38);
  --line-1: rgba(18, 56, 48, 0.09);
  --line-2: rgba(18, 56, 48, 0.16);
  --line-3: rgba(18, 56, 48, 0.26);
  --ink-1: #142622;
  --ink-2: #344e48;
  --ink-3: #5a756e;
  --ink-4: #839e97;
  --accent: #0b7d69;
  --accent-tint: rgba(11, 125, 105, 0.11);
  --accent-solid: #0f8e77;
  --amber: #b86814;
  --amber-tint: rgba(184, 104, 20, 0.12);
  --up: #15803d;
  --up-tint: rgba(21, 128, 61, 0.11);
  --down: #c93b33;
  --down-tint: rgba(201, 59, 51, 0.10);
  --warn: #a6620c;
  --warn-tint: rgba(166, 98, 12, 0.12);
  --chart-line: #12906e;
  --chart-glow: rgba(18, 144, 110, 0.24);
  --chart-guide: rgba(18, 144, 110, 0.52);
  --chart-dot-ring: #f9fcfb;
  --pill: rgba(18, 56, 48, 0.068);
}
html[data-theme="light"] header { border-bottom-color: var(--line-2); }
html[data-theme="light"] header::before {
  background: rgba(249, 252, 251, 0.93);
  box-shadow: 0 1px 4px rgba(16, 52, 46, 0.06);
}
html[data-theme="light"] .themeBtn {
  background: var(--bg-1);
  border-color: var(--line-2);
  color: var(--ink-2);
}
html[data-theme="light"] .appDlBtn {
  border-color: rgba(11, 125, 105, 0.34);
  background: rgba(11, 125, 105, 0.10);
  color: #096b5a;
}
@media (hover: hover) {
  html[data-theme="light"] .appDlBtn:hover {
    background: rgba(11, 125, 105, 0.17);
    border-color: rgba(11, 125, 105, 0.50);
  }
  html[data-theme="light"] .themeBtn:hover {
    background: var(--bg-2);
    border-color: var(--line-3);
    color: var(--ink-1);
  }
  html[data-theme="light"] .opts button:hover {
    background: rgba(18, 56, 48, 0.12);
    color: var(--ink-1);
  }
  html[data-theme="light"] .book:hover {
    background: #ffffff;
    border-color: rgba(11, 125, 105, 0.34);
    box-shadow: 0 4px 14px rgba(16, 52, 46, 0.11);
  }
  html[data-theme="light"] .list.dense .book:hover {
    background: var(--bg-2);
    box-shadow: none;
  }
}
html[data-theme="light"] .mast {
  border-color: rgba(18, 56, 48, 0.16);
  box-shadow: 0 8px 24px rgba(16, 52, 46, 0.14);
}
html[data-theme="light"] .mast::before {
  background:
    linear-gradient(92deg, rgba(16, 36, 34, 0.86) 0%, rgba(16, 36, 34, 0.62) 44%, rgba(16, 36, 34, 0.16) 78%, rgba(16, 36, 34, 0.04) 100%),
    linear-gradient(180deg, rgba(16, 36, 34, 0.05) 0%, rgba(16, 36, 34, 0.26) 100%);
}
html[data-theme="light"] .mast h1 { color: #f6fbfa; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45); }
html[data-theme="light"] .mastSub { color: #d6e6e2; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
html[data-theme="light"] .helpBtn {
  background: rgba(12, 30, 28, 0.68);
  color: #8be6d5;
  border-color: rgba(139, 230, 213, 0.36);
}
html[data-theme="light"] .helpBtn[aria-expanded="true"],
html[data-theme="light"] .helpBtn:hover {
  background: rgba(12, 30, 28, 0.86);
  border-color: rgba(139, 230, 213, 0.62);
}
html[data-theme="light"] .modeHelp {
  background: rgba(10, 28, 25, 0.90);
  border-color: rgba(206, 238, 232, 0.24);
  color: #dceee9;
  box-shadow: 0 10px 26px rgba(6, 18, 16, 0.30);
}
html[data-theme="light"] .modeHelp strong { color: #f6fbfa; }
html[data-theme="light"] .mastRankBar {
  background: rgba(10, 28, 25, 0.58);
  border: 1px solid rgba(206, 238, 232, 0.24);
  box-shadow: 0 4px 14px rgba(6, 18, 16, 0.24);
}
html[data-theme="light"] .mastRankBar .rankDateLbl { color: #a7cbc4; }
html[data-theme="light"] #rankState { color: #e8f5f2; }
html[data-theme="light"] #rankDateBtn {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(206, 238, 232, 0.30);
  color: #f6fbfa;
}
html[data-theme="light"] #rankDateBtn .popChev { color: #a7cbc4; }
html[data-theme="light"] #rankDateBtn[aria-expanded="true"] .popChev { color: #8be6d5; }
html[data-theme="light"] #rankRetry {
  background: rgba(114, 216, 196, 0.20);
  color: #8be6d5;
}
html[data-theme="light"] .search {
  background: rgba(10, 28, 25, 0.62);
  border: 1px solid rgba(206, 238, 232, 0.26);
  box-shadow: 0 4px 14px rgba(6, 18, 16, 0.22);
}
html[data-theme="light"] .search:focus-within {
  background: rgba(10, 28, 25, 0.80);
  border-color: rgba(114, 216, 196, 0.65);
}
html[data-theme="light"] .search .searchIcon { color: #9ec4bd; }
html[data-theme="light"] .search input { color: #f6fbfa; }
html[data-theme="light"] .search input::placeholder { color: #a7cbc4; }
html[data-theme="light"] .search button {
  background: #1ea48b;
  color: #ffffff;
}
html[data-theme="light"] .book,
html[data-theme="light"] .filters,
html[data-theme="light"] .modeBar,
html[data-theme="light"] .activeBar,
html[data-theme="light"] .empty,
html[data-theme="light"] .coverage,
html[data-theme="light"] .list.dense {
  box-shadow: 0 2px 9px rgba(16, 52, 46, 0.08), 0 1px 2px rgba(16, 52, 46, 0.04);
}
html[data-theme="light"] .list.dense .book { box-shadow: none; }
html[data-theme="light"] .segOpts button[aria-pressed="true"] {
  background: #ffffff;
  color: #096b5a;
  box-shadow: 0 1px 3px rgba(16, 52, 46, 0.12);
}
html[data-theme="light"] .opts button[aria-pressed="true"] {
  background: rgba(11, 125, 105, 0.11);
  color: #096b5a;
  box-shadow: inset 0 0 0 1px rgba(11, 125, 105, 0.36);
}
html[data-theme="light"] .opts button[aria-pressed="true"] small { color: rgba(9, 107, 90, 0.78); }
html[data-theme="light"] .filtersMain { scrollbar-color: rgba(18, 56, 48, 0.22) transparent; }
html[data-theme="light"] .filtersMain::-webkit-scrollbar-thumb { background: rgba(18, 56, 48, 0.22); }
html[data-theme="light"] .tmCell.active { border-color: rgba(11, 125, 105, 0.45); }
html[data-theme="light"] .tiqian { background: linear-gradient(155deg, #e2ede9 0%, #d2e2dc 100%); }
html[data-theme="light"] .tiqian[data-tone="1"] { background: linear-gradient(155deg, #dfefe8 0%, #cee2da 100%); }
html[data-theme="light"] .tiqian[data-tone="2"] { background: linear-gradient(155deg, #f2ebe0 0%, #e3d9c8 100%); }
html[data-theme="light"] .tiqian[data-tone="3"] { background: linear-gradient(155deg, #e6ebf1 0%, #d5dee8 100%); }
html[data-theme="light"] .tqCat { color: #46615a; border-color: rgba(18, 56, 48, 0.18); }
html[data-theme="light"] .tqTitle { color: #182e29; }
html[data-theme="light"] .skelLine {
  background: linear-gradient(90deg, #e4eeea 25%, #f1f7f5 50%, #e4eeea 75%);
  background-size: 200% 100%;
}
html[data-theme="light"] .tagpanel,
html[data-theme="light"] .wxCard {
  box-shadow: 0 20px 50px rgba(14, 34, 30, 0.22);
}
html[data-theme="light"] .iosSteps {
  background: rgba(11, 125, 105, 0.07);
  border-color: rgba(11, 125, 105, 0.22);
}
html[data-theme="light"] .trend {
  border-color: rgba(11, 125, 105, 0.22);
  background: rgba(11, 125, 105, 0.07);
}
html[data-theme="light"] .trend:hover,
html[data-theme="light"] .trend[aria-expanded="true"] {
  border-color: rgba(11, 125, 105, 0.42);
  background: var(--accent-tint);
}
html[data-theme="light"] .cardSaveBtn {
  background: rgba(11, 125, 105, 0.06);
  border-color: rgba(11, 125, 105, 0.34);
  color: var(--ink-1);
}
html[data-theme="light"] .cardSaveBtn:hover {
  background: rgba(11, 125, 105, 0.12);
  border-color: rgba(11, 125, 105, 0.52);
}
html[data-theme="light"] .cardSaveBtn.active {
  background: var(--amber-tint);
  border-color: rgba(184, 104, 20, 0.38);
  color: var(--amber);
}
html[data-theme="light"] .cardMoreBtn:hover,
html[data-theme="light"] .cardMoreBtn:active {
  border-color: rgba(201, 59, 51, 0.35);
}
html[data-theme="light"] .readApp {
  border-color: rgba(11, 125, 105, 0.28);
}
html[data-theme="light"] .readApp:hover {
  background: rgba(11, 125, 105, 0.18);
  border-color: rgba(11, 125, 105, 0.48);
}
html[data-theme="light"] .search button,
html[data-theme="light"] .sheetApply,
html[data-theme="light"] .quickBadge,
html[data-theme="light"] .wxBtns a.wxPrimary,
html[data-theme="light"] .wxBtns button.wxPrimary,
html[data-theme="light"] .tagpanel .panelend .sheetApply,
html[data-theme="light"] .syncRetryBtn:hover {
  color: #ffffff;
}
@media (max-width: 680px) {
  html[data-theme="light"] nav {
    background: rgba(249, 252, 251, 0.96);
    border-top: 1px solid rgba(18, 56, 48, 0.14);
    box-shadow: 0 -2px 12px rgba(16, 52, 46, 0.06);
  }
  html[data-theme="light"] .mast::before {
    background:
      linear-gradient(95deg, rgba(16, 36, 34, 0.86) 0%, rgba(16, 36, 34, 0.62) 50%, rgba(16, 36, 34, 0.16) 88%),
      linear-gradient(180deg, rgba(16, 36, 34, 0.06) 0%, rgba(16, 36, 34, 0.34) 100%);
  }
  html[data-theme="light"] .quick {
    box-shadow: 0 2px 9px rgba(16, 52, 46, 0.08), 0 1px 2px rgba(16, 52, 46, 0.04);
  }
  html[data-theme="light"] .sheetTitle::before,
  html[data-theme="light"] .tagSubHead::before {
    background: rgba(18, 56, 48, 0.22);
  }
}

/* Anchored In-Place Popovers (Sort, Weekly Archive, Mini Calendar) */
.uiPopScrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: var(--scrim);
  backdrop-filter: blur(3px);
}
.uiPop {
  position: fixed;
  z-index: 40;
  min-width: 164px;
  max-width: calc(100vw - 20px);
  border-radius: 12px;
  background: var(--bg-1);
  border: 1px solid var(--line-3);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.50);
  padding: 6px;
  color: var(--ink-1);
}
.uiPop.uiPopSheet {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100%;
  max-width: 100%;
  border-radius: 18px 18px 0 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.48);
}
.popMenuHead {
  padding: 5px 10px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-1);
  border-bottom: 1px solid var(--line-1);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.popMenuItem {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
}
.popMenuItem b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-1);
}
.popMenuSub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
}
.popMenuItem.danger, .popMenuItem.danger b {
  color: var(--down);
}
.popMenuCancel {
  display: none;
  width: 100%;
  height: 40px;
  margin-top: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}
.uiPop.uiPopSheet .popMenuCancel {
  display: block;
}
html[data-theme="light"] .uiPop {
  box-shadow: 0 12px 32px rgba(14, 34, 30, 0.18);
}
.popList {
  max-height: 252px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}
.popOpt {
  width: 100%;
  border: 0;
  border-radius: 7px;
  padding: 7px 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.popOpt:hover { background: var(--bg-2); color: var(--ink-1); }
.popOpt.active {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.popCheck {
  font-size: 12px;
  color: var(--accent);
  flex: none;
}
.popHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 4px 7px;
  border-bottom: 1px solid var(--line-1);
}
.popYears {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.popYears::-webkit-scrollbar { display: none; }
.popYearBtn {
  border: 0;
  border-radius: 6px;
  padding: 3px 8px;
  background: var(--pill);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.popYearBtn[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent);
}
.popLatestBtn, .popCalReset {
  border: 0;
  border-radius: 6px;
  padding: 3px 8px;
  background: var(--pill);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}
.popLatestBtn:hover, .popCalReset:hover { background: var(--accent-tint); }
.popSub {
  font-size: 11px;
  color: var(--ink-4);
  padding: 5px 8px 4px;
}
.popWkTitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.popLatestTag {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
}
.popWkRight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-3);
}
.popCalBox {
  width: 262px;
  max-width: calc(100vw - 32px);
}
.popCalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 3px 7px;
  border-bottom: 1px solid var(--line-1);
}
.popCalMonthWrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.popCalNav {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.popCalNav:hover:not(:disabled) { background: var(--bg-2); color: var(--ink-1); }
.popCalMonth {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-1);
  min-width: 78px;
  text-align: center;
}
.popCalWk, .popCalGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  text-align: center;
}
.popCalWk {
  padding: 6px 0 3px;
  font-size: 11px;
  color: var(--ink-4);
}
.popCalDay {
  position: relative;
  height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  padding: 0;
}
.popCalDay.hasData {
  color: var(--ink-1);
  font-weight: 600;
}
.popCalDay.hasData:hover { background: var(--bg-2); }
.popCalDay.hasData i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 1px;
}
.popCalDay.active {
  background: var(--accent-solid);
  color: #0b1b18;
  font-weight: 700;
}
html[data-theme="light"] .popCalDay.active { color: #ffffff; }
.popCalDay.active i { background: currentColor; }
.popCalDay.off {
  color: var(--ink-4);
  opacity: 0.34;
  cursor: default;
}
.popCalFoot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line-1);
  font-size: 11px;
  color: var(--ink-4);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Card Save & Block Menu Triggers + Toast Undo */
.book { -webkit-touch-callout: none; }
.book .blurbFull { -webkit-touch-callout: default; user-select: text; }
.cardSaveBtn, .cardMoreBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 8px;
  line-height: 1;
  white-space: nowrap;
  flex: none;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.cardMoreBtn {
  padding: 0 11px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}
.cardMoreBtn:hover, .cardMoreBtn:active {
  background: var(--down-tint);
  border-color: rgba(235, 154, 146, 0.42);
  color: var(--down);
}
.cardSaveBtn {
  padding: 0 11px;
  border: 1px solid rgba(114, 216, 196, 0.34);
  background: rgba(114, 216, 196, 0.08);
  color: var(--ink-1);
  font-size: 12.5px;
  font-weight: 600;
}
.cardSaveBtn:hover {
  background: rgba(114, 216, 196, 0.15);
  border-color: rgba(114, 216, 196, 0.55);
}
.cardSaveBtn.active {
  background: var(--amber-tint);
  border-color: rgba(235, 183, 130, 0.48);
  color: var(--amber);
}
.shelfOps .readApp,
.shelfOps .cardSaveBtn {
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 11.5px;
}

.favToast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(15, 24, 30, 0.94);
  border: 1px solid rgba(114, 216, 196, 0.40);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  max-width: calc(100vw - 32px);
  text-align: center;
}
.favToastUndo {
  border: 0;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--accent-solid);
  color: #0b1b18;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.favToast.warn {
  border-color: rgba(235, 154, 146, 0.55);
  color: var(--down);
}
html[data-theme="light"] .favToast {
  background: rgba(16, 36, 34, 0.92);
  color: #f6fbfa;
}

/* Shelf Mode (5th Nav Tab) */
body.shelfMode main {
  grid-template-columns: minmax(0, 1fr);
}
body.shelfMode main > :not(.filters) {
  grid-column: 1;
}
body.shelfMode .filters,
body.shelfMode .quick,
body.shelfMode .results,
body.shelfMode .activeBar,
body.shelfMode #warning,
body.shelfMode #list,
body.shelfMode .pager {
  display: none !important;
}
.shelfView {
  margin-top: 12px;
}
.shelfNotice {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-tint);
  border: 1px solid rgba(223, 185, 114, 0.35);
  color: var(--ink-1);
  font-size: 12.5px;
  line-height: 1.55;
}
.shelfNoticeOps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
}
.shelfNoticeBtn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(223, 185, 114, 0.45);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.shelfNoticeBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
#oldAppCopyState {
  font-size: 11.5px;
  color: var(--ink-2);
}
.shelfEmpty {
  text-align: center;
  padding: 46px 18px;
  border-radius: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
}
.shelfEmptyTitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1);
  margin-bottom: 6px;
}
.shelfEmpty p {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-3);
}
.shelfGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.shelfItem {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border-radius: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  align-items: start;
}
.shelfItem .cover {
  width: 68px;
}
.shelfFilterBar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.sfChip {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sfChip em {
  font-style: normal;
  color: var(--ink-3);
  font-size: 11px;
}
.sfChip.active {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
  color: var(--accent);
}
.sfChip.active em { color: var(--accent); }
.fattenAlertCnt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--amber);
  color: #15120c;
  font-size: 10.5px;
  font-weight: 700;
}
.fTargetPresets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.fPresetBtn {
  height: 25px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}
.fPresetBtn.active {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
  color: var(--accent);
}
.shelfFattenRow {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
}
.fattenAlertLine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.fAlertPill {
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
}
.fAlertPill.up { background: var(--up-tint); color: var(--up); }
.fAlertPill.accent { background: var(--accent-tint); color: var(--accent); }
.fAlertPill.warn { background: var(--warn-tint); color: var(--warn); }
.fProgText {
  font-size: 11px;
  color: var(--ink-3);
}
.fEditTargetBtn {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 0 2px;
}
.shelfHiddenHint {
  font-size: 11.5px;
  color: var(--ink-3);
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg-sunken);
  border: 1px dashed var(--line-2);
}
.shelfItem.isLost { border-color: rgba(223, 185, 114, 0.32); }
.shelfLostPill, .dLostPill {
  flex: none;
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
}
.dLostPill { margin-top: 6px; }
.shelfSubHeadBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.shelfSubHeadBar b { color: var(--ink-1); }
.shelfDangerBtn {
  height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid rgba(235, 154, 146, 0.4);
  background: var(--down-tint);
  color: var(--down);
  font-size: 11.5px;
  font-weight: 600;
}
.shelfDangerBtn.armed {
  background: var(--down);
  color: #160c0c;
}
.histTime {
  flex: none;
  font-size: 11px;
  color: var(--ink-4);
}
.blockScopeNote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
}
.blockScopeNote strong { color: var(--ink-1); }
.blockPanels, .backupGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.blockCard {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 14px;
  min-width: 0;
}
.blockCard h3 {
  margin: 0 0 10px;
  font-size: 14.5px;
  color: var(--ink-1);
  display: flex;
  align-items: center;
  gap: 6px;
}
.blockCard h3 em {
  font-style: normal;
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-3);
}
.blockAddForm {
  display: flex;
  gap: 7px;
  margin-bottom: 9px;
}
.blockAddForm input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12.5px;
}
.blockAddForm button {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(114, 216, 196, 0.45);
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
.blockSuggestRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 9px;
  font-size: 11.5px;
  color: var(--ink-4);
}
.blockSuggestBtn {
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--ink-3);
  font-size: 11px;
}
.blockSuggestBtn:hover { color: var(--accent); border-color: var(--accent); }
.blockChipList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.blockChip {
  height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(235, 154, 146, 0.35);
  background: var(--down-tint);
  color: var(--down);
  font-size: 12px;
  font-weight: 600;
}
.blockChip.kw {
  border-color: rgba(223, 185, 114, 0.4);
  background: var(--warn-tint);
  color: var(--warn);
}
.blockBookList {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.blockBookRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  font-size: 12.5px;
  color: var(--ink-2);
}
.blockBookRow b { color: var(--ink-1); }
.blockEmptyHint { font-size: 12px; color: var(--ink-4); }
.backupDesc {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.backupFileRow { margin-bottom: 8px; }
.backupFileBtn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.backupFileBtn input { display: none; }
.backupTextarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
  margin-bottom: 8px;
}
.backupCheckBtn { height: 32px; padding: 0 13px; }
.backupMsg { margin-top: 8px; font-size: 12px; color: var(--accent); }
.backupError {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--down-tint);
  border: 1px solid rgba(235, 154, 146, 0.35);
  color: var(--down);
  font-size: 12px;
}
.backupPreviewCard {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid rgba(114, 216, 196, 0.38);
}
.bpTitle {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.bpWarn {
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--warn);
}
.bpDiffList {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
}
.bpDiffList strong { color: var(--ink-1); }
.bpModeRow {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.bpActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.blockAlsoHit {
  margin-top: 3px;
  font-size: 11px;
  color: var(--warn);
}
.shelfBody {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.shelfTop {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.shelfTitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-1);
  text-decoration: none;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.shelfTitle:hover { color: var(--accent); }
.shelfMeta {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.shelfObs {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.shelfObs b { font-size: 14px; color: var(--ink-1); }
.shelfObs small { font-size: 11px; color: var(--ink-4); }
.shelfOps {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.shelfDetailBtn, .shelfRemoveBtn {
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}
.shelfDetailBtn:hover { border-color: var(--accent); color: var(--accent); }
.shelfRemoveBtn:hover { border-color: var(--down); color: var(--down); }

/* Book Detail Mode (Full-Page In-Site Dossier) */
body.detailMode main {
  grid-template-columns: minmax(0, 1fr);
}
body.detailMode main > :not(#bookDetailView):not(#favToast) {
  display: none !important;
}
body.detailMode #bookDetailView {
  grid-column: 1;
  display: block;
}
.detailView {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.dTopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.dTopOps {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dBackBtn, .dGhostBtn {
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease), color 140ms var(--ease);
}
.dBackBtn:hover, .dGhostBtn:hover {
  background: var(--bg-2);
  border-color: var(--accent);
  color: var(--accent);
}
.dGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: start;
}
.dMainCol, .dSideCol {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.dCard {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 16px;
}
.dHeroHead {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.dCoverBox {
  position: relative;
  width: 96px;
  aspect-ratio: 3 / 4;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  flex: none;
}
.dHeroMeta {
  min-width: 0;
}
.dTitle {
  margin: 0;
  font-size: 20px;
  line-height: 1.32;
  font-weight: 700;
  color: var(--ink-1);
  overflow-wrap: anywhere;
}
.dAuthorRow {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-3);
}
.dAuthorJump {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.dAuthorJump:hover { text-decoration: underline; }
.dChTag {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
}
.dSpecs {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.dSpecs span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--ink-4);
}
.dCatsLine {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dCatChip, .dTagChip {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  text-decoration: none;
  white-space: nowrap;
}
.dCatChip {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}
.dTagChip {
  background: var(--pill);
  color: var(--ink-2);
}
.dTagChip:hover, .dCatChip:hover {
  filter: brightness(1.08);
}
.dSecHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dSecHead h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-1);
}
.dSrcNote {
  font-size: 11px;
  color: var(--ink-4);
}
.dJumpSimBtn {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--pill);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.dIntroBody p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.dIntroBody p:last-child { margin-bottom: 0; }
.dIntroBody.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dIntroToggle {
  margin-top: 8px;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
.dIntroMissing {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.65;
}
.dActRow {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.dPrimaryBtn, .dSecBtn, .dFavBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
}
.dPrimaryBtn {
  background: var(--accent-solid);
  color: #0b1b18;
}
.dSecBtn {
  background: var(--bg-sunken);
  border-color: var(--line-2);
  color: var(--ink-1);
  font-weight: 600;
}
.dFavBtn {
  background: var(--bg-sunken);
  border-color: var(--line-2);
  color: var(--ink-1);
  font-weight: 600;
}
.dFavBtn.active {
  background: var(--amber-tint);
  border-color: rgba(235, 183, 130, 0.45);
  color: var(--amber);
}
.dBlockBtn {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}
.dBlockBtn.active {
  background: var(--down-tint);
  border-color: rgba(235, 154, 146, 0.4);
  color: var(--down);
}
.dShelfControls {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.dBlockNotice {
  margin-top: 8px;
  font-size: 12px;
  color: var(--warn);
}
.dToast {
  margin-top: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.dToast.warn { color: var(--down); }
.dStatStrip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.dStatItem {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
}
.dStatItem small {
  display: block;
  font-size: 11px;
  color: var(--ink-4);
}
.dStatItem b {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-1);
}
.dStatDeltas {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dStatNote {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.dTrendWrap .trendMetrics {
  margin-bottom: 4px;
}
.dWordBarWrap {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-1);
}
.wordBarEmpty {
  font-size: 12px;
  color: var(--ink-3);
}
.wbHead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.wbTitle { font-size: 12.5px; font-weight: 700; color: var(--ink-1); }
.wbMeta { font-size: 11px; color: var(--ink-4); }
.wbReadout {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.wbBars {
  display: grid;
  gap: 4px;
  align-items: end;
}
.wbCol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 1px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  min-width: 0;
}
.wbCol.active {
  background: var(--bg-sunken);
  border-color: var(--line-2);
}
.wbTrack {
  width: 100%;
  height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.wbValTop {
  font-size: 9.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.wbBar {
  width: 72%;
  max-width: 24px;
  min-height: 6px;
  border-radius: 4px 4px 2px 2px;
  background: var(--accent-solid);
}
.wbZeroBar, .wbNegBar, .wbBaseDot {
  font-size: 9.5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--pill);
  color: var(--ink-3);
}
.wbGapSlot {
  width: 76%;
  height: 30px;
  border-radius: 4px;
  border: 1px dashed var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  color: var(--ink-4);
}
.wbIntervalPill {
  width: 96%;
  padding: 3px 2px;
  border-radius: 5px;
  border: 1px dashed rgba(235, 183, 130, 0.55);
  background: var(--amber-tint);
  color: var(--amber);
  font-size: 9.5px;
  line-height: 1.25;
  font-weight: 600;
  text-align: center;
}
.wbLbl {
  font-size: 10px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.dDailyDetails {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-1);
}
.dDailyDetails summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}
.dDailyWrap {
  margin-top: 8px;
  overflow-x: auto;
}
.dDailyTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.dDailyTable th, .dDailyTable td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-1);
  text-align: right;
  white-space: nowrap;
}
.dDailyTable th:first-child, .dDailyTable td:first-child { text-align: left; }
.dDailyTable th { color: var(--ink-4); font-weight: 600; }
.dDailyTable td { color: var(--ink-2); }
.dDailyTable tr.isGapRow td { color: var(--ink-4); font-style: italic; }
.ddDelta.up { color: var(--up); }
.ddDelta.down { color: var(--down); }
.dMilestoneList {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dMsItem {
  display: grid;
  grid-template-columns: 44px 10px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
}
.dMsDate { color: var(--ink-4); font-variant-numeric: tabular-nums; }
.dMsDot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.dMsItem.isBase .dMsDot { background: var(--amber); }
.dMsBody {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.dMsBaseTag {
  padding: 0 6px;
  border-radius: 4px;
  background: var(--amber-tint);
  color: var(--amber);
  font-size: 10.5px;
  font-weight: 600;
}
.dRelList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dRelCard {
  display: block;
  padding: 10px 11px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  text-decoration: none;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.dRelCard:hover {
  background: var(--bg-2);
  border-color: rgba(114, 216, 196, 0.38);
}
.dRelTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dRelTitle {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-1);
  line-height: 1.35;
}
.dRelArrow {
  color: var(--ink-4);
  font-size: 15px;
  flex: none;
}
.dRelReason {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 500;
}
.dRelMeta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.dRelSubHead {
  margin: 12px 0 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
}
.dRelHint {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.6;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dRelSyncing {
  margin-bottom: 10px;
  color: var(--accent);
}
.dRelaxBtn {
  margin-top: 10px;
  width: 100%;
  height: 34px;
  border-radius: 9px;
  border: 1px dashed var(--line-3);
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}
.dRelaxBtn:hover {
  background: var(--accent-tint);
  border-style: solid;
}
.dStateBox {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 36px 20px;
  text-align: center;
}
.dStateTitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1);
  margin-bottom: 6px;
}
.dStateSub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-3);
}

/* Mobile Header MyBtn + Shelf v29 Slimming + Drawer + SubPages + Modals */
.myBtn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 140ms var(--ease), color 140ms var(--ease), background-color 140ms var(--ease);
}
.myBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
body.shelfMode .mast {
  display: none !important;
}
body.shelfMode .shelfView {
  margin-top: 2px;
}
.shelfHeadRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.shelfPageTitle {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink-1);
}
.fattenReadyBanner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--up-tint);
  border: 1px solid rgba(136, 214, 163, 0.35);
  font-size: 12.5px;
  color: var(--ink-1);
}
.fBannerHead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.fBannerList {
  margin: 0;
  padding: 6px 0 0 18px;
  border-top: 1px dashed rgba(136, 214, 163, 0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fBannerItem {
  font-size: 12px;
  line-height: 1.45;
}
.fBannerItem a {
  color: var(--ink-1);
  text-decoration: none;
  font-weight: 600;
}
.fBannerItem a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.fattenReadyTxt b {
  color: var(--up);
}
.fattenReadyOps {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fBannerGoBtn, .fBannerAckBtn {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
}
.fBannerGoBtn {
  border: 0;
  background: var(--accent-solid);
  color: #0b1b18;
}
html[data-theme="light"] .fBannerGoBtn {
  color: #ffffff;
}
.fBannerAckBtn {
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
}
.fLineOps {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.fCancelInlineBtn {
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
}
.fCancelInlineBtn:hover {
  color: var(--down);
}
.dFattenActBtn {
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 13px;
  font-weight: 600;
}
.dFattenActBtn.active {
  background: var(--up-tint);
  border-color: rgba(136, 214, 163, 0.45);
  color: var(--up);
}
.dFattenInfo {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 0 4px;
}

/* My Lightweight Side Drawer */
.myDrawerWrap {
  position: fixed;
  inset: 0;
  z-index: 42;
}
.myDrawerScrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
}
.myDrawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 350px);
  background: var(--bg-1);
  border-left: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.35);
}
.myDrawerHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-1);
}
.myDrawerTitleWrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.myDrawerTitleWrap b {
  font-size: 17px;
  color: var(--ink-1);
}
.myIdentTag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.myDrawerClose {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.myQuickControls {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.myQuickRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.drawerPillBtn {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 600;
}
.drawerPillBtn.accent {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.4);
  color: var(--accent);
}
.myMenuList {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.myMenuItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  text-align: left;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.myMenuItem:hover {
  border-color: var(--accent);
  background: var(--bg-2);
}
.myMenuText {
  min-width: 0;
}
.myMenuText b {
  display: block;
  font-size: 14.5px;
  color: var(--ink-1);
}
.myMenuText small {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ink-3);
}
.myMenuRight {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-4);
}
.myMenuRight em {
  font-style: normal;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}
.myMenuRight i {
  font-style: normal;
  font-size: 17px;
  line-height: 1;
}
.myDrawerFoot {
  margin-top: auto;
  padding-top: 14px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.myDrawerCoverage {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
}
.myDrawerCoverage summary {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.myDrawerCoverageBody p {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: var(--ink-3);
}
.dBlockTagsBtn {
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.dBlockTagsBtn:hover {
  border-color: var(--down);
  color: var(--down);
}
.btBookSub {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
}
.btOpt.blockedAlready {
  opacity: 0.52;
  cursor: default;
}
.myDrawerEnvLine {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-4);
}
.dotLive, .dotLocal {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.dotLive { background: var(--accent); }
.dotLocal { background: var(--ink-4); }

/* Dedicated Full-Page My SubView (History / Blocks / Backup) */
body.subPageMode main {
  grid-template-columns: minmax(0, 1fr);
}
body.subPageMode main > :not(#mySubView):not(#favToast) {
  display: none !important;
}
body.subPageMode #mySubView {
  grid-column: 1;
  display: block;
}
.mySubView {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}
.subPageTopBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
}
.subPageTitle {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-1);
  margin-right: auto;
}
.subPageSwitch {
  display: inline-flex;
  border-radius: 9px;
  padding: 2px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  gap: 2px;
}
.spsBtn {
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}
.spsBtn.active {
  background: var(--accent-tint);
  color: var(--accent);
}
.blockSubTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.bstBtn {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.bstBtn em {
  font-style: normal;
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-3);
}
.bstBtn.active {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
  color: var(--accent);
}
.blockSearchRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}
.blockSearchInputWrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  align-items: center;
}
.blockSearchInputWrap input {
  width: 100%;
  height: 34px;
  padding: 0 30px 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 12.5px;
}
.blockSearchClear {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-3);
  font-size: 11px;
}
.blockSearchMeta {
  font-size: 12px;
  color: var(--ink-3);
}
.blockBookInfo {
  min-width: 0;
  overflow-wrap: anywhere;
}
.blockBookLink {
  font-weight: 700;
  color: var(--ink-1);
  text-decoration: none;
}
.blockBookLink:hover {
  color: var(--accent);
}
.blockBookAuthor {
  color: var(--ink-3);
  font-size: 12px;
}
.blockPager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.blockTagPickerRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.blockTagHint {
  font-size: 12px;
  color: var(--ink-3);
}
.bpReplaceOpt {
  color: var(--down);
}
.bpReplaceWarn {
  margin-bottom: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--down-tint);
  border: 1px solid rgba(235, 154, 146, 0.35);
  font-size: 12px;
  color: var(--down);
}

/* Fatten Goal & Block Tag Multi-Select Modals */
.fattenModalCard {
  max-width: 440px;
}
.blockTagModalCard {
  max-width: 560px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
}
.fModalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.fModalHead h3 {
  margin: 0;
  font-size: 17px;
  color: var(--ink-1);
}
.fModalBook {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-1);
}
.fModalStateTag {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}
.fModalModes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.fModeBtn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.fModeBtn.active {
  background: var(--accent-tint);
  border-color: rgba(114, 216, 196, 0.45);
  color: var(--accent);
}
.fModalPane {
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-1);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.fModalInputRow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.fModalInputRow input {
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  font-size: 13px;
}
.fModalInputRow input[type="number"] {
  width: 92px;
}
.fModalCheck {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}
.fModalDesc {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
}
.fModalFoot {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.btSearchWrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.btSearchWrap input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-1);
  font-size: 13px;
}
.btSelBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.btClearSelBtn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.btScrollArea {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: 48dvh;
  overflow-y: auto;
  padding-right: 2px;
}
.btSecTitle {
  margin: 8px 0 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
}
.btGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.btOpt {
  min-height: 34px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-sunken);
  color: var(--ink-2);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  text-align: left;
  min-width: 0;
}
.btOpt span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btOpt small, .btOpt i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--ink-4);
  flex: none;
}
.btOpt.active {
  background: var(--down-tint);
  border-color: rgba(235, 154, 146, 0.45);
  color: var(--down);
  font-weight: 600;
}
.btOpt.active small, .btOpt.active i {
  color: var(--down);
}

html[data-theme="light"] .dPrimaryBtn { color: #ffffff; }
html[data-theme="light"] .fattenAlertCnt { color: #ffffff; }
html[data-theme="light"] .shelfDangerBtn.armed { color: #ffffff; }
html[data-theme="light"] .dCard,
html[data-theme="light"] .shelfItem,
html[data-theme="light"] .shelfEmpty,
html[data-theme="light"] .dStateBox,
html[data-theme="light"] .blockCard {
  box-shadow: 0 2px 9px rgba(16, 52, 46, 0.08), 0 1px 2px rgba(16, 52, 46, 0.04);
}

@media (max-width: 860px) {
  .dGrid { grid-template-columns: minmax(0, 1fr); }
  .shelfGrid { grid-template-columns: minmax(0, 1fr); }
  .blockPanels, .backupGrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  header .bar #themeBtn,
  header .bar #appDlBtn { display: none !important; }
  .myBtn { height: 27px; padding: 0 10px; font-size: 12px; }
  body.detailMode .favToast,
  body.subPageMode .favToast { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .favToast { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .dCard { padding: 13px; }
  .dHeroHead { grid-template-columns: 78px minmax(0, 1fr); gap: 11px; }
  .dCoverBox { width: 78px; }
  .dTitle { font-size: 17.5px; }
  .dPrimaryBtn { flex: 1 1 100%; }
  .dSecBtn, .dFavBtn, .dFattenActBtn, .dBlockTagsBtn { flex: 1 1 auto; }
  .dStatItem b { font-size: 17px; }
  .shelfItem { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .shelfItem .cover { width: 60px; }
  .btGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
