/* 教學頁：步驟播放器與畫面示意（顏色跟首頁一致） */
:root {
  color-scheme: light;
  --plane: #f6f6f3; --surface: #ffffff; --surface-2: #efefeb;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781; --border: rgba(11, 11, 11, 0.1);
  --accent: #008a60; --accent-ink: #ffffff; --accent-text: #00704e;
  --line: #06c755; --c-labor: #2a78d6; --c-expense: #eb6834; --warn-text: #9a5b00;
  --radius: 16px;
  --font: "Segoe UI", "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781; --border: rgba(255, 255, 255, 0.1);
    --accent: #22a77e; --accent-ink: #0b0b0b; --accent-text: #22a77e;
    --c-labor: #5b9cf0; --c-expense: #f08a5e; --warn-text: #f0b24a;
  }
}
  /* 手動選深色（theme.js 會在 <html> 加 data-theme） */
  :root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781; --border: rgba(255, 255, 255, 0.1);
  --accent: #22a77e; --accent-ink: #0b0b0b; --accent-text: #22a77e;
  --c-labor: #5b9cf0; --c-expense: #f08a5e; --warn-text: #f0b24a;
  }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--plane); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--plane) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; text-decoration: none; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: #008a60; color: #fff; display: grid; place-items: center; }
.logo .mark svg { width: 18px; height: 18px; }
.logo .name { display: flex; align-items: baseline; gap: 7px; }
.logo .name small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.03em; }
.nav nav { display: flex; gap: 22px; align-items: center; font-size: 15px; color: var(--ink-2); }
.nav nav a { text-decoration: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 12px; font-weight: 700; text-decoration: none; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 8px 16px; font-size: 14px; }
/* 外觀切換按鈕：依目前模式顯示對應的圖示 */
.theme-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; display: none; }
.theme-toggle:not([data-mode]) .t-auto, .theme-toggle[data-mode="auto"] .t-auto, .theme-toggle[data-mode="light"] .t-light, .theme-toggle[data-mode="dark"] .t-dark { display: block; }

/* 頁首 */
.g-hero { padding: 64px 20px 24px; }
.eyebrow { display: inline-flex; font-size: 13px; font-weight: 700; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 6px 12px; border-radius: 999px; margin-bottom: 16px; }
.g-hero h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
.g-hero .lead { margin-top: 16px; font-size: 18px; color: var(--ink-2); max-width: 640px; }
.chapters { position: sticky; top: 64px; z-index: 9; display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 0; margin-top: 24px; background: color-mix(in srgb, var(--plane) 92%, transparent); backdrop-filter: blur(10px); }
.chapters a { font-size: 14px; font-weight: 700; text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); }
.chapters a.on { background: var(--ink); color: var(--plane); border-color: var(--ink); }

/* 章節 */
.chapter { padding: 56px 20px 24px; scroll-margin-top: 130px; }
.chapter-head { display: grid; grid-template-columns: 44px 1fr; gap: 6px 16px; max-width: 760px; margin-bottom: 28px; }
.chapter-head .n { grid-row: span 2; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--plane); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.chapter-head h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; line-height: 1.25; font-weight: 800; }
.chapter-head p { color: var(--ink-2); font-size: 16px; }
.chapter-head p b { color: var(--ink); font-weight: 700; }

/* 播放器 */
.player { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps button { width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px 14px 54px; position: relative; cursor: pointer; overflow: hidden; transition: border-color .2s, transform .2s, box-shadow .2s; }
.steps button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.steps button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.steps .k { position: absolute; left: 16px; top: 15px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--muted); transition: all .25s; }
.steps b { display: block; font-size: 16px; }
.steps span.d { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.steps .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); }
.player.js .steps li.active button { border-color: var(--accent); box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.player.js .steps li.active .k { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.player.js .steps li:not(.active) span.d { display: none; }
.pager { display: none; gap: 8px; margin-top: 10px; }
.player.js .pager { display: flex; }
.pager button { font: inherit; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; }

.stage { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; min-height: 420px; overflow: hidden; }
.scene { position: relative; padding: 24px 24px 44px; display: grid; place-items: center; }
/* 有 JS 時所有畫面疊在同一格，容器高度跟著最高的那一個，不會被裁掉 */
.player.js .stage { display: grid; }
.player.js .scene { grid-area: 1 / 1; opacity: 0; transform: translateY(10px); transition: opacity .4s ease, transform .4s ease, visibility 0s .4s; pointer-events: none; visibility: hidden; }
.player.js .scene.active { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.player:not(.js) .scene + .scene { border-top: 1px solid var(--border); }
.scene .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px; font-size: 13px; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); text-align: center; }

/* 畫面示意：手機（LINE）與網站 */
.frame { width: 100%; max-width: 420px; font-size: 13px; color: #111827; }
.frame.phone { max-width: 300px; background: #0b0b0b; border-radius: 34px; padding: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.pscreen { background: #eef0f3; border-radius: 24px; overflow: hidden; }
.pbar { background: var(--line); color: #fff; padding: 12px 14px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.pbar span { font-weight: 400; opacity: .9; font-size: 11px; }
.pchat { padding: 10px; display: grid; gap: 8px; min-height: 180px; align-content: start; }
.b { max-width: 90%; background: #fff; border-radius: 14px; border-top-left-radius: 5px; padding: 8px 11px; box-shadow: 0 1px 2px rgba(0,0,0,.06); line-height: 1.45; }
.b.me { justify-self: end; background: #d6f5c4; border-radius: 14px; border-top-right-radius: 5px; }
.b small { display: block; color: #6b7280; font-size: 11px; margin-top: 1px; }
.b .tag { display: inline-block; font-size: 10.5px; font-weight: 800; color: var(--line); letter-spacing: .04em; }
.b .file { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.b .file i { width: 24px; height: 24px; border-radius: 7px; background: #fff; display: grid; place-items: center; font-style: normal; font-size: 12px; }
.pmenu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 4px 10px 12px; }
.pmenu span { text-align: center; font-size: 10.5px; padding: 7px 0; border-radius: 8px; background: #fff; border: 1px solid #e5e7eb; }
.pmenu span.on { background: #111827; color: #fff; border-color: #111827; font-weight: 700; }
.pcard { background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); display: grid; gap: 8px; }
.pcard h4 { margin: 0; font-size: 14px; }
.pcard .time { font-size: 34px; font-weight: 800; text-align: center; letter-spacing: 1px; line-height: 1.1; }
.pcard .date { text-align: center; color: #6b7280; font-size: 11px; }
.pcard .ok { background: #ecfdf3; border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.pcard .ok b { display: block; }
.pcard .go { background: var(--line); color: #fff; text-align: center; border-radius: 10px; padding: 11px; font-weight: 700; }
.pcard .go.ghost { background: #fff; color: #111827; border: 1px solid #e5e7eb; }
.pcard .field { display: grid; gap: 2px; font-size: 11px; color: #6b7280; }
.pcard .field b { font-size: 13px; color: #111827; background: #f3f4f6; border-radius: 8px; padding: 7px 9px; font-weight: 600; }

.frame.web { background: #0f0f0f; border-radius: 14px; overflow: hidden; display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 330px; box-shadow: 0 24px 60px rgba(0,0,0,.2); color: #e9e9e4; }
.wside { background: #161616; border-right: 1px solid rgba(255,255,255,.08); padding: 12px 10px; font-size: 11px; display: grid; gap: 8px; align-content: start; }
.wlogo { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 12px; }
.wlogo i { width: 16px; height: 16px; border-radius: 5px; background: #008a60; display: inline-block; }
.wco { font-weight: 700; font-size: 12px; margin-top: 4px; }
.wnav span { display: block; padding: 6px 8px; border-radius: 8px; color: #b8b8b0; }
.wnav span.on { background: #f3f3ef; color: #0b0b0b; font-weight: 700; }
.wmain { padding: 14px; display: grid; gap: 10px; align-content: start; font-size: 12px; }
.wmain h4 { margin: 0; font-size: 15px; }
.wcard { background: #1b1b1a; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.wcard .muted { color: #9a9a92; font-size: 11px; }
.wrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.wrow:last-child { border-bottom: 0; }
.wbtn { font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 8px; background: #f3f3ef; color: #0b0b0b; white-space: nowrap; }
.wbtn.ghost { background: transparent; color: #e9e9e4; border: 1px solid rgba(255,255,255,.2); }
.winput { background: #0f0f0f; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; padding: 7px 9px; color: #e9e9e4; min-height: 30px; }
.winput.ph { color: #777; }
.wchip { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(34,167,126,.18); color: #4dd4a4; }
.wchip.warn { background: rgba(240,178,74,.16); color: #f0b24a; }
.wtoggle { width: 30px; height: 18px; border-radius: 999px; background: #444; position: relative; flex: none; transition: background .3s; }
.wtoggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .3s; }
.wtoggle.on { background: #22a77e; }
.wtoggle.on::after { transform: translateX(12px); }
.wbar { height: 8px; border-radius: 999px; background: #2a2a28; overflow: hidden; }
.wbar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--c-labor); transition: width 1.2s ease .3s; }
.wbar i.exp { background: var(--c-expense); }
.wbar i.time { background: #9a9a92; }
.scene.active .wbar i, .player:not(.js) .wbar i { width: var(--w, 60%); }
.map { position: relative; height: 120px; border-radius: 10px; overflow: hidden; background: #e9eee6; background-image: linear-gradient(rgba(0,0,0,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.08) 1px, transparent 1px); background-size: 24px 24px; }
.map::before { content: ""; position: absolute; left: 0; right: 0; top: 54px; height: 10px; background: #fff; opacity: .9; }
.map::after { content: ""; position: absolute; top: 0; bottom: 0; left: 70%; width: 8px; background: #fff; opacity: .9; }
.map .ring { position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; background: rgba(0,138,96,.18); border: 2px solid rgba(0,138,96,.6); transform: scale(0); transition: transform .8s cubic-bezier(.2,.9,.3,1.2) .9s; }
.map .pin { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -14px 0 0 -7px; border-radius: 50% 50% 50% 0; background: #0b0b0b; transform: rotate(-45deg) translateY(-60px); opacity: 0; transition: transform .5s cubic-bezier(.3,1.4,.5,1) .4s, opacity .2s .4s; }
.scene.active .map .ring, .player:not(.js) .map .ring { transform: scale(1); }
.scene.active .map .pin, .player:not(.js) .map .pin { transform: rotate(-45deg) translateY(0); opacity: 1; }

/* 進場動畫：元素用 --i 排隊出現 */
.pop { opacity: 0; transform: translateY(8px); }
.scene.active .pop, .player:not(.js) .pop { animation: pop .45s ease both; animation-delay: calc(var(--i, 0) * .55s + .15s); }
@keyframes pop { to { opacity: 1; transform: none; } }
.fade-out { transition: opacity .4s ease 2.6s, max-height .4s ease 2.6s; }
.scene.active .fade-out { opacity: 0; }
.shimmer { background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.cursor { position: absolute; width: 18px; height: 18px; pointer-events: none; opacity: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.scene.active .cursor { animation: cursor 1.6s ease .6s both; }
@keyframes cursor { 0% { opacity: 0; transform: translate(60px, 60px); } 30% { opacity: 1; } 70% { transform: translate(0, 0); } 80% { transform: translate(0, 0) scale(.85); } 100% { opacity: 1; transform: translate(0, 0); } }
.typing::after { content: "|"; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* 指令與清單 */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.card h3 { font-size: 17px; margin-bottom: 10px; }
.card ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); display: grid; gap: 6px; }
.card li b { color: var(--ink); }
.cmds { width: 100%; border-collapse: collapse; font-size: 15px; }
.cmds th, .cmds td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--ink-2); }
.cmds th { color: var(--ink); background: var(--surface-2); }
.cmds td:first-child { color: var(--ink); font-weight: 700; white-space: nowrap; }
.cmds code { font-family: inherit; background: var(--surface-2); padding: 2px 8px; border-radius: 8px; color: var(--ink); font-weight: 700; }
.closing { text-align: center; padding: 40px 20px 72px; }
.closing h2 { font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -0.02em; font-weight: 800; }
.closing p { margin-top: 10px; color: var(--ink-2); }
.closing .cta { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

footer { border-top: 1px solid var(--border); }
.foot { padding-top: 32px; padding-bottom: 48px; display: grid; grid-template-columns: 1fr auto; gap: 16px 32px; color: var(--muted); font-size: 14px; }
.foot-co { display: grid; gap: 2px; }
.foot-co b { color: var(--ink); }
.foot a { color: var(--ink-2); text-decoration: none; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-content: start; }
.foot-note { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .player, .two, .foot { grid-template-columns: 1fr; }
  .stage { min-height: 400px; }
  .scene { padding: 16px 12px 40px; }
  .frame.web { grid-template-columns: 1fr; min-height: 0; }
  .wside { display: none; }
  .wmain { min-width: 0; }
  .wbtn { white-space: normal; }
  .chapter { padding-top: 40px; }
  .chapters { top: 64px; }
  .hide-sm { display: none; }
  .cmds td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .scene.active .pop, .player:not(.js) .pop { animation: none; opacity: 1; transform: none; }
  .scene.active .cursor { animation: none; opacity: 1; }
  .shimmer { animation: none; }
  .map .ring, .map .pin, .wbar i, .wtoggle, .wtoggle::after { transition: none; }
}
