/* 隨地考駕照官網：跟 App 同一套語言。斜角、黑粗線、斜體窄數字，主角是小燈和 App 實機影片。 */
:root {
  --orange: #ed6431;
  --ink: #1a1a1a;
  --cream: #fffbf0;
  --block: #fcefd4;
  --track: #f0e5cd;
  --yellow: #ffd60a;
  --sub: #6f6759;
  --good: #0f8a4b;
  --bad: #cf1f1b;
  --mascot: #1a1a1a;
  --glyph: #fffbf0;
  --ball: #ed6431;
  --eye-go: #2ee08a;
  --eye-wait: #ffd60a;
  --eye-stop: #ff4b3e;
  --eye-socket: #1a1a1a;
  --cut: 14px;
  --parallelogram: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
  --bar: var(--ink);
  --hud: calc(48px + env(safe-area-inset-top, 0px));
  --snap: cubic-bezier(0.16, 1, 0.3, 1);
  --body: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --num: "Barlow Condensed", "Noto Sans TC", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--orange); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-weight: 500; line-height: 1.5; overflow-x: clip; }
h1, h2, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h2 { font-size: clamp(34px, 9.4vw, 64px); font-style: italic; font-weight: 900; line-height: 1.18; letter-spacing: 0.01em; text-wrap: balance; }
.num { font-family: var(--num); font-style: italic; font-weight: 800; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.on-dark { --mascot: #4a453c; --ball: #ffd60a; --sub: #b8af9e; --block: #2b2824; }
.orange { --mascot: #1a1a1a; --ball: #ffd60a; background: var(--orange); color: var(--cream); }
.cream { background: var(--cream); }
.dark { --bar: #282520; background: #141311; color: var(--cream); }
.mascot { display: block; width: 100%; height: auto; overflow: visible; }
.m-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.2s linear infinite; }
.m-mark { transform-box: fill-box; transform-origin: center; animation: mark-pop 300ms cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.act-pop { animation: act-pop 340ms cubic-bezier(0.3, 1.5, 0.5, 1); }
.act-jump { animation: act-jump 460ms cubic-bezier(0.3, 1.4, 0.5, 1); }
.act-shake { animation: act-shake 420ms ease-in-out; }
[data-mascot] { display: block; transform-origin: 50% 90%; }
.brand-word { display: block; aspect-ratio: 3908 / 775; background: currentColor; -webkit-mask: url("../img/word.svg") center / contain no-repeat; mask: url("../img/word.svg") center / contain no-repeat; }
@keyframes blink { 0%, 95%, 100% { transform: none; } 97.5% { transform: scaleY(0.1); } }
@keyframes mark-pop { from { opacity: 0; transform: scale(0.3); } }
@keyframes act-pop { 0% { transform: scale(0.94, 1.08); } 60% { transform: scale(1.05, 0.96); } }
@keyframes act-jump { 30% { transform: translateY(-16%) scale(0.95, 1.07); } 60% { transform: translateY(0) scale(1.09, 0.9); } 80% { transform: translateY(-4%); } }
@keyframes act-shake { 20% { transform: translateX(-4%) rotate(-5deg); } 40% { transform: translateX(4%) rotate(5deg); } 60% { transform: translateX(-3%) rotate(-3deg); } 80% { transform: translateX(2%) rotate(2deg); } }

/* 開場是全站唯一固定畫面的段落：外層給捲動長度，裡面的舞台黏在畫面上。 */
.chapter { position: relative; height: calc(var(--len, 300) * 1svh); }
.stage { position: sticky; top: 0; height: 100svh; overflow: hidden; padding: calc(var(--hud) + 18px) max(20px, env(safe-area-inset-right, 0px)) 24px max(20px, env(safe-area-inset-left, 0px)); }
.streaks { position: absolute; inset: 0; background: linear-gradient(112deg, transparent 58%, rgb(255 255 255 / 9%) 58% 70%, transparent 70% 74%, rgb(255 255 255 / 9%) 74% 77%, transparent 77%); animation: streak-drift 11s ease-in-out infinite alternate; }
@keyframes streak-drift { to { transform: translateX(-7%); } }

/* 頂端進度列 */
.hud { position: fixed; inset: 0 0 auto; z-index: 40; display: flex; align-items: center; gap: 10px; height: var(--hud); padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); background: var(--ink); color: var(--cream); }
.hud-home { display: none; width: 132px; flex-shrink: 0; }
.hud-road { position: relative; flex: 1; min-width: 0; height: 36px; }
.hud-track { position: absolute; inset: auto 16px 4px 0; display: block; height: 8px; overflow: hidden; background: #3a362f; transform: skewX(-18deg); -webkit-mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); mask: repeating-linear-gradient(90deg, #000 0 9px, transparent 9px 12px); }
.hud-fill { display: block; width: 100%; height: 100%; background: var(--orange); transform: scaleX(0); transform-origin: left; }
.hud-rider { position: absolute; bottom: 7px; left: 0; width: 34px; }
.hud-count { flex-shrink: 0; font-size: 20px; line-height: 1; color: var(--yellow); }
.hud-count small { margin-left: 2px; font-size: 0.68em; color: #b8af9e; }
.hud-count.is-pass { color: var(--eye-go); }
.hud-sound { position: relative; width: 34px; height: 34px; flex-shrink: 0; }
.hud-sound i { position: absolute; inset: 9px; background: #b8af9e; clip-path: polygon(0 32%, 28% 32%, 62% 0, 62% 100%, 28% 68%, 0 68%); }
.hud-sound::after { content: ""; position: absolute; right: 5px; top: 11px; width: 7px; height: 12px; border: 2px solid transparent; border-right-color: #6f6759; border-radius: 50%; }
.hud-sound[aria-pressed="true"] i { background: var(--yellow); }
.hud-sound[aria-pressed="true"]::after { border-right-color: var(--yellow); }

/* 開場起跑燈 */
.curtain { position: fixed; inset: 0; z-index: 60; overflow: hidden; pointer-events: none; background: var(--orange); transition: background-color 0ms linear 0ms; }
.curtain.is-off { background: transparent; }
.cw { position: absolute; inset: 0 -40%; transform: skewX(-16deg); }
.cw-1 { background: var(--yellow); }
.cw-2 { background: var(--ink); }
.cw-3 { background: var(--orange); }
.curtain-face { position: absolute; top: 50%; left: 50%; width: 132px; margin: -66px 0 0 -66px; }
.curtain-face .m-lamp { animation: lamp-cycle 780ms steps(1, end) both; }
@keyframes lamp-cycle { 0% { fill: var(--eye-stop); } 33% { fill: var(--eye-wait); } 66%, 100% { fill: var(--eye-go); } }

/* 開場 */
.hero-inner { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(8px, 2svh, 22px); height: 100%; text-align: center; }
.hero-brand { width: min(80vw, 30rem); }
.hero-word { transform: skewX(-8deg); }
.hero-art { width: min(82vw, 26rem); }
.hero-lead { font-size: clamp(36px, 10.4vw, 72px); font-style: italic; font-weight: 900; line-height: 1.16; }
.hero-sub { margin-top: 6px; font-size: 15px; font-weight: 700; }
.hero-hint { position: absolute; right: 0; bottom: 14px; left: 0; font-size: 13px; font-weight: 700; text-align: center; animation: hint 1.4s ease-in-out infinite; }
@keyframes hint { 50% { transform: translateY(5px); } }
.hero-wipe { position: absolute; inset: -12% -4% -4%; z-index: 3; background: var(--cream); clip-path: polygon(0 9%, 100% 0, 100% 100%, 0 100%); transform: translateY(112%); }
/* 商店按鈕用 Apple、Google 的官方徽章，照兩家規範不改圖、不自己畫 logo。 */
.stores { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; margin-top: 14px; }
.stores.is-soon::after { content: "即將上架"; flex-basis: 100%; font-size: 13px; font-weight: 700; text-align: center; opacity: 0.85; }
.store { display: block; transition: transform 140ms var(--snap), filter 140ms ease; -webkit-tap-highlight-color: transparent; }
.store img { display: block; width: auto; height: 48px; }
.store:hover { transform: translateY(-2px); }
.store:active, .store.is-nope { transform: translateY(1px) scale(0.97); filter: brightness(1.2); transition-duration: 45ms; }

/* 段落：一般往下捲，字在上、手機影片在下；桌機左右排，左右交錯。 */
.scene { position: relative; overflow: clip; }
.scene-inner { position: relative; display: flex; flex-direction: column; gap: 22px; max-width: 72rem; margin-inline: auto; padding-block: calc(var(--hud) + 30px) 48px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.scene-copy { display: grid; gap: 10px; min-width: 0; }
.kicker { justify-self: start; padding: 3px 14px; background: var(--ink); color: var(--yellow); font-size: 14px; font-weight: 900; clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%); }
.on-dark .kicker { background: var(--yellow); color: var(--ink); }
.lead { max-width: 30em; font-size: 17px; font-weight: 700; line-height: 1.65; color: var(--sub); }
/* 段落清單就是影片的章節：播到哪段哪段反黑、底下跑進度，點一下影片跳過去。 */
.chapters { display: grid; gap: 6px; margin-top: 4px; }
.chapters li { position: relative; overflow: hidden; padding: 10px 22px 12px 40px; background: var(--block); font-size: 16px; font-weight: 900; line-height: 1.35; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); transition: background-color 160ms ease, color 160ms ease, transform 120ms var(--snap); -webkit-tap-highlight-color: transparent; }
.chapters li::before { content: ""; position: absolute; top: 50%; left: 14px; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--dot); }
.chapters li i { position: absolute; right: 0; bottom: 0; left: 0; height: 4px; background: var(--dot); transform: scaleX(var(--p, 0)); transform-origin: left; will-change: transform; }
.chapters.is-live li { cursor: pointer; }
.chapters li[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.on-dark .chapters li[aria-pressed="true"] { background: var(--cream); color: var(--ink); }
.orange .lead { color: rgb(255 251 240 / 88%); }
.orange .chapters li { background: rgb(0 0 0 / 14%); }
.orange .chapters li[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.orange .phone { box-shadow: 10px 10px 0 rgb(0 0 0 / 18%); }
.chapters.is-live li:active { transform: translateX(4px); transition-duration: 40ms; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.stats li { display: grid; min-width: 86px; padding: 8px 16px; background: var(--ink); color: var(--cream); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.on-dark .stats li { background: #2b2824; }
.stats b { font-size: 40px; line-height: 1; color: var(--yellow); }
.stats span { font-size: 12px; font-weight: 700; }

/* 手機外框：高度跟著螢幕走，黏在上面的章節條和整支手機要能同時在一個畫面裡。 */
.scene { --chaps: 0px; }
.scene:has(.chapters) { --chaps: 84px; }
.scene-phone { position: relative; justify-self: center; align-self: center; width: clamp(220px, calc((100svh - var(--hud) - var(--chaps) - 16px) * 390 / 844), min(76vw, 320px)); }
.phone { position: relative; width: 100%; aspect-ratio: 390 / 844; overflow: hidden; border: 7px solid var(--ink); border-radius: 30px; background: var(--ink); box-shadow: 10px 10px 0 rgb(0 0 0 / 14%); }
.dark .phone { border-color: #3a362f; box-shadow: none; }
.clip { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; background: var(--cream); }
.buddy { position: absolute; bottom: -10px; left: -14%; z-index: 2; width: 34%; --mascot: #1a1a1a; filter: drop-shadow(3px 0 0 #fffbf0) drop-shadow(-3px 0 0 #fffbf0) drop-shadow(0 3px 0 #fffbf0) drop-shadow(0 -3px 0 #fffbf0); }
.scene:nth-of-type(odd) .buddy { right: -14%; left: auto; }

/* 終點 */
.finish { position: relative; padding-top: 28px; text-align: center; }
.checker { display: block; height: 28px; background: conic-gradient(#1a1a1a 25%, #fffbf0 0 50%, #1a1a1a 0 75%, #fffbf0 0) 0 0 / 28px 28px; }
.finish-inner { display: grid; justify-items: center; gap: 22px; padding: 34px 20px 44px; }
.finish-count { font-size: clamp(64px, 20vw, 130px); line-height: 0.9; }
.finish-count small { font-size: 0.42em; opacity: 0.8; }
.finish-art { width: min(72vw, 24rem); margin-top: 8px; cursor: pointer; }
.finish .stores { margin-top: 6px; }
.foot { padding: 18px max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); background: var(--ink); color: #b8af9e; font-size: 12px; line-height: 1.7; }
.foot a { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }
.fx-canvas { position: fixed; inset: 0; z-index: 50; width: 100%; height: 100%; pointer-events: none; }

/* 手機：章節縮成一條跟頂端 HUD 同色的分段進度列，下面只寫現在播的那段，放在影片下方。
   手機還沒整支露出來時，進度列先黏在畫面底部，看影片也看得到講到哪。 */
@media (max-width: 899px) {
  .scene-inner { gap: 10px; }
  .scene-copy { display: contents; }
  .scene-phone { order: 1; }
  .chapters { --n: 2; order: 2; position: sticky; bottom: 0; z-index: 5; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: 22px auto; gap: 4px 6px; margin: 0 -20px; padding: 8px 20px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--bar); color: var(--cream); }
  .chapters:has(> li:nth-child(3)) { --n: 3; }
  .scene .chapters li, .scene .chapters li[aria-pressed] { display: contents; color: inherit; }
  .chapters li::before { content: none; }
  .chapters li i { grid-row: 1; position: relative; inset: auto; height: auto; background: none; transform: none; will-change: auto; }
  .chapters li i::before { content: ""; position: absolute; inset: 7px 0; background: linear-gradient(90deg, var(--dot) calc(var(--p, 0) * 100%), rgb(255 255 255 / 16%) 0); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
  .chapters li[data-past] i::before { background: var(--dot); }
  .chapters li span { grid-row: 2; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; font-weight: 900; line-height: 1.5; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(5px); pointer-events: none; transition: opacity 180ms ease, transform 220ms var(--snap), visibility 0s linear 220ms; }
  .chapters li span::before { content: ""; flex-shrink: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--dot); }
  .chapters li[aria-pressed="true"] span { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .chapters.is-live li:active { transform: none; }
  .ce-on .chapters { position: static; }
  .ce-on .chapters li span { grid-row: auto; opacity: 1; visibility: visible; transform: none; white-space: normal; pointer-events: auto; }
  .scene-phone { margin-top: 6px; }
}

/* 短螢幕：手機拿掉一些裝飾，文字才不會被擠掉。 */
@media (max-height: 700px) {
  .hero-sub { display: none; }
  .hero-art { width: min(62vw, 20rem); }
}

@media (min-width: 900px) {
  .hud-home { display: block; }
  .scene-inner { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center; gap: 64px; min-height: 100svh; padding-inline: 48px; }
  .scene:nth-of-type(odd) .scene-copy { order: 2; }
  .scene-phone { width: auto; height: min(80svh, 700px); aspect-ratio: 390 / 844; }
  .phone { height: 100%; width: auto; }
  .lead { font-size: 19px; }
  .chapters li { padding-block: 12px 14px; font-size: 18px; }
  .buddy { width: 42%; left: -24%; }
  .scene:nth-of-type(odd) .buddy { right: -24%; }
}

@media (prefers-reduced-motion: reduce) {
  .streaks, .hero-hint, .m-eyes, .act-pop, .act-jump, .act-shake { animation: none !important; }
}

/* 減少動態或沒有 JS 時，開場直接攤開。 */
.is-static .chapter { height: auto; }
.is-static .stage { position: relative; height: auto; min-height: 100svh; }
.is-static .hero-wipe, .is-static .hero-hint { display: none; }

/* 隱私權政策頁 */
.legal-page { background: var(--cream); }
.legal-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; height: var(--hud); padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); background: var(--ink); color: var(--cream); }
.legal-home { display: block; width: 132px; }
.legal { display: grid; gap: 26px; max-width: 42rem; margin-inline: auto; padding-block: 36px 56px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.legal h1 { font-size: clamp(34px, 9vw, 52px); font-style: italic; font-weight: 900; line-height: 1.15; }
.legal-date { margin-top: -18px; font-size: 14px; font-weight: 700; color: var(--sub); }
.legal-sum { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--ink); color: var(--cream); font-size: 17px; font-weight: 700; line-height: 1.6; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%); }
.legal-face { width: 56px; flex-shrink: 0; --mascot: #4a453c; }
.legal section { display: grid; gap: 8px; }
.legal h2 { padding-top: 10px; border-top: 4px solid var(--ink); font-size: 20px; font-style: italic; font-weight: 900; line-height: 1.3; }
.legal p, .legal li { font-size: 16px; line-height: 1.75; }
.legal ul { display: grid; gap: 8px; }
.legal li { position: relative; padding-left: 20px; }
.legal li::before { content: ""; position: absolute; top: 0.68em; left: 2px; width: 8px; height: 8px; background: var(--orange); transform: skewX(-14deg); }
.legal a { color: var(--orange); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
