/* ── Mamba shared foundations ─────────────────────────────── */
/* Space Grotesk, self-hosted (no third-party font origin). Variable font,
   weights 300-700; latin + latin-ext subsets via unicode-range. */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/spacegrotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/spacegrotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #A6F511;
  --accent-deep: #6FA800;
  --accent-soft: rgba(166, 245, 17, 0.12);
  --gold: #C9A24B;
  --bg: #070905;
  --bg-raised: #10130c;
  --bg-pill: #161a11;
  --line: #1d2215;
  --line-soft: #141810;
  --fg: #f2f5ec;
  --fg2: #aab3a0;
  --fg3: #6b7361;
  --red: #ff5544;
  --font: "Space Grotesk", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #c4ff4d; }
a.m-btn:hover { color: #0a0c06; }
a.m-btn.ghost:hover { color: var(--fg); }

.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 180ms ease-out, transform 120ms ease-out;
  background: var(--accent);
  color: #0a0c06;
}
.m-btn:hover { filter: brightness(1.08); color: #0a0c06; }
.m-btn:active { transform: translateY(1px); }
.m-btn.ghost {
  background: var(--bg-pill);
  color: var(--fg);
  border: 1px solid var(--line);
}
.m-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Welcome / session-start modal (A5) ──────────────────────────────────
   Single column by default; on short/landscape viewports (phones lock to
   landscape) it becomes two columns so name entry, the how-to steps and the
   Start button are all reachable with no scrolling. */
/* Session popup — redesign per the design handoff (advisor spec). Self-contained
   palette + spacing; the game plays in landscape, so it is a 2-column card by
   default. Jost (UI) / IBM Plex Mono (session id + credit) fall back to the site
   fonts until those woff2 are vendored like Space Grotesk. */
.m-dialog.welcome-dialog {
  --wl-accent: #B7E33B; --wl-card: #14110C;
  --wl-text: #EFEAD8; --wl-body: #A9A288; --wl-muted: #8A8266; --wl-mono: #CFC8AE;
  --wl-b-card: rgba(183,227,59,0.14); --wl-b-input: rgba(207,200,174,0.16);
  --wl-mono-font: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  width: min(920px, calc(100vw - 32px));
  background: var(--wl-card); border: 1px solid var(--wl-b-card);
  border-radius: 16px; padding: 40px 44px;
}
.welcome-overlay { background: rgba(11, 9, 6, 0.92); }
.welcome-cols { display: flex; flex-direction: row; gap: 48px; align-items: stretch; }
.welcome-col { display: flex; flex-direction: column; min-width: 0; }
.welcome-col-a { flex: 1 1 0; gap: 20px; }
.welcome-col-b { flex: 1 1 0; }

/* header row: avatar + session text on one line, text centered against the icon */
.welcome-head { display: flex; align-items: center; gap: 14px; }
.welcome-glyph-wrap { position: relative; display: flex; flex-shrink: 0; }
.welcome-glyph {
  width: 46px; height: 46px; border-radius: 50%; margin: 0;
  background: rgba(183,227,59,0.08); border: 2px solid var(--wl-accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.welcome-glyph-btn { padding: 0; cursor: pointer; position: relative; font: inherit; }
.welcome-glyph-btn:focus-visible { outline: 2px solid var(--wl-accent); outline-offset: 3px; }
.welcome-glyph-edit {
  position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--wl-accent); color: #0a0c06;
  display: flex; align-items: center; justify-content: center; font-size: 10px;
  border: 2px solid var(--wl-card);
}
.welcome-avatar-pop {
  position: absolute; top: calc(100% + 8px); left: 0;
  z-index: 10; display: flex; flex-wrap: wrap; gap: 6px; width: 232px;
  padding: 8px; background: var(--bg-pill); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.55);
}
.welcome-head-txt { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.welcome-session-lbl { font-size: 11px; letter-spacing: 0.16em; color: var(--wl-muted); font-weight: 700; }
.welcome-session-id { font-family: var(--wl-mono-font); font-size: 15px; color: var(--wl-mono); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.welcome-input {
  width: 100%; box-sizing: border-box; padding: 18px 20px; font-size: 15px;
  background: transparent; border: 1px solid var(--wl-b-input); border-radius: 10px;
  color: var(--wl-text); font-family: var(--font); outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.welcome-input::placeholder { color: var(--wl-muted); }
.welcome-input:focus { border-color: var(--wl-accent); box-shadow: 0 0 0 3px rgba(183,227,59,0.15); }

.welcome-escrow {
  background: rgba(183,227,59,0.04); border: 1px solid var(--wl-b-card);
  border-radius: 12px; padding: 24px 28px; text-align: center;
}
.welcome-escrow-lbl { font-size: 11px; letter-spacing: 0.14em; color: var(--wl-accent); font-weight: 700; margin-bottom: 8px; }
.welcome-escrow-val { font-family: var(--wl-mono-font); font-size: 40px; font-weight: 700; color: var(--wl-text); font-variant-numeric: tabular-nums; line-height: 1; }
.welcome-escrow-val span { font-size: 15px; font-weight: 600; color: var(--wl-accent); font-family: var(--font); }
.welcome-escrow-sub { font-size: 12.5px; color: var(--wl-body); margin-top: 10px; line-height: 1.5; }

.welcome-steps { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 18px; text-align: left; }
.welcome-step { display: flex; gap: 12px; font-size: 14px; color: var(--wl-body); line-height: 1.55; }
.welcome-step b { color: var(--wl-text); }
.welcome-step-n { color: var(--wl-accent); font-weight: 700; flex-shrink: 0; }
.welcome-start {
  width: 100%; padding: 20px; margin-top: 28px; font-size: 16px; font-weight: 700;
  background: var(--wl-accent); color: #0a0c06; border: none; border-radius: 12px;
  cursor: pointer; font-family: var(--font); transition: background .12s ease;
}
.welcome-start:hover { background: #C9EF5C; }
.welcome-start:active { background: #A5D22F; }
.welcome-start:focus-visible { outline: 2px solid var(--wl-accent); outline-offset: 3px; }

/* narrow (small landscape phones): stack the columns, tighten spacing */
@media (max-width: 640px) {
  .m-dialog.welcome-dialog { padding: 24px 22px; }
  .welcome-cols { flex-direction: column; gap: 22px; }
  .welcome-col-a { gap: 16px; }
  .welcome-escrow { padding: 18px 20px; }
  .welcome-escrow-val { font-size: 32px; }
  .welcome-steps { gap: 12px; }
  .welcome-step { font-size: 13px; }
  .welcome-start { padding: 15px; margin-top: 18px; }
}

/* A7: preset avatar picker (popover opened from the avatar glyph) */
.welcome-avatar {
  all: unset; cursor: pointer; border-radius: 10px; padding: 3px;
  border: 1px solid transparent; line-height: 0;
}
.welcome-avatar:hover { border-color: var(--line); }
.welcome-avatar.sel { border-color: var(--wl-accent); background: rgba(183,227,59,0.12); }
.welcome-avatar:focus-visible { outline: 2px solid var(--wl-accent); outline-offset: 1px; }

/* Base toast position. Lives in CSS (not the inline style) so the landscape
   media query below can actually override `left` — an inline left:14 would win
   over the media query's left:50% and, combined with translateX(-50%), shove
   the toast half off the left edge (James, 29 Jul 2026). */
.m-toasts {
  position: absolute; top: 12px; left: 14px; z-index: 50;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

/* Mobile (landscape phone, short viewport): the bet notifications otherwise
   stack down the left edge and cover the price line. Show only ONE, single-line
   toast, centred at the top, so it never hides the game. */
@media (max-height: 500px) {
  .m-toasts { top: 8px; left: 50%; right: auto; transform: translateX(-50%); max-width: 84vw; }
  .m-toasts .m-toast:not(:last-child) { display: none; } /* newest only */
  .m-toasts .m-toast-body { display: none; }             /* single line */
  .m-toasts .m-toast-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
