/* Huan Hsu | 桓 | TW | 959 */
/* 手機遊戲畫面（720px 以下）。
   實測 375×812：底部工具列＋快選列＋輸入列一共 226px（畫面的 28%），
   正文外面還包一層卡片，一行只剩約 300px。參考對話 App 與閱讀器的做法：
   - 輸入列縮成一行並浮在正文上方，往下讀時讓位、往上捲或讀到底時出現
   - 工具收進「⋯」打開的底部抽屜
   - 快選列只在正文裡的選項捲出畫面後才出現
   - 正文拿掉卡片外框，全寬閱讀
   浮動而不是留在版面裡：收起與出現只是位移，閱讀區大小一格都不變，
   正在讀的那一行不會被推動（「讀到哪就停在哪」）。 */

.more-btn { display: none; }
.tools-sheet-head { display: none; }
.tools-backdrop { display: none; }

@media (max-width: 720px) {
  /* ── 正文全寬 ── */
  body.in-game #gameView .log {
    padding-inline: 16px;
    padding-bottom: calc(var(--dock-h, 64px) + 24px);
    gap: 28px;
    scroll-padding-bottom: calc(var(--dock-h, 64px) + 16px);
  }
  body.in-game .msg.assistant {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }
  body.in-game .msg.assistant.is-past { opacity: .9; }
  /* 回合之間用一條細線分開，取代卡片 */
  body.in-game .msg.assistant + .msg,
  body.in-game .msg.user + .msg.assistant { border-top: 1px solid var(--border); padding-top: 22px; }
  body.in-game .msg.user {
    margin-left: auto;
    max-width: 88%;
  }

  /* ── 浮動輸入列 ── */
  body.in-game #gameView { position: relative; }
  body.in-game .input-bar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 15;
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 3px rgba(43, 42, 40, 0.04);
    transition: transform .2s ease-out;
  }
  body.in-game.dock-hidden:not(.tools-open) .input-bar { transform: translateY(110%); }
  body.in-game .input-bar #playerInput {
    flex: 1 1 auto;
    width: auto;
    min-height: 44px;
    max-height: 132px;
    padding: 10px 12px;
    border-radius: 22px;
    line-height: 1.45;
  }
  body.in-game .input-bar .send-group { flex: 0 0 auto; align-self: flex-end; border-radius: 22px; }
  body.in-game .input-bar .send-group button { min-height: 44px; padding: 0 14px; font-size: 15px; }
  body.in-game .input-bar .send-group.single button { border-radius: 22px; }
  body.in-game .input-bar .stop-btn { flex: 0 0 auto; min-height: 44px; border-radius: 22px; }
  .more-btn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    cursor: pointer;
  }
  .more-btn[aria-expanded="true"] { color: var(--ember-bright); border-color: var(--ember); }

  /* ── 快選列：浮在輸入列上方，正文裡的選項看得到時就不出現 ── */
  body.in-game .quick-picks:not(.hidden) {
    position: absolute;
    left: 0; right: 0;
    bottom: var(--dock-h, 64px);
    z-index: 14;
    padding: 6px 10px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    transition: transform .2s ease-out, opacity .2s ease-out;
  }
  body.in-game.options-in-view .quick-picks,
  body.in-game.dock-hidden .quick-picks { transform: translateY(20px); opacity: 0; pointer-events: none; }

  /* 產出中提示與上回提要也浮在輸入列上方 */
  body.in-game .generating-hint:not(.hidden) {
    position: absolute; left: 10px; right: 10px; bottom: calc(var(--dock-h, 64px) + 6px); z-index: 14;
    margin: 0; padding: 8px 12px; border-radius: 10px;
    background: var(--card); border: 1px solid var(--border);
  }
  body.in-game .recap-card:not(.hidden) {
    position: absolute; left: 0; right: 0; bottom: calc(var(--dock-h, 64px) + 4px); z-index: 14; margin: 0 10px;
  }
  body.in-game .jump-btn { bottom: calc(var(--dock-h, 64px) + 58px); }
  body.in-game.dock-hidden .jump-btn { bottom: max(16px, env(safe-area-inset-bottom)); }

  /* ── 工具抽屜 ── */
  body.in-game .toolbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 6px 14px max(16px, env(safe-area-inset-bottom));
    overflow: visible;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -1px 3px rgba(43, 42, 40, 0.06);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .2s ease-out, visibility 0s linear .2s;
  }
  body.in-game.tools-open .toolbar {
    transform: none;
    visibility: visible;
    transition: transform .2s ease-out;
  }
  body.in-game .toolbar .ghost-btn { min-height: 48px; min-width: 0; font-size: 15px; border: 1px solid var(--border); border-radius: 10px; }
  body.in-game .toolbar .font-ctl { grid-column: 1 / -1; display: flex; justify-content: center; gap: 12px; }
  body.in-game .toolbar .font-ctl button { min-height: 48px; min-width: 88px; }
  body.in-game .toolbar .font-val { display: inline-flex; align-items: center; }
  .tools-sheet-head { display: flex; justify-content: center; grid-column: 1 / -1; padding: 4px 0 6px; }
  .tools-grip { width: 36px; height: 4px; border-radius: 999px; background: var(--border-strong, #cfc6bd); }
  body.in-game.tools-open .tools-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 39;
    background: rgba(43, 42, 40, 0.28);
  }

  /* ── 標題列壓成一行：原本標題與按鈕各一行，佔掉約 95px ── */
  body.in-game .topbar { flex-wrap: nowrap; gap: 6px; min-height: 52px; padding: 6px 10px; }
  body.in-game .brand-lockup { flex: 1 1 auto; min-width: 0; }
  body.in-game .brand-copy { min-width: 0; }
  body.in-game .brand-kicker, body.in-game .brand-mark { display: none; }
  body.in-game .brand-copy h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.in-game .topbar-actions { flex: 0 0 auto; flex-wrap: nowrap; overflow: visible; max-width: none; gap: 2px; padding-bottom: 0; }
  body.in-game .topbar .tb-btn { width: 38px; height: 38px; min-height: 38px; }

  /* 選項按鈕在全寬版面裡稍微收緊 */
  body.in-game .option-btn { padding: 12px 13px; }
}

@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  body.in-game .input-bar, body.in-game .toolbar, body.in-game .quick-picks { transition: none; }
}
