/* ════════════════════════════════════════════════════════════════════
   余温 · 手机端与安卓客户端排版重构样式
   严格沿用既有站点配色与变量（--paper / --paper2 / --ink / --coral /
   思源宋体 + Jost），仅重构窄屏排版结构、安全区/层级坐标系与触控体验。
   ════════════════════════════════════════════════════════════════════ */

:root {
  --app-header-h: 58px;
  --app-dock-h: 56px;
  --safe-top: var(--app-safe-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--app-safe-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--app-safe-left, env(safe-area-inset-left, 0px));
  --safe-right: var(--app-safe-right, env(safe-area-inset-right, 0px));
}

html.ime-open {
  --safe-bottom: 0px;
}

@media (max-width: 800px) {
  :root {
    --gutter: 16px;
  }

  html.yuwen-app body.view-mode {
    padding-bottom: 0;
  }

  /* ── 1. 统一安全区版心与顶部导航栏 ──────────────────────────────── */
  .page-pad,
  .chapter-gutter {
    padding-left: max(16px, var(--safe-left));
    padding-right: max(16px, var(--safe-right));
  }

  html body.view-mode > .site-header,
  html .site-header {
    position: relative;
    z-index: 110;
    height: calc(var(--app-header-h) + var(--safe-top));
    min-height: calc(var(--app-header-h) + var(--safe-top));
    padding: var(--safe-top) max(14px, var(--safe-right)) 0 max(14px, var(--safe-left));
    gap: 0;
    flex: 0 0 auto;
    align-items: center;
  }

  body.app-nav-open > .site-header,
  body.app-nav-open .site-header {
    z-index: 120;
  }

  html .site-header .brand {
    gap: 8px;
    margin-right: auto;
    min-width: 0;
  }

  html .site-header .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 17px;
    border-radius: 10px;
    flex: none;
  }

  html .site-header .brand-name {
    font-size: 17px;
    line-height: 1;
  }

  html .site-header .brand-name small {
    font-size: 6px;
    margin-top: 5px;
    letter-spacing: .08em;
  }

  html .site-header .header-tools {
    margin-left: 8px;
    gap: 8px;
    flex: none;
  }

  html .site-header .header-ghost {
    width: 36px;
    height: 36px;
    flex: none;
    position: relative;
  }

  html .site-header .header-ghost::after {
    content: none;
    display: none;
  }

  html .site-header .header-ghost svg {
    width: 15px;
    height: 15px;
  }

  html .site-header .header-cta {
    margin-left: 8px;
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
    flex: none;
  }

  html .site-header .header-cta::after {
    inset: -5px 0;
  }

  html .site-header .mobile-menu {
    width: 38px;
    height: 38px;
    margin-left: 6px;
    flex: none;
    align-items: center;
    justify-content: center;
  }

  /* ── 2. 移动端 2 列抽屉菜单 + 遮罩 + 顶部快捷栏 ─────────────────── */
  .app-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 105;
    background: rgba(24, 20, 17, .38);
    backdrop-filter: blur(2px);
  }

  html body .main-nav {
    position: fixed;
    top: calc(var(--app-header-h) + var(--safe-top));
    left: 0;
    right: 0;
    z-index: 120;
    max-height: calc(100dvh - var(--app-header-h) - var(--safe-top) - var(--safe-bottom) - 12px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 12px max(14px, var(--safe-right)) 16px max(14px, var(--safe-left));
    background: var(--paper);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 22px 40px rgba(32, 24, 18, .20);
  }

  html body .main-nav.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .app-nav-quick {
    grid-column: 1 / -1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px dashed var(--line);
  }

  .app-nav-quick-btn {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
  }

  .app-nav-quick-btn:active {
    border-color: var(--coral);
    color: var(--coral-dark);
  }

  html body .main-nav .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    font-size: 13.5px;
    color: var(--ink);
    white-space: nowrap;
  }

  html body .main-nav .nav-link::after {
    display: none;
  }

  html body .main-nav .nav-link.active {
    background: var(--paper2);
    border-color: var(--coral);
    color: var(--coral-dark);
    font-weight: 700;
  }

  /* ── 3. 底部悬浮左右分置 & 分页安全留白 ──────────────────────────── */
  body.view-mode .comic-page {
    padding-bottom: calc(74px + var(--safe-bottom));
  }

  body.view-mode .hero.comic-page {
    padding-bottom: calc(72px + var(--safe-bottom));
  }

  body.view-mode.music-open .music-section.comic-page {
    padding-bottom: calc(var(--mp-player-h, 72px) + 56px + var(--safe-bottom));
  }

  html body .page-rail {
    top: auto;
    left: max(12px, var(--safe-left));
    right: auto;
    bottom: calc(10px + var(--safe-bottom));
    transform: none;
    z-index: 30;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    border-radius: 999px;
    min-height: 42px;
  }

  html body .page-rail span {
    writing-mode: horizontal-tb;
    padding: 0 7px;
    font-size: 10.5px;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
  }

  html body .page-rail button {
    min-width: 44px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
  }

  html body.music-open .page-rail {
    bottom: calc(var(--mp-player-h, 72px) + 8px + var(--safe-bottom));
  }

  html body .pet {
    z-index: 45;
    width: 66px;
    height: 52px;
    right: max(10px, var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
  }

  html body .pet-bubble {
    max-width: 176px;
    font-size: 11.5px;
    right: 2px;
  }

  html body.music-open .pet,
  html.ime-open .pet,
  html.ime-open .page-rail {
    display: none !important;
  }

  html body .page-turn {
    z-index: 140;
  }

  /* 适配 origin/main 50 张 16:9 / 1:1 混合翻页插图（88ced96） */
  html body .page-turn-paper img {
    max-width: 86vw;
    max-height: 54dvh;
    object-fit: contain;
    border-radius: 10px;
  }

  html body .page-turn-label {
    bottom: calc(8% + var(--safe-bottom));
  }

  html.app-fast-turn .page-turn.playing .page-turn-paper {
    animation-duration: .74s;
  }

  html body .toast {
    bottom: calc(64px + var(--safe-bottom));
    z-index: 135;
  }

  /* ── 4. 01 首页：修复轮播空按钮 + 重排首屏节奏 ────────────────────── */
  .hero {
    padding-top: 20px;
    gap: 20px;
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .hero h1 {
    white-space: normal;
    text-wrap: pretty;
    font-size: clamp(34px, 9.2vw, 46px);
    line-height: 1.24;
    margin: 12px 0 10px;
  }

  .hero-lead {
    font-size: 14px;
    line-height: 1.85;
  }

  .hero-actions {
    margin-top: 18px;
    gap: 16px;
    flex-wrap: wrap;
  }

  .hero-footnote {
    margin-top: 16px;
  }

  .today-strip {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 12px;
    gap: 6px;
  }

  .hero-art-wrap {
    height: auto;
    width: min(460px, 100%);
    margin: 4px auto 0;
  }

  .hero-art-wrap .art-card,
  .hero-art-wrap .art-card:hover {
    transform: none;
    box-shadow: 0 14px 32px rgba(112, 72, 54, .14);
  }

  .edition-seal {
    width: 58px;
    height: 58px;
    top: -14px;
    left: 6px;
    outline-width: 3px;
    gap: 2px;
  }

  .edition-seal > span {
    font-size: 6px;
  }

  .edition-seal strong {
    font-size: 16px;
  }

  .edition-seal small {
    display: none;
  }

  .art-topline {
    height: 34px;
    padding: 0 12px;
    font-size: 9px;
  }

  .art-caption {
    height: auto;
    min-height: 44px;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 12px;
  }

  #sceneCaption {
    flex: 1 1 180px;
    font-size: 10.5px;
    line-height: 1.4;
    letter-spacing: .06em;
  }

  .carousel-controls {
    margin-left: auto;
    gap: 6px;
  }

  /* 覆盖 styles.css:424-427 清空伪元素导致的空白方块 bug */
  html body .art-caption .carousel-arrow,
  html body .art-caption #sceneToggle {
    position: relative;
    width: auto !important;
    min-width: 44px;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  html body .art-caption .carousel-arrow::after,
  html body .art-caption #sceneToggle::after {
    position: static;
    inset: auto;
  }

  html body .art-caption .carousel-arrow.prev::after {
    content: "前页";
  }

  html body .art-caption .carousel-arrow:not(.prev)::after {
    content: "后页";
  }

  html body .art-caption #sceneToggle::after {
    content: "色调";
  }

  .scroll-invitation {
    position: static;
    margin-top: 6px;
    padding-right: 0;
  }

  /* ── 5. 通用章节节奏 & 02 文档书房 / 文献卡片 ────────────────────── */
  .section {
    padding-top: 24px;
  }

  .section-heading {
    margin-bottom: 18px;
    padding-bottom: 10px;
    gap: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading h2 {
    font-size: clamp(28px, 7.8vw, 36px);
    margin: 6px 0 6px;
  }

  .library::after,
  .journal::after {
    font-size: 86px;
    top: 12px;
    right: 16px;
  }

  .recent-strip {
    gap: 8px;
    margin: 0 0 12px;
    padding-bottom: 10px;
    flex-wrap: nowrap;
  }

  .recent-list {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .recent-list::-webkit-scrollbar,
  .owner-tabs::-webkit-scrollbar,
  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .recent-list button {
    flex: 0 0 auto;
  }

  .owner-tabs {
    margin: 0 0 12px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .owner-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .library-toolbar {
    padding: 0 12px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: 18px;
    padding-right: 8px;
  }

  .filter-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 42px;
    padding: 12px 0;
  }

  .library-toolbar .search-box {
    width: 100%;
    border-top: 1px solid var(--line);
    padding: 10px 0;
  }

  .library-toolbar .ask-open {
    width: 100%;
    justify-content: center;
    margin: 2px 0 2px;
  }

  .document-grid {
    gap: 12px;
    padding-top: 16px;
  }

  .doc-card {
    min-height: 0;
  }

  .doc-card-button {
    padding: 16px 16px 14px;
  }

  .doc-symbol {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .doc-symbol::before {
    font-size: 10px;
  }

  .doc-type {
    margin-top: 12px;
  }

  .doc-card h3 {
    font-size: 17.5px;
    line-height: 1.4;
    margin: 6px 0 5px;
  }

  .doc-card p {
    font-size: 12.5px;
    line-height: 1.7;
  }

  .doc-card-bottom {
    padding: 10px 16px;
  }

  .paper-block {
    margin-top: 32px;
    padding-top: 22px;
  }

  .paper-tools {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .paper-tools .search-box,
  .paper-tools .paper-doi {
    flex: 1 1 100%;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--white);
    padding: 0 12px;
    height: 42px;
    min-height: 42px;
  }

  .paper-tools > button {
    flex: 1 1 140px;
    justify-content: center;
    gap: 8px;
  }

  .paper-links a,
  .paper-links button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  /* ── 6. 03 生活手记 & 04 实验日志 ────────────────────────────────── */
  .post-visual,
  .post-card.featured .post-visual {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .post-body {
    padding: 16px 16px 14px;
  }

  .post-card h3,
  .post-card.featured h3 {
    font-size: 19px;
    line-height: 1.4;
    margin: 8px 0 6px;
  }

  .post-card p,
  .post-card.featured p {
    font-size: 13px;
    line-height: 1.75;
  }

  .post-read {
    padding: 12px 16px;
  }

  .onthisday {
    margin-bottom: 16px;
    padding: 12px 14px;
    gap: 8px 12px;
  }

  .onthisday .otd-item {
    width: 100%;
  }

  .onthisday .otd-title {
    max-width: 100%;
    flex: 1;
    min-width: 0;
  }

  html body .lab-toolbar .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    gap: 8px;
    padding-bottom: 4px;
  }

  html body .lab-toolbar .lab-tag {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 36px;
  }

  .lab-card header {
    flex-direction: column;
    gap: 10px;
  }

  .lab-tools {
    width: 100%;
    justify-content: flex-end;
  }

  /* ── 7. 05 代码浏览抽屉 + 06 插图灯箱 + 07 照片墙 ─────────────────── */
  .code-browser {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .code-head-bar {
    padding: calc(10px + var(--safe-top)) 14px 10px;
  }

  .code-head-title h2 {
    font-size: 16.5px;
  }

  .app-code-files-btn {
    min-height: 34px;
    white-space: nowrap;
  }

  .code-browser .code-side {
    display: none;
    max-height: 44dvh;
  }

  .code-browser.app-side-open .code-side {
    display: flex;
  }

  .code-view-head {
    padding: 10px 14px;
    gap: 8px;
  }

  .code-version select {
    max-width: 170px;
  }

  .code-view-body {
    padding: 10px 12px calc(24px + var(--safe-bottom));
  }

  .gallery-groups {
    gap: 28px;
    padding-top: 14px;
  }

  .gallery-group-head {
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
  }

  /* 适配 origin/main 触屏画廊标题与 133 张肖像卡片（6f1be6b） */
  .gallery-item span {
    color: #f6efe4;
    pointer-events: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .gallery-group[data-shape="portrait"] .gallery-grid {
    gap: 10px;
  }

  .art-viewer {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
  }

  .art-viewer-inner {
    height: 100%;
    justify-content: center;
    padding: calc(48px + var(--safe-top)) 0 calc(20px + var(--safe-bottom));
  }

  .art-viewer-inner img {
    max-height: calc(100dvh - 140px - var(--safe-top) - var(--safe-bottom));
    border-radius: 0;
  }

  .art-viewer-close {
    top: calc(10px + var(--safe-top));
    right: 12px;
    min-height: 36px;
    z-index: 3;
  }

  .photo-month > summary {
    min-height: 44px;
    padding: 12px 2px;
  }

  .photo-item span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* ── 8. 08 时光痕迹 / 09 年度报告 / 10 本体状态 ──────────────────── */
  .trace-body {
    gap: 16px;
  }

  .trace-tags {
    order: -1;
    padding: 14px 14px 10px;
  }

  .trace-group + .trace-group {
    margin-top: 14px;
    padding-top: 14px;
  }

  .report-tracks li strong {
    max-width: none;
    flex: 1;
    min-width: 0;
  }

  .usage-side {
    min-width: 0;
    width: 100%;
  }

  .status-io {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  /* ── 9. 11 听歌页：恢复歌手名 + 单行贴边播放条 + 手机黑胶歌词 ────── */
  html body.view-mode .music-section {
    padding-top: 20px;
  }

  html body .music-section .section-heading {
    margin-bottom: 12px;
    padding-bottom: 8px;
    gap: 8px;
  }

  html body .music-section .section-heading .section-index,
  html body .music-section .section-heading p {
    display: block;
  }

  html body .music-section .mp-toolbar .mp-search-box {
    height: 42px;
  }

  html body .music-section .mp-lang {
    min-height: 36px;
    padding: 6px 10px;
  }

  html body .music-section .mp-track {
    min-height: 54px;
    padding: 8px 6px;
    gap: 10px;
  }

  html body .music-section .mp-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
  }

  html body .music-section .mp-name {
    max-width: 100%;
    width: 100%;
    font-size: 14.5px;
  }

  html body .music-section .mp-singer {
    display: block;
    max-width: 100%;
    width: 100%;
    padding-left: 0;
    font-size: 11.5px;
  }

  html body .music-section .mp-singer::before,
  html body .music-section .mp-leader,
  html body .music-section .mp-play {
    display: none;
  }

  html body .music-section .mp-like {
    width: 36px;
    height: 36px;
  }

  .mp-tab {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  html body.music-open .mp-player {
    z-index: 60;
    padding-bottom: 0;
  }

  html body .music-section .mp-player-inner {
    position: relative;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 12px max(14px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(14px, var(--safe-left));
  }

  html body .music-section .mp-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: 4px;
    margin: 0;
    border-radius: 0;
    order: 0;
  }

  html body .music-section .mp-bar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    bottom: -10px;
  }

  html body .music-section .mp-cover {
    order: 1;
    width: 38px;
    height: 38px;
  }

  html body .music-section .mp-now {
    order: 2;
    flex: 1;
    width: auto;
    min-width: 0;
  }

  html body .music-section .mp-time {
    order: 3;
    flex: none;
    margin-left: 0;
    font-size: 10px;
  }

  html body .music-section .mp-toggle {
    order: 4;
    width: 40px;
    height: 40px;
    flex: none;
  }

  html body .music-section .mp-vol-btn,
  html body .music-section .mp-vol {
    display: none;
  }

  html body .music-section .mp-player.disc-open .mp-disc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 14px;
    padding: 12px max(14px, var(--safe-right)) 6px max(14px, var(--safe-left));
  }

  html body .music-section .mp-disc-plate {
    width: 68px;
    height: 68px;
  }

  html body .music-section .mp-disc-meta {
    flex: 1;
    min-width: 0;
    gap: 4px;
  }

  .app-disc-close {
    flex: none;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
  }

  .app-disc-lyric-wrap {
    flex: 1 1 100%;
    width: 100%;
    border-top: 1px dashed var(--line);
    padding-top: 8px;
  }

  .app-disc-lyric {
    max-height: 25dvh;
    min-height: 64px;
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    scrollbar-width: none;
    text-align: center;
  }

  .app-disc-lyric::-webkit-scrollbar {
    display: none;
  }

  /* ── 10. 全屏阅读器顶栏瘦身 & 底部 Sheet 弹窗 ─────────────────────── */
  .reader {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .reader-shell {
    padding-bottom: var(--safe-bottom);
  }

  html body .reader-head {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: calc(8px + var(--safe-top)) max(12px, var(--safe-right)) 8px max(12px, var(--safe-left));
  }

  html body .reader-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  html body .reader-head .section-index {
    display: none;
  }

  html body .reader-head h2 {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html body .reader-actions {
    width: auto;
    flex: none;
    flex-wrap: nowrap;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  html body .reader-actions::-webkit-scrollbar {
    display: none;
  }

  html body .reader-actions .icon-button,
  html body .reader-actions button,
  html body .reader-actions a {
    min-height: 34px;
    min-width: 38px;
    white-space: nowrap;
  }

  .reader-page {
    padding: 20px 18px calc(32px + var(--safe-bottom));
  }

  /* 所有普通弹窗统一化为 Bottom Sheet，并保留内部滚动 */
  dialog.modal {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    max-height: calc(100dvh - 18px - var(--safe-top));
  }

  dialog.modal .modal-shell {
    max-height: calc(100dvh - 18px - var(--safe-top));
    padding: 20px max(18px, var(--safe-right)) calc(22px + var(--safe-bottom)) max(18px, var(--safe-left));
  }

  dialog.modal h2 {
    font-size: 23px;
    margin: 12px 0 6px;
  }

  dialog.modal .modal-intro {
    margin-bottom: 16px;
  }

  /* 所有输入框 >=16px，防 WebView 聚焦自动放大 */
  .field-label input,
  .field-label select,
  .field-label textarea,
  .search-field input,
  .paper-doi,
  .mp-search-box input,
  .pet-chat-input,
  .status-app-form input {
    font-size: 16px;
  }

  .action-options button {
    min-height: 82px;
    padding: 14px 16px 14px 70px;
  }

  .option-icon {
    left: 16px;
    top: 20px;
  }

  html body .pet-panel {
    z-index: 130;
    left: max(12px, var(--safe-left));
    right: max(12px, var(--safe-right));
    bottom: calc(12px + var(--safe-bottom));
    max-height: calc(100dvh - var(--app-header-h) - var(--safe-top) - var(--safe-bottom) - 20px);
  }

  html.ime-open .pet-chat {
    height: min(26dvh, 190px);
  }

  /* ── 10b. 移动端备忘录快捷输入与多风格弹窗适配 ─────────────────────── */
  .memo-mobile-new {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    font-size: 12px;
  }

  .memo-composer {
    display: none;
    padding: 14px;
  }

  .memo-composer.is-mobile-open {
    display: flex;
  }

  .memo-input,
  .memo-textarea,
  .memo-select,
  .memo-toolbar .search-box input {
    font-size: 16px;
  }

  .memo-pill,
  .memo-mini-btn,
  .memo-act-btn,
  .memo-tag-chip {
    min-height: 36px;
  }

  .memo-mini-btn {
    width: 36px;
    height: 36px;
  }

  .memo-check {
    width: 22px;
    height: 22px;
  }

  .memo-meta-field {
    flex: 1 1 130px;
    justify-content: space-between;
  }

  .memo-meta-field .memo-input,
  .memo-meta-field .memo-select {
    flex: 1;
    min-width: 0;
  }

  .memo-tags-input {
    width: auto !important;
  }

  .memo-remind-banner {
    top: calc(var(--app-header-h) + var(--safe-top) + 8px);
    left: max(12px, var(--safe-left));
    right: max(12px, var(--safe-right));
    width: auto;
  }

  .style-popover {
    right: -4px;
    width: min(248px, calc(100vw - 24px));
  }

  /* ── 10c. 移动端价格追踪、180 天曲线交互与提醒横幅适配 ───────────────── */
  .today-prices {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .price-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .price-head-actions > button {
    flex: 1 1 130px;
    justify-content: center;
    min-height: 40px;
  }

  .price-add-bar,
  .price-config-panel {
    padding: 14px;
  }

  .price-phase-note {
    margin-left: 0;
    width: 100%;
  }

  .price-add-fields {
    flex-direction: column;
    align-items: stretch;
  }

  .price-url-input,
  .price-title-input,
  .price-num-input,
  .price-note-input,
  .price-add-fields .btn-primary {
    flex: 1 1 auto;
    width: 100%;
  }

  .price-add-bar input,
  .price-config-panel input,
  .price-modal input,
  .price-toolbar .search-box input {
    font-size: 16px;
  }

  .price-toolbar .search-box {
    max-width: none;
    width: 100%;
  }

  .price-filter-tabs {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .price-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .price-filter-tabs .memo-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .price-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .price-card {
    padding: 14px;
  }

  .price-now {
    font-size: 22px;
  }

  .price-spark {
    width: 112px;
    height: 34px;
  }

  .price-act-btn,
  .price-act-del {
    min-height: 36px;
    padding: 0 12px;
  }

  dialog.price-modal {
    width: 100vw;
    max-width: 100vw;
  }

  .price-form-row,
  .price-form-row-btn {
    grid-template-columns: 1fr;
  }

  .price-alert-banner {
    top: calc(var(--app-header-h) + var(--safe-top) + 8px);
    left: max(12px, var(--safe-left));
    right: max(12px, var(--safe-right));
    width: auto;
  }
}

/* 适配 origin/main 卡片标题恒定两行高（8fcfed4）：双列保持齐平，单列不留白行 */
@media (min-width: 561px) and (max-width: 800px) {
  .doc-card h3,
  .post-card h3 {
    min-height: 3em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (hover: none) {
  .gallery-item span {
    color: #f6efe4;
    pointer-events: none;
  }
}

@media (max-width: 380px) {
  html .site-header .header-tools {
    margin-left: 4px;
    gap: 4px;
  }
  html .site-header .header-ghost {
    width: 30px;
    height: 30px;
  }
  html .site-header .header-cta {
    padding: 0 9px;
    font-size: 10.5px;
    margin-left: 5px;
  }
}

@media (max-width: 560px) {
  .doc-card h3,
  .post-card h3 {
    min-height: 0;
  }

  .trace-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
  }

  .trace-stat {
    padding: 12px;
    gap: 5px;
  }

  .trace-stat strong {
    font-size: 20px;
  }

  .closing {
    margin: 0 4px;
    border-radius: 22px;
  }

  .closing-inner {
    padding: 36px 20px;
  }

  /* ── 13. 2026-11-23 新增模块手机端适配（双发现条 / 三列元信息 / 3×2 折叠画廊 / 分享与热搜） ── */
  .library-discovery {
    flex-direction: column;
    gap: 10px;
  }

  .library-discovery:has(> .recent-strip:not([hidden])) {
    margin-bottom: 12px;
  }

  .library-discovery > .recent-strip {
    flex: none;
    width: 100%;
    padding: 10px 12px;
  }

  .gallery-group.is-folded .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .collapse-toggle {
    min-height: 36px;
    padding: 0 12px;
    margin-left: 0;
  }

  .post-share {
    min-height: 28px;
    padding: 2px 10px;
  }

  .search-hot-word {
    min-height: 32px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
  }

  .editor-meta-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .editor-meta-grid .field-label {
    margin-bottom: 12px;
  }

  .site-footer > .online-badge {
    order: 2;
    width: auto;
  }
}

@media (max-width: 480px) {
  html .site-header .brand-name small,
  html .site-header #randomOpen {
    display: none;
  }
}

/* ── 11. 移动端 PDF Canvas 阅读容器与缩放控制 bar ───────────────────── */
.mobile-pdf-pages {
  width: max-content;
  min-width: 100%;
  padding: 14px 10px calc(76px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.mobile-pdf-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 22px rgba(40, 32, 26, .16);
}

.mobile-pdf-bar button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.mobile-pdf-bar button:disabled {
  opacity: .35;
}

.mobile-pdf-stat {
  padding: 0 6px;
  color: var(--muted);
  white-space: nowrap;
}

.mobile-pdf-page {
  position: relative;
  background: #fffdf9;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(42, 35, 29, .10);
  overflow: hidden;
  flex: none;
}

.mobile-pdf-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

.mobile-pdf-page.is-pending::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--paper2) 20%, var(--paper) 40%, var(--paper2) 60%);
  background-size: 200% 100%;
  animation: mobile-pdf-shimmer 1.4s linear infinite;
}

@keyframes mobile-pdf-shimmer {
  to { background-position: -200% 0; }
}

/* ── 12. 暗色模式全组件补齐（桌宠面板 / 听歌 / PDF / 抽屉） ─────────── */
html[data-theme="dark"] .page-turn-label {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .page-turn-label .page-turn-kicker {
  color: var(--muted);
}

html[data-theme="dark"] .mobile-pdf-page {
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
}

html[data-theme="dark"] .mobile-pdf-page canvas {
  filter: brightness(.88) contrast(.96);
}

html[data-theme="dark"] .app-nav-backdrop {
  background: rgba(0, 0, 0, .55);
}

html[data-theme="dark"] .pet-panel {
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 22px 50px rgba(0, 0, 0, .58);
}

html[data-theme="dark"] .pet-panel-head,
html[data-theme="dark"] .pet-tabs {
  background: var(--white);
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .pet-panel-name,
html[data-theme="dark"] .pet-tab.active,
html[data-theme="dark"] .pet-metric-value,
html[data-theme="dark"] .pet-link-name,
html[data-theme="dark"] .pet-job-name,
html[data-theme="dark"] .pet-log-title,
html[data-theme="dark"] .pet-grow-top strong,
html[data-theme="dark"] .pet-grow-stats strong {
  color: var(--ink);
}

html[data-theme="dark"] .pet-panel-sub,
html[data-theme="dark"] .pet-tab,
html[data-theme="dark"] .pet-metric-label,
html[data-theme="dark"] .pet-grow-note,
html[data-theme="dark"] .pet-grow-next,
html[data-theme="dark"] .pet-grow-stats,
html[data-theme="dark"] .pet-grow-hint {
  color: var(--muted);
}

html[data-theme="dark"] .pet-panel-close {
  border-color: var(--line);
  color: var(--muted);
}

html[data-theme="dark"] .pet-bar,
html[data-theme="dark"] .pet-grow-bar,
html[data-theme="dark"] .pet-log::before {
  background: #2b2620;
}

html[data-theme="dark"] .pet-link,
html[data-theme="dark"] .pet-job,
html[data-theme="dark"] .pet-foot-note,
html[data-theme="dark"] .pet-grow-stats {
  border-color: var(--line);
}

html[data-theme="dark"] .pet-log-item::before {
  background: var(--card, var(--white));
  border-color: var(--coral);
}

html[data-theme="dark"] .pet-chat-row.her .pet-chat-text {
  background: var(--paper2);
  color: var(--ink);
}

html[data-theme="dark"] .pet-chat-input {
  background: #262119;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .pet-feed-btn:disabled {
  background: var(--paper2);
  border-color: var(--line);
  color: var(--muted);
}

html[data-theme="dark"] .music-section .mp-track:hover {
  background: rgba(217, 122, 95, .08);
}

html[data-theme="dark"] .music-section .mp-track.active {
  background: rgba(217, 122, 95, .14);
}

html[data-theme="dark"] .music-section .mp-thumb {
  background: #2b2620;
}

html[data-theme="dark"] .music-section .mp-tab {
  color: var(--muted);
}

html[data-theme="dark"] .music-section .mp-tab.is-on {
  color: var(--ink);
}

@media (min-width: 801px) {
  .app-nav-backdrop,
  .app-nav-quick,
  .app-code-files-btn,
  .app-disc-close,
  .app-disc-lyric-wrap {
    display: none !important;
  }
}
