/* Finanza · Khel ON */
:root {
  --navy: #141721; --navy2: #1c2030; --navy3: #252a3d; --line: #333950;
  --ink: #f5f2ea; --muted: #a9aec2;
  --orange: #ff9a3c; --pink: #f04fa8; --purple: #8b5cf6; --teal: #2fd4c8; --green: #4ade80; --gold: #ffcf4a; --red: #ff6b6b;
  --grad: linear-gradient(90deg, #ff9a3c, #f04fa8 55%, #8b5cf6);
  --invest: #2fd4c8; --innovate: #8b5cf6; --educate: #ff9a3c; --enjoy: #f04fa8; --meditate: #4ade80; --startc: #ffcf4a;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: var(--ink); }
body { font-family: Nunito, system-ui, sans-serif; font-size: 16px; line-height: 1.45; min-height: 100vh; overflow-x: hidden;
  cursor: default; -webkit-user-select: none; user-select: none; caret-color: transparent; -webkit-tap-highlight-color: transparent; }
button:disabled, button:disabled * { cursor: default; }
summary { cursor: pointer; }
h1, h2, h3, .fz, button { font-family: Outfit, Nunito, system-ui, sans-serif; }
button { cursor: pointer; font: inherit; font-family: Outfit, Nunito, system-ui, sans-serif; color: inherit; }
[hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(20,23,33,.94); z-index: 5; }
.back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: #d8d7ee; font: 800 15px Nunito, system-ui, sans-serif; padding: 8px 12px 8px 4px; border-radius: 12px; min-height: 40px; flex: none; }
.back svg { width: 20px; height: 20px; }
@media (hover: hover) { .back:hover { color: #fff; background: rgba(255,255,255,.06); } .icon:hover { border-color: var(--teal); } }
.top h1 { margin: 0; flex: 1; font-size: 22px; line-height: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.top h1 small { font-family: Nunito, sans-serif; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin-top: 3px; }
.fz { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; letter-spacing: -.01em; }
.tools { display: flex; align-items: center; gap: 6px; }
.icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--navy2); font-weight: 800; }
.starcount { color: var(--gold); font-weight: 800; font-family: Outfit, sans-serif; white-space: nowrap; }

main { max-width: 1100px; margin: 0 auto; padding: 14px 16px 40px; }
/* the front door and settings step sit over the page; sheets opened from them (How to play, Badges) go on top */
html.kl-open .sheet, html.ks-open .sheet { z-index: 2147482950; }
html.kl-open .toast, html.ks-open .toast { z-index: 2147482960; }

.hint { color: var(--muted); font-size: 14px; margin: 8px 0; }
.start { display: block; width: 100%; margin: 18px 0 0; padding: 15px; border: 0; border-radius: 16px; background: var(--grad); color: #fff; font-size: 19px; font-weight: 800; box-shadow: 0 6px 22px rgba(240,79,168,.3); }
.row .start { margin: 0; }
.ghost { padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: transparent; font-weight: 700; }

/* play */
.play { display: grid; gap: 16px; }
.boardwrap { position: relative; width: 100%; max-width: 560px; margin: 0 auto; aspect-ratio: 1; container-type: inline-size; }
/* desktop: the board fills the height of the screen, the panel sits beside it */
@media (min-width: 900px) {
  main { max-width: none; padding: 14px 24px 16px; }
  :root { --b: min(calc(100vh - 92px), calc(100vw - 48px - 24px - 400px)); --sw: clamp(380px, calc(100vw - 48px - 24px - var(--b)), 520px); }
  .play { grid-template-columns: var(--b) var(--sw); justify-content: center; align-items: start; gap: 24px; }
  /* the square's card opens over the middle of the board, so the money panel stays readable beside it */
  #card { justify-content: flex-start; padding-left: max(10px, calc((100vw - var(--b) - 24px - var(--sw)) / 2 + var(--b) / 2 - min(260px, var(--b) * .42))); background: rgba(8,10,16,.5); }
  body.online-table { --b: min(calc(100vh - 140px), calc(100vw - 48px - 24px - 400px)); } /* room for the online pill under the board */
  #card .cardui { max-width: min(520px, calc(var(--b) * .84)); max-height: calc(var(--b) * .9); }
  .boardwrap { max-width: none; width: var(--b); }
  .side { max-height: calc(100vh - 92px); overflow: auto; overscroll-behavior: contain; padding: 2px; }
  .pcard { padding: 12px 14px; }
  .pcard h4 { font-size: 16px; }
  .nw { font-size: 22px; }
  .pcard dl { font-size: 14px; }
  .mbtns button { padding: 12px 8px; font-size: 15px; }
  .cardui { max-width: 520px; }
}
#board { display: block; width: 100%; height: 100%; }
#board .tile { stroke: #141721; stroke-width: 4; }
#board .ico { font-size: 44px; text-anchor: middle; dominant-baseline: central; }
#board .lbl { font: 800 15px Outfit, sans-serif; fill: #141721; text-anchor: middle; }
#board .corner-lbl { font: 800 17px Outfit, sans-serif; }
#board .tokn { stroke: #fff; stroke-width: 5; transition: transform .12s ease; }
#board .tokn.active { stroke: var(--gold); stroke-width: 8; }
@container (max-width: 480px) { #board .lbl { display: none; } #board .ico { font-size: 50px; } }

.centre { position: absolute; inset: 11%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; padding: 6px; }
.cbrand { margin: 0; line-height: 0; }
.cbrand img { display: block; width: clamp(130px, 46cqw, 380px); height: auto; }
.top .fzlogo { display: block; height: 34px; width: auto; }
@media (min-width: 900px) { .top { padding: 0 24px; } .top .fzlogo { height: 38px; } .tools { gap: 8px; } .icon { width: 40px; height: 40px; } }
.cstage { margin: 0; color: var(--muted); font-size: clamp(12px, 3.5cqw, 21px); font-weight: 700; }
.cwho { margin: 2px 0; font: 800 clamp(15px, 4.8cqw, 30px) Outfit, sans-serif; display: flex; align-items: center; gap: 6px; }
.cwho i { width: .75em; height: .75em; border-radius: 50%; display: inline-block; }
.dice { display: flex; gap: clamp(10px, 2.6cqw, 20px); margin: 4px 0; }
.die { width: clamp(34px, 11cqw, 84px); height: clamp(34px, 11cqw, 84px); border-radius: clamp(10px, 2.6cqw, 18px); background: #fff; color: #141721; display: grid; place-items: center; font: 800 clamp(20px, 6.6cqw, 50px) Outfit, sans-serif; box-shadow: 0 3px 0 #b9bdd0; }
.die.spin { animation: spin .35s linear infinite; }
@keyframes spin { 50% { transform: rotate(18deg) scale(.9); } }
.roll { min-height: 44px; padding: clamp(8px, 2.6cqw, 18px) clamp(26px, 9cqw, 66px); border: 0; border-radius: 999px; background: var(--grad); color: #fff; font-size: clamp(16px, 5cqw, 32px); font-weight: 800; box-shadow: 0 5px 18px rgba(240,79,168,.35); }
@media (hover: hover) { .roll:not(:disabled):hover { filter: brightness(1.08); } .opt:hover:not(:disabled), .seat:hover { border-color: var(--teal); } .ghost:hover { border-color: var(--teal); } .mbtns button:hover:not(:disabled) { border-color: var(--teal); } }
.roll:disabled { opacity: .35; box-shadow: none; cursor: default; }
.cstatus { margin: 2px 0 0; font-size: clamp(12px, 3.5cqw, 20px); color: var(--muted); min-height: 2.6em; max-width: 30ch; }

.side { display: grid; gap: 12px; align-content: start; }
.money { background: var(--navy2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.mtitle { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.mbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mbtns button { padding: 10px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--navy3); font-weight: 700; font-size: 14px; }
.mbtns button:disabled { opacity: .35; cursor: default; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pcard { background: var(--navy2); border: 2px solid var(--line); border-radius: 16px; padding: 10px 11px; min-width: 0; }
.pcard.now { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,207,74,.15); }
.pcard h4 { margin: 0 0 4px; font: 800 15px Outfit, sans-serif; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pcard h4 i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pcard .pname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .ptag { flex: none; font: 800 11px Nunito, sans-serif; padding: 2px 7px; border-radius: 999px; background: rgba(47,212,200,.18); color: var(--teal); }
.pcard .ptag.away { background: rgba(255,255,255,.08); color: var(--muted); }
.nw { font: 800 19px Outfit, sans-serif; margin: 0; }
.nw.neg { color: var(--red); }
.pcard dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin: 6px 0 4px; font-size: 13px; }
.pcard dt { color: var(--muted); }
.pcard dd { margin: 0; text-align: right; font-weight: 700; }
.pcard dd.debt { color: var(--red); }
.well { display: flex; gap: 2px; margin-top: 4px; }
.well span { flex: 1; height: 7px; border-radius: 3px; background: var(--navy3); }
.well span.on { background: var(--green); }
.well.low span.on { background: var(--red); }
.pmeta { font-size: 12px; color: var(--muted); margin: 3px 0 0; }
.logbox { background: var(--navy2); border-radius: 14px; padding: 8px 12px; font-size: 13px; }
.logbox summary { cursor: pointer; font-weight: 800; }
.logbox ol { margin: 6px 0 0; padding-left: 28px; max-height: 220px; overflow: auto; color: var(--muted); }
.gamebtns { display: flex; justify-content: flex-end; }

/* sheets */
.sheet { position: fixed; inset: 0; background: rgba(8,10,16,.72); display: flex; align-items: flex-end; justify-content: center; z-index: 20; padding: 10px; }
@media (min-width: 600px) { .sheet { align-items: center; } }
/* the square's card leaves the header free, so Menu, How to play and sound always work (even while a friend is choosing) */
#card { top: 56px; }
.cardui { width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; background: var(--navy2); border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: pop .22s ease-out; }
@keyframes pop { from { transform: translateY(24px) scale(.97); opacity: 0; } }
.band { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #141721; font: 800 16px Outfit, sans-serif; border-radius: 20px 20px 0 0; background: var(--teal); }
.band .bicon { font-size: 22px; }
.band .bwho { margin-left: auto; font-size: 13px; opacity: .8; }
.band.k-invest { background: var(--invest); } .band.k-innovate { background: var(--innovate); color: #fff; }
.band.k-educate { background: var(--educate); } .band.k-enjoy { background: var(--enjoy); color: #fff; }
.band.k-meditate, .band.k-event { background: var(--meditate); } .band.k-start { background: var(--startc); }
.band.k-skip { background: var(--muted); }
.cbody { padding: 14px 16px 16px; }
.cbody h3 { margin: 0 0 8px; font-size: 20px; line-height: 1.25; }
.cbody p { margin: 6px 0; }
.payday { background: rgba(255,207,74,.12); border: 1px solid rgba(255,207,74,.4); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.payday b { color: var(--gold); }
.payday ul { margin: 4px 0 0; padding-left: 18px; }
.big { font: 800 28px Outfit, sans-serif; margin: 6px 0; }
.big.plus { color: var(--green); } .big.minus { color: var(--red); }
.calc { color: var(--muted); font-size: 14px; }
.opts { display: grid; gap: 8px; margin: 8px 0; }
.opt { display: block; width: 100%; text-align: left; padding: 11px 13px; border-radius: 14px; border: 2px solid var(--line); background: var(--navy3); }
.opt:hover:not(:disabled) { border-color: var(--teal); }
.opt:disabled { opacity: .45; cursor: default; }
.opt b { display: block; font-size: 16px; }
.opt small { display: block; color: var(--muted); font-family: Nunito, sans-serif; font-size: 13px; }
.opt .price { float: right; font-weight: 800; color: var(--gold); margin-left: 8px; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 4px; font-weight: 700; }
.quizq { font-weight: 800; font-size: 16px; margin: 4px 0 6px; }
.opt.right { border-color: var(--green); background: rgba(74,222,128,.15); }
.opt.wrong { border-color: var(--red); background: rgba(255,107,107,.12); }
.outcome { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.outcome li { background: var(--navy3); border-radius: 10px; padding: 7px 10px; font-size: 14px; }
.outcome:empty { display: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row > * { flex: 1 1 140px; }
.tip { font-size: 13px; color: var(--teal); margin-top: 8px; }

.wincard .trophy { font-size: 52px; text-align: center; }
.wincard h3 { text-align: center; }
.ranks { padding-left: 22px; margin: 8px 0; }
.ranks li { margin: 6px 0; }
.ranks li small { display: block; color: var(--muted); }
.ranks li.unhappy b { text-decoration: line-through; opacity: .7; }
.lesson { background: rgba(47,212,200,.1); border-radius: 12px; padding: 8px 12px; color: var(--teal); font-size: 14px; }
.winstars { color: var(--gold); font-weight: 800; text-align: center; }

.howlist { list-style: none; padding: 0; display: grid; gap: 8px; }
.howlist li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.howcard { max-width: 620px; }
.sq { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; }
.sq-start { background: var(--startc); } .sq-educate { background: var(--educate); } .sq-innovate { background: var(--innovate); }
.sq-invest { background: var(--invest); } .sq-enjoy { background: var(--enjoy); } .sq-meditate { background: var(--meditate); }
.selllist, .badgelist { list-style: none; padding: 0; display: grid; gap: 8px; }
.badgelist li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--navy3); }
.badgelist li.locked { opacity: .45; filter: grayscale(1); }
.badgelist .bi { font-size: 26px; }
.badgelist small { display: block; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--navy3); border: 1px solid var(--teal); border-radius: 999px; padding: 9px 16px; font-weight: 700; z-index: 30; max-width: 92vw; text-align: center; }
@media (prefers-reduced-motion: reduce) { .die.spin, .cardui { animation: none; } #board .tokn { transition: none; } }

@media (max-width: 420px) {
  .top { gap: 8px; padding: 0 12px; }
  .back { padding-right: 8px; font-size: 14px; }
  .top h1 { font-size: 21px; }
  .top .fzlogo { height: 28px; }
  .top h1 small { font-size: 12px; letter-spacing: 0; white-space: nowrap; }
  .starcount { display: none; }
  .tools { gap: 5px; }
}
@media (max-width: 350px) { .top h1 small { display: none; } }
/* phones: a smaller logo in the middle of the board so the turn, dice, Roll and a 3-line status always fit inside the squares */
@media (max-width: 420px) {
  .cbrand img { width: clamp(100px, 33vw, 150px); }
  .centre { gap: 2px; }
}
@media (max-width: 340px) { .cbrand { display: none; } .dice { margin: 2px 0; } .cwho { margin: 0; } } /* the header already shows the wordmark */

.online-table .cbody { padding-bottom: 56px; }
.online-table main { padding-bottom: 72px; }
