/* ══════════════════════════════════════════════════════════════
   STORY DETAIL — Mobile-only rebuild
   Keeps the desktop layout intact and introduces a separate
   vertical flow for phones.
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .detail-layout,
  .detail-layout > *,
  .detail-content,
  .detail-sidebar,
  .story-overview,
  .sd-player,
  .detail-copy,
  .sd-progress-wrap,
  .sd-row--controls,
  .sd-ubar,
  .related-grid {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .detail-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 16px !important;
  }

  .detail-content,
  .detail-sidebar {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .site-header,
  .site-footer,
  .breadcrumb,
  .chapter-reading,
  .audio-video-embed,
  .bnav,
  .detail-sidebar {
    display: none !important;
  }

  .m-page {
    padding-top: var(--m-header-h, 60px);
    padding-bottom: calc(var(--m-bottom-h, 64px) + var(--m-safe, 0px) + 16px);
    min-height: 100vh;
    background: #070b12;
  }

  .detail-main {
    padding: 0 0 16px !important;
  }

  .detail-main .container {
    padding: 0;
    max-width: none;
  }

  .detail-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 14px;
  }

  .sd-nextup {
    display: block !important;
    margin: 0;
    padding: 0;
  }

  .sd-nextup__label {
    color: #8ec5ff;
    margin-bottom: 8px;
    letter-spacing: 0.08em;
  }

  .sd-nextup__card {
    padding: 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: none;
    gap: 12px;
  }

  .sd-nextup__thumb {
    width: 72px;
    height: 72px;
    border-radius: 14px;
  }

  .sd-nextup__eyebrow {
    color: #f59e0b;
  }

  .sd-nextup__title {
    font-size: 0.95rem;
  }

  .sd-nextup__meta {
    color: #94a3b8;
    font-size: 0.76rem;
  }

  .sd-nextup__play {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.08);
    color: #fff;
  }

  .story-overview,
  .detail-copy,
  .sd-player,
  .mobile-card,
  .comments-panel,
  .related-panel {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
  }

  .story-overview,
  .detail-copy,
  .sd-player,
  .mobile-card,
  .comments-panel {
    background: #121826;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 18px;
    margin: 0;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  }

  .detail-title {
    font-family: 'Baloo 2', cursive;
    font-size: 1.34rem;
    line-height: 1.2;
    margin-bottom: 10px;
  }

  .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  .detail-meta span,
  .detail-meta a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    color: #94a3b8;
  }

  .library-actions {
    margin: 0;
    padding: 0;
  }

  .library-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.22);
    color: #f87171;
    font-size: 0.92rem;
    font-weight: 700;
  }

  .detail-copy {
    position: relative;
  }

  .detail-copy h2 {
    font-size: 1rem;
    margin-bottom: 8px;
  }

  .detail-copy h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #f59e0b;
  }

  .detail-copy p {
    font-size: 0.92rem;
    line-height: 1.7;
    margin-bottom: 8px;
    color: #cbd5e1;
  }

  .detail-copy:not(.is-expanded) {
    max-height: 150px;
    overflow: hidden;
  }

  .detail-copy:not(.is-expanded)::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 44px;
    background: linear-gradient(180deg, rgba(18, 24, 37, 0), rgba(18, 24, 37, 1));
    pointer-events: none;
  }

  .detail-copy__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 9px 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    font-weight: 700;
    font-size: 0.82rem;
  }

  .sd-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    position: relative;
  }

  .sd-cover {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .sd-cover__img {
    width: min(220px, 70vw);
    height: min(220px, 70vw);
    border-radius: 50%;
    margin: 0 auto;
    border: 6px solid rgba(255, 255, 255, 0.08);
    background-size: cover;
    background-position: center;
  }

  .sd-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 6px;
  }

  .sd-ubar__gear {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    z-index: 2;
  }

  .sd-info__chapter {
    font-size: 1.06rem;
    font-weight: 700;
    margin: 0;
  }

  .sd-info__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #94a3b8;
  }

  .sd-progress-wrap {
    width: 100%;
    max-width: none;
    margin-bottom: 10px;
    height: auto;
  }

  .sd-progress {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
  }

  .sd-times {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 6px;
  }

  .sd-row--controls {
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    height: auto;
    margin: 0;
  }

  .sd-play {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 10px 22px rgba(245, 158, 11, 0.22);
  }

  .sd-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2f3645;
    color: #f8fafc;
    font-size: 14px;
  }

  .sd-ubar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: none;
    height: auto;
    padding: 0;
  }

  .sd-settings {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 84px !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(70vh, 460px) !important;
    overflow-y: auto !important;
    padding: 14px !important;
    border-radius: 16px !important;
    transform: translateY(8px) !important;
    box-sizing: border-box !important;
  }

  .sd-settings__section {
    gap: 8px;
  }

  .sd-settings__pills {
    gap: 8px;
  }

  .sd-settings__pill {
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  .sd-settings__custom {
    flex-direction: column;
    gap: 8px;
  }

  .sd-settings__custom button {
    width: 100%;
    padding: 10px 12px;
  }

  .sd-settings__toggle {
    padding: 10px 0;
  }

  .sd-badge,
  .sd-speed-wrap,
  .sd-vol,
  .sd-ubar__gear {
    margin: 0;
  }

  .sd-vol {
    flex: 1 1 100%;
    justify-content: center;
    min-width: 0;
  }

  .sd-vol-track {
    flex: 1;
  }

  .mobile-card__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
  }

  .mobile-card__heading h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    margin: 0;
  }

  .mobile-card__heading span {
    font-size: 0.8rem;
    color: #94a3b8;
  }

  .mobile-quick-actions__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .mobile-quick-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 92px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: #f8fafc;
    text-align: left;
  }

  .mobile-quick-action i {
    font-size: 1rem;
    color: #f59e0b;
  }

  .mobile-story-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-story-info__item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.86rem;
  }

  .mobile-story-info__item:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .mobile-story-info__label {
    color: #94a3b8;
  }

  .mobile-chapter-list .chapter-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    padding-right: 4px;
  }

  .mobile-chapter-list .chapter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #f8fafc;
    text-decoration: none;
  }

  .mobile-chapter-list .chapter-item.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
  }

  .mobile-chapter-list .chapter-item.is-locked {
    color: #94a3b8;
  }

  .mobile-chapter-list .chapter-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    flex-shrink: 0;
  }

  .mobile-chapter-list .chapter-item.active .chapter-dot {
    background: #f59e0b;
  }

  .related-panel {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
  }

  .related-panel .section-heading {
    padding: 0;
    margin-bottom: 10px;
  }

  .related-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .story-card--mini {
    flex: 0 0 140px;
    width: 140px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    background: #121826;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
  }

  .story-card--mini .story-card__thumb {
    min-height: 90px;
    margin: 8px 8px 0;
    border-radius: 10px;
  }

  .story-card--mini .story-card__body {
    padding: 10px;
  }

  .comments-panel {
    margin: 0;
  }

  .comment-entry__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .comment-entry textarea {
    min-height: 90px;
    resize: vertical;
  }

  img,
  svg,
  video {
    max-width: 100%;
    height: auto;
    display: block;
  }
}

@media (max-width: 480px) {
  .sd-cover__img {
    width: 190px;
    height: 190px;
  }

  .sd-play {
    width: 68px;
    height: 68px;
  }
}
