/* ==========================================================================
   VIEW PANELS & MAIN PORTAL SYSTEM
   ========================================================================== */

.view-panel {
  display: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100vh;
}

.view-panel.active {
  display: block;
}

/* Reader Top Bar Store Navigation Button */
.btn-store-nav {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.35);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-store-nav:active {
  transform: scale(0.94);
  background: rgba(255, 51, 102, 0.25);
}

.btn-store-nav .icon-store {
  font-size: 14px;
}

/* Paywall Escape Route */
.btn-paywall-free-coins {
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: 1px dashed var(--color-gold);
  color: var(--color-gold);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-paywall-free-coins:active {
  background: rgba(245, 158, 11, 0.15);
}

/* Drawer Footer Portal Link */
.drawer-footer-portal {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.btn-footer-store {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #e11d48 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 51, 102, 0.3);
  transition: transform 0.2s;
}

.btn-footer-store:active {
  transform: scale(0.97);
}

/* Readers Also Loved Section (Chapter Bottom Bridge) */
.reader-recommend-section {
  max-width: 680px;
  margin: 40px auto 20px;
  padding: 20px 16px 30px;
  border-top: 1px solid var(--border-subtle);
}

.recommend-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.recommend-title-row h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.recommend-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.recommend-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.rec-book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.rec-book-card:active {
  transform: scale(0.97);
  border-color: var(--color-primary);
}

.rec-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  background: #000;
}

.rec-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.rec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rec-meta {
  font-size: 11px;
  color: var(--color-gold);
  font-weight: 600;
  margin-top: auto;
}

/* ==========================================================================
   PORTAL VIEW (MAIN BOOKSTORE & ECOSYSTEM)
   ========================================================================== */

.portal-panel {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: calc(75px + var(--sab));
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: calc(10px + var(--sat)) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-logo-icon {
  font-size: 22px;
}

.portal-brand-text {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* High-contrast brand logo gradient for Sepia and Light modes */
html[data-theme="sepia"] .portal-brand-text,
html:not([data-theme]) .portal-brand-text,
body.theme-sepia .portal-brand-text,
html[data-theme="light"] .portal-brand-text,
body.theme-light .portal-brand-text {
  background: linear-gradient(135deg, #b91c1c 0%, #ff3366 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.portal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-wallet-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 11.5px;
  white-space: nowrap;
}

.btn-portal-back {
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 0 9px;
  min-height: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.15s ease;
}

/* 3-Theme Adaptive Colors for Reading Button */
html[data-theme="sepia"] .btn-portal-back,
html:not([data-theme]) .btn-portal-back,
body.theme-sepia .btn-portal-back {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.3);
  color: #be123c;
}

html[data-theme="dark"] .btn-portal-back,
body.theme-dark .btn-portal-back {
  background: rgba(255, 51, 102, 0.15);
  border-color: rgba(255, 51, 102, 0.4);
  color: #ff3366;
}

html[data-theme="light"] .btn-portal-back,
body.theme-light .btn-portal-back {
  background: rgba(225, 29, 72, 0.06);
  border-color: rgba(225, 29, 72, 0.28);
  color: #e11d48;
}

.btn-portal-back:active {
  transform: scale(0.96);
}

.portal-main-body {
  flex: 1;
  width: 100%;
  max-width: 600px;
  min-width: 0;
  margin: 0 auto;
  padding: 14px 16px;
  box-sizing: border-box;
}

.portal-tab {
  display: none;
}

.portal-tab.active {
  display: block;
}

/* Discover: Search & Hero */
.portal-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 8px 14px;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.portal-search-bar:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.15);
}

.portal-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 13px;
}

.btn-clear-search {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: var(--text-sub);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-clear-search:active {
  background: var(--color-primary);
  color: #fff;
}

.btn-clear-search.hidden {
  display: none;
}

.portal-hero-card {
  position: relative;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  gap: 12px !important;
  background: linear-gradient(135deg, #1e1b4b 0%, #311042 50%, #111827 100%);
  border: 1px solid rgba(255, 51, 102, 0.3);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  box-sizing: border-box;
}

/* Elegant theme adaptations for Hero Banner */
html[data-theme="sepia"] .portal-hero-card,
html:not([data-theme]) .portal-hero-card,
body.theme-sepia .portal-hero-card {
  background: linear-gradient(135deg, #2b1810 0%, #3d2318 50%, #20120b 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 20px rgba(61, 48, 35, 0.25);
}

html[data-theme="light"] .portal-hero-card,
body.theme-light .portal-hero-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #2e1065 50%, #172554 100%);
  border: 1px solid rgba(255, 51, 102, 0.25);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.hero-cover-col {
  flex: 0 0 78px !important;
  width: 78px !important;
  display: flex !important;
  align-items: center !important;
}

.hero-cover-wrap {
  position: relative;
  width: 78px;
  height: 106px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.hero-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-cover-badge {
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 5px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.3px;
  line-height: 1.2;
  z-index: 2;
}

.hero-info-col {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 3px !important;
  padding: 1px 0 !important;
}

.hero-header-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  margin-bottom: 1px !important;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background: var(--color-primary);
  color: #fff;
  font-size: 9.5px;
  font-weight: 900;
  padding: 1.5px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  line-height: 1.2;
}

.hero-rating-badge {
  font-size: 11px;
  color: #fbbf24 !important;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.65);
  padding: 1.5px 6px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  white-space: nowrap;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.hero-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Specific theme font adjustments for Hero Banner text */
html[data-theme="sepia"] .hero-desc,
body.theme-sepia .hero-desc {
  color: #dcd1ba;
}

html[data-theme="light"] .hero-desc,
body.theme-light .hero-desc {
  color: #e2e8f0;
}

.hero-footer-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-top: auto !important;
  padding-top: 2px !important;
}

.hero-chs-tag {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}

html[data-theme="sepia"] .hero-chs-tag,
body.theme-sepia .hero-chs-tag {
  color: #fde68a !important; /* High contrast amber on sepia dark hero */
}

html[data-theme="sepia"] .hero-chs-tag,
body.theme-sepia .hero-chs-tag {
  color: #c2b396;
}

.btn-hero-read {
  width: auto;
  min-width: 80px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #e11d48 100%);
  color: #ffffff;
  border: none;
  border-radius: 13px;
  padding: 0 10px;
  min-height: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 51, 102, 0.35);
  transition: transform 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.2px;
  margin: 0;
}

.btn-hero-read:active {
  transform: scale(0.96);
}

/* Genre Pills */
.genre-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}

.genre-pills::-webkit-scrollbar {
  display: none;
}

.genre-pill {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  padding: 0 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  cursor: pointer;
  white-space: nowrap;
}

.genre-pill.active {
  background: rgba(255, 51, 102, 0.15);
  border-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 700;
}

.genre-pill[data-genre="short_story"].active {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #10b981;
}

.genre-pill[data-genre="long_epic"].active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #f59e0b;
}

/* Section Title Bar */
.portal-section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
}

.portal-section-title-bar h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.title-tip {
  font-size: 11px;
  color: var(--text-muted);
}

/* Bookstore Book Grid */
.portal-book-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 800px;
  contain: layout style;
}

.empty-search-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 42px 20px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: 16px;
  margin: 10px 0;
}

.empty-icon {
  font-size: 38px;
  margin-bottom: 10px;
}

.empty-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.4;
}

.empty-desc strong {
  color: var(--color-primary);
}

.btn-reset-search {
  background: linear-gradient(135deg, var(--color-primary), #e11d48);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 22px;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--color-primary-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-reset-search:active {
  transform: scale(0.96);
}

.book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 14px;
  transition: transform 0.2s, border-color 0.2s;
}

.book-card:active {
  transform: scale(0.98);
  border-color: var(--color-primary);
}

.book-card-cover-wrap {
  position: relative;
  width: 90px;
  aspect-ratio: 2 / 3;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.12) 0%, rgba(30, 27, 75, 0.3) 100%);
}

.book-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 900;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.book-badge.gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.book-badge.red {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
}

.book-badge.purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.book-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 4px;
}

.book-card-author {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.book-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  margin-bottom: 6px;
}

.book-card-meta .rating {
  color: var(--color-gold);
  font-weight: 700;
}

.book-card-meta .reads {
  color: var(--text-sub);
}

.book-card-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.book-card-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sub);
  padding: 2px 7px;
  border-radius: 4px;
}

.book-tag-complete {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-emerald);
  border: 1px solid rgba(16, 185, 129, 0.28);
  white-space: nowrap;
  line-height: 1.2;
}

.book-tag-featured {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-gold);
  border: 1px solid rgba(245, 158, 11, 0.28);
  white-space: nowrap;
  line-height: 1.2;
}

.book-tag-short {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
  line-height: 1.2;
}

.book-tag-long {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
  white-space: nowrap;
  line-height: 1.2;
}

.book-tag-spice {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(244, 63, 94, 0.18));
  color: #ff4d6d;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.2);
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1.2;
}

body.theme-light .book-tag-spice,
body.theme-sepia .book-tag-spice {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.35);
}

.genre-pill.spicy-pill {
  color: #ff4d6d;
  border-color: rgba(255, 77, 109, 0.35);
  font-weight: 700;
}

.genre-pill.spicy-pill.active {
  background: linear-gradient(135deg, #ff3366, #e11d48);
  color: #ffffff;
  border-color: #ff3366;
  box-shadow: 0 2px 10px rgba(255, 51, 102, 0.35);
}

/* Desktop Auditor Safe Mode: Strictly hide spicy genre buttons and badges on desktop screens */
@media (min-width: 850px) {
  .genre-pill.spicy-pill,
  .book-tag-spice,
  .featured-spice-badge {
    display: none !important;
  }
}

.book-card-cover-wrap {
  position: relative;
}

body.theme-light .book-tag-complete,
body.theme-sepia .book-tag-complete {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.4);
}

body.theme-light .book-tag-featured,
body.theme-sepia .book-tag-featured {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.4);
}

body.theme-light .book-card-tag,
body.theme-sepia .book-card-tag {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-sub);
}

.btn-card-read {
  align-self: flex-start;
  margin-top: auto;
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid rgba(255, 51, 102, 0.4);
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 700;
  padding: 0 16px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 17px;
  cursor: pointer;
  white-space: nowrap;
}

html[data-theme="sepia"] .btn-card-read,
body.theme-sepia .btn-card-read {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.35);
  color: #e11d48;
}

.btn-card-read:active {
  background: var(--color-primary);
  color: #fff;
}

/* Bookshelf Tab Styles */
.resume-reading-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 51, 102, 0.3);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.resume-cover-wrap {
  width: 75px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.resume-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resume-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.resume-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

.resume-details h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 2px 0 4px;
  line-height: 1.3;
}

.resume-details p {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-gold) 100%);
}

.btn-resume-cta {
  align-self: flex-start;
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
}

.library-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Rewards Tab Styles */
.reward-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.reward-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.reward-box-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.reward-box-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.streak-pill {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 10px;
}

.streak-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.streak-day {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.streak-day.current {
  border-color: var(--color-gold);
  background: rgba(245, 158, 11, 0.12);
}

.streak-day.claimed {
  opacity: 0.6;
}

.streak-day.mega {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  border-color: var(--color-primary);
}

.s-day {
  font-size: 10px;
  color: var(--text-muted);
}

.s-coins {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-gold);
}

.s-status {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-sub);
}

.streak-day.current .s-status {
  color: var(--color-emerald);
}

.btn-checkin-action {
  width: 100%;
  background: linear-gradient(135deg, var(--color-gold) 0%, #d97706 100%);
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: transform 0.2s;
}

.btn-checkin-action:active {
  transform: scale(0.98);
}

.btn-checkin-action.claimed {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Daily Quests Deck */
.quest-deck {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.quest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
}

.quest-icon {
  font-size: 24px;
}

.quest-text {
  flex: 1;
}

.quest-text h5 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.quest-text p {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-quest-cta {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-quest-cta.gold {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-quest-cta.emerald {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--color-emerald);
  color: var(--color-emerald);
}

.btn-quest-cta.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-quest-cta.claimed {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Profile Tab Styles */
.profile-guest-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.guest-avatar-large {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.guest-info-block {
  flex: 1;
}

.guest-header-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.guest-status-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.guest-warning {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.wallet-balance-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.wallet-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallet-tile-icon {
  font-size: 24px;
}

.wallet-tile-label {
  font-size: 10px;
  color: var(--text-muted);
}

.wallet-tile-val {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
}

/* Recharge Grid */
.recharge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.recharge-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.recharge-card.best {
  border-color: var(--color-primary);
  background: rgba(255, 51, 102, 0.08);
}

.recharge-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.recharge-badge.gold {
  color: var(--color-gold);
}

.recharge-coin-count {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.recharge-usd {
  font-size: 16px;
  font-weight: 900;
  color: var(--color-gold);
  margin-bottom: 8px;
}

.btn-recharge-pack {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
}

.recharge-card.best .btn-recharge-pack {
  background: var(--color-primary);
  color: #fff;
  border: none;
}

/* VIP Subscription Card */
.vip-sub-card {
  background: linear-gradient(135deg, #311042 0%, #1e1b4b 100%);
  border: 1px solid rgba(255, 51, 102, 0.4);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}

.vip-sub-text h4 {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.vip-sub-text p {
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.btn-vip-checkout {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-gold) 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

/* Ledger Box */
.ledger-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.ledger-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
}

.ledger-amt.green {
  color: var(--color-emerald);
  font-weight: 700;
}

/* Footer Links */
.portal-footer-links {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 10px 0;
}

.portal-footer-links .link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  -webkit-tap-highlight-color: transparent;
}

/* Fixed Bottom Tab Navigation */
.portal-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-overlay);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 16px calc(8px + var(--sab));
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  box-sizing: border-box;
}

.portal-nav-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.p-nav-icon {
  font-size: 18px;
}

.p-nav-label {
  font-size: 11px;
  font-weight: 600;
}

.portal-nav-btn.active {
  color: var(--color-primary);
}

.portal-nav-btn.active .p-nav-label {
  font-weight: 800;
}

/* ==========================================================================
   AD & MODAL ENHANCEMENTS
   ========================================================================== */

/* 15s Video Ad Simulation Modal */
.ad-video-modal-card {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  width: 90%;
  max-width: 380px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  color: #fff;
}

.ad-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
}

.ad-tag {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

.ad-countdown {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-gold);
}

.btn-ad-close {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-ad-close:active {
  transform: scale(0.9);
  background: rgba(255, 51, 102, 0.4);
  border-color: #ff3366;
}

.ad-video-screen {
  height: 220px;
  background: radial-gradient(circle at center, #2e1065 0%, #09090b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.ad-brand-logo {
  font-size: 18px;
  font-weight: 900;
  color: #facc15;
  margin-bottom: 8px;
}

.ad-brand-slogan {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.ad-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.ad-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  transition: width 1s linear;
}

.ad-video-footer {
  padding: 12px 16px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}

/* Exit & Small Modals */
.small-modal, .exit-modal {
  max-width: 360px;
}

.modal-icon-header, .exit-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: 8px;
}

.modal-input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.modal-input:focus {
  border-color: var(--color-primary);
}

.exit-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-secondary-action {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
}

/* ==========================================================================
   FEATURED BESTSELLERS & RANKINGS MODULE (MODULARIZED DISCOVER TAB)
   ========================================================================== */

.portal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px 0;
}

.portal-section-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.section-badge-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 51, 102, 0.15);
  color: var(--color-primary);
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.section-badge-pill.gold {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-gold);
  border-color: rgba(245, 158, 11, 0.35);
}

/* Featured Bestsellers Cards Grid */
.featured-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  min-height: 240px;
  contain: layout style;
  width: 100%;
}

.featured-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  min-width: 0;
}

.featured-card:hover, .featured-card:active {
  transform: translateY(-2px);
  border-color: rgba(255, 51, 102, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.featured-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.12) 0%, rgba(30, 27, 75, 0.3) 100%);
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.featured-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.featured-badge.top-rank {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.featured-badge.hot {
  background: linear-gradient(135deg, #ff3366, #e11d48);
}

.featured-badge.ai-trend {
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.featured-badge.complete {
  background: linear-gradient(135deg, #10b981, #059669);
}

.featured-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  height: 2.7em;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-author {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 1.3em;
}

.featured-spice-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #ff6b81;
  font-size: 9.5px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  letter-spacing: 0.2px;
  line-height: 1.2;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

html[data-theme="sepia"] .featured-spice-badge,
body.theme-sepia .featured-spice-badge {
  background: rgba(43, 24, 16, 0.85);
  border-color: rgba(225, 29, 72, 0.5);
  color: #f43f5e;
}

html[data-theme="light"] .featured-spice-badge,
body.theme-light .featured-spice-badge {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(225, 29, 72, 0.5);
  color: #ff3366;
}

/* Desktop Auditor Safe Mode: Strictly hide spicy genre buttons and badges on desktop screens */
@media (min-width: 850px) {
  .featured-spice-badge {
    display: none !important;
  }
}

.featured-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 0 0;
  width: 100%;
}

.featured-meta .chapters {
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.featured-meta .book-tag-complete {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.2;
  flex-shrink: 0;
}

.btn-read-featured {
  width: 100%;
  padding: 0 8px;
  min-height: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255, 51, 102, 0.12);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 51, 102, 0.28);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.btn-read-featured:active {
  background: var(--color-primary);
  color: #fff;
  transform: scale(0.97);
}

/* 3-Theme Color Adaptations for Featured Cards */
html[data-theme="sepia"] .featured-title,
body.theme-sepia .featured-title {
  color: #2b1d0c;
}
html[data-theme="sepia"] .featured-author,
body.theme-sepia .featured-author {
  color: #8c7b69;
}
html[data-theme="sepia"] .featured-meta .chapters,
body.theme-sepia .featured-meta .chapters {
  color: #786350;
}
html[data-theme="sepia"] .featured-spice-badge,
body.theme-sepia .featured-spice-badge {
  background: rgba(43, 29, 12, 0.82);
  border-color: rgba(225, 29, 72, 0.45);
  color: #ff6b8b;
}
html[data-theme="sepia"] .btn-read-featured,
body.theme-sepia .btn-read-featured {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.3);
  color: #be123c;
}

html[data-theme="dark"] .featured-title,
body.theme-dark .featured-title {
  color: #f8fafc;
}
html[data-theme="dark"] .featured-author,
body.theme-dark .featured-author {
  color: #94a3b8;
}
html[data-theme="dark"] .featured-meta .chapters,
body.theme-dark .featured-meta .chapters {
  color: #cbd5e1;
}
html[data-theme="dark"] .featured-spice-badge,
body.theme-dark .featured-spice-badge {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(239, 68, 68, 0.55);
  color: #ff6b81;
}
html[data-theme="dark"] .btn-read-featured,
body.theme-dark .btn-read-featured {
  background: rgba(255, 51, 102, 0.14);
  border: 1px solid rgba(255, 51, 102, 0.35);
  color: #ff3366;
}

html[data-theme="light"] .featured-title,
body.theme-light .featured-title {
  color: #0f172a;
}
html[data-theme="light"] .featured-author,
body.theme-light .featured-author {
  color: #64748b;
}
html[data-theme="light"] .featured-meta .chapters,
body.theme-light .featured-meta .chapters {
  color: #475569;
}
html[data-theme="light"] .featured-spice-badge,
body.theme-light .featured-spice-badge {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(225, 29, 72, 0.4);
  color: #ff6b81;
}
html[data-theme="light"] .btn-read-featured,
body.theme-light .btn-read-featured {
  background: rgba(225, 29, 72, 0.06);
  border: 1px solid rgba(225, 29, 72, 0.28);
  color: #e11d48;
}

/* Expand / Collapse More Featured Button */
.btn-toggle-more {
  width: 100%;
  padding: 11px 16px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  margin-bottom: 22px;
  transition: all 0.2s ease;
}

.btn-toggle-more:active {
  background: rgba(255, 51, 102, 0.1);
  border-color: rgba(255, 51, 102, 0.4);
}

/* Top Trending Rankings List */
.top-ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  min-height: 380px;
  contain: layout style;
}

.top-ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.top-ranking-item:active {
  transform: scale(0.98);
  border-color: rgba(245, 158, 11, 0.4);
}

.rank-index {
  font-size: 16px;
  font-weight: 900;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.rank-index.rank-1 { color: #f59e0b; text-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.rank-index.rank-2 { color: #94a3b8; }
.rank-index.rank-3 { color: #d97706; }
.rank-index.rank-4, .rank-index.rank-5 { color: var(--text-muted); font-size: 14px; }

.rank-cover {
  width: 44px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.rank-info {
  flex: 1;
  min-width: 0;
  padding-right: 4px;
}

.rank-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rank-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.rank-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta-row .rank-rating {
  color: var(--color-gold);
  flex-shrink: 0;
}

.rank-meta-row .rank-bullet {
  color: var(--text-muted);
  opacity: 0.45;
  font-size: 8px;
  flex-shrink: 0;
}

.rank-meta-row .rank-length-text {
  flex-shrink: 0;
}

.rank-meta-row .rank-genre-text {
  color: var(--color-primary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.rank-meta-row .book-tag-spice,
.rank-meta-row .book-tag-complete {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.2;
}

.btn-rank-read {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.35);
  color: var(--color-primary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rank-read:active {
  background: var(--color-primary);
  color: #fff;
  transform: scale(0.92);
}

/* 3-Theme Color Adaptations for Top Rankings */
html[data-theme="sepia"] .rank-title,
body.theme-sepia .rank-title {
  color: #2b1d0c;
}
html[data-theme="sepia"] .rank-desc,
body.theme-sepia .rank-desc {
  color: #8c7b69;
}
html[data-theme="sepia"] .btn-rank-read,
body.theme-sepia .btn-rank-read {
  background: rgba(225, 29, 72, 0.1);
  border-color: rgba(225, 29, 72, 0.3);
  color: #be123c;
}

html[data-theme="dark"] .rank-title,
body.theme-dark .rank-title {
  color: #f8fafc;
}
html[data-theme="dark"] .rank-desc,
body.theme-dark .rank-desc {
  color: #94a3b8;
}
html[data-theme="dark"] .btn-rank-read,
body.theme-dark .btn-rank-read {
  background: rgba(255, 51, 102, 0.15);
  border-color: rgba(255, 51, 102, 0.4);
  color: #ff3366;
}

html[data-theme="light"] .rank-title,
body.theme-light .rank-title {
  color: #0f172a;
}
html[data-theme="light"] .rank-desc,
body.theme-light .rank-desc {
  color: #64748b;
}
html[data-theme="light"] .btn-rank-read,
body.theme-light .btn-rank-read {
  background: rgba(225, 29, 72, 0.06);
  border-color: rgba(225, 29, 72, 0.28);
  color: #e11d48;
}

.rank-read-arrow {
  margin-left: 2px;
}

/* ==========================================================================
   RESPONSIVE MOBILE VIEWPORT ADJUSTMENTS (PREVENT OVERFLOW ON NARROW SCREENS)
   ========================================================================== */
@media (max-width: 480px) {
  .portal-main-body {
    padding: 12px 12px;
  }
  .featured-cards-grid {
    gap: 10px;
  }
  .featured-card {
    padding: 8px;
  }
  .hero-title {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .portal-main-body {
    padding: 10px 8px;
  }
  .portal-header {
    padding-left: 10px;
    padding-right: 10px;
  }
  .portal-brand-text {
    font-size: 16px;
  }
  .featured-cards-grid {
    gap: 8px;
  }
  .featured-card {
    padding: 6px;
  }
  .featured-title {
    font-size: 12px;
  }
  .featured-meta {
    font-size: 10px;
  }
  .btn-read-featured {
    font-size: 10.5px;
    height: 26px;
    min-height: 26px;
  }
  .btn-portal-back {
    font-size: 10.5px;
    height: 26px;
    min-height: 26px;
    padding: 0 8px;
  }
  .book-card {
    padding: 10px 8px;
    gap: 10px;
  }
  .book-card-cover-wrap {
    width: 76px;
  }
  .book-card-title {
    font-size: 14px;
  }
}


