/* The Financial Trail — styles. Palette follows games/shared/art-style-guide.md. */

@font-face { font-family: "Baloo 2"; font-weight: 600; font-display: swap; src: url(fonts/baloo-2-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Baloo 2"; font-weight: 800; font-display: swap; src: url(fonts/baloo-2-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url(fonts/nunito-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url(fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url(fonts/nunito-latin-800-normal.woff2) format("woff2"); }

:root {
  --teal: #6ec9c7;
  --teal-dk: #3e9b99;
  --pink: #f08fb0;
  --blue: #6b9bd1;
  --gold: #f7c948;
  --green: #8fd18c;
  --coral: #f2766b;
  --lavender: #d9cff0;

  --bg: #fff9ee;
  --surface: #ffffff;
  --cream: #faf3e3;
  --tint: #e8f7f6;
  --ink: #4a4440;
  --muted: #7b726b;
  --line: #4a4440;
  --soft-line: #e6dccb;
  --pos: #2f8f5b;
  --neg: #d4574c;
  --tip-bg: #fff4d1;
  --tip-ink: #6a5314;

  --radius: 20px;
  --shadow: 4px 4px 0 var(--line);
  --shadow-lg: 7px 7px 0 var(--line);
  --bw: 2.5px;
  --display: "Baloo 2", "Arial Rounded MT Bold", "Comic Sans MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a22;
    --surface: #26232e;
    --cream: #2d2a36;
    --tint: #203334;
    --ink: #f4eee6;
    --muted: #b3aabb;
    --line: #0f0e13;
    --soft-line: #3d3948;
    --pos: #7fe0a6;
    --neg: #ff8f84;
    --tip-bg: #3a3218;
    --tip-ink: #f7df98;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 0%, #f7c94826 0, transparent 34%),
    radial-gradient(circle at 92% 6%, #6ec9c72e 0, transparent 36%);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; margin: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ---------- top bar */
.topbar {
  max-width: 1280px; margin: 0 auto; height: 76px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 clamp(14px, 3vw, 32px);
}
.brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; font: 800 1.3rem/1 var(--display); letter-spacing: -.01em; }
.brand img { width: 36px; height: 36px; transition: transform .25s; }
.brand:hover img { transform: rotate(-18deg) scale(1.1); }
.top-actions { display: flex; gap: 8px; }
.icon-btn { display: grid; place-items: center; }
.icon-btn, .pill-btn {
  height: 42px; min-width: 42px; border-radius: 999px; background: var(--surface);
  border: var(--bw) solid var(--line); box-shadow: 3px 3px 0 var(--line); font-weight: 800; transition: transform .12s, box-shadow .12s;
}
.pill-btn { padding: 0 16px; }
.icon-btn:hover, .pill-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--line); }
.icon-btn:active, .pill-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--line); }

/* ---------- shared bits */
.card {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card-label, .eyebrow, .date {
  font: 800 .72rem/1.2 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.eyebrow { margin-bottom: 8px; }
.primary, .secondary {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: var(--bw) solid var(--line); border-radius: 999px; padding: 14px 22px;
  font: 800 1.05rem/1 var(--body); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, filter .12s;
}
.primary { background: var(--teal); color: #173b3a; }
.primary.big { font-size: 1.2rem; padding: 18px 24px; }
.primary.danger { background: var(--coral); color: #3d1411; }
.secondary { background: var(--surface); }
.primary:hover:not(:disabled), .secondary:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.primary:active:not(:disabled), .secondary:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--line); }
.primary:disabled, .secondary:disabled { opacity: .45; cursor: not-allowed; }
.tip {
  border: 2px solid var(--line); border-left: 8px solid var(--gold); border-radius: 12px;
  background: var(--tip-bg); color: var(--tip-ink); padding: 12px 14px; font-size: .92rem;
}

/* ---------- start screen */
.start { max-width: 1120px; margin: 0 auto; padding: 8px clamp(14px, 3vw, 32px) 64px; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; margin-bottom: 36px; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.4rem); letter-spacing: -.02em; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--teal-dk); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: .16em; text-underline-offset: .1em; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 34em; margin: 0; }
.lede strong { color: var(--ink); }
.hero-art { position: relative; aspect-ratio: 4 / 3; }
.hero-bg { width: 100%; height: 100%; object-fit: cover; border: var(--bw) solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lg); }
.hero-roundy, .hero-fifi { position: absolute; bottom: -18px; filter: drop-shadow(0 6px 8px #0003); }
.hero-roundy { left: 6%; width: 40%; animation: bounce 2.4s ease-in-out infinite; }
.hero-fifi { right: 4%; width: 34%; }

.setup { padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow-lg); }
.setup-title { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; margin: 6px 0 16px; }
.setup-title:not(:first-child) { margin-top: 30px; }
.step-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); border: 2px solid var(--line); font-size: 1rem; color: #4a4440; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 18px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, background .15s;
}
.mode-card img { width: 76px; height: 76px; object-fit: contain; flex: none; transition: transform .2s; }
.mode-card strong { display: block; font: 800 1.2rem/1.15 var(--display); }
.mode-card small { display: block; color: var(--muted); font-size: .9rem; margin-top: 4px; }
.mode-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.mode-card.selected { background: var(--tint); box-shadow: var(--shadow-lg); transform: translate(-2px, -2px); outline: 3px solid var(--teal); outline-offset: -7px; }
.mode-card.selected img { transform: scale(1.08) rotate(-4deg); }

.field { display: block; font-weight: 800; }
.field input {
  display: block; width: 100%; max-width: 380px; margin-top: 6px; padding: 12px 14px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 12px; font-size: 1.05rem; font-weight: 700;
}
.field input:focus { outline: 3px solid var(--teal); outline-offset: 1px; }
.field-label { font-weight: 800; margin: 22px 0 8px; }
.field-label small { font-weight: 400; color: var(--muted); }
.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.choice-row.three { grid-template-columns: repeat(3, 1fr); }
.pick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 14px; transition: transform .12s, box-shadow .12s, background .12s;
}
.pick img { width: 44px; height: 44px; object-fit: contain; margin-bottom: 4px; }
.pick b { font-size: 1rem; }
.pick span { color: var(--muted); font-size: .85rem; }
.pick:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
.pick.selected { background: var(--tint); box-shadow: 3px 3px 0 var(--line); outline: 3px solid var(--teal); outline-offset: -6px; }
.check { display: flex; align-items: center; gap: 12px; margin: 22px 0 4px; padding: 12px 14px; border: 2px dashed var(--soft-line); border-radius: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--teal-dk); flex: none; }
.check img { width: 40px; height: 40px; object-fit: contain; }
.check small { display: block; color: var(--muted); }
.setup .primary.big { margin-top: 28px; }
.tiny-note { text-align: center; color: var(--muted); font-size: .8rem; margin: 14px 0 0; }

/* ---------- game layout */
.game { max-width: 1280px; margin: 0 auto; padding: 4px clamp(12px, 3vw, 32px) 64px; }
.game-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.trail-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: 4px; }
.trail-title small { display: inline-block; font: 800 .8rem/1 var(--body); padding: 6px 10px; margin-left: 6px; vertical-align: middle; border: 2px solid var(--line); border-radius: 999px; background: var(--gold); color: #4a4440; }
.goal { width: min(360px, 42%); }
.goal-line { display: flex; justify-content: space-between; gap: 8px; font: 800 .75rem/1.2 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.track { height: 18px; border: var(--bw) solid var(--line); border-radius: 999px; background: var(--cream); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: inherit; background: repeating-linear-gradient(45deg, var(--teal) 0 12px, #82d6d4 12px 24px); transition: width .8s cubic-bezier(.2, .8, .2, 1); }

/* trail map */
.trail {
  position: relative; padding: 0; overflow: hidden; margin-bottom: 18px;
  background: url(img/bg-trail.webp) center 62% / cover;
}
.trail::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, #fff9ee00 0%, #fff9ee55 55%, #fff9eecc 100%); }
.trail svg { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
.trail-path-bg { fill: none; stroke: #4a4440; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.trail-path { fill: none; stroke: #f6e3bf; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.trail-walked { fill: none; stroke: var(--teal); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.trail-tick { font: 800 15px var(--body); fill: #4a4440; text-anchor: middle; paint-order: stroke; stroke: #fff9ee; stroke-width: 4px; }
.stop circle:first-of-type { fill: #fff; stroke: #4a4440; stroke-width: 3; }
.stop.done circle:first-of-type { fill: #dff4e0; }
.check-dot { fill: var(--pos); stroke: #fff; stroke-width: 2; }
.check-mark { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.flag-pole { fill: #4a4440; }
.flag { fill: var(--coral); stroke: #4a4440; stroke-width: 2; stroke-linejoin: round; }
.me-img { animation: hop 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; filter: drop-shadow(0 4px 3px #0004); }

.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 18px; align-items: start; }
.col { display: grid; gap: 18px; }

/* net worth */
.worth-card .card-label { display: flex; align-items: center; gap: 6px; }
.info { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font: 800 .7rem/1 var(--body); padding: 0; }
.net-worth { font: 800 clamp(2.3rem, 4.6vw, 3.2rem)/1.05 var(--display); margin: 6px 0 2px; letter-spacing: -.01em; }
.net-worth.pos { color: var(--ink); }
.pulse-up { animation: pulse-up .8s; }
.pulse-down { animation: pulse-down .8s; }
.worth-change { font-weight: 800; font-size: .9rem; color: var(--muted); }
.spark { display: block; width: 100%; height: 70px; margin: 10px 0 4px; }
.spark-fill { fill: var(--teal); opacity: .18; }
.spark-line { fill: none; stroke: var(--teal-dk); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-zero { stroke: var(--neg); stroke-dasharray: 4 4; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.mood { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 2px dashed var(--soft-line); }
.mood img { width: 54px; height: 54px; object-fit: contain; }
.mood > div { flex: 1; font-size: .9rem; }
.meter { height: 10px; margin-top: 6px; border: 2px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--cream); }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--pink), var(--gold)); transition: width .6s; }

/* balances */
.rows { list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 4px; }
.rows:last-child { margin-bottom: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 12px; }
.rows li:nth-child(odd) { background: var(--cream); }
.rows img { width: 36px; height: 36px; object-fit: contain; flex: none; }
.rows span { flex: 1; min-width: 0; }
.rows b { display: block; font-size: .95rem; }
.rows small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.3; }
.rows em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.debt-free { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-weight: 800; color: var(--pos); }
.debt-free img { width: 48px; }

/* credit */
.credit { display: flex; align-items: center; gap: 16px; }
.gauge { width: 120px; flex: none; }
.gauge-bg, .gauge-fg { fill: none; stroke-width: 12; stroke-linecap: round; }
.gauge-bg { stroke: var(--cream); }
.gauge-fg { stroke: var(--teal); transition: stroke-dasharray .8s; }
.gauge-dot { fill: var(--surface); stroke: var(--line); stroke-width: 3; }
.score { font: 800 1.9rem/1 var(--display); margin-top: 4px; }
.score small { font: 800 .85rem var(--body); color: var(--teal-dk); margin-left: 4px; }
.fine { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }

/* log */
.log-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.log-list li { border-left: 5px solid var(--soft-line); padding: 2px 0 2px 12px; font-size: .88rem; }
.log-list li.tone-good { border-color: var(--green); }
.log-list li.tone-bad { border-color: var(--coral); }
.log-list li.tone-start { border-color: var(--gold); }
.log-list small { display: block; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.log-list b { display: block; }
.log-list span { color: var(--muted); }

/* plan */
.plan h2 { font-size: 1.6rem; margin: 4px 0 14px; }
.paycheck { border: 2px solid var(--line); border-radius: 16px; background: var(--cream); padding: 10px 14px; margin-bottom: 16px; }
.pc-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-weight: 700; }
.pc-row b { font-variant-numeric: tabular-nums; }
.pc-row.total { border-top: 2px dashed var(--soft-line); margin-top: 6px; padding-top: 10px; font-size: 1.15rem; }
.pc-row.total b { font: 800 1.5rem/1 var(--display); color: var(--pos); }
.pc-row.total.neg b { color: var(--neg); }
details summary { cursor: pointer; font-size: .85rem; font-weight: 800; color: var(--teal-dk); padding: 2px 0; }
.pc-lines { list-style: none; margin: 6px 0; padding: 0; font-size: .86rem; }
.pc-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; color: var(--muted); }

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .85rem; font-weight: 800; color: var(--muted); }
.presets button {
  display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); font-weight: 800; font-size: .85rem; transition: transform .12s, box-shadow .12s;
}
.presets button img { width: 28px; height: 28px; object-fit: contain; }
.presets button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }

.buckets { display: grid; gap: 10px; }
.bucket { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--soft-line); border-radius: 16px; transition: border-color .15s; }
.bucket:hover, .bucket:focus-within { border-color: var(--line); }
.bucket.off { opacity: .55; }
.bucket > img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.bucket-body { flex: 1; min-width: 0; }
.bucket-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bucket-top label b { display: block; }
.bucket-top label small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.bucket output { text-align: right; white-space: nowrap; }
.bucket output b { display: block; font: 800 1.15rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.bucket output small { color: var(--muted); font-weight: 800; font-size: .78rem; }

input[type=range] {
  --fill: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 4px 0 0; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 12px; border-radius: 99px; border: 2px solid var(--line);
  background: linear-gradient(90deg, var(--teal) var(--fill), var(--cream) var(--fill));
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; border: 2px solid var(--line); background: var(--cream); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--teal); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%;
  background: var(--gold); border: var(--bw) solid var(--line); box-shadow: 2px 2px 0 var(--line); transition: transform .1s;
}
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); border: var(--bw) solid var(--line); box-shadow: 2px 2px 0 var(--line); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]:disabled { cursor: not-allowed; }

.leftover-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 8px 12px; border-radius: 14px; background: var(--cream); font-weight: 800; }
.leftover-line img { width: 30px; }
.leftover-line span { flex: 1; color: var(--muted); }

.shortfall { display: flex; gap: 14px; align-items: center; padding: 12px; border: 2px solid var(--neg); border-radius: 16px; background: color-mix(in srgb, var(--coral) 12%, var(--surface)); }
.shortfall img { width: 72px; flex: none; }
.shortfall p { margin: 0; }

.fifi-hint { display: flex; gap: 12px; align-items: center; margin: 16px 0; }
.fifi-hint img { width: 62px; flex: none; }
.fifi-hint p {
  position: relative; margin: 0; padding: 10px 14px; border: 2px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--pink) 16%, var(--surface)); font-size: .95rem;
}
.fifi-hint p::before {
  content: ""; position: absolute; left: -9px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%) rotate(45deg);
  background: inherit; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line);
}
.plan-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }

.decision { text-align: center; padding: 34px 26px; }
.decision img { width: 150px; margin: 0 auto 12px; animation: bounce 2.4s ease-in-out infinite; }
.decision h2 { font-size: 2rem; margin-bottom: 8px; }
.decision p { color: var(--muted); margin: 0 auto 20px; max-width: 30em; }
.decision .primary { max-width: 340px; margin: 0 auto; }

/* ---------- modal */
dialog { border: 0; padding: 16px; background: transparent; width: min(620px, 100%); max-height: 100dvh; color: var(--ink); overflow: visible; }
dialog.wide { width: min(760px, 100%); }
dialog::backdrop { background: #2a24209c; backdrop-filter: blur(4px); }
dialog[open] { animation: pop .28s cubic-bezier(.2, 1.3, .4, 1); }
.modal-card {
  position: relative; max-height: calc(100dvh - 32px); overflow: auto; padding: 26px;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.modal-x { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); font-size: 1.3rem; line-height: 1; z-index: 2; }
.modal-card h2 { font-size: 1.8rem; margin-bottom: 8px; }
.modal-card p { margin: 0 0 12px; }
.modal-card > div > .primary, #modal-content > .primary { margin-top: 18px; }
.modal-options { display: grid; gap: 10px; margin: 16px 0 8px; }
.modal-option {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 16px; box-shadow: 3px 3px 0 var(--line); transition: transform .12s, box-shadow .12s, background .12s;
}
.modal-option.has-img { display: flex; align-items: center; gap: 14px; }
.modal-option img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.modal-option b { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.modal-option small { display: block; color: var(--muted); line-height: 1.4; }
.modal-option small.need { color: var(--neg); font-weight: 800; margin-top: 4px; }
.modal-option:hover:not(:disabled) { background: var(--tint); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--line); }
.modal-option:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

.talk { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.talk > img { width: 96px; flex: none; }
.talk--right { justify-content: flex-end; }
.bubble { position: relative; flex: 1; padding: 14px 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--cream); }
.bubble p:last-child, .bubble ul:last-child { margin-bottom: 0; }
.bubble ul { margin: 6px 0 0; padding-left: 20px; }
.bubble li { margin-bottom: 6px; }
.bubble--roundy { background: color-mix(in srgb, var(--teal) 18%, var(--surface)); flex: 0 1 auto; }

.event { text-align: center; }
.event-art { position: relative; width: 190px; height: 170px; margin: 0 auto 8px; }
.event-img { width: 170px; height: 170px; object-fit: contain; margin: 0 auto; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.event-react { position: absolute; right: -34px; bottom: -6px; width: 80px; animation: hop 1.4s ease-in-out infinite; }
.event--bad .event-img { animation: shake .5s; }
.delta { font: 800 2.8rem/1 var(--display); margin: 10px 0 14px; }
.delta small { display: block; font: 800 .75rem var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
.paid { text-align: left; border: 2px dashed var(--soft-line); border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.paid-parts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.paid-parts span { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--cream); font-weight: 800; font-size: .88rem; }
.paid-parts img { width: 26px; height: 26px; object-fit: contain; }
.paid-note { margin: 8px 0 0 !important; font-size: .9rem; font-weight: 700; }
.event .fifi-hint { text-align: left; }
.event .modal-option { text-align: left; }
.outcome { font-weight: 800; font-size: 1.05rem; padding: 12px; border-radius: 14px; background: var(--cream); }

.ms-head { display: flex; gap: 18px; align-items: center; padding-right: 30px; }
.ms-head > img { width: 120px; flex: none; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.ms-head p { color: var(--muted); margin: 0; }
.ms-cash { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); margin: 10px 0 0 !important; }
.ms-cash img { width: 24px; }

.review-worth { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font: 800 1.5rem/1.1 var(--display); margin: 6px 0 14px; }
.review-worth em { font: 800 1rem var(--body); font-style: normal; padding: 3px 10px; border-radius: 999px; background: var(--cream); }
.review-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.review-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--cream); }
.review-list img { width: 42px; height: 42px; object-fit: contain; flex: none; }
.review-list span { flex: 1; min-width: 0; }
.review-list b { display: block; }
.review-list small { color: var(--muted); display: block; line-height: 1.3; }
.review-list em { font-style: normal; font-weight: 800; white-space: nowrap; }
.quiet { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.quiet img { width: 60px; }

.help-list { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 8px; }
.help-list li { display: flex; align-items: center; gap: 12px; }
.help-list img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.help-list b { display: block; }

/* ---------- ending */
.end { max-width: 900px; margin: 0 auto; padding: 4px clamp(12px, 3vw, 32px) 64px; }
.end-hero { position: relative; height: clamp(220px, 38vw, 340px); margin-bottom: -40px; }
.end-bg { width: 100%; height: 100%; object-fit: cover; border: var(--bw) solid var(--line); border-radius: 28px; box-shadow: var(--shadow-lg); }
.end-roundy { position: absolute; left: 50%; bottom: 20px; width: clamp(130px, 22vw, 200px); transform: translateX(-70%); animation: bounce-x 2.2s ease-in-out infinite; filter: drop-shadow(0 6px 8px #0003); }
.end-fifi { position: absolute; left: 50%; bottom: 26px; width: clamp(100px, 16vw, 150px); transform: translateX(45%); filter: drop-shadow(0 6px 8px #0003); }
.end-body { position: relative; text-align: center; padding: 30px clamp(18px, 4vw, 40px); box-shadow: var(--shadow-lg); }
.end-body h1 { font-size: clamp(2.4rem, 7vw, 4rem); margin-bottom: 8px; }
.end-worth { font-size: 1.15rem; margin: 0 0 16px; }
.end-worth strong { font: 800 1.6rem var(--display); }
.end-chart svg { width: 100%; height: auto; }
.goal-line-svg { stroke: var(--gold); stroke-width: 3; stroke-dasharray: 8 6; }
.zero-line { stroke: var(--soft-line); stroke-width: 2; }
.chart-label { font: 800 12px var(--body); fill: var(--muted); }
.chart-line { fill: none; stroke: var(--teal-dk); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--gold); stroke: var(--line); stroke-width: 3; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 22px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border: 2px solid var(--line); border-radius: 16px; background: var(--cream); }
.stat img { width: 44px; height: 44px; object-fit: contain; }
.stat span { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.stat b { font: 800 1.25rem var(--display); }
.end .talk { text-align: left; }
.end .primary.big { max-width: 360px; margin: 18px auto 0; }

/* ---------- toasts & confetti */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 460px); pointer-events: none; }
.toast {
  padding: 12px 18px; border-radius: 16px; border: var(--bw) solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  font-weight: 800; text-align: center; opacity: 0; transform: translateY(20px) scale(.96); transition: opacity .3s, transform .3s;
}
.toast--good { background: color-mix(in srgb, var(--green) 30%, var(--surface)); }
.toast--bad { background: color-mix(in srgb, var(--coral) 25%, var(--surface)); }
.toast.show { opacity: 1; transform: none; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }

/* ---------- motion */
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bounce-x { 0%, 100% { transform: translate(-70%, 0); } 50% { transform: translate(-70%, -12px); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } 60% { transform: translateY(-7px); } }
@keyframes pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px) rotate(-4deg); } 40% { transform: translateX(8px) rotate(4deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes pulse-up { 40% { transform: scale(1.06); color: var(--pos); } }
@keyframes pulse-down { 40% { transform: scale(.97); color: var(--neg); } }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); } }
.net-worth { transform-origin: left center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .hero-art { max-width: 560px; }
  .dashboard { grid-template-columns: 1fr; }
  .col-main { order: -1; }
  .col-side { grid-template-columns: 1fr 1fr; }
  .worth-card, .log { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { height: 64px; }
  .brand { font-size: 1.1rem; }
  .brand img { width: 30px; height: 30px; }
  .pill-text { display: none; }
  .pill-btn { padding: 0; width: 42px; }
  .game-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .goal { width: 100%; }
  .mode-grid { grid-template-columns: 1fr; }
  .choice-row, .choice-row.three { grid-template-columns: 1fr 1fr; }
  .col-side { grid-template-columns: 1fr; }
  .plan-actions { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .modal-card { padding: 20px 16px; }
  .talk > img { width: 70px; }
  .ms-head { flex-direction: column; align-items: flex-start; }
  .ms-head > img { width: 90px; }
  .modal-option img { width: 48px; height: 48px; }
  .end-stats { grid-template-columns: 1fr 1fr; }
  .modal-actions { grid-template-columns: 1fr; }
  .trail-tick { font-size: 22px; }
}
@media (max-width: 380px) {
  .choice-row, .choice-row.three { grid-template-columns: 1fr; }
}
