/* 故事模式（官網與產品網站共用）：像看一部短片，不是開一張卡片。
   城市保持全螢幕；旁白直接疊在畫面下方（大時間碼＋一句話），章節是一條真的時間軸。
   不用浮動白卡、App 圖示、分頁籤、膠囊按鈕。 */
.story { position: absolute; inset: 0; z-index: 3; pointer-events: none; color: var(--ink); --st-bg: oklch(0.16 0.01 260); }
html[data-theme="paper"] .story { --st-bg: oklch(0.985 0.002 85); }
.story[hidden] { display: none; }
.story-scrim::before { content: ""; position: absolute; inset: 0 0 auto; height: 120px; background: linear-gradient(180deg, color-mix(in oklch, var(--st-bg) 94%, transparent) 0, color-mix(in oklch, var(--st-bg) 70%, transparent) 55%, color-mix(in oklch, var(--st-bg) 0%, transparent) 100%); }   /* 上方淡底色：Logo 與離開故事看得清楚 */
.story > * { pointer-events: auto; }
.story-scrim { position: absolute; inset: 0; pointer-events: none !important; background: linear-gradient(0deg, var(--st-bg) 0%, color-mix(in oklch, var(--st-bg) 94%, transparent) 36%, color-mix(in oklch, var(--st-bg) 0%, transparent) 70%); animation: st-fade 700ms ease both; }
.story-head { position: absolute; left: var(--pad-x); right: var(--pad-x); top: 0; height: 76px; display: flex; align-items: center; justify-content: flex-end; gap: var(--s-4); }
.story-kick { font-weight: 700; font-size: 15px; color: var(--ink-2); margin-bottom: var(--s-3); }
.story-kick b { color: var(--ink); }
.story-x { min-height: 44px; padding: 0 16px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; color: var(--ink); border-radius: 999px; background: color-mix(in oklch, var(--st-bg) 88%, transparent); box-shadow: 0 6px 18px -8px oklch(0 0 0 / .35), inset 0 0 0 1px var(--rule); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }   /* 有底色，城市上也看得清楚 */
.story-x span { text-decoration: none; }
.story-x:hover { box-shadow: 0 6px 18px -8px oklch(0 0 0 / .35), inset 0 0 0 1.5px var(--ink); }
.story-x svg { width: 18px; height: 18px; }
.story-body { position: absolute; left: var(--pad-x); right: var(--pad-x); bottom: 112px; display: grid; grid-template-columns: minmax(0, 34em) auto; justify-content: space-between; align-items: end; gap: var(--s-7); }
.story-body.swap .story-time { animation: st-tc 600ms var(--ease) both; }
.story-body.swap .story-h, .story-body.swap .story-p { animation: st-up 650ms var(--ease) 80ms both; }
.story-body.swap .story-vis { animation: st-up 650ms var(--ease) 220ms both; }
.story-time { font-weight: 700; font-size: clamp(3rem, min(7vw, 11vh), 6.5rem); line-height: .9; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--hi); }
html[data-theme="paper"] .story-time { color: var(--ink); }
.story-h { font-size: clamp(1.6rem, min(2.8vw, 4.6vh), 2.6rem); line-height: 1.25; margin-top: var(--s-4); }
.story-p { margin-top: var(--s-3); color: var(--ink-2); font-size: var(--t-lg); line-height: 1.6; max-width: 28em; }
.story-vis { justify-self: end; max-width: 380px; }
/* 時間軸：08:00 ───●─── 17:30，刻度照實際時間比例排 */
.story-foot { position: absolute; left: var(--pad-x); right: var(--pad-x); bottom: 28px; display: flex; align-items: center; gap: var(--s-5); }
.story-steps { list-style: none; position: relative; flex: 1; height: 52px; margin: 0 28px; }
.story-steps::before, .story-steps::after { content: ""; position: absolute; left: 0; top: 13px; height: 2px; background: var(--rule); right: 0; }
.story-steps::after { background: var(--ink); right: auto; width: calc(var(--p, 0) * 100%); transition: width 900ms var(--ease); }
.story-steps li { position: absolute; top: 0; left: calc(var(--at) * 100%); transform: translateX(-50%); }
.story-steps button { display: grid; justify-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 6px 4px 0; font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.story-steps button::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--st-bg); box-shadow: inset 0 0 0 2px var(--ink-2); transition: transform 300ms var(--ease), background-color 300ms; }
/* 兩個刻度太近（11:12 和 11:30）：後一個的時間寫在線上方 */
.story-steps li.up { top: -26px; }
.story-steps li.up button { grid-template-rows: auto auto; padding-top: 0; }
.story-steps li.up button::before { order: 2; }
.story-steps button.done::before { background: var(--ink); box-shadow: none; }
.story-steps button[aria-current="step"] { color: var(--ink); }
.story-steps button[aria-current="step"]::before { background: var(--hi); box-shadow: 0 0 0 4px color-mix(in oklch, var(--hi) 30%, transparent); transform: scale(1.3); }
.story-prev, .story-next { min-height: 48px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.story-prev { width: 48px; justify-content: center; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ink); }
.story-prev svg { width: 18px; height: 18px; }
.story-prev[disabled] { opacity: .3; cursor: default; }
.story-next { padding: 0 var(--s-5); border-radius: 999px; background: var(--btn); color: var(--btn-ink); }
.story-next::after { content: "→"; }
@keyframes st-fade { from { opacity: 0; } }
@keyframes st-up { from { opacity: 0; transform: translateY(16px); } }
@keyframes st-tc { from { opacity: 0; transform: translateY(24px); filter: blur(6px); } }

/* 每一幕的小東西：直接放在畫面上，不另外框起來 */
.sv-devs { display: flex; align-items: flex-end; gap: var(--s-5); }
.sv-devs img { height: clamp(110px, 20vh, 180px); width: auto; }
.sv-devs { padding-bottom: 10px; background: radial-gradient(ellipse 46% 9% at 50% 94%, oklch(0 0 0 / .16), transparent 70%); }   /* 照片下方一層淡淡的地面陰影（不用 filter，避免被捲動框切成方塊） */
.sv-big { font-weight: 700; font-size: clamp(3rem, 6vw, 5rem); line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.sv-big small { display: block; font-size: 15px; color: var(--ink-2); margin-top: 8px; letter-spacing: 0; }
.sv-big .ok { color: oklch(0.72 0.15 150); }
html[data-theme="paper"] .sv-big .ok { color: oklch(0.5 0.13 150); }
/* 鎖定畫面通知：老師手機上真的會跳出來的樣子 */
.sv-alert { width: 320px; border-radius: 18px; padding: 12px 14px; background: oklch(0.98 0.004 85 / .96); color: oklch(0.2 0.012 80); box-shadow: 0 20px 40px -16px oklch(0 0 0 / .5); display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 10px; font-size: 14px; line-height: 1.4; }
.sv-alert i { grid-row: span 2; width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #F2A516, #D9690B); }
.sv-alert b { font-weight: 700; }
.sv-alert time { font-size: 12px; color: oklch(0.5 0.01 80); }
.sv-alert span { grid-column: 2 / -1; color: oklch(0.45 0.17 28); font-weight: 600; }
.sv-roll { list-style: none; display: grid; grid-template-columns: repeat(3, auto); gap: 4px 20px; font-size: 15px; }
.sv-roll li { display: flex; gap: 8px; }
.sv-roll li em { font-style: normal; color: var(--ink-2); width: 1em; }
.sv-roll li.in em { color: oklch(0.72 0.15 150); }
html[data-theme="paper"] .sv-roll li.in em { color: oklch(0.5 0.13 150); }
.sv-sum { margin-top: var(--s-3); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.sv-stats { display: flex; gap: var(--s-6); }
.sv-stats b { display: block; font-size: clamp(2.4rem, 4.4vw, 3.6rem); line-height: 1; font-variant-numeric: tabular-nums; }
.sv-stats span { font-size: 14px; color: var(--ink-2); }
.sv-cta { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-5); align-items: center; }
.sv-cta .btn { min-height: 48px; }
.sv-pile { position: relative; height: 150px; width: 240px; }
.sv-pile span { position: absolute; left: 20px; top: 10px; width: 96px; height: 120px; background: #fff; border-radius: 3px; box-shadow: 0 10px 22px -10px oklch(0 0 0 / .55);
  background-image: linear-gradient(oklch(0.85 0.005 85), oklch(0.85 0.005 85)), linear-gradient(oklch(0.9 0.005 85), oklch(0.9 0.005 85)), linear-gradient(oklch(0.9 0.005 85), oklch(0.9 0.005 85));
  background-size: 60% 6px, 70% 4px, 50% 4px; background-position: 14px 16px, 14px 34px, 14px 46px; background-repeat: no-repeat; }
.sv-pile span:nth-child(1) { transform: rotate(-12deg) translateX(-6px); } .sv-pile span:nth-child(2) { transform: rotate(-4deg) translateX(30px); } .sv-pile span:nth-child(3) { transform: rotate(6deg) translateX(66px); } .sv-pile span:nth-child(4) { transform: rotate(14deg) translateX(104px); }
.sv-chips { display: flex; gap: var(--s-5); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.01em; }
.sv-chips span + span::before { content: "/"; color: var(--ink-2); margin-right: var(--s-5); font-weight: 400; }
.sv-ocr { display: grid; grid-template-columns: auto 1fr; gap: var(--s-5); align-items: center; }
.sv-ocr dl { min-width: 190px; }
.sv-ocr dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding: 4px 0; opacity: .2; transition: opacity 400ms var(--ease); }
.sv-ocr dl dt { font-size: 13px; color: var(--ink-2); } .sv-ocr dl dd { font-weight: 800; font-variant-numeric: tabular-nums; }
.sv-ocr.read dl div { opacity: 1; } .sv-ocr.read dl div:nth-child(2) { transition-delay: 150ms; } .sv-ocr.read dl div:nth-child(3) { transition-delay: 300ms; }
.sv-ocr.read .inv .f::after { opacity: 1; }
.sv-csv { min-width: 300px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.sv-csv th { text-align: left; color: var(--ink-2); font-weight: 700; border-bottom: 2px solid var(--ink); padding: 6px 10px 6px 0; }
.sv-csv td { border-bottom: 1px solid var(--rule); padding: 6px 10px 6px 0; }
.sv-csv td:last-child { color: oklch(0.72 0.15 150); font-weight: 700; }
html[data-theme="paper"] .sv-csv td:last-child { color: oklch(0.5 0.13 150); }
.sv-note { font-size: 12px; color: var(--ink-2); margin-top: var(--s-2); }

@media (max-width: 960px) {
  .story-scrim { background: linear-gradient(0deg, var(--st-bg) 0%, var(--st-bg) 50%, color-mix(in oklch, var(--st-bg) 0%, transparent) 64%); }
  .story-kick { font-size: 13px; margin-bottom: var(--s-2); }
  .story-body { padding-bottom: 12px; bottom: 96px; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); max-height: 50dvh; overflow-y: auto; align-content: start; }
  .sv-ocr { gap: var(--s-4); }
  .sv-ocr .einv { --ei-w: 128px; }
  .sv-ocr dl { min-width: 0; }
  .sv-csv { min-width: 0; width: 100%; font-size: 13px; }
  .story-vis { justify-self: start; }
  .story-time { font-size: 2.8rem; }
  .story-h { font-size: 1.45rem; margin-top: var(--s-2); }
  .story-p { font-size: var(--t-base); }
  .story-foot { bottom: 16px; gap: var(--s-3); }
  .story-steps { margin: 0 18px; }
  .story-steps button { font-size: 0; min-width: 32px; }   /* 手機：只留刻度點，時間看大時間碼 */
  .story-steps li, .story-steps li.up { top: 0; left: calc(var(--even) * 100%); }
  .story-steps li.up button { grid-template-rows: none; padding-top: 6px; }
  .story-steps li.up button::before { order: 0; }
  .story-steps::after { width: calc(var(--pe, 0) * 100%); }
  .story-next { padding: 0 var(--s-4); }
  .sv-devs img { height: 76px; }
  .sv-alert { width: 100%; max-width: 320px; }
  .sv-big { font-size: 2.6rem; }
  .sv-roll { grid-template-columns: repeat(3, auto); font-size: 14px; }
}

/* ---------- 電子發票證明聯（熱感紙）----------
   寬度用 --ei-w 控制，字級跟著寬度等比例縮放（真實證明聯 5.7cm 寬 × 約 9cm 高）。 */
.einv { --ei-w: 230px; --ei-ink: oklch(0.26 0.006 80); width: var(--ei-w); font-size: calc(var(--ei-w) / 19); line-height: 1.32; color: var(--ei-ink); position: relative; overflow: hidden;
  padding: 1.3em 1.15em 1.1em; text-align: left; font-family: "Noto Sans TC", system-ui, sans-serif; font-weight: 500; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, oklch(0.975 0.004 90) 0%, oklch(0.99 0.002 90) 18%, oklch(0.985 0.003 90) 70%, oklch(0.955 0.006 85) 100%);
  box-shadow: 0 1px 0 oklch(1 0 0 / .8) inset, 0 28px 40px -24px var(--shadow, oklch(0 0 0 / .5)), 0 2px 5px oklch(0 0 0 / .12); transform: rotate(-2.5deg); }
.einv::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5; mix-blend-mode: multiply;   /* 熱感紙的微小顆粒與一點捲曲陰影 */
  background: radial-gradient(120% 60% at 100% 0%, oklch(0 0 0 / .06), transparent 60%), repeating-linear-gradient(0deg, oklch(0 0 0 / .018) 0 1px, transparent 1px 3px); }
.einv p { margin: 0; }
.einv .ei-shop { text-align: center; font-weight: 700; font-size: 1.05em; letter-spacing: .1em; margin-bottom: .45em; }
.einv .ei-t { text-align: center; font-weight: 900; font-size: 1.5em; letter-spacing: .06em; line-height: 1.2; }
.einv .ei-big { text-align: center; font-weight: 900; font-size: 1.62em; line-height: 1.18; letter-spacing: .02em; font-family: "Noto Sans TC", ui-monospace, monospace; }
.einv .ei-row { display: flex; justify-content: space-between; gap: .6em; white-space: nowrap; margin-top: .25em; }
.einv .ei-big + .ei-row { margin-top: .55em; }
.einv .ei-bar { display: block; width: 100%; height: 2.6em; margin-top: .7em; fill: var(--ei-ink); }
.einv .ei-qrs { display: flex; justify-content: space-between; margin-top: .7em; }
.einv .ei-qr { width: 44%; height: auto; fill: var(--ei-ink); }
.einv .f { position: relative; }
.einv .f::after { content: ""; position: absolute; inset: -.18em -.12em; border: 2px solid var(--scan, oklch(0.55 0.17 258)); border-radius: 4px; opacity: 0; transition: opacity 250ms ease; }
.read .einv .f::after { opacity: 1; }
.read .einv .ei-row:nth-of-type(6) .f::after { transition-delay: 120ms; } .read .einv .ei-row:nth-of-type(7) .f::after { transition-delay: 240ms; }
.einv .beam { position: absolute; left: 0; right: 0; top: -40px; height: 40px; background: linear-gradient(180deg, transparent, oklch(0.55 0.17 258 / 0.22)); border-bottom: 2px solid var(--scan, oklch(0.55 0.17 258)); opacity: 0; }
.scan .einv .beam { animation: beam 1100ms var(--ease) forwards; }
@keyframes beam { 0% { top: -40px; opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
/* 收據（不是統一發票的單據） */
.einv.receipt .ei-t { font-size: 1.4em; }
.sv-ocr .einv { --ei-w: 168px; }

/* 城市裡的劇情標籤：貼在公車、老師、學生、會計部旁邊，跟著鏡頭移動；照劇情時間點出現 */
.st-marks { position: absolute; inset: 0; pointer-events: none !important; overflow: hidden; }
.st-mark { position: absolute; left: 0; top: 0; will-change: translate; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; padding: 6px 12px; border-radius: 10px; font-size: 14px; font-weight: 700; line-height: 1.3;
  background: oklch(0.99 0.004 85); color: oklch(0.2 0.012 80); box-shadow: 0 10px 24px -10px oklch(0 0 0 / .55); animation: st-pop 450ms var(--ease) var(--d, 0ms) both; }
.st-mark::after { content: ""; position: absolute; left: 50%; bottom: -12px; width: 2px; height: 12px; background: inherit; transform: translateX(-50%); }
.st-mark.ok { background: oklch(0.95 0.05 150); color: oklch(0.36 0.11 150); }
.st-mark.alert { background: #fff1f0; color: oklch(0.45 0.18 28); box-shadow: 0 0 0 2px oklch(0.6 0.2 28 / .5), 0 10px 24px -10px oklch(0 0 0 / .55); }
@keyframes st-pop { from { opacity: 0; transform: translate(-50%, calc(-100% - 2px)) scale(.9); } }
body.in-story .toast { display: none; }   /* 故事裡用劇情標籤，不用首頁的提醒 */
@media (max-width: 960px) { .st-mark { font-size: 12px; padding: 4px 9px; } }
