/* 大樹神獸 App — 版面。顏色、字體、元件都用 design-system 的 token 與 class。 */

html, body { height: 100%; margin: 0; }
body { background: var(--surface-sunken); }

/* 手機寬度滿版；桌機置中成手機寬，方便 Demo 錄影 */
.app {
  position: relative; height: 100%; height: 100dvh; max-width: 480px; margin: 0 auto;
  overflow: hidden; background: var(--surface-sunken);
}
@media (min-width: 481px) { .app { border-left: var(--stroke-ui) solid var(--outline); border-right: var(--stroke-ui) solid var(--outline); } }

/* 地圖：OpenFreeMap Positron 底圖，再微調成宣紙米色 */
/* z-index: 0 讓地圖自成一層，Leaflet 控制項（z-index 1000）才不會蓋到樹木頁 */
.map { position: absolute; inset: 0; z-index: 0; background: var(--surface-sunken); }
.map .leaflet-gl-layer { filter: sepia(0.15) saturate(0.9); }
.leaflet-container { font-family: var(--font-sans); }
.leaflet-control-attribution { font-size: 10px; background: rgba(252, 250, 245, 0.85) !important; }
.leaflet-bottom.leaflet-right { bottom: var(--bottom-h, 180px); }

/* 拉遠時神獸縮小一點（以柱底為軸），幾隻神獸靠很近時比較不會互相蓋住 */
.map.is-far .dsh-marker--beast:not(.is-selected) .dsh-marker__shape { transform: scale(0.8); }

/* 拉遠時一般樹縮成柱底位置的小圓點，避免標記疊成一團 */
.map.is-far .dsh-marker:not(.dsh-marker--beast):not(.is-selected) > * { display: none; }
.map.is-far .dsh-marker:not(.dsh-marker--beast):not(.is-selected)::after {
  content: ""; position: absolute; left: 50%; top: var(--marker-anchor-y); transform: translate(-50%, -50%);
  width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%;
  background: var(--marker-fill); border: var(--stroke-fine) solid var(--outline);
}

/* 搜尋列與篩選 */
.topbar {
  position: absolute; z-index: 500; left: var(--space-4); right: var(--space-4);
  top: calc(var(--space-4) + env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
.search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 var(--space-4);
  background: var(--surface-raised); border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-pill);
  box-sizing: border-box;
}
.search input { flex: 1; min-width: 0; border: none; background: transparent; font: inherit; font-size: 16px; color: var(--text); outline: none; }
.search:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.filters { display: flex; gap: var(--space-2); overflow-x: auto; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
  border: var(--stroke-fine) solid var(--outline); background: var(--surface-raised); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--brand); color: var(--ink-50); }
.chip:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
/* 樹種類別選單：按鈕和 chip 同一套，選了某一類就跟按下的 chip 一樣填深綠 */
.cat-select {
  flex: none; display: inline-flex; align-items: center; gap: var(--space-2);
  height: 36px; padding: 0 12px 0 14px; border-radius: var(--radius-pill);
  border: var(--stroke-fine) solid var(--outline); background: var(--surface-raised); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.cat-select::after {
  content: ""; width: 12px; height: 8px; background: currentColor;
  -webkit-mask: var(--chevron) center / contain no-repeat; mask: var(--chevron) center / contain no-repeat;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 L6 6 L10.5 1.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: transform 120ms ease;
}
.cat-select[aria-expanded="true"]::after { transform: rotate(180deg); }
.cat-select.is-active { background: var(--brand); color: var(--ink-50); }
.cat-select:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* 打開的清單：平面、墨線框，不用陰影（設計系統「墨線、形狀、陰影」） */
.cat-menu {
  position: absolute; z-index: 10; width: min(100%, 300px); box-sizing: border-box;
  margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-raised); border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-md);
}
.cat-menu[hidden] { display: none; }
/* 選單打開時整條搜尋列浮到底部樹卡上面（樹木頁 800 還是蓋得過它） */
.topbar:has(.cat-menu:not([hidden])) { z-index: 700; }
.cat-menu:focus { outline: none; }
.cat-menu__item {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto 16px; align-items: center; gap: var(--space-2);
  min-height: var(--target-min); padding: 0 var(--space-3); cursor: pointer;
}
.cat-menu__item + .cat-menu__item { border-top: var(--stroke-fine) solid var(--ink-200); }
.cat-menu__emoji { font-size: 18px; line-height: 1; text-align: center; }
.cat-menu__name { font-size: 15px; font-weight: 700; }
.cat-menu__count { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cat-menu__item.is-active-desc { background: var(--surface-sunken); }
.cat-menu__item[aria-selected="true"] { background: var(--green-50); color: var(--brand-text); }
.cat-menu__item[aria-selected="true"].is-active-desc { background: var(--green-100); }
.cat-menu__item[aria-selected="true"] .cat-menu__check::before { content: "✓"; font-weight: 900; }
@media (prefers-reduced-motion: reduce) { .cat-select::after { transition: none; } }

/* 回到我的位置 */
.locate {
  position: absolute; z-index: 500; right: var(--space-4); bottom: calc(var(--bottom-h, 180px) + var(--space-3));
  width: var(--target-min); height: var(--target-min); border-radius: 50%;
  background: var(--surface-raised); border: var(--stroke-ui) solid var(--outline);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.locate:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.locate-hint {
  position: absolute; z-index: 500; right: calc(var(--space-4) + var(--target-min) + var(--space-2)); bottom: calc(var(--bottom-h, 180px) + var(--space-3));
  box-sizing: border-box; max-width: min(280px, calc(100vw - var(--space-4) * 2 - var(--target-min) - var(--space-2))); margin: 0; padding: 10px 12px;
  background: var(--surface-raised); border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-md);
  font-size: 14px; line-height: 20px; cursor: pointer;
}
.locate-hint[hidden] { display: none; }
.locate-hint a { font-weight: 700; color: inherit; }

/* 你的位置 */
.me-dot { width: 22px; height: 22px; box-sizing: border-box; border-radius: 50%; background: var(--state-keep); border: 4px solid var(--ink-50); box-shadow: 0 0 0 3px var(--outline); }

/* 底部：樹卡＋導覽列 */
.bottom { position: absolute; z-index: 600; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; }
.tree-card {
  margin: 0 var(--space-3) 10px; padding: 14px; background: var(--surface-raised);
  border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-md);
  display: flex; gap: var(--space-3); align-items: center;
}
.tree-card[hidden] { display: none; }
.tree-card__art { width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--honor); border: var(--stroke-ui) solid var(--outline); box-sizing: border-box; overflow: hidden; }
.tree-card__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tree-card__art--tree { background: var(--green-100); display: flex; align-items: center; justify-content: center; }
.tree-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.tree-card__head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.tree-card__name { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 22px; line-height: 28px; }
.tree-card__meta { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-muted); }
.tree-card__count { margin: 0; font-size: 14px; line-height: 20px; font-weight: 700; }
.tree-card__count b { color: var(--brand-text); font-variant-numeric: tabular-nums; }
.tree-card__go {
  width: 44px; height: 44px; flex: none; border-radius: var(--radius-sm); border: var(--stroke-ui) solid var(--outline);
  background: var(--surface-raised); display: flex; align-items: center; justify-content: center; box-sizing: border-box;
}
.tree-card__go:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* 樹木頁／神獸頁：蓋在地圖上面，上方標題列、中間捲動、下方固定行動區 */
.tree-page {
  position: absolute; inset: 0; z-index: 800; display: flex; flex-direction: column;
  background: var(--surface);
}
.tree-page[hidden] { display: none; }
/* 圖鑑、通知、我的、我參加的活動（js/map.js 的 WITH_NAV）：手機版底部導覽列浮到畫面上面，畫面底部讓出導覽列的高度。
   樹卡藏起來後 --bottom-h 只剩導覽列的高度。電腦版用頂部導覽，不套用 */
@media not all and (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .app.has-nav .bottom { z-index: 850; }
  .app.has-nav .tree-card { display: none; }
  .app.has-nav .tree-page { bottom: var(--bottom-h, 0px); }
}
.tp-bar {
  flex: none; display: flex; align-items: center; gap: var(--space-2);
  padding: calc(var(--space-2) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-2);
  background: var(--surface-raised); border-bottom: var(--stroke-ui) solid var(--outline);
}
.tp-back {
  width: var(--target-min); height: var(--target-min); margin-left: calc(var(--space-2) * -1);
  display: flex; align-items: center; justify-content: center; color: var(--text); border-radius: var(--radius-sm);
}
.tp-back:focus-visible, .tp-link:focus-visible, .tp-choice:focus-visible, .tp-notice:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.tp-bar__title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 20px; line-height: 28px; letter-spacing: 0.1em; }

.tp-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4);
}
.tp-notice { flex: none; color: var(--text); text-decoration: none; }

/* 神獸卡放大成頁首 */
.tp-hero { width: auto; flex: none; }
.tp-hero .dsh-beast__art { height: 264px; }
.tp-hero .dsh-beast__art img { width: auto; height: 244px; }
.tp-hero.dsh-beast--rare .dsh-beast__art::before { width: 208px; height: 208px; top: 20px; }
.tp-hero--tree .dsh-beast__art { height: 168px; align-items: center; }
.tp-hero--tree .dsh-beast__art img { width: 96px; height: 96px; margin-bottom: var(--space-4); }
.tp-quote { margin: 0; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--brand-text); text-align: center; }

.tp-status { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; line-height: 20px; }
.tp-status .dsh-tag { flex: none; }

.tp-box {
  flex: none; padding: var(--space-4); background: var(--surface-raised);
  border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-md);
}
.dsh-lanterns, .dsh-official { flex: none; }
.tp-h { margin: 0 0 var(--space-2); font-family: var(--font-display); font-weight: 900; font-size: 20px; line-height: 28px; }
.tp-p { margin: 0 0 var(--space-2); font-size: 16px; line-height: 26px; }
.tp-h__count { font-family: var(--font-sans); font-size: 14px; font-weight: 700; color: var(--text-muted); }
.tp-muted { color: var(--text-muted); }
.tp-small { margin: var(--space-2) 0 0; font-size: 13px; line-height: 20px; color: var(--text-muted); }
/* 相機權限小提示（shared.js 的 camTipHtml），只在加到主畫面的 PWA 裡出現 */
.tp-camtip { flex: none; display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: 13px; line-height: 20px; color: var(--text-muted); }
.tp-camtip span { flex: 1; }
.tp-camtip__ok {
  flex: none; min-height: 32px; padding: 0 var(--space-2); font: inherit; font-weight: 700; color: var(--brand-text);
  background: none; border: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.tp-camtip__ok:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.tp-fact { margin: var(--space-3) 0 0; padding: var(--space-3); background: var(--green-50); border: var(--stroke-fine) solid var(--outline); border-radius: var(--radius-sm); font-size: 15px; line-height: 24px; }
.tp-fact b { display: block; color: var(--brand-text); }

.tp-reports { list-style: none; margin: 0; padding: 0; }
.tp-report { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
.tp-report:first-child { border-top: none; padding-top: 0; }
.tp-report__head { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 14px; line-height: 20px; margin-bottom: var(--space-1); }
.tp-report__head time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tp-report .tp-p { margin: 0; }
.tp-report__photo { display: block; width: 96px; height: 128px; object-fit: cover; margin: var(--space-1) 0 var(--space-2); border: var(--stroke-fine) solid var(--outline); border-radius: var(--radius-sm); }
.tp-report__seen { margin: var(--space-1) 0 0; font-size: 14px; line-height: 20px; font-weight: 700; color: var(--state-watch-text); }

.tp-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-2) var(--space-4); margin: 0; }
.tp-facts dt { font-size: 14px; line-height: 22px; font-weight: 700; color: var(--text-muted); }
.tp-facts dd { margin: 0; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }

/* 底部行動區：「守護祂」或「回報樹況」 */
.tp-actions {
  flex: none; display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--surface-raised); border-top: var(--stroke-ui) solid var(--outline);
}
.tp-actions a.dsh-btn { text-decoration: none; box-sizing: border-box; }
.tp-actions__hint { margin: 0; font-size: 14px; line-height: 20px; color: var(--text-muted); text-align: center; }
.tp-link { padding: 0 2px; border: none; background: none; font: inherit; font-weight: 700; color: var(--brand-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* 選擇在地守護或遠端關注 */
.tp-sheet { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; background: rgba(38, 35, 31, 0.45); }
.tp-sheet[hidden] { display: none; }
.tp-sheet__panel {
  width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: var(--stroke-bold) solid var(--outline); border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.tp-choice {
  display: flex; flex-direction: column; gap: var(--space-1); text-align: left; cursor: pointer;
  padding: var(--space-3) var(--space-4); background: var(--surface-raised); color: var(--text);
  border: var(--stroke-ui) solid var(--outline); border-radius: var(--radius-sm); font-family: inherit;
}
.tp-choice:active { background: var(--surface-sunken); }
.tp-choice b { font-size: 18px; line-height: 26px; font-weight: 900; }
.tp-choice span { font-size: 14px; line-height: 20px; color: var(--text-muted); }

/* 燈海：燈籠造型（只改 App，design-system 的 dsh-lantern 方塊燈不動），固定 3 排 × 10 盞 */
.tp-defs { position: absolute; }
.tp-lanterns .dsh-lanterns__grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); justify-items: center; gap: var(--space-2) 0; }
.tp-lantern { width: 20px; height: 30px; display: block; --lantern-body: var(--honor); --lantern-tassel: var(--action); }
.tp-lantern--off { --lantern-body: var(--green-700); --lantern-tassel: var(--green-400); }
.tp-lanterns__goals { align-self: flex-start; font-size: 14px; line-height: 20px; font-weight: 700; color: var(--green-100); text-underline-offset: 3px; }
.tp-lanterns__goals:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* 剛守護：新的一盞燈亮起、人數跳一下 */
@keyframes tp-light { 0% { opacity: 0.3; transform: scale(0.6); } 60% { opacity: 1; transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes tp-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.25); } }
.tp-lantern.is-new { transform-origin: 50% 0; animation: tp-light 700ms ease-out 150ms both; }
.dsh-lanterns__num.is-bump { display: inline-block; animation: tp-bump 500ms ease-out 300ms; }
@media (prefers-reduced-motion: reduce) { .tp-lantern.is-new, .dsh-lanterns__num.is-bump { animation: none; } }

/* 附近的樹清單只在電腦版左欄出現 */
.nearby, .nearby-title, .tree-card__go-label { display: none; }

/* 樹木頁的兩欄外框：手機版攤平成一欄，公示通知條排最上面 */
.tp-cols, .tp-aside, .tp-main { display: contents; }
.tp-notice { order: -1; }

/* ── 平板與寬視窗（768px 以上）：沿用手機版，內容置中最寬 720px ── */
@media (min-width: 768px) {
  .app { max-width: none; border-left: none; border-right: none; }
  .topbar { left: max(var(--space-4), (100% - 720px) / 2); right: max(var(--space-4), (100% - 720px) / 2); }
  .tree-card { margin-inline: max(var(--space-3), (100% - 720px) / 2); }
  .tree-page { --page-max: 720px; }
  .tree-page .tp-bar, .tree-page .tp-scroll, .tree-page .tp-actions { padding-inline: max(var(--space-4), (100% - var(--page-max)) / 2); }
  .tp-sheet__panel { max-width: 720px; margin-inline: auto; }
}

/* ── 電腦版（1024px 以上、滑鼠操作）：頂部導覽＋左欄｜地圖｜右側面板，見 design-system/desktop.css ── */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  body { display: flex; flex-direction: column; }
  .dsh-topnav { flex: none; }
  .app {
    flex: 1; min-height: 0; height: auto; width: 100%; margin: 0;
    display: grid; grid-template-columns: var(--desk-rail) minmax(0, 1fr) var(--desk-panel); grid-template-rows: minmax(0, 1fr);
  }

  /* 左欄：搜尋、篩選、附近的樹 */
  .topbar {
    position: static; grid-column: 1; grid-row: 1; min-height: 0; overflow-y: auto;
    gap: var(--space-4); padding: var(--space-6); box-sizing: border-box;
    background: var(--surface); border-right: var(--stroke-ui) solid var(--outline);
  }
  .topbar > * { flex: none; }
  .filters { flex-wrap: wrap; overflow: visible; }
  .chip { height: 40px; padding: 0 var(--space-4); font-size: 15px; }
  .cat-select { height: 40px; padding-left: var(--space-4); font-size: 15px; }
  .topbar { position: relative; }
  .cat-menu { width: calc(100% - 2 * var(--space-6)); }
  .nearby-title { display: block; margin: var(--space-2) 0 0; font-family: var(--font-display); font-weight: 900; font-size: 20px; line-height: 28px; }
  .nearby { display: flex; }
  .dsh-treelist__item:hover { background: var(--surface-sunken); }
  .dsh-treelist__item:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }

  /* 中間：地圖。定位鈕放在地圖右下角（右側面板的左邊） */
  .map { position: relative; inset: auto; grid-column: 2; grid-row: 1; }
  .locate { right: calc(var(--desk-panel) + var(--space-6)); bottom: var(--space-6); }
  .locate-hint { right: calc(var(--desk-panel) + var(--space-6) + var(--target-min) + var(--space-2)); bottom: var(--space-6); }
  .leaflet-bottom.leaflet-right { bottom: 0; }

  /* 右側面板：點選的樹（手機版的底部卡片），地圖不會被蓋住 */
  .bottom {
    position: static; grid-column: 3; grid-row: 1; min-height: 0; overflow-y: auto;
    padding: var(--space-6); box-sizing: border-box;
    background: var(--surface-raised); border-left: var(--stroke-ui) solid var(--outline);
  }
  .tree-card { margin: 0; padding: var(--space-6); flex-direction: column; align-items: stretch; gap: var(--space-4); text-align: center; background: var(--surface); }
  .tree-card__art { width: 120px; height: 120px; align-self: center; }
  .tree-card__head { justify-content: center; }
  .tree-card__name { font-size: 28px; line-height: 36px; }
  .tree-card__go {
    width: 100%; height: var(--target-min); gap: var(--space-2);
    color: var(--text); font-size: 18px; font-weight: 900; text-decoration: none;
    box-shadow: inset 0 0 0 3px var(--surface-raised), inset 0 0 0 4px var(--outline);
  }
  .tree-card__go:hover { background: var(--surface-sunken); }
  .tree-card__go-label { display: inline; }

  /* 樹木頁：左欄神獸與燈海、右欄公告故事回報，內容最寬 --content-max */
  .tree-page[data-page="tree"] { --page-max: var(--content-max); }
  .tree-page .tp-scroll { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .tp-cols, .tp-aside, .tp-main { display: flex; }
  .tp-cols { flex: none; }

  /* 守護方式：置中的對話框，兩個選項並排 */
  .tp-sheet { align-items: center; justify-content: center; }
  .tp-sheet__panel {
    width: 640px; max-width: calc(100% - var(--space-12)); margin: 0;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4);
    padding: var(--space-6) var(--space-8) var(--space-8);
    border: var(--stroke-bold) solid var(--outline); border-radius: var(--radius-md);
  }
  .tp-sheet__panel > :not(.tp-choice) { grid-column: 1 / -1; }
  .tp-sheet__panel .tp-h { font-size: 28px; line-height: 36px; }
  .tp-choice { padding: var(--space-4); }
  .tp-choice b { font-family: var(--font-display); font-size: 22px; line-height: 28px; }
  .tp-choice:hover { background: var(--green-50); }
}

/* 載入中：蓋住整個 App，樹資料和底圖都好了才淡出（js/map.js 的 loadingStep） */
.loading {
  position: absolute; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-4); padding: var(--space-6); box-sizing: border-box; text-align: center;
  background: var(--surface); color: var(--text); font-family: var(--font-sans);
  transition: opacity 0.3s ease;
}
.loading.is-done { opacity: 0; pointer-events: none; }
.loading__beast { width: 112px; height: 112px; animation: loading-bob 1.6s ease-in-out infinite; }
@keyframes loading-bob { 50% { transform: translateY(-10px); } }
.loading__title { margin: 0; font-family: var(--font-display); font-size: 24px; line-height: 32px; font-weight: 900; letter-spacing: 0.08em; }
.loading__steps { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-2); font-size: 16px; line-height: 24px; font-weight: 500; text-align: left; }
.loading__steps li { display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); }
/* 還在讀：空心轉圈；讀完：綠色打勾 */
.loading__steps li::before {
  content: ""; flex: none; width: 18px; height: 18px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand); animation: loading-spin 0.9s linear infinite;
}
.loading__steps li.is-done { color: var(--text); }
.loading__steps li.is-done::before {
  content: "✓"; display: grid; place-items: center; border: 0; animation: none;
  background: var(--brand); color: var(--on-action); font-size: 12px; font-weight: 900;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
.loading__retry[hidden] { display: none; }
.loading__hint { margin: 0; max-width: 300px; font-size: 14px; line-height: 20px; color: var(--text-muted); }
.loading.is-error .loading__beast { animation: none; filter: grayscale(0.6); }
.loading.is-error .loading__steps { display: none; }
@media (prefers-reduced-motion: reduce) {
  .loading { transition: none; }
  .loading__beast, .loading__steps li::before { animation: none; }
}
