/* 人生存摺 — a bank passbook you live inside. Cream paper, ledger rules, navy cover, red teller stamp. */
:root {
  color-scheme: light;
  /* look A, 日落 (Pita 2026-10-22「唔洗Keep 番呢個色, 死氣沉沉」→「咁A 啦」「入到去game 入面都想套番個感覺」): warm blush paper,
     a peach → rose → plum bar on top, coral for what you press. --gold stays the name of the accent line colour. */
  --paper: #fff3ed; --paper-2: #fde3d9; --card: #fffaf7; --ink: #3a2230; --ink-2: #6e4b58; --ink-3: #a1808b;
  --rule: #efc8bc; --rule-2: #f7ddd3; --cover: #b8456b; --cover-2: #e0645f; --stamp: #c8364f; --gold: #d9663f;
  --accent: linear-gradient(180deg, #ff9a6e, #ec5a72); --accent-solid: #ec5f6c; --on-accent: #fff;
  --bar: linear-gradient(100deg, #ff9966 0%, #ef6278 55%, #a8457f 100%); --on-bar: #fff;
  --dusk: linear-gradient(180deg, #ff9f72 0%, #f0687a 38%, #b4497f 72%, #5e2a5c 100%);
  --gain: #2c7a45; --loss: #c8364f;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #8a5cc8; --series-5: #c2477a; --series-6: #a07a10;
  --f-head: 'Noto Serif TC', serif; --f-body: 'LXGW WenKai TC', 'Noto Serif TC', serif; --f-num: 'IBM Plex Mono', ui-monospace, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* the same sunset after dark: plum paper, a dusk bar, coral that still glows */
    --paper: #1c1219; --paper-2: #2a1a26; --card: #241620; --ink: #fbe9e6; --ink-2: #dcbac1; --ink-3: #a2838e;
    --rule: #533544; --rule-2: #3a2632; --cover: #7a2f5a; --cover-2: #c24d6c; --stamp: #ff7a80; --gold: #ff9a76;
    --accent: linear-gradient(180deg, #ff9a76, #e8577a); --accent-solid: #f06e78; --on-accent: #fff;
    --bar: linear-gradient(100deg, #d9694c 0%, #b3456a 50%, #5a2550 100%); --on-bar: #fff;
    --dusk: linear-gradient(180deg, #e0765a 0%, #c24d6c 35%, #7a2f5a 70%, #2e1530 100%);
    --gain: #6cc485; --loss: #ff7a80;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #9a6fd8; --series-5: #d0598a; --series-6: #b88d22;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 15.5px; line-height: 1.5; }
body { background-image: repeating-linear-gradient(0deg, transparent 0 31px, var(--rule-2) 31px 32px); min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gain { color: var(--gain); } .loss { color: var(--loss); } .muted { color: var(--ink-3); }

/* ---------- start / cover ---------- */
.cover { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--dusk); background-attachment: fixed; color: #fff; }
.cover-card { width: min(560px, 100%); border: 1px solid rgba(241,233,214,.35); border-radius: 10px; padding: 40px 32px; position: relative;
  box-shadow: inset 0 0 0 6px rgba(241,233,214,.06), 0 30px 80px rgba(0,0,0,.35); animation: rise .7s ease both; }
.cover-card h1 { font-family: var(--f-head); font-weight: 900; font-size: clamp(40px, 9vw, 64px); letter-spacing: .12em; margin: 0 0 4px; }
.cover-card .sub { opacity: .8; margin: 0 0 28px; }
.cover-card .emblem { position: absolute; top: 22px; right: 24px; width: 64px; height: 64px; border: 2px solid var(--gold); border-radius: 50%; display: grid; place-items: center;
  color: var(--gold); font-family: var(--f-head); font-weight: 900; transform: rotate(-12deg); }
.cover-card ul { padding-left: 1.1em; margin: 0 0 26px; opacity: .9; }
.cover-card li { margin: 4px 0; }
.big-btn { display: block; width: 100%; padding: 16px; border: 0; border-radius: var(--r); background: var(--accent); color: var(--on-accent); font-family: var(--f-head); font-weight: 900; font-size: 20px; letter-spacing: .2em; }
.big-btn:hover { filter: brightness(1.08); }
.ghost-btn { background: transparent; border: 1px solid currentColor; border-radius: var(--r); padding: 8px 14px; opacity: .9; }
.cover-opts { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13.5px; }
.cover-opts select, .cover-opts input { font: inherit; font-size: 13.5px; background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(241,233,214,.35); border-radius: 4px; padding: 6px 8px; }
/* the fate entry: a big gold-outline button right under 投胎 (Pita 2026-10-20) */
.cover-fate { margin-top: 10px; }
.cover-fate summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 14px;
  border: 2px solid var(--gold); border-radius: 6px; text-align: center; }
.cover-fate summary::-webkit-details-marker { display: none; }
.cover-fate summary b { font-size: 17px; letter-spacing: .04em; }
.cover-fate summary small { font-size: 12.5px; opacity: .8; font-weight: 400; }
.cover-fate[open] summary { margin-bottom: 8px; background: rgba(217,102,63,.12); }
.cover-fate > p, .cover-fate > .fate-row, .cover-fate > .big-btn { margin-left: 2px; margin-right: 2px; }
.cover-fate .fate-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.cover-fate label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; flex: 1 1 9em; }
.cover-fate select, .cover-fate input { font: inherit; font-size: 13.5px; background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(241,233,214,.35); border-radius: 4px; padding: 6px 8px; color-scheme: dark; }
.cover-fate .big-btn { margin-top: 6px; }
.fate-msg { min-height: 1.2em; font-size: 12.5px; margin: 6px 0 0; }
.resume { margin-top: 14px; }

/* ---------- main layout ---------- */
.top { position: sticky; top: 0; z-index: 5; background: var(--bar); color: var(--on-bar); padding: 10px 16px 12px; box-shadow: 0 4px 16px rgba(160,50,80,.25); }
.top .row1 { display: flex; align-items: center; /* portrait, ♪ and name on one centre line (Pita 2026-10-18「個 icon 唔係中間」) */ gap: 12px; flex-wrap: wrap; }
.top .nm { font-family: var(--f-head); font-weight: 900; font-size: 20px; letter-spacing: .06em; }
.top .meta { opacity: .85; font-size: 13.5px; }
.top .age { margin-left: auto; font-family: var(--f-num); font-size: 13.5px; opacity: .9; }
.prog { height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: #fff; }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; font-size: 11.5px; }
.bar label { display: flex; justify-content: space-between; opacity: .85; }
.bar i { display: block; height: 5px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.bar i b { display: block; height: 100%; background: #fff; transition: width .5s ease; }
/* one page: life on the left, money on the right; on a phone the money summary sits on top of the diary */
.main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "diary summary" "diary detail"; grid-template-rows: auto 1fr;
  gap: 14px 20px; padding: 16px; max-width: 1240px; margin: 0 auto 150px; align-items: start; }
.main { grid-template-areas: "diary summary"; grid-template-rows: auto; }
.pane-summary { grid-area: summary; } .pane-diary { grid-area: diary; } .pane-detail { grid-area: detail; }
@media (min-width: 861px) { .pane-summary { position: sticky; top: 104px; z-index: 2; } }
@media (max-width: 860px) {
  .main { grid-template-columns: 1fr; grid-template-areas: "summary" "diary"; padding: 10px; gap: 10px; }
  .bars { grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px; } /* four stats on one line (Pita 2026-10-17) */
  .bar label span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pane-summary { position: sticky; top: 0; z-index: 6; }
  .top { position: static; } /* on a phone the passbook summary is what stays on screen */
}
.book.summary .agebar { display: none; font-family: var(--f-num); font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
@media (max-width: 860px) {
  .book.summary { padding: 8px 10px; }
  .book.summary .agebar { display: block; }
  .book.summary .lbl, .book.summary .yrline { display: none; }
  .book.summary .val { font-size: 20px; }
  .kv.kv-s { gap: 2px 8px; margin-top: 4px; padding-top: 4px; }
  .kv.kv-s div span { font-size: 10px; } .kv.kv-s div b { font-size: 11.5px; }
  .actions { gap: 6px; padding-top: 8px; }
  .actions .go { padding: 9px 18px; font-size: 14.5px; }
  .actions .sec { padding: 7px 10px; font-size: 11.5px; }
  .speeds .mini { padding: 4px 8px; font-size: 11.5px; }
}
.book.summary { margin-bottom: 0; padding: 10px 12px; box-shadow: 0 6px 14px rgba(0,0,0,.06); }
.book.summary .val { font-size: 23.5px; }
.yrline { font-size: 11px; text-align: right; }
.kv.kv-s { grid-template-columns: repeat(3, 1fr); gap: 4px 10px; margin-top: 6px; padding-top: 6px; }
.kv.kv-s div span { font-size: 10.5px; } .kv.kv-s div b { font-size: 12.5px; }
details#moneyDetail > summary { cursor: pointer; list-style: none; font-family: var(--f-head); font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  padding: 8px 12px; border: 1px dashed var(--rule); border-radius: var(--r); background: var(--card); }
details#moneyDetail > summary::after { content: ' ▾'; } details#moneyDetail[open] > summary::after { content: ' ▴'; }
details#moneyDetail[open] > summary { margin-bottom: 10px; }
.book-full .hero { display: none; }
.yr .flows { font-family: var(--f-num); font-size: 11px; color: var(--ink-3); margin: -2px 0 4px; }
.yr.quiet { padding-top: 6px; padding-bottom: 6px; } .yr.quiet .hd { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.yr.quiet .hd .a { font-size: 14.5px; }
.pane h2 { font-family: var(--f-head); font-weight: 900; font-size: 13.5px; letter-spacing: .3em; color: var(--ink-2); margin: 4px 0 10px; display: flex; align-items: center; gap: 10px; }
.pane h2::after { content: ''; flex: 1; height: 1px; background: var(--rule); }

/* ---------- diary ---------- */
.diary { display: flex; flex-direction: column-reverse; gap: 10px; }
.yr { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 14px 12px; position: relative; }
.yr.new { animation: rise .35s ease both; }
.yr .hd { display: flex; gap: 10px; align-items: baseline; border-bottom: 1px dashed var(--rule); padding-bottom: 4px; margin-bottom: 6px; }
.yr .hd .a { font-family: var(--f-head); font-weight: 900; font-size: 18px; }
.yr .hd .y { font-family: var(--f-num); color: var(--ink-3); font-size: 11.5px; }
.yr .hd .money { margin-left: auto; font-family: var(--f-num); font-size: 11px; color: var(--ink-3); text-align: right; }
.yr p { margin: 4px 0; }
.yr p.bad::before, .yr p.big::before, .yr p.hist::before, .yr p.ev::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 2px; }
.yr p.bad::before { background: var(--loss); } .yr p.big::before { background: var(--gold); } .yr p.ev::before { background: var(--ink-3); }
.yr p.hist { font-size: 13.5px; color: var(--ink-2); background: var(--paper-2); padding: 4px 8px; border-radius: 4px; }
.yr p.hist::before { background: var(--cover-2); }
.yr.death { border-color: var(--stamp); }

/* ---------- money (passbook) ---------- */
.book { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; margin-bottom: 14px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 10px; flex-wrap: wrap; }
.hero .lbl { font-size: 12.5px; color: var(--ink-2); }
.hero .val { font-family: var(--f-num); font-weight: 600; font-size: 27px; line-height: 1.1; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; margin-top: 12px; border-top: 1px solid var(--rule-2); padding-top: 10px; }
.kv div span { display: block; font-size: 11.5px; color: var(--ink-3); }
.kv div b { font-family: var(--f-num); font-weight: 600; font-size: 13.5px; }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--paper-2); border-left: 3px solid var(--gold); padding: 6px 10px; margin: 10px 0 0; border-radius: 0 4px 4px 0; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ledger th { text-align: right; font-weight: 400; color: var(--ink-3); font-size: 11px; border-bottom: 1px solid var(--rule); padding: 4px 6px; }
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger td { text-align: right; padding: 6px; border-bottom: 1px solid var(--rule-2); font-family: var(--f-num); }
.ledger td:first-child { font-family: var(--f-body); }
.ledger td .acts { display: flex; gap: 4px; justify-content: flex-end; }
.mini { border: 1px solid var(--rule); background: var(--paper); border-radius: 4px; padding: 2px 8px; font-size: 11.5px; }
.mini:hover { border-color: var(--ink-2); }
.mini.on { background: var(--bar); color: var(--on-bar); border-color: var(--cover); }
.prods { display: grid; gap: 6px; }
.prod { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 8px 10px; border: 1px solid var(--rule-2); border-radius: 4px; background: var(--paper); }
.prod .d { font-size: 11.5px; color: var(--ink-3); grid-column: 1 / -1; }
.prod .k { font-size: 10px; letter-spacing: .1em; color: var(--ink-3); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; margin-left: 6px; }
.prod .buy { display: flex; gap: 4px; align-items: center; }
.setting { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; font-size: 13.5px; }
.setting > span:first-child { min-width: 7.5em; color: var(--ink-2); }
/* a row of choices wraps inside its own column, not back under the label (Pita 2026-10-19「呢度 ui 走晒位」, phone) */
.setting.budrow { flex-wrap: nowrap; align-items: flex-start; } .setting.budrow > span:first-child { flex: 0 0 auto; padding-top: 5px; }
.setting.budrow .opts { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 0; min-width: 0; }
.empty { color: var(--ink-3); font-size: 13.5px; padding: 6px 0; }

/* ---------- action bar ---------- */
.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 10px; justify-content: center; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 70%, transparent); }
.actions .go { padding: 14px 34px; border: 0; border-radius: 999px; background: var(--stamp); color: #fff8ee; font-family: var(--f-head); font-weight: 900; font-size: 18px; letter-spacing: .15em; box-shadow: 0 6px 18px rgba(163,49,43,.35); }
.actions .go:active { transform: translateY(1px); }
.actions .sec { padding: 10px 16px; border: 1px solid var(--rule); background: var(--card); border-radius: 999px; font-size: 13.5px; }
.actions .sec.on { background: var(--bar); color: var(--on-bar); border-color: var(--cover); }
.actions { align-items: center; flex-wrap: wrap; }
.speeds { display: flex; gap: 4px; }
.speeds .mini { padding: 6px 10px; font-family: var(--f-num); }
@media (max-width: 600px) { .actions .go { padding: 12px 22px; font-size: 16px; } .actions .sec { padding: 8px 12px; font-size: 12.5px; } .speeds { width: 100%; justify-content: center; } }

/* ---------- modal (event card) ---------- */
.veil { position: fixed; inset: 0; z-index: 20; background: rgba(20,16,10,.55); display: grid; place-items: center; padding: 16px; }
.card { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--card); border-radius: 10px; padding: 22px 22px 18px; box-shadow: 0 30px 80px rgba(0,0,0,.4); position: relative; }
.card .age-tag { font-family: var(--f-num); font-size: 11.5px; color: var(--ink-3); }
.card h3 { font-family: var(--f-head); font-weight: 900; margin: 4px 0 10px; font-size: 18px; line-height: 1.4; }
.card .fork { display: inline-block; font-size: 11.5px; color: var(--stamp); border: 1.5px solid var(--stamp); border-radius: 4px; padding: 0 6px; transform: rotate(-2deg); margin-bottom: 6px; }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choices button { text-align: left; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); font-size: 15.5px; }
.choices button:hover:not(:disabled) { border-color: var(--stamp); background: var(--card); }
.choices button:disabled { opacity: .45; cursor: not-allowed; }
.choices button small { display: block; color: var(--ink-3); font-size: 11.5px; }

/* ---------- end / compare ---------- */
.end { max-width: 980px; margin: 0 auto; padding: 20px 16px 120px; }
.end h1 { font-family: var(--f-head); font-weight: 900; font-size: 27px; margin: 10px 0 2px; }
.stamp-dead { display: inline-block; border: 3px double var(--stamp); color: var(--stamp); font-family: var(--f-head); font-weight: 900; padding: 2px 12px; transform: rotate(-4deg); letter-spacing: .3em; }
.cmp { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 14px 0; }
.cmp .book h4 { margin: 0 0 6px; font-family: var(--f-head); display: flex; align-items: center; gap: 8px; }
.cmp .book h4 i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.chart { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 12px 6px; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .legend { display: flex; gap: 16px; font-size: 12.5px; margin: 0 0 6px; flex-wrap: wrap; }
.chart .legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: 4px; margin-right: 6px; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--paper); font-size: 11.5px; padding: 6px 9px; border-radius: 5px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; font-family: var(--f-num); }
.chart .tip b { font-family: var(--f-body); }
.forks { display: grid; gap: 8px; }
.forks button { text-align: left; }
details.tbl { margin-top: 8px; font-size: 12.5px; }
details.tbl summary { cursor: pointer; color: var(--ink-2); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* birth card */
.card.birth { padding: 0 0 16px; overflow: hidden; }
.card.birth > *:not(.bc-head) { margin-left: 22px; margin-right: 22px; }
.bc-head { display: flex; justify-content: space-between; align-items: center; background: var(--stamp); color: #fff8ee; padding: 10px 22px; font-family: var(--f-head); font-weight: 900; letter-spacing: .1em; }
.bc-head .num { font-size: 11px; font-weight: 400; opacity: .85; }
.bc-name { font-size: 30.5px !important; margin-top: 14px !important; }
.bc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 10px 0 12px; font-size: 13.5px; }
.bc-grid span { display: block; font-size: 11px; color: var(--ink-3); }
.card.birth > table.bc-cmp { width: calc(100% - 44px); margin: 6px 22px 8px; }
.stat-note { font-size: 12.5px; color: var(--ink-2); border-left: 3px solid var(--cover-2); background: var(--paper-2); padding: 6px 10px; margin: 0 0 4px; border-radius: 0 4px 4px 0; }

/* investing screen */
.sheet-veil { align-items: end; padding: 0; }
@media (min-width: 861px) { .sheet-veil { align-items: center; padding: 24px; } }
.sheet { width: min(760px, 100%); max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 14px 14px 0 0; padding: 0 14px 20px; box-shadow: 0 -20px 60px rgba(0,0,0,.35); }
@media (min-width: 861px) { .sheet { border-radius: 12px; } }
.sheet-hd { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; background: var(--paper); padding: 12px 0 10px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.sheet-hd b { font-family: var(--f-head); font-size: 16px; } .sheet-hd .muted { font-size: 11.5px; } .sheet-hd button { margin-left: auto; }
.book-full .hero { display: none; }
.open-invest { display: block; width: 100%; margin-top: 8px; padding: 6px; font-size: 12.5px; background: var(--bar); color: var(--on-bar); border-color: var(--cover); }
.actions .invest { background: var(--accent); color: var(--on-accent); border-color: var(--gold); font-weight: 600; }

.sheet-tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.sheet-tabs button { flex: 1; padding: 9px; border: 1px solid var(--rule); background: var(--card); border-radius: var(--r); font-family: var(--f-head); font-weight: 600; }
.sheet-tabs button.on { background: var(--bar); color: var(--on-bar); border-color: var(--cover); }
.focus { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; font-size: 11.5px; }
.focus > span { color: var(--ink-3); margin-right: 4px; }
.focus .mini { padding: 2px 7px; font-size: 11px; }
.sheet .book h2 { font-family: var(--f-head); font-weight: 900; font-size: 13.5px; letter-spacing: .3em; color: var(--ink-2); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.sheet .book h2::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.ledger td:first-child { white-space: nowrap; }
.pctpick input { width: 4.2em; font: inherit; font-size: 12.5px; padding: 2px 4px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.prod .k.held { border-color: var(--gain); color: var(--gain); }
.ledger td .acts { flex-wrap: wrap; }
.hold { border: 1px solid var(--rule-2); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; background: var(--paper); }
.hold-nm { font-weight: 600; margin-bottom: 4px; }
.hold-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 11.5px; color: var(--ink-3); }
.hold-kv b { font-family: var(--f-num); color: var(--ink); font-weight: 600; }
.hold-kv b.gain { color: var(--gain); } .hold-kv b.loss { color: var(--loss); }
.hold .acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.book-full .kv { border-top: 0; margin-top: 0; padding-top: 0; }
.setting .mini small { color: var(--ink-3); font-family: var(--f-num); font-size: 10px; }
.setting .mini.on small { color: #d9d0bd; }
table.stmt td:last-child { font-family: var(--f-num); }
table.stmt tr.sec td { font-weight: 700; border-top: 1px solid var(--rule); background: var(--paper-2); }
.flows a, .yrline a { color: var(--cover-2); }
.yr p .sea { display: inline-block; font-size: 10px; line-height: 1; padding: 2px 5px; margin-right: 6px; border-radius: 3px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule); vertical-align: 2px; }
.top #season { font-family: var(--f-head); color: #fff3c4; font-weight: 900; }
.chipgroups { display: grid; gap: 8px; margin-top: 10px; }
.chipgroups .cg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chipgroups .cg > span { min-width: 6.5em; font-size: 11.5px; color: var(--ink-3); }
.chipgroups .chip { font-size: 13.5px; padding: 6px 12px; }

/* display currency picker */
.cursel { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); margin-left: auto; }
.cursel select { font: inherit; font-size: 11.5px; padding: 2px 4px; border: 1px solid var(--rule, rgba(0,0,0,.2)); border-radius: 4px; background: transparent; color: inherit; }
/* PC: this year's statement under the summary, right-hand column */
.pc-stmt { margin-top: 12px; max-height: calc(100vh - 470px); min-height: 160px; overflow: auto; }
.pc-stmt .book h2 { font-size: 13.5px; }
@media (max-width: 860px) { .pc-stmt { display: none; } }

/* save button on a choice */
.age-tag .savebtn { float: right; margin-top: -4px; }

/* the four stats, each its own colour (Pita 2026-10-17「健康、快樂嗰啲每個都唔同色」) */
.bar.k-health i b { background: #62b56f; } .bar.k-happy i b { background: #e8b23a; }
.bar.k-smart i b { background: #5a9fe0; } .bar.k-social i b { background: #d77fb0; }
.bar label { opacity: 1; font-weight: 700; text-shadow: 0 1px 2px rgba(90,20,50,.35); } /* white on the sunset bar; the colour moves to a dot */
.bar label span:first-child::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; background: var(--k); box-shadow: 0 0 0 1.5px #fff; }
.bar.k-health { --k: #4fae5f; } .bar.k-happy { --k: #f0b52e; } .bar.k-smart { --k: #4e95e0; } .bar.k-social { --k: #c95fa0; }
/* family member: relationship and state bars */
.kin { display: grid; grid-template-columns: auto 1fr 2.2em auto 1fr 2.2em; gap: 2px 6px; align-items: center; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; max-width: 360px; }
.kin i { display: block; height: 5px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.kin i b { display: block; height: 100%; }
.kin .kr b { background: #d77fb0; } .kin .kw b { background: #62b56f; }
.kin em { font-style: normal; font-family: var(--f-num); }
.saverow { display: flex; gap: 6px; align-items: stretch; } .saverow > button:first-child { flex: 1; }
/* dropdown lists: the cover's selects use light text on a dark card, and the open list inherited it — white on white
   (Pita 2026-10-17). Options get their own dark-on-light colours everywhere. */
select option, select optgroup { color: #1c1a16; background: #f4efe5; }
.cover select, .cover-fate select { color-scheme: dark; }
.cover select option, .cover-fate select option { color: #fff; background: #5e2a5c; }
/* PC: the header lines up with the page column instead of stretching across a wide screen (Pita 2026-10-17「PC 版又太長」) */
.top { padding-left: max(16px, calc((100% - 1240px) / 2 + 16px)); padding-right: max(16px, calc((100% - 1240px) / 2 + 16px)); }
/* product price chart */
.pchart { grid-column: 1 / -1; margin: 6px 0 2px; }
.pchart svg { width: 100%; height: auto; display: block; }
.pchart .line { fill: none; stroke: var(--series-1, #3a6ea5); stroke-width: 2; stroke-linejoin: round; }
.pchart .grid { stroke: var(--rule-2, rgba(0,0,0,.08)); stroke-width: 1; }
.pchart .base { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.pchart .ax { font-size: 10px; fill: var(--ink-3); font-family: var(--f-num); }
.pchart .hit { fill: transparent; } .pchart .hit:hover { fill: var(--series-1, #3a6ea5); }
.pchart .pstats { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.pchart .pnote { font-size: 11.5px; color: var(--ink-3); }
/* 提早還款 row under a mortgage */
.prepay { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; font-size: 13px; }
.prepay input { width: 9em; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: inherit; font: inherit; }
.prepay small { flex-basis: 100%; }
/* 收支明細: 全年 / 每月 switch in the heading */
.book h2 .persw { float: right; display: inline-flex; gap: 4px; font-family: var(--f-body); letter-spacing: 0; }
.book h2 .persw .mini { font-size: 11.5px; padding: 2px 8px; }
/* 自己揀出身 on the birth card */
.ownbirth { margin-top: 12px; border-top: 1px solid var(--rule); padding-top: 10px; }
.ownbirth .fate-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.ownbirth label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; flex: 1 1 8em; }
.ownbirth select, .ownbirth input { font: inherit; font-size: 13.5px; background: var(--card); color: inherit; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; width: 100%; box-sizing: border-box; }
.ownbirth .big-btn { margin-top: 6px; width: 100%; }
/* one-row action bar (Pita 2026-10-17「下面堆 ui 最好可以一行過」): icons on a phone, words on a wide screen */
.actions { flex-wrap: nowrap; gap: 8px; }
.actions .go, .actions .sec { white-space: nowrap; }
@media (max-width: 700px) {
  .actions { gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .actions .lbl { display: none; }
  .actions .go { padding: 10px 16px; font-size: 16px; letter-spacing: 0; }
  .actions .sec { padding: 9px 11px; font-size: 15px; min-width: 42px; }
}
/* 形容呢一世 on the end screen */
.lifedesc { display: flex; gap: 8px; align-items: flex-end; margin: 12px 0; flex-wrap: wrap; }
.lifedesc label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; flex: 1 1 16em; }
.lifedesc input { font: inherit; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: inherit; }
/* 返回 must be easy to find (Pita 2026-10-17「個返回仔太過鬼鼠，唔太明顯搵唔到」): keeps its word on a phone and stands out */
.actions #back { border-color: var(--gold); color: var(--gold); font-weight: 700; }
@media (max-width: 700px) { .actions #back .lbl { display: inline; } .actions #back { padding: 9px 12px; } }
/* 返去人生: a real button, easy to see (Pita 2026-10-17「個返回仔太過鬼鼠」, pointing at the sheet's close) */
.sheet-hd .close-sheet { margin-left: auto; padding: 9px 16px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.sheet-hd .close-sheet:active { transform: translateY(1px); }
/* phone: a smaller top card and smaller diary text, so more of the diary shows (Pita 2026-10-17「呢部份有冇得整細啲？下便啲字都可以細少少」) */
@media (max-width: 600px) {
  .book.summary .agebar { display: none; }            /* the header above already says who, when and what job */
  .book.summary { padding: 6px 10px; }
  .book.summary .val { font-size: 19px; }
  .book.summary .open-invest { display: none; }        /* 📒 is in the bottom bar */
  .hero { gap: 6px; }
  .kv.kv-s { gap: 1px 8px; }
  .kv.kv-s div span { font-size: 9.5px; } .kv.kv-s div b { font-size: 11px; }
  .focus { margin-top: 4px; gap: 3px; } .focus > span { font-size: 10px; } .focus .mini { padding: 1px 6px; font-size: 10.5px; }
  .top { padding-top: 6px; padding-bottom: 6px; }
  .top .nm { font-size: 17px; } .top .meta { font-size: 11px; line-height: 1.35; } .top .age { font-size: 11.5px; }
  .bars { margin-top: 4px; }
  .yr { padding: 7px 10px 8px; }
  .yr p { font-size: 13.5px; line-height: 1.45; margin: 3px 0; }
  .yr p.hist { font-size: 12.5px; }
  .yr .hd .a { font-size: 15px; } .yr .hd { padding-bottom: 2px; margin-bottom: 4px; }
  .yr .flows { font-size: 10px; }
}
/* speed menu above the speed button */
.speedwrap { position: relative; display: inline-flex; }
.speedpop { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column-reverse; gap: 4px; padding: 6px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.3); z-index: 8; }
.speedpop .mini { min-width: 86px; white-space: nowrap; padding: 7px 10px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.speedpop .mini small { color: var(--ink-3); font-size: 11px; }
/* 買 / 再買 menu at the card, and the dividend-yield line under a fund's name */
.buywrap { position: relative; display: inline-flex; }
.buypop { position: absolute; top: calc(100% + 6px); left: -40px; z-index: 9; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 8px; background: var(--card); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.3); width: min(260px, calc(100vw - 60px)); box-sizing: border-box; }
.buypop .mini { display: flex; flex-direction: column; align-items: flex-start; padding: 6px 10px; font-size: 13.5px; }
.buypop .mini small { color: var(--ink-3); font-size: 11px; }
.buypop .buyin { grid-column: 1 / -1; display: flex; gap: 4px; }
.buypop .buyin input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: inherit; font: inherit; font-size: 13px; }
.ytag { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 4px; }
/* product card: the yield line and the buttons each take a full row, so nothing gets squeezed on a phone */
.prod .ytag { grid-column: 1 / -1; order: 0; }
.prod .buy .mini { white-space: nowrap; }
@media (max-width: 600px) { .prod { grid-template-columns: 1fr; } .prod .buy { flex-wrap: wrap; } }
.buypop { max-width: calc(100vw - 40px); }
.buywrap:last-child .buypop, .acts .buywrap .buypop { left: auto; right: auto; }
/* loading screen (index.html), visible before the scripts and data arrive */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: var(--dusk); color: #fff; padding: 24px; box-sizing: border-box; }
.splash .emblem { width: 64px; height: 64px; border: 2px solid var(--gold); color: var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; font-family: var(--f-head); }
.splash h1 { font-family: var(--f-head); letter-spacing: .2em; margin: 14px 0 4px; }
.splash .ld { font-size: 13px; opacity: .75; margin-top: 18px; }
.splash .dots::after { content: ''; animation: ld 1.2s steps(4) infinite; }
@keyframes ld { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* 逐件出: the newest line drops in and glows for a moment (ui/app.js REV) */
.yr p.fresh { animation: drop .5s ease both, glow 2.2s ease; border-radius: 4px; }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes glow { from { background: color-mix(in srgb, var(--gold) 22%, transparent); } to { background: transparent; } }
.revhint { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 6px; letter-spacing: 0; }
.diary { cursor: pointer; }
/* 收支明細 on a phone (Pita 2026-10-18「UI 呢度爛晒」): long line names wrap, amounts stay on one line, nothing runs past the frame */
table.stmt td:first-child { white-space: normal; overflow-wrap: anywhere; }
table.stmt td:last-child { white-space: nowrap; padding-left: 10px; vertical-align: top; }
.veil .card .book h2 { font-family: var(--f-head); font-size: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
/* a button you cannot use looks it, and the reason sits under it */
.buy .mini:disabled { opacity: .4; cursor: not-allowed; }
.whynot { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 2px; font-size: 12px; color: var(--loss); }
/* 好感 bar in the 心動對象 list (ui/app.js loveHtml) */
.kin .aff b { background: #e06c8a; }
/* a let flat's last year (ui/app.js letYearLine) */
.letyr { font-size: 12.5px; color: var(--ink-2); margin: 4px 0 6px; line-height: 1.55; }
/* 理財 folds (ui/app.js foldHtml): a kind stays closed until you open it */
.fold { border: 1px solid var(--rule); border-radius: var(--r); margin: 8px 0; }
.foldhd { display: flex; width: 100%; align-items: baseline; gap: 10px; padding: 10px 12px; background: none; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.foldhd b { font-family: var(--f-head); font-size: 15px; }
.foldhd span { font-size: 12.5px; margin-left: auto; }
.foldhd i { font-style: normal; color: var(--ink-3); }
.fold.open { padding-bottom: 8px; }
.fold .prods, .fold > .prod, .fold > .note, .fold > .downsel, .fold > .hold { margin-left: 10px; margin-right: 10px; }
/* bottom-bar icons (ui/app.js ICON): same size on every phone */
.actions .ic { width: 20px; height: 20px; display: block; }
.actions .go .ic { width: 24px; height: 24px; }
.actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
/* 每年供 box on fund cards (ui/app.js dcaSel) */
.dcabox { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12.5px; }
.dcabox input { width: 6.5em; font: inherit; font-size: 12.5px; padding: 2px 4px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.setting small.loss { display: block; width: 100%; margin-top: 2px; }
/* background music switch in the top card (ui/music.js) */
.musicbtn { float: right; margin-left: 8px; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--rule); background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.musicbtn .ic { width: 18px; height: 18px; }
/* portraits (ui/avatar.js) */
.av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; float: left; margin: 2px 10px 2px 0; background: var(--paper-2); border: 1px solid var(--rule); }
.av.gone { filter: grayscale(1); opacity: .6; }
.av.me { width: 46px; height: 46px; margin: 0; vertical-align: middle; float: none; display: inline-block; border-color: var(--gold); }
.av.big { width: 84px; height: 84px; float: none; display: block; margin: 0 auto 10px; border: 2px solid var(--gold); }
@media (max-width: 600px) { .av { width: 38px; height: 38px; } .av.me { width: 40px; height: 40px; } .av.big { width: 72px; height: 72px; } }
/* event pictures: scene + portraits with expressions (ui/avatar.js eventPicture) */
.scene { position: relative; clear: both; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 12px; border-radius: 12px; background: var(--paper-2) center / cover no-repeat; overflow: hidden; border: 1px solid var(--rule); }
.av.sc { position: absolute; bottom: 8%; width: 32%; height: auto; aspect-ratio: 1; float: none; margin: 0; border: 3px solid var(--gold); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.av.sc.me { left: 9%; } .av.sc.them { right: 9%; }
.scene.solo .av.sc.me { left: 34%; }

/* 模擬比較 (engine/whatif.js) */
.wi-open { width: 100%; margin-top: 10px; color: inherit; }
.wi-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; margin: 14px 0; font-size: 13.5px; }
.wi-form label { display: flex; flex-direction: column; gap: 4px; }
.wi-form input, .wi-form select { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(241,233,214,.35); border-radius: 4px; padding: 7px 8px; }
.wi-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; } .wi-row .ghost-btn { color: inherit; }
.wi-res { margin-top: 18px; background: var(--card); color: var(--ink); border-radius: var(--r); padding: 14px; }
.wi-head { margin: 0 0 8px; } .wi-inf { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }
.wi-chart { position: relative; } .wi-chart svg { width: 100%; height: auto; display: block; }
.wi-chart .tip { position: absolute; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; pointer-events: none; opacity: 0; box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.wi-chart .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; margin-bottom: 4px; } .wi-chart .legend i { display: inline-block; width: 12px; height: 3px; margin-right: 5px; vertical-align: middle; }
.wi-cards { display: grid; gap: 8px; margin-top: 10px; }
.wi-card { border-left: 4px solid; padding: 8px 10px; background: var(--paper); border-radius: 4px; display: flex; flex-direction: column; gap: 2px; }
.wi-card.off { opacity: .6; } .wi-card small { color: var(--ink-2); } .wi-big { font-weight: 800; font-size: 17px; } .wi-note { color: var(--ink-3) !important; }
.wi-fine { font-size: 12px; margin-top: 10px; }
.wi-form label.wide { grid-column: 1 / -1; } .wi-form small { opacity: .8; font-size: 12px; }
.wi-det-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-top: 6px; }
.wi-det-btns .chip { font: inherit; font-size: 12.5px; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); }
.wi-det-btns .chip.on { background: var(--ink); color: var(--card); }
.wi-det { margin-top: 8px; } .wi-det p { font-size: 12.5px; margin: 0 0 4px; }
.wi-det-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wi-det table { font-size: 12px; white-space: nowrap; } .wi-det td, .wi-det th { padding: 3px 6px; text-align: right; } .wi-det td:first-child, .wi-det th:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); }
.wi-det td.down { color: var(--down, #c0392b); } .wi-det td.up { color: var(--up, #1e8449); }
.wi-det tr.wi-buyrow td { background: var(--paper-2); font-weight: 600; }
.wi-pair { display: flex; gap: 6px; } .wi-pair input { flex: 1; } .wi-pair select { width: auto !important; }
/* the yearly table scrolls inside its card instead of pushing the page wider (Pita 2026-10-19「呢度爛晒」) */
.wi-res, .wi-cards, .wi-card, .wi-det { min-width: 0; max-width: 100%; }
.wi-cards { grid-template-columns: minmax(0, 1fr); }
.wi-card, .wi-res { overflow: hidden; }
.wi-det-scroll { max-width: 100%; }
.cover.wi .cover-card { max-width: 860px; }

/* 模擬比較 on a PC: the form and the results each get the whole screen (Pita 2026-10-19「填野時可以比晒full screen 我填」) */
.wi-det-h { margin: 16px 0 4px; font-size: 16px; }
.wi-bar { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 12px; }
.wi-bar .wi-row { margin-top: 0; align-items: center; } .wi-bar .cursel { font-size: 12.5px; color: inherit; opacity: .85; } .wi-bar .cursel select { font-size: 13px; padding: 4px 6px; } .wi-sum { margin: 4px 0 0; }
@media (min-width: 1000px) {
  .cover.wi { align-items: flex-start; }
  .cover.wi .cover-card { max-width: 1480px; width: calc(100vw - 48px); }
  .wi-form { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 12px 18px; }
  .wi-form label.wide { grid-column: span 2; }
  .wi-strats { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .wi-strats-h { grid-column: 1 / -1; }
  .cover.wi .big-btn { max-width: 420px; }
  .wi-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wi-det table { font-size: 13px; }
}
@media (min-width: 1500px) { .wi-cards.n3, .wi-cards.n5, .wi-cards.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .wi-cards.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .wi-cards.n1 { grid-template-columns: minmax(0, 1fr); } }
.cover.wi .cover-card { min-width: 0; }
.cover.wi .cover-card { width: 100%; box-sizing: border-box; }

.wi-strats { margin: 6px 0 14px; display: grid; gap: 8px; }
.wi-strats-h { font-size: 13.5px; opacity: .9; }
.wi-strat { border-left: 4px solid; background: rgba(0,0,0,.18); border-radius: 4px; padding: 8px 10px; display: grid; gap: 4px; font-size: 13px; }
.wi-strat-top { display: flex; gap: 8px; align-items: baseline; } .wi-strat-top small { opacity: .75; flex: 1; }
.wi-x { background: transparent; border: 0; color: inherit; opacity: .7; font-size: 15px; cursor: pointer; }
.wi-strat-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; } .wi-strat-row > span { opacity: .75; }
.wi-ck { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; } .wi-strat-note { opacity: .7; }
.wi-strat select { font: inherit; background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(241,233,214,.35); border-radius: 4px; padding: 2px 6px; }
.wi-sadd { color: inherit; justify-self: start; }
.wi-pct { display: inline-flex; gap: 4px; align-items: center; } .wi-pct input { width: 56px; font: inherit; background: rgba(0,0,0,.25); color: inherit; border: 1px solid rgba(241,233,214,.35); border-radius: 4px; padding: 2px 6px; }
.wi-pct-sum { opacity: .7; }
/* 買 / 賣 / 供款 popup over the 理財 sheet (Pita 2026-10-19「呢度都全部用 pop up 啦」): a bottom sheet on a phone, a card on a PC */
.popveil { position: fixed; inset: 0; z-index: 40; background: rgba(20,16,10,.55); display: flex; align-items: flex-end; justify-content: center; }
.popcard { width: min(460px, 100%); box-sizing: border-box; background: var(--card); color: var(--ink); border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom) + var(--tb, 0px)); box-shadow: 0 -6px 24px rgba(0,0,0,.3); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.popcard > * { min-width: 0; } .popin input { width: 100%; } .popin select, .popin .mini { flex: 0 0 auto; }
.pophd { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; }
.popclose { background: transparent; border: 0; color: inherit; font-size: 18px; opacity: .7; cursor: pointer; padding: 4px 8px; }
.popcard p { margin: 0; font-size: 13.5px; }
.popgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.popgrid .mini { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px; font-size: 14.5px; }
.popgrid .mini small { color: var(--ink-3); font-size: 11.5px; }
.popin { display: flex; gap: 6px; }
.popin input, .popin select { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: inherit; }
.popin input { flex: 1; min-width: 0; }
.popin .mini, .popstop { padding: 8px 14px; font-size: 14.5px; }
.popstop { justify-self: start; }
@media (min-width: 700px) { .popveil { align-items: center; } .popcard { border-radius: 14px; } }
/* 人生跑馬燈 before the summary (Pita 2026-10-19): lines drop in one at a time, newest on top, like the diary */
.flash { position: fixed; inset: 0; z-index: 50; background: #0d0b08; color: #efe6d2; display: flex; flex-direction: column; padding: 18px 18px calc(18px + env(safe-area-inset-bottom) + var(--tb, 0px)); cursor: pointer; user-select: none; }
.flash-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: .8; } .flash-top .ghost-btn { color: inherit; }
.flash-list { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 12px; max-width: 680px; width: 100%; margin: 18px auto 10px; }
.flash-line { animation: flashDrop .55s ease; transition: opacity .5s; border-left: 3px solid var(--gold); padding: 2px 0 2px 12px; }
.flash-line b { font-family: var(--f-head); font-size: 20px; color: var(--gold); margin-right: 8px; } .flash-y { font-size: 12px; opacity: .55; }
.flash-line p { margin: 4px 0 0; font-size: 16.5px; line-height: 1.6; }
.flash-end { border: 0; padding: 0; text-align: center; font-size: 18px; display: grid; gap: 14px; justify-items: center; } .flash-end .big-btn { width: auto; padding: 12px 28px; }
.flash-bar { height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; } .flash-bar i { display: block; height: 100%; background: var(--gold); transition: width .4s; }
.flash-hint { text-align: center; font-size: 12px; opacity: .45; margin: 8px 0 0; }
@keyframes flashDrop { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }

/* 兩個策略對比 (Pita 2026-10-19) */
.wi-cmp { margin-top: 14px; } .wi-cmp-ctl { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 8px; font-size: 13px; }
.wi-cmp-ctl select { font: inherit; font-size: 13px; padding: 4px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: inherit; max-width: 100%; }
.wi-cmpt { font-size: 12px; white-space: nowrap; } .wi-cmpt td, .wi-cmpt th { padding: 3px 6px; text-align: right; } .wi-cmpt td:first-child, .wi-cmpt tr:first-child th:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); } .wi-cmpt tr:nth-child(2) th { text-align: right; }
.wi-cmpt th.wi-cmpa, .wi-cmpt th.wi-cmpb { text-align: center; border-bottom: 1px solid var(--rule); } .wi-cmpt td.down { color: var(--down, #c0392b); } .wi-cmpt td.up { color: var(--up, #1e8449); }
.wi-tag { display: block; font-size: 10.5px; color: var(--gold, #b8860b); }

/* 更新紀錄 (Pita 2026-10-20) */
.news-open { position: relative; }
.news-new { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: var(--accent-solid); color: var(--on-accent); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.cover.news { place-items: start center; }
.cover.news .cover-card { width: min(760px, 100%); }
.news-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.news-rel { margin: 0 0 26px; }
.news-rel h3 { margin: 0 0 8px; font-size: 18px; border-bottom: 1px solid rgba(241,233,214,.25); padding-bottom: 6px; }
.news-rel h3 .num { color: var(--gold); margin-right: 6px; }
.news-rel ul { margin: 0; padding-left: 1.1em; opacity: .92; }
.news-rel li { margin: 0 0 8px; line-height: 1.6; }
/* 玄知Lab mentions: quiet (Pita 2026-10-20「唔想太hard sell」) */
.cover-foot { margin: 22px 0 0; text-align: center; font-size: 12.5px; opacity: .7; }
.cover-foot a, .soft-ad a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.soft-ad { margin-top: 18px; font-size: 13px; }
/* the middle button (理財・家人・行動) bigger: it is where most of the choices are (Pita 2026-10-20「中間行動掣可能大個啲會好啲」) */
.actions .invest { padding: 14px 24px; box-shadow: 0 6px 16px rgba(217,102,63,.35); }
.actions .invest .ic { width: 28px; height: 28px; }
@media (max-width: 700px) { .actions .invest { padding: 13px 20px; } }
/* 俾意見 box */
.fbveil textarea, .fbveil input { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 10px; margin: 6px 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink); }
.fbveil .fb-msg { min-height: 1.2em; margin: 4px 0; font-size: 13px; }
.fbveil .fb-life { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 4px 0; line-height: 1.4; }
.fbveil .fb-life input { width: auto; margin: 3px 0 0; flex: none; }
.fbveil .fb-life small { display: block; color: var(--ink-3); font-size: 12px; }
/* 今年重心: easier to see, says it can be changed (Pita 2026-10-20「好唔顯眼…要知道有得改」) */
.focus { display: grid; grid-template-columns: auto 1fr; gap: 6px 8px; align-items: center; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--gold); border-radius: 8px; background: rgba(217,102,63,.08); font-size: 13px; }
.focus .focus-lab { color: var(--ink); font-weight: 700; display: flex; flex-direction: column; line-height: 1.2; margin: 0; }
.focus .focus-lab small { font-weight: 400; font-size: 11px; color: var(--gold); }
.focus .focus-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.focus .mini { padding: 4px 10px; font-size: 12.5px; }
.focus .mini.on { background: var(--accent); border-color: var(--accent-solid); color: var(--on-accent); font-weight: 700; }
.focus .focus-hint { grid-column: 1 / -1; font-size: 12px; color: var(--ink-2); }
@media (max-width: 700px) { .focus { grid-template-columns: 1fr; padding: 7px 8px; } .focus .focus-lab { flex-direction: row; gap: 8px; align-items: baseline; } .focus .mini { padding: 4px 9px; font-size: 12.5px; } .focus > span { font-size: inherit; } }
.focus.spot { position: relative; z-index: 31; box-shadow: 0 0 0 4px rgba(217,102,63,.55), 0 0 24px 6px rgba(217,102,63,.45); background: var(--card); }
.coach { position: fixed; inset: 0; z-index: 30; background: transparent; pointer-events: none; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom) + var(--tb, 0px)); }
.coach-card { pointer-events: auto; box-shadow: 0 10px 40px rgba(0,0,0,.45); width: min(520px, 100%); max-height: 60vh; overflow: auto; background: var(--card); color: var(--ink); border: 2px solid var(--gold); border-radius: 12px; padding: 16px 18px; }
.coach-card h3 { margin: 0 0 6px; } .coach-card p { margin: 0 0 8px; font-size: 14px; } .coach-card ul { margin: 0 0 8px; padding-left: 1.1em; font-size: 13.5px; } .coach-card li { margin: 3px 0; }
/* top-right mark: 玄知Lab's red seal, as on yuenchilab.com (Pita 2026-10-20「右上角改做玄知個logo」) */
.emblem.seal { border: 0; border-radius: 6px; background: #b0341f; box-shadow: inset 0 0 0 3px #b0341f, inset 0 0 0 5px #f2d9c8; color: #f7efe0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-family: var(--f-head); font-weight: 900; font-size: 22px; line-height: 1.05; text-decoration: none; }
.emblem.seal span { display: block; }
.emblem.seal { transform: none; }
/* 臨終一句 + 人哋嘅人生 (Pita 2026-10-20) */
.lastwords textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px; border-radius: 6px; border: 1px solid rgba(241,233,214,.4); background: rgba(0,0,0,.25); color: inherit; margin: 6px 0; }
.lastwords .lw-share { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; opacity: .9; margin: 4px 0 10px; }
.lw-end { font-size: 15px; margin: 4px 0 12px; } .lw-end small { opacity: .7; margin-left: 6px; }
.wall { margin-top: 26px; border-top: 1px solid rgba(241,233,214,.25); padding-top: 14px; }
.wall h2 { font-family: var(--f-head); font-size: 20px; margin: 0 0 10px; letter-spacing: .08em; }
.wcard { border: 1px solid rgba(241,233,214,.25); border-radius: 8px; padding: 12px; margin: 0 0 10px; background: rgba(0,0,0,.15); }
.wcard .wtop { display: flex; gap: 10px; align-items: center; } .wcard .wtop .av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 1px solid var(--gold); }
.wcard .wtop b { display: block; font-size: 15px; } .wcard .wtop small { opacity: .75; font-size: 12px; }
.wcard .wq { font-size: 16px; margin: 8px 0; color: #f7efe0; }
.wcard .wmoney { font-size: 13.5px; } .wcard .wmoney small { opacity: .7; margin-left: 4px; }
.wcard .wach { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; } .wcard .wach span { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid rgba(217,102,63,.6); color: var(--gold); }
.wcard .wev { margin: 6px 0 0; padding-left: 1.1em; font-size: 12.5px; opacity: .85; } .wcard .wev li { margin: 2px 0; }
/* iPhone (Pita 2026-10-20「拉上拉落個menu 會無左」): a double tap or a tap on a small text box zoomed the page in, and a zoomed
   page carries the fixed bottom bar off screen. No double-tap zoom (pinch still works); maximum-scale=1 in index.html stops the
   zoom on a text box. */
html { touch-action: manipulation; }
/* room under the page for the floating Safari bar (--tb, set in index.html) */
.main { margin-bottom: calc(150px + var(--tb, 0px)); } .end { margin-bottom: var(--tb, 0px); } /* keep the 150px room under the fixed menu (playtest-6 #14) */
/* 收起 a question to read the diary (Pita 2026-10-21) */
.age-tag .qmin { float: right; margin: -4px 6px 0 0; }
.veil .qback { display: none; }
.veil.qhide { background: transparent; pointer-events: none; }
.veil.qhide > .card { display: none; }
.veil.qhide .qback { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom) + var(--tb, 0px)); z-index: 21; pointer-events: auto;
  padding: 13px 26px; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
/* a face beside a choice that is about someone (表白) */
.choices button.withav { display: flex; align-items: center; gap: 12px; }
.choices button.withav .chav { width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px; object-fit: cover; border: 2px solid var(--gold); }
.choices button.withav > span { min-width: 0; }
/* 收起 and 存檔 stand out (Pita 2026-10-21「收起同save 都太鬼祟喇」): real buttons, not hairline tags */
.card .age-tag { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.age-tag .qmin, .age-tag .savebtn { float: none; margin: 0; padding: 7px 14px; font-size: 14px; font-weight: 700; border-radius: 999px; border: 1.5px solid var(--gold); white-space: nowrap; }
.age-tag .qmin { order: 2; margin-left: auto; background: var(--accent); color: var(--on-accent); }
.age-tag .savebtn { order: 3; }
.age-tag .savebtn { background: transparent; color: var(--gold); }
.age-tag .savebtn:disabled { opacity: .7; }
@media (max-width: 440px) { .age-tag .ql { display: none; } .age-tag .qmin, .age-tag .savebtn { padding: 7px 12px; } }
.qwait { margin: 8px 0; padding: 10px 12px; border: 1.5px solid var(--gold); border-radius: 8px; background: rgba(217,102,63,.12); font-size: 14px; }
.qwait button { margin-left: 6px; border-color: var(--gold); font-weight: 700; }

/* ---- cover, look A (Pita 2026-10-22「咁A 啦」; mock-up scratch/cover_mock/v2.html?t=sunset) ---- */
.cover.home { display: block; padding: 0 16px 30px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #ffb37b 0%, #ff8a7a 38%, #f2668b 70%, #b44f9a 100%); background-attachment: scroll; }
@media (prefers-color-scheme: dark) { .cover.home { background: linear-gradient(180deg, #e98a66 0%, #d4607a 35%, #8e3a6e 70%, #3a1838 100%); } }
.cover.home .hero-bg { position: absolute; left: 0; right: 0; top: 0; height: 380px; background: url('scenes/confess_school.webp') center 30%/cover;
  -webkit-mask-image: linear-gradient(#000 50%, transparent); mask-image: linear-gradient(#000 50%, transparent); pointer-events: none; }
.cv { position: relative; max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: 100%; grid-template-areas: "title" "reel" "main" "wall" "foot"; }
.cv-title { grid-area: title; position: relative; padding: 30px 2px 0; min-height: 250px; animation: rise .7s ease both; }
.cv-title h1 { font-family: var(--f-head); font-weight: 900; font-size: clamp(48px, 14vw, 76px); letter-spacing: .1em; margin: 0; line-height: 1.15;
  text-shadow: 0 3px 0 rgba(150,50,40,.35), 0 0 30px rgba(255,120,80,.6); }
.cv-title .tag { margin: 4px 0 0; font-size: 18px; text-shadow: 0 1px 6px rgba(120,40,30,.6); }
.cv-title .emblem.seal { position: absolute; top: 26px; right: 2px; width: 54px; height: 54px; display: grid; place-content: center; text-align: center;
  font-family: var(--f-head); font-weight: 900; font-size: 20px; line-height: 1.05; text-decoration: none; box-shadow: inset 0 0 0 3px #b0341f, inset 0 0 0 5px #f2d9c8, 0 3px 10px rgba(0,0,0,.25); }
.cover.home .reel { grid-area: reel; border-radius: 18px; padding: 14px 12px 12px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(160,50,60,.2); min-height: 286px; }
.reel-in { animation: reelIn .6s ease both; }
@keyframes reelIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.reel .who { font-size: 13.5px; margin: 0 4px 8px; display: flex; justify-content: space-between; gap: 8px; } .reel .who b { font-weight: 700; }
.reel .steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.reel .pol { background: #fff; padding: 4px 4px 6px; border-radius: 3px; box-shadow: 0 4px 12px rgba(0,0,0,.18); text-align: center; color: #3a2a20; }
.reel .pol:nth-child(odd) { transform: rotate(-3deg); } .reel .pol:nth-child(even) { transform: rotate(3deg) translateY(4px); }
.reel .pol.now { transform: scale(1.12) translateY(-4px); position: relative; z-index: 1; }
.reel .pol-img { width: 100%; aspect-ratio: 1; display: block; border-radius: 2px; background: #f4e6e0; }
.reel .pol .y { font-weight: 900; font-size: 12.5px; margin-top: 3px; font-family: var(--f-num); }
.reel .pol .t { font-size: 11.5px; line-height: 1.2; }
.reel .line { margin: 14px 4px 0; font-size: 15px; line-height: 1.5; } .reel .line small { display: block; font-size: 13.5px; opacity: .85; }
.reel .dots { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.reel .dots i { width: 8px; height: 8px; border-radius: 4px; background: #fff; opacity: .4; cursor: pointer; transition: width .3s; } .reel .dots i.on { width: 22px; opacity: 1; }
.cv-main { grid-area: main; }
.hooks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.hook { border-radius: 14px; padding: 10px 6px; text-align: center; font-size: 12.5px; line-height: 1.35; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.45); }
.hook span { font-size: 24px; display: block; } .hook b { display: block; font-size: 15px; }
.go-btn { display: block; width: 100%; padding: 16px; border: 0; border-radius: 18px; background: #fff; color: #e2475f; font-family: var(--f-head); font-weight: 900;
  font-size: 26px; letter-spacing: .25em; box-shadow: 0 8px 0 #c9385a, 0 14px 30px rgba(120,20,60,.35); cursor: pointer; transition: transform .1s; }
.go-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #c9385a, 0 8px 20px rgba(120,20,60,.35); }
.go-btn small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 13px; letter-spacing: .03em; margin-top: 2px; color: #b0475a; }
.resume-btn { display: block; width: 100%; margin-top: 18px; padding: 12px; border-radius: 16px; border: 0; background: rgba(255,255,255,.88); color: #8a2f4f; font-size: 16px; font-weight: 700; }
.cover.home .cover-fate { margin-top: 16px; }
.cover.home .cover-fate summary { border: 2px solid #fff; border-radius: 16px; background: rgba(255,255,255,.12); }
.cover.home .cover-fate[open] summary { background: rgba(255,255,255,.22); }
.cover.home .cover-fate .big-btn { background: #fff; color: #e2475f; border-radius: 14px; }
.cover.home .cover-fate.saves summary { border-width: 1px; }
.cv-icons { display: flex; justify-content: space-around; margin: 18px 0 6px; }
.cv-icons button { display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 12.5px; color: inherit; background: none; border: 0; padding: 0; position: relative; cursor: pointer; }
.cv-icons button span { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.5); }
.cv-icons em { position: absolute; top: -6px; right: -10px; font-style: normal; font-size: 10.5px; font-weight: 700; border-radius: 8px; padding: 0 5px; color: #fff; background: #e8453c; }
.cover.home .cover-opts { justify-content: center; opacity: .9; }
.cover.home .wall { grid-area: wall; border-top: 0; }
.cover.home .wall h2 small { font-family: var(--f-body); font-size: 12.5px; font-weight: 400; opacity: .75; margin-left: 6px; letter-spacing: 0; }
.cover.home .wcard { background: #fff; color: #4a2a35; border: 0; border-radius: 14px; box-shadow: 0 6px 18px rgba(120,30,60,.18); }
@media (prefers-color-scheme: dark) { .cover.home .wcard { background: #2b1a27; color: #fbe9e6; } }
.cover.home .wcard .wach span { color: #d9663f; border-color: rgba(217,102,63,.6); }
.cv-foot { grid-area: foot; }
.howto ul { padding-left: 1.1em; } .howto li { margin: 6px 0; }
/* a PC: title and buttons on the left, the life and the wall on the right */
@media (min-width: 960px) {
  .cover.home { padding: 0 40px 40px; } .cover.home .hero-bg { height: 520px; }
  .cv { max-width: 1080px; grid-template-columns: 1fr 1.05fr; column-gap: 48px; align-items: start;
    grid-template-areas: "title reel" "main reel" "main wall" "foot foot"; grid-template-rows: auto auto 1fr auto; }
  .cv-title { padding-top: 70px; min-height: 0; } .cv-title .emblem.seal { top: 74px; }
  .cover.home .reel { margin-top: 70px; } .cover.home .wall { margin-top: 22px; }
  .reel .pol .t { font-size: 13px; } .reel .pol .y { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .reel-in { animation: none; } }
.cover.home .wall .muted { color: #fff; opacity: .85; }
/* iPhone Safari draws date/time fields at their own width and ignores width:100%, so in 模擬比較 the birth date ran over the next
   field (Pita 2026-10-22 screenshot); without the native look they take the column's width */
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
.wi-form label, .fate-row label { min-width: 0; }

/* ---- look C, 晴空 (Pita 2026-10-22「頭先C 我都鐘意，可以加埋落去，一入黎比人揀」; mock-up v2.html?t=sky): blue sky, white cards,
   yellow game buttons; at night a deep blue. Picked on the cover (.theme-pick), kept in localStorage 'lifebook-theme'. ---- */
:root[data-theme="sky"] {
  --paper: #eef6ff; --paper-2: #dcecfd; --card: #ffffff; --ink: #14324f; --ink-2: #44617d; --ink-3: #7f97ae;
  --rule: #c4daf0; --rule-2: #dde9f6; --cover: #1f6fd1; --cover-2: #4a9bf0; --stamp: #d8433a; --gold: #e08a00;
  --accent: linear-gradient(180deg, #ffe14d, #ffb300); --accent-solid: #ffc21a; --on-accent: #5a2e00;
  --bar: linear-gradient(100deg, #5fb4ff 0%, #2f86e8 55%, #3a5fd0 100%); --on-bar: #fff;
  --dusk: linear-gradient(180deg, #5fb4ff 0%, #3d8ff0 40%, #2d64c8 75%, #1e3f8f 100%);
  --gain: #1f8a4c; --loss: #d8433a;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="sky"] {
    --paper: #0e1a2e; --paper-2: #16253d; --card: #13223a; --ink: #e8f2ff; --ink-2: #b4c8e0; --ink-3: #7d93ad;
    --rule: #2a4060; --rule-2: #1d304b; --cover: #1f4f9a; --cover-2: #3a78d0; --stamp: #ff7a70; --gold: #ffcc33;
    --bar: linear-gradient(100deg, #3a86e8 0%, #2a58b8 55%, #26357a 100%);
    --dusk: linear-gradient(180deg, #2f6fd0 0%, #23489a 45%, #162c5e 80%, #0c1830 100%);
    --gain: #6cc485; --loss: #ff7a70;
  }
}
:root[data-theme="sky"] .cover.home { background: linear-gradient(180deg, #5fb4ff 0%, #8fd0ff 35%, #d6f0ff 70%, #fff6dd 100%); color: #123a5c; }
:root[data-theme="sky"] .cover.home .hero-bg { height: 340px; background-image: url('scenes/graduation.webp'); background-position: center 40%;
  -webkit-mask-image: none; mask-image: none; border-radius: 0 0 36px 36px; }
:root[data-theme="sky"] .cover.home .hero-bg::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(20,80,160,0) 30%, rgba(30,110,200,.55)); }
:root[data-theme="sky"] .cv-title { color: #fff; }
:root[data-theme="sky"] .cv-title h1 { -webkit-text-stroke: 2px #1f5fa8; text-shadow: 0 5px 0 #1f5fa8; letter-spacing: .06em; }
:root[data-theme="sky"] .cv-title .tag { text-shadow: 0 2px 4px rgba(10,50,100,.7); font-weight: 700; }
:root[data-theme="sky"] .cover.home .reel { background: #fff; color: #123a5c; border: 0; box-shadow: 0 10px 30px rgba(20,80,160,.25); border-radius: 24px; }
:root[data-theme="sky"] .reel .who b { color: #1f7ae0; } :root[data-theme="sky"] .reel .dots i { background: #1f5fa8; }
:root[data-theme="sky"] .hook { background: #fff; border: 0; box-shadow: 0 4px 0 #b9dcff; border-radius: 18px; color: #123a5c; }
:root[data-theme="sky"] .go-btn { background: linear-gradient(180deg, #ffe14d, #ffb300); color: #5a2e00; box-shadow: 0 7px 0 #d98200, 0 12px 24px rgba(200,120,0,.35); border-radius: 26px; }
:root[data-theme="sky"] .go-btn:active { box-shadow: 0 3px 0 #d98200, 0 6px 14px rgba(200,120,0,.35); }
:root[data-theme="sky"] .go-btn small { color: #7a4a00; }
:root[data-theme="sky"] .resume-btn { background: #fff; color: #1f5fa8; box-shadow: 0 4px 0 #b9dcff; }
:root[data-theme="sky"] .cover.home .cover-fate summary { background: #fff; border: 3px solid #a46bff; color: #4b2a8a; box-shadow: 0 5px 0 #d9c4ff; border-radius: 22px; }
:root[data-theme="sky"] .cover.home .cover-fate .big-btn { background: linear-gradient(180deg, #ffe14d, #ffb300); color: #5a2e00; }
:root[data-theme="sky"] .cv-icons button span { background: #fff; border: 0; box-shadow: 0 4px 0 #b9dcff; border-radius: 50%; }
:root[data-theme="sky"] .cover.home select, :root[data-theme="sky"] .cover.home input { background: #fff; color: #123a5c; border-color: #b9dcff; color-scheme: light; }
:root[data-theme="sky"] .cover.home .wcard { box-shadow: 0 4px 14px rgba(20,80,160,.12); }
:root[data-theme="sky"] .cover.home .wall .muted { color: #123a5c; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="sky"] .cover.home { background: linear-gradient(180deg, #2f6fd0 0%, #1d3f80 50%, #0e1a2e 100%); color: #fff; }
  :root[data-theme="sky"] .cover.home .wall .muted { color: #fff; }
  :root[data-theme="sky"] .cover.home .wcard { background: #13223a; color: #e8f2ff; }
}
@media (min-width: 960px) { :root[data-theme="sky"] .cover.home .hero-bg { height: 480px; border-radius: 0 0 60px 60px; } }
/* the look switch, top left of the cover */
.theme-pick { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.25); border: 1px solid rgba(255,255,255,.55); margin-bottom: 10px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.theme-pick button { font: inherit; font-size: 13px; color: #fff; background: none; border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer; text-shadow: 0 1px 3px rgba(0,0,0,.35); }
.theme-pick button.on { background: #fff; color: #c9385a; text-shadow: none; font-weight: 700; }
:root[data-theme="sky"] .theme-pick button.on { color: #1f6fd1; }
.cv-title { padding-top: 18px; }
@media (min-width: 960px) { .cv-title { padding-top: 46px; } }
/* on a PC the wall sits over the photo: give it its own card so the text stays readable */
:root[data-theme="sky"] .cover.home .wall { background: rgba(255,255,255,.88); border-radius: 20px; padding: 14px 16px; margin-top: 22px; }
@media (prefers-color-scheme: dark) { :root[data-theme="sky"] .cover.home .wall { background: rgba(19,34,58,.9); } }
.wall-sub { font-family: var(--f-head); font-size: 15px; font-weight: 700; letter-spacing: .06em; margin: 16px 0 8px; opacity: .85; }
/* the quote was cream for the old dark cards; on the white cards it vanished (2026-10-22, also on the live site after v330803a1b2) */
.cover.home .wcard .wq { color: inherit; font-weight: 700; }

/* ---- 人生故事 (engine/story.js): crossroads in the flashback and the story on the end screen (Pita 2026-10-22) ---- */
.xtag { display: inline-block; margin: 0 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 700; vertical-align: 2px; }
.xr { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin: 4px 0 0; font-size: 13.5px; }
.xr span { font-size: 11.5px; padding: 0 6px; border-radius: 4px; border: 1px solid currentColor; opacity: .75; }
.xr b { font-weight: 700; } .xr i { font-style: normal; opacity: .65; text-decoration: line-through; text-decoration-thickness: 1px; }
.flash-line.xline { border-left-width: 5px; }
.story { margin: 18px 0 8px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--rule); }
.story h2 { font-family: var(--f-head); margin: 0 0 6px; letter-spacing: .08em; }
.story .chap { margin: 12px 0 0; padding-top: 8px; border-top: 1px dashed var(--rule); }
.story .chap h3 { font-family: var(--f-head); font-size: 16px; margin: 0 0 6px; color: var(--gold); }
.story .chap h3 small { font-family: var(--f-body); font-weight: 400; font-size: 12px; color: var(--ink-3); margin-left: 8px; }
.story p { margin: 3px 0; font-size: 14px; line-height: 1.5; } .story p b { font-family: var(--f-num); font-size: 12.5px; margin-right: 8px; color: var(--ink-2); }
.story .xpick { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: var(--paper-2); }
.fate-reveal { margin-top: 14px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--gold); }
.fate-reveal h3 { font-family: var(--f-head); font-size: 16px; margin: 0 0 4px; } .fate-reveal h3 small { font-family: var(--f-body); font-weight: 400; font-size: 12px; opacity: .7; margin-left: 8px; }
.flash-line .xr b { font-family: var(--f-body); font-size: 15px; color: inherit; margin: 0; }
.xr { display: inline; margin: 0; font-size: inherit; font-weight: 700; color: var(--gold); }
.xdot { color: var(--gold); margin-right: 4px; } .story .xp { margin: 4px 0; } .story .xkey { font-size: 12px; margin: 0 0 4px; }
.flash-line .xr { color: var(--gold); }

/* 「同一個 BB」 challenge on the cover and the friend's result on the end screen (2026-10-22) */
.challenge { margin: 16px 0 0; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.92); color: #4a2a35; box-shadow: 0 8px 24px rgba(120,30,60,.25); }
.challenge b { font-size: 16px; } .challenge p { margin: 6px 0 10px; font-size: 14px; line-height: 1.5; }
.challenge .ch-row { display: flex; gap: 8px; align-items: center; } .challenge .ghost-btn { color: #8a2f4f; }
.go-btn.sm { width: auto; flex: 1; font-size: 18px; letter-spacing: .1em; padding: 10px 14px; box-shadow: 0 5px 0 #c9385a; background: linear-gradient(180deg, #ff9a6e, #ec5a72); color: #fff; }
:root[data-theme="sky"] .challenge { color: #123a5c; } :root[data-theme="sky"] .go-btn.sm { background: linear-gradient(180deg, #ffe14d, #ffb300); color: #5a2e00; box-shadow: 0 5px 0 #d98200; }
.vs { margin: 14px 0; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--gold); background: var(--card); }
.vs b { font-family: var(--f-head); } .vs p { margin: 4px 0 0; }
.birth .choices button small { display: block; font-size: 12px; opacity: .75; font-weight: 400; }
.cv-title .challenge { position: relative; z-index: 2; text-shadow: none; }
/* 人生道理 on the end screen (Pita 2026-10-22) */
.lesson { margin: 14px 0; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--gold); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.lesson h3 { font-family: var(--f-head); font-size: 16px; margin: 0 0 4px; }
.lesson p { margin: 4px 0; line-height: 1.6; } .lesson p.muted { font-size: 13px; }
/* own birth time is the main way in (Pita 2026-10-22); random is the smaller choice under it */
.cover.home .fate-main { margin-top: 14px; padding: 14px 14px 12px; border: 2px solid #fff; border-radius: 18px; background: rgba(255,255,255,.14); }
.fate-main h2 { margin: 0 0 4px; text-align: center; font-family: var(--f-head); font-size: 22px; letter-spacing: .04em; }
.fate-main .fm-sub { margin: 0 0 6px; text-align: center; font-size: 14px; line-height: 1.5; }
.fate-main .fm-note { margin: 4px 0 8px; font-size: 12px; opacity: .8; line-height: 1.5; }
.fate-main .go-btn { margin-top: 4px; }
.or-random { margin-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; opacity: .95; }
.rand-btn { width: 100%; padding: 10px 12px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.8); background: transparent; color: inherit; font-family: var(--f-head); font-weight: 700; font-size: 17px; letter-spacing: .08em; cursor: pointer; }
.rand-btn small { display: block; font-family: var(--f-body); font-weight: 400; font-size: 12px; letter-spacing: .02em; opacity: .8; margin-top: 2px; }
.resume-btn.top { margin: 0 0 4px; }
.cover.home .or-random + .cover-opts { margin-top: 8px; }
:root[data-theme="sky"] .cover.home .fate-main { background: #fff; border: 3px solid #a46bff; color: #4b2a8a; box-shadow: 0 5px 0 #d9c4ff; border-radius: 22px; }
:root[data-theme="sky"] .fate-main select, :root[data-theme="sky"] .fate-main input { background: #f4efff; color: #2b1a50; border-color: #c9b3ff; color-scheme: light; }
:root[data-theme="sky"] .rand-btn { border-color: #1f5fa8; color: #1f5fa8; background: rgba(255,255,255,.7); }
