/* Discover — Readkidz 1.0 Explore layout (Activity / Book) in the V3 paper skin.
   Sizes follow asllata-web Explorer.tsx, activity/Active.tsx, activityHis.tsx, ranking.tsx and
   explorer/_components/BookListNew.tsx; colours map 1.0 greys/accents onto --rk-* tokens. */
/* Discover keeps the shell's side margin like the other main pages (Kim 2026-10-31); the bookstore and creator pages keep theirs. */
.rk-main:has(.discover-page) { padding-block: 24px 34px; }
.rk-main:has(.store-page) { padding-inline: 56px; }
.rk-content:has(.discover-page) { max-width: none; }
.rk-content:has(.discover-page) > .rk-topbar { margin-bottom: 24px; }
.rk-content:has(.discover-page:not(.store-page)) > .rk-topbar { margin-bottom: 32px; }
.discover-page { width: 100%; margin-inline: auto; padding: 0 0 48px; }

.discover-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-block-end: 24px; }
.discover-head h1 { margin: 0; color: var(--rk-ink); font-family: var(--rk-font-body); font-size: 16px; line-height: 1.5; font-weight: 600; }

/* Top tabs (mockup A, 2026-10-21): 1.0's text-xl tabs 32px apart, now 48px tall with a 2px ink underline
   on the selected tab sitting on one hairline under the whole row; unselected tabs read --rk-ink-soft. */
.discover-primary-tabs { display: flex; gap: 32px; margin: 0 0 28px; border-block-end: 1px solid var(--rk-line); }
.rk-topbar .discover-primary-tabs { margin: 0; border-block-end: 0; }
.discover-primary-tabs button { min-height: 48px; margin-block-end: -1px; padding: 0 2px; border: 0; border-block-end: 2px solid transparent; background: transparent; color: var(--rk-ink-soft); font: inherit; font-size: 20px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.discover-primary-tabs [aria-selected=true] { color: var(--rk-ink); font-weight: 700; border-block-end-color: var(--rk-ink); }
#discoverActivities[hidden], #discoverBooks[hidden] { display: none !important; }
.discover-primary-tabs button:focus-visible { outline: 2px solid var(--rk-emerald); outline-offset: 2px; border-radius: 4px; }

/* Shared by the activity and book tabs: load-more / retry row and empty or failed notice */
.dl-more { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 12px; padding: 16px 0; color: var(--rk-ink-soft); font-size: 14px; }
.dl-empty { display: flex; min-height: 240px; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--rk-ink); }
.dl-empty p { margin: 0; color: var(--rk-ink-soft); font-size: 14px; }
.dl-empty .dl-empty-title { color: var(--rk-ink); font-size: 16px; font-weight: 600; }
.dl-empty .dl-empty-title + p { margin-top: 4px; }
.dl-empty .contest-button { margin-top: 12px; }

.discover-store-slot:empty { display: none; }
.discover-feed { min-height: 440px; }

/* Shared Discover pieces */
.discover-book-author { display: flex; min-width: 0; align-items: center; gap: 7px; }
.discover-book-author-avatar { display: grid; width: 24px; height: 24px; flex: 0 0 24px; overflow: hidden; place-items: center; border: 1px solid var(--rk-line); border-radius: 50%; background: var(--rk-emerald-soft); color: var(--rk-emerald); font-size: 10px; font-weight: 850; }
.discover-book-author-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.discover-book-author-name { overflow: hidden; min-width: 0; text-overflow: ellipsis; white-space: nowrap; }
.discover-loading { display: flex; min-height: 440px; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--rk-ink-muted); text-align: center; }
.discover-loading-label { line-height: 1.4; }
.discover-spinner { width: 20px; height: 20px; border: 2px solid var(--rk-line); border-top-color: var(--rk-emerald); border-radius: 50%; animation: discover-spin .8s linear infinite; }

@keyframes discover-spin { to { transform: rotate(360deg); } }

@media (max-width: 740px) {
  .rk-main:has(.discover-page) { padding: 16px; }
  .discover-head { align-items: flex-start; flex-direction: column; margin-block-end: 22px; }
  .discover-primary-tabs { gap: 24px; }
  .discover-primary-tabs button { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .discover-spinner { animation: none; }
}
@media (max-width: 680px) {
  .rk-main:has(.discover-page) { padding-bottom: 126px; }
  .rk-content:has(.discover-page) .rk-top-actions { width: 100%; gap: 6px; flex-wrap: nowrap; }
  .rk-content:has(.discover-page) .rk-top-actions > div:empty { display: none; }
  .rk-content:has(.discover-page) .rk-lang { min-width: 0; flex: 1; max-width: 120px; }
  .rk-content:has(.discover-page) .rk-lang-toggle { min-width: 0; width: 100%; padding-inline: 8px; min-height: 40px; }
  .rk-content:has(.discover-page) .rk-lang-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rk-content:has(.discover-page) .balance-chip { padding-inline: 8px; min-height: 40px; }
  .rk-content:has(.discover-page) :is(.rk-foryou-btn, .rk-bell, .rk-user-toggle) { width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; }
}
