/* The Financial Trail: styles. The series look (buttons, panels, bubbles, motion) comes from series/series.css,
   a synced copy of games/shared/ui (run web-assets/sync_series.py). This file only lays the game out.
   Rules: games/shared/series-style.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: 700; font-display: swap; src: url(fonts/baloo-2-latin-700-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 {
  --tint: #e6f6f5;          /* soft teal wash for hovered / selected rows */
  --muted: var(--aa-ink-soft);
  --pos: var(--aa-green-ink);
  --neg: var(--aa-coral-ink);
  --display: var(--aa-head);
  --body: var(--aa-body);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--aa-paper);
  color: var(--aa-ink);
  font: 400 20px/1.45 var(--aa-body);
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--aa-head); font-weight: 800; line-height: 1.1; margin: 0; color: var(--aa-teal-ink); }
:focus-visible { outline: 4px solid var(--aa-focus); outline-offset: 3px; border-radius: 8px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.btn-block { width: 100%; }
.aa-btn img { width: 32px; height: 32px; object-fit: contain; }
.aa-sticker { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- top bar (brand left, toolbar right; sound is always the right-most button) */
.topbar {
  max-width: 1280px; margin: 0 auto; min-height: 84px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(14px, 3vw, 32px) 4px;
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px; font: 800 26px/1 var(--aa-head); color: var(--aa-teal-ink); text-align: left; }
.brand img { width: 40px; height: 40px; transition: transform .25s var(--aa-ease-pop); }
.brand:hover img { transform: rotate(-18deg) scale(1.1); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.toolbar { display: flex; gap: 10px; }
/* the sound button also rides on every open dialog, above the veil */
.toolbar--modal { position: fixed; top: 17px; right: max(16px, calc((100% - 1280px) / 2 + clamp(14px, 3vw, 32px))); z-index: 5; }
body[data-screen="title"] .toolbar--modal { top: 14px; right: 16px; }

/* ---------- shared bits */
.card {
  background: var(--aa-cream); border: 4px solid var(--aa-line); border-radius: var(--aa-radius-card);
  box-shadow: var(--aa-shadow-card); padding: 20px 24px;
}
.card.aa-panel { border-radius: var(--aa-radius-panel); box-shadow: var(--aa-shadow-panel); }
.card-label {
  font: 800 26px/1.1 var(--aa-head); color: var(--aa-teal-ink); margin: 0 0 6px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow, .plan > .card-label, .paid .card-label {
  font: 700 20px/1.2 var(--aa-head); color: var(--aa-pink-ink); margin: 0 0 6px;
}
.tip {
  border: 4px solid var(--aa-gold); border-radius: 18px; background: #fff4d1; color: var(--aa-ink);
  padding: 12px 16px; font-size: 18px; line-height: 1.4;
}
.aa-ico svg, .eyebrow svg { width: 1em; height: 1em; }
.eyebrow .aa-ico { vertical-align: -.12em; margin: 0 2px; }

/* selectable cards (setup choices, milestone choices): kit card, selected = teal border + soft ring */
.mode-card, .pick, .modal-option {
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  transition: transform var(--aa-t-hover) ease, border-color var(--aa-t-hover) ease, box-shadow var(--aa-t-hover) ease, background var(--aa-t-hover) ease;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.mode-card:hover, .pick:hover, .modal-option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--aa-teal); background: var(--tint); }
.mode-card:active, .pick:active, .modal-option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(190, 172, 140, .45); }
.mode-card:focus-visible, .pick:focus-visible, .modal-option:focus-visible { outline: 4px solid var(--aa-focus); outline-offset: 3px; border-radius: var(--aa-radius-card); }
.mode-card:disabled, .modal-option:disabled { filter: grayscale(.55) brightness(1.04); opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- title screen (series-style section 6) */
body[data-screen="title"] .brand { visibility: hidden; }
body[data-screen="title"] .topbar { position: absolute; top: 0; left: 0; right: 0; max-width: none; margin: 0; z-index: 60; padding: 14px 16px 0; }
body[data-screen="title"] #new-game-btn, body[data-screen="setup"] #new-game-btn { display: none; }

.title-screen {
  --h: clamp(120px, min(36vh, 50vw), 400px);       /* Roundy's height: about a third of the screen */
  --edge: clamp(8px, 4vw, 64px);
  position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.title-bg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; filter: saturate(1.05) brightness(1.03); }
/* a light cream veil (30%) so the painted trail still shows */
.title-screen::after { content: ""; position: absolute; inset: 0; background: rgba(255, 249, 238, .3); }
.title-stack {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 2px; padding: 18px 16px 24px;
}
.title-logo { width: clamp(180px, 62vh, 420px); filter: drop-shadow(0 6px 0 rgba(74, 68, 64, .12)); }
.title-name { font: 800 clamp(34px, min(9.5vh, 11vw), 72px)/1.05 var(--aa-head); margin: 4px 0 0; color: var(--aa-teal-ink); text-shadow: 0 4px 0 #fff, 0 8px 14px rgba(74, 68, 64, .18); }
.title-episode { font: 700 clamp(18px, 3.4vh, 26px)/1.2 var(--aa-head); color: var(--aa-pink-ink); text-shadow: 0 2px 0 #fff, 0 3px 8px rgba(255, 255, 255, .9); }
.title-tagline { margin: 0 0 14px; font: 700 20px/1.3 var(--aa-body); color: var(--aa-ink); text-shadow: 0 2px 0 rgba(255, 255, 255, .9), 0 2px 8px rgba(255, 255, 255, .9); }
.title-btns { display: flex; gap: 16px; align-items: center; margin-top: 4px; }
.title-row { display: flex; gap: 12px; margin-top: 18px; }
.title-char { position: absolute; bottom: 18px; z-index: 3; height: var(--h); }
.title-char img { height: 100%; width: auto; max-width: none; }
.title-roundy { left: var(--edge); }
.title-fifi { right: var(--edge); height: calc(var(--h) * .92); }
.title-rouck { right: calc(var(--edge) + var(--h) * .66); height: calc(var(--h) * .62); }

/* ---------- setup screen */
.start { max-width: 1120px; margin: 0 auto; padding: 0 clamp(14px, 3vw, 32px) 64px; }
.back-btn { margin: 4px 0 14px; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; margin-bottom: 36px; }
.hero h1 { font-size: clamp(2.5rem, 5vw, 3.4rem); letter-spacing: -.01em; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--aa-pink-ink); }
.lede { font-size: 20px; color: var(--aa-ink); max-width: 34em; margin: 0; }
.lede strong { color: var(--aa-teal-ink); }
.hero-art { position: relative; aspect-ratio: 4 / 3; }
.hero-bg { width: 100%; height: 100%; max-width: none; object-fit: cover; border: 4px solid var(--aa-line); border-radius: var(--aa-radius-panel); box-shadow: var(--aa-shadow-panel); }
.hero-char { position: absolute; bottom: 5%; }
.hero-char img { width: 100%; }
.hero-roundy { left: 8%; width: 38%; }
.hero-fifi { right: 8%; width: 32%; }

.setup { padding: clamp(20px, 3vw, 32px); }
.setup-title { display: flex; align-items: center; gap: 12px; font-size: 34px; margin: 6px 0 16px; }
.setup-title:not(:first-child) { margin-top: 30px; }
.step-dot { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--aa-gold); border: 3px solid var(--aa-gold-dark); font: 800 22px/1 var(--aa-head); color: var(--aa-gold-ink); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.mode-card img { width: 80px; height: 80px; object-fit: contain; flex: none; transition: transform .2s var(--aa-ease-pop); }
.mode-card strong { display: block; font: 800 26px/1.1 var(--aa-head); color: var(--aa-teal-ink); }
.mode-card small { display: block; color: var(--aa-ink); font-size: 18px; line-height: 1.3; margin-top: 4px; }
.mode-card.selected img { transform: scale(1.08) rotate(-4deg); }

.field { display: block; font: 800 22px/1.2 var(--aa-head); color: var(--aa-teal-ink); }
.field input {
  display: block; width: 100%; max-width: 380px; margin-top: 8px; padding: 12px 16px;
  background: var(--aa-bubble); border: 4px solid var(--aa-line); border-radius: 18px;
  font: 700 22px/1.2 var(--aa-body); color: var(--aa-ink);
}
.field input:focus { outline: 4px solid var(--aa-focus); outline-offset: 2px; border-color: var(--aa-teal); }
.field-label { font: 800 22px/1.2 var(--aa-head); color: var(--aa-teal-ink); margin: 24px 0 8px; }
.field-label small { font: 400 17px var(--aa-body); color: var(--muted); }
.choice-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.choice-row.three { grid-template-columns: repeat(3, 1fr); }
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; }
.pick img { width: 48px; height: 48px; object-fit: contain; margin-bottom: 4px; }
.pick b { font: 800 21px/1.15 var(--aa-head); }
.pick span { color: var(--aa-ink); font-size: 17px; line-height: 1.3; }
.check { display: flex; align-items: center; gap: 14px; margin: 24px 0 4px; padding: 12px 16px; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--aa-teal-dark); flex: none; }
.check img { width: 44px; height: 44px; object-fit: contain; }
.check b { font: 800 21px var(--aa-head); }
.check small { display: block; color: var(--aa-ink); font-size: 17px; }
.setup .btn-block { margin-top: 28px; }
.tiny-note { text-align: center; color: var(--muted); font-size: 17px; 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: 18px; }
.date-chip { min-height: 46px; font-size: 22px; }
.date-chip img { width: 30px; height: 30px; }
.trail-title { font-size: clamp(2.2rem, 4vw, 3.2rem); margin-top: 10px; }
.trail-title small {
  display: inline-block; font: 800 20px/1 var(--aa-head); padding: 8px 14px 6px; margin-left: 6px; vertical-align: middle;
  border: 3px solid var(--aa-gold-dark); border-radius: 999px; background: #fbe6a3; color: var(--aa-gold-ink);
}
.goal { width: min(380px, 42%); }
.goal-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 800 18px/1.2 var(--aa-head); color: var(--aa-ink); margin-bottom: 8px; }
.goal-line span { display: inline-flex; align-items: center; gap: 6px; }
.track { height: 22px; border: 4px solid var(--aa-line); border-radius: 999px; background: var(--aa-cream); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: inherit; background: repeating-linear-gradient(45deg, var(--aa-teal) 0 12px, #82d6d4 12px 24px); transition: width .8s var(--aa-ease-out); }

/* trail map */
.trail {
  position: relative; padding: 0 0 38px; overflow: hidden; margin-bottom: 20px;
  background: url(img/bg-trail.webp) center 62% / cover; border-radius: var(--aa-radius-panel); box-shadow: var(--aa-shadow-panel);
}
.trail::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 249, 238, 0) 0%, rgba(255, 249, 238, .25) 60%, rgba(255, 249, 238, .88) 100%); }
.trail svg { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
.trail-ticks { position: absolute; left: 0; right: 0; bottom: 6px; height: 28px; }
.trail-ticks span { position: absolute; top: 0; transform: translateX(-50%); font: 800 18px/28px var(--aa-head); color: var(--aa-ink); white-space: nowrap; text-shadow: 0 0 6px var(--aa-paper), 0 0 3px var(--aa-paper); }
.trail-path-bg { fill: none; stroke: var(--aa-ink-soft); stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.trail-path { fill: none; stroke: #f6e3bf; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.trail-walked { fill: none; stroke: var(--aa-teal); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.stop circle:first-of-type { fill: var(--aa-cream); stroke: var(--aa-line-dark); stroke-width: 4; }
.stop.done circle:first-of-type { fill: var(--aa-p2); }
.check-dot { fill: var(--aa-green-dark); stroke: #fff; stroke-width: 2; }
.check-mark { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.flag-pole { fill: var(--aa-ink-soft); }
.flag { fill: var(--aa-coral); stroke: var(--aa-coral-dark); stroke-width: 2; stroke-linejoin: round; }
.me-shadow { fill: rgba(28, 36, 20, .26); }
.me-img { animation: aa-bob var(--aa-bob-period) ease-in-out infinite alternate; }

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

/* net worth */
.info { width: 40px; height: 40px; min-width: 40px; }
.info svg { width: 22px; height: 22px; }
.net-worth { font: 800 clamp(2.4rem, 4.6vw, 3.4rem)/1.05 var(--aa-head); margin: 6px 0 2px; transform-origin: left center; }
.net-worth.pos { color: var(--aa-ink); }
.pulse-up { animation: pulse-up .8s; }
.pulse-down { animation: pulse-down .8s; }
.worth-change { font: 700 18px/1.3 var(--aa-body); color: var(--muted); }
.worth-change.pos { color: var(--pos); }
.worth-change.neg { color: var(--neg); }
.spark { display: block; width: 100%; height: 70px; margin: 10px 0 4px; }
.spark-fill { fill: var(--aa-teal); opacity: .2; }
.spark-line { fill: none; stroke: var(--aa-teal-dark); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-zero { stroke: var(--aa-coral); stroke-dasharray: 4 4; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.mood { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding-top: 14px; border-top: 3px dashed var(--aa-line); }
.mood .aa-char { flex: none; }
.mood img { width: 62px; height: auto; }
.mood > div:last-child { flex: 1; font: 700 18px/1.3 var(--aa-body); }
.meter { height: 14px; margin-top: 6px; border: 3px solid var(--aa-line); border-radius: 99px; overflow: hidden; background: var(--aa-bubble); }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--aa-pink), var(--aa-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: 12px; padding: 6px 6px; border-radius: 14px; }
.rows li:nth-child(odd) { background: rgba(255, 253, 247, .75); }
.rows img { width: 40px; height: 40px; object-fit: contain; flex: none; }
.rows span { flex: 1; min-width: 0; }
.rows b { display: block; font: 700 20px/1.2 var(--aa-body); }
.rows small { display: block; color: var(--muted); font-size: 16px; line-height: 1.3; }
.rows em { font: 800 22px var(--aa-head); font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }
.debt-free { display: flex; align-items: center; gap: 12px; margin: 8px 0 0; font: 800 21px/1.2 var(--aa-head); color: var(--pos); }
.debt-free img { width: 56px; }

/* credit */
.credit { display: flex; align-items: center; gap: 16px; }
.gauge { width: 124px; flex: none; }
.gauge-bg, .gauge-fg { fill: none; stroke-width: 12; stroke-linecap: round; }
.gauge-bg { stroke: var(--aa-bubble); }
.gauge-fg { stroke: var(--aa-teal); transition: stroke-dasharray .8s; }
.gauge-dot { fill: var(--aa-cream); stroke: var(--aa-teal-dark); stroke-width: 3; }
.score { font: 800 34px/1 var(--aa-head); margin-top: 4px; }
.score small { font: 800 18px var(--aa-head); color: var(--aa-teal-ink); margin-left: 4px; }
.fine { margin: 6px 0 0; font-size: 17px; line-height: 1.35; color: var(--muted); }

/* log */
.log-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.log-list li { border-left: 6px solid var(--aa-line); padding: 2px 0 2px 12px; font-size: 18px; line-height: 1.3; }
.log-list li.tone-good { border-color: var(--aa-green); }
.log-list li.tone-bad { border-color: var(--aa-coral); }
.log-list li.tone-start { border-color: var(--aa-gold); }
.log-list small { display: block; color: var(--aa-pink-ink); font: 700 16px/1.2 var(--aa-head); }
.log-list b { display: block; }
.log-list span { color: var(--muted); }

/* plan */
.plan h2 { font-size: 34px; margin: 4px 0 16px; }
.paycheck { border: 4px solid var(--aa-line); border-radius: 20px; background: var(--aa-bubble); padding: 10px 16px; margin-bottom: 18px; }
.pc-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-weight: 700; }
.pc-row b { font: 800 22px var(--aa-head); font-variant-numeric: tabular-nums; }
.pc-row.total { border-top: 3px dashed var(--aa-line); margin-top: 6px; padding-top: 10px; font-size: 22px; align-items: baseline; }
.pc-row.total b { font: 800 34px/1 var(--aa-head); color: var(--pos); }
.pc-row.total.neg b { color: var(--neg); }
details summary { cursor: pointer; font: 800 18px var(--aa-head); color: var(--aa-teal-ink); padding: 4px 0; }
.pc-lines { list-style: none; margin: 6px 0; padding: 0; font-size: 18px; }
.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: 10px; margin-bottom: 14px; font: 800 18px var(--aa-head); color: var(--aa-ink); }
.presets .aa-btn { gap: 8px; padding-left: 10px; }
.presets .aa-btn img { width: 30px; height: 30px; }

.buckets { display: grid; gap: 12px; }
.bucket { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 4px solid var(--aa-line); border-radius: 22px; background: var(--aa-bubble); transition: border-color .15s; }
.bucket:hover, .bucket:focus-within { border-color: var(--aa-teal); }
.bucket.off { opacity: .6; }
.bucket > img { width: 58px; height: 58px; 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; font: 700 20px/1.2 var(--aa-body); }
.bucket-top label small { display: block; color: var(--muted); font-size: 16px; line-height: 1.3; }
.bucket-top label small img { display: inline-block; vertical-align: -5px; }
.bucket output { text-align: right; white-space: nowrap; }
.bucket output b { display: block; font: 800 24px/1.1 var(--aa-head); font-variant-numeric: tabular-nums; }
.bucket output small { color: var(--muted); font: 700 16px var(--aa-body); }

input[type=range] {
  --fill: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 4px 0 0; background: transparent; cursor: pointer;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 14px; border-radius: 99px; border: 3px solid var(--aa-line);
  background: linear-gradient(90deg, var(--aa-teal) var(--fill), var(--aa-cream) var(--fill));
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; border: 3px solid var(--aa-line); background: var(--aa-cream); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--aa-teal); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; border-radius: 50%;
  background: var(--aa-gold); border: 3px solid var(--aa-gold-dark); box-shadow: 0 3px 0 var(--aa-gold-dark); transition: transform .1s;
}
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--aa-gold); border: 3px solid var(--aa-gold-dark); box-shadow: 0 3px 0 var(--aa-gold-dark); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type=range]:focus-visible { outline: 4px solid var(--aa-focus); outline-offset: 2px; border-radius: 12px; }
input[type=range]:disabled { cursor: not-allowed; opacity: .6; }

.leftover-line { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 14px; border-radius: 18px; background: var(--aa-bubble); border: 4px solid var(--aa-line); font: 800 22px var(--aa-head); }
.leftover-line img { width: 34px; }
.leftover-line span { flex: 1; color: var(--aa-ink); }

.shortfall { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border: 4px solid var(--aa-coral); border-radius: 20px; background: var(--aa-bubble); }
.shortfall .aa-char { flex: none; width: 76px; }
.shortfall p { margin: 0; font-size: 19px; }

/* Fifi's hint under the plan, and her tip lines in dialogs: the series speech bubble, smaller */
.fifi-hint { margin: 18px 0 16px; }
.fifi-hint .aa-speech__face { width: 84px; }
.fifi-hint .aa-bubble { flex: 1; max-width: none; }
.fifi-hint .aa-bubble__text { font-size: 19px; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.plan-actions .aa-btn { flex: 1 1 auto; white-space: nowrap; }
.plan-actions .aa-btn--big { flex-grow: 1.4; }

.decision { text-align: center; padding: 34px 26px; }
.decision img { width: 150px; margin: 0 auto 12px; }
.decision h2 { font-size: 36px; margin-bottom: 8px; }
.decision p { color: var(--aa-ink); margin: 0 auto 22px; max-width: 30em; }

/* ---------- modal */
dialog { border: 0; padding: 16px; background: transparent; width: min(700px, 100%); max-width: 100%; max-height: 100dvh; color: var(--aa-ink); overflow: visible; }
dialog.wide { width: min(820px, 100%); }
dialog::backdrop { background: var(--aa-veil); }
dialog[open]::backdrop { animation: aa-fade-in 200ms ease both; }
dialog.is-leaving::backdrop { animation: aa-fade-out var(--aa-t-exit) ease both; }
.modal-card {
  position: relative; z-index: 1; max-height: calc(100dvh - 32px); overflow: auto; padding: 26px 28px;
  animation: aa-pop-in var(--aa-t-pop) var(--aa-ease-pop) both;
}
dialog.is-leaving .modal-card { animation: aa-pop-out var(--aa-t-exit) var(--aa-ease-in) both; }
.modal-card h2 { font-size: 34px; margin-bottom: 8px; }
.modal-card p { margin: 0 0 12px; }
.modal-card .aa-bubble h2 { font-size: 32px; margin-bottom: 6px; }
.modal-card .aa-bubble p { margin-bottom: 8px; }
.modal-card .aa-bubble p:last-child { margin-bottom: 0; }
.modal-card .btn-block { margin-top: 18px; }
.modal-options { display: grid; gap: 12px; margin: 16px 0 8px; }
.modal-option { display: block; width: 100%; padding: 14px 18px; }
.modal-option.has-img { display: flex; align-items: center; gap: 14px; }
.modal-option img { width: 68px; height: 68px; object-fit: contain; flex: none; }
.modal-option b { display: block; font: 800 22px/1.15 var(--aa-head); color: var(--aa-teal-ink); margin-bottom: 2px; }
.modal-option small { display: block; color: var(--aa-ink); font-size: 18px; line-height: 1.35; }
.modal-option small.need { color: var(--neg); font-weight: 800; margin-top: 4px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }

/* speech bubbles inside dialogs and the ending */
.aa-speech { margin-bottom: 14px; }
.aa-speech__face { width: 100px; }
.aa-bubble { flex: 1; max-width: none; }
.aa-speech--right .aa-bubble { flex: 0 1 auto; }
.aa-bubble__name-note { margin: 0 0 2px; font: 700 19px/1.2 var(--aa-head); color: var(--aa-pink-ink); }
.aa-bubble ul.aa-bubble__text { margin: 4px 0 0; padding-left: 22px; }
.aa-bubble ul.aa-bubble__text li { margin-bottom: 6px; }

.event { text-align: center; }
.event-art { position: relative; width: 200px; height: 176px; margin: 0 auto 8px; }
.event-img { width: 170px; height: 170px; object-fit: contain; margin: 0 auto; animation: aa-pop-in .5s var(--aa-ease-pop) both; }
.event-react { position: absolute; right: -40px; bottom: -6px; width: 84px; }
.event-react img { width: 100%; }
.event--bad .event-img { animation: aa-pop-in .5s var(--aa-ease-pop) both, aa-wiggle .6s ease-in-out .5s 1; }
.delta { font: 800 46px/1 var(--aa-head); margin: 10px 0 14px; }
.delta small { display: block; font: 700 18px var(--aa-head); color: var(--muted); margin-top: 4px; }
.paid { text-align: left; border: 3px dashed var(--aa-line); border-radius: 18px; padding: 10px 14px; 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 12px 4px 6px; border-radius: 999px; background: var(--aa-bubble); border: 3px solid var(--aa-line); font: 800 18px var(--aa-head); }
.paid-parts img { width: 30px; height: 30px; object-fit: contain; }
.paid-note { margin: 8px 0 0 !important; font: 700 18px var(--aa-body); }
.event .fifi-hint { text-align: left; }
.event .modal-option { text-align: left; }
.outcome { font: 800 21px/1.3 var(--aa-head); padding: 12px 16px; border-radius: 18px; background: var(--aa-bubble); border: 4px solid var(--aa-teal); }

.ms-head { display: flex; gap: 18px; align-items: center; }
.ms-head > img { width: 120px; flex: none; }
.ms-head p { color: var(--aa-ink); margin: 0; }
.ms-cash { display: flex; align-items: center; gap: 8px; font-size: 18px; color: var(--muted); margin: 10px 0 0 !important; }

.review-worth { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 800 28px/1.1 var(--aa-head); margin: 6px 0 14px; }
.review-worth .aa-ico { color: var(--aa-teal-ink); }
.review-worth em { font: 800 20px var(--aa-head); font-style: normal; padding: 4px 14px 2px; border-radius: 999px; background: var(--aa-bubble); border: 3px solid var(--aa-line); }
.review-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; max-height: 46vh; overflow: auto; }
.review-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; background: var(--aa-bubble); border: 3px solid var(--aa-line); }
.review-list img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.review-list span { flex: 1; min-width: 0; }
.review-list b { display: block; font: 700 20px/1.2 var(--aa-body); }
.review-list small { color: var(--muted); display: block; line-height: 1.3; font-size: 16px; }
.review-list em { font: 800 22px var(--aa-head); font-style: normal; white-space: nowrap; }
.quiet { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.quiet img { width: 64px; }

.help-list { list-style: none; padding: 0; margin: 4px 0 14px; display: grid; gap: 10px; }
.help-list li { display: flex; align-items: center; gap: 12px; }
.help-list img { width: 48px; height: 48px; object-fit: contain; flex: none; }
.help-list b { display: block; font: 800 21px var(--aa-head); }
.help-list span { font-size: 18px; line-height: 1.3; }

/* ---------- 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%; max-width: none; object-fit: cover; border: 4px solid var(--aa-line); border-radius: var(--aa-radius-panel); box-shadow: var(--aa-shadow-panel); }
.end-char { position: absolute; z-index: 2; bottom: 52px; }
.end-char img { width: 100%; }
.end-roundy { left: calc(50% - clamp(150px, 24vw, 220px)); width: clamp(120px, 20vw, 190px); }
.end-fifi { left: calc(50% + clamp(0px, 1vw, 12px)); width: clamp(96px, 15vw, 146px); }
.end-body { position: relative; text-align: center; padding: 30px clamp(18px, 4vw, 40px); }
.end-body h1 { font-size: clamp(2.4rem, 7vw, 3.4rem); margin-bottom: 8px; }
.end-worth { font-size: 22px; margin: 0 0 16px; }
.end-worth strong { font: 800 34px var(--aa-head); }
.end-chart svg { display: block; width: 100%; height: auto; }
.goal-line-svg { stroke: var(--aa-gold); stroke-width: 3; stroke-dasharray: 8 6; }
.zero-line { stroke: var(--aa-line-dark); stroke-width: 2; }
.chart-label { font: 800 16px var(--aa-body); fill: var(--aa-ink-soft); }
.chart-line { fill: none; stroke: var(--aa-teal-dark); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--aa-gold); stroke: var(--aa-gold-dark); stroke-width: 3; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 22px; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; }
.stat img { width: 48px; height: 48px; object-fit: contain; }
.stat span { font: 700 16px/1.2 var(--aa-head); color: var(--aa-ink); margin-top: 4px; }
.stat b { font: 800 26px var(--aa-head); }
.end .aa-speech { text-align: left; margin-top: 4px; }
.end .aa-speech__face { width: 110px; }
.end .aa-btn--big { margin-top: 18px; }

/* ---------- toasts & confetti */
#toasts { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.toast { position: fixed; left: 50%; top: auto; bottom: 24px; max-width: min(92vw, 640px); text-align: center; }
.toast.aa-toast--good { --tone: var(--aa-green-dark); }
.toast.aa-toast--warn { --tone: var(--aa-coral); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
/* page content sits above the confetti (text is never covered) */
.topbar, #app { position: relative; z-index: 1; }
body[data-screen="title"] .topbar { position: absolute; }

/* ---------- motion */
@keyframes pulse-up { 40% { transform: scale(1.06); color: var(--pos); } }
@keyframes pulse-down { 40% { transform: scale(.97); } }
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); } }

@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: minmax(0, 1fr); }
  .col-main { order: -1; }
  .col-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worth-card, .log { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { min-height: 72px; }
  .brand { font-size: 21px; }
  .brand img { width: 34px; height: 34px; }
  .pill-text { display: none; }
  #new-game-btn { min-width: 48px; padding: 8px 12px 6px; }
  .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: minmax(0, 1fr); }
  .plan-actions .aa-btn { flex-basis: 100%; }
  .card { padding: 16px; }
  .modal-card { padding: 20px 16px; }
  .aa-speech__face { width: 72px; }
  .fifi-hint .aa-speech__face { width: 64px; }
  .ms-head { flex-direction: column; align-items: flex-start; }
  .ms-head > img { width: 90px; }
  .modal-option img { width: 52px; height: 52px; }
  .end-stats { grid-template-columns: 1fr 1fr; }
  .modal-actions { grid-template-columns: 1fr; }
  .modal-card h2, .modal-card .aa-bubble h2 { font-size: 28px; }
  .trail-ticks span { font-size: 16px; }
  .title-rouck { display: none; }
}
@media (max-width: 520px) {
  .brand span { display: none; }        /* the coin stays; the top bar has to fit a phone held upright */
  .top-actions { gap: 10px; }
  .toolbar { gap: 8px; }
}
@media (max-width: 640px) and (min-height: 521px) {
  .title-stack { padding-bottom: calc(var(--h) + 40px); }   /* Roundy and Fifi stand below the buttons, never on them */
}
@media (max-width: 380px) {
  .choice-row, .choice-row.three { grid-template-columns: 1fr; }
}
/* short screens (a phone on its side): the title has to fit */
@media (max-height: 520px) {
  .title-stack { padding-top: 8px; padding-bottom: 8px; }
  .title-logo { width: clamp(150px, 46vh, 260px); }
  .title-tagline { display: none; }
  .title-btns .aa-btn--big { min-height: 60px; font-size: 26px; padding: 10px 32px 8px; }
  .title-row { margin-top: 10px; }
  .title-char { bottom: 8px; }
}
