/* Layout: phone-first game shell — gradient identity header, scrolling feed, floating round Age button in a tab bar */
/* Flag emoji: Windows has no flag glyphs, so a small Twemoji flag font (CC-BY 4.0, via country-flag-emoji-polyfill) covers just the flag code points. */
@font-face { font-family: "Twemoji Country Flags"; unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F; src: url("TwemojiCountryFlags.woff2") format("woff2"); font-display: swap; }
:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --sunk: #e8ecf5;
  --ink: #171b2e;
  --muted: #687089;
  --line: #dde2ee;
  --accent: #10b981;
  --accent-ink: #ffffff;
  --accent-2: #ff5d73;
  --gold: #f59f00;
  --sky: #4c8dff;
  --violet: #8b5cf6;
  --good: #12a150;
  --bad: #e5484d;
  --warn: #e69500;
  --head-1: #0ea47a;
  --head-2: #13b5a6;
  --felt: #0f6b4f;
  --felt-ink: #eaf7ef;
  --p0: #ff5d73; --p1: #10b981; --p2: #4c8dff; --p3: #f5b400;
  --shadow: 0 1px 2px rgb(23 27 46 / .06), 0 8px 24px -12px rgb(23 27 46 / .25);
  --shadow-lg: 0 24px 60px -20px rgb(23 27 46 / .45);
  --f-display: "Twemoji Country Flags", "Fredoka", "Segoe UI", system-ui, sans-serif;
  --f-body: "Twemoji Country Flags", "Nunito", "Segoe UI", system-ui, sans-serif;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d111c; --surface: #161b2b; --sunk: #1e2538; --ink: #edf0f8; --muted: #9aa3bd; --line: #262e45;
    --accent: #2fd39b; --accent-ink: #062418; --accent-2: #ff6f83; --gold: #ffbb33; --sky: #6ea3ff; --violet: #a78bfa;
    --good: #3fd17f; --bad: #ff6b6f; --warn: #ffb547; --head-1: #0b5a46; --head-2: #0d6e66; --felt: #0b4a37;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 26px -12px rgb(0 0 0 / .7); --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d111c; --surface: #161b2b; --sunk: #1e2538; --ink: #edf0f8; --muted: #9aa3bd; --line: #262e45;
  --accent: #2fd39b; --accent-ink: #062418; --accent-2: #ff6f83; --gold: #ffbb33; --sky: #6ea3ff; --violet: #a78bfa;
  --good: #3fd17f; --bad: #ff6b6f; --warn: #ffb547; --head-1: #0b5a46; --head-2: #0d6e66; --felt: #0b4a37;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 26px -12px rgb(0 0 0 / .7); --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f-body); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; font-weight: 600; }

#app { max-width: 560px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); position: relative; box-shadow: 0 0 0 1px var(--line); }

/* ---------- header ---------- */
#top { padding: 14px 16px 12px; background: linear-gradient(135deg, var(--head-1), var(--head-2)); color: #fff; display: grid; gap: 12px; border-radius: 0 0 26px 26px; box-shadow: var(--shadow); position: relative; z-index: 2; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / .22); font-size: 34px; flex: none; position: relative; box-shadow: inset 0 0 0 3px rgb(255 255 255 / .35); }
.avatar em { position: absolute; right: -4px; bottom: -2px; font-style: normal; font-size: 13px; background: #fff; color: var(--head-1); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); }
#top { grid-template-columns: minmax(0, 1fr); }
.who-txt { flex: 1; min-width: 0; }
.who-txt h1 { font-size: 22px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-txt p { margin: 2px 0 0; font-size: 13px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-txt .status { font-weight: 700; opacity: 1; }
.icon-btn { width: 42px; height: 42px; border: 0; border-radius: 14px; background: rgb(255 255 255 / .2); font-size: 20px; display: grid; place-items: center; transition: transform .15s; }
.icon-btn:hover { transform: rotate(30deg); }
.money-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: stretch; }
.pill-money { background: rgb(0 0 0 / .14); border-radius: 14px; padding: 6px 10px; display: grid; min-width: 0; }
.pill-money span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 700; }
.pill-money b { font: 700 18px var(--f-display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-money b.down { color: #ffd1d6; }
.econ { display: grid; place-items: center; border-radius: 14px; padding: 4px 10px; font: 600 12.5px var(--f-display); background: rgb(255 255 255 / .2); white-space: nowrap; }
.econ.boom { background: #fff; color: var(--good); }
.econ.recession { background: #ffe1e4; color: #c22a33; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px 12px; }
.stats .stat { grid-column: span 2; } .stats .stat:nth-child(n+4) { grid-column: span 3; }
.stat { display: grid; grid-template-columns: 20px 1fr 26px; align-items: center; gap: 6px; position: relative; font-size: 14px; }
.stat em { font: 700 12px var(--f-body); font-style: normal; text-align: right; }
.stat .bar { background: rgb(0 0 0 / .18); height: 8px; }
.stat .float { position: absolute; right: -4px; top: -10px; font: 700 12px var(--f-display); padding: 0 6px; border-radius: 99px; background: #fff; animation: floatUp 1.8s ease-out forwards; pointer-events: none; }
.stat .float.up { color: var(--good); } .stat .float.down { color: var(--bad); }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

.bar { height: 7px; background: var(--sunk); border-radius: 99px; overflow: hidden; min-width: 40px; flex: 1; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.good i { background: linear-gradient(90deg, #22c55e, #4ade80); } .bar.warn i { background: linear-gradient(90deg, #f59e0b, #fbbf24); } .bar.bad i { background: linear-gradient(90deg, #ef4444, #fb7185); }
#top .bar.good i { background: #b7f7c9; } #top .bar.warn i { background: #ffe08a; } #top .bar.bad i { background: #ffb3bb; }

/* ---------- main view ---------- */
#view { flex: 1; overflow-y: auto; padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
#view > *, .modal-body > * { flex-shrink: 0; min-width: 0; }
.card { background: var(--surface); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; min-width: 0; box-shadow: var(--shadow); animation: cardIn .3s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.card > header { display: flex; align-items: center; gap: 10px; }
.card h3 { font-size: 17px; }
.ci { font-style: normal; font-size: 20px; width: 34px; height: 34px; border-radius: 11px; background: var(--sunk); display: grid; place-items: center; flex: none; }
.card.flat { background: transparent; box-shadow: none; padding: 4px 2px; }
.card.flat .ci { background: var(--surface); }
.card.list { gap: 0; }
.card.list > header { margin-bottom: 8px; }
.card.job-card { border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.card.jail { background: repeating-linear-gradient(90deg, var(--surface) 0 26px, var(--sunk) 26px 30px); }
.card.society { background: linear-gradient(135deg, #1a1530, #2b1f4a); color: #efe8ff; }
.card.society .ci { background: rgb(255 255 255 / .1); }
.card.society .sub, .card.society .kv > span { color: #c7b9f0; }
.card.society.locked { filter: saturate(.6); }
.card.mafia { border-left: 5px solid #444; }
.card.gov { border: 2px solid color-mix(in srgb, var(--sky) 45%, transparent); }
.card.insider { border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.card.crime .tile { border-color: color-mix(in srgb, var(--bad) 20%, var(--line)); }
.sub { color: var(--muted); font-size: 13px; margin: 0; }
.sub.pad { padding: 0 4px; }
.sub-h { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.center { text-align: center; }
.lead { margin: 0; font-size: 15px; font-weight: 600; }
.title { font-size: 21px; }
.big-emoji { font-size: 52px; text-align: center; line-height: 1; filter: drop-shadow(0 6px 10px rgb(0 0 0 / .15)); }
.art-hero { width: 132px; height: 132px; margin: 0 auto 6px; border-radius: 28px; overflow: hidden; background: var(--sunk); box-shadow: 0 8px 22px rgb(0 0 0 / .12); }
.art-hero svg { width: 100%; height: 100%; display: block; }
.jicon.artic { width: 48px; height: 48px; border-radius: 13px; overflow: hidden; }
.jicon.artic svg { width: 100%; height: 100%; display: block; }
.job.locked .jicon.artic { filter: grayscale(.85); }
.bignum { font: 700 30px var(--f-display); }
.empty { color: var(--muted); margin: 0; font-size: 14px; }
.warn-text { color: var(--warn) !important; font-weight: 700; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 14px; min-width: 0; }
.kv.wrap { flex-wrap: wrap; }
.kv > span { color: var(--muted); min-width: 0; }
.kv > b { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.kv > .bar { max-width: 58%; }
.kv > em { font-style: normal; font-weight: 800; font-size: 13px; }
.kv.total { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
.kv.total > span { color: var(--ink); font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
.grid3 .kv { display: grid; gap: 0; }
.grid3 .kv > b { text-align: left; font-size: 14px; }
.grid3 .kv > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 16px; padding: 12px 14px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); }
.up { color: var(--good); font-weight: 800; } .down { color: var(--bad); font-weight: 800; }
.alloc { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.alloc > span { color: var(--muted); }
.alloc b { font-variant-numeric: tabular-nums; }
.meter { display: grid; gap: 4px; }
.meter-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.meter-top b { color: var(--ink); }
.card.society .meter-top b { color: #fff; }
.tipnote { margin: 0; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 15%, transparent); font-weight: 700; }

/* tiles: the main action buttons */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.tile { border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px; padding: 10px 6px 9px; display: grid; justify-items: center; gap: 3px; text-align: center; transition: transform .12s, box-shadow .15s, border-color .15s; min-width: 0; }
.tile i { font-style: normal; font-size: 26px; line-height: 1.1; }
.tile span { font-weight: 700; font-size: 12.5px; line-height: 1.2; }
.tile small { font-size: 11px; color: var(--muted); line-height: 1.2; }
.tile:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.tile:active:not(:disabled) { transform: scale(.95); }
.tile:disabled { opacity: .4; filter: grayscale(.6); }
.card.society .tile { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .14); color: #fff; }
.card.society .tile small { color: #c7b9f0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.col { flex-direction: column; }
.btn { border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 14px; font-weight: 800; font-size: 14px; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; transition: transform .1s, background .15s, box-shadow .15s; }
.btn small { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.btn:hover:not(:disabled) { background: var(--sunk); }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000), var(--shadow); }
.btn.primary small { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent)); }
.btn.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn.warn { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 11px; }
.btn.big { padding: 15px 22px; font-size: 17px; align-items: center; }
.btn:disabled { opacity: .45; }

.seg { display: flex; background: var(--sunk); border-radius: 14px; padding: 4px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: transparent; padding: 7px 11px; border-radius: 11px; font-size: 13px; font-weight: 800; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.kv .seg { flex: none; max-width: 100%; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill { font: 800 10px var(--f-body); font-style: normal; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 99px; background: var(--sunk); color: var(--muted); vertical-align: 2px; }
.pill.gold { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }
.pill.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.tags li { background: var(--sunk); padding: 4px 11px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.tags li.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.tags li.gold { color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.search { width: 100%; font: 600 15px var(--f-body); padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }

/* rows */
.row-item { width: 100%; display: grid; grid-template-columns: 1fr 72px auto; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 0; border-radius: var(--r); text-align: left; box-shadow: var(--shadow); transition: transform .12s; }
.row-item:hover { transform: translateY(-1px); }
.row-item.noch { grid-template-columns: auto 1fr auto; }
.row-item.person { grid-template-columns: auto 1fr auto; }
.card .row-item { box-shadow: none; border-radius: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 0; }
.card .row-item:last-child { border-bottom: 0; }
.row-item.dead { opacity: .5; }
.face { font-size: 30px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--sunk); border-radius: 50%; }
.ri-main { min-width: 0; display: grid; }
.ri-main b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-main small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-main small.hold { color: var(--accent); font-weight: 800; }
.ri-num { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.ri-num b { font-weight: 800; font-size: 14px; }
.ri-num small { color: var(--muted); font-size: 11.5px; }
.ri-num span { font-size: 12.5px; }
.bond { width: 90px; }
canvas.mini { width: 72px; height: 30px; display: block; }
canvas.chart { width: 100%; height: 140px; display: block; }
canvas.chart.big { height: 200px; }
.list-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; padding: 0 14px; font-weight: 800; }
.jicon { font-style: normal; font-size: 24px; width: 40px; height: 40px; border-radius: 12px; background: var(--sunk); display: grid; place-items: center; flex: none; }
.job { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.job:last-child { border-bottom: 0; }
.job > div:not(.job-r) { min-width: 0; display: grid; flex: 1; }
.job small { color: var(--muted); font-size: 12.5px; }
.job small.req { color: var(--warn); font-weight: 700; }
.job.locked b { color: var(--muted); }
.job.locked .jicon { filter: grayscale(1); opacity: .6; }
.job-r { display: flex; align-items: center; gap: 8px; flex: none; }
.job-r > span { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.stepper { display: flex; gap: 4px; }

/* life feed */
.ledger summary { cursor: pointer; font: 600 16px var(--f-display); display: flex; justify-content: space-between; list-style: none; gap: 8px; }
.ledger summary::-webkit-details-marker { display: none; }
.ledger summary b { margin-left: auto; }
.ledger summary::after { content: '▾'; color: var(--muted); }
.ledger[open] summary::after { content: '▴'; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-family: var(--f-body); font-weight: 800; margin-bottom: 4px; }
.cols .kv { font-size: 13px; }
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.news li { display: grid; grid-template-columns: 42px 1fr; gap: 8px; }
.news li span { font-weight: 800; color: var(--muted); font-size: 12px; padding-top: 1px; }
.news li.good { color: var(--good); } .news li.bad { color: var(--bad); }
.log { display: grid; gap: 12px; }
.log-year { background: var(--surface); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); }
.log-year.latest { border: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); animation: pop .4s ease; }
@keyframes pop { from { transform: scale(.97); opacity: .4; } }
.log-year h4 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.age-chip { background: var(--accent); color: var(--accent-ink); font: 600 14px var(--f-display); padding: 2px 12px; border-radius: 99px; }
.log-year h4 > span:last-child { font: 700 12px var(--f-body); color: var(--muted); }
.log-year p { margin: 0 0 6px; display: grid; grid-template-columns: 26px 1fr; gap: 6px; font-size: 14.5px; align-items: start; }
.log-year p i { font-style: normal; font-size: 17px; line-height: 1.25; text-align: center; }
.log-year p.good span { color: var(--good); font-weight: 700; }
.log-year p.bad span { color: var(--bad); font-weight: 700; }
.log-year p.warn span { color: var(--warn); font-weight: 700; }
.credit { display: flex; align-items: baseline; gap: 10px; }
.credit b { font: 700 36px var(--f-display); }
.uhnw { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, #7b5cff 14%, var(--sunk)), color-mix(in srgb, #3fa6ff 12%, var(--sunk))); }
.uhnw > b { display: block; margin-bottom: 4px; }
.uhnw ul { margin: 0 0 6px; padding-left: 18px; font-size: 13px; }
.credit span { color: var(--muted); font-weight: 800; }
.bigprice { display: flex; align-items: baseline; gap: 10px; }
.bigprice b { font: 700 30px var(--f-display); }
.bigprice small { color: var(--muted); }
.cand { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cand > div { display: grid; flex: 1; min-width: 0; }
.cand small { color: var(--muted); }
.mini-stats { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 8px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.help p { margin: 0 0 10px; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.field b { color: var(--ink); }
.field input[type=number], .field input:not([type]), .field input[type=password], .acct .pw input[type=text], .plan .field input[type=text] { font: 700 17px var(--f-body); padding: 11px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ribbon.main { display: grid; justify-items: center; font-size: 46px; gap: 2px; padding: 10px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 25%, transparent), color-mix(in srgb, var(--accent-2) 18%, transparent)); }
.ribbon.main b { font: 600 20px var(--f-display); }
.ribbons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ribbons span { background: var(--sunk); padding: 5px 11px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.ribbons.big span { font-size: 15px; background: color-mix(in srgb, var(--gold) 18%, var(--sunk)); }
.ribbons span.dim { opacity: .6; }
.grave { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grave small { color: var(--muted); }

/* ---------- tab bar + age button ---------- */
#tabs { display: grid; grid-template-columns: repeat(3, 1fr) 76px repeat(3, 1fr); align-items: end; background: var(--surface); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -6px 24px -16px rgb(0 0 0 / .4); position: relative; z-index: 3; border-radius: 22px 22px 0 0; }
#tabs > button:not(.age-btn) { border: 0; background: none; padding: 6px 0 4px; font-size: 10px; letter-spacing: -.01em; font-weight: 800; color: var(--muted); display: grid; justify-items: center; gap: 2px; min-width: 0; transition: color .15s, transform .15s; }
#tabs > button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
#tabs > button.on { color: var(--accent); }
#tabs > button.on svg { transform: translateY(-2px) scale(1.1); fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.age-btn { justify-self: center; width: 72px; height: 72px; margin-top: -30px; border-radius: 50%; border: 5px solid var(--surface); background: radial-gradient(circle at 35% 30%, #ff8a9a, var(--accent-2) 60%, #d63a52); color: #fff; display: grid; place-content: center; justify-items: center; box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent-2) 80%, #000), 0 0 0 0 color-mix(in srgb, var(--accent-2) 50%, transparent); animation: breathe 2.6s ease-in-out infinite; transition: transform .1s; }
.age-btn b { font: 700 32px/0.9 var(--f-display); }
.age-btn span { font: 700 11px var(--f-display); text-transform: uppercase; letter-spacing: .08em; }
.age-btn:active:not(:disabled) { transform: scale(.92); }
.age-btn:disabled { filter: grayscale(.7); animation: none; opacity: .7; }
.age-btn.spin b { animation: spin .6s linear infinite; }
@keyframes breathe { 0%, 100% { box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent-2) 80%, #000), 0 0 0 0 color-mix(in srgb, var(--accent-2) 45%, transparent); } 50% { box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent-2) 80%, #000), 0 0 0 10px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- modals ---------- */
#modalRoot { position: relative; z-index: 50; }
.modal-wrap { position: fixed; inset: 0; background: rgb(10 14 26 / .55); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; padding: 12px 10px calc(10px + env(safe-area-inset-bottom, 0px)); animation: fade .18s ease; }
.modal-wrap.leaving { animation: fade .14s ease reverse forwards; }
.modal { width: 100%; max-width: 520px; max-height: calc(100% - env(safe-area-inset-top, 0px) - 30px); overflow-y: auto; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); animation: rise .28s cubic-bezier(.2, 1.2, .3, 1); position: relative; }
.modal.has-hero { padding-top: 6px; }
.hero { display: grid; place-items: center; padding-top: 16px; }
.hero span { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 42px; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 22%, var(--surface)), color-mix(in srgb, var(--accent) 12%, var(--sunk))); box-shadow: inset 0 -4px 0 rgb(0 0 0 / .06), var(--shadow); animation: bounceIn .5s cubic-bezier(.2, 1.6, .4, 1); }
.hero.good span { background: radial-gradient(circle at 35% 30%, #d9fbe6, #aef0c8); }
.hero.bad span { background: radial-gradient(circle at 35% 30%, #ffe1e4, #ffc2c8); }
@keyframes bounceIn { from { transform: scale(.3) rotate(-15deg); opacity: 0; } }
.modal-head { position: sticky; top: 0; display: flex; justify-content: center; align-items: center; padding: 10px 52px 6px; background: var(--surface); z-index: 1; text-align: center; }
.modal-head h2 { font-size: 22px; }
.x { position: absolute; right: 14px; top: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--sunk); font-size: 14px; }
.modal-body { padding: 6px 18px 20px; display: grid; gap: 12px; }
.ev-text { font-size: 16px; margin: 0; text-align: center; line-height: 1.5; }
.choices { display: grid; gap: 9px; }
.choices.row { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.btn.choice { width: 100%; padding: 13px 16px; font-size: 15px; align-items: center; text-align: center; border-radius: 16px; }
.btn.choice small { text-align: center; }
@keyframes rise { from { transform: translateY(40px) scale(.98); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 600px) { .modal-wrap { align-items: center; } }
.modal.death .modal-head h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.epitaph { margin: 0; font: 600 30px/1.1 var(--f-display); display: grid; text-align: center; }
.epitaph span { font: 700 14px var(--f-body); color: var(--muted); margin-top: 4px; }

/* ---------- mini-games ---------- */
.mg-intro { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
.mg-msg { margin: 0; font-weight: 800; text-align: center; font-size: 15px; }
.mg-msg.good { color: var(--good); } .mg-msg.bad { color: var(--bad); }
.mg-cash, .pot { text-align: center; font-size: 13px; color: var(--muted); font-weight: 700; }
.mg-cash b, .pot b { color: var(--ink); }
.pot b { font: 700 24px var(--f-display); }
.fine { font-size: 12px; color: var(--muted); margin: 0; text-align: center; font-weight: 700; }
.felt { background: radial-gradient(ellipse at 50% 20%, color-mix(in srgb, var(--felt) 80%, #fff), var(--felt)); color: var(--felt-ink); border-radius: 18px; padding: 14px; display: grid; gap: 8px; box-shadow: inset 0 0 0 4px rgb(0 0 0 / .12); }
.felt .mg-msg { color: var(--felt-ink); }
.hand-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 800; }
.hand { display: flex; gap: 6px; flex-wrap: wrap; min-height: 76px; }
.hand.big { justify-content: center; }
.pcard { width: 52px; height: 76px; background: #fbfaf6; color: #1a1a1a; border-radius: 8px; display: grid; place-content: center; text-align: center; font: 700 21px var(--f-display); line-height: 1; box-shadow: 0 3px 8px rgb(0 0 0 / .3); animation: deal .25s ease both; }
.hand.big .pcard { width: 76px; height: 108px; font-size: 32px; }
.pcard small { font-size: 17px; }
.pcard.red { color: #d0312d; }
.pcard.back { background: repeating-linear-gradient(45deg, #b8323b 0 6px, #8f2028 6px 12px); }
@keyframes deal { from { transform: translateY(-20px) rotate(-8deg); opacity: 0; } }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: linear-gradient(180deg, #2b1d47, #1a1030); padding: 14px; border-radius: 18px; box-shadow: inset 0 0 0 4px #f5b400; }
.reel { background: #fffdf5; color: #1a1a1a; border-radius: 12px; height: 90px; display: grid; place-items: center; font: 700 38px var(--f-display); box-shadow: inset 0 -6px 10px rgb(0 0 0 / .12); }
.reel.spinning { filter: blur(1.5px); }
.reel.seven { color: #d0312d; }
.wheel { width: 120px; height: 120px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font: 700 40px var(--f-display); background: var(--sunk); border: 7px solid var(--gold); box-shadow: var(--shadow); }
.wheel.red { background: #d0312d; color: #fff; } .wheel.black { background: #1d1d1d; color: #fff; } .wheel.green { background: #12a150; color: #fff; }
.chipgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chipgrid button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 2px; font-size: 12px; font-weight: 800; display: grid; }
.chipgrid button small { font-weight: 600; color: var(--muted); font-size: 10.5px; }
.chipgrid button.on { background: var(--ink); color: var(--bg); }
.chipgrid button.on small { color: var(--bg); opacity: .7; }
.race { display: grid; gap: 6px; }
.lane { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; }
.lane.mine { color: var(--accent-2); }
.lane span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 30px; background: repeating-linear-gradient(90deg, #c8a171 0 18px, #bb9566 18px 20px); border-radius: 8px; }
.track i { position: absolute; top: 2px; font-style: normal; font-size: 22px; transform: scaleX(-1); transition: left .09s linear; }
.pins { display: flex; justify-content: center; gap: 8px; }
.pins i { width: 16px; height: 32px; border-radius: 5px; background: var(--sunk); border: 1.5px solid var(--line); transition: background .2s; }
.pins i.on { background: var(--good); border-color: var(--good); }
.lock-bar { position: relative; height: 58px; background: var(--sunk); border-radius: 16px; overflow: hidden; cursor: pointer; border: 1.5px solid var(--line); }
.lock-zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--good) 40%, transparent); border-left: 3px solid var(--good); border-right: 3px solid var(--good); }
.lock-needle { position: absolute; top: 5px; bottom: 5px; width: 5px; margin-left: -2.5px; background: var(--ink); border-radius: 3px; }
.vault { display: flex; justify-content: center; gap: 12px; }
.dial { display: grid; justify-items: center; gap: 4px; background: var(--sunk); border-radius: 14px; padding: 6px 12px; }
.dial b { font: 700 36px var(--f-display); }
.dial button { border: 0; background: transparent; font-size: 18px; padding: 4px 10px; }
.vhist { display: grid; gap: 3px; font-weight: 800; max-height: 150px; overflow-y: auto; }
.vhist div { display: flex; justify-content: space-between; padding: 4px 12px; background: var(--sunk); border-radius: 8px; }
.timer { height: 8px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--accent-2)); transition: width 1s linear; }
.timer i.drain { width: 100%; animation: drain linear forwards; }
@keyframes drain { to { width: 0; } }
.quiz-q { text-align: center; font: 700 38px var(--f-display); padding: 10px 0; }
.quiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quiz-grid .btn { align-items: center; font: 700 22px var(--f-display); padding: 14px; }
.neg { display: grid; grid-template-columns: 1fr auto; gap: 10px; background: var(--sunk); padding: 12px 14px; border-radius: 14px; }
.neg div { display: grid; }
.neg span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.neg b { font: 700 20px var(--f-display); }
.fighters { display: flex; justify-content: center; align-items: center; gap: 20px; font: 700 18px var(--f-display); color: var(--muted); }
.fighter { font-size: 52px; transition: transform .1s; }
.fighter.hit { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-8px) rotate(-6deg); } 75% { transform: translateX(8px) rotate(6deg); } }
.hp { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; }
.hp span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp .bar { height: 14px; }
.fightlog { min-height: 74px; background: var(--sunk); border-radius: 14px; padding: 8px 12px; font-size: 14px; }
.fightlog p { margin: 0 0 3px; }
.fightlog p:last-child { font-weight: 800; }
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(260px, 100%); margin: 0 auto; }
.spad { aspect-ratio: 1; border-radius: 22px; border: 0; opacity: .35; transition: opacity .1s, transform .1s; max-width: 100%; box-shadow: inset 0 -6px 0 rgb(0 0 0 / .15); }
.spad.p0 { background: var(--p0); } .spad.p1 { background: var(--p1); } .spad.p2 { background: var(--p2); } .spad.p3 { background: var(--p3); }
.spad.lit, .spad:active:not(:disabled) { opacity: 1; transform: scale(1.05); }
.spad:disabled { cursor: default; }
.seq { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.seq span { font-size: 30px; width: 48px; height: 48px; display: grid; place-items: center; background: var(--sunk); border-radius: 12px; animation: deal .3s ease both; }
.seq span.hidden-slot { color: var(--muted); font: 700 22px var(--f-display); }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pick-grid .btn { font-size: 28px; align-items: center; padding: 10px; }
.odd-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.odd-grid button { aspect-ratio: 1; border: 0; border-radius: 8px; background: var(--sunk); font: 700 20px ui-monospace, Consolas, monospace; }
.odd-grid button:hover { background: color-mix(in srgb, var(--sky) 25%, var(--sunk)); }
.range { position: relative; height: 240px; border-radius: 18px; background: linear-gradient(180deg, #cfe8ff, #e9f4ff 60%, #b9d99a 60%, #9cc77a); overflow: hidden; }
.target { position: absolute; border: 0; background: none; font-size: 40px; padding: 0; animation: popIn .2s ease; cursor: crosshair; }
.target.pop { transform: scale(1.6); opacity: 0; transition: all .15s; }
@keyframes popIn { from { transform: scale(0); } }
.rhythm { position: relative; width: 180px; height: 180px; margin: 0 auto; display: grid; place-items: center; }
.ring { position: absolute; width: 80px; height: 80px; border-radius: 50%; border: 5px solid var(--accent-2); }
.core { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; font-size: 34px; background: color-mix(in srgb, var(--accent-2) 18%, var(--sunk)); }
.core.pulse { animation: pulse .25s ease; }
@keyframes pulse { 50% { transform: scale(1.18); } }
.script { margin: 0; font: 500 20px/1.35 var(--f-display); text-align: center; padding: 10px; background: #fffbe8; color: #3a3220; border-radius: 12px; box-shadow: var(--shadow); }
.goal { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px; border: 6px solid #f4f4f4; border-bottom: 0; border-radius: 6px 6px 0 0; background: repeating-linear-gradient(90deg, rgb(255 255 255 / .2) 0 2px, transparent 2px 14px), #2e9e5b; }
.goal button { height: 56px; border: 2px dashed rgb(255 255 255 / .6); background: rgb(255 255 255 / .1); color: #fff; border-radius: 10px; font-size: 22px; }
.goal button:hover { background: rgb(255 255 255 / .3); }
.keeper { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font-size: 30px; pointer-events: none; }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 16px; font-size: 14px; font-weight: 800; max-width: min(92vw, 480px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2, 1.4, .4, 1); z-index: 100; text-align: center; box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { background: var(--good); color: #fff; }
#toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 420px) {
  .pill-money b { font-size: 16px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .cols { grid-template-columns: 1fr; gap: 10px; }
  .row-item { grid-template-columns: 1fr 56px auto; gap: 8px; }
  canvas.mini { width: 56px; }
  .chipgrid { grid-template-columns: repeat(4, 1fr); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .alloc { grid-template-columns: 90px 1fr auto; }
  .lane { grid-template-columns: 84px 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- special careers, countries, politics meters, new mini-games ---------- */
.who-txt .where { font-weight: 700; }
.tiles.special .tile { position: relative; }
.tiles.special .tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.tiles.special .tile.locked i { filter: grayscale(1); opacity: .55; }
.tiles.special .tile.locked small { color: var(--warn); font-weight: 700; }
.how { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.ladder { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; font-size: 12.5px; font-weight: 700; }
.ladder span { display: grid; justify-items: center; background: var(--sunk); border-radius: 12px; padding: 5px 8px; text-align: center; }
.ladder span small { font-weight: 600; color: var(--muted); font-size: 10.5px; }
.ladder span.dim { opacity: .5; }
.ladder b { color: var(--muted); }
.kv > .bar + em { min-width: 24px; text-align: right; }
.meter-impeach .bar { background-image: linear-gradient(90deg, transparent calc(100% - 3px), var(--bad) 0); }
.warn-text { color: var(--warn); font-weight: 700; }

.flag { font-size: 26px; line-height: 1; }
.co-pick { display: flex; gap: 8px; align-items: stretch; }
.co-btn { flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; border: 1.5px solid var(--line); background: var(--bg); border-radius: 14px; padding: 8px 12px; color: var(--ink); }
.co-btn > span:nth-child(2) { flex: 1; display: grid; min-width: 0; }
.co-btn b { font-size: 16px; } .co-btn small { color: var(--muted); font-weight: 600; }
.co-btn i { font-style: normal; color: var(--muted); }
.co-list { display: grid; max-height: min(52vh, 460px); overflow-y: auto; margin: 0 -6px; }
.co { display: flex; align-items: center; gap: 12px; padding: 8px 8px; border: 0; background: none; text-align: left; border-radius: 12px; }
.co:hover { background: var(--sunk); }
.co.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.co .flag { font-size: 28px; flex: none; width: 36px; text-align: center; }
.co-n { flex: 1; display: grid; min-width: 0; }
.co-n b { font-size: 15px; } .co-n small { color: var(--muted); font-size: 12.5px; }
.co-s { color: var(--muted); font-weight: 700; font-size: 12.5px; flex: none; }

.poll { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.react { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; text-align: center; padding: 8px 12px; border-radius: 14px; background: var(--sunk); animation: popIn .25s ease; }
.react span { font-size: 22px; }
.react.good { color: var(--good); } .react.bad { color: var(--bad); } .react.warn { color: var(--warn); }

.crowd-hud { display: flex; justify-content: space-around; font-weight: 800; font-size: 15px; }
.crowd { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; border-radius: 18px; background: linear-gradient(180deg, #ffe7b3, #ffd27a); }
.spot { aspect-ratio: 1; border: 0; border-radius: 50%; background: rgb(255 255 255 / .45); font-size: 40px; display: grid; place-items: center; padding: 0; box-shadow: inset 0 -4px 0 rgb(0 0 0 / .08); }
.spot.up { animation: popIn .18s ease; }
.spot.h { background: rgb(239 68 68 / .25); } .spot.p { background: rgb(76 141 255 / .3); }
.spot.tapped { transform: scale(.9); }

.customer { display: grid; justify-items: center; gap: 6px; padding: 14px; border-radius: 18px; background: linear-gradient(180deg, #1d2337, #2b3352); color: #f2f4fb; animation: popIn .2s ease; }
.customer span { font-size: 52px; line-height: 1; }
.customer p { margin: 0; text-align: center; font-weight: 700; }

.launch { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; }
.launch .sky { position: relative; height: 150px; border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, #0b1026, #283a8c 55%, #7fb3ff); }
.launch .rocket { position: absolute; left: 50%; font-size: 32px; transform: translateX(-50%) rotate(-45deg); transition: bottom .5s cubic-bezier(.2, .8, .2, 1); }
.launch h4 { font-size: 20px; }

/* ---------- v1.2: folding cards, scroll arrows, creator mini-games ---------- */
.card.fold { gap: 0; }
.card.fold > summary { list-style: none; cursor: pointer; -webkit-user-select: none; user-select: none; }
.card.fold > summary::-webkit-details-marker { display: none; }
.card.fold > summary > header { display: flex; align-items: center; gap: 10px; }
.card.fold > summary h3 { flex: 1; min-width: 0; }
.card.fold .chev { font-style: normal; font-size: 22px; line-height: 1; color: var(--muted); transition: transform .2s; flex: none; }
.card.fold[open] .chev { transform: rotate(90deg); }
.card.fold[open] > summary { margin-bottom: 10px; }
.card.fold > .fold-body { display: grid; gap: 10px; min-width: 0; }
.card.fold.list > .fold-body { gap: 0; }
.card.fold:not([open]):hover { box-shadow: var(--shadow-lg); }
.card.flat.fold > summary .ci { background: var(--surface); }
.card.society.fold .chev { color: #c7b9f0; }
.fold-all { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: -4px; }
.fold-all button { border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 800; padding: 2px 6px; border-radius: 8px; }
.fold-all button:hover { color: var(--ink); background: var(--sunk); }

.scroller { position: relative; min-width: 0; max-width: 100%; }
.kv > .scroller { flex: none; max-width: 100%; }
.sc-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font: 800 20px/1 var(--f-display); display: none; place-items: center; padding: 0 0 2px; }
.sc-arrow.l { left: -4px; } .sc-arrow.r { right: -4px; }
.scroller.can-l > .sc-arrow.l, .scroller.can-r > .sc-arrow.r { display: grid; }
.scroller.can-r::after, .scroller.can-l::before { content: ''; position: absolute; top: 0; bottom: 0; width: 34px; pointer-events: none; z-index: 1; }
.scroller.can-r::after { right: 0; background: linear-gradient(90deg, transparent, var(--bg)); }
.scroller.can-l::before { left: 0; background: linear-gradient(270deg, transparent, var(--bg)); }
.card .scroller.can-r::after { background: linear-gradient(90deg, transparent, var(--surface)); }
.card .scroller.can-l::before { background: linear-gradient(270deg, transparent, var(--surface)); }

.mini-skill .bar { height: 5px; margin-top: 4px; max-width: 160px; }
.timeline { display: flex; gap: 4px; min-height: 40px; padding: 6px; border-radius: 12px; background: var(--sunk); overflow-x: auto; align-items: center; }
.timeline span { font-size: 22px; background: var(--surface); border-radius: 8px; padding: 2px 4px; flex: none; }
.timeline span.bad { outline: 2px solid var(--bad); }
.timeline em { color: var(--muted); font-size: 12px; font-style: normal; }
.clip-card { display: grid; justify-items: center; gap: 6px; padding: 16px; border-radius: 18px; background: linear-gradient(180deg, #1e2235, #31395c); color: #f2f4fb; animation: cardIn .2s ease both; }
.clip-card span { font-size: 54px; line-height: 1; }
.clip-card p { margin: 0; font-weight: 700; text-align: center; }
.live-hud { display: flex; justify-content: space-between; font-weight: 800; }
.live-hud .live { color: #fff; background: #e5484d; padding: 1px 8px; border-radius: 6px; animation: pulseLive 1.2s infinite; }
@keyframes pulseLive { 50% { opacity: .6; } }
.chatbox { display: grid; gap: 4px; height: 232px; overflow: hidden; align-content: start; padding: 6px; border-radius: 14px; background: var(--sunk); }
.chatmsg { display: flex; gap: 6px; align-items: baseline; text-align: left; border: 0; border-radius: 10px; padding: 6px 8px; background: var(--surface); font-size: 13px; animation: cardIn .15s ease both; }
.chatmsg i { font-style: normal; }
.chatmsg b { color: var(--sky); flex: none; }
.chatmsg.don { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); }
.chatmsg.q { background: color-mix(in srgb, var(--sky) 16%, var(--surface)); }
.chatmsg.troll { background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.chatmsg.done { opacity: .45; } .chatmsg.done::after { content: '✓'; margin-left: auto; color: var(--good); font-weight: 800; }
.chatmsg.banned { opacity: .35; text-decoration: line-through; }
.chatmsg.old { opacity: .55; }
.card.illum { background: linear-gradient(135deg, #2a2108, #4a3a0c); color: #fff5d6; }
.card.illum .sub, .card.illum .kv > span { color: #e8d79c; }
.card.illum .tile { background: rgb(255 255 255 / .07); border-color: rgb(255 215 100 / .25); color: #fff5d6; }
.card.illum .tile small { color: #e8d79c; }
.card.positions { border: 2px solid color-mix(in srgb, var(--sky) 40%, transparent); }
.job.pos small b { font-weight: 800; }
.job-r.col { flex-direction: column; align-items: stretch; }
.pro-badge { font: 800 11px var(--f-body); font-style: normal; vertical-align: middle; background: linear-gradient(135deg, #ffd34d, #ff9f1c); color: #3b2500; padding: 2px 7px; border-radius: 99px; margin-left: 6px; letter-spacing: .04em; }
.btn.pro-btn { background: linear-gradient(135deg, #ffd34d, #ff9f1c); color: #3b2500; border-color: transparent; }
.pro-stats { display: grid; gap: 6px; }
.pstat { display: grid; grid-template-columns: 9.5em 1fr 2.2em; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pstat input { width: 100%; accent-color: var(--gold); }
.pstat b { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- v1.4 crime mini-games ---------- */
.mark { display: grid; justify-items: center; gap: 2px; padding: 12px; border-radius: 18px; background: var(--sunk); transition: background .2s; }
.mark span { font-size: 54px; line-height: 1; }
.mark small { font-weight: 800; }
.mark.look { background: color-mix(in srgb, var(--bad) 25%, var(--sunk)); } .mark.look small { color: var(--bad); }
.mark.turn { background: color-mix(in srgb, var(--warn) 25%, var(--sunk)); } .mark.turn small { color: var(--warn); }
.mark.away small { color: var(--good); }
.pocket { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.loot { display: grid; justify-items: center; gap: 2px; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 8px 2px; }
.loot span { font-size: 28px; } .loot small { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.loot.taken { opacity: .25; }
.sneak { display: grid; gap: 4px; padding: 6px; border-radius: 14px; background: #1b2033; }
.sneak .cell { aspect-ratio: 1; border-radius: 8px; background: #2a3150; display: grid; place-items: center; font-size: 24px; transition: background .2s; }
.sneak .cell.beam { background: linear-gradient(180deg, #fff3a6, #ffd75a); }
.sneak .cell.cover { background: #3d3424; }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; justify-content: center; }
.dpad button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; font-size: 20px; font-weight: 800; }
.dpad [data-k="u"] { grid-column: 2; } .dpad [data-k="l"] { grid-column: 1; grid-row: 2; } .dpad [data-k="d"] { grid-column: 2; grid-row: 2; } .dpad [data-k="r"] { grid-column: 3; grid-row: 2; }
.wires { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 30px; min-height: 48px; }
.wires b { font-size: 16px; color: var(--muted); }
.wires span.done { filter: drop-shadow(0 0 6px gold); }
.btn.wire { font-size: 24px; }
.safe { display: grid; justify-items: center; gap: 6px; }
.safe .dial { width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, #d9dde8 0 35%, #8a93a8 36% 60%, #4b536b 61%); position: relative; box-shadow: var(--shadow); transition: transform .12s; }
.safe .dial i { position: absolute; left: 50%; top: 6px; width: 4px; height: 26px; margin-left: -2px; background: #e5484d; border-radius: 2px; }
.safe b { font: 800 28px var(--f-display); font-variant-numeric: tabular-nums; }
.terminal { display: flex; justify-content: space-between; font: 700 14px ui-monospace, Consolas, monospace; background: #0b1410; color: #43f08a; padding: 10px 12px; border-radius: 12px; }
.terminal b { color: #b8ffd4; letter-spacing: .1em; }
.hexgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.hexgrid button { font: 700 15px ui-monospace, Consolas, monospace; border: 1px solid #1f3a2a; background: #0f1d16; color: #43f08a; border-radius: 10px; padding: 10px 0; }
.seq span.lit { transform: scale(1.25); filter: drop-shadow(0 0 8px gold); transition: transform .1s; }
/* fishing, skydiving, street racing, climbing */
.pond { height: 120px; border-radius: 16px; background: linear-gradient(180deg, #8fd3ff, #2d7fc1); display: grid; place-items: center; }
.pond .bobber { font-size: 34px; animation: bob 1.6s ease-in-out infinite; }
.pond.bite .bobber { animation: dip .25s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }
@keyframes dip { 50% { transform: translateY(16px); } }
.sky-dive { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.alt-scale { position: relative; height: 200px; border-radius: 16px; background: linear-gradient(180deg, #3d6fd8, #9fd0ff 88%, #6fbf5a 88%, #4a9a3c); overflow: hidden; }
.alt-scale .zone { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--good) 45%, transparent); border-top: 2px dashed #fff; border-bottom: 2px dashed #fff; }
.alt-scale .diver { position: absolute; left: 50%; transform: translate(-50%, 50%); font-size: 28px; }
.sky-dive b { font: 700 24px var(--f-display); min-width: 90px; text-align: right; }
.road { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 6px; border-radius: 14px; background: #2b2f3a; }
.road .cell { height: 34px; display: grid; place-items: center; font-size: 24px; border-left: 2px dashed rgba(255, 255, 255, .12); }
.road .cell:nth-child(3n+1) { border-left: 0; }
.wall { position: relative; height: 170px; border-radius: 16px; background: linear-gradient(180deg, #dfe8f5, #8a8f99 30%, #6b6258); overflow: hidden; }
.wall .me { position: absolute; left: 50%; transform: translateX(-50%); font-size: 30px; transition: bottom .4s cubic-bezier(.2, .8, .2, 1); }
.wall .peak { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font-size: 22px; }
.btn.hold { font-size: 26px; align-items: center; padding: 10px; }
.btn.hold.lit { background: color-mix(in srgb, var(--good) 45%, var(--surface)); border-color: var(--good); }
.prison-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.prison-head .big { font-size: 40px; }
.sec-min { color: var(--good); } .sec-med { color: var(--warn); } .sec-max { color: var(--bad); }
.risk-list { display: grid; gap: 6px; }
.risk-list div { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; }
.risk-list em { font-style: normal; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--sunk); }
.risk-list em.high { background: color-mix(in srgb, var(--bad) 22%, var(--sunk)); color: var(--bad); }
.risk-list em.med { background: color-mix(in srgb, var(--warn) 22%, var(--sunk)); color: var(--warn); }
/* pump and dump */
.rp-stage { position: relative; overflow: hidden; border-radius: 14px; background: var(--sunk); }
.rp-coin { position: absolute; font-size: 22px; transition: left .25s linear, top .25s linear; pointer-events: none; animation: rpSpin 1.2s linear infinite; }
@keyframes rpSpin { 50% { transform: scaleX(.2); } }
.rp-float { position: absolute; bottom: 0; font-size: 22px; pointer-events: none; animation: rpFloat 1.5s ease-out forwards; }
@keyframes rpFloat { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-120px) scale(1.2); opacity: 0; } }
.rp-now b { font-size: 24px; } .rp-now b.up { color: var(--good); } .rp-now b.down { color: var(--bad); }
.neg.rp-3 { grid-template-columns: 1fr auto auto; }
#rpP.flash-up { color: var(--good); animation: rpPop .3s; } #rpP.flash-down { color: var(--bad); animation: rpPop .3s; }
@keyframes rpPop { 50% { transform: scale(1.15); } }
.poll.danger .bar { animation: rpDanger .6s ease-in-out infinite; }
@keyframes rpDanger { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 35%, transparent); } }
#rpM.pop { animation: rpPop .35s; }
.rp-dump { animation: rpGlow 1.6s ease-in-out infinite; }
@keyframes rpGlow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--good) 30%, transparent); } }
.shake { animation: rpShake .4s; }
@keyframes rpShake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
/* drawn portraits */
.av { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: linear-gradient(160deg, #e9f4ff, #cfe3f7); }
.av svg { width: 100%; height: 100%; display: block; }
.av.dead { display: grid; place-items: center; background: var(--sunk); font-size: 70%; }
.avatar .av { width: 54px; height: 54px; background: linear-gradient(160deg, #fff6d8, #ffd7a8); box-shadow: 0 0 0 2px rgb(255 255 255 / .55); }
.face { overflow: hidden; }
.face .av { width: 44px; height: 44px; }
.big-avatar { width: 110px; height: 110px; margin: 0 auto; filter: drop-shadow(0 6px 12px rgb(0 0 0 / .15)); }
.big-avatar .av { width: 110px; height: 110px; font-size: 56px; }
.fighter .av.fight { width: 64px; height: 64px; }
.with-av { display: inline-flex; align-items: center; gap: 10px; }
.with-av .av.sm { width: 34px; height: 34px; flex: none; }
.cand .face .av { width: 44px; height: 44px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av:not(.dead) { background: linear-gradient(160deg, #33415c, #26314a); } }
:root[data-theme="dark"] .av:not(.dead) { background: linear-gradient(160deg, #33415c, #26314a); }
/* garage */
.car-badge { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font-size: 26px; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--paint) 55%, #fff), var(--paint)); box-shadow: inset 0 -4px 0 rgb(0 0 0 / .18), 0 4px 10px color-mix(in srgb, var(--paint) 40%, transparent); }
.car-badge.big { width: 84px; height: 84px; border-radius: 24px; font-size: 48px; }
.car-head { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; align-items: center; margin-bottom: 6px; }
.car-head .perf { display: block; font: 800 30px var(--f-display); line-height: 1; }
.car-head small { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.car-quick { display: grid; gap: 2px; justify-items: end; font-weight: 800; font-size: 13px; }
.car-hero { display: grid; justify-items: center; gap: 6px; text-align: center; margin-bottom: 8px; }
.car-hero .car-badge { animation: carIdle 2.4s ease-in-out infinite; }
.car-art { display: inline-block; width: 64px; height: 64px; border-radius: 16px; background: var(--sunk); overflow: hidden; flex: none; }
.car-art.big { width: 112px; height: 112px; border-radius: 24px; }
.car-art svg { width: 100%; height: 100%; display: block; }
.car-hero .car-art svg { animation: carIdle 2.4s ease-in-out infinite; }
@keyframes carIdle { 50% { transform: translateY(-3px) rotate(-2deg); } }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; border: 1.5px solid rgb(0 0 0 / .2); }
.job.maxed { opacity: .7; }
/* the rite of candles and soul contracts */
.modal.ritual { background: radial-gradient(circle at 50% 35%, #2a1a14, #0c0808 75%); color: #f1e3cf; }
.modal.ritual .modal-head h2, .modal.ritual .ritual-msg { color: #f6e6c8; text-shadow: 0 0 12px rgb(255 140 60 / .45); }
.modal.ritual .hero { background: #1c1210; }
.modal.ritual .ritual-fine { color: #b9a58a; }
.modal.ritual .btn.choice { background: #1e1513; color: #f1e3cf; border-color: #5a3a2a; }
.altar { position: relative; aspect-ratio: 1; width: min(100%, 320px); flex: none; margin: 4px auto; border-radius: 50%; background: radial-gradient(circle, #3a1f16 0%, #160d0b 70%); box-shadow: inset 0 0 40px #000; }
.altar .sigil { position: absolute; inset: 0; display: grid; place-items: center; font-size: 110px; color: #7a1d1d; opacity: .45; animation: sigil 6s linear infinite; pointer-events: none; }
@keyframes sigil { to { transform: rotate(360deg); } }
.candle { position: absolute; transform: translate(-50%, -50%); width: 54px; height: 54px; border: 0; background: none; font-size: 32px; cursor: pointer; }
.candle .flame { display: block; filter: drop-shadow(0 0 8px rgb(255 170 60 / .8)); animation: flick 1.3s ease-in-out infinite; }
.candle.blood .flame { filter: drop-shadow(0 0 12px #ff1f1f) hue-rotate(-25deg) saturate(2); animation: flickFast .25s ease-in-out infinite; }
.candle.eye .flame { filter: drop-shadow(0 0 10px #9be7ff); animation: blink 1.4s ease-in-out infinite; }
.candle.out .flame { opacity: .35; }
@keyframes flick { 50% { transform: scale(1.06) translateY(-1px); } }
@keyframes flickFast { 50% { transform: scale(1.18) rotate(4deg); } }
@keyframes blink { 0%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.1); } 55% { transform: scaleY(1); } }
.masks { font-size: 64px; text-align: center; filter: drop-shadow(0 0 16px rgb(255 120 60 / .4)); animation: flick 3s ease-in-out infinite; }
.contract { display: block; background: linear-gradient(#f6ecd4, #e9d9b4); color: #3b2a1a; border-radius: 10px; padding: 14px 16px; text-align: left; font-family: Georgia, serif; box-shadow: inset 0 0 30px rgb(120 80 30 / .35); }
.contract .seal { display: block; text-align: center; font-size: 34px; color: #8b1a1a; }
.contract .cl { display: block; margin: 6px 0; font-size: 14px; }
.contract .sig { display: block; text-align: right; margin-top: 10px; color: #8b1a1a; }
.modal.ritual .modal-head, .modal.ritual .modal-body { background: transparent; }
.modal.ritual .hero span { background: radial-gradient(circle, #3b2318, #120a08); box-shadow: 0 0 24px rgb(255 120 40 / .35); }
.modal.ritual .modal-body { overflow-x: hidden; }
/* space mini-games */
.modal.space { background: radial-gradient(circle at 50% 20%, #1c2650, #070a18 80%); color: #e6ecff; }
.modal.space .modal-head, .modal.space .modal-body { background: transparent; }
.modal.space .modal-head h2, .modal.space .mg-msg, .modal.space .crowd-hud { color: #e6ecff; }
.modal.space .hero span { background: radial-gradient(circle, #2a3570, #0b1028); }
.dock-view, .lander-view { position: relative; height: 210px; border-radius: 16px; overflow: hidden; background: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #cfe, transparent), radial-gradient(1px 1px at 85% 15%, #fff, transparent), #0a0f26; }
.dock-view .port { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px; border: 3px dashed #7cf; border-radius: 50%; box-shadow: 0 0 18px #39f; }
.dock-view .port::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: #7cf; font-weight: 800; }
.dock-view .ship { position: absolute; font-size: 30px; transition: left .1s linear, top .1s linear; }
.lander-view { background-color: #05070f; }
.lander-view .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 6%; background: linear-gradient(#bdbdbd, #7d7d7d); }
.lander-view .lander { position: absolute; left: 50%; transform: translateX(-50%); font-size: 30px; transition: bottom .1s linear; }
.space-grid { background: #0a0f26; }
.space-grid .cell { background: #141c40; }
.space-grid .cell.debris { background: #3b2338; }
.road.starfield { background: #0a0f26; }
.road.starfield .cell { border-left-color: transparent; }
/* driving test, approach, harvest, fire */
.road-scene { display: flex; justify-content: center; align-items: center; gap: 18px; height: 90px; border-radius: 16px; background: linear-gradient(#bfe3ff 55%, #5b6270 55%); font-size: 40px; }
.road-scene .car { font-size: 34px; animation: carIdle 2.4s ease-in-out infinite; }
.exam-sheet { display: flex; justify-content: space-between; align-items: center; background: #fffbe8; color: #3b2a1a; border-radius: 10px; padding: 6px 10px; font-size: 12.5px; border: 1px dashed #c9b27a; }
.park-grid { background: #5b6270; }
.park-grid .cell { background: #6b7280; }
.park-grid .cell.curb { background: #8a909c; border-top: 4px solid #e8e8e8; }
.park-grid .cell.spot { outline: 2px dashed #ffd84d; outline-offset: -4px; }
.approach { position: relative; height: 190px; border-radius: 16px; overflow: hidden; background: linear-gradient(#7cc4ff, #cfeaff 75%, #6fbf5a 75%); }
.approach .slope { position: absolute; left: 0; bottom: 4%; width: 92%; height: 76%; background: linear-gradient(to top right, transparent calc(50% - 14px), rgb(255 255 255 / .55) calc(50% - 14px), rgb(255 255 255 / .55) calc(50% + 14px), transparent calc(50% + 14px)); pointer-events: none; }
.approach .plane { position: absolute; font-size: 26px; transition: left .16s linear, bottom .16s linear, transform .16s; }
.approach .runway { position: absolute; right: 2%; bottom: 12%; font-size: 22px; }
.harvest-field { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; border-radius: 14px; background: #7b5a3c; }
.harvest-field .plot { aspect-ratio: 1; border: 0; border-radius: 10px; background: #5d4228; font-size: 28px; }
.house .cell { border: 0; font-size: 24px; background: #e9dcc6; }
.house .cell.burning { background: #ffb36b; animation: flickFast .3s infinite; }
.house .cell.ash { background: #444; }
.dock-view.water { background: repeating-linear-gradient(170deg, #2f86c9 0 14px, #3b95d6 14px 28px); }
.dock-view.water .port { border-color: #fff; box-shadow: 0 0 10px #fff; }
.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.sec-title { font: 700 17px var(--f-display); margin: 18px 4px 6px; }
.emp-range { width: 100%; margin: 2px 0 10px; }

/* =====================================================================
   v1.13 visual refresh: aurora header, labelled stats, coloured cards,
   sliding tab glow, screen transitions, new-year burst, money counters
   ===================================================================== */
@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
:root { --head-3: #3b82f6; --glass: rgb(255 255 255 / .16); --glass-line: rgb(255 255 255 / .22); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --head-1: #0c6b55; --head-2: #0f5f74; --head-3: #3b2f8f; } }
:root[data-theme="dark"] { --head-1: #0c6b55; --head-2: #0f5f74; --head-3: #3b2f8f; }

body { background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 10%, var(--bg)), var(--bg)); }
#app { background: radial-gradient(500px 380px at 0% 40%, color-mix(in srgb, var(--violet) 7%, transparent), transparent), radial-gradient(500px 400px at 100% 80%, color-mix(in srgb, var(--sky) 7%, transparent), transparent), var(--bg); }

/* ---------- header ---------- */
#top { overflow: hidden; isolation: isolate; background: linear-gradient(135deg, var(--head-1), var(--head-2) 62%, var(--head-3)); border-radius: 0 0 28px 28px; padding: 14px 16px 14px; gap: 11px; box-shadow: 0 14px 34px -18px color-mix(in srgb, var(--head-2) 80%, #000); }
#top::before { content: ''; position: absolute; inset: -70%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side at 30% 38%, var(--glow-1, rgb(20 210 160 / .45)), transparent), radial-gradient(closest-side at 70% 58%, var(--glow-2, rgb(110 80 240 / .42)), transparent), radial-gradient(closest-side at 46% 72%, var(--glow-3, rgb(240 70 140 / .22)), transparent);
  animation: aurora 26s linear infinite; }
#top::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(1.5px 1.5px at 12% 22%, rgb(255 255 255 / .8), transparent), radial-gradient(1px 1px at 38% 12%, rgb(255 255 255 / .7), transparent), radial-gradient(1.5px 1.5px at 64% 30%, rgb(255 255 255 / .6), transparent), radial-gradient(1px 1px at 86% 16%, rgb(255 255 255 / .8), transparent), radial-gradient(1px 1px at 92% 64%, rgb(255 255 255 / .6), transparent), radial-gradient(1.5px 1.5px at 22% 70%, rgb(255 255 255 / .5), transparent);
  animation: twinkle 3.5s ease-in-out infinite alternate; }
@keyframes aurora { to { transform: rotate(360deg); } }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
.who-txt h1 { font-size: 23px; text-shadow: 0 2px 10px rgb(0 0 0 / .18); }
.who-txt p { opacity: .92; }
.age-txt { display: inline-block; font-weight: 800; }
.age-txt { transform-origin: 0 60%; }
.age-txt.bump { animation: bump .8s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-3deg); color: #fff7b0; } 100% { transform: scale(1); } }
.avatar { width: 60px; height: 60px; background: rgb(255 255 255 / .18); }
.avatar::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, #fff, rgb(255 255 255 / .05) 25%, #9ff3d8 50%, rgb(255 255 255 / .05) 75%, #fff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: spin 7s linear infinite; }
.avatar.pro::before { background: conic-gradient(from 0deg, #ffd34d, #ff9f1c 25%, #fff3b0 50%, #ff9f1c 75%, #ffd34d); }
.avatar em { z-index: 1; }
.icon-btn { background: var(--glass); border: 1px solid var(--glass-line); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), background .2s; }
.icon-btn:hover { transform: rotate(90deg) scale(1.06); background: rgb(255 255 255 / .28); }
.pro-badge { animation: proShine 3s ease-in-out infinite; background-size: 200% 100%; background-image: linear-gradient(110deg, #ffd34d 30%, #fff6c9 45%, #ff9f1c 60%); }
@keyframes proShine { 50% { background-position: 100% 0; } }

.money-row { gap: 8px; }
.pill-money { position: relative; overflow: hidden; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px; padding: 7px 12px 6px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pill-money span { display: flex; align-items: center; gap: 4px; font-size: 9.5px; letter-spacing: .03em; opacity: .9; white-space: nowrap; overflow: hidden; }
.pill-money span i { font-style: normal; font-size: 12px; letter-spacing: 0; }
.pill-money b { font-size: 20px; letter-spacing: .01em; text-shadow: 0 2px 8px rgb(0 0 0 / .18); }
.pill-money.gain { animation: gainFlash 1.1s ease; }
.pill-money.loss { animation: lossFlash .9s ease; }
.pill-money.gain::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / .6) 50%, transparent 70%); transform: translateX(-110%); animation: sweepX 1s ease forwards; pointer-events: none; }
@keyframes gainFlash { 25% { background: rgb(150 255 190 / .35); box-shadow: 0 0 0 2px rgb(190 255 210 / .8), 0 0 26px rgb(120 255 170 / .55); } }
@keyframes lossFlash { 20% { background: rgb(255 120 140 / .35); transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } }
@keyframes sweepX { to { transform: translateX(110%); } }
.econ { display: grid; justify-items: center; align-content: center; gap: 0; padding: 4px 8px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px; font-size: 11px; min-width: 58px; }
.econ i { font-style: normal; font-size: 18px; line-height: 1.1; }
.econ.boom { background: #fff; color: var(--good); border-color: #fff; animation: econGlow 2.4s ease-in-out infinite; }
.econ.boom i { animation: hop 1.6s ease-in-out infinite; }
.econ.recession { background: #ffe1e4; color: #c22a33; border-color: #ffc2c8; animation: econBad 2.4s ease-in-out infinite; }
@keyframes econGlow { 50% { box-shadow: 0 0 18px rgb(140 255 190 / .75); } }
@keyframes econBad { 50% { box-shadow: 0 0 18px rgb(255 110 130 / .7); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* stats: five labelled chips */
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stats .stat, .stats .stat:nth-child(n+4) { grid-column: auto; }
.stat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; background: rgb(0 0 0 / .16); border: 1px solid rgb(255 255 255 / .1); border-radius: 13px; padding: 5px 6px 4px; }
.st-top { display: flex; justify-content: space-between; align-items: center; gap: 2px; }
.st-top span { font-size: 14px; line-height: 1; }
.stat em, .st-top em { font: 700 15px/1 var(--f-display); font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.stat small { font-size: 10px; font-weight: 800; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.stat .bar { height: 6px; min-width: 0; }
.stat.rose { animation: statRose 1.3s ease; }
.stat.fell { animation: statFell 1.3s ease; }
@keyframes statRose { 25% { background: rgb(140 255 190 / .3); box-shadow: 0 0 14px rgb(140 255 190 / .5); } }
@keyframes statFell { 25% { background: rgb(255 120 140 / .32); box-shadow: 0 0 14px rgb(255 120 140 / .45); } }
.stat .float { top: -13px; right: -3px; font-size: 12px; box-shadow: 0 4px 10px rgb(0 0 0 / .2); z-index: 2; }
.bar i { position: relative; overflow: hidden; }
#top .bar i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .55), transparent); transform: translateX(-100%); animation: barShine 4s ease-in-out infinite; }
@keyframes barShine { 60%, 100% { transform: translateX(100%); } }

/* ---------- tab bar ---------- */
#tabs { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; }
#tabs::before { content: ''; position: absolute; top: 6px; left: var(--tx, -100px); width: 54px; height: 34px; margin-left: -27px; border-radius: 13px; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 24%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
  box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: left .5s cubic-bezier(.3, 1.45, .45, 1), opacity .25s; }
#tabs.has-on::before { opacity: 1; }
#tabs > button:not(.age-btn) { position: relative; padding-top: 10px; }
#tabs > button:not(.age-btn):hover { color: var(--ink); }
#tabs > button:not(.age-btn):hover svg { transform: translateY(-2px); }
#tabs > button.on svg { animation: tabHop .55s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes tabHop { 0% { transform: scale(.7); } 60% { transform: translateY(-4px) scale(1.2); } 100% { transform: translateY(-2px) scale(1.1); } }

.age-btn { position: relative; width: 76px; height: 76px; margin-top: -34px; background: radial-gradient(circle at 35% 28%, #ffb6c1, var(--accent-2) 52%, #c9284a); box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--accent-2) 85%, #000), inset 0 -5px 0 rgb(0 0 0 / .14), inset 0 3px 0 rgb(255 255 255 / .35); }
.age-btn::before { content: ''; position: absolute; inset: -12px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 12%, #ff5d73 26%, #ffc145 40%, transparent 54%, transparent 62%, #b06cff 76%, #4c8dff 88%, transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  animation: spin 3.2s linear infinite; }
.age-btn:hover:not(:disabled) { transform: scale(1.06) rotate(-3deg); }
.age-btn:hover:not(:disabled) b { animation: spin .6s cubic-bezier(.3, 1.4, .5, 1); }
.age-btn:disabled::before { animation-duration: .6s; }
.age-btn b { text-shadow: 0 2px 6px rgb(0 0 0 / .25); }

/* ---------- screen title ---------- */
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 4px 0; min-width: 0; }
.view-head h2 { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(90deg, var(--ink) 40%, color-mix(in srgb, var(--accent) 80%, var(--ink))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.view-head h2 svg { width: 26px; height: 26px; flex: none; fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.view-head .fold-all { margin: 0; flex: none; gap: 6px; }
.fold-all button { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 3px 9px; font-size: 11px; white-space: nowrap; transition: transform .15s, color .15s, background .15s; }
.fold-all button:hover { transform: translateY(-1px); color: var(--accent); background: var(--surface); }

/* ---------- cards: each section gets its own colour ---------- */
.card { animation: none; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 20px; }
.card.flat { background: var(--surface); box-shadow: var(--shadow); padding: 14px; }
.ci { width: 38px; height: 38px; border-radius: 12px; font-size: 21px; transition: transform .35s cubic-bezier(.3, 1.8, .5, 1);
  background: linear-gradient(140deg, hsl(var(--h, 160) 95% 93%), hsl(var(--h, 160) 80% 83%)); box-shadow: inset 0 -2px 0 hsl(var(--h, 160) 60% 60% / .35); }
.card.flat .ci, .card.flat.fold > summary .ci { background: linear-gradient(140deg, hsl(var(--h, 160) 95% 93%), hsl(var(--h, 160) 80% 83%)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ci, :root:not([data-theme="light"]) .card.flat .ci { background: linear-gradient(140deg, hsl(var(--h, 160) 45% 30%), hsl(var(--h, 160) 50% 18%)); box-shadow: inset 0 0 0 1px hsl(var(--h, 160) 60% 55% / .35); } }
:root[data-theme="dark"] .ci, :root[data-theme="dark"] .card.flat .ci { background: linear-gradient(140deg, hsl(var(--h, 160) 45% 30%), hsl(var(--h, 160) 50% 18%)); box-shadow: inset 0 0 0 1px hsl(var(--h, 160) 60% 55% / .35); }
.card.society .ci, .card.illum .ci { background: rgb(255 255 255 / .1); box-shadow: none; }
.card h3 { font-size: 17.5px; }
.card.fold { transition: box-shadow .25s, transform .25s; }
.card.fold[open] { box-shadow: var(--shadow), inset 4px 0 0 hsl(var(--h, 160) 75% 50%); }
.card.fold:not([open]):hover { transform: translateY(-2px); box-shadow: 0 14px 30px -16px hsl(var(--h, 160) 60% 35% / .55); }
.card.fold > summary:hover .ci { transform: rotate(-10deg) scale(1.1); }
.card.fold .chev { width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-size: 19px; padding-bottom: 2px; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), background .2s, color .2s; }
.card.fold[open] .chev { background: hsl(var(--h, 160) 80% 50% / .18); color: hsl(var(--h, 160) 70% 45%); }
.card.fold.just-opened > .fold-body > * { animation: foldIn .45s cubic-bezier(.2, .9, .3, 1.15) both; }
.card.fold.just-opened > .fold-body > :nth-child(2) { animation-delay: .04s; } .card.fold.just-opened > .fold-body > :nth-child(3) { animation-delay: .08s; }
.card.fold.just-opened > .fold-body > :nth-child(4) { animation-delay: .12s; } .card.fold.just-opened > .fold-body > :nth-child(n+5) { animation-delay: .16s; }
.card.fold.just-opened canvas.chart { animation: wipe 1s cubic-bezier(.3, .8, .3, 1) both; }
@keyframes foldIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.ledger.card { border-radius: 20px; }

/* ---------- screen transitions ---------- */
#view { overflow-x: hidden; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent; }
#view.enter > * { animation: viewIn .5s cubic-bezier(.2, .9, .25, 1.08) both; }
#view.enter.from-r > * { --fx: 34px; --fy: 0px; } #view.enter.from-l > * { --fx: -34px; --fy: 0px; }
#view.enter > :nth-child(2) { animation-delay: .04s; } #view.enter > :nth-child(3) { animation-delay: .08s; } #view.enter > :nth-child(4) { animation-delay: .12s; }
#view.enter > :nth-child(5) { animation-delay: .16s; } #view.enter > :nth-child(6) { animation-delay: .2s; } #view.enter > :nth-child(n+7) { animation-delay: .24s; }
#view.enter canvas.chart { animation: wipe 1.1s .15s cubic-bezier(.3, .8, .3, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translate(var(--fx, 0px), var(--fy, 16px)) scale(.985); } }

/* ---------- life story: a timeline ---------- */
.log { position: relative; padding-left: 22px; gap: 14px; }
.log::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: 18px; width: 3px; border-radius: 3px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--violet) 50%, transparent) 40%, transparent); }
.log-year { position: relative; border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: 20px; }
.log-year::before { content: ''; position: absolute; left: -21px; top: 16px; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 3px solid color-mix(in srgb, var(--accent) 60%, var(--line)); box-sizing: border-box; }
.log-year.latest { border: 2px solid transparent; animation: angSpin 7s linear infinite;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, conic-gradient(from var(--ang), var(--accent), var(--sky), var(--violet), var(--accent-2), var(--gold), var(--accent)) border-box;
  box-shadow: 0 16px 34px -18px color-mix(in srgb, var(--accent) 65%, transparent); }
.log-year.latest::before { left: -22px; background: var(--accent); border-color: var(--surface); animation: dotPulse 1.8s ease-out infinite; }
@keyframes angSpin { to { --ang: 360deg; } }
@keyframes dotPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
.age-chip { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--sky))); box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--accent) 70%, transparent); }
.log-year p { grid-template-columns: 28px 1fr; gap: 8px; margin-bottom: 7px; }
.log-year p i { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: var(--sunk); }
.log-year p.good i { background: color-mix(in srgb, var(--good) 18%, var(--sunk)); }
.log-year p.bad i { background: color-mix(in srgb, var(--bad) 18%, var(--sunk)); }
.log-year p.warn i { background: color-mix(in srgb, var(--warn) 20%, var(--sunk)); }
.log-year p span { padding-top: 3px; }
#view.aged .log-year.latest p { animation: logIn .5s cubic-bezier(.2, .9, .3, 1.2) both; }
#view.aged .log-year.latest p:nth-of-type(1) { animation-delay: .25s; } #view.aged .log-year.latest p:nth-of-type(2) { animation-delay: .37s; }
#view.aged .log-year.latest p:nth-of-type(3) { animation-delay: .49s; } #view.aged .log-year.latest p:nth-of-type(4) { animation-delay: .61s; }
#view.aged .log-year.latest p:nth-of-type(5) { animation-delay: .73s; } #view.aged .log-year.latest p:nth-of-type(n+6) { animation-delay: .85s; }
@keyframes logIn { from { opacity: 0; transform: translateX(-14px); } }

/* ---------- tiles and buttons ---------- */
.tile { position: relative; overflow: hidden; border-radius: 18px; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s, border-color .2s; }
.tile i { transition: transform .35s cubic-bezier(.3, 1.8, .5, 1); }
.tile:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 12px 24px -12px hsl(var(--h, 160) 70% 38% / .6); border-color: hsl(var(--h, 160) 70% 55% / .75); }
.tile:hover:not(:disabled) i { transform: scale(1.2) rotate(-7deg); }
.tile::after, .btn.primary::after { content: ''; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; pointer-events: none; background: linear-gradient(100deg, transparent, rgb(255 255 255 / .45), transparent); transform: skewX(-20deg); }
.tile:hover:not(:disabled)::after, .btn.primary:hover:not(:disabled)::after { animation: sweep .75s ease; }
@keyframes sweep { to { left: 130%; } }
.btn.primary { position: relative; overflow: hidden; }
.btn { transition: transform .15s cubic-bezier(.3, 1.6, .5, 1), background .15s, box-shadow .15s, border-color .15s; }
.btn:hover:not(:disabled):not(.primary) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.seg button.on { animation: segOn .35s cubic-bezier(.3, 1.6, .5, 1); color: var(--accent); }
@keyframes segOn { from { transform: scale(.9); } }

/* ---------- pop-ups ---------- */
.modal-wrap { background: radial-gradient(circle at 50% 40%, rgb(30 40 80 / .42), rgb(5 8 18 / .68)); -webkit-backdrop-filter: blur(6px) saturate(1.15); backdrop-filter: blur(6px) saturate(1.15); }
.modal { animation: modalIn .5s cubic-bezier(.2, 1.25, .3, 1); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
@keyframes modalIn { from { transform: translateY(70px) scale(.9); opacity: 0; } 50% { opacity: 1; } }
.hero { position: relative; }
.hero::before { content: ''; position: absolute; left: 50%; top: 54px; width: 170px; height: 170px; margin: -85px 0 0 -85px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 0 9deg, transparent 9deg 22.5deg);
  -webkit-mask: radial-gradient(closest-side, #000 35%, transparent); mask: radial-gradient(closest-side, #000 35%, transparent);
  animation: spin 16s linear infinite, fade .6s ease both; }
.hero.good::before { background: repeating-conic-gradient(color-mix(in srgb, var(--gold) 45%, transparent) 0 9deg, transparent 9deg 22.5deg); animation-duration: 9s, .6s; }
.hero.bad::before { background: repeating-conic-gradient(color-mix(in srgb, var(--bad) 30%, transparent) 0 9deg, transparent 9deg 22.5deg); }
.hero span { position: relative; z-index: 1; }
.hero.good span { animation: bounceIn .55s cubic-bezier(.2, 1.6, .4, 1), heroFloat 2.6s 0.6s ease-in-out infinite; box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 22%, transparent), var(--shadow); }
.hero.bad span { animation: bounceIn .5s cubic-bezier(.2, 1.6, .4, 1), heroShake .5s .5s; }
@keyframes heroFloat { 50% { transform: translateY(-5px) rotate(3deg); } }
@keyframes heroShake { 20% { transform: translateX(-7px) rotate(-6deg); } 40% { transform: translateX(7px) rotate(6deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.modal-head h2 { animation: titleIn .45s .08s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes titleIn { from { opacity: 0; transform: translateY(8px) scale(.95); } }
.modal-body > .ev-text + .choices > .btn { animation: choiceIn .4s cubic-bezier(.2, 1.3, .4, 1) both; }
.modal-body > .ev-text + .choices > .btn:nth-child(1) { animation-delay: .12s; } .modal-body > .ev-text + .choices > .btn:nth-child(2) { animation-delay: .18s; }
.modal-body > .ev-text + .choices > .btn:nth-child(3) { animation-delay: .24s; } .modal-body > .ev-text + .choices > .btn:nth-child(n+4) { animation-delay: .3s; }
@keyframes choiceIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.btn.choice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.x { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), background .15s; }
.x:hover { transform: rotate(90deg); background: color-mix(in srgb, var(--bad) 18%, var(--sunk)); }

/* ---------- toast ---------- */
#toast { display: flex; align-items: center; gap: 10px; text-align: left; padding: 11px 16px 13px 12px; overflow: hidden; transform: translate(-50%, 30px) scale(.9); border: 1px solid rgb(255 255 255 / .12); }
#toast.show { transform: translate(-50%, 0) scale(1); }
#toast i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 800 14px var(--f-display); font-style: normal; background: rgb(255 255 255 / .22); }
#toast.show i { animation: bounceIn .5s cubic-bezier(.2, 1.6, .4, 1); }
#toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgb(255 255 255 / .45); transform-origin: left; transform: scaleX(0); }
#toast.show::after { animation: toastTime 2.8s linear forwards; }
@keyframes toastTime { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- effects layer ---------- */
.tap-fx { position: fixed; z-index: 300; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; pointer-events: none; border: 2px solid var(--accent); animation: tapFx .55s ease-out forwards; }
.tap-fx.big { border-color: var(--accent-2); border-width: 3px; animation: tapFxBig .7s ease-out forwards; }
@keyframes tapFx { from { transform: scale(.3); opacity: .9; } to { transform: scale(5); opacity: 0; } }
@keyframes tapFxBig { from { transform: scale(.5); opacity: 1; } to { transform: scale(9); opacity: 0; } }
.pop-at { position: fixed; z-index: 300; transform: translate(-50%, 0); pointer-events: none; font: 700 14px var(--f-display); padding: 3px 10px; border-radius: 99px; background: #fff; box-shadow: 0 6px 18px rgb(0 0 0 / .25); white-space: nowrap; animation: popAt 1.6s cubic-bezier(.2, .9, .3, 1) forwards; }
.pop-at.up { color: #12a150; } .pop-at.down { color: #e5484d; }
@keyframes popAt { 0% { opacity: 0; transform: translate(-50%, 0) scale(.5); } 15% { opacity: 1; transform: translate(-50%, 6px) scale(1.12); } 70% { opacity: 1; transform: translate(-50%, 14px) scale(1); } 100% { opacity: 0; transform: translate(-50%, 26px); } }

/* the new-year burst */
.age-fx { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; pointer-events: none; animation: afBg 1.5s ease forwards;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%); }
.age-fx > * { grid-area: 1 / 1; }
.af-num { display: grid; justify-items: center; line-height: 1; color: #fff; animation: afNum 1.5s cubic-bezier(.2, 1.4, .3, 1) forwards; filter: drop-shadow(0 6px 22px rgb(0 0 0 / .35)); }
.af-num small { font: 700 16px var(--f-display); text-transform: uppercase; letter-spacing: .3em; opacity: .9; }
.af-num b { font: 700 108px/1 var(--f-display); background: linear-gradient(180deg, #fff, #c8ffe9 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.af-num span { font: 700 15px var(--f-display); opacity: .85; letter-spacing: .12em; }
.af-ring { width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--accent); animation: afRing 1.1s cubic-bezier(.1, .7, .3, 1) forwards; }
.af-ring.r2 { border-color: var(--accent-2); border-width: 2px; animation-delay: .12s; opacity: 0; }
.af-p { width: 10px; height: 10px; border-radius: 3px; background: var(--gold); transform: rotate(var(--a)) translateY(0); animation: afP 1.1s cubic-bezier(.1, .7, .3, 1) forwards; }
.af-p:nth-child(3n) { background: var(--accent-2); border-radius: 50%; } .af-p:nth-child(3n+1) { background: var(--sky); }
.age-fx.milestone .af-num b { background: linear-gradient(180deg, #fff8d6, #ffd34d 55%, #ff9f1c); -webkit-background-clip: text; background-clip: text; }
.age-fx.milestone .af-ring { border-color: var(--gold); }
.age-fx.milestone { background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--gold) 40%, transparent), transparent 60%); }
@keyframes afBg { 0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes afNum { 0% { opacity: 0; transform: scale(.3) rotate(-8deg); } 22% { opacity: 1; transform: scale(1.12) rotate(2deg); } 34% { transform: scale(1); } 72% { opacity: 1; transform: scale(1) translateY(0); } 100% { opacity: 0; transform: scale(.55) translateY(-38vh); } }
@keyframes afRing { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(4.2); opacity: 0; } }
@keyframes afP { 0% { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1; } 100% { transform: rotate(var(--a)) translateY(calc(-1 * var(--d))) scale(.3) rotate(180deg); opacity: 0; } }

/* ---------- emblems: Square and Compasses, Eye of Providence ---------- */
.emb { display: block; width: 100%; height: 100%; overflow: visible; }
.emb-wrap { display: grid; place-items: center; width: 100%; height: 100%; }
.ci .emb-wrap { width: 34px; height: 34px; }
.card .ci:has(.emb-wrap) { background: none; box-shadow: none; }
.hero span:has(.emb-wrap) { background: radial-gradient(circle, #2a2410, #0e0c06); box-shadow: 0 0 26px rgb(242 199 90 / .45); }
.hero span .emb-wrap { width: 70px; height: 70px; }
.log-year p i:has(.emb-wrap) { background: none; }
.log-year p i .emb-wrap { width: 26px; height: 26px; }
.emb.eye .eye-ball { transform-origin: 50px 36px; animation: blink 6s ease-in-out infinite; }
.emb.eye .rays { animation: raysPulse 3s ease-in-out infinite; }
@keyframes raysPulse { 50% { opacity: .4; } }
.crest { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 16px; background: radial-gradient(circle at 14% 50%, rgb(242 199 90 / .28), transparent 55%), rgb(255 255 255 / .05); border: 1px solid rgb(242 199 90 / .25); }
.crest > .emb { width: 76px; height: 76px; flex: none; animation: crestGlow 3.6s ease-in-out infinite; }
.crest > div { display: grid; min-width: 0; }
.crest b { font: 700 22px var(--f-display); color: #f2c75a; }
.crest span { font-size: 13px; opacity: .85; }
@keyframes crestGlow { 0%, 100% { filter: drop-shadow(0 0 6px rgb(242 199 90 / .35)); } 50% { filter: drop-shadow(0 0 16px rgb(242 199 90 / .75)); } }
.card.masons { background: linear-gradient(135deg, #0f1d44, #1c2f68); color: #eef2ff; border-color: rgb(231 184 76 / .3); }
.card.masons .sub, .card.masons .kv > span, .card.masons .fine { color: #c3cdf0; }
.card.masons .tile { background: rgb(255 255 255 / .06); border-color: rgb(231 184 76 / .22); color: #eef2ff; }
.card.masons .tile small { color: #c3cdf0; }
.card.masons .chev, .card.society .chev, .card.illum .chev { background: rgb(255 255 255 / .1); color: #f2c75a; }
.card.masons[open], .card.illum[open] { box-shadow: var(--shadow), inset 4px 0 0 #e7b84c; }
.card.masons .btn.primary { --accent: #e7b84c; --accent-ink: #2a1c00; }

/* ---------- Alzheimer's: the screen fades with the mind (--fog goes 0 → 1) ---------- */
body.alz #app { filter: saturate(calc(1 - var(--fog) * .9)) sepia(calc(var(--fog) * .3)) contrast(calc(1 - var(--fog) * .25)) blur(calc(var(--fog) * var(--fog) * 1.3px)); }
body.alz #top, body.alz #view { opacity: calc(1 - var(--fog) * .45); }
body.alz #app * { text-shadow: calc(var(--fog) * 3px) calc(var(--fog) * 1px) calc(var(--fog) * 2px) rgb(128 128 140 / calc(var(--fog) * .55)); }
body.alz #app::after { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent calc(78% - var(--fog) * 55%), rgb(200 200 210 / calc(var(--fog) * .9)) 100%);
  animation: fogDrift 9s ease-in-out infinite alternate; }
@keyframes fogDrift { from { transform: scale(1); opacity: 1; } to { transform: scale(1.08); opacity: .75; } }
body.alz #view { animation: sway 9s ease-in-out infinite; }
@keyframes sway { 50% { transform: translateX(calc(var(--fog) * 6px)) rotate(calc(var(--fog) * .5deg)); } }
body.alz #view > :nth-child(odd):not(.view-head) { rotate: calc(var(--fog) * var(--fog) * -1.2deg); translate: calc(var(--fog) * var(--fog) * -6px) 0; }
body.alz #view > :nth-child(even):not(.view-head) { rotate: calc(var(--fog) * var(--fog) * 1.2deg); translate: calc(var(--fog) * var(--fog) * 6px) 0; }
body.alz .log-year:not(.latest) { filter: blur(calc(var(--fog) * 2.5px)); opacity: calc(1 - var(--fog) * .65); }
body.alz .avatar .av { filter: grayscale(var(--fog)) blur(calc(var(--fog) * 2.5px)); }
body.alz .modal { filter: saturate(calc(1 - var(--fog) * .7)) blur(calc(var(--fog) * var(--fog) * .7px)); }
body.alz .age-fx { filter: grayscale(var(--fog)) blur(calc(var(--fog) * 3px)); opacity: calc(1 - var(--fog) * .6); }
.age-btn.lost { background: radial-gradient(circle at 35% 28%, #d9d9de, #9a9aa5 60%, #6d6d78); opacity: .45; animation: none; }
.age-btn.lost::before { opacity: .25; }

/* the game is a full-screen app: only #view and pop-ups scroll, never the page (the Age ring pokes past the bottom edge) */
html, body { overflow: hidden; }

/* ---------- v1.14: fitness plans, the presidency, Minerval ---------- */
.fit-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fit-plan { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 10px 6px; border-radius: 16px; border: 1.5px solid hsl(var(--h, 160) 60% 55% / .45); background: linear-gradient(160deg, hsl(var(--h, 160) 90% 50% / .1), transparent 70%), var(--surface); min-width: 0; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s; }
.fit-plan:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -12px hsl(var(--h, 160) 70% 38% / .6); }
.fit-plan > i { font-style: normal; font-size: 28px; line-height: 1.1; transition: transform .35s cubic-bezier(.3, 1.8, .5, 1); }
.fit-plan:hover > i { transform: scale(1.18) rotate(-6deg); }
.fit-plan span { display: grid; gap: 1px; min-width: 0; }
.fit-plan small { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fit-plan b { font-size: 12.5px; line-height: 1.2; }
.fit-plan em { font-style: normal; font-size: 11px; font-weight: 800; color: hsl(var(--h, 160) 60% 42%); }
.job small.fx { color: var(--ink); font-weight: 700; opacity: .8; }
.job.fit-opt.cur { background: color-mix(in srgb, var(--good) 9%, transparent); border-radius: 12px; padding-left: 6px; padding-right: 6px; }
.pres-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgb(255 255 255 / .06); border: 1px solid rgb(242 199 90 / .25); }
.pres-head > div { display: grid; flex: 1; min-width: 0; }
.pres-head b { font: 700 18px var(--f-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres-head small { color: #e8d79c; font-weight: 700; }
.pres-ic { font-size: 34px; filter: drop-shadow(0 0 10px rgb(242 199 90 / .5)); animation: hop 2.4s ease-in-out infinite; }
.card.illum .cand-row { border-bottom-color: rgb(255 255 255 / .1); }
.card.illum .cand-row small { color: #e8d79c; }
.card.illum .jicon { background: rgb(255 255 255 / .08); }
.card.illum .sub-h { color: #e8d79c; }
.crest.owl .owl-ic { font-size: 54px; line-height: 1; width: 76px; text-align: center; flex: none; animation: crestGlow 3.6s ease-in-out infinite, owlTilt 5s ease-in-out infinite; }
@keyframes owlTilt { 0%, 100% { transform: rotate(0); } 40% { transform: rotate(-8deg); } 55% { transform: rotate(6deg); } }
@media (max-width: 420px) { .fit-plan b { font-size: 11.5px; } .fit-plans { gap: 6px; } }

/* ---------- v1.15: money in politics ---------- */
.pres-head { background: var(--sunk); border: 1px solid var(--line); }
.pres-head small { color: var(--muted); }
.card.illum .pres-head { background: rgb(255 255 255 / .06); border-color: rgb(242 199 90 / .25); }
.card.illum .pres-head small { color: #e8d79c; }
.cand-row .bar { margin-top: 4px; max-width: 200px; height: 6px; }
.card.elections .chips { margin-top: 2px; }

/* ---------- v1.15: PRO face designer ---------- */
.av-maker { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; }
.av-prev { display: grid; gap: 8px; position: sticky; top: 60px; }
.av-prev figure { margin: 0; display: grid; justify-items: center; gap: 2px; }
.av-prev .av { width: 80px; height: 80px; box-shadow: var(--shadow); }
.av-prev figcaption { font-size: 11px; font-weight: 800; color: var(--muted); }
.av-opts { display: grid; gap: 8px; min-width: 0; }
.av-row { display: grid; gap: 4px; }
.av-row > span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.av-opts .chips .chip { padding: 4px 10px; font-size: 12px; }
.swatch-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--c); padding: 0; transition: transform .2s; }
.swatch-btn.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); transform: scale(1.1); }
@media (max-width: 420px) { .av-maker { grid-template-columns: 1fr; } .av-prev { grid-template-columns: 1fr 1fr; position: static; } }

/* ---------- v1.17.1: coin boxes ---------- */
.coin-box { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--sunk); border: 1px solid var(--line); }
.coin-head { display: flex; align-items: center; gap: 10px; }
.coin-head i { font-style: normal; font-size: 28px; }
.coin-head div { display: grid; }
.coin-head em { margin-left: auto; }
.coin-box .chart { height: 110px; margin: 6px 0 4px; }
.coin-head b { font: 700 18px var(--f-display); }
.coin-head small { color: var(--muted); font-weight: 700; }
.coin-row { display: grid; gap: 4px; }
.coin-row > span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.coin-row .chip { font-size: 12px; padding: 4px 10px; }
.trade-btns .btn { flex: 1; align-items: center; }
#tLev, #tAmt { margin-top: 6px; }

/* ---------- color themes (Menu › Colors). html:root beats the dark-mode rules so each palette works in light and dark ---------- */
html:root[data-palette="ocean"] { --accent: #1e88e5; --accent-2: #ff7a59; --head-1: #1565c0; --head-2: #26a5d8; --felt: #0d4f7a; --accent-ink: #ffffff; }
html:root[data-palette="sunset"] { --accent: #f97316; --accent-2: #e11d48; --head-1: #ea580c; --head-2: #f43f5e; --felt: #7c2d12; --accent-ink: #ffffff; }
html:root[data-palette="forest"] { --accent: #16a34a; --accent-2: #d97706; --head-1: #14532d; --head-2: #4d7c0f; --felt: #14532d; --accent-ink: #ffffff; }
html:root[data-palette="royal"] { --accent: #8b5cf6; --accent-2: #f59e0b; --head-1: #4c1d95; --head-2: #9333ea; --felt: #3b0764; --accent-ink: #ffffff; }
html:root[data-palette="rose"] { --accent: #ec4899; --accent-2: #8b5cf6; --head-1: #be185d; --head-2: #f472b6; --felt: #831843; --accent-ink: #ffffff; }
html:root[data-palette="gold"] { --accent: #d4a017; --accent-2: #e11d48; --head-1: #1c1c28; --head-2: #4a3b12; --felt: #1c1c28; --accent-ink: #1a1205; }
/* Halloween: always dark, pumpkin orange and witch purple, bats in the header */
html:root[data-palette="halloween"] {
  --bg: #120c19; --surface: #1d1427; --sunk: #2a1c38; --ink: #f6ecff; --muted: #b9a1d1; --line: #3a2a4b;
  --accent: #ff7a1a; --accent-ink: #1f0c00; --accent-2: #a463ff; --gold: #ffb020; --good: #7ed957; --bad: #ff5468; --warn: #ffb020;
  --head-1: #3b0d5c; --head-2: #d9480f; --felt: #2a0e3d; color-scheme: dark;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 26px -12px rgb(0 0 0 / .8);
}
html:root[data-palette="halloween"] body {
  background: radial-gradient(circle at 85% -10%, rgb(255 122 26 / .18), transparent 40%), var(--bg);
  background-image: radial-gradient(circle at 85% -10%, rgb(255 122 26 / .16), transparent 40%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cpath d='M30 40c4-6 8-6 10-2 2-4 6-4 10 2-4-1-6 1-7 4-1-2-3-3-3-3s-2 1-3 3c-1-3-3-5-7-4z' fill='%23a463ff' opacity='.08'/%3E%3Cpath d='M100 105c4-6 8-6 10-2 2-4 6-4 10 2-4-1-6 1-7 4-1-2-3-3-3-3s-2 1-3 3c-1-3-3-5-7-4z' fill='%23ff7a1a' opacity='.07'/%3E%3C/svg%3E");
  background-color: var(--bg);
}
html:root[data-palette="halloween"] .card { border-color: color-mix(in srgb, var(--accent) 22%, var(--line)); }
html:root[data-palette="halloween"] .tile:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow); }
/* the swatches in the Menu */
.pal-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-pick button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: linear-gradient(135deg, var(--a), var(--b)); display: grid; place-items: center; font-size: 15px; }
.pal-pick button.on { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
/* achievements */
.ach-head { display: grid; gap: 6px; margin-bottom: 8px; }
.ach-cat { margin: 14px 0 6px; font: 800 12px var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 14px; background: var(--sunk); }
.ach i { font-style: normal; font-size: 24px; }
.ach b { display: block; font-size: 13px; line-height: 1.2; }
.ach small { display: block; font-size: 11px; color: var(--muted); line-height: 1.25; }
.ach.locked i { filter: grayscale(1); opacity: .35; }
.ach.locked b { color: var(--muted); }
.ach.got { background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 22%, var(--sunk)), var(--sunk)); }
/* birth screen: the family wealth options wrap into a grid so every one is visible (no hidden sideways scroll) */
.kv.wrap:has(#nlW) { flex-wrap: wrap; }
#nlW { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); width: 100%; overflow: visible; }
#nlW button { white-space: normal; display: grid; gap: 1px; text-align: center; }
#nlW button small { font-weight: 700; font-size: 11px; opacity: .8; }

/* ---------- living themes: header glows, backgrounds and ambience per palette ---------- */
html:root[data-palette="ocean"] { --glow-1: rgb(60 200 255 / .5); --glow-2: rgb(20 90 220 / .45); --glow-3: rgb(120 255 230 / .25); }
html:root[data-palette="sunset"] { --glow-1: rgb(255 190 80 / .55); --glow-2: rgb(255 70 120 / .45); --glow-3: rgb(170 60 200 / .3); }
html:root[data-palette="forest"] { --glow-1: rgb(140 220 90 / .45); --glow-2: rgb(30 120 70 / .5); --glow-3: rgb(230 200 90 / .25); }
html:root[data-palette="royal"] { --glow-1: rgb(190 120 255 / .5); --glow-2: rgb(80 40 200 / .5); --glow-3: rgb(255 200 80 / .3); }
html:root[data-palette="rose"] { --glow-1: rgb(255 150 200 / .55); --glow-2: rgb(220 60 140 / .45); --glow-3: rgb(255 220 240 / .35); }
html:root[data-palette="gold"] { --glow-1: rgb(255 210 90 / .35); --glow-2: rgb(120 90 20 / .5); --glow-3: rgb(255 240 180 / .2); }
html:root[data-palette="halloween"] { --glow-1: rgb(255 120 20 / .55); --glow-2: rgb(130 40 220 / .55); --glow-3: rgb(60 255 120 / .18); }
html:root[data-palette="ocean"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #26a5d8 18%, var(--bg)), var(--bg)); }
html:root[data-palette="sunset"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #f97316 16%, var(--bg)), color-mix(in srgb, #f43f5e 6%, var(--bg))); }
html:root[data-palette="forest"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #4d7c0f 16%, var(--bg)), var(--bg)); }
html:root[data-palette="royal"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #9333ea 16%, var(--bg)), var(--bg)); }
html:root[data-palette="rose"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #f472b6 18%, var(--bg)), var(--bg)); }
html:root[data-palette="gold"] body { background: radial-gradient(1200px 700px at 50% -10%, color-mix(in srgb, #d4a017 14%, var(--bg)), var(--bg)); }
html:root[data-palette] #app { background: transparent; }
html:root[data-palette] .card { border-color: color-mix(in srgb, var(--accent) 16%, var(--line)); }

/* the ambience layer: drifting particles above the page, below the tab bar, never catching taps */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.fx-p { position: absolute; left: var(--x); top: 0; opacity: .5; will-change: transform; animation-timing-function: linear; animation-iteration-count: infinite; }
.fx-rise { animation-name: fxRise; }
.fx-fall { animation-name: fxFall; }
.fx-float { top: var(--y); animation-name: fxFloat; animation-timing-function: ease-in-out; }
.fx-twinkle { top: var(--y); animation-name: fxTwinkle; animation-timing-function: ease-in-out; opacity: 0; }
.fx-bat { top: calc(var(--y) * .45); left: -40px; opacity: .55; animation-name: fxBat; }
@keyframes fxRise { from { transform: translate(0, 105vh); } 50% { transform: translate(18px, 50vh); } to { transform: translate(-6px, -8vh); } }
@keyframes fxFall { from { transform: translate(0, -8vh) rotate(0deg); } 50% { transform: translate(-30px, 50vh) rotate(180deg); } to { transform: translate(20px, 105vh) rotate(360deg); } }
@keyframes fxFloat { 0%, 100% { transform: translate(0, 0); opacity: .15; } 50% { transform: translate(14px, -26px); opacity: .55; } }
@keyframes fxTwinkle { 0%, 100% { opacity: 0; transform: scale(.6); } 50% { opacity: .7; transform: scale(1.1); } }
@keyframes fxBat { 0% { transform: translate(0, 0) scale(1, 1); } 10% { transform: translate(12vw, -14px) scale(1, .6); } 20% { transform: translate(24vw, 8px) scale(1, 1); } 35% { transform: translate(42vw, -18px) scale(1, .6); } 50% { transform: translate(60vw, 10px) scale(1, 1); } 65% { transform: translate(78vw, -12px) scale(1, .6); } 80% { transform: translate(96vw, 6px) scale(1, 1); } 100% { transform: translate(115vw, -20px) scale(1, .6); } }

/* ---------- Halloween, all the way ---------- */
/* a spider dangles from the corner on a silk thread */
.fx-spider { position: absolute; right: 18px; top: 0; width: 2px; height: 120px; background: linear-gradient(rgb(255 255 255 / .35), rgb(255 255 255 / .15)); transform-origin: top center; animation: fxSpider 7s ease-in-out infinite; }
.fx-spider i { position: absolute; bottom: -16px; left: -9px; font-style: normal; font-size: 20px; opacity: .8; }
@keyframes fxSpider { 0%, 100% { height: 90px; transform: rotate(3deg); } 50% { height: 150px; transform: rotate(-3deg); } }
/* low mist rolling above the tab bar */
.fx-mist { position: absolute; left: -20%; right: -20%; bottom: 60px; height: 170px; opacity: .55;
  background: radial-gradient(40% 60% at 20% 70%, rgb(160 110 220 / .28), transparent), radial-gradient(35% 55% at 65% 80%, rgb(120 80 190 / .25), transparent), radial-gradient(30% 50% at 90% 60%, rgb(255 140 60 / .12), transparent);
  animation: fxMist 18s ease-in-out infinite alternate; filter: blur(6px); }
@keyframes fxMist { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
/* cards glow like candlelight */
html:root[data-palette="halloween"] .card { box-shadow: 0 0 0 1px rgb(255 122 26 / .08), 0 10px 30px -18px rgb(255 122 26 / .45), var(--shadow); }
html:root[data-palette="halloween"] .log-year.latest { animation: candle 3.2s ease-in-out infinite; }
@keyframes candle { 0%, 100% { box-shadow: 0 0 22px -6px rgb(255 122 26 / .55); } 45% { box-shadow: 0 0 28px -4px rgb(255 150 40 / .7); } 52% { box-shadow: 0 0 16px -8px rgb(255 110 20 / .45); } }
html:root[data-palette="halloween"] #top { box-shadow: 0 14px 40px -16px rgb(255 100 20 / .55); }
html:root[data-palette="halloween"] #tabs { background: linear-gradient(180deg, #1f1430, #170f22); }
/* birth screen (PRO): appearance and stats fold away; hairstyle and beard step with arrows */
.nl-fold { margin: 10px 0; border-radius: 16px; background: var(--sunk); padding: 0 12px; }
.nl-fold > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 0; font-weight: 800; cursor: pointer; }
.nl-fold > summary::-webkit-details-marker { display: none; }
.nl-fold > summary > span:first-child { flex: 1; }
.nl-fold[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.nl-arrow { font-style: normal; transition: transform .2s; color: var(--muted); }
.nl-fold[open] .nl-arrow { transform: rotate(180deg); }
.nl-mini .av { width: 30px; height: 30px; }
.nl-fold[open] .nl-mini { display: none; }
.av-cyc { display: flex; align-items: center; gap: 8px; }
.av-cyc b { min-width: 96px; text-align: center; font-size: 14px; }
.av-cyc .chip { width: 34px; height: 30px; padding: 0; justify-content: center; font-size: 18px; font-weight: 800; }
/* the age button: a drawn pumpkin everywhere is hidden, except in Halloween where it replaces the round button */
.age-btn .pk { display: none; }
html:root[data-palette="halloween"] .age-btn {
  position: relative; width: 92px; height: 86px; margin-top: -40px; border: 0; border-radius: 0; background: none; box-shadow: none; overflow: visible;
  animation: pkBob 3.2s ease-in-out infinite;
}
html:root[data-palette="halloween"] .age-btn .pk { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible;
  filter: drop-shadow(0 0 12px rgb(255 130 20 / .55)) drop-shadow(0 8px 10px rgb(0 0 0 / .55)); }
html:root[data-palette="halloween"] .age-btn .pk-face { animation: pkFlicker 2.6s steps(1, end) infinite; }
html:root[data-palette="halloween"] .age-btn b { display: none; }
html:root[data-palette="halloween"] .age-btn span { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10px; letter-spacing: .14em; color: #fff3c4; text-shadow: 0 1px 3px #3a1300, 0 0 6px rgb(0 0 0 / .6); }
html:root[data-palette="halloween"] .age-btn:hover:not(:disabled) .pk { filter: drop-shadow(0 0 20px rgb(255 160 40 / .85)) drop-shadow(0 8px 10px rgb(0 0 0 / .55)); }
html:root[data-palette="halloween"] .age-btn:active:not(:disabled) { transform: scale(.92); }
html:root[data-palette="halloween"] .age-btn.spin { animation: pkWobble .5s ease-in-out infinite; }
html:root[data-palette="halloween"] .age-btn:disabled .pk-face { animation: none; opacity: .35; }
@keyframes pkBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes pkWobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes pkFlicker { 0% { opacity: 1; } 18% { opacity: .82; } 22% { opacity: 1; } 47% { opacity: .9; } 52% { opacity: .7; } 55% { opacity: 1; } 80% { opacity: .88; } }
html:root[data-palette="halloween"] #tabs .age-btn svg.pk { width: 100%; height: 100%; fill: initial; stroke: none; transform: none; }
html:root[data-palette="halloween"] .age-btn::before, html:root[data-palette="halloween"] .age-btn::after { display: none; }
/* phones: no double-tap or pinch zoom inside the game, and taps register instantly where the finger is */
html, body { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
button, summary, .row-item, .tile, .chip { touch-action: manipulation; }

/* ---------- account (js/cloud.js) ---------- */
.acct .modal-body { display: grid; gap: 12px; }
.acct-form { display: grid; gap: 12px; }
.acct-form .btn.big { width: 100%; align-items: center; }
.acct-tabs button { flex: 1 1 0; }
.acct .pw { position: relative; display: block; }
.acct .pw input { padding-right: 48px; }
.acct .pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; font-size: 18px; padding: 6px; line-height: 1; }
.acct-check { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14px; cursor: pointer; }
.acct-check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.acct-err { margin: 0; min-height: 0; color: var(--bad); font-weight: 800; font-size: 13px; text-align: center; }
.acct-err:empty { display: none; }
.acct-link { border: 0; background: transparent; color: var(--accent); font-weight: 800; font-size: 13px; padding: 4px; justify-self: center; text-decoration: underline; }
.acct-link.danger { color: var(--bad); }
.acct-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; }
.acct-or::before, .acct-or::after { content: ''; flex: 1; height: 1.5px; background: var(--line); }
.acct-g { width: 100%; flex-direction: row; justify-content: center; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #dadce0; }
.acct-g:hover:not(:disabled) { background: #f8f9fa; }
.acct-me { display: flex; align-items: center; gap: 12px; }
.acct-me div { display: grid; min-width: 0; }
.acct-me b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-me small { color: var(--muted); font-weight: 700; }
.acct-av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 22px var(--f-display); color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); }
.acct .choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acct .choices .btn { align-items: center; }
.acct-nl { width: 100%; flex-direction: row; justify-content: center; margin-bottom: 4px; }
[hidden] { display: none !important; }

/* ---------- Hall of Trophies (achieve.js) ---------- */
.modal.hall { --wood1: #7a4a26; --wood2: #4f2e16; }
.hall .modal-body { display: grid; gap: 12px; }
.hall-top { display: flex; align-items: stretch; gap: 10px; }
.hall-rank { flex: 1; display: grid; gap: 1px; padding: 10px 14px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 26%, var(--sunk)), var(--sunk)); }
.hall-rank span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hall-rank b { font: 700 21px var(--f-display); }
.hall-rank small { font-size: 12px; color: var(--muted); font-weight: 700; }
.hall-count { display: grid; place-items: center; align-content: center; padding: 8px 16px; border-radius: 16px; background: var(--sunk); }
.hall-count b { font: 700 26px var(--f-display); line-height: 1; }
.hall-count b small { font-size: 14px; color: var(--muted); }
.hall-count span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hall-tiers { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.hall-tiers span, .tro-tier { display: inline-flex; align-items: center; gap: 5px; }
.hall-tiers i, .tro-tier i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.hall-tiers .t-d i, .tro-tier.t-d i { background: linear-gradient(135deg, #5ad8f0, #f2fdff, #a493ff); } .hall-tiers .t-g i, .tro-tier.t-g i { background: linear-gradient(135deg, #b07d0c, #ffe887); }
.hall-tiers .t-s i, .tro-tier.t-s i { background: linear-gradient(135deg, #7d8896, #f6f8fb); } .hall-tiers .t-b i, .tro-tier.t-b i { background: linear-gradient(135deg, #7e431b, #eeb07c); }
.hall-wait { border-radius: 18px; padding: 10px 10px 4px; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--gold) 30%, transparent), transparent 70%), var(--sunk); border: 1.5px solid color-mix(in srgb, var(--gold) 45%, transparent); }
.hall-wait-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 4px 6px; }
.hall-wings { position: sticky; top: -2px; z-index: 2; box-shadow: 0 6px 10px -8px rgb(0 0 0 / .4); }
.wing h4 { margin: 4px 2px 0; display: flex; justify-content: space-between; align-items: baseline; font: 700 15px var(--f-display); }
.wing h4 small { font: 800 12px var(--f-body); color: var(--muted); }
/* a wooden shelf under each row of trophies, with a soft spotlight from above */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 0 4px; padding: 10px 4px 0;
  background: radial-gradient(60% 50% at 50% 0%, rgb(255 236 180 / .14), transparent 70%),
  repeating-linear-gradient(to bottom, transparent 0 110px, var(--wood1) 110px 117px, var(--wood2) 117px 122px, transparent 122px 124px); border-radius: 12px; }
.tro { border: 0; background: transparent; padding: 0 0 14px; height: 124px; display: grid; justify-items: center; align-content: end; gap: 2px; min-width: 0; color: var(--ink); cursor: pointer; }
.tro b { font-size: 10.5px; line-height: 1.15; font-weight: 800; text-align: center; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 24px; }
.tro.locked b { color: var(--muted); opacity: .7; }
.cup { position: relative; width: 52px; height: 68px; display: block; transition: transform .2s; }
.cup svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgb(0 0 0 / .35)); }
.cup i { position: absolute; left: 0; right: 0; top: 13px; text-align: center; font-style: normal; font-size: 17px; line-height: 1; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .35)); }
.cup.locked i { color: #9aa1ad; font: 800 16px var(--f-display); top: 14px; }
.tro:hover .cup { transform: translateY(-3px); }
.tro.got.t-d .cup::after { content: ''; position: absolute; inset: -6px -6px 14px; background: radial-gradient(circle, rgb(140 230 255 / .35), transparent 65%); z-index: -1; }
/* waiting to be collected: it floats and glows on its pedestal */
.tro.new .cup { animation: troFloat 1.6s ease-in-out infinite; }
.tro.new .cup::before { content: ''; position: absolute; inset: -8px -10px 10px; background: radial-gradient(circle, rgb(255 220 120 / .55), transparent 65%); z-index: -1; animation: troGlow 1.6s ease-in-out infinite; }
.tro.new b::after { content: ' ✨'; }
.tro.collecting .cup { animation: troCollect .65s cubic-bezier(.3, 1.4, .5, 1) forwards; }
@keyframes troFloat { 50% { transform: translateY(-4px); } }
@keyframes troGlow { 50% { opacity: .5; transform: scale(1.12); } }
@keyframes troCollect { 40% { transform: scale(1.35) rotate(-6deg); filter: brightness(1.6); } 100% { transform: scale(1) rotate(0); } }
.tro-pop .modal-body { display: grid; justify-items: center; gap: 6px; }
.tro-big .cup { width: 120px; height: 158px; }
.tro-big .cup i { top: 30px; font-size: 40px; }
.tro-big.got .cup { animation: troFloat 2.4s ease-in-out infinite; }
.tro-tier { justify-content: center; font-weight: 800; font-size: 13px; color: var(--muted); margin: 0; }
.hall-badge { font-style: normal; color: var(--gold); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .tro.new .cup, .tro.new .cup::before, .tro-big.got .cup { animation: none; } }
.scene-pick .btn { flex: 1; align-items: center; }
.scene-emo { font-size: 30px; line-height: 1.1; }

/* ---------- products and rivals (company.js) ---------- */
.prod { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; margin-bottom: 8px; }
.prod-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mshare { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 6px 0; }
.mshare i { display: block; min-width: 4px; }
.plan-sum { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--sunk); }

/* ---------- auction house (auction.js) ---------- */
.au-pic { display: block; width: 46px; height: 46px; flex: none; border-radius: 6px; overflow: hidden; border: 3px solid #c9a227; box-shadow: 0 2px 6px rgb(0 0 0 / .35); background: #222; }
.au-pic img, .au-photo img, .au-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.au-pic.big { width: 120px; height: 120px; border-width: 5px; }
.jicon.au-photo { overflow: hidden; border-radius: 6px; border: 2px solid #c9a227; padding: 0; }
.art-hero.au-hero { width: 220px; height: 220px; margin: 0 auto; border: 8px solid #c9a227; border-radius: 6px; overflow: hidden; box-shadow: 0 6px 18px rgb(0 0 0 / .4); }
.au-row.t-masterpiece { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 18%, transparent), transparent); border-radius: 12px; }
.au-lot { display: flex; gap: 12px; align-items: center; }
.au-lot > div { display: grid; gap: 3px; min-width: 0; }
.au-lot small { color: var(--muted); font-weight: 700; }
.au-board { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.au-board > div { background: var(--sunk); border-radius: 14px; padding: 8px 12px; display: grid; }
.au-board span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.au-board b { font: 700 20px var(--f-display); }
.au-call { text-align: center; font: 700 17px var(--f-display); color: var(--gold); min-height: 22px; margin: 4px 0; }
.au-feed { display: grid; gap: 2px; min-height: 96px; font-size: 13px; font-weight: 700; }
.au-feed p { margin: 0; }
.au-feed p:first-child { color: var(--ink); } .au-feed p:not(:first-child) { color: var(--muted); }
.au-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.au-btns .btn { align-items: center; }
.au-btns #auBid, .au-btns #auDone { grid-column: 1 / -1; }

/* ---------- wedding planner and prenup (marriage.js) ---------- */
.wedding .modal-body { display: grid; gap: 10px; }
.wd-row { display: grid; gap: 5px; }
.wd-row > span { font-weight: 800; font-size: 13px; color: var(--muted); }
.wd-row .seg.wrap { flex-wrap: wrap; overflow: visible; }
.wd-row .seg button { display: grid; justify-items: center; line-height: 1.15; }
.wd-row .seg button small { font-size: 10.5px; font-weight: 700; opacity: .8; }

/* ---------- online friends (friends.js) ---------- */
.friends .modal-body h4 { margin: 12px 0 4px; font: 700 15px var(--f-display); }
.fr-code { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--sunk); }
.fr-code span { color: var(--muted); font-weight: 800; font-size: 13px; }
.fr-code b { font: 700 18px var(--f-display); user-select: all; }
.fr-add { display: flex; gap: 8px; margin: 10px 0; }
.fr-add input { flex: 1; min-width: 0; font: 700 16px var(--f-body); padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
.fr-row .job-r { display: flex; gap: 6px; }

/* ---------- play together (coop.js) ---------- */
.coop-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 7px 12px; border-radius: 14px; background: rgb(0 0 0 / .22); color: #fff; font-size: 12.5px; font-weight: 800; }
.coop-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coop-nw { font: 700 14px var(--f-display); }
.coop-st { padding: 3px 8px; border-radius: 99px; background: rgb(255 255 255 / .16); white-space: nowrap; }
.coop-st.up { background: #2bb56a; }

/* ---------- livelier theme backgrounds (G.themeFx in state.js) ---------- */
.fx-drift { animation-name: fxDrift; }
.fx-swirl { animation-name: fxSwirl; }
.fx-swim { top: calc(25% + var(--y) * .7); left: -60px; animation-name: fxSwim; opacity: .45; }
.fx-fly { top: var(--y); animation-name: fxFly; animation-timing-function: ease-in-out; opacity: .6; }
@keyframes fxDrift { from { transform: translate(0, -8vh) rotate(-10deg); } 25% { transform: translate(40px, 25vh) rotate(10deg); } 50% { transform: translate(-10px, 50vh) rotate(-8deg); } 75% { transform: translate(50px, 78vh) rotate(12deg); } to { transform: translate(10px, 108vh) rotate(-6deg); } }
@keyframes fxSwirl { from { transform: translate(0, -8vh) rotate(0deg) scale(.8); } 33% { transform: translate(60px, 30vh) rotate(240deg) scale(1); } 66% { transform: translate(-40px, 66vh) rotate(480deg) scale(.9); } to { transform: translate(30px, 108vh) rotate(720deg) scale(.8); } }
@keyframes fxSwim { 0% { transform: translate(0, 0) scaleX(-1); } 25% { transform: translate(30vw, -12px) scaleX(-1); } 50% { transform: translate(60vw, 8px) scaleX(-1); } 75% { transform: translate(90vw, -8px) scaleX(-1); } 100% { transform: translate(120vw, 0) scaleX(-1); } }
@keyframes fxFly { 0%, 100% { transform: translate(0, 0) rotate(-8deg); } 25% { transform: translate(40px, -30px) rotate(8deg); } 50% { transform: translate(-20px, -60px) rotate(-6deg); } 75% { transform: translate(-50px, -20px) rotate(10deg); } }
/* soft light orbs */
.fx-orb { position: absolute; left: var(--ox); top: var(--oy); width: 46vmax; height: 46vmax; margin: -23vmax 0 0 -23vmax; border-radius: 50%; background: radial-gradient(circle, var(--c), transparent 62%); opacity: .13; filter: blur(30px); animation: fxOrb ease-in-out infinite alternate; }
@keyframes fxOrb { from { transform: translate(-8vw, -6vh) scale(.9); } to { transform: translate(8vw, 7vh) scale(1.15); } }
/* shooting stars */
.fx-shoot { position: absolute; left: var(--sx); top: var(--sy); width: 120px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgb(255 255 255 / .9), transparent); opacity: 0; transform: rotate(-28deg); animation: fxShoot 13s ease-in infinite; }
@keyframes fxShoot { 0%, 88% { opacity: 0; transform: translate(0, 0) rotate(-28deg) scaleX(.3); } 90% { opacity: .9; } 96% { opacity: 0; transform: translate(-46vw, 24vh) rotate(-28deg) scaleX(1); } 100% { opacity: 0; } }
/* ocean light rays */
.fx-ray { position: absolute; left: var(--rx); top: -10vh; width: 90px; height: 120vh; background: linear-gradient(rgb(255 255 255 / .18), transparent 80%); transform: skewX(-14deg); opacity: .5; animation: fxRay 9s ease-in-out infinite alternate; }
@keyframes fxRay { from { opacity: .15; transform: skewX(-14deg) translateX(-20px); } to { opacity: .55; transform: skewX(-10deg) translateX(30px); } }
/* sunset sun glow */
.fx-sun { position: absolute; right: -12vmax; bottom: 8vh; width: 40vmax; height: 40vmax; border-radius: 50%; background: radial-gradient(circle, rgb(255 190 90 / .5), rgb(255 120 80 / .15) 45%, transparent 70%); animation: fxSun 12s ease-in-out infinite alternate; }
@keyframes fxSun { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.08); opacity: 1; } }
/* forest fireflies */
.fx-firefly { position: absolute; left: var(--x); top: var(--y); width: 5px; height: 5px; border-radius: 50%; background: #f7ff9a; box-shadow: 0 0 10px 3px rgb(240 255 120 / .7); opacity: 0; animation: fxFirefly ease-in-out infinite; }
@keyframes fxFirefly { 0%, 100% { opacity: 0; transform: translate(0, 0); } 30% { opacity: .9; } 50% { opacity: .3; transform: translate(18px, -24px); } 70% { opacity: .85; transform: translate(-12px, -10px); } }
/* halloween moon */
.fx-moon { position: absolute; right: 8vw; top: 46vh; width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff8d6, #f3d98b 60%, #c9a54a); box-shadow: 0 0 40px 12px rgb(255 230 150 / .25); opacity: .22; animation: fxSun 10s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { #fx { display: none; } }
