:root {
  --page: #E9E6F0; --bg: #F4F0FB; --card: #FFFFFF; --ink: #2B2540; --muted: #6F6788; --line: #ECE7F6; --future: #A8A1BC;
  --accent: #6A4FD0; --accent-soft: #EEE8FD; --on-accent: #FFFFFF;
  --mint: #D9F2E6; --mint-ink: #1F5A41; --mint-deco: #9FD9BF; --pink: #FFE3EA; --pink-ink: #7A2742;
  --squiggle: #FF9E6B; --warn-bg: #FFF4D6; --warn-ink: #7A5200;
  --font: "jf-openhuninn", "Huninn", "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --r-card: 24px; --r-row: 18px; --r-pill: 999px; --tap: 44px;
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); line-height: 1.6; font-size: 15px; }
.wrap { max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--bg); padding: 20px 16px calc(28px + env(safe-area-inset-bottom)); }
h1, h2, h3, b, strong { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.press { transition: transform .12s var(--ease), background-color .2s, box-shadow .2s; }
.press:active { transform: scale(.97); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.view { display: none; animation: up .4s var(--ease) both; }
.view.on { display: block; }
@keyframes up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.primary { border: 0; border-radius: var(--r-row); background: var(--accent); color: var(--on-accent); min-height: var(--tap); padding: 0 20px; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); cursor: pointer; }
.primary.big { width: 100%; min-height: 52px; font-size: 17px; }
.primary:disabled { opacity: .45; box-shadow: none; cursor: default; }
.ghost { border: 0; background: var(--card); width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.ghost svg { width: 22px; height: 22px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.card { background: var(--card); border-radius: var(--r-card); padding: 18px; margin-top: 14px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }

/* 首頁 */
.hero { text-align: center; padding: 18px 4px 6px; }
.hero .pill { display: table; margin: 0 auto; }
.hero h1 { position: relative; display: inline-block; margin: 12px 0 6px; font-size: 44px; letter-spacing: .04em; }
.squiggle { position: absolute; left: 50%; bottom: -4px; width: 64px; height: 12px; transform: translateX(-50%); stroke: var(--squiggle); stroke-width: 3; }
.lead { margin: 10px 0 18px; color: var(--muted); font-size: 16px; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.levels { list-style: none; margin: 20px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lv { position: relative; background: var(--card); border-radius: var(--r-card); padding: 12px 12px 14px; overflow: hidden; animation: up .5s var(--ease) both; }
.lv img { display: block; width: 76px; height: 64px; object-fit: contain; margin: 0 auto 4px; }
.lv .n { position: absolute; top: 10px; left: 12px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-pill); padding: 1px 8px; }
.lv b { display: block; font-size: 15px; }
.lv span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--mint); color: var(--mint-ink); display: grid; place-items: center; font-size: 14px; }
.steps b { font-size: 15px; }
.steps span { color: var(--muted); font-size: 13.5px; }

/* 問卷 */
.qbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }
.qnum { font-size: 13px; color: var(--muted); min-width: 36px; text-align: right; }
.q h2 { margin: 0 0 4px; font-size: 22px; line-height: 1.4; }
.q .sub { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; border: 2px solid transparent; border-radius: var(--r-row); background: var(--card); text-align: left; cursor: pointer; }
.opt .ic { flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.opt .ic svg { width: 22px; height: 22px; }
.opt .tx { flex: 1; min-width: 0; }
.opt .tx b { display: block; font-size: 16px; }
.opt .tx span { display: block; color: var(--muted); font-size: 13px; line-height: 1.5; }
.opt .ck { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--future); display: grid; place-items: center; color: var(--on-accent); }
.opt .ck svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.opt.multi .ck { border-radius: 8px; }
.opt[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.opt[aria-checked="true"] .ck { background: var(--accent); border-color: var(--accent); }
.opt[aria-checked="true"] .ck svg { opacity: 1; }
.opt.locked { opacity: .55; cursor: default; }
.sw { display: flex; gap: 4px; margin-top: 6px; }
.sw i { width: 18px; height: 18px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.qfoot { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); margin-top: 18px; }

/* 結果 */
.rhero { position: relative; overflow: hidden; background: var(--mint); color: var(--mint-ink); border-radius: var(--r-card); padding: 20px 18px 18px; }
.rhero::before { content: ""; position: absolute; width: 140px; height: 140px; right: -40px; top: -50px; border-radius: 50%; background: var(--mint-deco); opacity: .5; }
.rhero img { position: absolute; right: 10px; bottom: 6px; width: 104px; height: 90px; object-fit: contain; animation: grow .7s var(--ease) both .15s; }
@keyframes grow { from { opacity: 0; transform: scale(.6) translateY(10px); } to { opacity: 1; transform: none; } }
.rhero .lab { position: relative; font-size: 13px; opacity: .85; }
.rhero h2 { position: relative; margin: 4px 0 6px; font-size: 26px; }
.rhero p { position: relative; margin: 0; max-width: 64%; font-size: 13.5px; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.list li { position: relative; padding-left: 18px; font-size: 14px; }
.list li::before { content: ""; position: absolute; left: 2px; top: .65em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.warn { background: var(--warn-bg); color: var(--warn-ink); }
.warn .list li::before { background: var(--warn-ink); }
.block { background: var(--pink); color: var(--pink-ink); }
.block .list li::before { background: var(--pink-ink); }
.block small { display: block; opacity: .85; }
.pack { margin-top: 12px; background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.pack > button.head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; background: none; text-align: left; cursor: pointer; }
.pack .head img { width: 46px; height: 40px; object-fit: contain; }
.pack .head .tx { flex: 1; }
.pack .head b { display: block; font-size: 16px; }
.pack .head span { display: block; color: var(--muted); font-size: 12.5px; }
.pack .head .chev { width: 20px; height: 20px; color: var(--muted); transition: transform .25s var(--ease); }
.pack.open .head .chev { transform: rotate(180deg); }
.pack .body { display: none; padding: 0 16px 16px; }
.pack.open .body { display: block; }
.pack .acts { display: flex; gap: 8px; margin-bottom: 10px; }
.pack .acts .primary { flex: 1; }
.btn2 { border: 0; border-radius: var(--r-row); background: var(--accent-soft); color: var(--accent); min-height: var(--tap); padding: 0 16px; cursor: pointer; }
pre.prompt { margin: 0; max-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--bg); border-radius: 14px; padding: 12px; font-size: 12.5px; line-height: 1.6; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.disc { font-size: 13px; }
.disc p { margin: 0 0 8px; }
.again { margin-top: 18px; display: grid; gap: 8px; }
.again .btn2 { width: 100%; }
.foot { margin-top: 26px; text-align: center; color: var(--future); font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--card); padding: 10px 18px; border-radius: var(--r-pill); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.agree { display: flex; align-items: center; gap: 10px; min-height: var(--tap); margin-top: 4px; font-size: 14px; cursor: pointer; }
.agree input { width: 22px; height: 22px; accent-color: var(--accent); }
.lv em { display: inline-block; font-style: normal; font-size: 11.5px; color: var(--mint-ink); background: var(--mint); border-radius: var(--r-pill); padding: 0 8px; margin: 2px 0 4px; }
.grp { display: flex; align-items: center; gap: 8px; margin: 10px 2px -2px; color: var(--muted); font-size: 14px; }
.grp:first-child { margin-top: 0; }
.grp img { width: 34px; height: 30px; object-fit: contain; }
.feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.feats li { display: flex; gap: 10px; align-items: flex-start; }
.feats .st { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--mint-ink); }
.feats .st svg { width: 15px; height: 15px; stroke-width: 2.6; }
.feats .no .st { background: var(--pink); color: var(--pink-ink); }
.feats .tx b { display: block; font-size: 14.5px; }
.feats .tx span { display: block; font-size: 12.5px; color: var(--muted); }
.feats .no .tx span { color: var(--pink-ink); }
