/* GidiReads mobile experience redesign — Stage 2
   Layout-first mobile rules. Desktop layouts and page-specific functionality remain intact. */
:root {
  --gr-mobile-content: 680px;
  --gr-mobile-page-gutter: 16px;
  --gr-mobile-accent: #c9a5e8;
  --gr-mobile-accent-strong: #dfc1f4;
  --gr-mobile-bg: #100a16;
  --gr-mobile-surface: #1a1121;
  --gr-mobile-line: rgba(220, 198, 235, .13);
}

@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: clip; }
  body { min-width: 320px; }
  main, section, article, aside, form { min-width: 0; }
  img, video, canvas, iframe { max-width: 100%; }
  :where(button, a, input, select, textarea) { touch-action: manipulation; }
  :where(button, input, select, textarea) { font-size: max(16px, 1em); }
  .section-inner, .container, .page-shell, .content-wrap, .main-container {
    width: 100%; max-width: 100%;
  }
  .section-inner { padding-left: var(--gr-mobile-page-gutter); padding-right: var(--gr-mobile-page-gutter); }

  /* Shared app header: compact, balanced and safe-area aware. */
  body.has-site-nav { padding-top: calc(58px + env(safe-area-inset-top, 0px)) !important; }
  .site-nav {
    top: 0 !important;
    height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    min-height: calc(58px + env(safe-area-inset-top, 0px)) !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
  }
  .site-nav .nav-inner, .home-page .nav-inner {
    height: 58px !important; min-height: 58px !important;
    padding: 0 13px !important; gap: 9px !important;
  }
  .site-nav .brand-mark, .home-page .brand-mark {
    width: 40px !important; height: 40px !important; max-height: 40px !important;
    object-fit: contain;
  }
  .site-nav .nav-actions { gap: 7px !important; }
  .site-nav .top-icon-btn, .site-nav .home-nav-search {
    width: 36px !important; min-width: 36px !important; height: 36px !important;
    min-height: 36px !important; padding: 0 !important; justify-content: center;
  }
  .site-nav .top-profile-btn, .site-nav .home-profile-avatar {
    flex: 0 0 36px !important; width: 36px !important; min-width: 36px !important;
    height: 36px !important; min-height: 36px !important;
  }
  .site-nav #loginBtn {
    min-height: 35px !important; padding: 0 11px !important;
    border-radius: 999px !important; font-size: .75rem !important;
  }

  /* Phone navigation: stable height, safe-area padding and no content collision. */
  body:has(.bottom-nav) {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .bottom-nav {
    min-height: 64px !important;
    padding: 5px 7px calc(5px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 15px 15px 0 0 !important;
    background: rgba(19, 11, 25, .97) !important;
    border-color: rgba(211, 185, 231, .16) !important;
  }
  .bottom-nav-item {
    min-height: 48px !important; gap: 3px !important;
    font-size: 10px !important; line-height: 1.1 !important;
  }
  .bottom-nav-item svg { width: 20px !important; height: 20px !important; }
  .bottom-nav-write .write-fab { width: 28px !important; height: 28px !important; }

  /* HOME: remove the desktop-style poster stage from the first mobile screen. */
  .home-page .home-hero {
    min-height: 0 !important; display: block !important;
    background:
      radial-gradient(ellipse at 88% 42%, rgba(117, 72, 151, .20), transparent 48%),
      linear-gradient(145deg, #100a16 0%, #160d1e 58%, #100a16 100%) !important;
  }
  .home-page .home-hero::before { width: 300px; height: 300px; right: -190px; top: -160px; }
  .home-page .home-hero-inner {
    display: block !important; width: 100% !important;
    padding: 24px var(--gr-mobile-page-gutter) 22px !important;
  }
  .home-page .home-hero-copy { width: 100%; max-width: 620px; }
  .home-page .home-kicker { margin: 0 0 8px !important; font-size: .65rem !important; letter-spacing: .17em; }
  .home-page .home-hero h1 {
    max-width: none !important; margin: 0 !important;
    font-size: clamp(2.35rem, 9.8vw, 3.35rem) !important;
    line-height: .99 !important; letter-spacing: -.045em !important;
  }
  .home-page .home-hero-sub {
    max-width: 38ch !important; margin: 12px 0 16px !important;
    font-size: .88rem !important; line-height: 1.5 !important;
  }
  .home-page .home-search {
    width: 100% !important; max-width: none !important; min-height: 48px;
    gap: 7px !important; padding: 4px 5px 4px 12px !important;
    border-radius: 12px !important;
  }
  .home-page .home-search svg { width: 18px; height: 18px; }
  .home-page .home-search input {
    min-width: 0 !important; width: 100% !important;
    font-size: .84rem !important;
  }
  .home-page .home-search button {
    flex: 0 0 auto; min-height: 38px; padding: 0 12px !important;
    border-radius: 9px !important; font-size: .78rem !important;
  }
  .home-page .home-hero-actions { gap: 8px !important; margin-top: 12px !important; }
  .home-page .home-primary-btn, .home-page .home-secondary-btn {
    min-height: 40px !important; padding: 0 13px !important;
    border-radius: 10px !important; font-size: .8rem !important;
  }
  .home-page .home-hero-art { display: none !important; }
  .home-page .home-main { overflow: clip !important; }
  .home-page .home-section { padding: 30px 0 !important; }
  .home-page .home-section-head { gap: 12px !important; margin-bottom: 14px !important; }
  .home-page .home-section-head h2 { font-size: 1.55rem !important; line-height: 1.08; }
  .home-page .home-section-head > a { font-size: .72rem !important; }
  .home-page .home-story-grid:not(.home-story-grid-continue) .home-story-card,
  .home-page .home-story-grid-continue .home-story-card { flex-basis: 122px !important; }
  .home-page .home-story-grid { gap: 12px !important; }
  .home-page .home-story-card h3 { margin-top: 8px !important; font-size: .88rem !important; }
  .home-page .home-story-card > p { font-size: .68rem !important; }
  .home-page .home-featured-card { grid-template-columns: 104px minmax(0,1fr) !important; min-height: 190px !important; }
  .home-page .home-featured-cover { min-height: 190px !important; }
  .home-page .home-featured-copy { min-width: 0; padding: 13px !important; }
  .home-page .home-featured-copy h3 { font-size: 1.15rem !important; }
  .home-page .home-taxonomy-grid { gap: 8px !important; }
  .home-page .home-taxonomy-card { min-height: 62px !important; padding: 11px !important; }
  .home-page .home-author-cta-inner { gap: 14px; }

  /* HOLIDAY HEARTS: a compact campaign feature, not a full-height poster. */
  .home-page .home-section.hhr-section {
    padding: 17px 0 20px !important; border-top: 1px solid var(--home-line);
  }
  .home-page .hhr { padding: 0 13px !important; }
  .home-page .hhr-banner {
    display: grid !important; grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important; padding: 9px !important; border-radius: 17px !important;
    align-items: stretch !important;
  }
  .home-page .hhr-poster {
    width: 100% !important; height: clamp(132px, 39vw, 172px) !important;
    aspect-ratio: auto !important; border-radius: 12px !important;
    box-shadow: 0 9px 24px rgba(0,0,0,.3) !important;
  }
  .home-page .hhr-poster img {
    width: 100% !important; height: 100% !important;
    object-fit: cover !important; object-position: center 38% !important;
  }
  .home-page .hhr-copy { padding: 12px 5px 5px !important; min-width: 0; }
  .home-page .hhr-eyebrow { margin-bottom: 5px !important; font-size: .59rem !important; }
  .home-page .hhr-copy h2 { font-size: 1.65rem !important; line-height: 1.02 !important; }
  .home-page .hhr-tag { margin: 5px 0 8px !important; font-size: .88rem !important; }
  .home-page .hhr-status { margin: 0 0 9px !important; font-size: .75rem !important; }
  .home-page .hhr-lead { display: block !important; margin: 0 0 10px !important; font-size: .76rem; line-height: 1.45; }
  .home-page .hhr-facts { display: none !important; }
  .home-page .hhr-actions { gap: 7px !important; }
  .home-page .hhr-btn { min-height: 38px !important; padding: 0 12px !important; font-size: .75rem !important; }
  .home-page .hhr-btn-quiet { display: inline-flex !important; }
  .home-page .hhr-head { margin: 18px 2px 10px !important; }
  .home-page .hhr-head h3 { font-size: 1.25rem !important; }
  .home-page .hhr-head a { font-size: .72rem !important; }
  .home-page .hhr-rail { gap: 11px !important; margin: 0 -13px !important; padding: 3px 13px 12px !important; }
  .home-page .hhr-card { flex-basis: 112px !important; }
  .home-page .hhr-card h3 { margin-top: 7px !important; font-size: .84rem !important; }
  .home-page .hhr-card p { font-size: .68rem !important; }

  /* EXPLORE: reduce the fixed-height cinematic desktop hero on phones. */
  .explore-page .explore-hero { min-height: 340px !important; }
  .explore-page .explore-hero-inner {
    min-height: 340px !important; align-items: flex-start !important;
  }
  .explore-page .explore-hero-copy {
    width: 100% !important; max-width: 540px; padding: 24px 0 78px !important;
  }
  .explore-page .explore-hero-copy h1 {
    max-width: 12ch; font-size: clamp(2.1rem, 9vw, 2.8rem) !important;
    line-height: 1.02 !important;
  }
  .explore-page .explore-hero-copy > p { max-width: 34ch !important; font-size: .82rem !important; }
  .explore-page .explore-search { width: 100%; max-width: 100%; }
  .explore-page .explore-character-scene {
    right: -21% !important; bottom: -50px !important;
    width: 57vw !important; max-width: 260px; height: 280px !important;
    opacity: .34 !important; pointer-events: none;
  }
  .explore-page .explore-hero-caption { bottom: 12px !important; }
  .explore-page .explore-section { padding: 30px 0 !important; }
  .explore-page .explore-section-heading h2 { font-size: 1.5rem !important; }
  .explore-page .explore-story-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 11px !important; }
  .explore-page .explore-card-copy { padding: 10px !important; }
  .explore-page .explore-card-copy h3 { font-size: .86rem !important; }

  /* LIBRARY: compact shelf introduction and denser book browsing. */
  .library-page .library-hero { min-height: 178px !important; }
  .library-page .library-hero-inner { min-height: 178px !important; }
  .library-page .library-hero-copy { padding: 24px 0 20px !important; }
  .library-page .library-hero h1 { margin: 12px 0 10px !important; font-size: 2.55rem !important; }
  .library-page .shelf-icon { width: 34px !important; height: 34px !important; border-radius: 10px !important; }
  .library-page .library-hero-art { width: 42% !important; min-height: 178px !important; opacity: .35 !important; right: -10% !important; }
  .library-page .library-content { padding-top: 25px !important; padding-bottom: 90px !important; }
  .library-page .shelf-section { margin-bottom: 36px !important; }
  .library-page .shelf-section-head { gap: 10px !important; margin-bottom: 13px !important; }
  .library-page .shelf-section h2 { font-size: 1.5rem !important; }
  .library-page .story-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 12px !important; }
  .library-page .story-card { border-radius: 13px !important; }
  .library-page .card-cover { aspect-ratio: 2 / 2.65 !important; }
  .library-page .card-body { padding: 10px !important; }
  .library-page .card-title { font-size: .98rem !important; }
  .library-page .card-author { margin-bottom: 8px !important; font-size: .68rem !important; }
  .library-page .card-meta { gap: 7px !important; font-size: .6rem !important; }
  .library-page .bookmark-grid { grid-template-columns: 1fr !important; gap: 9px !important; }
  .library-page .bookmark-card { grid-template-columns: 58px minmax(0,1fr) auto !important; gap: 10px !important; padding: 10px !important; border-radius: 13px !important; }
  .library-page .bookmark-cover { width: 58px !important; height: 78px !important; }

  /* STORY DETAILS: keep the cover and reading actions visible without a long hero. */
  .story-page .story-hero-inner-v2 { grid-template-columns: 112px minmax(0,1fr) !important; gap: 16px !important; align-items: start !important; }
  .story-page .story-cover-stage { width: 112px !important; min-width: 0 !important; }
  .story-page .story-cover-frame-v2 { width: 100% !important; }
  .story-page .story-detail-title-v2 { font-size: clamp(1.55rem, 7vw, 2.1rem) !important; line-height: 1.04 !important; }
  .story-page .story-detail-actions-v2 { display: grid !important; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 40px !important; gap: 7px !important; }
  .story-page .story-read-btn, .story-page .story-secondary-btn { min-height: 40px !important; padding: 0 9px !important; font-size: .72rem !important; }
  .story-page .story-intro-grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  .story-page .story-intro-section, .story-page .story-taxonomy-section-v2,
  .story-page .story-chapters-section-v2, .story-page .story-reviews-section-v2 { padding-top: 28px !important; padding-bottom: 28px !important; }
  .story-page .story-intro-main, .story-page .story-at-a-glance { min-width: 0; }

  /* READER: immersive reading surface and consistent GidiReads loading accent. */
  .reader-body .spinner {
    width: 29px !important; height: 29px !important;
    border: 2px solid rgba(201,165,232,.20) !important;
    border-top-color: #c9a5e8 !important;
    border-right-color: rgba(201,165,232,.62) !important;
  }
  .reader-body main { padding: 78px 16px 65px !important; }
  .reader-body .chapter-intro { margin-top: 2vh !important; }
  .reader-body .chapter-intro h1 { font-size: clamp(1.8rem, 8vw, 2.4rem) !important; }
  .reader-body .manuscript { font-size: 1rem; line-height: 1.85; }

  /* Forms, dashboards and horizontal controls must not force page-width overflow. */
  .admin-table, table[role="table"] { max-width: 100%; overflow-x: auto; }
  .tabs, .tab-list, .filter-tabs, .studio-tabs, .ae-tabs { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
  .modal, .dialog, [role="dialog"] { max-height: calc(100dvh - 24px); overflow-y: auto; }
}

@media (max-width: 420px) {
  :root { --gr-mobile-page-gutter: 14px; }
  .home-page .home-hero h1 { font-size: clamp(2.2rem, 9.5vw, 2.75rem) !important; }
  .home-page .home-hero-actions > * { flex: 1 1 auto; }
  .home-page .hhr-copy h2 { font-size: 1.48rem !important; }
  .home-page .hhr-btn { padding: 0 10px !important; font-size: .7rem !important; }
  .story-page .story-hero-inner-v2 { grid-template-columns: 96px minmax(0,1fr) !important; gap: 12px !important; }
  .story-page .story-cover-stage { width: 96px !important; }
  .story-page .story-detail-actions-v2 { grid-template-columns: 1fr 1fr !important; }
  .story-page .story-icon-btn { display: none !important; }
}

@media (display-mode: standalone) {
  html { min-height: 100%; }
  body { min-height: 100dvh; }
  .site-nav { padding-top: env(safe-area-inset-top, 0px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* AUTHOR STUDIO: retain its drawer navigation, but tighten the workspace on phones. */
@media (max-width: 760px) {
  .studio-shell { display: block !important; min-height: 100dvh; }
  .studio-main { width: 100%; min-width: 0; }
  .studio-topbar {
    height: 56px !important; min-height: 56px;
    padding: 0 14px !important; gap: 10px;
  }
  .menu-button { width: 36px; height: 36px; flex: 0 0 36px; }
  .topbar-context { min-width: 0; gap: 6px; font-size: 10px !important; }
  .topbar-context strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { gap: 8px !important; }
  .studio-content { padding: 26px 14px 84px !important; }
  .welcome-block { padding-bottom: 15px !important; }
  .welcome-copy h1 { max-width: 13ch; font-size: clamp(2.05rem, 9vw, 2.8rem) !important; line-height: 1.02 !important; }
  .welcome-sub { max-width: 38ch; margin-top: 10px !important; font-size: .78rem !important; }
  .welcome-actions { margin-top: 16px !important; gap: 8px !important; }
  .welcome-actions .button { min-height: 40px; font-size: .75rem; }
  .welcome-rule { margin-top: 22px !important; }
  .continue-section { margin-top: 28px !important; }
  .continue-card { min-height: 0 !important; }
  .continue-art { min-height: 220px !important; }
  .cover-frame { width: min(120px, 34vw) !important; }
  .paper-sheet, .paper-shadow { width: min(140px, 40vw) !important; height: min(190px, 55vw) !important; }
  .sun-disc { width: 145px !important; height: 145px !important; }
  .continue-copy { min-height: 0 !important; padding: 20px 17px 22px !important; }
  .continue-copy h2 { font-size: clamp(1.8rem, 8vw, 2.35rem) !important; }
  .activity-section { margin-top: 38px !important; }
  .lower-grid { gap: 34px !important; margin-top: 38px !important; }
  .notices-section, .quick-section, .story-shelf-section { margin-top: 38px !important; }
  .studio-footer { padding-bottom: 22px !important; }
}

@media (max-width: 420px) {
  .studio-content { padding-left: 12px !important; padding-right: 12px !important; }
  .welcome-actions { grid-template-columns: 1fr 1fr !important; }
  .continue-art { min-height: 200px !important; }
  .continue-copy h2 { font-size: 1.8rem !important; }
}


/* Curated seasonal homepage collections: compact banner + swipeable novel shelf. */
@media (max-width: 760px) {
  .home-page .home-custom-section {
    display: grid !important;
    grid-template-columns: 88px minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    align-items: center !important;
    gap: 10px 12px !important;
    margin: 0 12px 16px !important;
    padding: 11px !important;
    border-radius: 15px !important;
  }
  .home-page .home-custom-section.has-image .home-custom-image {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 88px !important;
    height: 104px !important;
    min-height: 0 !important;
    max-height: 104px !important;
    border-radius: 9px !important;
    order: 0 !important;
  }
  .home-page .home-custom-section.has-image .home-custom-image img {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 104px !important;
    object-fit: cover !important;
    object-position: center !important;
  }
  .home-page .home-custom-section.has-image .home-custom-copy {
    grid-column: 2 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    order: 0 !important;
  }
  .home-page .home-custom-section.image-right.has-image .home-custom-image {
    grid-column: 2 !important;
  }
  .home-page .home-custom-section.image-right.has-image .home-custom-copy {
    grid-column: 1 !important;
  }
  .home-page .home-custom-copy .home-section-kicker {
    margin: 0 0 4px !important;
    font-size: .56rem !important;
    line-height: 1.2 !important;
    letter-spacing: .11em !important;
  }
  .home-page .home-custom-copy h2 {
    margin: 0 0 5px !important;
    font-size: 1.25rem !important;
    line-height: 1.05 !important;
  }
  .home-page .home-custom-body {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    margin: 0 !important;
    font-size: .69rem !important;
    line-height: 1.35 !important;
  }
  .home-page .home-custom-cta {
    min-height: 29px !important;
    margin-top: 7px !important;
    padding: 0 9px !important;
    gap: 5px !important;
    border-radius: 8px !important;
    font-size: .63rem !important;
  }
  .home-page .home-custom-section .home-custom-stories {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    width: calc(100% + 22px) !important;
    margin: 0 -11px !important;
    padding: 2px 11px 7px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .home-page .home-custom-section .home-custom-stories::-webkit-scrollbar { display: none !important; }
  .home-page .home-custom-section .home-custom-stories .home-story-card {
    flex: 0 0 104px !important;
    width: 104px !important;
    min-width: 104px !important;
    scroll-snap-align: start !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-cover-wrap {
    width: 104px !important;
    aspect-ratio: 2 / 3 !important;
    border-radius: 8px !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-cover-wrap img,
  .home-page .home-custom-section .home-custom-stories .home-cover-wrap .home-cover {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-story-card h3 {
    margin: 6px 0 2px !important;
    font-size: .72rem !important;
    line-height: 1.2 !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-story-card > p {
    font-size: .6rem !important;
  }
  /* Show genre and numbers on phones too, in a compact form (2026-11-22) */
  .home-page .home-custom-section .home-custom-stories .home-card-genre {
    display: block !important;
    max-width: 100% !important;
    margin-top: 4px !important;
    font-size: .54rem !important;
    line-height: 1.25 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-card-stats {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    margin-top: 4px !important;
    font-size: .56rem !important;
    line-height: 1.25 !important;
  }
  .home-page .home-custom-section .home-custom-stories .home-card-stats .home-echo-stat svg { width: 9px !important; height: 9px !important; }
  .home-page .home-custom-section .home-custom-footer {
    grid-column: 1 / -1 !important;
    padding-top: 7px !important;
  }
  .home-page .home-custom-section .home-custom-see-all {
    margin: 0 !important;
    font-size: .66rem !important;
  }
  .home-page .home-custom-section.text-only {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .home-page .home-custom-section.text-only .home-custom-copy {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }
}

@media (max-width: 360px) {
  .home-page .home-custom-section {
    grid-template-columns: 76px minmax(0, 1fr) !important;
    gap: 9px !important;
    padding: 9px !important;
  }
  .home-page .home-custom-section.has-image .home-custom-image {
    width: 76px !important;
    height: 92px !important;
    max-height: 92px !important;
  }
  .home-page .home-custom-section.has-image .home-custom-image img {
    max-height: 92px !important;
  }
  .home-page .home-custom-copy h2 { font-size: 1.12rem !important; }
  .home-page .home-custom-section .home-custom-stories .home-story-card,
  .home-page .home-custom-section .home-custom-stories .home-cover-wrap {
    flex-basis: 80px !important;
    width: 80px !important;
    min-width: 80px !important;
  }
}


/* =========================================================
   MOBILE EXPERIENCE — STAGE 3
   Denser discovery shelves and more intentional mobile layouts.
   Presentation-only overrides: existing story, list and notification
   markup/actions remain in place.
   ========================================================= */
@media (max-width: 760px) {
  /* HOME: featured novels become compact horizontal editorial cards. */
  .home-page .home-featured-grid {
    display: flex !important;
    gap: 12px !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 14px;
    margin: 0 -14px !important;
    padding: 2px 14px 12px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .home-page .home-featured-grid::-webkit-scrollbar { display: none; }
  .home-page .home-featured-grid > .home-loading-card,
  .home-page .home-featured-grid > .home-empty { flex: 0 0 100%; min-width: 100%; }
  .home-page .home-featured-card {
    flex: 0 0 min(88vw, 360px) !important;
    min-height: 0 !important;
    height: 154px !important;
    grid-template-columns: 102px minmax(0, 1fr) !important;
    border-radius: 13px !important;
    scroll-snap-align: start;
  }
  .home-page .home-featured-cover { min-height: 0 !important; height: 154px !important; }
  .home-page .home-featured-copy {
    min-width: 0 !important;
    padding: 10px 11px !important;
    overflow: hidden;
  }
  .home-page .home-featured-copy .home-card-badge {
    margin: 0 0 4px !important;
    padding: 3px 6px !important;
    font-size: .52rem !important;
  }
  .home-page .home-featured-genre { margin: 0 0 3px !important; font-size: .55rem !important; }
  .home-page .home-featured-copy h3 { font-size: .98rem !important; line-height: 1.12 !important; }
  .home-page .home-featured-author { margin: 3px 0 5px !important; font-size: .62rem !important; }
  .home-page .home-featured-description {
    font-size: .61rem !important;
    line-height: 1.35 !important;
    -webkit-line-clamp: 2 !important;
  }
  .home-page .home-featured-meta {
    gap: 7px !important;
    flex-wrap: wrap;
    margin-top: 5px !important;
    padding-top: 0 !important;
    font-size: .51rem !important;
  }
  .home-page .home-featured-link { margin-top: 4px !important; font-size: .61rem !important; }

  /* HOME: keep all story shelves compact and swipeable. */
  .home-page .home-section { padding-top: 26px !important; padding-bottom: 26px !important; }
  .home-page .home-section-head { margin-bottom: 12px !important; }
  .home-page .home-section-head h2 { font-size: 1.35rem !important; }
  .home-page .home-story-grid:not(.home-story-grid-continue) .home-story-card,
  .home-page .home-story-grid-continue .home-story-card { flex-basis: 116px !important; }
  .home-page .home-story-card h3 { font-size: .79rem !important; line-height: 1.2 !important; }
  .home-page .home-story-card > p { font-size: .62rem !important; }
  .home-page .home-custom-section .home-custom-stories .home-story-card { flex-basis: 108px !important; }

  /* EXPLORE: three compact cover columns for discovery shelves. */
  .explore-page .explore-story-grid:not(.explore-results-list) {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }
  .explore-page .explore-story-card { border-radius: 10px !important; }
  .explore-page .explore-featured-grid {
    display: flex !important;
    gap: 10px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    margin: 0 -14px !important;
    padding: 2px 14px 12px !important;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .explore-page .explore-featured-grid::-webkit-scrollbar { display: none; }
  .explore-page .explore-featured-card {
    flex: 0 0 min(88vw, 350px) !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    min-height: 142px !important;
    height: 142px !important;
    border-radius: 12px !important;
    scroll-snap-align: start;
  }
  .explore-page .explore-featured-cover { min-height: 0 !important; height: 142px !important; }
  .explore-page .featured-copy { min-width: 0; padding: 9px 10px !important; overflow: hidden; }
  .explore-page .featured-copy .explore-badge { font-size: .48rem !important; padding: 3px 5px !important; }
  .explore-page .featured-genre { margin: 5px 0 2px !important; font-size: .52rem !important; }
  .explore-page .featured-copy h3 { font-size: .9rem !important; line-height: 1.12 !important; }
  .explore-page .featured-author { margin: 3px 0 5px !important; font-size: .6rem !important; }
  .explore-page .featured-copy > p:not(.featured-genre):not(.featured-author) { font-size: .58rem !important; line-height: 1.3 !important; -webkit-line-clamp: 2 !important; }
  .explore-page .featured-stats { gap: 6px !important; flex-wrap: wrap; margin-top: 5px !important; font-size: .49rem !important; }
  .explore-page .featured-read { margin-top: 4px !important; font-size: .58rem !important; }
  .explore-page .explore-card-cover { aspect-ratio: 2 / 2.85 !important; }
  .explore-page .explore-card-copy { padding: 8px 8px 9px !important; }
  .explore-page .explore-card-copy h3 { font-size: .75rem !important; line-height: 1.18 !important; }
  .explore-page .explore-card-copy > p { margin: 4px 0 6px !important; font-size: .58rem !important; }
  .explore-page .explore-card-meta { display: flex !important; flex-wrap: wrap; justify-content: flex-start !important; gap: 3px 6px !important; font-size: .49rem !important; }
  .explore-page .explore-card-meta span:first-child { max-width: 100% !important; }
  .explore-page .explore-card-echo { margin-top: 5px !important; font-size: .5rem !important; }
  .explore-page .explore-card-echo svg { width: 11px !important; height: 11px !important; }
  .explore-page .explore-save { top: 6px !important; right: 6px !important; width: 25px !important; height: 25px !important; }
  .explore-page .explore-save svg { width: 12px !important; height: 12px !important; }

  /* Search results use a compact cover-left list instead of tiny grid cards. */
  .explore-page .explore-results-list {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }
  .explore-page .explore-results-list .explore-story-card {
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) !important;
    min-height: 104px !important;
  }
  .explore-page .explore-results-list .explore-card-cover {
    grid-row: 1;
    grid-column: 1;
    height: 100% !important;
    min-height: 104px !important;
    aspect-ratio: auto !important;
  }
  .explore-page .explore-results-list .explore-card-copy {
    grid-row: 1;
    grid-column: 2;
    align-self: center;
    padding: 9px 11px !important;
  }
  .explore-page .explore-results-list .explore-card-copy h3 { font-size: .86rem !important; }
  .explore-page .explore-results-list .explore-card-copy > p { font-size: .65rem !important; margin: 4px 0 7px !important; }
  .explore-page .explore-results-list .explore-card-meta { font-size: .55rem !important; }
  .explore-page .explore-results-list .explore-card-echo { font-size: .57rem !important; margin-top: 6px !important; }
  .explore-page .explore-results-list .explore-save { right: 8px !important; top: 8px !important; }

  /* Public reading lists: horizontal, book-shelf style rows. */
  .explore-page .public-reading-list-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 9px !important;
  }
  .explore-page .public-reading-list-card {
    display: grid !important;
    grid-template-columns: 70px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: center !important;
    column-gap: 12px !important;
    row-gap: 5px !important;
    padding: 10px !important;
    border-radius: 12px !important;
  }
  .explore-page .public-reading-list-card .public-list-cover {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 70px !important;
    height: 92px !important;
    border-radius: 8px !important;
  }
  .explore-page .public-list-owner { grid-column: 2; grid-row: 1; gap: 7px !important; }
  .explore-page .public-list-owner img,
  .explore-page .public-list-avatar-fallback { width: 25px !important; height: 25px !important; font-size: .7rem !important; }
  .explore-page .public-list-owner strong { font-size: .68rem !important; }
  .explore-page .public-list-owner small { font-size: .57rem !important; }
  .explore-page .public-list-main { grid-column: 2; grid-row: 2; gap: 7px !important; align-items: flex-start !important; }
  .explore-page .public-list-icon { width: 25px !important; height: 25px !important; border-radius: 7px !important; font-size: .9rem !important; }
  .explore-page .public-list-main strong { font-size: .88rem !important; line-height: 1.15 !important; }
  .explore-page .public-list-description { font-size: .62rem !important; -webkit-line-clamp: 2 !important; }
  .explore-page .public-list-count { grid-column: 2; grid-row: 3; padding-top: 4px !important; border-top: 0 !important; font-size: .61rem !important; }
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) { grid-template-columns: minmax(0, 1fr) !important; }
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-owner,
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-main,
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-count { grid-column: 1 !important; }
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-owner { grid-row: 1 !important; }
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-main { grid-row: 2 !important; }
  .explore-page .public-reading-list-card:not(:has(.public-list-cover)) .public-list-count { grid-row: 3 !important; }

  /* Notifications: keep the existing unread/read actions, improve hierarchy. */
  .notifications-hero { padding: 24px 0 18px !important; }
  .notifications-head { gap: 13px !important; }
  .notifications-head h1 { font-size: 2rem !important; }
  .notifications-subtitle { margin-top: 6px !important; font-size: .76rem !important; line-height: 1.45 !important; }
  .notifications-mark-all { min-height: 36px !important; padding: 8px 11px !important; font-size: .68rem !important; }
  .notifications-section { padding-top: 20px !important; padding-bottom: 84px !important; }
  .notification-toolbar { margin-bottom: 11px !important; }
  .notification-toolbar h2 { font-size: 1.25rem !important; }
  .notification-tabs { gap: 6px !important; padding-bottom: 12px !important; }
  .notification-tab { min-height: 34px !important; padding: 7px 9px !important; border-radius: 9px !important; font-size: .66rem !important; }
  .notification-row {
    grid-template-columns: 38px minmax(0, 1fr) 7px !important;
    gap: 10px !important;
    padding: 11px 10px !important;
    margin-bottom: 7px !important;
    border-radius: 11px !important;
  }
  .notification-avatar-wrap, .notification-avatar { width: 38px !important; height: 38px !important; }
  .notification-type-icon { width: 18px !important; height: 18px !important; }
  .notification-topline strong { font-size: .75rem !important; }
  .notification-display-name { font-size: .63rem !important; }
  .notification-message { font-size: .74rem !important; line-height: 1.38 !important; }
  .notification-time { font-size: .61rem !important; }
  .notification-unread-mark { width: 7px !important; height: 7px !important; }

  /* Library: use three-column discovery shelves but preserve list controls. */
  .library-page .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 9px !important; }
  .library-page .card-cover { aspect-ratio: 2 / 2.85 !important; }
  .library-page .card-body { padding: 8px !important; }
  .library-page .card-title { font-size: .78rem !important; line-height: 1.2 !important; }
  .library-page .card-author { font-size: .57rem !important; }
  .library-page .card-meta { flex-wrap: wrap; font-size: .5rem !important; }
}

@media (max-width: 760px) {
  /* Public author profiles: more books visible while preserving readable labels. */
  .author-profile-page .gr-story-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }
  .author-profile-page .gr-story-copy { padding: 8px !important; }
  .author-profile-page .gr-story-copy strong { font-size: .76rem !important; line-height: 1.2 !important; }
  .author-profile-page .gr-story-copy span { font-size: .59rem !important; }
  .author-profile-page .gr-section { padding-top: 25px !important; }
  .author-profile-page .gr-section-title { margin-bottom: 13px !important; font-size: 1.45rem !important; }

  /* A reader's individual list keeps its search and owner actions, with a compact shelf. */
  .rlp { padding: 18px 13px 88px !important; }
  .rlp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 11px !important; }
  .rlp-item h3 { font-size: .78rem !important; line-height: 1.2 !important; }
  .rlp-item p { font-size: .61rem !important; }
  .rlp-actions { gap: 7px !important; margin-bottom: 17px !important; }
  .rlp-actions .rl-btn { min-height: 38px !important; padding: 0 12px !important; font-size: .72rem !important; }
  .rlp-search { margin: 14px 0 !important; }

  /* Admin and analytics: compact controls without hiding any data or actions. */
  #adminTabContent { padding-top: 17px !important; }
  .an-top { gap: 12px !important; }
  .an-section-head { margin: 22px 0 12px !important; }
  .an-panel { border-radius: 13px !important; }
  .an-table-wrap { overscroll-behavior-x: contain; }
}

@media (max-width: 350px) {
  /* Keep three Explore columns on standard 360px phones; use two only on very narrow screens. */
  .explore-page .explore-story-grid:not(.explore-results-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 380px) {
  .library-page .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .home-page .home-featured-card { flex-basis: 90vw !important; }
  .author-profile-page .gr-story-grid,
  .rlp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
