/* 貘布 前門：「你是哪隻貘」入口（/pair/）＋ 矮螢幕（高 ≤700px）收緊間距，讓前門一頁放得下、不用捲動。只動排版，不改文案、不動圖。 */
.pair-entry { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; box-shadow: 0 2px 10px rgba(27,43,79,.05); }
.pair-entry img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.app-card small { text-wrap: balance; line-break: strict; }
.mobu-move-card p { text-wrap: pretty; line-break: strict; line-height: 1.55; letter-spacing: 0; font-kerning: normal; }
.pair-entry b { flex: 1; font-size: 16px; white-space: nowrap; }
.pair-entry::after { content: "›"; flex: none; font-size: 22px; line-height: 1; color: var(--muted); }
.pair-entry:active { transform: scale(.98); }
.pair-entry:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* 320 寬：上方一列放不下（登入備份＋商標＋指令中心＋記憶庫＋設定），標題「指令中心」讓位給按鈕，不再橫向撐開頁面 */
@media (max-width: 359px) { .top-t { display: none; } .top { gap: 4px; } }
@media (max-height: 700px) {
  .main { padding-top: 8px; gap: 8px; }
  .cmd { padding: 8px 10px; }
  .cmd-head { margin-bottom: 4px; }
  .pet { width: 52px; height: 52px; }
  .bubble { padding: 4px 10px 5px; margin-bottom: 4px; }
  .cmd-row { margin-top: 6px; }
  .apps { gap: 8px; }
  .app-card { min-height: 64px; padding: 6px 8px 6px 6px; }
  .app-card img { width: 48px; height: 48px; }
  .pair-entry { min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
  .pair-entry img { width: 32px; height: 32px; }
  .recent { padding: 4px 12px; }
  .recent .empty { padding: 2px 0; font-size: 13px; }
  .mobu-move-card { padding: 8px 12px 8px 12px !important; font-size: 14px !important; line-height: 1.55 !important; }
  .mobu-move-card p { margin-bottom: 6px !important; line-height: 1.55 !important; letter-spacing: 0 !important; }
  .mobu-move-card .mmc-go, .mobu-move-card .mmc-no { min-height: 40px !important; }
}
/* 「把舊資料搬過來」還在時，比較高的手機（高 ≤860px）也先收緊一點，加上「你是哪隻貘」之後前門仍一頁放得下 */
@media (max-height: 860px) {
  .mobu-move-card { padding: 8px 12px !important; font-size: 14px !important; line-height: 1.55 !important; }
  .mobu-move-card p { margin-bottom: 6px !important; line-height: 1.55 !important; letter-spacing: 0 !important; }
  .mobu-move-card .mmc-go, .mobu-move-card .mmc-no { min-height: 40px !important; }
}
/* 高 ≤620px（320×568、iPhone SE 一代）：再收緊；「最近動作」還沒有動作時（只有一句空白提示）先讓位，有動作就照常顯示 */
@media (max-height: 620px) {
  .main { padding-top: 6px; gap: 6px; }
  .cmd { padding: 6px 10px; }
  .pet { width: 44px; height: 44px; }
  .bubble { padding: 3px 10px 4px; margin-bottom: 2px; }
  textarea { min-height: 60px; padding: 6px 10px; }
  .cmd-row { margin-top: 4px; }
  .apps { gap: 6px; }
  .app-card { min-height: 56px; padding: 4px 8px 4px 4px; }
  .app-card img { width: 44px; height: 44px; }
  .app-card b { font-size: 16px; }
  .app-card small { font-size: 12px; line-height: 1.3; }
  .pair-entry { min-height: 40px; }
  .pair-entry img { width: 30px; height: 30px; }
  .recent:has(> .empty), .recent:has(#recent-list > .empty) { display: none; }
  /* .top 矮螢幕收緊只套在窄螢幕，見下方 max-width 767 區塊 */
  .main { gap: 4px; padding-bottom: calc(8px + var(--mobu-nav-h, 50px)); }
  .cmd { padding: 4px 10px; }
  .app-card b { line-height: 1.2; }
  .mobu-move-card { padding: 6px 10px !important; font-size: 13px !important; line-height: 1.55 !important; }
  .mobu-move-card p { margin-bottom: 4px !important; line-height: 1.55 !important; letter-spacing: 0 !important; }
  .mobu-move-card .mmc-go, .mobu-move-card .mmc-no { min-height: 36px !important; }
}

/* QA 1203f：320×568（高 ≤620px）「把舊資料搬過來」卡片的「不用」不被切換列切到——連指令中心第一次使用說明（氣泡兩行、輸入框有範例字）展開時也放得下。只動間距、不改字 */
@media (max-height: 620px) and (max-width: 767px) {
  .top { padding-top: calc(4px + var(--safe-top)); padding-bottom: 4px; min-height: calc(44px + var(--safe-top)); }
}
@media (max-height: 620px) {
  .app-card { padding-top: 3px; padding-bottom: 3px; }
  .app-card small { line-height: 1.2; }
  .pair-entry { min-height: 36px; padding-top: 3px; padding-bottom: 3px; }
  .pair-entry img { width: 28px; height: 28px; }
  .apps { gap: 5px; }
}

/* QA a2hs：加入主畫面提示卡（只在 iOS Safari、導覽和搬家卡都關掉之後出現）。系統字型、不改既有文案。暫時頂替「最近動作」，不加高度。 */
.mobu-a2hs-card { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.mobu-a2hs-card p { margin: 0; flex: 1; min-width: 0; text-wrap: pretty; line-break: strict; }
.mobu-a2hs-card .a2hs-share { font-style: normal; }
.mobu-a2hs-card .a2hs-end { white-space: nowrap; }
.mobu-a2hs-card .a2hs-ok { flex: none; font: inherit; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(27,43,79,.2); background: #fff; color: #1b2b4f; }
@media (max-height: 700px) {
  .mobu-a2hs-card { padding: 6px 10px; font-size: 13px; line-height: 1.35; gap: 8px; }
  .mobu-a2hs-card .a2hs-ok { min-height: 44px; padding: 0 12px; }
}
@media (max-height: 620px) {
  .mobu-a2hs-card { padding: 4px 10px; font-size: 13px; line-height: 1.3; }
  .mobu-a2hs-card .a2hs-ok { min-height: 44px; padding: 0 12px; }
}

/* 頂列左右留白，避免「登入備份」貼齊左緣、「設定」被切到；桌面寬度維持 44px 按鈕放得下的高度（短桌面窗不要套手機矮螢幕的頂列） */
header.top { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); overflow: visible; }
@media (min-width: 768px) {
  header.top { min-height: calc(52px + var(--safe-top)); padding-top: calc(8px + var(--safe-top)); padding-bottom: 8px; }
}
.mobu-move-card .site-word { display: inline-block; padding: 0 0.1em; letter-spacing: 0; white-space: nowrap; }
.mobu-move-card .nowrap { white-space: nowrap; }
@media (max-width: 359px) { .mobu-move-card .nowrap { white-space: normal; } }

/* ≥1024 電腦首頁：主區最寬 1100、雙欄。手機版不變。連接另一台裝置入口先隱藏，等連接介面上線。 */
.app-grid { display: contents; }
#values-entry, #desk-connect { display: none; }
@media (min-width: 1024px) {
  html[data-mobu-app="home"] header.top {
    min-height: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
  }
  html[data-mobu-app="home"] header.top .top-inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    box-sizing: border-box;
  }
  html[data-mobu-app="home"] header.top .wm { display: none; } /* 商標改在側欄 */
  html[data-mobu-app="home"] .main {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding: 24px 24px 40px;
  }
  html[data-mobu-app="home"] #cmd { grid-column: 1; grid-row: 1; }
  html[data-mobu-app="home"] #cards,
  html[data-mobu-app="home"] .ob-demo { grid-column: 1; }
  html[data-mobu-app="home"] #recent { grid-column: 1; grid-row: 2; }
  html[data-mobu-app="home"] #desk-connect { grid-column: 1; }
  html[data-mobu-app="home"] #apps { display: contents; }
  html[data-mobu-app="home"] .app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    grid-column: 2;
    grid-row: 1;
  }
  html[data-mobu-app="home"] #pair-entry,
  html[data-mobu-app="home"] #values-entry { grid-column: 2; }
  html[data-mobu-app="home"] .mobu-move-card { grid-column: 2; }
  html[data-mobu-app="home"] .mobu-a2hs-card { grid-column: 1; grid-row: 3; }
  html[data-mobu-app="home"] .app-grid .app-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 16px 14px;
    min-height: 148px;
  }
  html[data-mobu-app="home"] .app-grid .app-card img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    object-position: left center;
  }
  html[data-mobu-app="home"] .app-grid .app-card b { font-size: 18px; }
  html[data-mobu-app="home"] #values-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 16px 8px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(27,43,79,.05);
  }
  html[data-mobu-app="home"] #values-entry img { width: 44px; height: 44px; object-fit: contain; flex: none; }
  html[data-mobu-app="home"] #values-entry b { flex: 1; font-size: 16px; font-weight: 700; white-space: nowrap; min-width: 0; }
  html[data-mobu-app="home"] #values-entry::after { content: "›"; flex: none; font-size: 22px; line-height: 1; color: var(--muted); }
  html[data-mobu-app="home"] #cmd .pet { width: 80px; height: 80px; }
}
@media (min-width: 1024px) and (max-width: 1100px) {
  html[data-mobu-app="home"] .main { padding: 16px 16px 28px; }
  html[data-mobu-app="home"] .app-grid .app-card { min-height: 132px; padding: 12px; }
  html[data-mobu-app="home"] .app-grid .app-card img { width: 76px; height: 76px; }
  html[data-mobu-app="home"] #cmd .pet { width: 72px; height: 72px; }
  html[data-mobu-app="home"] header.top .top-inner { padding: 0 16px; }
}
@media (min-width: 1024px) and (max-height: 800px) {
  html[data-mobu-app="home"] .main { padding-top: 16px; padding-bottom: 20px; }
  html[data-mobu-app="home"] .app-grid .app-card { min-height: 124px; }
  html[data-mobu-app="home"] .app-grid .app-card img { width: 72px; height: 72px; }
}

/* top-inner：手機也維持一列，避免記憶庫／設定掉到第二行、跟「？」重疊 */
header.top .top-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
  min-width: 0;
  flex: 1;
  box-sizing: border-box;
}
@media (max-width: 359px) { header.top .top-inner { gap: 4px; } }
