/* ============================================================================
   css/shell.css — AppShell 版面（Visual Pass PR-04 / D1）
   - 全屏高度鎖定 100dvh（帶 100vh 後備）
   - 手機（<768px）：底部四頁籤 Tab Bar 取代舊三掣 Dock（摺摺 ribbon 保留）
   - iPad（≥768px）：左側導航欄 ＋ 中央小鎮舞台 ＋ 右側 Today Deck 槽位
   - 桌面（≥1280px）：舞台封頂置中，兩側以暮光底色填滿（PR-05 追加，IVAN 2026-12-04 拍板）
   - 彈窗係 body 層 position:fixed，唔受本檔影響
   ============================================================================ */

#game-client { height: 100vh; height: 100dvh; }

/* ---------- 共用：樣式指南全屏視圖 ---------- */
#view-styleguide {
  position: fixed; inset: 0; z-index: 300;
  display: none; flex-direction: column;
  background: #fdf9ef;
}
#view-styleguide.open { display: flex; }
.sg-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--paper-cream); border-bottom: 2.5px solid var(--paper-kraft-deep);
  font-weight: 900; color: var(--ink-primary); font-size: 14px;
}
#styleguide-frame { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- 共用：AdaptiveSheet 內部結構（外觀行 PR-02 .ds-sheet） ---------- */
.adaptive-sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.adaptive-sheet-title { font-size: 16px; font-weight: 900; color: var(--ink-primary); }
.adaptive-sheet-x {
  width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 2px solid var(--paper-kraft-deep);
  background: var(--paper-white); color: var(--ink-primary);
  font-size: 18px; font-weight: 900; cursor: pointer;
}
.adaptive-sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- 預設（手機優先）：Rail／Deck 隱藏，Tab Bar 隱藏待手機媒體查詢開啟 ---------- */
#nav-rail { display: none; }
#today-deck { display: none; }
#tab-bar { display: none; }

/* ---------- 手機（<768px）：四頁籤 Tab Bar ---------- */
@media (max-width: 767px) {
  #hud-bottom .bottom-dock-bar { display: none; }
  #tab-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
    pointer-events: auto;
  }
  .tab-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 52px; padding: 8px 2px;
    background-color: rgba(255, 253, 247, 0.98); background-image: var(--paper-grain);
    border: 2.5px solid #9f8258; border-radius: 14px;
    box-shadow: 0 4px 0 #7e633f, 0 6px 14px rgba(45, 36, 30, 0.2);
    color: var(--ink-primary); font-size: 13px; font-weight: 900; white-space: nowrap;
    cursor: pointer;
  }
  .tab-btn .ico-slot { width: 22px; height: 22px; }
  .tab-btn.is-active {
    background: linear-gradient(180deg, #fff5d1 0%, #ffd97d 100%);
    border-color: #c96f2d; box-shadow: 0 4px 0 #9e5017; color: #4a2204;
  }
}

/* ---------- iPad（≥768px）：左欄 ＋ 中央舞台 ＋ 右 Deck ---------- */
@media (min-width: 768px) {
  #nav-rail {
    display: flex; flex-direction: column; gap: 10px;
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    z-index: 30;
  }
  .nav-rail-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    width: 62px; min-height: 62px; padding: 7px 2px;
    background-color: rgba(255, 253, 247, 0.98); background-image: var(--paper-grain);
    border: 2.5px solid #9f8258; border-radius: 16px;
    box-shadow: 0 4px 0 #7e633f, 0 6px 14px rgba(45, 36, 30, 0.2);
    color: var(--ink-primary); font-size: 11.5px; font-weight: 900;
    cursor: pointer;
  }
  .nav-rail-btn .ico-slot { width: 26px; height: 26px; }
  .nav-rail-btn.is-active {
    background: linear-gradient(180deg, #fff5d1 0%, #ffd97d 100%);
    border-color: #c96f2d; box-shadow: 0 4px 0 #9e5017; color: #4a2204;
  }

  /* 中央舞台讓位俾左欄（76px）同右 Deck（316px）；width:auto 防 layout.css 嘅
     width:100% 令 right 失效溢出（審查 P1） */
  #diorama-viewport { left: 76px; right: 316px; width: auto; }
  #hud-bottom { left: 76px; right: 316px; width: auto; }
  /* 頂欄橫跨全闊：Deck 由 top:84px 先開始，唔會同頂欄重疊，右邊唔使讓位；
     若連右邊都夾走，768px 豎屏只剩 ~358px 會逼爆雙組 HUD（審查 P1） */
  #hud-top { left: 85px; width: auto; }
  /* 浮動包裹原本 right:10px/top:96px 會俾 Deck 遮住，改泊喺舞台右上角 */
  #btn-dock-chest { right: 316px; }

  #today-deck {
    display: block;
    position: absolute; right: 10px; top: 84px; width: 292px; z-index: 25;
  }
  .deck-card {
    background-color: var(--paper-cream); background-image: var(--paper-grain);
    border: 2.5px solid var(--paper-kraft-deep); border-radius: 18px;
    box-shadow: 0 6px 0 rgba(126, 99, 63, 0.55), 0 12px 26px rgba(45, 36, 30, 0.22);
    padding: 16px 16px 14px;
  }
  .deck-card-title { font-size: 13px; font-weight: 900; color: var(--ink-secondary); letter-spacing: 0.06em; }
  .deck-card-big { font-size: 40px; font-weight: 900; color: var(--ink-primary); line-height: 1.15; margin: 2px 0; }
  .deck-card-sub { font-size: 12.5px; color: var(--ink-secondary); margin-bottom: 12px; }
}

/* ---------- 桌面（≥1280px）：舞台封頂 ＋ 置中 ＋ 暮光填邊 ----------
   #game-client 係 position:relative（layout.css），左欄／舞台／Deck 全部以佢為定位原點，
   所以淨係封頂佢嘅闊度＋置中，入面所有嘢會跟住收返入框，唔使逐件改。
   封頂後 viewport 兩側露出嘅 body 以暮光漸變填滿（同 ART-0 遠景天色同一對 token），
   唔再出現成條米色死位；手機／iPad 闊度完全唔受呢段影響。 */
@media screen and (min-width: 1280px) {
  body {
    background: linear-gradient(180deg, var(--stage-sky-deep) 0%, var(--stage-sky-mid) 100%);
    background-attachment: fixed;
  }
  #game-client {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    box-shadow: inset 0 0 0 2px var(--wood-edge), 0 0 60px rgba(0, 0, 0, 0.45);
  }
}

/* ---------- PR-07 Today Spine 卡片 + Resume Banner ---------- */
#today-spine-list { margin-bottom: 12px; }
#today-spine-list:empty { margin-bottom: 0; }
.spine-card {
  display: flex; align-items: center; gap: 12px;
  background-color: var(--paper-cream); background-image: var(--paper-grain);
  border: 2.5px solid var(--paper-kraft-deep); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(126, 99, 63, 0.45);
  padding: 12px 14px; margin-bottom: 10px;
}
.spine-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.spine-card-main strong { font-size: 15px; font-weight: 900; color: var(--ink-primary); }
.spine-card-main small { font-size: 12.5px; color: var(--ink-secondary); line-height: 1.35; }
.spine-go { flex-shrink: 0; min-height: 44px; }
.spine-parent { border-left: 8px solid #8a6d3b; }
.spine-sunday { border: 3px solid #d9a441; box-shadow: 0 4px 0 rgba(176, 132, 44, 0.55), 0 0 14px rgba(217, 164, 65, 0.35); }
.spine-repair { border-left: 8px solid #c0453e; }
.spine-done { justify-content: center; text-align: center; }
.spine-trilogy { flex-direction: column; align-items: stretch; gap: 8px; }
.spine-card-head { font-size: 13px; font-weight: 900; letter-spacing: 0.06em; color: var(--ink-secondary); }
.spine-step {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--paper-white); border: 2px solid var(--paper-kraft-deep); border-radius: 12px;
  padding: 9px 12px; text-align: left; cursor: pointer; font: inherit;
}
.spine-step.is-done { opacity: 0.65; cursor: default; }
.spine-step-tick { font-weight: 900; color: #8a6d3b; font-size: 16px; }
.spine-step-main { display: flex; flex-direction: column; }
.spine-step-main strong { font-size: 14px; font-weight: 900; color: var(--ink-primary); }
.spine-step-main small { font-size: 12px; color: var(--ink-secondary); }
.today-resume {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fdf3d8; border: 2.5px dashed #b0842c; border-radius: 14px;
  padding: 9px 12px; margin-bottom: 10px; font-size: 13.5px; font-weight: 800; color: #6d5216;
}
.today-resume[hidden] { display: none; }

/* ---------- PR-07 星期日挑戰 ---------- */
.sun-note { font-size: 14.5px; line-height: 1.55; color: var(--ink-primary); margin-bottom: 12px; }
.sun-mode {
  display: block; width: 100%; text-align: left; cursor: pointer; font: inherit;
  background: var(--paper-white); border: 2.5px solid var(--paper-kraft-deep); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px;
}
.sun-mode strong { display: block; font-size: 16px; font-weight: 900; color: var(--ink-primary); margin-bottom: 3px; }
.sun-mode small { font-size: 13px; color: var(--ink-secondary); line-height: 1.45; }
.sun-mode.is-off { opacity: 0.6; cursor: default; }
.sun-meta { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; color: var(--ink-secondary); margin-bottom: 8px; }
.sun-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sun-chip { font-size: 12px; font-weight: 900; background: #d9a441; color: #3d2c05; border-radius: 999px; padding: 3px 10px; }
.sun-chip-sub { background: var(--paper-cream); color: var(--ink-secondary); border: 1.5px solid var(--paper-kraft-deep); }
.sun-stem { font-size: 17px; font-weight: 800; line-height: 1.6; color: var(--ink-primary); margin-bottom: 14px; }
.sun-opts { display: flex; flex-direction: column; gap: 9px; }
.sun-opt {
  min-height: 48px; text-align: left; cursor: pointer; font: inherit; font-size: 15.5px; font-weight: 700;
  background: var(--paper-white); border: 2.5px solid var(--paper-kraft-deep); border-radius: 12px; padding: 10px 14px;
  color: var(--ink-primary);
}
.sun-opt.is-correct { background: #dcefe2; border-color: #2e7d4f; }
.sun-opt.is-wrong { background: #fbe7e4; border-color: #c0453e; }
.sun-opt:disabled { cursor: default; opacity: 0.92; }
.sun-feedback { margin-top: 12px; font-size: 14.5px; line-height: 1.6; background: #fdf6e0; border: 2px solid #d9a441; border-radius: 12px; padding: 10px 12px; color: var(--ink-primary); }
.sun-wide { width: 100%; margin-top: 12px; min-height: 48px; }
.sun-done { text-align: center; padding: 8px 0 2px; }
.sun-done-title { font-size: 22px; font-weight: 900; color: var(--ink-primary); margin-bottom: 6px; }
.sun-done-gears { font-size: 19px; font-weight: 900; color: #8a6d3b; }

/* PR-07 審查修復：.btn-warm 嘅 display:inline-flex 會壓過 [hidden]，星期日「下一題」掣未作答前要真隱藏 */
.sun-wide[hidden] { display: none !important; }
/* iPad 甲板（Resume Banner＋最多 3 張 Spine 卡＋鏡像卡）限高可捲，矮橫屏唔截斷 */
@media (min-width: 768px) {
  #today-deck { bottom: 10px; overflow-y: auto; }
}
