:root {
  --ink: #17201d;
  --muted: #64726a;
  --paper: #fff9e8;
  --gold: #f2b84b;
  --sun: #ffe08a;
  --ruby: #bd3152;
  --teal: #128f91;
  --blue: #2875ba;
  --green: #62a860;
  --violet: #7656a6;
  --line: rgba(78, 58, 20, .18);
  --shadow: rgba(65, 48, 18, .18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.65;
  background:
    linear-gradient(135deg, rgba(255, 250, 235, .96), rgba(232, 255, 246, .9) 46%, rgba(255, 239, 228, .95)),
    repeating-linear-gradient(45deg, rgba(242, 184, 75, .08) 0 1px, transparent 1px 22px);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 238, .9);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(94, 69, 25, .08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-key {
  position: relative;
  width: 42px;
  height: 22px;
  transform: rotate(-18deg);
}

.brand-key::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 17px;
  width: 23px;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(180deg, #fff4a9, var(--gold), #9a6816);
  box-shadow: 0 0 15px rgba(255, 220, 115, .9);
}

.brand-key::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 19px;
  height: 19px;
  border: 6px solid var(--gold);
  border-left-color: #9a6816;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(255, 220, 115, .9);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a,
.primary-action,
.secondary-action,
.category-buttons button,
.reader-toolbar button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(125, 91, 30, .24);
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
  color: #453719;
  font-weight: 800;
  cursor: pointer;
}

.nav a::before,
.primary-action::before,
.secondary-action::before,
.category-buttons button::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 3px solid currentColor;
  border-left-width: 1px;
  border-radius: 50%;
}

.hero {
  position: relative;
  min-height: 86vh;
  display: grid;
  grid-template-columns: minmax(0, .96fr) minmax(320px, 1.04fr);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  padding: clamp(34px, 6vw, 86px) clamp(16px, 5vw, 72px);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(100deg, rgba(255, 250, 235, .95) 0 38%, rgba(255, 250, 235, .42)),
    url("assets/bookslab.jpg") center / cover;
  opacity: .55;
}

.kicker {
  margin: 0 0 8px;
  color: #7b5418;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(44px, 7vw, 96px);
  line-height: 1.04;
  font-weight: 950;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.15;
}

.hero-copy p:not(.kicker) {
  max-width: 690px;
  color: #35423b;
  font-size: clamp(18px, 2vw, 23px);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.primary-action {
  background: linear-gradient(180deg, #fff6be, var(--gold));
  box-shadow: 0 18px 34px rgba(242, 184, 75, .25), inset 0 -8px 12px rgba(129, 87, 17, .16);
}

.secondary-action {
  background: rgba(255, 255, 255, .72);
}

.hero-stage {
  min-height: 510px;
  position: relative;
  perspective: 1200px;
}

.arch {
  position: absolute;
  inset: 20px 0 0;
  border: 2px solid rgba(143, 95, 21, .32);
  border-bottom-width: 8px;
  border-radius: 54% 54% 8px 8px / 38% 38% 8px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .58), rgba(255, 247, 223, .86)),
    repeating-linear-gradient(90deg, rgba(189, 49, 82, .16) 0 22px, rgba(18, 143, 145, .14) 22px 44px, rgba(242, 184, 75, .18) 44px 66px);
  box-shadow: inset 0 0 44px rgba(255, 224, 138, .36), 0 44px 90px rgba(95, 77, 39, .2);
  transform: rotateY(-9deg) rotateX(4deg);
}

.cross-light {
  position: absolute;
  top: 62px;
  right: 50%;
  width: 92px;
  height: 134px;
  transform: translateX(50%);
  filter: drop-shadow(0 0 24px rgba(255, 224, 138, .95));
}

.cross-light::before,
.cross-light::after {
  content: "";
  position: absolute;
  background: linear-gradient(180deg, #fff7b8, var(--gold) 58%, var(--ruby));
  border-radius: 8px;
}

.cross-light::before {
  inset: 0 33px;
}

.cross-light::after {
  top: 40px;
  right: 0;
  left: 0;
  height: 29px;
}

.big-key {
  position: absolute;
  width: 260px;
  height: 88px;
  transform-style: preserve-3d;
  filter: drop-shadow(0 18px 20px rgba(64, 45, 12, .24));
}

.big-key::before {
  content: "";
  position: absolute;
  top: 25px;
  right: 70px;
  width: 155px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff4a9, var(--gold) 50%, #91600e);
  box-shadow: inset 0 -8px 12px rgba(120, 74, 10, .32), 0 0 26px rgba(255, 224, 138, .82);
}

.big-key::after {
  content: "";
  position: absolute;
  top: 39px;
  left: 4px;
  width: 60px;
  height: 37px;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 74% 35%, 74% 70%, 48% 70%, 48% 100%, 0 100%);
  background: linear-gradient(180deg, #fff1a1, #e09c2c 56%, #8a5a0c);
}

.big-key span {
  position: absolute;
  top: 0;
  right: 0;
  width: 88px;
  height: 70px;
  border: 16px solid var(--gold);
  border-left-color: #ac7421;
  border-bottom-color: #d18d24;
  border-radius: 50%;
  box-shadow: inset 0 0 14px rgba(255, 245, 170, .8), 0 0 30px rgba(242, 184, 75, .82);
}

.key-one {
  top: 214px;
  right: 7%;
  transform: rotateZ(-14deg) rotateX(56deg);
}

.key-two {
  top: 304px;
  left: 5%;
  transform: rotateZ(18deg) rotateX(58deg) scale(.88);
}

.key-three {
  bottom: 42px;
  right: 36%;
  transform: rotateZ(4deg) rotateX(62deg) scale(1.08);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 clamp(16px, 5vw, 72px) 42px;
}

.stats div {
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .7);
  box-shadow: 0 18px 40px rgba(95, 77, 39, .1);
}

.stats strong {
  display: block;
  color: #8f5f15;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.1;
}

.stats span {
  color: var(--muted);
  font-weight: 800;
}

.library-shell,
.reader-shell,
.taxonomy {
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 78px) clamp(16px, 4vw, 44px);
}

.library-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
}

.library-tools,
.book-section,
.toc-panel,
.reader-page,
.taxonomy-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 24px 54px rgba(75, 61, 34, .12);
}

.library-tools {
  align-self: start;
  position: sticky;
  top: 82px;
  padding: 18px;
}

.search-box {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  margin: 16px 0;
  border: 1px solid rgba(72, 58, 31, .16);
  border-radius: 8px;
  background: white;
}

.search-box span {
  width: 16px;
  height: 16px;
  border: 2px solid var(--teal);
  border-radius: 50%;
  box-shadow: 8px 8px 0 -6px var(--teal);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.category-buttons {
  display: grid;
  gap: 8px;
}

.category-buttons button {
  justify-content: flex-start;
  text-align: right;
}

.category-buttons button.active {
  background: linear-gradient(180deg, #fff5c5, #f7d776);
  box-shadow: 0 0 18px rgba(242, 184, 75, .28);
}

.book-section {
  min-width: 0;
  padding: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.count-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(18, 143, 145, .1);
  color: #126d70;
  font-weight: 900;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.book-card {
  min-height: 256px;
  display: grid;
  grid-template-rows: 128px auto auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(72, 58, 31, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .78);
  cursor: pointer;
  text-align: right;
  box-shadow: 0 18px 34px rgba(75, 61, 34, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}

.book-card:hover,
.book-card.active {
  transform: translateY(-4px);
  box-shadow: 0 24px 44px rgba(75, 61, 34, .16), 0 0 20px rgba(242, 184, 75, .18);
}

.seal,
.reader-seal {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
  text-align: center;
  font-weight: 950;
  line-height: 1.1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  box-shadow: inset 0 -14px 26px rgba(0, 0, 0, .18), 0 0 22px rgba(255, 224, 138, .38);
}

.seal::before,
.reader-seal::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 255, 255, .46);
  clip-path: inherit;
}

.shape-hex { clip-path: polygon(50% 0, 92% 23%, 92% 77%, 50% 100%, 8% 77%, 8% 23%); }
.shape-oct { clip-path: polygon(20% 0, 80% 0, 100% 24%, 100% 76%, 80% 100%, 20% 100%, 0 76%, 0 24%); }
.shape-dome { clip-path: polygon(50% 0, 88% 18%, 100% 58%, 74% 100%, 26% 100%, 0 58%, 12% 18%); }
.shape-round { border-radius: 50%; }
.shape-star { clip-path: polygon(50% 0, 62% 30%, 95% 35%, 70% 56%, 78% 91%, 50% 72%, 22% 91%, 30% 56%, 5% 35%, 38% 30%); }
.shape-gate { clip-path: polygon(50% 0, 88% 18%, 100% 44%, 100% 100%, 0 100%, 0 44%, 12% 18%); }

.tone-1 { background: linear-gradient(135deg, var(--ruby), var(--gold)); }
.tone-2 { background: linear-gradient(135deg, var(--teal), var(--blue)); }
.tone-3 { background: linear-gradient(135deg, var(--violet), #f07b79); }
.tone-4 { background: linear-gradient(135deg, var(--green), var(--gold)); }
.tone-5 { background: conic-gradient(from 20deg, var(--ruby), var(--gold), var(--teal), var(--blue), var(--ruby)); }
.tone-6 { background: linear-gradient(135deg, var(--blue), #79d7cf); }

.book-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.book-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.reader-shell {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.toc-panel {
  position: sticky;
  top: 82px;
  padding: 18px;
}

.toc-list {
  display: grid;
  gap: 8px;
}

.toc-list button {
  position: relative;
  min-height: 48px;
  padding: 8px 42px 8px 10px;
  border: 1px solid rgba(72, 58, 31, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  color: #35423b;
  text-align: right;
  font-weight: 850;
  cursor: pointer;
}

.toc-list button::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 10px;
  width: 23px;
  height: 20px;
  background:
    radial-gradient(circle at 8px 9px, transparent 0 5px, currentColor 6px 9px, transparent 10px),
    linear-gradient(currentColor, currentColor) 20px 8px / 18px 5px no-repeat;
  color: var(--gold);
  filter: drop-shadow(0 0 7px rgba(242, 184, 75, .7));
}

.toc-list button.active {
  background: #fff4c7;
  color: #8f5f15;
  box-shadow: inset 0 0 0 1px rgba(242, 184, 75, .3), 0 0 18px rgba(242, 184, 75, .16);
}

.reader-page {
  min-width: 0;
  padding: clamp(18px, 4vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 248, 229, .62)),
    repeating-linear-gradient(0deg, rgba(141, 101, 24, .05) 0 1px, transparent 1px 35px);
}

.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.reader-toolbar span {
  color: #7b5418;
  font-weight: 900;
}

.reader-toolbar button.saved {
  background: #e8fff5;
  color: #126d70;
}

.reader-title {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.reader-seal {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  font-size: 22px;
}

.reader-title h2 {
  margin-bottom: 5px;
}

.reader-title p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.reader-content {
  max-width: 790px;
  margin: 0 auto;
  color: #2f3b34;
  font-size: 18px;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.reader-actions a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fff6be, var(--gold));
  color: #4c3614;
  font-weight: 900;
}

.reader-actions span {
  color: var(--muted);
  font-weight: 800;
}

.content-frame {
  width: 100%;
  min-height: 78vh;
  border: 1px solid rgba(72, 58, 31, .16);
  border-radius: 8px;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.reader-content section {
  scroll-margin-top: 100px;
  padding: 14px 0 8px;
}

.reader-content h3 {
  margin-bottom: 8px;
  color: #563b13;
  font-size: 26px;
}

.reader-content p {
  margin-bottom: 16px;
}

.reader-content .focus-box {
  margin: 18px 0;
  padding: 14px 16px;
  border-right: 4px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 255, 255, .68);
  color: #624414;
  font-weight: 850;
}

.taxonomy {
  padding-bottom: 88px;
}

.taxonomy-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.taxonomy-grid > div {
  min-height: 150px;
  padding: 16px;
}

.taxonomy-grid b {
  display: block;
  margin-bottom: 8px;
  color: #7b5418;
  font-size: 18px;
}

.taxonomy-grid span {
  color: #435047;
}

.footer {
  padding: 26px clamp(16px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 238, .86);
  color: #435047;
  text-align: center;
  font-weight: 850;
}

@media (max-width: 1120px) {
  .hero,
  .library-shell,
  .reader-shell {
    grid-template-columns: 1fr;
  }

  .library-tools,
  .toc-panel {
    position: static;
  }

  .book-grid,
  .taxonomy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .section-head,
  .reader-toolbar,
  .reader-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats,
  .book-grid,
  .taxonomy-grid {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    min-height: 360px;
  }

  .big-key {
    transform: scale(.74) rotateZ(-10deg) rotateX(54deg);
    transform-origin: center;
  }
}

/* Final dark reader theme */
:root {
  --ink: #f5f1e7;
  --muted: #b8c2c5;
  --paper: #101820;
  --gold: #d7ad56;
  --sun: #f7dd91;
  --ruby: #9f3456;
  --teal: #4fb7c6;
  --blue: #6aa7de;
  --green: #86bf7a;
  --violet: #9d86d6;
  --line: rgba(199, 218, 232, .16);
  --shadow: rgba(0, 0, 0, .42);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(106, 167, 222, .18), transparent 28%),
    radial-gradient(circle at 86% 26%, rgba(79, 183, 198, .16), transparent 30%),
    linear-gradient(135deg, #071018, #101820 42%, #15111b);
}

.topbar,
.footer {
  background: rgba(7, 16, 24, .9);
  border-color: rgba(199, 218, 232, .14);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .35);
}

.nav a,
.secondary-action,
.category-buttons button,
.reader-toolbar button,
.library-tools,
.book-section,
.toc-panel,
.reader-page,
.taxonomy-grid > div {
  background: linear-gradient(180deg, rgba(19, 32, 43, .92), rgba(10, 18, 27, .92));
  border-color: rgba(199, 218, 232, .16);
  color: var(--ink);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .32);
}

.hero::before {
  background:
    linear-gradient(100deg, rgba(7, 16, 24, .96) 0 42%, rgba(7, 16, 24, .58)),
    url("assets/bookslab.jpg") center / cover;
  opacity: .68;
}

.hero-copy p:not(.kicker),
.library-tools p,
.reader-title p:last-child,
.book-route,
.reader-actions span,
.taxonomy-grid span {
  color: var(--muted);
}

.arch {
  background:
    linear-gradient(180deg, rgba(20, 33, 45, .64), rgba(7, 16, 24, .9)),
    repeating-linear-gradient(90deg, rgba(159, 52, 86, .18) 0 22px, rgba(79, 183, 198, .16) 22px 44px, rgba(215, 173, 86, .18) 44px 66px);
  border-color: rgba(199, 218, 232, .26);
  box-shadow: inset 0 0 54px rgba(106, 167, 222, .22), 0 44px 90px rgba(0, 0, 0, .42);
}

.big-key {
  animation: keyFloat 5.5s ease-in-out infinite;
}

.big-key::before,
.big-key::after,
.big-key span {
  box-shadow: 0 0 28px rgba(106, 167, 222, .72), inset 0 -8px 12px rgba(35, 22, 8, .36);
}

.key-two {
  animation-delay: -1.8s;
}

.key-three {
  animation-delay: -3.2s;
}

@keyframes keyFloat {
  0%, 100% { filter: drop-shadow(0 18px 22px rgba(106, 167, 222, .28)); }
  50% { filter: drop-shadow(0 28px 34px rgba(106, 167, 222, .58)); }
}

.stats div {
  background: linear-gradient(180deg, rgba(19, 32, 43, .9), rgba(10, 18, 27, .92));
  border-color: rgba(199, 218, 232, .16);
}

.search-box {
  background: rgba(5, 12, 19, .72);
  border-color: rgba(199, 218, 232, .15);
}

.search-box input {
  color: var(--ink);
}

.search-box input::placeholder {
  color: rgba(245, 241, 231, .58);
}

.category-buttons button.active {
  background: linear-gradient(180deg, rgba(68, 104, 132, .92), rgba(21, 46, 64, .92));
  color: #ffffff;
  box-shadow: 0 0 22px rgba(106, 167, 222, .3);
}

.book-grid.book-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  max-height: 72vh;
  overflow: auto;
  padding-left: 4px;
}

.book-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(120px, .28fr);
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(199, 218, 232, .13);
  border-radius: 8px;
  background: rgba(9, 18, 27, .82);
  color: var(--ink);
  text-align: right;
  cursor: pointer;
}

.book-row:hover,
.book-row.active {
  background: linear-gradient(90deg, rgba(79, 183, 198, .18), rgba(215, 173, 86, .12));
  box-shadow: 0 0 18px rgba(106, 167, 222, .18);
}

.book-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(106, 167, 222, .16);
  color: #d8ecff;
  font-weight: 900;
}

.book-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.book-route {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.reader-shell {
  max-width: 1580px;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

.toc-panel {
  padding: 20px;
}

.reader-page {
  padding: clamp(18px, 3vw, 30px);
}

.reader-content {
  max-width: none;
}

.reader-actions {
  padding: 10px;
  border: 1px solid rgba(199, 218, 232, .12);
  border-radius: 8px;
  background: rgba(5, 12, 19, .5);
}

.reader-action-button,
.reader-actions a,
.map-open-button,
.map-overlay-head button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(215, 173, 86, .34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(215, 173, 86, .95), rgba(118, 78, 26, .95));
  color: #110d08;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(106, 167, 222, .2), inset 0 -8px 12px rgba(35, 22, 8, .22);
}

.reader-action-button::before,
.map-open-button::before {
  content: "";
  width: 19px;
  height: 12px;
  border-radius: 8px;
  background: #d9efff;
  box-shadow: 12px 0 0 -3px #d7ad56, 0 0 12px rgba(106, 167, 222, .65);
}

.content-frame {
  min-height: 86vh;
  border-color: rgba(199, 218, 232, .18);
  background: #ffffff;
}

.library-map-section {
  max-width: 1580px;
}

.flow-map-preview,
.map-overlay-content {
  border: 1px solid rgba(199, 218, 232, .16);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(106, 167, 222, .14), transparent 38%),
    linear-gradient(180deg, rgba(19, 32, 43, .92), rgba(8, 14, 22, .96));
  box-shadow: 0 28px 60px rgba(0, 0, 0, .36);
}

.flow-map-preview {
  cursor: zoom-in;
  padding: 18px;
}

.flow-root {
  width: fit-content;
  min-width: 180px;
  margin: 0 auto 22px;
  padding: 14px 20px;
  border: 1px solid rgba(215, 173, 86, .36);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(215, 173, 86, .9), rgba(88, 59, 23, .95));
  color: #080b0e;
  text-align: center;
  font-weight: 950;
  box-shadow: 0 0 26px rgba(106, 167, 222, .28);
}

.flow-lines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.flow-group {
  position: relative;
  padding: 14px;
  border: 1px solid rgba(199, 218, 232, .13);
  border-radius: 8px;
  background: rgba(4, 11, 18, .55);
}

.flow-group h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: #e8f6ff;
}

.flow-group h3 span,
.flow-node small {
  color: var(--muted);
  font-size: 12px;
}

.flow-children {
  display: grid;
  gap: 8px;
}

.flow-node {
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid rgba(106, 167, 222, .24);
  border-radius: 8px;
  background: rgba(15, 28, 39, .86);
  color: var(--ink);
  text-align: right;
  cursor: pointer;
}

.flow-node small {
  display: block;
}

.flow-node:hover {
  background: rgba(36, 72, 96, .9);
}

.flow-hint {
  margin: 14px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.map-overlay[hidden] {
  display: none;
}

.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(14px, 3vw, 28px);
  background: rgba(3, 8, 13, .96);
  backdrop-filter: blur(18px);
}

.map-open {
  overflow: hidden;
}

.map-overlay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.map-overlay-head h2 {
  margin: 0;
}

.map-overlay-content {
  overflow: auto;
  padding: 18px;
}

@media (max-width: 1120px) {
  .reader-shell {
    grid-template-columns: 1fr;
  }

  .book-row {
    grid-template-columns: 42px 1fr;
  }

  .book-route {
    grid-column: 2;
  }
}
