/* Rat Race Royale — bright blue, playful, calm */
:root {
  --bg: #061433; --bg-2: #0b1f4d; --bg-3: #13306b; --bg-4: #1b3f88;
  --line: rgba(140, 185, 255, 0.16); --glass: rgba(16, 40, 96, 0.72);
  --text: #eef5ff; --muted: #9fb6dd;
  --blue: #2f7bff; --cyan: #22d3ee; --sky: #7cc4ff; --mint: #2ee59d; --mint-ink: #032b1c;
  --pink: #ff5fa2; --yellow: #ffd23f; --red: #ff5d6c; --violet: #8b7bff;
  --grad: linear-gradient(135deg, #2f7bff 0%, #22d3ee 100%);
  --radius: 18px; --shadow: 0 24px 60px -24px rgba(0, 8, 40, 0.9);
  --display: "Outfit", system-ui, sans-serif; --body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.5 var(--body); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(34, 211, 238, 0.22), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(47, 123, 255, 0.28), transparent 60%),
    radial-gradient(700px 500px at 50% 120%, rgba(139, 123, 255, 0.22), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.08; margin: 0; }
button, input, select { font: inherit; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.pos { color: var(--mint); } .neg { color: var(--red); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 11px 18px; font-weight: 700; cursor: pointer; color: var(--text); background: var(--bg-3); transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn--accent { background: var(--grad); color: #fff; box-shadow: 0 10px 28px -10px rgba(47, 123, 255, .9); }
.btn--accent:hover:not(:disabled) { box-shadow: 0 14px 34px -10px rgba(34, 211, 238, .95); }
.btn--pink { background: var(--pink); color: #fff; box-shadow: 0 10px 24px -12px rgba(255, 95, 162, .9); }
.btn--ghost { background: rgba(255, 255, 255, .04); border-color: var(--line); }
.btn--glass { background: var(--glass); border-color: var(--line); backdrop-filter: blur(10px); }
.btn--danger { background: rgba(255, 93, 108, .14); color: #ff8b96; border-color: rgba(255, 93, 108, .35); }
.btn--sm { padding: 7px 13px; font-size: .84rem; }
.btn--xs { padding: 3px 9px; font-size: .74rem; }
.btn--big { padding: 14px 26px; font-size: 1.05rem; }
.btn--icon { width: 42px; height: 42px; padding: 0; font-size: 1.05rem; }
.btn--block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.field input, .field select, input.inp { background: rgba(3, 10, 30, .55); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--text); font-weight: 500; min-width: 0; }
.field input:focus, .field select:focus, input.inp:focus { outline: 2px solid var(--cyan); outline-offset: -1px; }
input.inp--sm { padding: 5px 8px; width: 92px; border-radius: 9px; font-size: .84rem; }

/* ---------- top bar + race strip */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: rgba(6, 20, 51, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; }
.logo__mark { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; font-size: 1.15rem; box-shadow: 0 8px 20px -8px rgba(34, 211, 238, .9); }
.logo__text { font-family: var(--display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; white-space: nowrap; }
.logo__text em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar__nav { display: flex; gap: 8px; flex: none; }
.race { flex: 1; display: flex; gap: 8px; justify-content: center; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.race::-webkit-scrollbar { display: none; }
.racer { flex: 0 1 190px; min-width: 132px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; padding: 6px 10px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-align: left; transition: border-color .2s, background .2s; }
.racer:hover { background: rgba(255, 255, 255, .08); }
.racer.is-turn { border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc), 0 0 22px -6px var(--pc); }
.racer .dot { grid-row: span 2; }
.racer b { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.racer small { grid-column: 2; font-size: .68rem; color: var(--muted); white-space: nowrap; }
.racer .progress { grid-column: 1 / -1; height: 6px; margin-top: 3px; }
.topinfo { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 8px 12px 0; font-size: .8rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); color: var(--text); white-space: nowrap; }
.chip b { color: var(--cyan); letter-spacing: .08em; }
.chip--hot { color: var(--red); border-color: var(--red); animation: pulse 1s infinite; }

/* ---------- lobby */
.screen { padding: 26px 20px 40px; max-width: 1240px; margin: 0 auto; }
.hero { max-width: 780px; margin: 22px 0 28px; }
.eyebrow { color: var(--cyan); font-weight: 700; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; margin: 0 0 10px; }
.hero h1 { font-size: clamp(3rem, 9vw, 6rem); font-weight: 800; letter-spacing: -0.04em; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 16px 0 0; max-width: 60ch; }
.lead strong { color: var(--text); }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode, .panel { background: linear-gradient(180deg, rgba(19, 48, 107, .55), rgba(11, 31, 77, .55)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(8px); }
.mode { display: flex; flex-direction: column; gap: 12px; }
.mode h2 { font-size: 1.3rem; }
.mode p { margin: 0; }
.names { display: grid; gap: 8px; }
.names .row input { flex: 1; }
.hostlobby { border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 10px; }
.code { font-family: var(--display); font-size: 2.1rem; font-weight: 800; letter-spacing: .2em; text-align: center; background: rgba(3, 10, 30, .55); border-radius: 14px; padding: 8px; color: var(--cyan); }
.status { margin: 0; color: var(--yellow); font-size: .88rem; min-height: 1.2em; }
.footnote { color: var(--muted); font-size: .8rem; margin-top: 22px; }
.saves { margin-bottom: 16px; display: grid; gap: 12px; padding: 18px; }
.savelist { display: grid; gap: 8px; }
.saverow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3, 10, 30, .45); }
.saverow small { display: block; }

/* ---------- game layout: rail | board (center) ; drawer slides over */
.game { position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 16px; padding: 10px 18px 0; max-width: 1500px; margin: 0 auto; }
.rail { position: sticky; top: 76px; align-self: start; display: flex; flex-direction: column; gap: 6px; padding: 8px 6px; border-radius: 22px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 20; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 14px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; transition: background .2s, transform .15s; }
.rail button span { font-size: 1.35rem; line-height: 1; }
.rail button small { font-size: .66rem; color: var(--muted); font-weight: 600; }
.rail button:hover { background: rgba(255, 255, 255, .07); transform: translateX(2px); }
.rail button.is-on { background: rgba(47, 123, 255, .28); border-color: rgba(124, 196, 255, .4); }
.rail button.is-on small { color: var(--text); }

.drawer { position: absolute; left: 112px; top: 10px; z-index: 25; width: min(400px, calc(100% - 130px)); max-height: calc(100vh - 210px); overflow: auto; padding: 18px; border-radius: 22px; background: rgba(9, 27, 70, .96); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(14px); animation: slidein .25s ease both; }
@keyframes slidein { from { opacity: 0; transform: translateX(-14px); } }
.drawer__close { position: sticky; top: 0; float: right; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--bg-3); color: var(--text); font-size: 1.2rem; cursor: pointer; z-index: 2; }
.pane { display: none; }
.pane.is-on { display: block; }
.pane h3 { font-size: 1.1rem; margin-bottom: 12px; }

.center { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.boardwrap { position: relative; width: min(100%, calc(100vh - 300px)); min-width: 300px; flex: none; }
.board { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; padding: 8px; aspect-ratio: 1; border-radius: 26px; background: linear-gradient(160deg, rgba(27, 63, 136, .7), rgba(9, 27, 70, .8)); border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .08); }
.board--fast { grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); background: linear-gradient(160deg, rgba(139, 123, 255, .45), rgba(9, 27, 70, .85)); }
.tile { position: relative; border-radius: 11px; background: color-mix(in srgb, var(--c) 22%, #0a1d47); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2px; min-width: 0; overflow: hidden; transition: transform .2s; }
.tile:hover { transform: scale(1.04); z-index: 1; }
.tile__icon { font-size: clamp(.9rem, 2.2vw, 1.55rem); line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.tile__name { font-size: clamp(.42rem, .8vw, .62rem); color: #cfe0ff; font-weight: 600; line-height: 1.1; margin-top: 3px; }
.tile.is-current { outline: 2px solid var(--yellow); outline-offset: 1px; animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px 2px rgba(255, 210, 63, .55); } }
.hub { grid-column: 2 / 7; grid-row: 2 / 7; border-radius: 18px; border: 1px dashed var(--line); background: rgba(6, 20, 51, .55); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 16px; }
.hub h3 { font-size: clamp(1.1rem, 3vw, 2rem); }
.tokens { position: absolute; inset: auto 2px 2px 2px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.token { width: clamp(11px, 1.7vw, 17px); height: clamp(11px, 1.7vw, 17px); border-radius: 50%; background: var(--pc); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); font-size: 0; }
.token.is-turn { animation: bob .9s infinite ease-in-out; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.dice { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; display: flex; gap: 12px; z-index: 8; }
.die { width: 70px; height: 70px; border-radius: 18px; background: linear-gradient(160deg, #fff, #dbe8ff); color: #0b1f4d; font: 800 2.2rem var(--display); display: grid; place-items: center; box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .7); animation: roll .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.die:nth-child(2) { animation-delay: .08s; }
@keyframes roll { from { transform: translateY(-40px) rotate(-200deg) scale(.4); opacity: 0; } }

.peek { min-height: 38px; display: flex; justify-content: center; width: min(100%, 760px); }
.peek p { margin: 0; padding: 7px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: .86rem; text-align: center; box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc, var(--cyan)) 35%, transparent); animation: peekin .4s ease both; max-width: 100%; }
@keyframes peekin { from { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* card stage: cards appear in the middle of the board */
.stage { position: absolute; inset: 6%; display: grid; place-items: center; z-index: 6; pointer-events: none; }
.stage > * { pointer-events: auto; width: min(100%, 470px); max-height: 100%; overflow: auto; animation: deal .4s cubic-bezier(.2, 1.2, .4, 1) both; }
.stage:has(.report) > * { width: min(100%, 640px); }
@keyframes deal { from { transform: translateY(26px) rotate(-2deg) scale(.92); opacity: 0; } }

/* ---------- cards */
.card { background: linear-gradient(170deg, #12306e, #0a1f4f); border: 1px solid rgba(124, 196, 255, .28); border-radius: 20px; padding: 18px; box-shadow: 0 34px 80px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .1); }
.card__kicker { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--cyan); margin: 0 0 6px; }
.card h4 { font: 800 1.35rem var(--display); margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card p.story { margin: 0 0 12px; color: var(--muted); font-style: italic; }
.card--dream { border-color: var(--pink); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: .9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choose button { text-align: left; border-radius: 16px; padding: 16px; border: 1px solid var(--line); background: rgba(3, 10, 30, .4); color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform .15s, border-color .2s; }
.choose button:hover { border-color: var(--cyan); transform: translateY(-3px); }
.choose b { font-family: var(--display); font-size: 1.15rem; }
.choose span { color: var(--muted); font-size: .82rem; }
.qty { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.qty input { width: 110px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn { flex: 1; min-width: 110px; }
.rbar { position: relative; display: inline-block; width: 70px; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--mint), var(--yellow), var(--red)); vertical-align: middle; }
.rbar i { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1px; background: #fff; border-radius: 2px; }
.dreams { display: grid; gap: 8px; }
.dream { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; text-align: left; background: rgba(3, 10, 30, .4); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--text); cursor: pointer; transition: transform .15s; }
.dream:hover { transform: translateX(3px); }
.dream.is-on { border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink), 0 0 24px -8px var(--pink); }
.dream span { font-size: 1.4rem; }
.dream small { color: var(--muted); }

/* ---------- money panel bits */
.progress { height: 12px; border-radius: 999px; background: rgba(3, 10, 30, .6); overflow: hidden; border: 1px solid var(--line); }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan), var(--mint)); border-radius: 999px; transition: width .8s cubic-bezier(.2, 1, .3, 1); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.stat { background: rgba(3, 10, 30, .45); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; }
.stat small { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; }
.stat b { font-family: var(--display); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.timeline { display: grid; gap: 6px; margin: 12px 0; font-size: .84rem; }
.timeline div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 12px; background: rgba(3, 10, 30, .35); }
.timeline span { color: var(--muted); }
.lifechips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.lifechips span { font-size: .76rem; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.k401 { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--text); padding: 5px 10px; cursor: pointer; font-size: .8rem; }
.seg button.is-on { background: var(--grad); color: #fff; font-weight: 800; }
.seg button:disabled { cursor: default; }
.seg button:disabled:not(.is-on) { opacity: .5; }
.badges { font-size: .9rem; letter-spacing: 1px; }
.badge { font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.badge--off { color: var(--red); }
.badge--fast { background: rgba(255, 95, 162, .2); color: var(--pink); }
.credit { margin-top: 12px; font-size: .84rem; display: grid; gap: 8px; }
.credit--big { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(3, 10, 30, .45); }
.credit__score { font-family: var(--display); font-size: 1.5rem; color: var(--cc); }
.credit__tier { font-size: .72rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; color: #061433; background: var(--cc); }
.credit__bar { position: relative; height: 7px; border-radius: 999px; background: linear-gradient(90deg, #ff5d6c 0%, #ff9f43 40%, #ffd23f 60%, #9be564 80%, #2ee59d 100%); }
.credit__bar i { position: absolute; top: -4px; width: 4px; height: 15px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 2px var(--bg); transition: left .8s ease; }
.credit__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .76rem; }
.howto { padding-left: 18px; color: var(--muted); font-size: .84rem; display: grid; gap: 6px; }
.howto b { color: var(--text); }
.spark { display: block; overflow: visible; }

/* players + feed + market + fast */
.plist { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 11px; border-radius: 14px; background: rgba(3, 10, 30, .4); border: 1px solid transparent; cursor: pointer; text-align: left; color: var(--text); width: 100%; }
.prow:hover { border-color: var(--line); }
.prow.is-turn { border-color: var(--pc); }
.prow small { color: var(--muted); display: block; font-size: .75rem; }
.prow .progress { height: 6px; margin-top: 4px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--pc); flex: none; box-shadow: 0 0 12px var(--pc); display: inline-block; }
.log { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.log.is-on { display: flex; }
.log:not(.is-on) { display: none; }
.log p { margin: 0; padding: 7px 11px; border-radius: 12px; background: rgba(3, 10, 30, .4); border-left: 3px solid var(--pc, var(--line)); }
.log p.narrator { background: rgba(255, 95, 162, .09); }
.log p.econ { border-left-color: var(--yellow); }
.log p.warn { color: var(--yellow); }
.log p.good, .log p.credit { color: var(--mint); }
.log p.tip { border-left-color: var(--cyan); background: rgba(34, 211, 238, .08); }
.ticks { display: grid; gap: 4px; }
.tick { display: grid; grid-template-columns: 1fr auto auto 58px; gap: 8px; align-items: center; font-size: .8rem; padding: 4px 6px; border-radius: 10px; }
.tick.is-live { background: rgba(255, 210, 63, .14); }
.tick__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick small { text-align: right; }
.fastboard { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 10px; }
.fastboard.is-locked { opacity: .45; filter: grayscale(.5); }
.ftile { position: relative; aspect-ratio: 1; border-radius: 9px; background: color-mix(in srgb, var(--c) 22%, var(--bg)); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); display: grid; place-items: center; font-size: 1rem; }
.ftile.is-current { outline: 2px solid var(--yellow); }
.ftile .token { position: absolute; bottom: 1px; width: 10px; height: 10px; }
.fastme { display: grid; gap: 6px; font-size: .86rem; margin-top: 10px; }

/* report card */
.winner { text-align: center; padding: 6px 0 2px; }
.winner h3 { font-size: 1.9rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 4px; }
.report { display: grid; gap: 10px; margin: 12px 0; }
.rc { border: 1px solid var(--line); border-left: 4px solid var(--pc); border-radius: 14px; padding: 10px 12px; background: rgba(3, 10, 30, .4); }
.rc .dot { width: 10px; height: 10px; }
.rc__stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); margin: 6px 0; }
.rc__stats b { color: var(--text); }
.rc__stats b.pos { color: var(--mint); } .rc__stats b.neg { color: var(--red); }
.rc__badges { display: flex; flex-wrap: wrap; gap: 6px; font-size: .78rem; }
.rc__badges span { background: var(--bg-3); border-radius: 999px; padding: 2px 8px; }
.rc__lesson { margin: 8px 0 0; font-size: .84rem; }

/* ---------- bottom dock */
body.in-game { padding-bottom: 104px; }
.dock { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 30; width: min(820px, calc(100% - 24px)); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 24px; background: rgba(11, 31, 77, .9); backdrop-filter: blur(16px); border: 1px solid rgba(124, 196, 255, .25); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .9), 0 0 0 1px rgba(47, 123, 255, .15); }
.dock__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dock__who b { display: block; font-family: var(--display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__who small { display: block; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock__cash { text-align: right; line-height: 1.1; }
.dock__cash small { display: block; color: var(--muted); font-size: .7rem; font-weight: 600; }
.dock__cash b { font-family: var(--display); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.dock__btns { display: flex; align-items: center; gap: 8px; flex: none; }
.waiting { color: var(--muted); font-size: .9rem; }

/* ---------- fx: confetti + floating money */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.fx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.float { position: absolute; font: 800 1.35rem var(--display); text-shadow: 0 4px 18px rgba(0, 0, 0, .6); animation: floatup 1.6s ease-out both; white-space: nowrap; }
.float.pos { color: var(--mint); } .float.neg { color: var(--red); }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 100% { opacity: 0; transform: translate(-50%, -90px) scale(1); } }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- dialogs */
.modal { border: 0; padding: 0; border-radius: 24px; background: linear-gradient(180deg, #0f2a64, #0a1f4f); color: var(--text); width: min(560px, 100% - 24px); max-height: calc(100vh - 24px); box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal--wide { width: min(1000px, 100% - 24px); }
.modal::backdrop { background: rgba(2, 8, 25, .7); backdrop-filter: blur(5px); }
.modal[open] { animation: deal .35s cubic-bezier(.2, 1.2, .4, 1) both; }
.modal__inner { padding: 24px; position: relative; }
.modal__close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg-3); color: var(--text); font-size: 1.3rem; cursor: pointer; z-index: 2; }
.rules ol { padding-left: 1.2rem; display: grid; gap: 8px; }
.advice { padding-left: 18px; display: grid; gap: 8px; }
.fs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.fs section { background: rgba(3, 10, 30, .42); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.fs h4 { margin: 0 0 2px; font-size: 1.05rem; }
.fs h4 + p { margin: 0 0 8px; color: var(--muted); font-size: .76rem; }
.fs table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.fs td { padding: 4px 0; vertical-align: middle; }
.fs td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs tr.total td { border-top: 1px dashed var(--line); font-weight: 800; padding-top: 6px; }
.fs .sub { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; padding-top: 8px; }
.debtctl { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 6px; }
.fs-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding-right: 44px; }
.escape { background: rgba(3, 10, 30, .42); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 14px; }
.escape .row { justify-content: space-between; font-size: .9rem; margin-bottom: 8px; }
.loanbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.loanbox input { width: 110px; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: var(--bg-3); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 70; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* folds (used inside panes) */
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fold > summary::-webkit-details-marker { display: none; }
.fold__hint { font-size: .78rem; flex: 1; min-width: 0; }
.fold__chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.fold[open] > summary .fold__chev { transform: rotate(180deg); }
.fold__body { padding-top: 8px; }

.sitefoot { text-align: center; color: var(--text); font-size: .84rem; padding: 18px 16px 24px; border-top: 1px solid var(--line); margin-top: 24px; }
.sitefoot b { font-family: var(--display); }
body.in-game .sitefoot { padding-bottom: 120px; }

/* ---------- responsive */
@media (max-width: 1000px) {
  .modes { grid-template-columns: 1fr; }
  .fs { grid-template-columns: 1fr; }
  .race { justify-content: flex-start; }
}
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; padding: 8px 12px; }
  .race { order: 3; flex-basis: 100%; }
  .topbar__nav { margin-left: auto; }
  body.in-game #coachBtn { display: none !important; }
  .game { grid-template-columns: 1fr; padding: 8px 10px 0; }
  .rail { position: fixed; top: auto; bottom: 92px; left: 50%; transform: translateX(-50%); flex-direction: row; overflow-x: auto; max-width: calc(100% - 20px); padding: 4px; border-radius: 18px; }
  .rail button { padding: 6px 8px; }
  .rail button:hover { transform: none; }
  .rail button span { font-size: 1.1rem; }
  .drawer { position: fixed; left: 10px; right: 10px; top: auto; bottom: 156px; width: auto; max-height: 62vh; }
  .boardwrap { width: 100%; }
  .stage { position: fixed; inset: auto 10px 156px 10px; max-height: 64vh; place-items: end center; }
  body.in-game { padding-bottom: 170px; }
  body.in-game .sitefoot { padding-bottom: 180px; }
}
@media (max-width: 520px) {
  .logo__text { font-size: 1.05rem; }
  .screen { padding: 18px 12px 32px; }
  .board { gap: 3px; padding: 5px; border-radius: 18px; }
  .dock { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 8px 8px 12px; bottom: 8px; }
  .dock__cash { display: none; }
  .dock__who small { display: none; }
  .btn--big { padding: 12px 16px; }
  .die { width: 54px; height: 54px; font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.rail { scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }

.dock__job { color: var(--text) !important; font-weight: 600; }
.jobcard { margin: 12px 0 0; padding: 11px 13px; border-radius: 14px; background: linear-gradient(135deg, rgba(47, 123, 255, .25), rgba(34, 211, 238, .12)); border: 1px solid rgba(124, 196, 255, .3); display: grid; gap: 2px; }
.jobcard small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.jobcard b { font-family: var(--display); font-size: 1.15rem; }
.jobcard span { font-size: .82rem; color: #cfe0ff; }

/* ---- the arena: the Fast Track ring (40 tiles, 11×11 edge) around the rat race board (9×9 middle) */
.arena { position: relative; width: min(100%, calc(100vh - 290px)); min-width: 300px; aspect-ratio: 1; display: grid; grid-template-columns: repeat(11, 1fr); grid-template-rows: repeat(11, 1fr); gap: 4px; padding: 10px; border-radius: 34px;
  background:
    radial-gradient(80% 80% at 50% 50%, rgba(6, 20, 51, .0) 55%, rgba(139, 123, 255, .16) 100%),
    linear-gradient(135deg, rgba(139, 123, 255, .35), rgba(255, 95, 162, .22) 50%, rgba(34, 211, 238, .3));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 0 60px rgba(139, 123, 255, .25); }
.ring { display: contents; }
.arena > .boardwrap { grid-row: 2 / 11; grid-column: 2 / 11; width: auto; min-width: 0; margin: 4px; }
.arena > .boardwrap .board { width: 100%; height: 100%; gap: 3px; padding: 6px; border-radius: 22px; aspect-ratio: auto; }
.arena.no-ring { grid-template-columns: 1fr; grid-template-rows: 1fr; background: none; box-shadow: none; padding: 0; }
.arena.no-ring > .boardwrap { grid-row: 1; grid-column: 1; margin: 0; }
.arena.no-ring > .boardwrap .board { gap: 5px; padding: 8px; border-radius: 26px; }
.arena .tile { border-radius: 9px; }
.arena .tile__name { font-size: clamp(.38rem, .7vw, .56rem); }
.arena .tile__icon { font-size: clamp(.8rem, 1.8vw, 1.3rem); }

.rtile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0; overflow: hidden; border-radius: 10px;
  background: linear-gradient(160deg, rgba(139, 123, 255, .38), rgba(25, 20, 70, .85)); border: 1px solid rgba(190, 175, 255, .35); transition: transform .2s, filter .3s; }
.rtile:hover { transform: scale(1.08); z-index: 3; }
.rtile__icon { font-size: clamp(.8rem, 1.9vw, 1.35rem); line-height: 1; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4)); }
.rtile__name { font-size: clamp(.38rem, .72vw, .6rem); font-weight: 800; color: #f1ecff; margin-top: 2px; line-height: 1; letter-spacing: .01em; }
.rtile--dream { background: linear-gradient(160deg, rgba(255, 95, 162, .55), rgba(110, 30, 90, .85)); border-color: rgba(255, 150, 200, .55); }
.rtile--dream .rtile__name { color: #ffe1f0; }
.rtile--payout { background: linear-gradient(160deg, rgba(255, 210, 63, .6), rgba(120, 85, 10, .85)); border-color: rgba(255, 220, 120, .7); }
.rtile--deal { background: linear-gradient(160deg, rgba(47, 123, 255, .6), rgba(10, 40, 110, .85)); border-color: rgba(124, 196, 255, .6); }
.rtile--hazard { background: linear-gradient(160deg, rgba(255, 93, 108, .5), rgba(90, 15, 30, .85)); border-color: rgba(255, 140, 150, .55); }
.rtile.is-fav { box-shadow: inset 0 0 0 2px var(--yellow), 0 0 14px -2px rgba(255, 210, 63, .7); }
.rtile.is-fav::after { content: "★"; position: absolute; top: 1px; right: 3px; font-size: .55rem; color: var(--yellow); }
.rtile.is-current { outline: 2px solid #fff; outline-offset: 1px; animation: glow 1.4s ease-in-out infinite; z-index: 2; }
.rtile.corner-tl { border-top-left-radius: 50%; } .rtile.corner-tr { border-top-right-radius: 50%; }
.rtile.corner-bl { border-bottom-left-radius: 50%; } .rtile.corner-br { border-bottom-right-radius: 50%; }
.rtile .token { width: clamp(9px, 1.4vw, 14px); height: clamp(9px, 1.4vw, 14px); }

.arena.ring-locked .rtile { filter: saturate(.45) brightness(.75); }
.arena.ring-locked .rtile:hover { filter: none; }
.arena.ring-active { box-shadow: var(--shadow), inset 0 0 0 2px rgba(255, 210, 63, .6), 0 0 50px -8px rgba(255, 95, 162, .6); }
.arena.ring-active > .boardwrap { opacity: .72; }
.arena.rat-active > .boardwrap .board { box-shadow: 0 0 0 2px rgba(124, 196, 255, .45), 0 0 34px -8px rgba(34, 211, 238, .6); }
.arena > .dice { z-index: 8; }
.arena > .stage { inset: 14%; }
@media (max-width: 820px) {
  .arena { width: 100%; padding: 6px; gap: 2px; border-radius: 22px; }
  .arena > .boardwrap { margin: 2px; }
  .rtile__name, .arena .tile__name { display: none; }
  .arena > .stage { inset: auto 10px 156px 10px; }
}
