:root {
  /* Common */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Dark Theme (Default) */
  --bg: #040b14;
  --bg-card: #0a1525;
  --bg-elevated: #0d1a2d;
  --bg-hover: #112238;
  --bg-surface: #091320;
  --border: rgba(255, 255, 255, 0.05);
  --border-hi: rgba(255, 255, 255, 0.09);
  --border-card: rgba(255, 255, 255, 0.06);
  --accent: #0ea5e9;
  --accent-dim: rgba(14, 165, 233, 0.10);
  --accent-glow: rgba(14, 165, 233, 0.25);
  --accent-hover: #0284c7;
  --accent-soft: rgba(14, 165, 233, 0.06);
  --text-1: #e8edf5;
  --text-2: #7a8da6;
  --text-3: #3e5068;
  --green-text: #34d399;
  --green-bg: rgba(52, 211, 153, 0.08);
  --green-border: rgba(52, 211, 153, 0.18);
  --orange-text: #fb923c;
  --orange-bg: rgba(251, 146, 60, 0.08);
  --orange-border: rgba(251, 146, 60, 0.20);
  --red: #f43f5e;
  --edit-accent: #22d3ee;
  --edit-glow: rgba(34, 211, 238, 0.15);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--border-card);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-surface: #fdfdfd;
  --border: rgba(0, 0, 0, 0.05);
  --border-hi: rgba(0, 0, 0, 0.08);
  --border-card: rgba(0, 0, 0, 0.06);
  --accent: #0284c7;
  --accent-dim: rgba(2, 132, 199, 0.08);
  --accent-glow: rgba(2, 132, 199, 0.15);
  --accent-hover: #0369a1;
  --accent-soft: rgba(2, 132, 199, 0.04);
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --green-text: #059669;
  --green-bg: rgba(5, 150, 105, 0.08);
  --green-border: rgba(5, 150, 105, 0.15);
  --orange-text: #ea580c;
  --orange-bg: rgba(234, 88, 12, 0.08);
  --orange-border: rgba(234, 88, 12, 0.15);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.15);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px var(--border-card);
}


*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* ======================================
   PAGE LOADER OVERLAY
   ====================================== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-loader.page-loader--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: loaderFadeIn 0.4s ease both;
}

@keyframes loaderFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.loader-logo {
  width: 72px;
  height: 72px;
  animation: loaderPulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(14, 165, 233, 0.5));
}

.loader-logo svg {
  width: 100%;
  height: 100%;
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 18px rgba(14, 165, 233, 0.5)); }
  50%       { transform: scale(1.07); filter: drop-shadow(0 0 30px rgba(14, 165, 233, 0.85)); }
}

.loader-wordmark {
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-1);
  text-transform: uppercase;
}

.loader-bar-track {
  width: 200px;
  height: 3px;
  background: var(--border-hi);
  border-radius: 99px;
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  border-radius: 99px;
  animation: loaderBarFill 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.6);
}

@keyframes loaderBarFill {
  0%   { width: 0%; }
  60%  { width: 75%; }
  85%  { width: 88%; }
  100% { width: 100%; }
}

.loader-status {
  font-size: 0.75rem;
  color: var(--text-2);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Prevent scrolling while loader is visible */
body.loading {
  overflow: hidden;
}

/* Main content fades in after loader disappears */
body.page-ready header,
body.page-ready main,
body.page-ready footer {
  animation: contentReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes contentReveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}


body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}


::selection {
  background: rgba(14, 165, 233, 0.25);
  color: #fff;
}


::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}


.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


header {
  background: linear-gradient(180deg, #030a12 0%, var(--bg) 100%);
  padding: 28px 28px 30px;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 10;
}

.header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}


.header-center pre.ascii-banner {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.15;
  color: #1a3560;
  background: transparent;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  display: inline-block;
  letter-spacing: 0.02em;
  user-select: none;
  text-shadow: 0 0 40px rgba(14, 165, 233, 0.08);
}

.header-center pre.ascii-banner .credit-line {
  color: var(--text-3);
  font-size: 0.7em;
  letter-spacing: 0.35em;
  text-shadow: none;
}


#searchBox {
  width: 100%;
  max-width: 520px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-1);
  background: var(--bg-elevated);
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background 0.25s;
  caret-color: var(--accent);
}

#searchBox:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 2px 16px rgba(14, 165, 233, 0.08);
  background: var(--bg-hover);
}

/* Book Banner Slider */
.book-banner {
  width: 100%;
  max-width: 520px;
  height: 180px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-hi);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  box-shadow: var(--shadow-md);
}

.banner-track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 0.6s var(--ease-out);
}

.banner-item {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  gap: 20px;
}

.banner-img {
  height: 140px;
  width: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.banner-info {
  text-align: left;
  flex: 1;
}

.banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.banner-author {
  font-size: 0.85rem;
  color: var(--text-2);
}

.banner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, var(--bg-card) 0%, transparent 15%, transparent 85%, var(--bg-card) 100%);
  opacity: 0.3;
}

@media screen and (max-width: 600px) {
  .book-banner {
    height: 140px;
    max-width: 100%;
  }

  .banner-img {
    height: 110px;
    width: 80px;
  }

  .banner-title {
    font-size: 0.95rem;
  }

  .banner-author {
    font-size: 0.75rem;
  }
}

#searchBox::placeholder {
  color: var(--text-3);
  font-weight: 400;
}


.menu-button {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  transition: all 0.25s var(--ease-out);
  z-index: 1001;
  padding: 0;
}

.menu-button:hover {
  background: var(--bg-hover);
  border-color: rgba(14, 165, 233, 0.3);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.menu-button span {
  display: block;
  width: 17px;
  height: 1.5px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.3s var(--ease-out);
}

.menu-button.active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
  background: var(--accent);
}

.menu-button.active span:nth-child(2) {
  opacity: 0;
}

.menu-button.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
  background: var(--accent);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: absolute;
  top: 24px;
  right: 80px;
  /* To the left of the menu button */
  width: 42px;
  height: 42px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s var(--ease-out);
  z-index: 1001;
  padding: 0;
  color: var(--text-2);
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: rgba(14, 165, 233, 0.3);
  color: var(--accent);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s var(--ease-spring);
}

.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

[data-theme="light"] .sun-icon {
  display: block;
}

[data-theme="light"] .moon-icon {
  display: none;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
}


.side-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 310px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 48px rgba(0, 0, 0, 0.55);
  transition: right 0.35s var(--ease-out);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(16px);
}

.side-panel.open {
  right: 0;
}

.panel-content {
  padding: 28px 22px;
}

.panel-content h2 {
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0 0 18px;
}

.collapsible-section {
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.25s;
}

.collapsible-section:hover {
  border-color: var(--border-hi);
}

.section-header {
  background: var(--bg-elevated);
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all 0.2s var(--ease-out);
}

.section-header:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}

.arrow {
  font-size: 0.55rem;
  transition: transform 0.3s var(--ease-out);
  color: var(--text-3);
}

.collapsible-section.active .arrow {
  transform: rotate(180deg);
  color: var(--accent);
}

.section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease-out), padding 0.3s;
  padding: 0 16px;
  background: var(--bg-card);
}

.collapsible-section.active .section-content {
  max-height: 220px;
  padding: 14px 16px;
}

.section-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.section-content li {
  padding: 4px 0;
  color: var(--text-2);
  font-size: 0.82rem;
}

.section-content p {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.7;
  margin: 0 0 8px;
}

.section-content p:last-child {
  margin-bottom: 0;
}

.section-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.section-content a:hover {
  text-decoration: underline;
  color: #38bdf8;
}


main {
  flex: 1;
  padding: 32px 28px;
  position: relative;
  z-index: 1;
}

.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin: 0 0 20px;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
}

@media (max-width: 1280px) {
  .book-list {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .book-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .book-list {
    grid-template-columns: repeat(2, 1fr);
  }
}


.book {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 20px 16px 18px;
  text-align: center;
  transition: all 0.35s var(--ease-out);
  box-shadow: var(--shadow-card);
}

.book::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.03) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  pointer-events: none;
}

.book:hover {
  border-color: rgba(14, 165, 233, 0.2);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.15), 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 60px rgba(14, 165, 233, 0.06);
  transform: translateY(-6px);
}

.book:hover::before {
  opacity: 1;
}

/* Skeleton Card Loader */
.book.skeleton {
  pointer-events: none;
  user-select: none;
}

.book.skeleton .skeleton-img {
  width: 140px;
  height: 192px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin-bottom: 14px;
  order: 1;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-title {
  width: 78%;
  height: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  order: 2;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-btn {
  width: 88%;
  height: 38px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  order: 4;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.book.skeleton .skeleton-meta {
  display: flex;
  gap: 6px;
  order: 3;
  margin-bottom: 14px;
}

.book.skeleton .skeleton-badge {
  width: 48px;
  height: 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}

.book-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius);
}

.book-empty-state h3 {
  color: var(--text-1);
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.book-empty-state p {
  color: var(--text-2);
  font-size: 0.88rem;
}


.book img {
  width: 140px;
  height: 192px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
  order: 1;
  margin-bottom: 14px;
  display: block;
}

.book:hover img {
  transform: scale(1.04);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(14, 165, 233, 0.12);
}


.book p {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 10px;
  line-height: 1.4;
  order: 2;
  font-style: normal;
}


.book-meta {
  display: flex;
  order: 3;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  min-height: 22px;
  align-self: center;
}


.book-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.orange {
  color: var(--orange-text);
  background: var(--orange-bg);
  border: 1px solid var(--orange-border);
}

.green {
  color: var(--green-text);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}


.book a {
  display: block;
  order: 4;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  text-decoration: none;
  text-align: center;
  letter-spacing: 0.03em;
  transition: all 0.25s var(--ease-out);
  margin: 0;
  position: relative;
  overflow: hidden;
}

.book a::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s;
}

.book a:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.book a:hover::after {
  opacity: 1;
}

.book a:active {
  transform: translateY(0);
}


.book-description,
.book-platform {
  display: none;
}

.mobile-book-title {
  display: none;
}


footer {
  text-align: center;
  padding: 24px 18px;
  font-size: 0.76rem;
  background: #030810;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  margin-top: auto;
  letter-spacing: 0.02em;
  line-height: 1.9;
}

footer a {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

footer a:hover {
  color: var(--accent);
}


.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease-out);
  z-index: 1000;
  box-shadow: 0 4px 20px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.scroll-to-top:active {
  transform: translateY(-1px);
}

body.menu-open {
  overflow: hidden;
}


@media (max-width: 1200px),
(pointer: coarse) {

  .menu-button,
  .side-panel {
    display: none !important;
  }
}


@media screen and (max-width: 600px),
screen and (max-device-width: 600px),
screen and (orientation: portrait) and (pointer: coarse) {

  html,
  body {
    background: var(--bg);
    color: var(--text-1);
    overflow-x: hidden;
  }

  header {
    padding: 16px 14px 20px;
    background: linear-gradient(180deg, #030a12 0%, var(--bg) 100%);
  }

  .header-center {
    gap: 14px;
    padding: 0 2px;
    width: 100%;
  }

  .header-center pre.ascii-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    color: #1a3560;
    font-size: clamp(4px, 1.5vw, 7.5px);
    line-height: 1.08;
    white-space: pre;
    text-align: center;
  }

  .header-center pre.ascii-banner .credit-line {
    display: block;
    width: 100%;
    color: var(--text-3);
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.15em;
    font-size: 1em;
  }

  #searchBox {
    width: min(100%, 420px);
    max-width: 420px;
    min-height: 44px;
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-1);
    border: 1px solid var(--border-hi);
  }

  .menu-button {
    display: flex !important;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
  }

  .theme-toggle-btn {
    top: 64px;
    /* Directly under the menu button */
    right: 14px;
    width: 40px;
    height: 40px;
  }

  main {
    padding: 14px 10px 28px;
  }

  .section-title {
    display: none;
  }

  .book-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 0;
    margin: 0 !important;
  }

  .book {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    min-height: 88px;
    display: grid !important;
    grid-template-columns: 54px minmax(0, 1fr) 88px;
    grid-template-rows: auto 1fr;
    grid-template-areas: "thumb title action" "thumb badge action";
    column-gap: 12px;
    row-gap: 2px;
    align-content: center;
    padding: 12px 12px 12px 14px;
    border-radius: var(--radius-sm);
    text-align: left;
    transform: none !important;
    box-shadow: var(--shadow-xs);
  }

  .book::before {
    display: none;
  }

  .book:hover {
    transform: none !important;
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2), var(--shadow-sm);
  }

  .book img {
    grid-area: thumb;
    width: 48px;
    height: 66px;
    margin: 0;
    padding: 0;
    order: unset !important;
    border-radius: var(--radius-xs);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .book:hover img {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  .book p {
    grid-area: title;
    align-self: end;
    margin: 0 0 3px;
    font-size: 0.86rem;
    font-style: normal;
    order: unset !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .book-meta {
    grid-area: badge;
    justify-content: flex-start;
    margin: 0;
    gap: 4px;
    order: unset !important;
    align-self: start;
    min-height: auto;
    display: grid !important;
    grid-template-columns: max-content max-content;
    column-gap: 4px;
    row-gap: 2px;
    width: max-content;
  }

  .book-badge {
    padding: 2px 6px;
    font-size: 0.55rem;
  }

  .book a {
    grid-area: action;
    width: 84px;
    min-width: 0;
    font-size: 0;
    padding: 9px 5px;
    order: unset !important;
    align-self: center;
    justify-self: end;
    margin: 0;
    border-radius: var(--radius-xs);
    transform: none !important;
  }

  .book a:hover {
    transform: none !important;
  }

  .book a::after {
    display: none;
  }

  .book a::before {
    content: "Read & Get";
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
  }

  .side-panel {
    display: block !important;
    width: min(300px, 88vw);
    right: calc(-1 * min(300px, 88vw));
  }

  .side-panel.open {
    right: 0 !important;
  }

  footer {
    padding: 18px 12px;
    font-size: 0.7rem;
  }

  .scroll-to-top {
    bottom: 14px;
    right: 12px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
}


@media screen and (max-width: 600px),
screen and (max-device-width: 600px),
screen and (orientation: portrait) and (pointer: coarse) {

  header .menu-button {
    display: flex !important;
  }

  body main .book-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  body main .book-list .book {
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 88px !important;
    margin: 0 !important;
  }

  body .book .book-meta {
    grid-area: badge;
    justify-content: flex-start;
    align-self: start;
  }

  body .book p {
    grid-area: title;
    align-self: center;
    min-width: 0;
    width: 100%;
    color: var(--text-1);
  }

  body .book-badge.green {
    color: var(--green-text);
    background: var(--green-bg);
    border: 1px solid var(--green-border);
  }

  body .book-badge.orange {
    color: var(--orange-text);
    background: var(--orange-bg);
    border: 1px solid var(--orange-border);
  }

  body .book a {
    grid-area: action;
    width: 84px;
    min-width: 0;
    padding: 9px 5px;
    font-size: 0;
  }

  body .book a::before {
    content: "Read & Get";
    margin: 0;
    font-size: 0.6rem;
    display: block;
  }

  body .book a::after {
    display: none;
  }
}




.edit-mode-active {
  --admin-accent: var(--edit-accent);
}

#editModeBar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 2000;
  background: linear-gradient(135deg, #0a1628 0%, #0d1f38 100%);
  border-bottom: 1px solid rgba(34, 211, 238, 0.2);
  color: #fff;
  padding: 14px 22px;
  box-shadow: 0 4px 24px rgba(34, 211, 238, 0.1);
  font-family: inherit;
}

.edit-mode-active #editModeBar {
  display: block;
  animation: slideDownBar 0.35s var(--ease-out);
}

@keyframes slideDownBar {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.edit-bar-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.edit-bar-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.edit-badge-pill {
  background: var(--edit-accent);
  color: #04101e;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: var(--radius-xs);
}

.edit-bar-info>span {
  font-size: 0.88rem;
  color: #c7daf0;
}


.edit-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.edit-btn-primary {
  background: var(--edit-accent);
  color: #04101e;
}

.edit-btn-primary:hover {
  background: #67e8f9;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.25);
}

.edit-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.edit-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.2);
}

.edit-btn-success {
  background: #10b981;
  color: #fff;
  font-weight: 700;
}

.edit-btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.edit-btn-danger {
  background: var(--red);
  color: #fff;
}

.edit-btn-danger:hover {
  background: #e11d48;
}

.edit-btn-cancel {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.edit-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}


.edit-mode-active .book {
  border: 1px dashed rgba(34, 211, 238, 0.25) !important;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.08), var(--shadow-sm) !important;
  position: relative;
}

.edit-mode-active .book:hover {
  border-color: rgba(34, 211, 238, 0.45) !important;
}

.card-edit-overlay {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  gap: 5px;
  z-index: 10;
}

.edit-mode-active .card-edit-overlay {
  display: flex;
}

.card-action-btn {
  background: rgba(10, 21, 37, 0.92);
  color: #fff;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-xs);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.2s var(--ease-out);
}

.card-action-btn:hover {
  background: var(--edit-accent);
  color: #000;
  border-color: var(--edit-accent);
}

.card-action-btn.delete:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}



.edit-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.edit-modal-backdrop.active {
  display: flex;
}

.edit-modal-box {
  background: #0b1626;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(34, 211, 238, 0.06);
  color: #f1f5f9;
  padding: 28px;
  animation: modalPop 0.3s var(--ease-spring);
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.edit-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

.edit-modal-header h3 {
  margin: 0;
  color: var(--edit-accent);
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 700;
}

.edit-modal-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.2s;
}

.edit-modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.edit-form-group {
  margin-bottom: 18px;
  text-align: left;
}

.edit-form-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #7aa2c7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.edit-form-group input,
.edit-form-group select {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  background: #060e1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.edit-form-group input:focus,
.edit-form-group select:focus {
  border-color: rgba(34, 211, 238, 0.4);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.edit-form-group input::placeholder {
  color: var(--text-3);
}


.image-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: #060e1a;
  padding: 22px;
  text-align: center;
  transition: all 0.25s var(--ease-out);
  cursor: pointer;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-drop-zone:hover {
  border-color: rgba(34, 211, 238, 0.2);
  background: rgba(34, 211, 238, 0.02);
}

.image-drop-zone.drag-over {
  border-color: var(--edit-accent);
  background: rgba(34, 211, 238, 0.06);
  box-shadow: 0 0 32px rgba(34, 211, 238, 0.12);
  transform: scale(1.01);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-zone-text {
  color: #7aa2c7;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0;
}

.drop-zone-subtext {
  color: #475569;
  font-size: 0.76rem;
  margin: 0;
}

.drop-zone-hint {
  color: #3e5068;
  font-size: 0.68rem;
  margin: 4px 0 0;
}

.drop-zone-hint code {
  background: rgba(34, 211, 238, 0.08);
  color: var(--edit-accent);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  user-select: none;
}

.file-upload-label:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.drop-zone-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.drop-zone-preview img {
  width: 68px;
  height: 92px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sm);
}

.drop-zone-preview-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.drop-zone-preview-info span {
  font-size: 0.78rem;
  color: #7aa2c7;
  font-weight: 500;
}

.remove-img-btn {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  text-align: left;
  transition: all 0.2s var(--ease-out);
}

.remove-img-btn:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: var(--red);
}

.edit-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}


#editToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  color: var(--text-1);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi);
  font-weight: 600;
  font-size: 0.84rem;
  font-family: inherit;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 4000;
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

#editToast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   PAGE LOADER & STARTING ANIMATION
   ========================================================================== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s ease;
  pointer-events: all;
}

.page-loader--done {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: loaderFadeIn 0.4s ease-out;
}

.loader-logo {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: hidden;
  animation: loaderPulse 1.8s ease-in-out infinite;
}

.loader-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.loader-wordmark {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.loader-bar-track {
  width: 140px;
  height: 3px;
  background: var(--border-hi);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 45%;
  background: var(--accent);
  border-radius: 99px;
  animation: loaderIndeterminate 1.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

.loader-status {
  font-size: 0.78rem;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

@keyframes loaderFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes loaderPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(14, 165, 233, 0));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 14px rgba(14, 165, 233, 0.35));
  }
}

@keyframes loaderIndeterminate {
  0% {
    left: -45%;
  }
  100% {
    left: 100%;
  }
}

/* Page content reveal transition */
body.loading header,
body.loading main,
body.loading footer,
body.loading .theme-toggle-btn,
body.loading .menu-button,
body.loading .scroll-to-top {
  opacity: 0;
}

header,
main,
footer,
.theme-toggle-btn,
.menu-button,
.scroll-to-top {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.page-ready header,
body.page-ready main,
body.page-ready footer,
body.page-ready .theme-toggle-btn,
body.page-ready .menu-button,
body.page-ready .scroll-to-top {
  opacity: 1;
}
