/* 在家練 — Morandi sage palette, editorial layout */
:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --ink: #2e3230;
  --ink-soft: #5d635f;
  --line: #e3ded6;
  --sage: #7d8c7c;
  --sage-deep: #55654f;
  --sand: #cbb99a;
  --clay: #b98b74;
  --rose: #b07a7a;
  --lv1: #7d8c7c;
  --lv2: #8fa08a;
  --lv3: #b98b74;
  --lv4: #a96e6e;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(46, 50, 48, 0.08);
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.75; }

.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 290px; flex-shrink: 0; background: var(--sage-deep); color: #f0efe9;
  padding: 2rem 1.4rem; display: flex; flex-direction: column; gap: 1.6rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
/* 手機專用：選單開啟時浮動鈕被側欄蓋住，需要自己的關閉鈕 */
.sidebar-close { display: none; }
.back-home {
  display: inline-block; font-size: 0.75rem; color: rgba(240, 239, 233, 0.72);
  text-decoration: none; margin-bottom: 0.9rem; letter-spacing: 0.04em;
  border-bottom: 1px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.back-home:hover { color: #f0efe9; border-bottom-color: rgba(240, 239, 233, 0.5); }
.brand h1 { font-family: var(--serif); font-size: 2rem; letter-spacing: 0.35em; }
.brand-sub { font-size: 0.8rem; opacity: 0.75; margin-top: 0.5rem; line-height: 1.6; }

.nav-track { margin-bottom: 1.2rem; }
.nav-track-name {
  font-size: 0.75rem; letter-spacing: 0.18em; opacity: 0.65;
  border-bottom: 1px solid rgba(240, 239, 233, 0.25);
  padding-bottom: 0.4rem; margin-bottom: 0.6rem; cursor: pointer;
}
.nav-unit {
  display: flex; align-items: center; gap: 0.55rem; width: 100%;
  background: none; border: none; color: inherit; font-family: inherit;
  font-size: 0.86rem; text-align: left; padding: 0.45rem 0.5rem;
  border-radius: 8px; cursor: pointer; line-height: 1.4;
}
.nav-unit:hover { background: rgba(240, 239, 233, 0.12); }
.nav-unit.active { background: rgba(240, 239, 233, 0.2); }
.nav-lv {
  flex-shrink: 0; font-size: 0.68rem; font-weight: 700; padding: 0.1rem 0.42rem;
  border-radius: 6px; background: rgba(240, 239, 233, 0.18); letter-spacing: 0.05em;
}
.nav-done { margin-left: auto; font-size: 0.7rem; opacity: 0.7; flex-shrink: 0; }

.side-foot { margin-top: auto; font-size: 0.72rem; opacity: 0.65; line-height: 1.7; }
.side-foot .curator { margin-top: 0.5rem; letter-spacing: 0.08em; }
.side-foot a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.menu-btn { display: none; }
.sidebar-backdrop { display: none; }

/* ── Main / Home ── */
.main { flex: 1; min-width: 0; }
.hidden { display: none !important; }

.home { max-width: 880px; margin: 0 auto; padding: 3.5rem 2rem 4rem; }
.hero-kicker { font-size: 0.72rem; letter-spacing: 0.35em; color: var(--clay); margin-bottom: 0.8rem; }
.hero h2 { font-family: var(--serif); font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.35; margin-bottom: 1.1rem; }
.hero-lead { color: var(--ink-soft); max-width: 40em; }
.hero-lead strong { color: var(--sage-deep); }

/* 策展人簡介：低調的信任來源，不做成廣告 */
.curator-note {
  margin-top: 1.8rem; padding: 1.1rem 1.3rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--sand); border-radius: var(--radius);
  max-width: 44em;
}
.curator-label {
  font-size: 0.7rem; letter-spacing: 0.2em; color: var(--clay);
  margin-bottom: 0.5rem;
}
.curator-body { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.8; }
.curator-body + .curator-body { margin-top: 0.5rem; }
.curator-body a { color: var(--sage-deep); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--sand); }
.curator-body a:hover { border-bottom-color: var(--sage-deep); }
.curator-link {
  display: inline-block; margin-top: 0.9rem; font-size: 0.84rem; font-weight: 600;
  color: var(--sage-deep); text-decoration: none;
  border-bottom: 1px solid var(--sand); padding-bottom: 1px;
  transition: border-color 0.15s, transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.curator-link:hover { border-bottom-color: var(--sage-deep); transform: translateX(2px); }

.how { margin-top: 3rem; }
.how h3, .disclaimer h3 { font-family: var(--serif); font-size: 1.25rem; margin-bottom: 1.1rem; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.how-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.how-num {
  display: inline-flex; width: 1.7rem; height: 1.7rem; align-items: center; justify-content: center;
  background: var(--sage); color: #fff; border-radius: 50%; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.5rem;
}
.how-card h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.how-card p { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.65; }

/* track entry cards */
.tracks-entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; margin-top: 3rem; }
.track-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem 1.5rem; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  border-top: 4px solid var(--sage);
}
.track-card.rehab { border-top-color: var(--clay); }
.track-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(46, 50, 48, 0.13); }
.track-card h3 { font-family: var(--serif); font-size: 1.3rem; }
.track-card .tagline { font-size: 0.85rem; color: var(--ink-soft); margin: 0.35rem 0 0.9rem; }
.track-card .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-size: 0.74rem; padding: 0.3rem 0.7rem; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink-soft);
  font-family: inherit; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--sage); border-color: var(--sage); color: #fff; }
.track-card.rehab .chip:hover { background: var(--clay); border-color: var(--clay); }
.card-hint { font-size: 0.72rem; color: var(--ink-soft); margin-top: 0.8rem; opacity: 0.85; }

/* booking CTA */
.booking-cta {
  margin-top: 2.4rem; background: var(--sage-deep); color: #f0efe9;
  border-radius: var(--radius); padding: 1.5rem 1.7rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap;
}
.booking-text h3 { font-family: var(--serif); font-size: 1.2rem; margin-bottom: 0.4rem; }
.booking-text p { font-size: 0.86rem; opacity: 0.88; max-width: 46em; line-height: 1.7; }
.booking-btn {
  flex-shrink: 0; background: #f0efe9; color: var(--sage-deep); text-decoration: none;
  font-size: 0.92rem; font-weight: 600; padding: 0.65rem 1.7rem; border-radius: 999px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
  white-space: nowrap;
}
.booking-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22); }

/* course design intro */
.design { margin-top: 3rem; }
.design h3 { font-family: var(--serif); font-size: 1.25rem; margin-bottom: 0.8rem; }
.design-lead { font-size: 0.92rem; color: var(--ink-soft); max-width: 42em; margin-bottom: 1.1rem; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem; }
.design-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; border-left: 4px solid var(--sage);
}
.design-card h4 { font-size: 0.95rem; margin-bottom: 0.35rem; color: var(--sage-deep); }
.design-card p { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.7; }
.design-note { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.9rem; }

/* unit evidence */
.unit-evidence {
  margin-top: 2.2rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem 1.5rem;
}
.unit-evidence h4 { font-family: var(--serif); font-size: 1.05rem; color: var(--sage-deep); margin-bottom: 0.4rem; }
.ev-intro { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 0.7rem; }
.unit-evidence ul { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.unit-evidence li { border-left: 3px solid var(--sand); padding-left: 0.9rem; }
.ev-note { display: block; font-size: 0.88rem; font-weight: 600; line-height: 1.55; }
.ev-ref { display: block; font-size: 0.78rem; color: var(--ink-soft); line-height: 1.6; margin-top: 0.15rem; }
.ev-ref a { color: var(--sage-deep); white-space: nowrap; }

.disclaimer {
  margin-top: 3.2rem; background: #f2ede4; border: 1px solid var(--sand);
  border-radius: var(--radius); padding: 1.4rem 1.6rem;
}
.disclaimer p { font-size: 0.85rem; color: var(--ink-soft); }

/* ── Unit view ── */
.unit { max-width: 880px; margin: 0 auto; padding: 3rem 2rem 4rem; }
.unit-back {
  background: none; border: none; color: var(--sage-deep); font-family: inherit;
  font-size: 0.85rem; cursor: pointer; padding: 0; margin-bottom: 1.4rem; letter-spacing: 0.05em;
}
.unit-back:hover { text-decoration: underline; }
.unit-head { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.lv-badge {
  font-size: 0.78rem; font-weight: 700; color: #fff; padding: 0.22rem 0.7rem;
  border-radius: 8px; letter-spacing: 0.08em; background: var(--sage);
}
.lv-badge.lv-L1 { background: var(--lv1); }
.lv-badge.lv-L2 { background: var(--lv2); }
.lv-badge.lv-L3 { background: var(--lv3); }
.lv-badge.lv-L4 { background: var(--lv4); }
.lv-badge.lv-R { background: var(--clay); }
.unit-head h2 { font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2rem); }
.unit-lvname { font-size: 0.85rem; color: var(--ink-soft); }
.unit-intro { margin-top: 1rem; color: var(--ink-soft); max-width: 42em; }

.unit-tips { margin-top: 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.4rem; }
.unit-tips h4 { font-size: 0.85rem; letter-spacing: 0.12em; color: var(--sage-deep); margin-bottom: 0.5rem; }
.unit-tips li { font-size: 0.85rem; color: var(--ink-soft); margin-left: 1.2em; margin-bottom: 0.25rem; }

.video-list { margin-top: 1.8rem; display: flex; flex-direction: column; gap: 0.7rem; }
.video-row {
  display: flex; align-items: center; gap: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1.1rem;
  cursor: pointer; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}
.video-row:hover { transform: translateX(4px); box-shadow: var(--shadow); }
.video-row.done { opacity: 0.62; }
.v-thumb { width: 108px; aspect-ratio: 16/9; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); }
.v-body { min-width: 0; flex: 1; }
.v-tag { font-size: 0.68rem; letter-spacing: 0.1em; color: var(--clay); font-weight: 700; }
.v-title { font-size: 0.95rem; font-weight: 600; line-height: 1.45; }
.v-meta { font-size: 0.76rem; color: var(--ink-soft); margin-top: 0.15rem; }
.v-check {
  flex-shrink: 0; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: transparent; background: none; cursor: pointer; transition: all 0.2s;
}
.v-check:hover { border-color: var(--sage); }
.video-row.done .v-check { background: var(--sage); border-color: var(--sage); color: #fff; }

.unit-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.4rem; }
.unit-nav button {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 0.85rem; color: var(--sage-deep);
  padding: 0.6rem 1.1rem; cursor: pointer;
}
.unit-nav button:hover { background: var(--sage-deep); color: #fff; }

/* ── Player overlay ── */
.player-overlay {
  position: fixed; inset: 0; background: rgba(30, 33, 31, 0.78);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1.2rem;
}
/* 播放器整體不得超出視窗：先由可用高度反推影片寬度，16:9 才不會被壓變形 */
.player-box {
  --player-chrome: 310px; /* 標題列＋時間軸＋底列實測高度 */
  width: min(920px, 100%, (100dvh - var(--player-chrome)) * 16 / 9);
  max-height: calc(100dvh - 2.4rem);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
}
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 1.2rem; flex-shrink: 0; }
.player-meta { font-size: 0.88rem; font-weight: 600; line-height: 1.4; }
.player-meta .pm-ch { font-size: 0.75rem; color: var(--ink-soft); font-weight: 400; }
.player-close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--ink-soft); padding: 0.3rem; }
.player-frame { aspect-ratio: 16/9; background: #000; flex-shrink: 0; }
.player-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.player-timeline {
  flex: 1 1 auto; min-height: 0; max-height: 200px; overflow-y: auto;
  padding: 0.6rem 1.2rem 0.2rem; border-top: 1px solid var(--line);
}
.tl-head { font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 0.4rem; }
.tl-item {
  display: flex; align-items: baseline; gap: 0.7rem; width: 100%;
  background: none; border: none; font-family: inherit; text-align: left;
  padding: 0.32rem 0.4rem; border-radius: 8px; cursor: pointer; line-height: 1.5;
}
.tl-item:hover { background: var(--bg); }
.tl-item.active { background: var(--bg); }
.tl-item.active .tl-time { background: var(--sage-deep); }
.tl-time {
  flex-shrink: 0; font-size: 0.74rem; font-weight: 700; color: #fff;
  background: var(--sage); border-radius: 6px; padding: 0.06rem 0.45rem;
  font-variant-numeric: tabular-nums;
}
.tl-label { font-size: 0.85rem; color: var(--ink); }

.player-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1.2rem; flex-shrink: 0; }
.player-foot a { font-size: 0.82rem; color: var(--sage-deep); }
.mark-btn {
  background: var(--sage); border: none; color: #fff; font-family: inherit;
  font-size: 0.84rem; padding: 0.5rem 1.1rem; border-radius: 999px; cursor: pointer;
}
.mark-btn.marked { background: var(--sage-deep); }

/* ── Feedback ── */
.feedback-cta {
  margin-top: 3rem; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--clay); border-radius: var(--radius); padding: 1.5rem 1.6rem;
}
.feedback-cta h3 { font-family: var(--serif); font-size: 1.2rem; margin-bottom: 0.5rem; }
.feedback-cta p { font-size: 0.88rem; color: var(--ink-soft); max-width: 42em; margin-bottom: 1rem; }
.fb-open-btn {
  background: var(--clay); color: #fff; border: none; font-family: inherit;
  font-size: 0.9rem; padding: 0.6rem 1.4rem; border-radius: 999px; cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s;
}
.fb-open-btn:hover { background: #a5765f; transform: translateY(-1px); }

.fb-side-btn {
  width: 100%; background: none; border: 1px solid rgba(240, 239, 233, 0.4);
  color: inherit; font-family: inherit; font-size: 0.78rem; letter-spacing: 0.05em;
  padding: 0.45rem 0.6rem; border-radius: 999px; cursor: pointer; margin-bottom: 0.9rem;
}
.fb-side-btn:hover { background: rgba(240, 239, 233, 0.14); }

.fb-overlay {
  position: fixed; inset: 0; background: rgba(30, 33, 31, 0.78); z-index: 110;
  display: flex; align-items: center; justify-content: center; padding: 1.2rem; overflow-y: auto;
}
.fb-box {
  width: min(520px, 100%); background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4); max-height: 92vh; overflow-y: auto;
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem 0.6rem;
}
.fb-head h3 { font-family: var(--serif); font-size: 1.2rem; }
.fb-close { background: none; border: none; font-size: 1.05rem; color: var(--ink-soft); cursor: pointer; padding: 0.3rem; }

.fb-form { padding: 0 1.4rem 1.3rem; display: flex; flex-direction: column; gap: 1rem; }
.fb-field { display: flex; flex-direction: column; gap: 0.4rem; }
.fb-field > span { font-size: 0.85rem; font-weight: 600; }
.fb-field em { font-style: normal; font-weight: 400; color: var(--ink-soft); font-size: 0.78rem; }
.fb-field textarea, .fb-field input, .fb-field select {
  font-family: inherit; font-size: 0.9rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.7rem; width: 100%;
}
.fb-field textarea:focus, .fb-field input:focus, .fb-field select:focus {
  outline: 2px solid var(--sage); outline-offset: 1px; background: var(--surface);
}
.fb-field textarea { resize: vertical; line-height: 1.6; }

.fb-rating { display: flex; gap: 0.4rem; }
.fb-star {
  flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 0.9rem; color: var(--ink-soft);
  padding: 0.5rem 0; cursor: pointer; transition: all 0.15s;
}
.fb-star:hover { border-color: var(--sage); }
.fb-star.on { background: var(--sage); border-color: var(--sage); color: #fff; font-weight: 700; }

.fb-note { font-size: 0.76rem; color: var(--ink-soft); }
.fb-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.fb-status { font-size: 0.82rem; color: var(--ink-soft); }
.fb-status.err { color: var(--rose); }
.fb-status.ok { color: var(--sage-deep); }
.fb-submit {
  background: var(--sage-deep); color: #fff; border: none; font-family: inherit;
  font-size: 0.88rem; padding: 0.6rem 1.5rem; border-radius: 999px; cursor: pointer;
}
.fb-submit:disabled { opacity: 0.55; cursor: default; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .layout { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 90; height: 100vh;
    transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: min(290px, 84vw);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 48px rgba(0,0,0,0.35); }
  .sidebar-close {
    display: block; width: 100%; margin-bottom: 0.9rem;
    background: rgba(240, 239, 233, 0.14); border: 1px solid rgba(240, 239, 233, 0.3);
    color: #f0efe9; font-family: inherit; font-size: 0.82rem;
    padding: 0.55rem 0.6rem; border-radius: 999px; cursor: pointer;
  }
  .sidebar-close:active { background: rgba(240, 239, 233, 0.25); }
  .sidebar-backdrop:not([hidden]) {
    display: block; position: fixed; inset: 0; z-index: 85;
    background: rgba(30, 33, 31, 0.45);
  }
  .menu-btn {
    display: block; position: fixed; top: 0.9rem; left: 0.9rem; z-index: 80;
    background: var(--sage-deep); color: #fff; border: none; border-radius: 999px;
    font-family: inherit; font-size: 0.82rem; padding: 0.55rem 1rem; cursor: pointer;
    box-shadow: var(--shadow);
  }
  .home, .unit { padding: 4.5rem 1.2rem 3rem; }
  .v-thumb { width: 84px; }
  /* 手機版浮動選單鈕會蓋住捲動中的內容，讓卡片自己讓開 */
  .track-card { scroll-margin-top: 4rem; }
  .track-card h3 { padding-right: 0.5rem; }
  .booking-cta { flex-direction: column; align-items: flex-start; }
  .booking-btn { width: 100%; text-align: center; }
}
