/* 休息頁＋四種休息活動（views/rest.js、views/rest-activity.js）。獨立樣式檔，避免擴大其他頁面的樣式變更。 */

/* 本人 11-19「休息頁不要上下滑動」「點動作進去也不要上下滑動 圖縮小」「上方休息計時框大小不要動到 維持一致」：
   整頁排成一欄、高度＝#view 看得見的那一塊。計時卡永遠是原本的大小（選單／活動兩種狀態一樣），
   剩下的高度給休息活動，放不下時縮的是動作圖；連動作圖最小都放不下（很矮的螢幕）才會捲動，當最後的退路。 */
.rest-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rest-page > * { flex: none; }
.rest-page > .rest-activities { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; }

/* 四格：沒有外框（本人 11-19「四個框外面不要框」）。 */
.rest-activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rest-activity-choice { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 72px; padding: 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--ink); text-align: left; font-size: 14px; }
.rest-activity-choice > span { overflow-wrap: anywhere; }
.rest-activity-choice:active { border-color: var(--accent); }
.rest-activity-choice:focus-visible, .rest-arrow:focus-visible, .rest-back:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rest-activity-thumbnail { flex: none; width: 46px; height: 46px; object-fit: contain; }

/* 小黑人都去背（本人 11-19）：圖本身是透明底的黑色火柴人，不再墊白紙。
   深色主題把人反白，透明的地方照樣透明 ⇒ 不會出現刺眼的白塊。 */
:root[data-theme='dark'] .rest-figure { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .rest-figure { filter: invert(1); }
}

/* 打開的活動：上一列名稱＋步驟、右上角返回選單；中間 ‹ 圖 ›；下面動作、一列說明、做多久。 */
.rest-activity-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rest-activity-name { display: flex; align-items: baseline; gap: 10px; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.rest-slide-count { margin: 0; font-size: 12px; font-weight: 400; }
.rest-back { flex: none; min-height: 28px; }
/* 圖那一列吃剩下的高度（最少 72px、最多 160px＝跟貓圖一樣大，本人 11-19「圖縮小」），
   ‹ › 貼在圖的兩側（本人 11-19「左右滑動放圖案兩側」）。 */
.rest-figure-row { flex: 1 1 0; display: flex; align-items: stretch; min-height: 48px; max-height: 160px; margin: 4px 0 6px; }
.rest-slides { flex: 1; min-width: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.rest-slides::-webkit-scrollbar { display: none; }
.rest-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: center; scroll-snap-stop: always; }
.rest-illustration { display: block; width: 100%; height: 100%; object-fit: contain; }
.rest-mirror { transform: scaleX(-1); }
.rest-arrow { flex: none; align-self: center; min-width: 44px; min-height: 44px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--muted); }
.rest-arrow:disabled { opacity: 0.25; cursor: default; }
/* 動作＋做多久同一列，放不下時做多久換到下一列。 */
.rest-title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 10px; }
.rest-instruction { margin: 0; text-align: center; font-size: 17px; line-height: 1.4; font-weight: 600; }
.rest-step-hint { margin: 0; font-size: 12px; line-height: 1.5; }
.rest-step-hint:empty { display: none; }
/* 說明維持一列（本人 11-19「副標文字維持一列」）：放不下由 JS 縮字（最小 10px），再不行才刪節號。 */
.rest-instruction-note { margin-top: 2px; text-align: center; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 打坐（本人 11-19）：呼吸圓圈框住小黑人、跟著吸吐變大變小，圖的右邊寫「↪吸氣」「吐氣↪」。
   圓圈的直徑＝圖那一列的高度（正方形）；字用絕對定位貼在圓圈右邊，不佔位置，圖才會在正中間。 */
.rest-breath-slide { display: flex; align-items: stretch; justify-content: center; }
.rest-breath-frame { position: relative; flex: none; height: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.rest-breath-circle { position: absolute; inset: 0; border: 2px solid var(--accent); border-radius: 50%; background: var(--soft); transition: transform 250ms linear; }
/* 圓圈縮到最小（0.76）時也要框得住圖 ⇒ 圖只佔圓的七成。 */
.rest-illustration.rest-breath-figure { position: relative; width: 70%; height: 70%; }
.rest-breath-label { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 10px; font-size: 15px; white-space: nowrap; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .rest-breath-circle { transition: none; } }
@media (min-width: 768px) {
  .rest-activity-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rest-figure-row { max-height: 200px; }
}
