/* 學習工作室視覺層（覆蓋 styles.css）：墨藍側欄、編輯式留白、四色篇別、輕量互動。
   規則：顏色一律用下方 token，深色模式只換 token，不在元件規則裡寫死顏色。
   簡報邏輯尺寸與切頁相關規則留在 styles.css，這裡不調整。 */

/* ========== 1. Token ========== */
:root {
  --plate: #BF540C; --plate-deep: #A95B20;
  --bg: #FBF8F5; --paper: #fff; --paper-2: #FDFBFA;
  --ink: #372F2A; --ink-2: #6E6053; --ink-3: #87796D;
  --tint: #FCF3ED; --line: #EFE6DF; --line-2: #F4EEE9;
  --radius: 12px; --side: 264px;
  --side-bg: #302924; --side-ink: #E5D3C5; --side-mute: #C8A78E; --side-line: #50453D; --side-hover: #433933; --side-cur: #87552E;
  --hero-accent: #F7C9A6;
  --shadow-soft: 0 1px 2px #202b430a, 0 10px 28px #202b430d;
  --shadow-lift: 0 14px 32px #202b4314;
  /* 篇別色：K 課堂（金）、A 基礎（藍）、B 實戰（陶）、C 把關（綠）、D 附錄（紫） */
  --a-accent: #BF540C; --a-wash: #FDEBDC;
  --b-accent: #B03A5B; --b-wash: #FBE7ED;
  --c-accent: #277765; --c-wash: #e0f0e9;
  --d-accent: #7355a1; --d-wash: #eee7f8;
  --k-accent: #8a6410; --k-wash: #fbf1d9;
  --wash-ink: #463B34; --wash-mute: #706760;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --plate: #F7A45C; --plate-deep: #FBC08A; --plate-ink: #2A1606;
    --bg: #1E1A17; --paper: #2C2622; --paper-2: #322A25;
    --ink: #F7EDE6; --ink-2: #D4C7BC; --ink-3: #BDAD9F;
    --tint: #473C35; --line: #493E37; --line-2: #413731;
    --side-bg: #1A1614; --side-line: #3E342E; --side-hover: #362E28; --side-cur: #554840;
    --hero-accent: #AA7248;
    --shadow-soft: 0 1px 2px #0005, 0 10px 28px #0004;
    --shadow-lift: 0 14px 32px #0006;
    --a-accent: #F7A45C; --a-wash: #3A2616;
    --b-accent: #F29BB3; --b-wash: #3D2330;
    --c-accent: #7fd1b9; --c-wash: #1d3a34;
    --d-accent: #c6b0ef; --d-wash: #312a47;
    --k-accent: #F28C28; --k-wash: #3a3120;
    --wash-ink: #F7EDE6; --wash-mute: #D4C7BC;
  }
}
:root[data-theme=dark] {
  --plate: #F7A45C; --plate-deep: #FBC08A; --plate-ink: #2A1606;
  --bg: #1E1A17; --paper: #2C2622; --paper-2: #322A25;
  --ink: #F7EDE6; --ink-2: #D4C7BC; --ink-3: #BDAD9F;
  --tint: #473C35; --line: #493E37; --line-2: #413731;
  --side-bg: #1A1614; --side-line: #3E342E; --side-hover: #362E28; --side-cur: #554840;
  --hero-accent: #AA7248;
  --shadow-soft: 0 1px 2px #0005, 0 10px 28px #0004;
  --shadow-lift: 0 14px 32px #0006;
  --a-accent: #F7A45C; --a-wash: #3A2616;
  --b-accent: #F29BB3; --b-wash: #3D2330;
  --c-accent: #7fd1b9; --c-wash: #1d3a34;
  --d-accent: #c6b0ef; --d-wash: #312a47;
  --k-accent: #F28C28; --k-wash: #3a3120;
  --wash-ink: #F7EDE6; --wash-mute: #D4C7BC;
}
[data-part=K] { --accent: var(--k-accent); --wash: var(--k-wash); }
[data-part=A] { --accent: var(--a-accent); --wash: var(--a-wash); }
[data-part=B] { --accent: var(--b-accent); --wash: var(--b-wash); }
[data-part=C] { --accent: var(--c-accent); --wash: var(--c-wash); }
[data-part=D] { --accent: var(--d-accent); --wash: var(--d-wash); }

/* ========== 2. 側欄 ========== */
.sidebar { background: var(--side-bg); color: #EFE1D6; border: 0; padding: 26px 18px; gap: 19px; }
.sidebar .brand { color: #fff; gap: 12px; }
.sidebar .brand small { color: #CAAE98; margin-top: 6px; }
.sidebar .brand-side { padding-bottom: 22px; border-bottom: 1px solid var(--side-line); }
.sidebar .plate { background: #53463E; box-shadow: none; border-radius: 7px; color: #FFEBDB; font-size: 12px; }
.sidebar .brand .plate { background: #D8813E; color: #fff; font-size: 18px; }
.sidebar .search input { background: #3F352F; border-color: #5B4E45; color: #fff; font-size: 14px; border-radius: 10px; }
.sidebar .search input::placeholder { color: #C4B4A6; }
.sidebar .search input:focus { border-color: #FFC497; box-shadow: 0 0 0 3px #97b4ff33; }
.sidebar .toc-part h2 { color: var(--side-mute); font-size: 12px; margin-top: 15px; }
.sidebar .toc-part a { color: var(--side-ink); font-size: 14px; padding: 9px 8px; gap: 10px; border-radius: 9px; transition: background .2s, transform .2s; }
.sidebar .toc-part a:hover { background: var(--side-hover); color: #fff; transform: translateX(3px); }
.sidebar .toc-part a[aria-current=page] { background: var(--side-cur); color: #fff; box-shadow: inset 3px 0 #FFC497; }
.sidebar .plate.done { background: #286555; color: #d3ffec; }
.sidebar .side-foot { border-color: var(--side-line); font-size: 13px; }
.sidebar .side-foot a, .sidebar .side-foot button { color: #EECEB6; }

main { padding: 34px clamp(24px, 4vw, 64px) 80px; }

/* ========== 3. 首頁 ========== */
.studio-home { max-width: 1240px; margin: 0 auto; }
.studio-topline { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 13px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.studio-topline span:first-child { color: var(--ink-2); font-weight: 700; }
.studio-hero { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(300px, .88fr); gap: clamp(24px, 4vw, 64px); padding: 54px 0 52px; align-items: center; }
.overline { font-size: 13px; font-weight: 700; letter-spacing: .1em; color: var(--plate); margin: 0 0 14px; }
.tiny-line { display: inline-block; width: 22px; height: 2px; background: var(--plate); vertical-align: middle; margin-right: 8px; }
.hero-copy h1 { font-size: clamp(38px, 4.6vw, 66px); line-height: 1.23; letter-spacing: -.045em; font-weight: 900; margin: 22px 0; }
.hero-copy h1 span { color: var(--plate); position: relative; white-space: nowrap; }
.hero-copy h1 span::after { content: ''; position: absolute; left: 0; right: 0; bottom: -8px; height: 5px; background: var(--hero-accent); border-radius: 50%; }
.studio-lead { font-size: 16.5px; line-height: 1.95; color: var(--ink-2); margin: 25px 0; }
.hero-actions { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin: 28px 0 32px; }
.hero-actions .btn { gap: 23px; border-radius: 10px; min-height: 50px; padding: 12px 20px; background: #BF540C; border-color: #BF540C; color: #fff; box-shadow: 0 7px 18px #3159cb33; transition: transform .2s, box-shadow .2s; }
.hero-actions .btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px #3159cb40; }
.quiet-link { font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.quiet-link:hover { color: var(--plate); }
.quiet-link span { margin-left: 8px; }
.hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; color: var(--ink-3); font-size: 13px; }
.hero-facts span + span { border-left: 1px solid var(--line); padding-left: 24px; }
.hero-facts b { display: block; font-size: 26px; color: var(--ink); font-weight: 700; margin-right: 5px; }

.learning-stack { display: flex; flex-direction: column; gap: 12px; }
.stack-label { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .09em; padding: 0 5px; }
.feature-course { display: block; text-decoration: none; border-radius: 20px; background: linear-gradient(135deg, #DA7C34, #AB5F25); color: #fff; padding: 27px 28px 0; box-shadow: 0 15px 35px #2548a92e; transition: transform .25s, box-shadow .25s; }
.feature-course:hover { transform: translateY(-4px); box-shadow: 0 20px 40px #2548a93d; }
.feature-course > div { display: flex; align-items: center; justify-content: space-between; }
.course-code { font-size: 12px; letter-spacing: .06em; border: 1px solid #ffffff55; padding: 3px 9px; border-radius: 6px; }
.course-arrow { font-size: 24px; color: #FFDABD; }
.feature-course h2 { font-size: 32px; line-height: 1.3; letter-spacing: -.025em; margin: 20px 0 12px; }
.feature-course p { font-size: 13.5px; color: #FFEBDB; margin: 0 0 22px; }
.course-bottom { display: flex; justify-content: space-between; padding: 15px 0; border-top: 1px solid #ffffff33; font-size: 12.5px; }
.course-bottom span { color: #FFEBDB; }
.mini-course { display: flex; align-items: center; gap: 15px; padding: 18px 20px; border-radius: 13px; text-decoration: none; color: var(--wash-ink); border: 1px solid transparent; transition: transform .2s, border-color .2s; }
.mini-course:hover { transform: translateX(5px); border-color: var(--accent); }
.course-peach { --accent: var(--b-accent); background: var(--b-wash); }
.course-mint { --accent: var(--c-accent); background: var(--c-wash); }
.mini-code { font-size: 18px; font-weight: 700; color: var(--accent); }
.mini-course div { flex: 1; min-width: 0; }
.mini-course strong { display: block; font-size: 15px; }
.mini-course small { display: block; font-size: 13px; color: var(--wash-mute); margin-top: 3px; }
.mini-course > span:last-child { color: var(--accent); }

.studio-path { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 28px 30px; margin-bottom: 54px; box-shadow: var(--shadow-soft); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { font-size: 26px; letter-spacing: -.025em; line-height: 1.35; margin: 0; }
.section-heading .overline { font-size: 12.5px; margin-bottom: 8px; }
.progress-note, .section-aside { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.progress-note { background: var(--bg); padding: 5px 12px; border-radius: 20px; }
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.role-cards button { display: flex; align-items: center; text-align: left; gap: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 12px; padding: 18px 14px; cursor: pointer; transition: border-color .2s, background .2s; }
.role-cards button:hover { border-color: var(--plate); }
.role-cards button[aria-pressed=true] { border-color: var(--plate); background: var(--tint); box-shadow: 0 0 0 1px var(--plate); }
.role-symbol { font-size: 24px; color: var(--plate); }
.role-cards strong { display: block; font-size: 15px; }
.role-cards small { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.role-check { margin-left: auto; color: var(--plate); font-size: 14px; }
.route-disclosure { margin-top: 18px; border-top: 1px solid var(--line); }
.route-disclosure > summary { cursor: pointer; padding: 17px 0 0; font-size: 14px; color: var(--ink-2); }
.route-disclosure > summary > span { float: right; font-size: 13px; color: var(--plate); }
.route-disclosure .route { border: 0; margin-top: 15px; background: transparent; }
.route-disclosure .route-head { padding-left: 0; padding-right: 0; }
.local-note { font-size: 12.5px; color: var(--ink-3); margin: 12px 0 0; }

.studio-catalog, .studio-tools { margin-bottom: 55px; }
.catalog-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }
.catalog-tabs button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 16px; cursor: pointer; color: var(--ink-2); min-height: 40px; transition: background .2s, color .2s, border-color .2s; }
.catalog-tabs button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.catalog-tabs button:hover:not([aria-pressed=true]) { border-color: var(--plate); color: var(--plate); }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; position: relative; }
.catalog-card { display: flex; flex-direction: column; position: relative; min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 22px 22px 18px; color: var(--ink); text-decoration: none; transition: transform .22s, box-shadow .22s, border-color .22s; }
.catalog-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); opacity: .85; }
.catalog-card:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: var(--shadow-lift); }
.catalog-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.catalog-meta > span { background: var(--wash); color: var(--accent); font-size: 14px; font-weight: 700; padding: 4px 10px; border-radius: 7px; letter-spacing: .02em; }
.catalog-meta small { font-size: 12.5px; color: var(--ink-3); }
.catalog-card.is-done .catalog-meta small { color: var(--c-accent); font-weight: 700; }
.catalog-card h3 { font-size: 18px; line-height: 1.5; margin: 0 0 6px; }
.catalog-card p { font-size: 14px; line-height: 1.7; color: var(--ink-2); margin: 0 0 18px; }
.catalog-go { margin-top: auto; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line-2); padding-top: 12px; font-size: 13px; font-weight: 500; color: var(--accent); }
.catalog-go span { font-size: 18px; transition: transform .2s; }
.catalog-card:hover .catalog-go span { transform: translate(3px, -3px); }

.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tool-grid > a { display: flex; align-items: center; gap: 16px; padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s, box-shadow .2s; }
.tool-grid > a:hover { border-color: var(--plate); transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.tool-symbol { display: grid; place-items: center; flex: none; width: 44px; height: 44px; background: var(--a-wash); color: var(--a-accent); border-radius: 12px; font-size: 24px; }
.tool-symbol[data-color=teal] { background: var(--c-wash); color: var(--c-accent); }
.tool-symbol[data-color=rose] { background: var(--b-wash); color: var(--b-accent); }
.tool-grid h3 { font-size: 16px; margin: 0 0 3px; }
.tool-grid p { font-size: 13.5px; color: var(--ink-2); margin: 0; }
.tool-arrow { margin-left: auto; color: var(--ink-3); }
.studio-footer { border-top: 1px solid var(--line); padding: 25px 0 0; display: flex; gap: 30px; justify-content: space-between; align-items: center; }
.studio-footer strong { font-size: 15px; white-space: nowrap; }
.studio-footer p { font-size: 12.5px; color: var(--ink-3); max-width: 440px; margin: 0; }

.catalog-enter-active, .catalog-leave-active, .catalog-move { transition: opacity .22s, transform .22s; }
.catalog-enter-from, .catalog-leave-to { opacity: 0; transform: translateY(10px); }
.catalog-leave-active { position: absolute; visibility: hidden; }
.route-fade-enter-active, .route-fade-leave-active { transition: opacity .15s; }
.route-fade-enter-from, .route-fade-leave-to { opacity: 0; }

/* ========== 4. 文章頁 ========== */
.chapter .ch-head { position: relative; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 32px 32px 28px; margin-bottom: 30px; box-shadow: var(--shadow-soft); }
.chapter .ch-head::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); z-index: 2; }
.chapter .ch-head::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--wash); opacity: .7; pointer-events: none; }
.chapter .ch-head > * { position: relative; z-index: 1; }
.chapter .ch-head .plate { box-shadow: none; border-radius: 12px; }
.chapter .ch-head h1 { letter-spacing: -.025em; }
.ch-part { display: inline-block; background: var(--wash); color: var(--accent); font-weight: 700; font-size: .8rem; padding: 1px 9px; border-radius: 6px; margin-right: 8px; }
.ch-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 16px; }
.ch-actions .view-switch { margin: 0; }
.ch-stats { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.ch-stats li { font-size: 13px; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 11px; }
.chapter .view-switch { border-radius: 10px; }
.chapter .ch-toc { border-radius: 12px; }
.chapter .prose h2 { padding-top: 15px; }
.chapter .prose h2 .sec-num { box-shadow: none; border-radius: 8px; }
.chapter .code pre { border-radius: 12px; }
.chapter .copy-btn { border-radius: 7px; }
.chapter .callout { border-radius: 0 12px 12px 0; }
.chapter .prose table { border-radius: 12px; }

.ch-foot { display: grid; gap: 20px; }
.done-toggle { font: inherit; font-weight: 500; border-radius: 999px; background: var(--paper); color: var(--ink); cursor: pointer; justify-self: start; transition: border-color .2s, background .2s, color .2s; }
.done-toggle:hover { border-color: var(--c-accent); }
.done-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); font-size: 13px; line-height: 1; transition: background .2s, border-color .2s; }
.done-toggle[aria-pressed=true] { background: var(--c-wash); border-color: var(--c-accent); color: var(--c-accent); }
.done-toggle[aria-pressed=true] .done-dot { background: var(--c-accent); border-color: var(--c-accent); color: var(--paper); }
.chapter .pager { margin-top: 0; }
.chapter .pager a { border-radius: 14px; padding: 16px 18px; background: var(--paper); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s, box-shadow .2s; }
.chapter .pager a:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }

.rail-meter { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.rail-title { color: var(--ink-3); letter-spacing: .06em; font-size: 12.5px; font-weight: 700; }
.rail-pct { font-size: 12px; color: var(--plate); font-variant-numeric: tabular-nums; }
.rail a.active { border-radius: 0 6px 6px 0; background: var(--tint); }
.rail-slides { margin-top: 4px; font-weight: 500; text-decoration: none; }

/* ========== 5. 互動工具 ========== */
.tools-page .ch-head { margin-bottom: 20px; }
.tool-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; position: sticky; top: 12px; z-index: 5; }
.tool-jump a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; transition: border-color .2s; }
.tool-jump a:hover { border-color: var(--plate); }
.tool-jump .tool-no { width: 26px; height: 26px; font-size: 13px; border-radius: 50%; }
.tool { border-radius: 20px; box-shadow: var(--shadow-soft); border-color: var(--line); padding: 28px 30px; scroll-margin-top: 70px; }
.tool-head { position: relative; }
.tool-head > div { flex: 1; min-width: 0; }
.tool-count { flex: none; align-self: center; font-size: 13px; color: var(--c-accent); background: var(--c-wash); padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.tool-no { box-shadow: none; border-radius: 10px; background: var(--tint); color: var(--plate); font-weight: 700; }
.tool-body { display: grid; gap: 4px 28px; }
.tool-side .tool-out { margin-top: 20px; }
.tool-out h3 { font-size: 14px; color: var(--ink-2); letter-spacing: .04em; }
.tool-out .code { position: relative; }
.tool-out pre { border-radius: 12px; min-height: 7em; }
@media (min-width: 1280px) {
  .tool-body { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .tool-side { position: sticky; top: 72px; }
  .tool-side .tool-out { margin-top: 0; }
  .tool-side .tool-out pre { max-height: 60vh; overflow: auto; }
}
.field > span { font-size: 14.5px; }
.field input, .field textarea, .field select { border-radius: 10px; background: var(--paper-2); color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: color-mix(in srgb, var(--plate) 45%, var(--line)); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--plate); background: var(--paper); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--plate) 22%, transparent); }
.select-wrap { position: relative; display: block; }
.select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); pointer-events: none; }
.select-wrap select { width: 100%; appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer; }
.chips { gap: 8px; }
.chips .opt-chip { position: relative; min-height: 0; }
.chips .opt-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips .opt-chip span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper-2); color: var(--ink-2); font-size: 14px; font-weight: 400; transition: background .15s, border-color .15s, color .15s; }
.chips .opt-chip i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--line); font-style: normal; font-size: 12px; line-height: 1; transition: background .15s, border-color .15s; }
.chips .opt-chip:hover span { border-color: var(--plate); }
.chips .opt-chip input:checked + span { background: var(--tint); border-color: var(--plate); color: var(--ink); }
.chips .opt-chip input:checked + span i { background: var(--plate); border-color: var(--plate); }
.chips .opt-chip input:checked + span i::after { content: '✓'; color: var(--paper); font-weight: 700; }
.chips .opt-chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.tool .btn-row { margin-top: 12px; }
.tool .btn.secondary { border-radius: 10px; }

/* ========== 6. 搜尋 ========== */
.search-page .page-title { font-size: 2rem; }
.search-page .results { display: grid; gap: 10px; }
.search-page .results li { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; transition: border-color .2s, box-shadow .2s; }
.search-page .results li:hover { border-color: var(--plate); box-shadow: var(--shadow-soft); }
.search-page .results a { flex-wrap: wrap; }
.result-meta { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--ink-3); }
.search-page .results mark { background: color-mix(in srgb, var(--focus) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.empty-state { background: var(--paper); border: 1px dashed var(--line); border-radius: 16px; padding: 22px 24px; }
.sample-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.sample { padding: 5px 14px; border-radius: 999px; background: var(--tint); color: var(--plate); text-decoration: none; font-size: 14px; }
.sample:hover { background: var(--plate); color: var(--paper); }

/* ========== 8. 小動畫（全部由 styles.css 的 prefers-reduced-motion 總規則關閉；
   fill-mode 一律用 backwards，播完就交還給 hover／transition，不卡住 transform） ========== */
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade-in { from { opacity: 0; } }

/* 首頁進場：每個分頁只播一次（home.js 控制 .intro） */
.studio-home.intro .hero-copy > * { animation: rise-in .6s var(--ease-out) backwards; }
.studio-home.intro .hero-copy > :nth-child(2) { animation-delay: .06s; }
.studio-home.intro .hero-copy > :nth-child(3) { animation-delay: .14s; }
.studio-home.intro .hero-copy > :nth-child(4) { animation-delay: .22s; }
.studio-home.intro .hero-copy > :nth-child(5) { animation-delay: .30s; }
.studio-home.intro .learning-stack > * { animation: rise-in .6s var(--ease-out) backwards; }
.studio-home.intro .learning-stack > :nth-child(2) { animation-delay: .22s; }
.studio-home.intro .learning-stack > :nth-child(3) { animation-delay: .32s; }
.studio-home.intro .learning-stack > :nth-child(4) { animation-delay: .42s; }
.studio-home.intro .studio-path { animation: rise-in .6s var(--ease-out) .45s backwards; }
.studio-home.intro .hero-copy h1 span::after { animation: underline-in .7s var(--ease-out) .55s backwards; transform-origin: 0 50%; }
@keyframes underline-in { from { transform: scaleX(0); } }

/* 首頁進度小條 */
.progress-note { display: inline-flex; align-items: center; gap: 8px; }
.note-bar { display: inline-block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.note-bar b { display: block; height: 100%; background: var(--c-accent); border-radius: 3px; transition: width .6s var(--ease-out); }
.progress-note.started { color: var(--c-accent); }

/* 複製成功：按鈕彈一下、提示詞框閃一圈綠光。文章與簡報都適用（只有光暈與縮放，不改變版面尺寸，不影響簡報切頁） */
@keyframes copied-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes btn-pop { 40% { transform: scale(1.08); } }
.code.copied pre { animation: copied-flash .8s var(--ease-out); }
td.prompt-cell.copied { animation: copied-flash .8s var(--ease-out); }
.copy-btn.ok { animation: btn-pop .35s var(--ease-out); background: color-mix(in srgb, var(--green) 10%, var(--paper)); }

/* 檢查清單：勾選動畫限定 .prose（文章內文），簡報的尺寸與切頁不受影響；.check-count 只在文章建立（簡報呼叫 wireChecklists 時不帶計數） */
.prose li.task span { text-decoration: line-through; text-decoration-color: transparent; transition: color .25s, text-decoration-color .25s; }
.prose li.task input:checked + span { text-decoration-color: var(--ink-3); }
@keyframes check-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } }
.prose li.task.just input { animation: check-pop .35s var(--ease-out); }
.check-count { transition: color .25s; }
.check-count.all-done { color: var(--green); font-weight: 700; }
@keyframes count-pop { 40% { transform: scale(1.06); } }
.check-count.pop { animation: count-pop .45s var(--ease-out); transform-origin: 0 50%; }
.check-count.all-done + ul.checklist { border-left: 3px solid color-mix(in srgb, var(--green) 45%, transparent); padding-left: 12px; transition: border-color .3s; }

/* 看答案：平滑展開（支援 ::details-content 的瀏覽器才有，其他直接打開）＋箭頭轉向 */
.prose details.answer { interpolate-size: allow-keywords; }
.prose details.answer::details-content { block-size: 0; overflow-y: clip; transition: block-size .32s var(--ease-out), content-visibility .32s allow-discrete; }
.prose details.answer[open]::details-content { block-size: auto; }
.prose details.answer summary { list-style: none; }
.prose details.answer summary::-webkit-details-marker { display: none; }
.prose details.answer summary::before { content: ''; width: 7px; height: 7px; margin-right: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease-out); flex: none; }
.prose details.answer[open] summary::before { transform: rotate(45deg); }
.prose details.answer[open] > div { animation: fade-in .35s var(--ease-out) backwards; }

/* 標記已讀完：圓點彈跳＋光圈，頁首門牌翻面 */
@keyframes dot-pop { 0% { transform: scale(.4); } 55% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes ring-out { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-accent) 50%, transparent); } to { box-shadow: 0 0 0 12px transparent; } }
.done-toggle.pop .done-dot { animation: dot-pop .45s var(--ease-out), ring-out .7s var(--ease-out); }
@keyframes plate-flip { from { transform: perspective(600px) rotateX(-100deg); opacity: .2; } }
.ch-plate.flip .plate { animation: plate-flip .55s var(--ease-out); }

/* 深淺色切換圖示轉一下 */
@keyframes theme-spin { from { transform: rotate(-120deg) scale(.6); opacity: 0; } }
.theme-btn.spin svg { animation: theme-spin .45s var(--ease-out); }

/* 搜尋結果依序淡入 */
.search-page .results li { animation: rise-in .4s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 45ms); }

/* 文章右側目錄：目前小節的標示平滑移動 */
.rail li a { transition: color .2s, background .2s, border-color .2s, padding-left .2s; }
.rail li a.active { padding-left: 14px; }

/* 找不到頁 */
.not-found { text-align: center; margin: 8vh auto 0; }
.nf-plate { margin-bottom: 18px; }
.nf-plate .plate { font-size: 2.2rem; padding: .3em .7em; animation: plate-flip .7s var(--ease-out) backwards; }
.not-found .muted { margin: 0 auto 22px; max-width: 32rem; text-wrap: balance; }
.nf-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.nf-links .btn { border-radius: 10px; text-decoration: none; }

/* ::details-content 不在 styles.css 總規則的 * 選取範圍內，另外關掉 */
@media (prefers-reduced-motion: reduce) {
  .prose details.answer::details-content { transition: none; }
}

/* ========== 7a. 內容置中（寬螢幕不要整塊靠左、右邊留一大片空白） ========== */
main > .page, main > .page-wide, main > .chapter-layout { margin-inline: auto; }
.chapter-layout:not(.with-rail) { max-width: var(--measure); }
@media (min-width: 1680px) {
  :root { --measure: 46rem; }
  .chapter-layout.with-rail { grid-template-columns: minmax(0, var(--measure)) 16rem; gap: 72px; max-width: calc(var(--measure) + 16rem + 72px); }
}

/* ========== 7. 響應式 ========== */
@media (max-width: 1200px) {
  .studio-hero { gap: 28px; }
  .hero-copy h1 { font-size: 46px; }
  .role-symbol { display: none; }
  .role-cards button { padding: 15px 10px; }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-facts { gap: 14px; }
  .hero-facts span + span { padding-left: 14px; }
  .hero-actions { gap: 16px; }
  .studio-footer { display: block; }
  .studio-footer p { margin-top: 10px; }
}
@media (max-width: 900px) {
  main { padding: 22px 24px 65px; }
  .studio-topline { display: none; }   /* 手機頂部列已有站名，不重複 */
  .studio-hero { padding-top: 14px; }
  .hero-copy h1 { font-size: clamp(36px, 5.7vw, 50px); }
  .topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
  .topbar .plate { box-shadow: none; }
  .sidebar { padding-top: 24px; }
  .studio-path { padding: 23px; }
  .role-symbol { display: block; }
  .tool-jump { top: 64px; }
  .tool { scroll-margin-top: 120px; }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 55px; }
  .studio-hero { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-bottom: 35px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-copy .overline { margin-top: 0; }
  .studio-lead { font-size: 15.5px; }
  .hero-actions { margin: 24px 0; }
  .hero-facts { font-size: 12px; gap: 14px; }
  .hero-facts b { font-size: 22px; }
  .learning-stack { gap: 10px; }
  .feature-course { padding: 22px 24px 0; }
  .feature-course h2 { font-size: 28px; }
  .feature-course h2 br { display: none; }
  .feature-course p { margin-bottom: 16px; }
  .mini-course { padding: 15px 18px; }
  .studio-path { padding: 20px 16px; margin-bottom: 36px; }
  .section-heading { align-items: start; gap: 12px; }
  .section-heading h2 { font-size: 23px; }
  .progress-note { font-size: 12px; padding: 4px 8px; }
  .section-aside { display: none; }
  .role-cards { gap: 8px; }
  .role-cards button { display: block; text-align: center; padding: 12px 6px; }
  .role-symbol { font-size: 22px; margin-bottom: 3px; }
  .role-cards strong { font-size: 14px; }
  .role-cards small, .role-check { display: none; }
  .route-disclosure > summary { font-size: 13px; }
  .route-disclosure > summary > span { font-size: 12px; }
  .course-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .catalog-card { padding: 16px 16px 14px 18px; }
  .catalog-meta { margin-bottom: 10px; }
  .catalog-card h3 { font-size: 16.5px; }
  .catalog-card p { font-size: 13.5px; margin-bottom: 12px; }
  .catalog-tabs { gap: 6px; flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .catalog-tabs button { flex: none; font-size: 13px; padding: 6px 14px; }
  .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .tool-grid > a { padding: 18px; }
  .studio-catalog, .studio-tools { margin-bottom: 36px; }
  .chapter .ch-head { padding: 24px 20px 20px; }
  .chapter .ch-head::after { width: 140px; height: 140px; right: -50px; top: -50px; }
  .chapter .prose h2 { font-size: 1.22rem; }
  .tool { padding: 20px 16px; border-radius: 16px; }
  .tool-head { flex-wrap: wrap; }
  .tool-count { margin-left: calc(2.2em + 14px); }
  .result-meta { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .catalog-enter-active, .catalog-leave-active, .catalog-move, .route-fade-enter-active, .route-fade-leave-active { transition: none; }
  .feature-course:hover, .mini-course:hover, .catalog-card:hover, .tool-grid > a:hover, .sidebar .toc-part a:hover,
  .hero-actions .btn:hover, .chapter .pager a:hover, .catalog-card:hover .catalog-go span { transform: none; }
}
@media print {
  .chapter .ch-head { border: 0; padding: 0; box-shadow: none; }
  .chapter .ch-head::before, .chapter .ch-head::after, .ch-stats, .tool-jump { display: none; }
  .studio-topline { display: none; }
}

/* ========== 課堂篇（K1 上課簡報、K2 學生講義）＋練習框 ========== */
.callout.practice { border-left-color: var(--k-accent); background: var(--k-wash); color: var(--wash-ink); }
.callout.practice p:first-child strong:first-child { color: var(--k-accent); }
.slide .callout.practice { border-left: 6px solid #B8860B; background: #FDF6E3; color: #2E2722; }
.slide .callout.practice strong { color: #7A5A0C; }
/* Chrome 預設 text-spacing-trim:normal 會讓行尾全形標點（」）多出半個字寬，量測時被判為水平溢出 */
.slide { text-spacing-trim: space-all; }
/* 上課簡報：字級放大、行距放寬，一張只講一件事 */
.slide.part-K { font-size: 30px; line-height: 1.55; }
.slide.part-K .slide-head h2 { font-size: 50px; }
.slide.part-K .slide-head h3 { font-size: 42px; }
.slide.part-K li { margin: .35em 0; }
.slide.part-K table { font-size: 24px; }
/* 表格內英文產品名不要被從中間切斷（slide-body 的 overflow-wrap:anywhere 會讓欄寬縮到單一字母） */
.slide.part-K td, .slide.part-K th { overflow-wrap: break-word; word-break: normal; }
.slide.part-K th { white-space: nowrap; }
.slide.part-K .callout { font-size: 27px; }
.slide.part-K .slide-body > p:only-child { font-size: 40px; font-weight: 700; line-height: 1.45; color: #2A2522; }
.slide.part-K.fmt-portrait { font-size: 32px; }
.slide.part-K.fmt-portrait .slide-head h2 { font-size: 50px; }
.slide.part-K.fmt-portrait table { font-size: 25px; }
.slide.part-K.fmt-portrait .slide-body > p:only-child { font-size: 42px; }
.slide.part-K .slide-foot .plate { background: #8A6410; box-shadow: inset 0 0 0 2px #8A6410, inset 0 0 0 3.5px #fff; }
/* 練習計時鈕（簡報底部） */
.deck-timer { min-height: 40px; padding: 0 14px; border: 1px solid #B8860B; border-radius: 999px; background: #3a3120; color: #F6D98B;
  font: inherit; font-size: .92rem; font-variant-numeric: tabular-nums; cursor: pointer; }
.deck-timer:hover { background: #4a3d24; }
.deck-timer:focus-visible { outline: 3px solid #F6D98B; outline-offset: 2px; }
.deck-timer.running { background: #B8860B; color: #1c1405; font-weight: 700; }
.deck-timer.ended { background: #C0392B; border-color: #C0392B; color: #fff; }
@media print {
  .callout.practice { background: none; border-left-width: 3px; }
}

/* ========== 課堂簡報特效（只作用在 K 篇；減少動態時全部關閉） ========== */
/* 換頁：淡入＋微微放大，取代翻書，投影機上最順 */
@keyframes k-in { from { opacity: 0; transform: translate(-50%, -50%) scale(calc(var(--s) * .97)); } }
@keyframes k-out { to { opacity: 0; transform: translate(-50%, -50%) scale(calc(var(--s) * 1.02)); } }
.slide.part-K.enter-next, .slide.part-K.enter-prev { z-index: 2; animation: k-in .45s var(--ease-out) both; }
.slide.part-K.leave-next, .slide.part-K.leave-prev { z-index: 1; animation: k-out .35s ease-in both; }
/* 重點逐條出現 */
.slide .rv { opacity: 0; transform: translateY(14px); }
.slide .rv.rv-in { opacity: 1; transform: none; transition: opacity .4s, transform .45s var(--ease-out); }
/* 分隔頁：大編號彈出＋一道光掃過 */
.slide.part-K.type-divider { background: #2A2522; overflow: hidden; }
.slide.part-K.type-divider::before { border-color: rgba(242, 140, 40, .75); }
.slide.part-K.type-divider .divider-slide h2 { display: flex; align-items: center; gap: 28px; font-size: 76px; }
.slide.part-K .dnum { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; background: #F28C28; color: #2A2522; font-size: 1.05em; flex-shrink: 0; }
.slide.part-K.type-divider:not(.thumb) .dnum { animation: dnum-pop .7s .15s var(--ease-out) both; }
.slide.part-K.type-divider:not(.thumb) .slide-inner::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 28%; left: -40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .16), transparent); transform: skewX(-12deg); animation: sweep 1.3s .25s ease-out both; pointer-events: none; }
@keyframes dnum-pop { 0% { transform: scale(.3) rotate(-25deg); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: none; opacity: 1; } }
@keyframes sweep { to { left: 120%; } }
.slide.part-K.fmt-portrait.type-divider .divider-slide h2 { flex-direction: column; align-items: flex-start; gap: 18px; font-size: 64px; }
/* 金句頁：螢光筆畫過 */
.slide.part-K .slide-body > p:only-child { display: inline; background-image: linear-gradient(transparent 62%, rgba(242, 140, 40, .6) 62%);
  background-repeat: no-repeat; background-size: 100% 100%; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.slide.part-K:not(.thumb) .slide-body > p:only-child { animation: marker .9s .35s var(--ease-out) both; }
@keyframes marker { from { background-size: 0% 100%; } }
/* 進度條：每一段起點的刻度 */
.deck-progress { position: relative; }
.deck-progress .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: rgba(242, 140, 40, .8); border-radius: 1px; }
/* B 鍵黑屏 */
.deck.blackout .stage { background: #000; }
.deck.blackout .viewport { opacity: 0; transition: opacity .25s; }
/* 課程結束彩帶 */
.stage .confetti { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
@media (prefers-reduced-motion: reduce) {
  .slide .rv { opacity: 1; transform: none; }
  .slide.part-K .dnum, .slide.part-K .slide-body > p:only-child, .slide.part-K .slide-inner::after { animation: none !important; }
}

/* ========== 簡報游標（投影時看得清楚；L 鍵開關） ==========
   深藍：在白底與橘色表頭、標籤上都最跳（橘色的互補色）；深色投影片上自動改白色。 */
.deck-pointer { --ptr: #16306B; --ptr-halo: rgba(255, 255, 255, .95); --ptr-glow: rgba(22, 48, 107, .45);
  position: fixed; left: 0; top: 0; z-index: 60; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  border: 4px solid var(--ptr); background: color-mix(in srgb, var(--ptr) 16%, transparent);
  box-shadow: 0 0 0 3px var(--ptr-halo), 0 0 22px 4px var(--ptr-glow);
  pointer-events: none; opacity: 0; transition: opacity .3s; display: grid; place-items: center;
  color: var(--ptr); font: 900 24px/1 system-ui, sans-serif; }
.deck-pointer.on-dark { --ptr: #FFFFFF; --ptr-halo: rgba(22, 48, 107, .9); --ptr-glow: rgba(255, 255, 255, .45); }
.deck-pointer::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ptr); }
.deck-pointer.left::after { content: "‹"; width: auto; height: auto; background: none; margin-top: -3px; }
.deck-pointer.right::after { content: "›"; width: auto; height: auto; background: none; margin-top: -3px; }
.deck-pointer.on { opacity: 1; }
.deck.pointer-on .stage, .deck.pointer-on .stage * { cursor: none; }
.deck.pointer-on .stage :is(a, button, summary, .code, pre) { cursor: pointer; }
.deck-pointer.click::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid var(--ptr); animation: ptr-ping .5s ease-out forwards; }
@keyframes ptr-ping { to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .deck-pointer.click::before { animation: none; } }

/* 簡報翻頁時不要反白選字；提示詞框仍可選取、複製 */
.deck .stage { -webkit-user-select: none; user-select: none; }
.deck .stage :is(.code, pre, input, textarea) { -webkit-user-select: text; user-select: text; }

/* ========== 原稿中的圖片（![說明](img/檔名)）；QR code 放大時保持銳利 ========== */
.prose img.md-img { display: block; max-width: 100%; height: auto; margin: 1em 0; border-radius: 8px; }
.md-img.qr { image-rendering: pixelated; background: #fff; padding: 10px; }
.prose img.md-img.qr { width: 240px; }
.slide .slide-body img.md-img { display: block; height: auto; margin: 6px 0; }
.slide .slide-body img.md-img.qr { width: 330px; border: 1px solid #E6DDD3; }
.slide.fmt-portrait .slide-body img.md-img.qr { width: 420px; }
