/* Block J4.6: the homepage leaderboard. Noir Deco: midnight navy, antique gold, crimson; emerald / crimson only for the
   amounts; Limelight only for the wordmark, Inter for everything else (tabular numbers). One centred column, 560 px max. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/juego/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/juego/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Limelight'; font-style: normal; font-weight: 400; font-display: swap; src: url('/juego/fonts/limelight-400.woff2') format('woff2'); }
:root {
  --night: #0B0F2A; --night-2: #121838; --ink: #07080F; --gold: #E8C476; --brass: #C9A24B; --crimson: #A3162E; --ivory: #F2EDE4;
  --muted: #B8BCD6; --line: rgba(201, 162, 75, .45); --line-soft: rgba(201, 162, 75, .2); --glass: rgba(18, 24, 56, .82);
  --pos: #7FE0A3; --neg: #FF9DAE; --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom);
  --text: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --display: 'Limelight', Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night); }
body { margin: 0; min-height: 100dvh; font-family: var(--text); font-size: 16px; line-height: 1.45; color: var(--ivory); -webkit-text-size-adjust: 100%;
  background: radial-gradient(120% 60% at 50% -10%, rgba(163, 22, 46, .22), transparent 60%), linear-gradient(180deg, var(--night) 0%, #070A1E 100%); background-attachment: fixed; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.col { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.num, .pnl, .mine-rank, .rank { font-variant-numeric: tabular-nums; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 560px; margin: 0 auto;
  padding: calc(10px + var(--sat)) 16px 10px; background: linear-gradient(180deg, rgba(11, 15, 42, .97) 70%, rgba(11, 15, 42, .88)); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; -webkit-tap-highlight-color: transparent; font-family: var(--display); font-size: 22px; letter-spacing: .1em; line-height: 1.1; text-decoration: none; white-space: nowrap;
  background: linear-gradient(180deg, #f6dfa4 0%, var(--gold) 45%, var(--brass) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; text-decoration: none; border-radius: 999px; }
.chip-face { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--night-2) center / cover no-repeat; flex: 0 0 auto; }
.chip-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.enter { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--ivory); }
.pill-gold { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px;
  color: var(--ink); background: linear-gradient(180deg, #f6dfa4 0%, var(--gold) 50%, var(--brass) 100%); box-shadow: 0 4px 14px rgba(0, 0, 0, .45); }
.pill-gold:active, .pill-line:active, .periods button:active, .row a:active { transform: scale(.97); }
.pill-line { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--gold); font: 600 15px var(--text); cursor: pointer; }

/* tabs */
.tabs { display: flex; max-width: 560px; margin: 0 auto; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.tab { flex: 1 1 0; display: flex; align-items: center; justify-content: center; min-height: 48px; text-decoration: none; font-weight: 600; font-size: 16px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ivory); border-bottom-color: var(--gold); }

/* controls */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 14px; }
.metric { position: relative; display: inline-flex; align-items: center; }
.metric select { appearance: none; -webkit-appearance: none; min-height: 44px; padding: 0 32px 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--night-2); color: var(--ivory); font: 600 15px var(--text); }
.metric .caret { position: absolute; right: 12px; width: 16px; height: 16px; fill: none; stroke: var(--gold); stroke-width: 2; pointer-events: none; }
.periods { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line-soft); background: rgba(7, 8, 15, .5); }
.periods button { min-width: 48px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 14px var(--text); cursor: pointer; }
.periods button[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
@media (max-width: 370px) { .periods button { min-width: 44px; padding: 0 6px; } .metric select { padding: 0 28px 0 12px; } .metric .caret { right: 9px; } }
@media (max-width: 400px) { .wordmark { font-size: 19px; letter-spacing: .08em; } .chip-name { display: none; } .pill-gold { padding: 0 16px; } .top { gap: 6px; } }

/* your rank */
.mine { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); box-shadow: 0 10px 28px rgba(0, 0, 0, .45); margin-bottom: 14px; min-height: 84px; }
.mine-face { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--night-2) center / cover no-repeat; flex: 0 0 auto; }
.mine-mid { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.mine-label { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.mine-rank { font-size: 30px; font-weight: 600; line-height: 1.1; } .mine-rank .hash { color: var(--gold); }
.mine-right { text-align: right; flex: 0 0 auto; }
.mine.out .mine-mid .mine-rank { font-size: 16px; font-weight: 600; } .mine .note { font-size: 15px; font-weight: 600; }

/* rows: the list keeps the skeleton's height (6 rows) so the footer never jumps when the data or the empty state lands */
.list { min-height: 414px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { border-bottom: 1px solid var(--line-soft); }
.row a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 6px 10px 8px; text-decoration: none; border-radius: 10px; }
.row.me a::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--gold); }
.rank { width: 32px; flex: 0 0 32px; display: flex; justify-content: center; font-weight: 600; font-size: 16px; color: var(--muted); }
.medal { width: 30px; height: 34px; color: #07080F; } /* the digit is ink on the metal (currentColor) */
.face { width: 48px; height: 48px; border-radius: 50%; flex: 0 0 48px; object-fit: cover; background: var(--night-2); border: 1px solid var(--line-soft); }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.who b { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 13px; color: var(--muted); }
.pnl { font-weight: 600; font-size: 17px; white-space: nowrap; text-align: right; }
/* block J9.0.1: two lines per row. Line 1 = name + pnl, line 2 = "N partidas · note" across the full width (the "Asumir ›"
   link, when there is one, sits at its right end). Same 68 px row as before; the skeleton rows keep the flex layout. */
.row:not(.sk) a { display: grid; grid-template-columns: 32px 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 0 12px; align-items: center; }
.row:not(.sk) .rank, .row:not(.sk) .face { grid-row: 1 / span 2; }
.row:not(.sk) .who { display: contents; }
.row:not(.sk) .who b { grid-column: 3; grid-row: 1; align-self: end; }
.row:not(.sk) .who .sub-line { grid-column: 3 / span 2; grid-row: 2; align-self: start; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.row:not(.sk) .pnl { grid-column: 4; grid-row: 1; align-self: end; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--ivory); }

/* skeleton */
.row.sk a { pointer-events: none; }
.sk .bar, .sk .face, .sk .rank i { background: linear-gradient(90deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .11), rgba(255, 255, 255, .05)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-color: transparent; }
.sk .bar { display: block; height: 12px; border-radius: 6px; } .sk .rank i { display: block; width: 18px; height: 14px; border-radius: 4px; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty { text-align: center; padding: 28px 0 8px; } .empty p { color: var(--muted); font-size: 16px; margin: 0 0 14px; }
.error { text-align: center; color: var(--neg); }
.link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--gold); font: 600 15px var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* footer */
.foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 24px; padding-bottom: calc(24px + var(--sab)); text-align: center; }
.foot .small { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* install sheet */
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); }
.sheet { position: fixed; left: 50%; bottom: 0; z-index: 31; width: min(100%, 560px); transform: translateX(-50%); padding: 20px 20px calc(20px + var(--sab)); border-radius: 18px 18px 0 0; background: var(--night-2); border: 1px solid var(--line); border-bottom: 0; }
.sheet h2 { margin: 0 0 10px; font-size: 18px; font-weight: 600; }
.sheet p { margin: 0 0 12px; color: var(--ivory); }
.steps { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; } .steps .n { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--gold); color: var(--ink); font-weight: 600; flex: 0 0 auto; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); z-index: 40; transform: translateX(-50%); padding: 12px 18px; border-radius: 12px; background: var(--night-2); border: 1px solid var(--line); font-weight: 600; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sk .bar, .sk .face, .sk .rank i { animation: none; } .pill-gold:active, .pill-line:active, .periods button:active, .row a:active { transform: none; } }
@media (min-width: 900px) { .wordmark { font-size: 26px; } }
/* block J4.6.1: the wordmark press state; embedded over a table (?embed=1) the page has no header of its own */
.wordmark:active { opacity: .8; }
body.embed .top { display: none; } body.embed { background: var(--night); }
/* block J10 "GAME CLOSED": only the closing message and the final table (no play buttons, no tabs) */
body.game-closed > *:not(#closed-screen):not(script) { display: none !important; }
.closed-screen { box-sizing: border-box; min-height: 100dvh; max-width: 640px; margin: 0 auto; padding: calc(32px + var(--sat)) 16px calc(32px + var(--sab)); display: flex; flex-direction: column; align-items: stretch; }
.cl-msg { text-align: center; margin: 8vh 0 36px; }
.cl-msg p { margin: 0 0 14px; font-family: var(--display); font-size: clamp(22px, 6.4vw, 34px); line-height: 1.2; color: var(--gold); letter-spacing: .02em; }
.cl-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.cl-rows { list-style: none; margin: 0; padding: 0; }
.cl-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
.cl-rank { color: var(--muted); font-weight: 600; }
.cl-name { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-amts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cl-pnl { font-weight: 600; font-size: 16px; } .cl-lib { font-size: 15px; font-weight: 600; }
.cl-amts .cl-pnl + .cl-lib { font-size: 13px; font-weight: 500; }
.cl-pnl.pos, .cl-lib.pos { color: var(--pos); } .cl-pnl.neg, .cl-lib.neg { color: var(--neg); } .cl-pnl.zero, .cl-lib.zero { color: var(--muted); }
.cl-back { margin: 24px 0 0; text-align: center; } .cl-back a { color: var(--gold); font-weight: 600; } /* J11 */
/* block J12: the closed banner. Full-bleed (cover) on wide screens; on portrait / narrow screens the whole banner (contain) centered on a dark deco background, so the title is never cropped. */
.closed-banner { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse 80% 50% at 50% 50%, rgba(201, 162, 75, .14), transparent 70%), repeating-linear-gradient(90deg, rgba(232, 196, 118, .045) 0 1px, transparent 1px 44px), linear-gradient(180deg, #0B0F2A 0%, #07080F 100%); }
.closed-banner picture { display: contents; }
.closed-banner img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; }
@media (min-aspect-ratio: 8/5) and (max-aspect-ratio: 2/1) { .closed-banner img { object-fit: cover; object-position: 50% 75%; } } /* wider than 2:1 would crop the dealer's head: whole banner */
html.closed-banner body > *:not(#closed-banner):not(script) { display: none !important; }
html.closed-banner #closed-banner { display: flex !important; }
html.closed-banner, html.closed-banner body { background: #07080F; overflow: hidden; }
