:root {
  color-scheme: light dark;
  
  --primary: #0288D1;
  --accent: #4CAF50;
  --muted: #cccccc;
  --card-bg: #ffffff;
  --surface: #f7f7f8;
  --text: #222;
  --section-bg: #e9e9e9;
  --elev: 0 2px 5px rgba(0, 0, 0, 0.4);
  --vh: 1vh;
}

html,
body {
  height: 100%;
  font-family: 'Vazirmatn', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: #f8f9fb;
  color: var(--text);
}

.app-root {
  max-width: 1100px;
  margin: 18px auto;
  padding: 12px;
}

/* Animation helpers for elements observed by JS (IntersectionObserver) */
.anim-item {
  opacity: 0;
  transform: translateY(12px) translateZ(0);
  transition: opacity 420ms cubic-bezier(.2, .8, .2, 1), transform 420ms cubic-bezier(.2, .8, .2, 1);
  will-change: opacity, transform;
}

.anim-item.visible {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

/* --- header carousel --- */
.header-carousel img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  object-position: center;
  border-radius: 0.75rem;
  display: block;
}

/* quick actions */
.quick-actions {
  background: #eeeeee;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 28px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  box-shadow: var(--elev);
  transition: transform .15s ease, box-shadow .15s ease;
  min-width: 130px;
  justify-content: center;
}

.action-pill.green {
  background: var(--accent);
}

.action-pill .material-icons {
  font-size: 22px;
}

/* section cards */
.section-card {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 0;
  margin-bottom: 16px;
  box-shadow: var(--elev);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  background: var(--section-bg);
  width: 100%;
}

.section-header .title {
  font-weight: 700;
  font-size: 20px;
  padding-inline: 12px;
  flex: 1;
}

.section-header .more-btn,
.more-btn {
  background: #606060;
  color: #f2f2f2;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.section-header .more-btn:hover,
.more-btn:hover {
  background: #2f2f2f;
}

.section-header .more-btn:active,
.more-btn:active {
  transform: translateY(1px);
}

.h-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px;
  padding-bottom: 18px;
}

.h-list::-webkit-scrollbar {
  height: 8px;
}

.h-list::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 8px;
}

.book-card {
  min-width: 100px;
  max-width: 100px;
  background: #f8f8f8;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
  transform-origin: center bottom;
  transition: transform .18s ease;
  cursor: pointer;
}

.book-card .meta {
  padding: 4px;
  font-size: 10px;
  text-align: center;
  display: block;
}

/* Single-line truncation for title and author inside card meta */
.book-card .meta>strong,
.book-card .meta>div {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  padding: 12px;
}

.grid-list.grid-center {
  justify-items: center;
  align-items: center;
  align-content: center;
  justify-content: center;
}


/* Responsive grid: 3 columns on mobile */
@media (max-width: 768px) {
  .grid-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ensure books page uses the same grid spacing as index */
.page-content[data-page="books"] .grid-list {
  grid-template-columns: repeat(auto-fill, 94px);
  padding: 8px;
}

/* Reduce outer padding and tighten gaps on the books page for small screens */
.page-content[data-page="books"] .app-root {
  padding: 6px !important;
}

@media (max-width: 450px) {
  .page-content[data-page="books"] .grid-list {
    gap: 20px;
  }

}

.media-card {
  background: #f8f8f8;
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
}

.media-card img,
.video-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

/* Horizontal layout for music list */
.h-list .media-card {
  box-sizing: border-box;
  min-width: 100px;
  max-width: 100px;
}

.h-list .media-card .music-cover {
  width: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Make video and music titles match picture/book title sizing */
#videoShelf h6,
#musicShelf h6,
.grid-list .media-card h6,
.h-list .media-card h6 {
  font-size: 10px;
  margin-top: 6px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

/* Music thumbnail overlay play button */
.music-thumb-wrap {
  position: relative;
  display: block;
}

.music-cover {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.music-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.music-play-btn .material-icons {
  font-size: 28px;
}

/* hide embedded audio controls in the card (we use the floating player) */
.embedded-audio {
  display: none !important;
}

/* Video thumbnail overlay play button */
.video-thumb-wrap {
  position: relative;
  display: block;
  overflow: hidden;
}

.video-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  z-index: 3;
}

.video-play-btn .material-icons {
  font-size: 28px;
}

@media (max-width: 420px) {
  .video-thumb {
    height: 120px;
  }
}

/* Make video media-cards visually similar in size to music cards when shown
   in the grid on larger screens. This constrains the grid for #videoShelf */
#videoShelf {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

@media (max-width: 420px) {
  #videoShelf {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* Floating fullscreen image viewer using dynamic --vh for mobile compatibility */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
}

.image-viewer.d-none {
  display: none !important;
}

.image-viewer-inner {
  position: relative;
  width: 95vw;
  height: 100%;
  max-width: 1200px;
  max-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
}

.iv-close {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.iv-container {
  flex: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Transparent info button overlay at the bottom of the image */
.iv-info-btn {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.iv-info-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
}

.iv-info-btn .material-icons {
  font-size: 24px;
}

.iv-meta { display: none; }

.iv-title { font-weight: 700; font-size: 16px; }
.iv-description { font-size: 13px; color: #aaa; margin-top: 4px; }

/* Bottom sheet for showing image info (title + description) */
.iv-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 26000;
  background: #fff;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.iv-bottom-sheet.d-none {
  display: none !important;
}

.iv-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.iv-sheet-title {
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}

.iv-sheet-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.iv-sheet-content {
  overflow-y: auto;
  flex: 1;
  padding: 12px;
}

.iv-sheet-description {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Floating fullscreen video player */
.video-player {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25000;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
}

.video-player.d-none { display: none !important; }

.video-player-inner {
  position: relative;
  width: 90vw;
  height: 100%;
  max-width: 1200px;
  max-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
}

.vp-close {
  position: absolute;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  padding: 6px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  left: 0;
  margin: 8px;
}

.vp-close .material-icons {
  font-size: 22px;
}

.vp-close:active {
  background: rgba(255, 255, 255, 0.15);
}

.vp-container {
  flex: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

/* Prevent background page scrolling while overlays are open */
body.no-scroll,
html.no-scroll {
  overflow: hidden !important;
  touch-action: none;
  height: calc(var(--vh, 1vh) * 100);
}

.vp-meta { padding: 12px; color: #fff; }
.vp-title { font-weight: 700; font-size: 16px; }
.vp-subtitle { font-size: 13px; color: #aaa; margin-top: 4px; }

/* Floating music player styles */
.music-player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20000;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.music-player.d-none { display: none; }

.music-player-inner {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
}

.mp-left img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.mp-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mp-title { font-weight: 700; font-size: 14px; }
.mp-subtitle { font-size: 12px; color: #666; }

.mp-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mp-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: #222;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mp-progress-wrap { flex: 1; }
#mp-progress { width: 100%; }

.mp-time {
  font-size: 12px;
  color: #666;
  min-width: 90px;
  text-align: right;
}

.mp-volume-wrap input { width: 80px; }

.mp-close {
  position: absolute;
  left: 12px;
  right: auto;
  top: 6px;
  border: 0;
  background: transparent;
  color: black;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

/* Mobile tweaks for floating music player */
@media (max-width: 420px) {
  .music-player {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 8px;
  }
  .music-player-inner { gap: 8px; }
  .mp-left img { width: 56px; height: 56px; }
  .mp-controls { gap: 8px; }
  .mp-btn { width: 44px; height: 44px; }
  .mp-volume-wrap { display: none !important; }
  .mp-time { min-width: 60px; font-size: 12px; }
  .mp-title { font-size: 13px; }
  .mp-subtitle { font-size: 11px; }
}

.book-info { background: #333; color: white; border-radius: 16px; padding: 12px; }

.book-info img {
  height: 120px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 2.2px 3px 2.9px rgba(0, 0, 0, 0.4);
}

.app-footer {
  text-align: center;
  padding: 22px 0;
  color: #6b6b6b;
}

/* Reserve a safe bottom area on every page so the floating music player doesn't cover content. */
.page-content { --music-space: 96px; }
.page-content .page-footer { height: 0; }

body.music-open .page-content .page-scroll {
  padding-bottom: calc(var(--music-space) + 12px);
}

body.music-open .page-content .page-footer { height: var(--music-space); }

@media (max-width: 420px) {
  .page-content { --music-space: 80px; }
  body.music-open .page-content .page-scroll {
    padding-bottom: calc(var(--music-space) + 8px);
  }
}

/* splash */
#splash-screen {
  position: fixed;
  inset: 0;
  background-color: #fff;
  color: #121212;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease;
}

.splash-content { animation: fadeUp 1.2s ease forwards; }

.splash-icon {
  width: 100px;
  height: 100px;
  border-radius: 20%;
  object-fit: cover;
  animation: pulse 1.5s infinite alternate ease-in-out;
}

.splash-title { font-size: 2rem; font-weight: 600; }
.splash-desc { font-size: 1.1rem; color: #121212AA; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

.fade-out { opacity: 0; pointer-events: none; }
.body-loading { overflow: hidden; }

/* video wrapper */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.lazy-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #000;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.25s ease;
}

.play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
}

.play-icon {
  width: 80px;
  height: 80px;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

/* ---------- FAB styles ---------- */
.fab-wrap {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 1500;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-direction: column;
}

.fab-row { display: flex; align-items: center; gap: 8px; }

.fab-item {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #333;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transform: translateY(10px);
  opacity: 0;
  transition: all .18s ease;
  pointer-events: none;
}

.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #DA4336;
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.fab-label {
  background: #333;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-inline: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  display: none;
}

.fab-text {
  background: #cccccc;
  color: #111;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-inline: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  white-space: nowrap;
  display: none;
}

/* CLOSED by default: items hidden */
.fab-wrap .fab-row-item .fab-item {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.fab-wrap .fab-row-item .fab-text { display: none; }

/* Prevent clicks on the FAB child wrapper when closed (only main remains clickable) */
.fab-wrap .fab-row-item { pointer-events: none; }
.fab-wrap.fab-open .fab-row-item { pointer-events: auto; }

/* OPEN state: when .fab-open on fab-wrap — only toggled by JS */
.fab-wrap.fab-open .fab-row-item .fab-item {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fab-wrap.fab-open .fab-row-item .fab-text { display: block; }

.fab-main-button-wrap { align-self: start; }
.fab-row-item { margin-inline-start: 6px; }

.fab-button,
.fab-button * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

/* ---------- End FAB styles ---------- */

/* Dynamic page container (stacked pages) */
#appPages {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

.page-frame {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  background: #fff;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.36s cubic-bezier(.25, .8, .25, 1), box-shadow .2s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  height: calc(var(--vh, 1vh) * 100);
  min-height: 100dvh;
}

.page-frame.show {
  transform: translateX(0%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  z-index: 9010;
}

.page-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.page-toolbar {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #ddd;
  background: #fff;
  z-index: 10;
  position: relative;
}

.toolbar-back {
  font-size: 28px;
  cursor: pointer;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.page-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.page-scroll {
  overflow-y: auto;
  height: calc(100% - 56px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* When pages are open, disable interactions on main content */
.pages-open #main-content {
  pointer-events: none;
  user-select: none;
}

.pages-open,
.pages-open body,
.pages-open html {
  overflow: hidden;
  height: 100%;
  touch-action: none;
}

.pages-open #appPages { pointer-events: auto; }

/* mobile adjustments */
@media (max-width: 768px) {
  .h-list { gap: 10px; padding: 10px; }
  .section-header .title { font-size: 18px; }
  .header-carousel img { height: 240px; }
  .grid-list { grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px; }
  .app-root { overflow-x: hidden; }
}

@media (max-width: 420px) {
  .grid-list { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; }
  .media-card, .media-card img, .grid-list>* { box-sizing: border-box; max-width: 100%; }
}

/* COVER SECTION */
.cover-wrapper {
  width: 288px;
  height: 411px;
  margin: 0 auto;
  position: relative;
}

.cover-frame {
  position: absolute;
  inset: 0;
  box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.3), 2px -4px 6px rgba(0, 0, 0, 0.4);
  border-radius: 6px;
}

.cover-main { width: 100%; height: 100%; object-fit: cover; }

/* TEXT SECTIONS */
.book-category {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  color: #888;
}

.book-title {
  margin-top: 12px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.book-author {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 12px;
}

.book-description {
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
  padding: 8px;
  line-height: 1.7;
}

/* PROGRESS BAR */
.download-progress {
  margin-top: 20px;
  height: 6px;
  background: #eee;
  border-radius: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 6px;
  width: 0%;
  background: #4CAF50;
}

/* BUTTON */
.action-btn {
  margin-top: 14px;
  width: 100%;
  background: #4CAF50;
  color: white;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  font-weight: 600;
}

/* Constrain action button on book details page so it's not oversized on desktop */
.book-card-details .action-btn {
  width: auto;
  display: block;
  margin: 18px auto;
  padding: 10px 20px;
  font-size: 15px;
  max-width: 420px;
  min-width: 140px;
}

@media (max-width: 768px) {
  .book-card-details .action-btn {
    width: 100%;
    max-width: none;
    margin: 14px 0 0 0;
  }
}

/* Global Modern Scrollbar */
* {
  scrollbar-width: none;
  scrollbar-color: #999 transparent;
}

*::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
  background-color: rgba(120, 120, 120, 0.5);
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(120, 120, 120, 0.7);
}

.drag-scroll {
  overflow-x: hidden;
  overflow-y: hidden;
  white-space: nowrap;
  cursor: grab;
  user-select: none;
}

.drag-scroll.dragging {
  cursor: grabbing;
  scroll-snap-type: none !important;
}

.drag-scroll>* {
  display: inline-block;
  margin-right: 10px;
}

.drag-scroll,
.drag-scroll * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -webkit-user-drag: none;
}

/* Hide scrollbar but allow scroll */
body {
  overflow-y: scroll;
  scrollbar-width: none;
}

/* Chrome, Safari, Edge */
body::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

.book-cover-wrapper {
  height: 112px;
  width: 100%;
}

.book-cover-frame {
  inset: 0;
  box-shadow: 2.2px 3px 2.9px rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  display: block;
  object-fit: cover;
  height: 110px;
  margin: 8px auto;
}

/* =======================================================================
   PDF Viewer (PDF.js canvas pages) — show_book + show_book2
   ======================================================================= */
.page-content[data-page="show_book"],
.page-content[data-page="show_book2"] {
  background: #ffffff !important;
}

.page-content[data-page="show_book"] .app-root,
.page-content[data-page="show_book2"] .app-root {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.page-content[data-page="show_book"] .page-scroll,
.page-content[data-page="show_book2"] .page-scroll {
  padding: 0 !important;
  margin: 0 !important;
  background: #ffffff !important;
  height: calc(var(--vh, 1vh) * 100 - 56px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  min-height: 0 !important;
}

.page-content[data-page="show_book"] .pdf-fullscreen,
.page-content[data-page="show_book2"] .pdf-fullscreen {
  position: relative;
  background: #ffffff !important;
  width: 100% !important;
  min-height: 0 !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

.page-content[data-page="show_book"] .pdf-loading-overlay,
.page-content[data-page="show_book2"] .pdf-loading-overlay {
  position: absolute;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.page-content[data-page="show_book"] .pdf-pages,
.page-content[data-page="show_book2"] .pdf-pages {
  width: 100% !important;
  max-width: none !important;
  padding: 16px 0 110px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff !important;
  box-sizing: border-box !important;
}

.page-content[data-page="show_book"] .pdf-page,
.page-content[data-page="show_book2"] .pdf-page {
  position: relative;
  margin: 0 auto 16px auto;
  background: #ffffff;
  overflow: hidden;
  width: fit-content;
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 0, 0, .25);
  min-height: 200px;
}

.page-content[data-page="show_book"] .pdf-page canvas,
.page-content[data-page="show_book2"] .pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.page-content[data-page="show_book"] .pdf-iframe,
.page-content[data-page="show_book2"] .pdf-iframe { filter: none !important; }

.pdf-float-controls {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 2200;
  font-size: 13px;
  pointer-events: none;
}

.pdf-controls-inner {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  padding: 6px 12px;
  direction: rtl;
}

.pdf-zoom-controls,
.pdf-page-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pdf-btn {
  border: none;
  outline: none;
  background: #f3f3f3;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pdf-btn .material-icons { font-size: 20px; }
.pdf-btn:hover { background: #e5e5e5; }

.pdf-zoom-label { min-width: 44px; text-align: center; font-size: 13px; }

.pdf-page-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  direction: rtl;
  font-size: 13px;
}

#pdfPageInput {
  width: 46px;
  padding: 3px 6px;
  font-size: 13px;
  text-align: center;
}

#pdfPageTotal { min-width: 22px; text-align: center; }

#pdfPageInput::-webkit-outer-spin-button,
#pdfPageInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#pdfPageInput { appearance: textfield; -moz-appearance: textfield; }

@media (max-width: 768px) {
  .pdf-zoom-controls, .pdf-page-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .pdf-btn { padding: 10px 12px; min-width: 44px; min-height: 44px; }
  .pdf-btn .material-icons { font-size: 24px; }
  #pdfPageInput { width: 50px; font-size: 14px; }
  .pdf-zoom-label, .pdf-page-label, #pdfPageTotal { font-size: 14px; white-space: nowrap; }
}

@media (max-width: 450px) {
  .pdf-zoom-controls { display: none; }
  .pdf-float-controls { width: auto; max-width: 100%; padding: 0 8px; box-sizing: border-box; }
  .pdf-controls-inner { max-width: 100%; overflow: hidden; }
}

/* Horizontal scroll container */
.music-cat-strip{
  display:flex;
  gap: 16px;
  overflow-x:auto;
  overflow-y:hidden;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.music-cat-strip > *{ scroll-snap-align: start; }

/* Card (96dp x 96dp) */
.music-cat-card{
  width:96px;
  height:96px;
  flex: 0 0 96px;
  background:#fff;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  position:relative;
  overflow:hidden;
}

.music-cat-card:hover{ cursor: pointer; }

/* Press feedback */
.music-cat-card:active{ transform: translateY(1px); }

.music-cat-card::after{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.06);
  opacity:0;
  transition: opacity .15s ease;
}
.music-cat-card:active::after{ opacity:1; }

.music-cat-card:focus-visible{
  outline: 2px solid rgba(2,136,209,.6);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .music-cat-card{
    width:auto;
    height:auto;
    flex: 1;
    flex-direction: row;
  }
}

/* Icon (48dp x 48dp) */
.music-cat-icon{
  width:48px;
  height:48px;
  object-fit:cover;
  display:block;
}

/* Title */
.music-cat-title{
  margin-top: 8px;
  width:100%;
  padding: 0 6px;
  font-size:10px;
  color: #222;
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
