.mobile-only, .mobile-hub { display: none; }

@media (max-width: 820px), (max-width: 1000px) and (max-height: 500px) {
  :root { --mobile-nav-height: calc(62px + env(safe-area-inset-bottom, 0px)); }
  html, body { height: 100%; overflow: hidden; scrollbar-gutter: auto; }
  body { background: #f1f3ed; }
  .mobile-only { display: block; }
  [hidden], .mobile-only[hidden] { display: none !important; }
  button, select, input, label { touch-action: manipulation; }
  button { -webkit-tap-highlight-color: transparent; }
  button:focus-visible, select:focus-visible, input:focus-visible {
    outline: 2px solid #2f735b; outline-offset: 2px;
  }
  .game-shell {
    width: 100%; max-width: none; height: calc(100dvh - var(--mobile-nav-height));
    padding: env(safe-area-inset-top, 0px) 0 0; gap: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .topbar {
    display: flex; justify-content: space-between; min-height: 50px; padding: 4px 14px;
    border: 0; border-radius: 0; box-shadow: none; background: #254d40;
  }
  .topbar::after, .top-actions { display: none; }
  .title-lockup { gap: 8px; }
  .title-lockup > div { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
  .title-lockup h1 { font-size: 20px; letter-spacing: 0; color: #faf8ee; }
  .title-lockup p { margin: 0; max-width: 80px; font-size: 12px; color: #c7d8cb; }
  #mobileCommissionSlot { flex-shrink: 0; }
  #mobileCommissionSlot button {
    display: flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 6px;
    border: 0; background: transparent; color: #f0f3e9; font: inherit; font-size: 13px;
  }
  #mobileCommissionSlot svg { width: 18px; height: 18px; }
  .layout { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .story-panel {
    display: block; height: auto; min-height: 100%; padding: 10px 12px 16px;
    border: 0; border-radius: 0; background: #f1f3ed; box-shadow: none;
  }
  .story-panel::before { display: none; }
  .home-overview { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; margin: 0 0 8px; border: 0; }
  .home-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; width: 100%; }
  .home-stats .stat-row {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline;
    gap: 5px; min-height: 24px; padding: 0; font-size: 13px; background: transparent;
  }
  .home-stats .stat-row::before { display: none; }
  .home-stats .stat-row b { min-width: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
  .home-stats .stat-rank { font-size: 11px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
  .home-statuses { border: 0; border-radius: 0; padding: 4px 0; white-space: normal; overflow: visible; }
  .home-statuses:has(.empty-status) { display: none; }
  .home-statuses small { font-size: 12px; }
  .home-statuses li { white-space: normal; font-size: 12px; }
  .progression-summary { display: block; padding: 0; border: 0; }
  .progression-summary > span { display: none; }
  .home-collection-goal {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    width: 100%; min-height: 44px; padding: 4px 0; border: 0; border-bottom: 1px solid #d5ddd3;
  }
  .home-collection-goal b { font-size: 12px; line-height: 1.45; color: #344e40; }
  .home-collection-goal em { display: none; }
  .home-collection-goal::after { content: "›"; color: #4d715d; font: 22px sans-serif; flex-shrink: 0; }
  .journey-strip { display: flex; gap: 8px; margin: 0; padding: 0; }
  .journey-strip button {
    flex: 1; min-width: 0; min-height: 44px; padding: 6px 0; border: 0; background: transparent;
    border-radius: 0; box-shadow: none; text-align: left;
  }
  .journey-strip button b, .journey-strip button strong { font-size: 12px; }
  .journey-strip button small { font-size: 11px; }
  .story-meta { padding: 0 0 8px; margin: 0; min-height: 40px; border: 0; }
  .encounter-seal { width: 30px; height: 30px; font-size: 17px; }
  .encounter-heading-copy small, .encounter-location { display: none; }
  .encounter-heading-copy strong { font-size: 17px; }
  .wind-mark b { font-size: 11px; }
  .story-card, .story-card.has-result {
    display: block; min-height: 0; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none; overflow: visible;
  }
  .story-card::before, .story-card::after { display: none; }
  .scene-scroll {
    display: grid; grid-template-rows: 120px auto; position: relative; padding: 0;
    overflow: hidden; border: 0; border-radius: 4px; background: #fff; box-shadow: none;
  }
  .scene-scroll > .scene-visual, .story-card.has-result .scene-visual {
    position: relative; inset: auto; width: 100%; height: 120px; min-height: 120px; opacity: 1;
  }
  .scene-narrative, .story-card.has-result .scene-narrative {
    display: block; position: static; min-height: 0; max-height: none; overflow: visible;
    padding: 10px 12px 44px; border: 0; background: #fff; backdrop-filter: none;
  }
  .scene-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; line-height: 1.6; }
  .scene-text::first-letter { font-size: inherit; }
  #sceneExpandBtn {
    position: absolute; z-index: 4; right: 6px; bottom: 0; min-height: 44px; padding: 0 8px;
    background: transparent; border: 0; color: #376551; font: inherit; font-size: 12px;
  }
  .scene-location-label { top: 10px; bottom: auto; }
  .scene-event-emblem { display: none; }
  .choice-area { overflow: visible; padding: 8px 0 0; border: 0; }
  .choice-caption { min-height: 44px; margin: 0 0 4px; padding: 0; }
  #approachQuickBtn, #growthSkillBtn { min-width: 44px; min-height: 44px; padding: 0 8px; font-size: 12px; }
  #approachQuickBtn small { font-size: 12px; }
  .choices { gap: 8px; }
  .choices > button {
    min-height: 76px; padding: 10px; grid-template-columns: 24px minmax(0, 1fr) 12px; gap: 8px;
    border-radius: 4px; background: #fff; box-shadow: none;
  }
  .choice-index { width: 24px; height: 24px; font-size: 13px; }
  .choice-title { font-size: 15px; line-height: 1.5; }
  .choice-risk { font-size: 11px; }
  .choice-terms { font-size: 12px; line-height: 1.6; margin-top: 3px; }
  .result-panel:not([hidden]) { display: block; overflow: visible; max-height: none; padding: 12px; background: #fff; }
  #resultText { max-height: none; overflow: visible; font-size: 14px; line-height: 1.75; }
  #continueBtn { width: 100%; min-height: 48px; margin-top: 12px; font-size: 16px; }

  #mobileNav {
    position: fixed; z-index: 25; bottom: 0; left: 0; right: 0; display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)); height: var(--mobile-nav-height);
    padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    border-top: 1px solid #d2dbd2; background: #fafbf7;
  }
  #mobileNav > span { min-width: 0; }
  #mobileNav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    width: 100%; height: 61px; min-width: 0; padding: 3px 0; color: #67756b;
    background: transparent; border: 0; border-top: 2px solid transparent; border-radius: 0; font: inherit; font-size: 12px;
  }
  #mobileNav [data-mobile-icon] { display: flex; }
  #mobileNav [aria-current="page"] { color: #21583f; border-top-color: #397555; background: #eaf1e9; font-weight: 700; }
  .mobile-tool-page, .mobile-hub:not([hidden]) {
    display: flex; position: fixed; z-index: 20; inset: 0 0 var(--mobile-nav-height);
    padding: env(safe-area-inset-top, 0px) 0 0; background: #f1f3ed;
    backdrop-filter: none; animation: none; overflow: hidden;
  }
  .mobile-tool-page .tool-panel {
    display: flex; flex-direction: column; width: 100%; height: 100%; max-width: none; max-height: none;
    min-height: 0; border: 0; border-radius: 0; background: #f1f3ed; box-shadow: none; animation: none !important;
  }
  .mobile-tool-page .tool-panel::before, .mobile-tool-page .tool-panel::after { display: none; }
  .mobile-tool-page .tool-header, .mobile-page-header {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-shrink: 0;
    min-height: 56px; padding: 6px 12px; color: #263f32; background: #fafbf7; border-bottom: 1px solid #d2dbd2;
  }
  .mobile-tool-page .tool-header > div { order: 1; }
  .mobile-tool-page .tool-header > div > span { display: none; }
  .mobile-tool-page .tool-header h2, .mobile-page-header h2 { margin: 0; font-size: 20px; letter-spacing: 0; color: #263f32; }
  .mobile-tool-page .tool-header .icon-button { display: grid; place-items: center; order: 0; background: transparent; color: #345744; border: 0; }
  .mobile-tool-page .tool-scroll { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; overscroll-behavior: contain; padding-bottom: 16px; }
  .mobile-tool-page button, .mobile-tool-page select,
  dialog button, dialog select, .icon-button { min-height: 44px; }
  .mobile-tool-page .growth-toggle { min-height: 44px; }
  .icon-button, .dialog-close, #albumPrevBtn, #albumNextBtn { min-width: 44px; width: 44px; height: 44px; flex-shrink: 0; }
  .mobile-tool-page .tool-header ~ :not(.tool-scroll) { flex-shrink: 0; }
  .mobile-tool-page .album-body { flex: 1 1 auto !important; }
  .mobile-tool-page .album-views { padding-inline: 12px; gap: 8px; }
  .album-filter-bar select { width: 78px; }
  .mobile-tool-page .album-summary { gap: 6px 12px; padding: 10px 14px; }
  .mobile-tool-page .album-book { margin-inline: 6px; }
  .mobile-tool-page .album-pagination { min-height: 56px; }
  .mobile-tool-page .album-dynasties button { min-height: 44px; }
  .mobile-tool-page .package-notice { margin: 0; padding: 10px 14px; font-size: 12px; line-height: 1.6; }
  .package-shortcuts { padding: 8px 14px; }
  .package-shortcuts button { flex: 1; font-size: 13px; }
  #packageList .coin-entry { gap: 8px; padding-block: 12px; }
  #packageList button { min-height: 44px; height: auto; box-shadow: none; }
  #packageList .coin-entry-actions { max-width: none; flex-shrink: 0; gap: 6px; flex-wrap: nowrap; }
  #packageList .coin-info { flex: 1; }
  #packageList .coin-name { font-size: 14px; overflow-wrap: anywhere; }
  #packageList .coin-entry-actions > .growth-toggle { display: none; }
  #packageList .coin-entry-actions .album-action { min-width: 64px; font-size: 13px; padding: 6px; }
  #packageList .coin-count { font-size: 12px; }
  .package-detail-btn { display: grid; place-items: center; width: 44px; padding: 0; border: 1px solid #b7c6b6; border-radius: 4px; color: #3d6150; background: transparent; }
  .mobile-hub:not([hidden]) { flex-direction: column; overflow: auto; }
  .mobile-hub-art { height: 160px; flex-shrink: 0; background: #dce7dc url("assets/jianghu-riverside-market.webp") center 35% / cover; }
  .mobile-menu-row { margin: 0 16px; border-bottom: 1px solid #cdd8cc; }
  .mobile-menu-row button {
    width: 100%; min-height: 76px; display: flex; align-items: center; gap: 16px;
    padding: 12px 4px; border: 0; background: transparent; color: #2e4c3c; font: inherit; font-size: 17px;
  }
  .mobile-menu-row button::after { content: "›"; margin-left: auto; font: 24px sans-serif; }
  .mobile-menu-row svg { width: 28px; height: 28px; }
  dialog.experience-dialog, dialog.album-coin-dialog {
    position: fixed; inset: auto 0 0; width: 100%; max-width: 600px; max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
    margin: 0 auto; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); border: 0; border-radius: 8px 8px 0 0;
    background: #fafbf7; overflow-y: auto; box-shadow: 0 -8px 36px #17281d24;
  }
  dialog::backdrop { backdrop-filter: none !important; background: #14251d66 !important; }
  .album-coin-dialog .album-detail-header { position: sticky; top: -16px; z-index: 1; background: #fafbf7; padding-block: 4px; }
  #albumCoinContent .album-entry { padding: 12px 0; }
  #albumCoinContent .album-actions { gap: 10px; }
  #albumCoinContent .album-actions button { min-height: 48px; }
  #albumCoinProtection .growth-toggle { display: flex; min-height: 48px; font-size: 14px; }
  #albumCoinProtection .growth-toggle input { width: 22px; height: 22px; margin-right: 6px; }
  #albumCoinProtection p { margin: 0 0 8px; }
  #mobileSceneText { font-size: 17px; line-height: 1.85; white-space: pre-wrap; }
  .collection-toast { bottom: calc(var(--mobile-nav-height) + 12px); }
  .travel-overlay, .cleaning-overlay { z-index: 40; }
}

@media (max-width: 360px) {
  .title-lockup p { display: none; }
  .story-panel { padding-inline: 10px; }
  #packageList .coin-entry-actions { gap: 4px; }
  #packageList .coin-entry-actions .album-action { min-width: 56px; }
}
