/* 運動島：生活順起來 — 共用樣式
   設計對象：50 歲以上長輩、手機直向為主。大字、大按鈕、高對比。 */

:root {
  --sky: #dff1fb;
  --sky-2: #bfe4f6;
  --sea: #1b6a99;        /* 白字對比 6.0:1 */
  --sea-dark: #124d70;
  --grass: #2f6b2a;      /* 白底對比 6.6:1 */
  --grass-light: #e4f3dc;
  --wood: #7a4a1f;       /* 白字對比 7.6:1 */
  --wood-dark: #5a3412;
  --wood-light: #f6ead8;
  --ink: #1f2d36;        /* 主要文字，白底 14:1 */
  --ink-soft: #3d4f5a;   /* 次要文字，白底 8.6:1 */
  --card: #ffffff;
  --warn-bg: #fff1e6;
  --warn-ink: #8a2d00;   /* 對比 7.9:1 */
  --warn-line: #e3874a;
  --pending-bg: #fff6dc;
  --pending-ink: #6b4a00;
  --radius: 22px;
  --shadow: 0 2px 0 rgba(18, 77, 112, .08), 0 8px 20px rgba(18, 77, 112, .14);
  --shadow-press: 0 1px 0 rgba(18, 77, 112, .08), 0 3px 8px rgba(18, 77, 112, .14);
  --gap: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--sky);
  background-image: linear-gradient(180deg, #cfeaf8 0%, var(--sky) 280px, #eef8f1 100%);
  background-attachment: scroll;
  overflow-wrap: anywhere;
}

img, picture, video { display: block; max-width: 100%; }

h1, h2, p, ul, ol, figure { margin: 0; }

a { color: var(--sea-dark); }

:focus-visible {
  outline: 4px solid #f2a900;
  outline-offset: 3px;
}

.page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.noscript {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 22px;
}

/* ---------- 共用：卡片、按鈕 ---------- */
.card, .panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h2 {
  font-size: 28px;
  line-height: 1.3;
  color: var(--wood-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2::before {
  content: "";
  flex: none;
  width: 10px;
  height: 28px;
  border-radius: 5px;
  background: var(--grass);
}
.card p { font-size: 22px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon { font-size: 30px; line-height: 1; }

.btn-home {
  min-height: 80px;
  font-size: 30px;
  color: #fff;
  background: var(--wood);
  border: 3px solid var(--wood-dark);
  box-shadow: 0 5px 0 var(--wood-dark), 0 10px 20px rgba(90, 52, 18, .25);
  margin-bottom: 5px;
}
.btn-home:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--wood-dark); }

.btn-replay {
  color: #fff;
  background: var(--sea);
  border: 3px solid var(--sea-dark);
  box-shadow: 0 5px 0 var(--sea-dark), 0 10px 20px rgba(18, 77, 112, .22);
  margin-bottom: 5px;
}
.btn-replay:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--sea-dark); }

.bottom-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 8px;
}
.link-level {
  align-self: center;
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 8px 20px;
  font-size: 22px;
  font-weight: 700;
  color: var(--sea-dark);
  text-underline-offset: 5px;
}

/* ---------- 首頁 ---------- */
.home-header { display: flex; justify-content: center; }
.title-wrap { width: 100%; }
.title-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.char-panel { display: flex; flex-direction: column; gap: 16px; }
.hint {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

.char-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.char-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: #f7fbfd;
  border: 4px solid #c9dde8;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* 角色身體下緣是平切：圖片貼齊這個區塊底部 */
.char-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: clamp(140px, 42vw, 210px);
  padding: 10px 6px 0;
  background: linear-gradient(180deg, #d7eefa 0%, #bfe4f6 100%);
}
.char-stage picture { height: 100%; display: flex; align-items: flex-end; }
.char-img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center bottom;
}
.char-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px;
  font-size: 26px;
  font-weight: 700;
  background: #fff;
}
.char-check {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--grass);
  color: #fff;
  font-size: 18px;
  line-height: 32px;
  text-align: center;
}
.char-card[aria-pressed="true"] {
  border-color: var(--grass);
  box-shadow: 0 0 0 4px #9fd38f, var(--shadow);
}
.char-card[aria-pressed="true"] .char-name { background: var(--grass-light); color: #1e4a1a; }
.char-card[aria-pressed="true"] .char-check { display: inline-block; }
.char-card[aria-pressed="false"] .char-stage { filter: saturate(.75); }

/* 對話泡泡 */
.speech {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.avatar {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, #d7eefa, #bfe4f6);
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.avatar picture { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.avatar-img { width: 92%; height: auto; object-fit: contain; object-position: center bottom; }
.speech-body { flex: 1; min-width: 0; }
.speaker {
  font-size: 20px;
  font-weight: 700;
  color: var(--sea-dark);
  margin: 0 0 4px 8px;
}
.bubble {
  position: relative;
  background: #fff;
  border: 3px solid var(--sky-2);
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  box-shadow: var(--shadow);
}
.speech:not(.speech-home) .bubble::before {
  content: "";
  position: absolute;
  left: -13px;
  bottom: 18px;
  border-width: 9px 13px 9px 0;
  border-style: solid;
  border-color: transparent var(--sky-2) transparent transparent;
}
.speech:not(.speech-home) .bubble::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 20px;
  border-width: 7px 10px 7px 0;
  border-style: solid;
  border-color: transparent #fff transparent transparent;
}
.speech-home .bubble { text-align: center; box-shadow: none; background: var(--wood-light); border-color: #e2c9a4; }
.speech-home .bubble::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 12px 14px;
  border-style: solid;
  border-color: transparent transparent #e2c9a4;
}
.speech-home .speaker { display: none; }

/* 島嶼卡片 */
.island-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.island-card {
  display: block;
  text-decoration: none;
  color: var(--wood-dark);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  -webkit-tap-highlight-color: transparent;
}
.island-card:active { transform: translateY(2px); box-shadow: var(--shadow-press); }
.island-art { display: block; aspect-ratio: 470 / 262; background: #7cc6ea; }
.island-art picture, .island-img { width: 100%; height: 100%; }
.island-img { object-fit: cover; }
.island-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  flex-wrap: wrap;
  min-height: 72px;
  padding: 10px 16px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .04em;
  background: linear-gradient(180deg, #fbf3e6, var(--wood-light));
  border-top: 3px solid #e2c9a4;
}
.island-card-safety { color: #1e4a1a; }
.island-card-safety .island-label {
  background: linear-gradient(180deg, #f2faee, var(--grass-light));
  border-top-color: #b9dcaa;
}
.island-sub { font-size: 26px; font-weight: 700; }
.safety-entry { margin-top: 4px; }

/* ---------- 等級頁 ---------- */
.page-header { text-align: center; padding-top: 6px; }
.level-title {
  display: inline-block;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--wood-dark);
  background: linear-gradient(180deg, #fbf3e6, var(--wood-light));
  border: 3px solid #e2c9a4;
  border-radius: 18px;
  padding: 8px 28px;
  box-shadow: var(--shadow);
}
.level-note {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-soft);
}

.ex-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ex-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  -webkit-tap-highlight-color: transparent;
}
.ex-card:active { transform: translateY(2px); box-shadow: var(--shadow-press); }
.ex-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: linear-gradient(180deg, #bfe4f6, #8fcbe8);
}
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-thumb.is-missing::after {
  content: "影片準備中";
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--sea-dark);
}
.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--sea);
  font-size: 32px;
  line-height: 72px;
  text-align: center;
  padding-left: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}
.ex-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px 18px;
}
.ex-num { font-size: 20px; color: var(--ink-soft); font-weight: 700; }
.ex-title { font-size: 28px; font-weight: 800; line-height: 1.35; color: var(--wood-dark); }

.tag-pending {
  align-self: flex-start;
  display: inline-block;
  margin-top: 4px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--pending-bg);
  color: var(--pending-ink);
  border: 2px dashed #e0c36b;
  font-size: 20px;
  font-weight: 700;
}

/* ---------- 單一運動頁 ---------- */
.crumb {
  display: inline-block;
  font-size: 20px;
  font-weight: 700;
  color: var(--wood-dark);
  background: var(--wood-light);
  border-radius: 999px;
  padding: 2px 16px;
  margin-bottom: 8px;
}
.ex-heading {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--wood-dark);
}

.video-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0d2a3b;
  box-shadow: var(--shadow);
}
.ex-video {
  width: 100%;
  height: auto;
  max-height: 75vh;
  background: #0d2a3b;
}
.video-wrap.is-missing .ex-video { aspect-ratio: 16 / 9; }
.video-msg {
  position: absolute;
  left: 12px; right: 12px; top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 56px;
  min-height: 42px;
  font-size: 22px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sea);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  line-height: 42px;
  text-align: center;
}
.card-dose { background: #f2f9fd; }
.card-dose h2::before { background: var(--sea); }
.card-dose p { font-weight: 700; }
.card-benefit { background: #f5fbf2; }
.card-pending { background: #fffcf2; }
.pending-note { color: var(--ink-soft); }

.reminder {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  border: 3px solid var(--warn-line);
  color: var(--warn-ink);
}
.reminder p { font-size: 22px; font-weight: 700; }
.reminder-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--warn-ink);
  color: #fff;
  font-weight: 800;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
}

/* ---------- 安全島 ---------- */
.safety-figure {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
}
.safety-figure a { display: block; border-radius: 14px; overflow: hidden; }
.safety-img { width: 100%; height: auto; }
.safety-figure figcaption {
  text-align: center;
  font-size: 20px;
  color: var(--ink-soft);
  padding: 8px 0 2px;
}
.safety-list {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.safety-list li {
  position: relative;
  padding-left: 36px;
  font-size: 22px;
}
.safety-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--grass);
}

/* ---------- 頁尾 ---------- */
.site-footer {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 20px;
}
.footer-logo {
  width: 200px;
  max-width: 70%;
  height: auto;
  margin: 0 auto 8px;
}

/* ---------- 尊重減少動態 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  .btn:active, .island-card:active, .ex-card:active { transform: none; }
}

@media (min-width: 600px) {
  .page { padding-top: 24px; }
}

/* 流量提醒（首頁與運動頁） */
.data-notice {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 3px solid var(--sea);
  border-radius: var(--radius); padding: 16px 18px; margin: 0 0 var(--gap);
  box-shadow: var(--shadow);
}
.data-notice p { font-size: 20px; font-weight: 700; color: var(--sea-dark); line-height: 1.5; }
.data-notice-icon { font-size: 28px; line-height: 1.2; }
.data-note { font-size: 20px; color: var(--ink-soft); text-align: center; margin: 0 0 10px; }
