/* ---------- Material 3 tokens (change --primary to re-theme) ---------- */
:root {
  --primary: #1b5e3a;
  --on-primary: #fff;
  --pc: #c3ecd1;
  --on-pc: #00210f;
  --sc: #d3e8d9;
  --on-sc: #0e1f15;
  --bg: #f6fbf6;
  --s1: #edf5ee;
  --s2: #e5efe7;
  --s3: #dde9df;
  --on: #171d19;
  --onv: #404943;
  --outline: #707972;
  --ov: #c0c9c1;
  --track: #d3dfd5;
  --gold: #e3b33c;
  --deep: #0d3523;
  --forest: #164c32;
  --e1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --e2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --e3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --gap: 36px;
  --n: 6;
}
@media (max-width: 1499px) {
  :root {
    --n: 5;
  }
}
@media (max-width: 1199px) {
  :root {
    --n: 4;
  }
}
@media (max-width: 899px) {
  :root {
    --n: 3;
    --gap: 24px;
  }
}
@media (max-width: 599px) {
  :root {
    --n: 2.3;
    --gap: 14px;
  }
  .cat[data-open="1"] {
    --n: 2;
  }
}
* {
  box-sizing: border-box;
}
html.lock,
html.lock body {
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--on);
  font:
    400 16px/1.5 Roboto,
    "Noto Sans Ol Chiki",
    system-ui,
    sans-serif;
}
svg {
  display: block;
  fill: currentColor;
}
.i {
  width: 24px;
  height: 24px;
}
[hidden] {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* buttons */
.ibtn {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ibtn:hover:not(:disabled) {
  background: color-mix(in srgb, currentColor 8%, transparent);
}
.ibtn:disabled {
  opacity: 0.38;
  cursor: default;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 24px;
  border: 0;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition:
    box-shadow 0.15s,
    filter 0.15s;
}
.btn .i {
  width: 18px;
  height: 18px;
}
.btn.filled {
  background: var(--primary);
  color: var(--on-primary);
}
.btn.tonal {
  background: var(--sc);
  color: var(--on-sc);
}
.btn.text {
  background: none;
  color: var(--primary);
  padding: 0 12px;
}
.btn:hover {
  filter: brightness(1.06);
  box-shadow: var(--e1);
}
.btn.text:hover {
  box-shadow: none;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* progress indicators */
.linear {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}
.linear i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: var(--primary);
  transition: width 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.linear.ind i {
  width: 35%;
  animation: ind 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes ind {
  0% {
    left: -35%;
  }
  100% {
    left: 100%;
  }
}
.circ {
  width: 40px;
  height: 40px;
  animation: rot 1.4s linear infinite;
}
.circ circle {
  fill: none;
  stroke: var(--primary);
  stroke-width: 4;
  stroke-linecap: round;
  animation: dash 1.4s ease-in-out infinite;
}
@keyframes rot {
  to {
    transform: rotate(360deg);
  }
}
@keyframes dash {
  0% {
    stroke-dasharray: 1 200;
    stroke-dashoffset: 0;
  }
  50% {
    stroke-dasharray: 90 200;
    stroke-dashoffset: -35;
  }
  100% {
    stroke-dasharray: 90 200;
    stroke-dashoffset: -125;
  }
}

/* header: compact Google-style app bar */
.appbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 8px clamp(16px, 5.2vw, 100px);
  box-shadow: 0 1px 0 var(--ov);
  transition: box-shadow 0.2s;
}
.appbar.raised {
  box-shadow: var(--e2);
}
.top {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}
.brandlink {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 0;
  border: 0;
  background: none;
  color: var(--on);
  cursor: pointer;
}
.logo {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
}
.logo .i {
  width: 23px;
  height: 23px;
}
.wm {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  font:
    500 26px/1 Outfit,
    "Product Sans",
    "Google Sans",
    Roboto,
    "Noto Sans Ol Chiki",
    sans-serif;
  letter-spacing: -0.3px;
}
.wm .sp {
  display: inline-block;
  width: 0.3em;
}
.wmimg {
  display: block;
  height: 30px;
  width: auto;
}
.search {
  flex: 1;
  min-width: 0;
  max-width: 720px;
  margin: 0 auto;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 24px;
  background: var(--s3);
  color: var(--onv);
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
.search:focus-within {
  background: var(--bg);
  box-shadow: var(--e2);
}
#q {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  font-size: 16px;
  color: var(--on);
}
#q::placeholder {
  color: var(--onv);
  opacity: 0.75;
}
.dnav {
  display: flex;
  flex: none;
  gap: 2px;
}
a.brandlink,
a.nlink,
a.mitem,
a.ibtn,
a.btn,
a.tile {
  text-decoration: none;
}
a.brandlink,
a.mitem,
a.ibtn,
a.tile {
  color: inherit;
}
/* "all genres" page: an even grid, same gap on every side, 3 across on phones */
.genres[data-open="1"] .nav {
  display: none;
}
.genres[data-open="1"] .track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  overflow: visible;
  scroll-snap-type: none;
  margin: 0;
  padding: 8px 0 16px;
}
.genres[data-open="1"] .track > .tile {
  width: auto;
  min-width: 0;
}
@media (max-width: 599px) {
  .genres[data-open="1"] .track {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .genres[data-open="1"] .tile {
    padding: 12px 6px;
    gap: 3px;
    border-radius: 14px;
  }
  .genres[data-open="1"] .ti {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 19px;
  }
  .genres[data-open="1"] .tn {
    font-size: 13px;
  }
  .genres[data-open="1"] .tc {
    font-size: 11px;
  }
}
.nlink {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 20px;
  background: none;
  color: var(--onv);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.nlink:hover {
  background: var(--s2);
  color: var(--on);
}
#menubtn {
  display: none;
}
.menu {
  position: absolute;
  right: 12px;
  top: 64px;
  z-index: 6;
  min-width: 200px;
  padding: 8px 0;
  border-radius: 12px;
  background: var(--s1);
  box-shadow: var(--e3);
}
.mitem {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.mitem:hover {
  background: var(--s3);
}
.appbar .linear {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  background: transparent;
}

/* account + favourites (only for signed-in readers) */
html:not(.authed) .heart,
html:not(.authed) #dfav,
html:not(.authed) #rheart,
html:not(.authed) [data-fav] {
  display: none !important;
}
.gicon {
  width: 18px;
  height: 18px;
}
.avatar {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font:
    500 16px Roboto,
    sans-serif;
  cursor: pointer;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.acc-id {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ov);
}
.acc-id b {
  display: block;
  font-weight: 500;
}
.acc-id small {
  color: var(--onv);
}
.heart {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  color: #5f6368;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.15s,
    color 0.15s;
}
.heart .i {
  width: 20px;
  height: 20px;
}
.heart:hover {
  transform: scale(1.12);
}
.heart.on {
  color: #e53935;
}
.btn.on svg,
#rheart.on {
  color: #e53935;
}
#reader #rheart.on {
  color: #ff6b6b;
}
.cat-h h2 .hrt {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  color: #e53935;
  vertical-align: -0.08em;
  margin-right: 6px;
}
/* footer */
.foot {
  position: relative;
  overflow: hidden;
  margin: 72px clamp(12px, 2.5vw, 32px) clamp(12px, 2.5vw, 32px);
  border-radius: 32px;
  color: #d3e4d8;
  background: #0d3523;
}
.foot::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(
      55% 90% at 100% 0,
      rgba(227, 179, 60, 0.16),
      transparent 62%
    ),
    radial-gradient(70% 100% at 0 100%, rgba(46, 125, 79, 0.5), transparent 66%);
}
.foot-in {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(
      auto-fit,
      minmax(150px, 1fr)
    );
  gap: 40px 56px;
  padding: 56px clamp(20px, 4vw, 64px) 40px;
}
.foot h3 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8fd0a5;
}
.f-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.f-brand .wm {
  font-size: 30px;
}
.f-brand small {
  display: block;
  margin-top: 4px;
  font:
    400 13px Roboto,
    sans-serif;
  color: #a9c4b0;
}
.foot p {
  margin: 0;
  max-width: 480px;
  line-height: 1.7;
  color: #c4d9c9;
}
.foot ul {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.foot a,
.flink {
  padding: 0;
  border: 0;
  background: none;
  color: #e1eee5;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.foot a:hover,
.flink:hover {
  color: var(--gold);
}
.f-ct li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.f-ct i {
  width: 18px;
  margin-top: 5px;
  color: #8fd0a5;
  text-align: center;
}
.socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.soc {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}
.soc:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--deep);
}
.foot-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding: 18px clamp(20px, 4vw, 64px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: #a9c4b0;
}

/* sections + carousel */
main {
  padding: 8px clamp(16px, 5.2vw, 100px) 72px;
  max-width: 1920px;
  margin: 0 auto;
}
.cat,
.genres {
  margin-top: 28px;
}
.cat {
  scroll-margin-top: 96px;
}
.cat-h {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.cat-h h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 400;
}
.cat-h h2 i {
  color: var(--primary);
  font-size: 0.8em;
  margin-right: 6px;
}
.ti.sm {
  display: inline-grid;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary);
  vertical-align: -0.2em;
  margin-right: 8px;
  font-size: 16px;
}
.iglyph {
  width: 62%;
  height: 62%;
  object-fit: contain;
  filter: grayscale(1) invert(1) contrast(1.4);
  mix-blend-mode: screen;
}
.cat-h .btn {
  margin-left: auto;
}
.car {
  position: relative;
}
.track {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  padding: 14px 20px 20px;
  margin: 0 -20px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 20px;
  scrollbar-width: none;
}
.track::-webkit-scrollbar {
  display: none;
}
.track > .card {
  flex: 0 0 calc((100% - (var(--n) - 1) * var(--gap)) / var(--n));
  scroll-snap-align: start;
}
.track > .tile {
  flex: 0 0 clamp(140px, 12vw, 190px);
  scroll-snap-align: start;
}
.genres .track {
  --gap: 14px;
}
.cat[data-open="1"] .track {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 28px;
  scroll-snap-type: none;
}
.nav {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  background: var(--s3);
  color: var(--on);
  box-shadow: var(--e2);
}
.nav:hover:not(:disabled) {
  background: var(--s2);
}
.genres .nav {
  top: 50%;
}
.nav.prev {
  left: -8px;
}
.nav.next {
  right: -8px;
}
.cat[data-open="1"] .nav {
  display: none;
}
@media (hover: none) {
  .nav {
    display: none;
  }
}
.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 6;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--pc);
  color: var(--on-pc);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--e3);
}
.fab:hover {
  filter: brightness(0.97);
}

/* genre tiles */
.tile {
  all: unset;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  background: var(--s1);
  border: 1px solid var(--ov);
  border-radius: 16px;
  cursor: pointer;
  text-align: center;
  min-width: 0;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}
.tile:hover {
  background: var(--s2);
  box-shadow: var(--e1);
}
.tile:focus-visible,
.card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ti {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  font-family: "Noto Sans Ol Chiki", Roboto, sans-serif;
}
.glyph {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--g) center/contain no-repeat;
  mask: var(--g) center/contain no-repeat;
}
.ti .glyph {
  width: 62%;
  height: 62%;
}
.tn {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(14px, 1vw, 16px);
  font-weight: 500;
}
.tc {
  color: var(--onv);
  font-size: clamp(12px, 0.9vw, 14px);
}
.tc b {
  color: var(--primary);
  font-weight: 500;
}

/* book cards + opening-book hover */
.card {
  all: unset;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  min-width: 0;
  transition: transform 0.2s;
}
.card::before {
  content: "";
  position: absolute;
  inset: -14px -16px -12px;
  z-index: -1;
  border-radius: 16px;
  background: var(--s2);
  box-shadow: var(--e1);
  opacity: 0;
  transition: opacity 0.18s;
}
.b3d {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 2/3;
  perspective: 900px;
  margin-bottom: 16px;
}
.pages {
  position: absolute;
  inset: 1.5% 0;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #f1ebe0, #fff);
  opacity: 0;
  transition: opacity 0.2s;
  box-shadow:
    3px 0 0 #fff,
    4px 0 0 #cfc8bb,
    7px 0 0 #fff,
    8px 0 0 #cfc8bb,
    11px 0 0 #fff,
    12px 0 0 #bdb5a6;
}
.cover {
  position: absolute;
  inset: 0;
  border-radius: 4px 8px 8px 4px;
  background: var(--c, #a23b4a);
  overflow: hidden;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.3);
  transform-origin: left center;
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.35s;
}
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.35) 0,
    rgba(0, 0, 0, 0.18) 3%,
    transparent 7%
  );
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  color: #fff;
  font-family: "Noto Sans Ol Chiki", Roboto, sans-serif;
}
.ph b {
  font-size: 22px;
}
.ph span {
  font-size: 12px;
  font-family: Roboto, sans-serif;
}
.card:focus-visible::before {
  opacity: 1;
}
.card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (hover: hover) {
  .card:hover {
    transform: translateY(-3px);
  }
  .card:hover::before {
    opacity: 1;
  }
  .card:hover .pages {
    opacity: 1;
  }
  .card:hover .cover {
    transform: rotateY(-24deg);
    box-shadow: 10px 6px 16px rgba(0, 0, 0, 0.35);
  }
}
.ct,
.cs {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ct {
  font-size: clamp(15px, 1.05vw, 17px);
  font-weight: 500;
}
.cs {
  margin-top: 4px;
  font-size: clamp(13px, 0.95vw, 15px);
  color: var(--onv);
}
.note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px clamp(16px, 5.2vw, 100px) 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--sc);
  color: var(--on-sc);
  font-size: 14px;
}
.note .btn {
  margin-left: auto;
}
.empty {
  margin: 48px 0;
  text-align: center;
  color: var(--onv);
}

/* details dialog */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 24, 16, 0.5);
  animation: fade 0.18s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
}
.dialog {
  position: relative;
  width: min(780px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 28px;
  border-radius: 28px;
  background: var(--bg);
  box-shadow: var(--e3);
  animation: pop 0.22s cubic-bezier(0.2, 0, 0, 1);
}
.dialog .x {
  position: absolute;
  top: 12px;
  right: 12px;
}
.d-main {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.d-cover {
  width: min(200px, 60%);
  flex: none;
  margin: 0 auto;
}
.d-cover .b3d {
  margin: 0;
}
.d-info {
  flex: 1;
  min-width: 260px;
}
.d-info h2 {
  margin: 0 40px 14px 0;
  font-size: 28px;
  line-height: 1.25;
  font-weight: 400;
}
.d-rows {
  border: 1px solid var(--ov);
  border-radius: 12px;
  overflow: hidden;
}
.d-row {
  display: grid;
  grid-template-columns: 28px 110px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 14px;
}
.d-row + .d-row {
  border-top: 1px solid var(--ov);
}
.d-row i {
  color: var(--primary);
  text-align: center;
}
.d-row .dl {
  color: var(--onv);
}
.d-row .dv {
  font-weight: 500;
}
.d-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
#dsumwrap h3 {
  margin: 26px 0 6px;
  font-size: 20px;
  font-weight: 500;
}
#dsum {
  margin: 0;
  color: var(--onv);
  white-space: pre-line;
}
#snack {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: 90vw;
  padding: 14px 16px;
  border-radius: 4px;
  background: #26382d;
  color: #e5f1e8;
  font-size: 14px;
  box-shadow: var(--e3);
  transform: translate(-50%, 90px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s,
    opacity 0.25s;
}
#snack.on {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* reader (dark Material surface) */
#reader {
  --primary: #8bd8a3;
  --on-primary: #003919;
  --pc: #00522a;
  --on-pc: #a5f4be;
  --sc: #3a4b3f;
  --on-sc: #d3e8d9;
  --bg: #0f1511;
  --s1: #161d18;
  --s2: #1c251f;
  --s3: #262f28;
  --on: #dfe4de;
  --onv: #bfc9c1;
  --outline: #8a938b;
  --ov: #404943;
  --track: #34413a;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100dvh;
  background: var(--bg);
  color: var(--on);
  display: none;
  flex-direction: column;
  z-index: 10;
}
#reader.on {
  display: flex;
}
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--s1);
}
.titlebar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 0 1 340px;
}
.t {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
}
.tools {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  visibility: hidden;
}
#reader.ready .tools {
  visibility: visible;
}
.go {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--onv);
}
#goto {
  width: 56px;
  height: 36px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: none;
  color: var(--on);
  font: inherit;
  text-align: center;
}
#goto:focus {
  outline: 0;
  border: 2px solid var(--primary);
}
.zoom {
  display: flex;
  align-items: center;
}
#zval {
  min-width: 64px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 18px;
  background: none;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}
#zval:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
#seek {
  flex: 1;
  min-width: 60px;
  height: 24px;
  margin: 0 8px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  --p: 0%;
  cursor: pointer;
}
#seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    var(--primary) var(--p),
    var(--track) var(--p)
  );
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 20%, transparent);
  transition: box-shadow 0.15s;
}
#seek:hover::-webkit-slider-thumb,
#seek:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) 20%, transparent);
}
#seek::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
}
#seek::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--primary);
}
#seek::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
}
#seek:focus-visible {
  outline: 0;
}
#bg {
  flex: none;
  border-radius: 0;
  background: var(--s2);
}
#bg.done {
  visibility: hidden;
}
#stage {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding: 4px;
}
#stage.zoomed {
  overflow: auto;
  scrollbar-width: thin;
  cursor: grab;
}
#stage.zoomed.grabbing {
  cursor: grabbing;
}
#stage.zoomed * {
  touch-action: pan-x pan-y pinch-zoom !important;
}
.flip {
  margin: auto;
  flex: none;
}
.page {
  background: #fff;
  position: relative;
}
.page img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.spin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.fail {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  text-align: center;
  font-size: 14px;
  color: #5f6368;
}
.fail .btn {
  --primary: #1b5e3a;
  --on-primary: #fff;
}
#msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
#msg.hide {
  display: none;
}
#msg .linear {
  width: 240px;
}
#mtxt {
  max-width: 440px;
}

@media (max-width: 719px) {
  .appbar {
    padding: 6px 12px;
  }
  .top {
    gap: 8px;
    height: 52px;
  }
  .wm {
    font-size: 21px;
  }
  .wmimg {
    height: 24px;
  }
  .search {
    height: 44px;
  }
  .dnav {
    display: none;
  }
  #menubtn {
    display: grid;
  }
  #signin span {
    display: none;
  }
  #signin {
    padding: 0 12px;
  }
  .foot-in {
    grid-template-columns: 1fr;
    padding-top: 44px;
  }
  .foot {
    border-radius: 24px;
  }
  .bar {
    display: contents;
  }
  .titlebar {
    order: 0;
    flex: none;
    padding: 4px 8px;
    background: var(--s1);
  }
  #bg {
    order: 0;
  }
  #stage {
    order: 1;
  }
  .tools {
    order: 2;
    flex: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--s1);
  }
  #seek {
    order: -1;
    flex: none;
    width: calc(100% - 16px);
    margin: 0 8px 4px;
  }
  .pl,
  #zval {
    display: none;
  }
  .dialog {
    padding: 20px;
    border-radius: 24px;
  }
  .d-info h2 {
    font-size: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
