/* What-If Wealth, the board game (js/ui/game.js). Colours come from FinPlan's tokens, so Night and Day both work.
   Everything here is under .gm, so none of it touches the tools.
   © In-Transit LLC. All rights reserved. */
.gm { --k-pay: var(--c-4); --k-fx: var(--c-p); --k-mkt: var(--c-3); --k-life: color-mix(in srgb, var(--c-2) 55%, var(--bad)); --k-key: var(--accent); --k-spend: var(--c-2);
  --k-pen: color-mix(in srgb, var(--c-4) 50%, var(--c-2)); --k-crash: var(--bad); --k-rate: var(--c-1);
  --t-a: var(--c-2); --t-c: var(--c-3); --t-h: var(--c-4); --t-e: var(--c-1); display: grid; gap: 16px; }
.gm h1, .gm h2, .gm h3, .gm p { margin: 0; }
.gm-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: space-between; }
.gm-logo { line-height: 0; }
.gm-logo img { display: block; height: clamp(56px, 8vw, 84px); width: auto; border-radius: 14px; border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.gm-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.gm-chip { display: flex; align-items: center; gap: 8px; padding: 6px 13px 6px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-weight: 650; font-size: 13px; }
.gm-chip i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--surface-3); }
.gm-chip small { display: block; font: 600 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); line-height: 1.1; }
.gm .mono { font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.gm .lede { color: var(--ink-2); }
.gm-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* set-up */
.gm-setup { display: grid; gap: 14px; padding: 18px 20px; }
.gm-opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .gm-opts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .gm-opts { grid-template-columns: 1fr; } }
.gm-opt { position: relative; display: grid; gap: 7px; align-content: start; padding: 14px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); cursor: pointer; }
.gm-opt:hover { border-color: var(--accent); }
.gm-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--ring); }
.gm-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-opt input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.gm-opt b { font-size: 15px; }
.gm-opt .e { font-size: 26px; line-height: 1; }
.gm-opt p { color: var(--ink-2); font-size: 12.5px; }
.gm-seg { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--track); }
.gm-seg i { display: block; height: 100%; }
.gm-seg .a { background: var(--t-a); } .gm-seg .c { background: var(--t-c); } .gm-seg .h { background: var(--t-h); } .gm-seg .e { background: var(--t-e); }
.gm-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gm-nums label { display: grid; gap: 2px; font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.gm-nums input { width: 100%; min-width: 0; padding: 6px 7px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); font: 600 14px var(--font); }
.gm-sum { font: 600 12px var(--mono); color: var(--ink-3); }
.gm-sum.bad { color: var(--bad); }
.gm-seed { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gm-seed input { width: 92px; padding: 7px 9px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink); font: 600 14px var(--mono); }

/* play */
.gm-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1020px) { .gm-layout { grid-template-columns: 1fr; } }
.gm-boardwrap { padding: 12px; border: 1px solid var(--line-2); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.gm-board { display: grid; grid-template-columns: repeat(9, 1fr); grid-template-rows: repeat(9, 1fr); gap: 5px; aspect-ratio: 1 / 1; width: 100%; }
.gm-sq { --k: var(--c-p); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 3px 2px 4px; min-width: 0;
  border-radius: 9px; border: 1px solid color-mix(in srgb, var(--k) 50%, transparent); border-top: 4px solid var(--k);
  background: color-mix(in srgb, var(--k) 17%, var(--bg-2)); color: var(--ink); transition: transform .15s; }
.gm-sq:hover { transform: translateY(-2px); z-index: 3; }
.gm-sq.pay { --k: var(--k-pay); } .gm-sq.fx { --k: var(--k-fx); } .gm-sq.mkt { --k: var(--k-mkt); } .gm-sq.life, .gm-sq.med { --k: var(--k-life); } .gm-sq.key { --k: var(--k-key); }
.gm-sq.spend { --k: var(--k-spend); } .gm-sq.pen { --k: var(--k-pen); } .gm-sq.crash { --k: var(--k-crash); } .gm-sq.rate { --k: var(--k-rate); }
.gm-sq .age { font: 700 clamp(8px, 1.05vw, 11px)/1 var(--mono); padding: 2px 5px; border-radius: 99px; background: color-mix(in srgb, var(--k) 30%, var(--bg-2)); color: var(--ink); }
.gm-sq .ic { font-size: clamp(14px, 2.5vw, 26px); line-height: 1; }
.gm-sq b { font: 650 clamp(7px, .9vw, 10.5px)/1.05 var(--font); text-align: center; }
.gm-sq.past { opacity: .55; }
.gm-sq.now { opacity: 1; outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent); z-index: 4; }
.gm-pawns { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); display: flex; z-index: 5; }
.gm-pawn { width: clamp(20px, 3.1vw, 32px); height: clamp(20px, 3.1vw, 32px); border-radius: 50%; display: grid; place-items: center; font-size: clamp(12px, 1.9vw, 19px); margin: 0 -4px; background: var(--bg-2); border: 2px solid var(--accent); box-shadow: var(--shadow); }
.gm-pawn.me { animation: gm-bob .7s infinite alternate; z-index: 2; background: color-mix(in srgb, var(--accent) 25%, var(--bg-2)); }
.gm-pawn.out { filter: grayscale(1); opacity: .6; border-color: var(--bad); }
@keyframes gm-bob { to { transform: translateY(-5px); } }
.gm-centre { grid-column: 2 / 9; grid-row: 2 / 9; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; min-width: 0; padding: clamp(8px, 1.6vw, 18px); border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.gm-title { text-align: center; }
.gm-title b { display: block; font: 800 clamp(16px, 3.4vw, 36px)/1.05 var(--font-display); letter-spacing: -.02em; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gm-title span { font: 600 clamp(7px, .95vw, 11px) var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.gm-stage { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; min-height: 0; }
.gm-stack { position: relative; height: clamp(54px, 9vw, 100px); display: grid; place-items: center; }
.gm-stack i { position: absolute; inset: 8% 14%; border-radius: 9px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--k) 38%, var(--bg-2)); box-shadow: var(--shadow); }
.gm-stack i:nth-child(1) { transform: rotate(-7deg); } .gm-stack i:nth-child(2) { transform: rotate(3deg); } .gm-stack i:nth-child(3) { transform: rotate(-1deg); }
.gm-stack span { position: relative; z-index: 2; font: 700 clamp(8px, 1.05vw, 12px) var(--mono); letter-spacing: .08em; text-transform: uppercase; text-align: center; color: var(--ink); }
.gm-stack.m { --k: var(--k-mkt); } .gm-stack.l { --k: var(--k-life); }
.gm-dicebox { display: grid; gap: 8px; justify-items: center; }
.gm-dice { display: flex; gap: 8px; }
.gm-die { width: clamp(36px, 5.6vw, 60px); height: clamp(36px, 5.6vw, 60px); border-radius: 12px; display: grid; place-items: center; font-size: clamp(24px, 4.2vw, 44px); line-height: 1; background: var(--bg-2); color: var(--ink); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.gm-die.roll { animation: gm-spin .12s linear infinite; }
@keyframes gm-spin { 0% { transform: rotate(0) translateY(-3px); } 50% { transform: rotate(180deg) translateY(2px); } 100% { transform: rotate(360deg) translateY(-3px); } }
.gm-legend { display: flex; gap: 5px 12px; flex-wrap: wrap; justify-content: center; font: 600 clamp(8px, .95vw, 11px) var(--font); color: var(--ink-2); }
.gm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.gm-side { display: grid; gap: 14px; }
.gm-panel { padding: 14px 16px; }
.gm-panel h3 { font: 700 11.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }
.gm-panel h3::before { content: "// "; color: var(--accent); }
.gm-me { display: flex; gap: 12px; align-items: center; }
.gm-av { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 29px; background: var(--accent-soft); border: 1px solid var(--accent); flex: none; }
.gm-lvl { display: inline-block; margin-left: 6px; font: 700 10px var(--mono); letter-spacing: .08em; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: 2px; }
.gm-xp { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 6px 0 3px; }
.gm-xp i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s; }
.gm-total { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 12px 0 2px; }
.gm-total .big { font: 750 32px/1 var(--font-display); letter-spacing: -.02em; }
.gm-note { color: var(--ink-3); font-size: 12.5px; }
.gm-buckets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 10px 0 6px; }
.gm-bk { text-align: center; }
.gm-tank { height: 100px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; overflow: hidden; }
.gm-tank i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--t) 70%, #fff), var(--t)); transition: height .6s cubic-bezier(.3, 1.4, .5, 1); }
.gm-tank i::before { content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--t) 70%, #fff); animation: gm-wob 2s ease-in-out infinite alternate; }
@keyframes gm-wob { to { transform: translateX(4px) scaleX(1.08); } }
.gm-bk.hit .gm-tank { animation: gm-shake .4s; }
@keyframes gm-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.gm-bk b { display: block; margin-top: 6px; font-size: 12px; }
.gm-bk span { font: 600 11.5px var(--mono); color: var(--ink-2); }
.gm-order { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font: 600 10.5px var(--mono); color: var(--ink-2); margin-top: 8px; }
.gm-order em { font-style: normal; background: var(--surface-3); border-radius: 99px; padding: 3px 8px; } .gm-order span { color: var(--ink-3); }
.gm-roll { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.gm-badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gm-bd { text-align: center; border-radius: var(--r); background: var(--surface-2); padding: 8px 4px 7px; border: 1px solid transparent; }
.gm-bd i { font-style: normal; font-size: 27px; display: block; filter: grayscale(1) opacity(.4); }
.gm-bd b { display: block; font-size: 11px; line-height: 1.15; margin-top: 2px; color: var(--ink-3); }
.gm-bd.on { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface-2)); }
.gm-bd.on i { filter: none; animation: gm-pop .6s; } .gm-bd.on b { color: var(--ink); }
@keyframes gm-pop { 0% { transform: scale(.3) rotate(-30deg); } 60% { transform: scale(1.35) rotate(10deg); } 100% { transform: scale(1); } }
.gm-lb { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.gm-lb li { display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 8px; align-items: center; font-weight: 600; font-size: 13px; }
.gm-lb .rk { font: 700 14px var(--mono); color: var(--accent); text-align: center; }
.gm-lb .pw { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 16px; }
.gm-lb .bar { height: 7px; border-radius: 99px; background: var(--track); margin-top: 3px; overflow: hidden; } .gm-lb .bar i { display: block; height: 100%; background: var(--accent); }
.gm-lb small { color: var(--ink-3); font-weight: 500; }
.gm-lb .you .bar i { background: var(--accent-2); } .gm-lb .out .bar i { background: var(--bad); } .gm-lb .out > span:last-child { color: var(--bad); }
.gm-log { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; max-height: 240px; overflow: auto; }
.gm-log li { padding: 7px 10px; border-left: 3px solid var(--line-2); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.gm-log li.bad { border-left-color: var(--bad); background: var(--bad-bg); } .gm-log li.good { border-left-color: var(--good); background: var(--good-bg); }
.gm-log li.gold { border-left-color: var(--warn); }
.gm-result { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface-2); margin-top: 12px; }
.gm-result.won { border-color: var(--good); background: var(--good-bg); } .gm-result.lost { border-color: var(--bad); background: var(--bad-bg); }
.gm-result h3 { font: 750 18px var(--font-display); letter-spacing: -.01em; }
.gm-result h3::before { content: none; }
.gm-learn { color: var(--ink-2); font-size: 13px; }
.gm-fine { color: var(--ink-3); font-size: 12px; }
.gm-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140px); z-index: 60; max-width: min(92vw, 480px); padding: 12px 20px; border-radius: 14px; font: 700 15px/1.3 var(--font); text-align: center;
  background: var(--sticky); color: var(--ink); border: 1px solid var(--accent); box-shadow: var(--shadow-lg); transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); pointer-events: none; }
.gm-toast.show { transform: translate(-50%, 0); } .gm-toast.bad { border-color: var(--bad); } .gm-toast.good { border-color: var(--good); } .gm-toast.gold { border-color: var(--warn); }
[data-tool="game"] { --h: var(--accent-2); }   /* the toolbar link's colour, like the other tools */
@media (max-width: 860px) { .gm-toast { bottom: 88px; } }   /* above the phone dock */
@media (max-width: 560px) { .gm-sq b { display: none; } .gm-sq .age { font-size: 7px; padding: 1px 3px; } .gm-buckets { gap: 5px; } .gm-tank { height: 80px; } }
@media (prefers-reduced-motion: reduce) { .gm *, .gm-toast { animation: none !important; transition: none !important; } }

/* Colour palettes (js/ui/game-palettes.js): a chosen palette sets the game's colours on .gm and gives it its own backdrop */
.gm-pal { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gm-pal .pb { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 7px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 12.5px var(--font); cursor: pointer; }
.gm-pal .pb:first-of-type { padding-left: 12px; }
.gm-pal .pb:hover { border-color: var(--accent); }
.gm-pal .pb.on { border-color: var(--accent); box-shadow: var(--ring); background: var(--accent-soft); }
.gm-pal .pb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-pal .sw { display: flex; } .gm-pal .sw i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -5px; } .gm-pal .sw i:first-child { margin-left: 0; }
.gm[data-pal] { background: var(--pal-bg); color: var(--ink); padding: 16px; border-radius: 22px; border: 1px solid var(--line-2); }
.gm[data-pal] .lede, .gm[data-pal] .gm-note, .gm[data-pal] .gm-fine { color: var(--ink-2); }
.gm[data-pal] a { color: var(--accent); }

/* One screen: a compact header, a board sized to the window (--gm-board, set in js/ui/game.js) and one tabbed panel beside it */
.gm { gap: 10px; }
.gm-top { gap: 8px 14px; }
.gm-logo img { height: clamp(38px, 5vw, 50px); border-radius: 10px; }
.gm-pal { gap: 5px; margin-left: auto; }
.gm-pal .pb { padding: 4px 7px; gap: 0; }
.gm-pal .pb .sw i { width: 11px; height: 11px; margin-left: -4px; }
.gm-pal .pb.auto { width: 30px; justify-content: center; padding: 3px 0; font-size: 15px; line-height: 1; }
.gm-pal .pb:first-of-type { padding-left: 0; }
.gm-chip { padding: 3px 11px 3px 5px; } .gm-chip i { width: 22px; height: 22px; font-size: 12px; }
.gm[data-pal] { padding: 10px; }
.gm-panel { padding: 10px 12px; } .gm-panel h3 { margin-bottom: 8px; }
.gm-me { gap: 10px; } .gm-av { width: 42px; height: 42px; font-size: 24px; border-radius: 12px; }
.gm-total { margin: 8px 0 0; } .gm-total .big { font-size: 26px; }
.gm-buckets { margin: 8px 0 4px; gap: 7px; } .gm-tank { height: 62px; } .gm-bk b { margin-top: 3px; font-size: 11.5px; }
.gm-order { margin-top: 4px; } .gm-roll { margin-top: 10px; }
.gm-tabs { display: flex; flex-direction: column; min-height: 0; }
.gm-tabbar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.gm-tabbar button { padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font: 600 12px var(--font); cursor: pointer; }
.gm-tabbar button[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.gm-tabbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-tabbody { min-height: 0; overflow: auto; }
.gm-tabbody .gm-log { max-height: none; }
.gm-badges { grid-template-columns: repeat(3, 1fr); } .gm-bd { padding: 6px 3px 5px; } .gm-bd i { font-size: 22px; } .gm-bd b { font-size: 10.5px; }
.gm-result { margin-top: 0; }
@media (min-width: 1021px) {
  .gm-layout { grid-template-columns: minmax(0, min(var(--gm-board, 720px), 62%)) minmax(320px, 1fr); }
  .gm-boardwrap { padding: 8px; border-radius: 16px; } .gm-board { gap: 4px; }
  .gm-layout { justify-content: center; }
  .gm-side { gap: 10px; height: calc(var(--gm-board, 720px) + 18px); grid-template-rows: auto minmax(0, 1fr); max-width: 620px; }
}
@media (max-height: 760px) and (min-width: 1021px) { .gm-tank { height: 44px; } .gm-buckets { margin: 6px 0 2px; } .gm-order { display: none; } .gm-total .big { font-size: 22px; } }
/* set-up on one screen too */
.gm-setup { padding: 12px 16px; gap: 10px; }
.gm-opt { padding: 10px 12px; gap: 5px; } .gm-opt .e { font-size: 22px; } .gm-opt p:last-of-type { display: none; }

/* The board's insides scale with the board (container units), not with the window, so a small board never grows taller than it is wide */
.gm-boardwrap { container-type: inline-size; }
.gm-board .gm-sq .age { font-size: clamp(7px, 1.9cqw, 11px); padding: 1px 4px; }
.gm-board .gm-sq .ic { font-size: clamp(12px, 4cqw, 26px); }
.gm-board .gm-sq b { font-size: clamp(6px, 1.55cqw, 10.5px); }
.gm-board .gm-pawn { width: clamp(18px, 4.4cqw, 32px); height: clamp(18px, 4.4cqw, 32px); font-size: clamp(11px, 2.8cqw, 19px); }
.gm-centre { padding: clamp(6px, 2cqw, 18px); gap: clamp(4px, 1.2cqw, 8px); }
.gm-title b { font-size: clamp(16px, 5cqw, 36px); } .gm-title span { font-size: clamp(7px, 1.5cqw, 11px); }
.gm-stack { height: clamp(44px, 13cqw, 100px); } .gm-stack span { font-size: clamp(7px, 1.6cqw, 12px); }
.gm-die { width: clamp(28px, 8cqw, 60px); height: clamp(28px, 8cqw, 60px); font-size: clamp(20px, 6cqw, 44px); border-radius: 10px; }
.gm-legend { font-size: clamp(7px, 1.5cqw, 11px); }

/* The colour picker is a dropdown at the right of the header, and the chips sit beside the logo on one line */
.gm-top { justify-content: flex-start; }
.gm-chips { gap: 6px; }
.gm-chip { gap: 6px; padding: 3px 11px 3px 5px; }
.gm-chip > div { display: flex; align-items: baseline; gap: 5px; }
.gm-chip small { display: inline; margin: 0; font-size: 9.5px; }
.gm-pal { position: relative; margin-left: auto; display: block; }
.gm-pal > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 8px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 600 12.5px var(--font); cursor: pointer; user-select: none; }
.gm-pal > summary::-webkit-details-marker { display: none; }
.gm-pal > summary:hover, .gm-pal[open] > summary { border-color: var(--accent); }
.gm-pal > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-pal .car { font-size: 10px; color: var(--ink-3); }
.gm-pal .sw { display: inline-flex; align-items: center; } .gm-pal .sw i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); margin-left: -4px; } .gm-pal .sw i:first-child { margin-left: 0; }
.gm-pal .sw.auto { width: 18px; justify-content: center; font-size: 14px; line-height: 1; }
.gm-pal-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: grid; gap: 2px; min-width: 190px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--sticky); box-shadow: var(--shadow-lg); }
.gm-pal-list .pb { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); font: 600 12.5px var(--font); text-align: left; cursor: pointer; }
.gm-pal-list .pb:hover { background: var(--surface-2); }
.gm-pal-list .pb.on { background: var(--accent-soft); border-color: var(--accent); }
.gm-pal-list .pb:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gm-pal-list .pb:first-of-type { padding-left: 10px; }
.gm-pal-list { min-width: 210px; } .gm-pal-list .pb .nm { white-space: nowrap; }

@media (min-width: 1100px) { .gm-opts { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* Where to start: at retirement, or today with the saving years */
.gm-starts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.gm-st { position: relative; display: inline-flex; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--font); cursor: pointer; }
.gm-st input { position: absolute; opacity: 0; pointer-events: none; }
.gm-st:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: var(--ring); }
.gm-st:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.gm-pile { grid-column: 1 / -1; }
.gm-pile .gm-tank { height: 62px; }

/* A livelier board: a progress track, the card you just drew, changes floating off the tanks, a pulse on the square you land on, and a shake for a crash */
.gm-centre { grid-template-rows: auto auto minmax(0, 1fr) auto auto; }
.gm-track { display: flex; align-items: center; gap: 8px; }
.gm-prog { position: relative; flex: 1; height: clamp(6px, 1.4cqw, 10px); border-radius: 99px; background: var(--track); overflow: visible; }
.gm-prog i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, var(--k-pay), var(--accent), var(--accent-2)); transition: width .5s; }
.gm-prog b.rt { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--k-key); border-radius: 2px; }
.gm-track .mono { font-size: clamp(7px, 1.4cqw, 10.5px); white-space: nowrap; }
.gm-card { display: flex; align-items: center; gap: clamp(6px, 1.6cqw, 12px); min-height: clamp(34px, 9cqw, 64px); padding: clamp(4px, 1.2cqw, 10px) clamp(8px, 2cqw, 14px); border-radius: 12px; border: 1px solid var(--line-2); border-left: 5px solid var(--ink-3); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.gm-card.good { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--surface)); } .gm-card.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); } .gm-card.gold { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.gm-card .ci { font-size: clamp(18px, 5cqw, 32px); line-height: 1; } .gm-card .cb { display: grid; gap: 1px; min-width: 0; } .gm-card .cb b { font-size: clamp(8px, 1.9cqw, 13px); } .gm-card .cb span { font-size: clamp(7px, 1.6cqw, 12px); color: var(--ink-2); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gm-card.flip { animation: gm-flip .5s ease; }
@keyframes gm-flip { from { transform: perspective(600px) rotateX(-80deg); opacity: 0; } to { transform: none; opacity: 1; } }
.gm-bk { position: relative; }
.gm-delta { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); z-index: 6; padding: 1px 7px; border-radius: 99px; font: 800 11px var(--mono); white-space: nowrap; pointer-events: none; animation: gm-float 1.4s ease-out forwards; box-shadow: var(--shadow); }
.gm-delta.up { background: var(--good); color: #04281a; } .gm-delta.dn { background: var(--bad); color: #fff; }
@keyframes gm-float { 0% { opacity: 0; transform: translate(-50%, 14px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -26px); } }
.gm-sq.hit { animation: gm-land .8s ease; }
@keyframes gm-land { 0% { transform: scale(1); } 25% { transform: scale(1.18); box-shadow: 0 0 0 4px var(--accent), 0 0 22px var(--accent); } 100% { transform: scale(1); } }
.gm-board.shake { animation: gm-quake .55s; }
@keyframes gm-quake { 10%, 50%, 90% { transform: translateX(-5px) rotate(-.3deg); } 30%, 70% { transform: translateX(5px) rotate(.3deg); } }
.gm-pawns { animation: gm-hop .4s ease; }
@keyframes gm-hop { 0% { transform: translateX(-50%) translateY(-18px); } 60% { transform: translateX(-50%) translateY(2px); } 100% { transform: translateX(-50%); } }
.gm-boardwrap { position: relative; }
.gm-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 30; border-radius: 16px; }
.gm-confetti i { position: absolute; left: var(--x); bottom: -10%; font-style: normal; font-size: calc(20px * var(--s)); animation: gm-rise 2.6s ease-out var(--d) forwards; }
@keyframes gm-rise { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(-110cqh) rotate(360deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gm-pawns, .gm-delta, .gm-sq.hit, .gm-board.shake, .gm-card.flip { animation: none !important; } .gm-confetti { display: none; } }

/* No scroll bars in the game; the result gets the room once the roll buttons are gone */
.gm, .gm * { scrollbar-width: none; }
.gm *::-webkit-scrollbar { display: none; }
.gm-side.done .gm-buckets, .gm-side.done .gm-order, .gm-side.done .gm-note, .gm-side.done .gm-xp, .gm-side.done .gm-me { display: none; }
.gm-result { gap: 8px; padding: 12px 14px; }
.gm-result h3 { font-size: 17px; }
.gm-bigline { font: 800 30px/1.05 var(--font-display); letter-spacing: -.02em; margin: 0; } .gm-bigline small { font: 600 13px var(--font); color: var(--ink-2); letter-spacing: 0; }
.gm-res { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gm-res li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.gm-res li.you { border-color: var(--accent); box-shadow: var(--ring); }
.gm-res .rk { font-size: 20px; line-height: 1; text-align: center; }
.gm-res .who { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; } .gm-res .who b { font-size: 14px; } .gm-res .who small { color: var(--ink-3); font-size: 11.5px; }
.gm-res .amt { font: 800 14px var(--font); white-space: nowrap; } .gm-res li.out .amt { color: var(--bad); }
.gm-learn { color: var(--ink); font-size: 13px; line-height: 1.45; }
.gm-lb li { grid-template-columns: 22px 30px minmax(0, 1fr) auto; }

/* Phone: the result's single column may shrink below its widest line, so nothing is cut off at the right */
.gm-result { grid-template-columns: minmax(0, 1fr); min-width: 0; } .gm-result > * { min-width: 0; }
.gm-actions { flex-wrap: wrap; } .gm-actions .btn { white-space: normal; text-align: center; }
.gm-res .who, .gm-learn { overflow-wrap: anywhere; }

/* How to play, the animation switch, the balance chart on the result */
.gm-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gm.still *, .gm.still *::before, .gm.still *::after { animation: none !important; transition: none !important; } .gm.still .gm-confetti { display: none; }
.gm-tour { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg-2) 72%, transparent); backdrop-filter: blur(3px); border-radius: inherit; }
.gm { position: relative; }
.gm-tour-card { width: min(380px, 100%); display: grid; gap: 8px; padding: 18px; border-radius: 16px; background: var(--sticky); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); color: var(--ink); text-align: center; }
.gm-tour-card .ic { font-size: 34px; line-height: 1; } .gm-tour-card h3 { margin: 0; font-size: 18px; } .gm-tour-card p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.gm-tour-card .dots { display: flex; gap: 6px; justify-content: center; } .gm-tour-card .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); } .gm-tour-card .dots i.on { background: var(--accent); }
.gm-tour-card .act { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.gm-hist { display: grid; gap: 2px; }
.gm-hist svg { width: 100%; height: auto; display: block; overflow: visible; }
.gm-hist .ax { stroke: var(--line-2); stroke-width: 1; } .gm-hist .cr { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.gm-hist .ln { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; } .gm-hist .ln.bot { stroke: var(--ink-3); opacity: .8; } .gm-hist .ln.you { stroke: var(--accent); stroke-width: 2.6; }
.gm-hist text { fill: var(--ink-3); font: 9px var(--mono); }
.gm-hkey { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; font-size: 11px; color: var(--ink-2); } .gm-hkey .you { font-weight: 700; color: var(--ink); } .gm-hkey .cr { color: var(--bad); }
a.btn#gmPlanner { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.gm-sq.crash b { font-size: clamp(5px, 1.3cqw, 9px); }
.gm-tour { place-items: start center; } .gm-tour-card { position: sticky; top: 110px; margin-top: 60px; }
