[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #05080e;
  --panel: rgba(10, 17, 29, .96);
  --panel-2: #101b2b;
  --line: rgba(255,255,255,.12);
  --muted: #9aabc0;
  --text: #f7f3e8;
  --gold: #e9b949;
  --gold-2: #ffd77b;
  --blue: #5db8ff;
  --theme-glow-a: rgba(33,83,133,.22);
  --theme-glow-b: rgba(177,77,25,.18);
  --zoom: 1;
  --page-max-height: calc(100vh - var(--topbar) - var(--controlbar) - 36px);
  --page-max-width: calc(100vw - 145px);
  --topbar: 64px;
  --controlbar: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body[data-book="art"] {
  --panel: rgba(12, 20, 19, .97);
  --panel-2: #14231f;
  --blue: #79c9a2;
  --gold: #c9a24f;
  --gold-2: #f0d48b;
  --theme-glow-a: rgba(28,108,82,.24);
  --theme-glow-b: rgba(164,105,36,.17);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, var(--theme-glow-a), transparent 32%),
    radial-gradient(circle at 85% 18%, var(--theme-glow-b), transparent 30%),
    linear-gradient(135deg, #07111f 0%, #05080e 50%, #11100d 100%);
}
body[data-book="art"] .app { background:
  radial-gradient(circle at 13% 20%, var(--theme-glow-a), transparent 34%),
  radial-gradient(circle at 87% 16%, var(--theme-glow-b), transparent 32%),
  linear-gradient(135deg, #07120f 0%, #050807 53%, #15100a 100%); }
.topbar {
  height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: rgba(5,9,15,.88); backdrop-filter: blur(18px);
  position: relative; z-index: 20;
}
.library-link {
  height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px;
  border: 1px solid rgba(233,185,73,.34); border-radius: 10px; color: var(--gold-2);
  background: rgba(233,185,73,.07); text-decoration: none; font-size: 13px; font-weight: 700;
  transition: .18s ease;
}
.library-link:hover { background: rgba(233,185,73,.15); border-color: rgba(233,185,73,.6); transform: translateY(-1px); }
.library-link svg { width: 18px; height: 18px; fill: currentColor; }
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: cover; border-radius: 9px; box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 6px 20px rgba(0,0,0,.35); }
.brand span { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: min(38vw, 420px); }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.icon-button, .text-button, .zoom-value {
  border: 1px solid var(--line); background: rgba(255,255,255,.055); border-radius: 10px;
  height: 40px; min-width: 40px; display: inline-grid; place-items: center; cursor: pointer; transition: .18s ease;
}
.icon-button:hover, .text-button:hover, .zoom-value:hover { background: rgba(255,255,255,.11); border-color: rgba(255,255,255,.23); transform: translateY(-1px); }
.icon-button svg { width: 21px; height: 21px; fill: currentColor; }
.icon-button[aria-pressed="true"] { color: var(--gold-2); border-color: rgba(233,185,73,.6); background: rgba(233,185,73,.14); }
.icon-button.small { width: 34px; min-width: 34px; height: 34px; font-size: 21px; }
.text-button { padding: 0 14px; }
.menu-button { gap: 4px; padding: 10px; }
.menu-button span { display: block; width: 18px; height: 2px; border-radius: 4px; background: currentColor; }

.donate-reader-button {
  color: var(--gold-2);
  border-color: rgba(233,185,73,.34);
  background: rgba(233,185,73,.07);
  text-decoration: none;
}
.donate-reader-button:hover {
  color: #ffe4a1;
  border-color: rgba(233,185,73,.64);
  background: rgba(233,185,73,.15);
}
.donate-reader-button svg { width: 20px; height: 20px; }

.reader-shell { height: calc(100vh - var(--topbar)); display: grid; grid-template-rows: minmax(0,1fr) var(--controlbar); }
.reader { min-height: 0; position: relative; display: flex; align-items: stretch; overflow: hidden; }
.page-stage { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 18px 66px; overflow: auto; scroll-behavior: smooth; overscroll-behavior: contain; }
.page-wrap { position: relative; flex: 0 0 auto; line-height: 0; min-width: 1px; min-height: 1px; filter: drop-shadow(0 24px 35px rgba(0,0,0,.55)); }
.page-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
.book-page { display: block; width: auto; height: auto; max-height: var(--page-max-height); max-width: var(--page-max-width); object-fit: contain; user-select: none; -webkit-user-drag: none; background: #111; }
.page-skeleton { position: absolute; inset: 0; min-width: 240px; min-height: 340px; background: linear-gradient(100deg, #121820 25%, #202a35 38%, #121820 52%); background-size: 200% 100%; animation: shimmer 1.25s infinite; }
.page-wrap.loaded .page-skeleton { display: none; }
@keyframes shimmer { to { background-position-x: -200%; } }
.edge-nav { position: absolute; z-index: 7; top: 0; bottom: 0; width: 58px; border: 0; background: linear-gradient(90deg, rgba(3,7,13,.75), transparent); cursor: pointer; opacity: .65; transition: .2s ease; }
.edge-nav:hover { opacity: 1; }
.edge-nav span { display: inline-grid; place-items: center; width: 42px; height: 64px; border-radius: 12px; font-family: Georgia, serif; font-size: 48px; color: rgba(255,255,255,.9); }
.edge-prev { left: 0; }
.edge-next { right: 0; transform: scaleX(-1); }
.edge-next span { transform: scaleX(-1); }
.edge-nav:disabled { opacity: .15; cursor: default; }
.spread-mode .page-stage { gap: 0; }
.spread-mode .book-page { max-width: var(--page-max-width); }
.spread-mode .page-wrap:first-child { transform-origin: right center; }
.spread-mode .page-wrap.second-page { transform-origin: left center; }
.spread-mode .page-wrap:first-child::after { box-shadow: inset -12px 0 20px -16px #000, inset 0 0 0 1px rgba(255,255,255,.08); }
.spread-mode .second-page::after { box-shadow: inset 12px 0 20px -16px #000, inset 0 0 0 1px rgba(255,255,255,.08); }
.controlbar { min-height: var(--controlbar); display: grid; grid-template-columns: minmax(170px,auto) minmax(220px,1fr) auto; gap: 20px; align-items: center; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(5,9,15,.9); backdrop-filter: blur(18px); position: relative; z-index: 10; }
.page-status { display: flex; flex-direction: column; min-width: 0; }
.page-status strong { font-size: 14px; }
.page-status span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 330px; }
.scrubber-wrap { position: relative; height: 26px; display: flex; align-items: center; }
#pageSlider { position: absolute; inset: 0; width: 100%; z-index: 2; opacity: 0; cursor: pointer; }
.progress-track { width: 100%; height: 7px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--gold)); }
.zoom-controls { display: flex; align-items: center; gap: 6px; }
.zoom-value { min-width: 58px; height: 34px; border: 0; background: transparent; font-size: 12px; color: var(--muted); }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(3px); z-index: 39; }
.drawer { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(440px, 92vw); background: var(--panel); border-right: 1px solid var(--line); box-shadow: 25px 0 60px rgba(0,0,0,.45); transform: translateX(-104%); transition: transform .25s ease; display: grid; grid-template-rows: auto auto minmax(0,1fr); }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.drawer-head > div { display: flex; flex-direction: column; }
.drawer-head strong { font-family: Georgia, serif; font-size: 22px; }
.drawer-head span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.drawer-head .icon-button { margin-left: auto; font-size: 25px; }
.drawer-tabs { padding: 10px 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.drawer-tab { border: 0; border-radius: 9px; padding: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.drawer-tab.active { background: rgba(255,255,255,.09); color: var(--text); }
.drawer-panel { display: none; min-height: 0; overflow: auto; padding: 14px; }
.drawer-panel.active { display: block; }
.search-box { height: 42px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.045); padding: 0 12px; position: sticky; top: 0; z-index: 2; backdrop-filter: blur(12px); }
.search-box svg { width: 19px; fill: var(--muted); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.contents-list { padding: 11px 0 18px; }
.contents-item { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text); padding: 9px 10px; text-align: left; cursor: pointer; }
.contents-item:hover { background: rgba(255,255,255,.07); }
.contents-item span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contents-item span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.contents-item.section { margin-top: 8px; color: var(--gold-2); font-family: Georgia, serif; font-size: 17px; background: rgba(233,185,73,.06); }
.contents-item.current { box-shadow: inset 3px 0 var(--blue); background: rgba(93,184,255,.09); }
.empty-state { color: var(--muted); padding: 16px 10px; }
.drawer-library-link { margin: 8px 0 22px; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid rgba(233,185,73,.3); border-radius: 10px; color: var(--gold-2); background: rgba(233,185,73,.06); text-decoration: none; font-weight: 700; }
.drawer-library-link:hover { background: rgba(233,185,73,.13); }
.drawer-library-link svg { width: 19px; height: 19px; fill: currentColor; }
.thumb-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; padding-bottom: 30px; }
.thumb-button { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #0a0e14; padding: 0; cursor: pointer; aspect-ratio: .84; }
.thumb-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-button span { position: absolute; left: 5px; bottom: 5px; background: rgba(0,0,0,.75); color: white; font-size: 11px; line-height: 1; padding: 5px 6px; border-radius: 6px; }
.thumb-button.current { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(233,185,73,.22); }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--controlbar) + 18px); transform: translate(-50%, 12px); padding: 9px 13px; border-radius: 9px; background: rgba(8,12,18,.92); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: .2s ease; color: #dce5ef; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
body.drawer-open { overflow: hidden; }
@media (max-width: 970px) {
  .library-link span { display: none; }
  .library-link { padding: 0; width: 40px; justify-content: center; }
  .brand strong { max-width: 29vw; }
}
@media (max-width: 850px) {
  :root { --topbar: 58px; --controlbar: 70px; }
  .brand small, .text-button.compact, #spreadButton { display: none; }
  .brand strong { font-size: 15px; max-width: 38vw; }
  .topbar { padding: 0 10px; gap: 7px; }
  .page-stage { padding: 10px 44px; }
  .edge-nav { width: 42px; }
  .edge-nav span { width: 34px; font-size: 38px; }
  .controlbar { grid-template-columns: minmax(100px,auto) 1fr; gap: 12px; padding-left: 12px; padding-right: 12px; }
  .zoom-controls { display: none; }
  .page-status span { max-width: 38vw; }
}
@media (max-width: 540px) {
  .brand img { width: 34px; height: 34px; }
  .brand strong { max-width: 145px; }
  .page-stage { padding-left: 34px; padding-right: 34px; }
  .edge-nav { width: 33px; background: transparent; }
  .edge-nav span { width: 30px; background: rgba(0,0,0,.42); height: 50px; font-size: 34px; }
  .controlbar { grid-template-columns: 105px 1fr; }
  .page-status strong { font-size: 12px; }
  .page-status span { font-size: 10px; }
  .thumb-grid { grid-template-columns: repeat(3,1fr); gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* World of Warcraft hand cursor — desktop and pointer devices only. */
@media (pointer: fine) {
  html, body, body * {
    cursor: url("../assets/gam372.cur"), auto !important;
  }
}
