/* UI refresh · tablet
   平板 / 大屏移动端布局层：body.mobile-shell 且宽度 ≥ 721px。导航轨（rail）、双栏、横竖屏适配。
   只使用 refresh/foundation.css 中的 --ds-* 设计令牌；不得修改其他文件负责的选择器。

   Tablets used to get the phone layout stretched wide: a horizontal tab card
   (80px tall) above the content and one long column. Here they get:
     • a left navigation rail (icon in a pill, label below), like the desktop
       medium layout, so the content keeps the full height;
     • landscape (≥ 981px): list + detail side by side for search, drama and
       comics, with the list at --ds-list-pane-w;
     • portrait (721–980px): app.js keeps search / detail as one pane (the
       hidden pane is inert), so the results list becomes a two-column grid.
   Landscape phones (max-height: 500px) keep the bottom bar from responsive.css. */

@media (min-width: 721px) and (min-height: 501px) {
  /* ---- Frame: rail + content ------------------------------------------- */
  body.mobile-shell .app-shell {
    max-width: none;
    grid-template-columns: calc(var(--ds-rail-w) + var(--safe-area-left)) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "navigation topbar"
      "navigation announcement"
      "navigation content"
      "navigation jobs";
    column-gap: var(--ds-frame-gap);
    row-gap: var(--ds-frame-gap);
    padding:
      calc(var(--ds-space-3) + var(--safe-area-top))
      calc(var(--ds-space-4) + var(--safe-area-right))
      calc(var(--ds-space-3) + var(--safe-area-bottom))
      0;
  }

  body.android-shell .app-shell {
    padding-top: calc(var(--ds-space-3) + var(--safe-area-top) + var(--mobile-system-bar-height));
  }

  /* ---- Navigation rail -------------------------------------------------- */
  body.mobile-shell .tabbar {
    position: static;
    grid-area: navigation;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: var(--ds-space-3);
    min-height: 0;
    height: auto;
    margin: calc(-1 * (var(--ds-space-3) + var(--safe-area-top))) 0 calc(-1 * (var(--ds-space-3) + var(--safe-area-bottom)));
    padding:
      calc(var(--ds-space-4) + var(--safe-area-top))
      0
      calc(var(--ds-space-4) + var(--safe-area-bottom))
      var(--safe-area-left);
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-right: 1px solid var(--ds-border);
    border-radius: 0;
    background: var(--ds-surface-panel);
    box-shadow: none;
  }

  body.android-shell .tabbar {
    margin-top: calc(-1 * (var(--ds-space-3) + var(--safe-area-top) + var(--mobile-system-bar-height)));
    padding-top: calc(var(--ds-space-4) + var(--safe-area-top) + var(--mobile-system-bar-height));
  }

  body.mobile-shell .tabbar .nav-item {
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: var(--ds-space-1);
    width: 64px;
    min-width: 0;
    height: auto;
    min-height: 56px;
    padding: var(--ds-space-1) 0;
    border: 0;
    border-radius: var(--ds-radius-md);
    background: transparent;
    color: var(--ds-text-muted);
    font-size: var(--ds-text-caption);
    font-weight: var(--ds-weight-medium);
    line-height: var(--ds-leading-tight);
  }

  body.mobile-shell .tabbar .nav-item:hover {
    background: transparent;
    color: var(--ds-text);
  }

  body.mobile-shell .tabbar .nav-icon,
  body.mobile-shell .tabbar .nav-item.active .nav-icon {
    display: inline-grid;
    flex: 0 0 32px;
    place-items: center;
    width: 56px;
    max-width: 100%;
    height: 32px;
    border-radius: var(--ds-radius-full);
    transition: background var(--ds-motion-fast) var(--ds-ease);
  }

  body.mobile-shell .tabbar .nav-icon {
    background: transparent;
  }

  body.mobile-shell .tabbar .nav-icon svg {
    width: 24px;
    height: 24px;
  }

  body.mobile-shell .tabbar .nav-item:hover .nav-icon {
    background: var(--ds-state-hover);
  }

  body.mobile-shell .tabbar .nav-item.active {
    background: transparent;
    color: var(--ds-text);
    font-weight: var(--ds-weight-strong);
  }

  body.mobile-shell .tabbar .nav-item.active .nav-icon {
    background: var(--ds-accent-soft);
    color: var(--ds-on-accent-soft);
  }

  /* ---- Top bar: one row, status beside the brand ------------------------ */
  body.mobile-shell .topbar-main {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--ds-space-3);
  }

  body.mobile-shell .brand-block {
    grid-column: 1;
  }

  body.mobile-shell .topbar-status {
    grid-column: 2;
    width: auto;
    flex-wrap: nowrap;
  }

  /* ---- Content ---------------------------------------------------------- */
  body.mobile-shell .view-stack {
    min-height: 0;
  }

  body.mobile-shell .content-grid {
    gap: var(--ds-frame-gap);
  }

  body.mobile-shell .section-title {
    font-size: var(--ds-text-title);
  }

  /* 10px labels are too small at tablet reading distance. */
  body.mobile-shell .status-label,
  body.mobile-shell .book-comment-badge,
  body.mobile-shell .media-comment-badge,
  body.mobile-shell .reader-chapter-time,
  body.mobile-shell .reader-source-label,
  body.mobile-shell .toc-item-time,
  body.mobile-shell #readerReadingTime,
  body.mobile-shell.bookshelf-compact .bookshelf-card-progress.official-progress-line {
    font-size: var(--ds-text-caption);
  }

  /* Bookshelf: roomier covers instead of many thin columns. */
  body.mobile-shell .bookshelf-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: var(--ds-space-4);
  }
}

/* ---- Portrait tablets: single pane, two-column results ----------------- */
@media (min-width: 721px) and (max-width: 980px) and (min-height: 501px) {
  body.mobile-shell .discover-search-panel .result-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: var(--ds-space-2);
  }

  body.mobile-shell .discover-search-panel .result-list > :not(.result-card) {
    grid-column: 1 / -1;
  }
}

/* ---- Landscape tablets: list + detail side by side --------------------- */
@media (min-width: 981px) and (min-height: 501px) {
  body.mobile-shell .discover-grid {
    grid-template-columns: var(--ds-list-pane-w) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
  }

  body.mobile-shell .discover-search-panel,
  body.mobile-shell .discover-detail-panel {
    display: flex;
    height: 100%;
    min-height: 0;
  }

  body.mobile-shell .mobile-back-button {
    display: none;
  }
}
