/* Shared chrome for the standalone pages.
 *
 * login, account, history, lobby, owner and dashboard each used to carry their
 * own copy of the palette, the button, the card and the table styles — about
 * 440 lines with the same colours declared five times over. Changing a colour
 * meant changing it in six files, and any of them could drift.
 *
 * The felt is NOT here. public/styles.css owns the table, and its layout is
 * geometry against a curved edge (see CLAUDE.md) — it has different
 * constraints and is better left alone.
 *
 * Loaded BEFORE each page's own <style>, so a page can still override anything
 * here. Where a page's rule differed from the common one, it kept its own.
 */

:root {
  --felt:   #6366f1;
  --rail:   #8b5cf6;
  --ink:    #f8fafc;
  --muted:  #c7d2fe;
  --panel:  rgba(15, 23, 42, .55);
  --good:   #4ade80;
  --bad:    #f87171;
  --gold:   #f2d98c;
  /* login.html called this --danger; kept as an alias so its rules did not all
     have to be rewritten to prove a CSS extraction changed nothing. */
  --danger: #fecaca;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 20px;
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #a78bfa33, transparent 60%),
    linear-gradient(160deg, #1e1b4b, #312e81 45%, #4c1d95);
}

/* Each page sets its own max-width; this is only the centring. */
.wrap { max-width: 900px; margin: 0 auto; }

/* ------------------------------------------------------------------ header */

/* nowrap, deliberately. With flex-wrap the header breaks when the items' BASE
   widths exceed the line — shrinking never gets a chance — so the hamburger
   dropped to a second row on every page with a longer subtitle. Nowrap plus a
   shrinkable text block keeps it on the title row at any width. */
header { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: nowrap; }
/* The title block is the only thing here that may shrink; a flex item's default
   min-width:auto would otherwise refuse to go below its text and overflow. */
header > div { min-width: 0; }
header h1, header small { overflow-wrap: anywhere; }
header small { display: block; color: var(--muted); font-size: 12px; }
h1 { margin: 0; font-size: 19px; }
h2 {
  font-size: 14px; margin: 0 0 14px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--muted);
}

/* The logo, not a lettered tile. public/logo.svg carries its own rounded plate,
   so this only sizes it — a background here would show through behind it. */
.brand-mark { width: auto; height: 42px; flex: none; display: block; }

.spacer { flex: 1; }
/* Wraps rather than overflowing, for the pages that still show buttons inline. */
.nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ hamburger */
/* The felt has its own copy of this in styles.css. It is not shared because
   the two stylesheets do not share a palette — this one is built on --panel /
   --ink / --muted, the felt's on --panel-2 / --txt / --line — so the rules
   would have to be rewritten to be merged, not merely moved. */

.menu-wrap { position: relative; flex: none; }

.hamburger {
  width: 42px; height: 42px; border-radius: 11px; cursor: pointer;
  display: grid; place-content: center; gap: 4px;
  background: #ffffff14; border: 1px solid #ffffff2b;
}
.hamburger:hover { background: #ffffff22; }
.hamburger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
.hamburger[aria-expanded="true"] { border-color: var(--gold); }
.hamburger[aria-expanded="true"] span { background: var(--gold); }

/* Right-aligned: on these pages the hamburger sits where the nav did, on the
   right, so the page keeps its identity — mark and title — on the left. */
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 208px;
  display: flex; flex-direction: column; padding: 6px; border-radius: 12px;
  background: #1b1f3aF2; border: 1px solid #ffffff2b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
.menu[hidden] { display: none; }
.menu-item {
  text-align: left; padding: 11px 12px; border-radius: 8px; cursor: pointer;
  background: transparent; border: 0; color: var(--ink); font: inherit; font-size: 13px;
  text-decoration: none; min-height: 42px; display: flex; align-items: center; width: 100%;
}
.menu-item:hover { background: #ffffff14; color: var(--gold); }
.menu-item[hidden] { display: none; }
.menu-sep { height: 1px; margin: 5px 4px; background: #ffffff22; }

/* ------------------------------------------------------------------ controls */

.btn {
  padding: 8px 13px; border-radius: 9px; border: 1px solid #ffffff2b;
  background: #ffffff14; color: var(--ink); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: #ffffff22; }
.btn.primary { background: linear-gradient(135deg, var(--felt), var(--rail)); border: 0; font-weight: 600; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------ surfaces */

.card {
  background: var(--panel); border: 1px solid #ffffff22; border-radius: 16px;
  padding: 22px; backdrop-filter: blur(10px); margin-bottom: 18px;
}

/* Wide content scrolls inside its own box rather than pushing the page sideways. */
.scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid #ffffff14; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ states */

.dim   { color: var(--muted); }
.ok    { color: var(--good); }
.bad   { color: var(--bad); }
.empty { color: var(--muted); font-size: 13px; }

.msg { margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; display: none; }
.msg.err { display: block; background: #7f1d1d66; border: 1px solid #ef444455; color: #fecaca; }
.msg.ok  { display: block; background: #14532d66; border: 1px solid #22c55e55; color: #bbf7d0; }

[hidden] { display: none !important; }


/* ------------------------------------------------------------------ phones */
/* The felt has its own breakpoint at 900px (styles.css) because it swaps to a
   different layout entirely. These pages only need to get out of their own way,
   so they narrow later and more gently. */

@media (max-width: 560px) {
  body { padding: 16px 12px 28px; }

  header { gap: 10px; margin-bottom: 16px; }
  h1 { font-size: 17px; }
  /* Pages that still show buttons inline drop them to their own row. A page
     with a hamburger must NOT — breaking the line puts the wrap at the left
     edge, and its right-aligned menu then opens off-screen. So the break is on
     .nav itself rather than on the spacer, which both kinds share. */
  .nav { width: 100%; }

  /* 40px is a usable target; the desktop 8px/13px button is not. */
  .btn { padding: 10px 13px; min-height: 40px; display: inline-flex; align-items: center; }
  .menu { min-width: 64vw; }

  .card { padding: 16px 14px; border-radius: 13px; margin-bottom: 14px; }

  /* Wide tables scroll inside their card. The page itself must never scroll
     sideways — that is the difference between "dense" and "broken". */
  .scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 8px; }
}

/* ============================================================ chip stacks ===
   Shared by the battle table (public/match.html) and the O/U felt
   (public/ou-table.html), which is why they are here rather than inline in
   either. The two pages fill them differently and deliberately: the battle game
   breaks an AMOUNT into denominations, while a bet on the O/U felt is already a
   count of one denomination and is drawn as exactly that many chips. The look
   of a chip is the same either way, and that is what this block owns. */
/* THE AMOUNT IS THE CHIPS. A bet is broken into denominations and stacked, so
   a thousand and a hundred are told apart before the numeral is read — the
   stack that is mostly yellow is simply bigger than the one that is not.
   Six denominations, each with its own colour, greedy from the top down:
   1000 yellow, 500 purple, 100 black, 25 green, 5 red, 1 white.

   A pile is capped (see MAX_PER_PILE) and spills sideways into another pile
   rather than growing without limit, which is what a real table does and what
   keeps a 20,000 pot from being a column taller than the felt. */
.piles { display:flex; align-items:flex-end; justify-content:center; gap:3px;
         flex:none; flex-wrap:wrap; max-width:104px; }
.pile  { position:relative; flex:none; width:var(--chip); }
.chip  { position:absolute; left:0; width:var(--chip); height:var(--chip);
         border-radius:50%; background:var(--base);
         box-shadow:0 1px 0 rgba(0,0,0,.55), inset 0 -2px 4px rgba(0,0,0,.45),
                    inset 0 2px 3px rgba(255,255,255,.16); }

/* A BURIED CHIP SHOWS ITS EDGE, NOT ITS FACE. Only the sliver along the
   bottom of each disc is visible under the one above it, and on a real chip
   that sliver is the moulded rim — short vertical dashes, not the six big
   spots of the top surface. Drawing the full face at this size made a stack
   read as a scattered column of dots rather than chips resting on chips. */
.chip::before {
  content:''; position:absolute; inset:0; border-radius:50%;
  background:repeating-linear-gradient(90deg, var(--spot) 0 14%, transparent 14% 33%);
  -webkit-mask:linear-gradient(#000,#000) bottom/100% 38% no-repeat;
          mask:linear-gradient(#000,#000) bottom/100% 38% no-repeat;
  opacity:.9;
}
/* The top chip is the one you see square on, so it gets the real face. */
.chip.top { background:repeating-conic-gradient(from 15deg,
            var(--spot) 0deg 20deg, var(--base) 20deg 60deg); }
.chip.top::before { display:none; }
.chip.top::after {
  content:''; position:absolute; inset:13%; border-radius:50%;
  background:var(--base); border:1px dashed var(--ring);
}

.d1000 { --base:#e2b32c; --spot:#2b2620; --ring:rgba(0,0,0,.22); }
.d500  { --base:#5c2d86; --spot:#f3f1ea; --ring:rgba(255,255,255,.26); }
.d100  { --base:#17181d; --spot:#f3f1ea; --ring:rgba(255,255,255,.22); }
.d25   { --base:#16663f; --spot:#f3f1ea; --ring:rgba(255,255,255,.28); }
.d5    { --base:#b3202c; --spot:#f3f1ea; --ring:rgba(255,255,255,.3); }
.d1    { --base:#f2efe4; --spot:#b3202c; --ring:rgba(0,0,0,.18); }
