/* ==========================================================================
   MM2ROLL — shell stylesheet (design per docs/frame-*.png, tokens per §5)
   ========================================================================== */

:root {
  --bg: #05070f;
  --bg-2: #070b16;
  --panel: #0c1120;
  --panel-2: #0e1428;
  --bubble: #121a2e;
  --line: #1a2138;
  --blue: #2f7bf6;
  --blue-2: #2563eb;
  --blue-text: #4c9aff;
  --gold: #f0a21d;
  --gold-2: #ffb020;
  --green: #35c46f;
  --red: #e14b4b;
  --text: #ffffff;
  --muted: #828ca6;
  --muted-2: #5c6584;

  --r-panel: 12px;
  --r-row: 10px;
  --r-btn: 8px;
  --r-chip: 6px;

  /* tier tints (set per element via --tier) */
  --tier-chroma: #ff4fd8;
  --tier-ancient: #ff3b3b;
  --tier-godly: #ffb020;
  --tier-legendary: #c084fc;
  --tier-rare: #4c9aff;
  --tier-uncommon: #35c46f;
  --tier-common: #8a93b0;
  --tier-vintage: #f97316;
  --tier-unique: #22d3ee;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
}

::selection { background: rgba(47, 123, 246, .45); }

[hidden] { display: none !important; }

img { max-width: 100%; }

button { font-family: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

input {
  font-family: inherit;
  color: var(--text);
}

code { font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace; }

/* thin dark scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1c2440; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #273154; }
* { scrollbar-width: thin; scrollbar-color: #1c2440 transparent; }

/* generic icon sizing */
.ico { width: 18px; height: 18px; fill: currentColor; flex: none; }
.rc  { width: 26px; height: 26px; flex: none; }        /* round coin svg */
.dec { font-style: normal; opacity: .55; }             /* dimmed decimals */

/* ==========================================================================
   APP GRID  —  topbar / (chat | subnav+main | sidenav)
   ========================================================================== */

#app {
  display: grid;
  grid-template-columns: 305px minmax(0, 1fr) 250px;
  grid-template-rows: 88px 46px minmax(0, 1fr);
  height: 100vh;
}

.topbar  { grid-area: 1 / 1 / 2 / 4; }
#chat    { grid-area: 2 / 1 / 4 / 2; }
.subnav  { grid-area: 2 / 2 / 3 / 3; }
#main    { grid-area: 3 / 2 / 4 / 3; overflow-y: auto; }
#sidenav { grid-area: 2 / 3 / 4 / 4; overflow-y: auto; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: var(--r-btn);
  color: #fff;
  transition: filter .15s, transform .08s, box-shadow .15s;
  user-select: none;
  white-space: nowrap;
}
.btn:hover  { filter: brightness(1.13); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }

.btn--blue {
  background: linear-gradient(180deg, #3b86f8, var(--blue-2));
  box-shadow: 0 4px 14px rgba(47, 123, 246, .35);
}
.btn--gold {
  background: linear-gradient(180deg, var(--gold-2), #d88a0e);
  box-shadow: 0 4px 14px rgba(240, 162, 29, .3);
  color: #1a1206;
}
.btn--ghost {
  background: var(--bubble);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn--ghost:hover { color: var(--text); filter: none; background: #1a2440; }
.btn--fair {
  background: #1c2742;
  color: #aac4ff;
  font-size: 12px;
  padding: 9px 16px;
}
.btn--sm   { padding: 6px 20px; font-size: 12px; }
.btn--caps { text-transform: uppercase; letter-spacing: .04em; }

.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-btn);
  background: var(--bubble);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: color .15s, background .15s, transform .08s;
  flex: none;
}
.icon-btn:hover  { color: var(--text); background: #1a2440; }
.icon-btn:active { transform: scale(.94); }

/* subtle keyboard focus */
:focus-visible { outline: 2px solid rgba(76, 154, 255, .6); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* small round-coin filter buttons */
.coin-filter {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  transition: transform .12s, filter .15s;
  opacity: .95;
}
.coin-filter .rc { width: 40px; height: 40px; }
.coin-filter:hover { transform: translateY(-1px); filter: brightness(1.15); }
.coin-filter:active { transform: scale(.94); }
.coin-filter[aria-pressed="true"] { filter: drop-shadow(0 0 10px rgba(76, 154, 255, .8)); }
#filter-t[aria-pressed="true"]   { filter: drop-shadow(0 0 10px rgba(240, 162, 29, .8)); }

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.topbar {
  display: grid;
  /* v5: minmax(0,1fr) lets the center column SHRINK — a 10-digit balance must
     never push the chips into the brand or the user block */
  grid-template-columns: 305px minmax(0, 1fr) auto;
  align-items: center;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding-right: 20px;
  z-index: 20;
}

#brand, .login-brand {
  font-style: italic;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -.5px;
  user-select: none;
  white-space: nowrap;
}
#brand { padding-left: 26px; }
.brand-mm2 { color: #fff; }
.brand-roll {
  background: linear-gradient(105deg, #6fb0ff 0%, var(--blue) 45%, #2557d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 6px; /* keep italic overhang visible */
}

.topbar__center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;          /* v5: allow the chips to shrink instead of overflowing */
  flex-wrap: nowrap;
  overflow: hidden;
  padding: 0 8px;
}
.topbar__center > * { min-width: 0; }
.topbar__center .btn { flex: none; white-space: nowrap; }

/* v6: the ONLY navbar value — total $ of the items you own (no spendable balance) */
.balance-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 11px 16px;
  font-weight: 800;
  font-size: 14px;
  min-width: 0;          /* v5: shrink, never wrap/overlap */
  overflow: hidden;
}
#balance-usd { white-space: nowrap; color: #fff; font-size: 14px; font-weight: 800; }
.balance-chip .ico--inv { width: 17px; height: 17px; color: var(--muted); }
.balance-chip__label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.me-text { text-align: right; line-height: 1.25; }
#me-name  { display: block; font-weight: 800; font-size: 13px; }
#me-level { display: block; font-weight: 700; font-size: 11px; color: var(--gold-2); }
#me-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--red);
  object-fit: cover;
  background: var(--bubble);
}
.notif-dot {
  position: absolute;
  right: 7px; bottom: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

/* ==========================================================================
   SUBNAV
   ========================================================================== */

.subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: var(--bg-2);
  border-bottom: 1px solid rgba(26, 33, 56, .6);
  min-width: 0;
}
.subnav__links { display: flex; gap: 26px; min-width: 0; }
.subnav__link {
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: color .15s;
}
.subnav__link:hover { color: #fff; }

.subnav__right { display: flex; align-items: center; gap: 18px; }

.subnav__socials { display: flex; align-items: center; gap: 14px; }
.social { color: var(--muted-2); display: inline-flex; transition: color .15s, transform .12s; }
.social .ico { width: 16px; height: 16px; }
.social:hover { color: #fff; transform: translateY(-1px); }

/* ==========================================================================
   CHAT SIDEBAR
   ========================================================================== */

#chat {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  min-height: 0;
}

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }

/* — messages — */
#chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
#chat-list:empty::before {
  content: "No messages yet — say hi!";
  display: block;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  padding: 30px 0;
}

.chat-msg { display: flex; gap: 9px; animation: msg-in .25s ease-out both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }
.chat-msg__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bubble);
  flex: none;
  margin-top: 2px;
}
.chat-msg__body { min-width: 0; }
.chat-msg__head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.chat-msg__name { color: var(--muted); font-size: 11.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg__text {
  background: var(--bubble);
  border-radius: 10px;
  border-top-left-radius: 4px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #cdd5ea;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* level pills (chat + anywhere) */
.lv {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 2px 6px;
  border-radius: var(--r-chip);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex: none;
}
.lv--gray   { background: #4a5370; }
.lv--green  { background: var(--green); }
.lv--orange { background: #e8862c; }
.lv--red    { background: var(--red); }
.lv--purple { background: #9d5cf0; }

/* — composer — */
.chat-composer {
  margin: 10px 12px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 10px;
}
#chat-input {
  width: 100%;
  background: transparent;
  border: 0;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 4px 12px;
}
#chat-input::placeholder { color: var(--muted-2); }
#chat-input:focus { outline: none; }
.chat-composer__row { display: flex; align-items: center; gap: 6px; }
.chat-mini {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted-2);
  border-radius: var(--r-chip);
  transition: color .15s;
}
.chat-mini .ico { width: 16px; height: 16px; }
.chat-mini:hover { color: var(--text); }
.chat-send {
  margin-left: auto;
  width: 42px; height: 34px;
  padding: 0;
  border-radius: var(--r-btn);
}
.chat-send .ico { width: 16px; height: 16px; }

/* — footer — */
.chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 12px;
}
.online { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.online b { color: #fff; font-size: 12px; }
.rules-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 12px; font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--r-chip);
  transition: color .15s, background .15s;
}
.rules-btn .ico { width: 14px; height: 14px; }
.rules-btn:hover { color: #fff; background: var(--bubble); }

/* ==========================================================================
   SIDENAV (right)
   ========================================================================== */

#sidenav {
  padding: 14px 14px 20px;
  border-left: 1px solid rgba(26, 33, 56, .5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidenav__tabs {
  display: flex;
  background: var(--panel);
  border-radius: var(--r-btn);
  padding: 4px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.tab:hover { color: #fff; }
.tab.is-active {
  background: linear-gradient(180deg, #3b86f8, var(--blue-2));
  color: #fff;
  box-shadow: 0 3px 10px rgba(47, 123, 246, .35);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-row);
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-align: left;
  transition: color .15s, background .15s;
}
.nav-item .ico { width: 17px; height: 17px; }
.nav-item .rc--nav { width: 20px; height: 20px; }
.nav-item:hover { color: #fff; background: rgba(18, 26, 46, .8); }
.nav-item:active { transform: scale(.98); }
/* Reference boxes only the Home row + group header rows; items sit on the page
   background and the active item gets a plain darker pill + thin blue LEFT bar. */
.nav-item.is-active {
  position: relative;
  background: #0f1830;
  color: var(--blue-text);
  box-shadow: none;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--blue);
}
.nav-item[data-nav="home"] { background: var(--panel); border-radius: 10px; color: #fff; }
.ico--home { color: var(--blue); }
.nav-item:hover .ico--home { color: var(--blue); }

.sidenav__group {
  background: none;
  border-radius: var(--r-panel);
  padding: 0;
}
.sidenav__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px 10px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--panel);
  border-radius: 10px;
  margin-bottom: 4px;
}
.ico--chev.up { transform: rotate(180deg); width: 14px; height: 14px; color: var(--muted-2); }

/* ==========================================================================
   MAIN — coinflip lobby
   ========================================================================== */

#main {
  padding: 26px 34px 60px;
  min-width: 0;
}

.main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}
#page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.ico--title { width: 30px; height: 30px; }

.main-head__tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.hv-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 10px 14px;
  font-weight: 800;
  font-size: 13px;
  min-width: 110px;
}
.hv-btn {
  background: var(--bubble);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: var(--r-btn);
  transition: color .15s, background .15s, transform .08s;
}
.hv-btn:hover { color: #fff; background: #1a2440; }
.hv-btn:active { transform: scale(.95); }
.hv-btn--max {
  background: linear-gradient(180deg, #3b86f8, var(--blue-2));
  color: #fff;
}
.hv-btn--max:hover { filter: brightness(1.12); background: linear-gradient(180deg, #3b86f8, var(--blue-2)); }

/* — auto-fill (quick value match) — v5: subtle blue-tinted helper pill.
   Reads as a helper next to Max/Clear, never competes with the primary
   Create/Join button. */
.hv-btn--auto {
  background: rgba(47, 123, 246, .14);
  border: 1px solid rgba(47, 123, 246, .42);
  color: #9dc2ff;
}
.hv-btn--auto:hover {
  filter: none;
  color: #cfe2ff;
  background: rgba(47, 123, 246, .24);
  border-color: rgba(47, 123, 246, .6);
}
.auto-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--bubble);
  border-radius: var(--r-btn);
  padding: 0 8px;
  height: 32px;
}
.auto-wrap__pfx { color: var(--muted-2); font-size: 12px; font-weight: 800; }
.auto-input {
  width: 68px;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 4px;
  outline: none;
}
.auto-input::placeholder { color: var(--muted-2); font-weight: 600; }
.auto-input::-webkit-outer-spin-button, .auto-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.auto-input { -moz-appearance: textfield; }
#join-auto { margin-left: auto; }

/* — games list — */
#games-list { display: flex; flex-direction: column; gap: 13px; }
#games-list:empty::before {
  content: "No active coinflips — hit Create Game to start one.";
  display: block;
  text-align: center;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 700;
  padding: 90px 0;
  border: 1px dashed #1c2440;
  border-radius: var(--r-panel);
}

/* — row — */
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 12px 16px 12px 22px;
  background: var(--panel);
  border-radius: var(--r-row);
  overflow: hidden;
  animation: row-in .35s ease-out both;
  animation-delay: var(--d, 0s);
}
@keyframes row-in { from { opacity: 0; transform: translateY(14px); } }

.row--h { background: linear-gradient(90deg, rgba(47, 123, 246, .12), rgba(47, 123, 246, 0) 34%), var(--panel); }
.row--t { background: linear-gradient(90deg, rgba(240, 162, 29, .12), rgba(240, 162, 29, 0) 34%), var(--panel); }

.row__bar {
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 4px;
  border-radius: 2px;
  background: var(--blue);
}
.row--t .row__bar { background: var(--gold); }

.row__avatar, .row__opp {
  position: relative;
  width: 58px; height: 58px;
  flex: none;
}
.row__avatar img, .row__opp img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--ring, var(--blue));
  background: var(--bubble);
}
.row__opp-q {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  background: var(--bubble);
  border: 2px solid #222b47;
  color: var(--muted-2);
  font-size: 21px;
  font-weight: 800;
}
.row__opp img:not([hidden]) ~ .row__opp-q { display: none; }

.row__badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--panel);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.row__badge .rc { width: 20px; height: 20px; }
/* creator badge shows the creator side; opponent badge the other side */
.row--h .row__avatar .rc--t,          .row--t .row__avatar .rc--h,
.row--h .row__opp .rc--h,             .row--t .row__opp .rc--t { display: none; }

.row__vs { color: #dfe6f5; display: flex; flex: none; }
.row__vs .ico { width: 22px; height: 22px; }

/* result coin is the largest element in the row — bigger than the 58px avatars */
.row__result-coin { display: flex; flex: none; }
.row__result-coin .rc { width: 66px; height: 66px; }
/* which face landed: .row--coin-h / -t / -edge on .row */
.row__result-coin .rc--h, .row__result-coin .rc--t, .row__result-coin .rc--edge { display: none; }
.row--coin-h .row__result-coin .rc--h,
.row--coin-t .row__result-coin .rc--t,
.row--coin-edge .row__result-coin .rc--edge { display: block; }
.row--coin-h .row__result-coin { filter: drop-shadow(0 0 12px rgba(47, 138, 247, .55)); }
.row--coin-t .row__result-coin { filter: drop-shadow(0 0 12px rgba(240, 162, 29, .55)); }

.row__items {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  margin-left: 6px;
}
.row__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 17px;
  background: var(--bubble);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  flex: none;
}

.row__value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: none;
  margin-left: auto;
  padding-right: 4px;
}
.row__value-label { color: var(--muted-2); font-size: 11px; font-weight: 700; }
.row__value-amt {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px;
}
.row__value-amt b { font-weight: 800; }
.ico--gun { width: 16px; height: 16px; color: var(--muted-2); }

.row__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: none;
  width: 208px;
}
.row__join, .row__callbot { padding: 11px 22px; }
.row__eye { width: 42px; height: 42px; }
.row--resolved .row__join, .row--resolved .row__callbot { display: none; }

/* item thumbs (rows + modals) — tint via --tier */
.item-thumb {
  --tier: #4c9aff;
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* neutral dark disc; the tier color only whispers as a soft glow */
  background: radial-gradient(circle at 50% 40%, #151129, #0a0e1c 75%);
  border: 1px solid color-mix(in srgb, var(--tier) 14%, var(--line));
  box-shadow: 0 0 14px -2px color-mix(in srgb, var(--tier) 30%, transparent),
              inset 0 0 12px color-mix(in srgb, var(--tier) 8%, transparent);
}
.item-thumb img {
  width: 76%; height: 76%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .55));
}
.item-thumb--sm { width: 46px; height: 46px; }

/* ==========================================================================
   MODAL CHASSIS
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.is-open, .modal.open, .modal.show, .modal.active { display: flex; }

.modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, .74);
  backdrop-filter: blur(3px);
  animation: fade-in .16s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }

.modal__panel {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  padding: 22px 24px;
  max-width: calc(100vw - 40px);
  max-height: 92vh;
  overflow-y: auto;
  animation: modal-in .16s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal__head h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px;
  font-weight: 800;
}
.modal__x {
  width: 32px; height: 32px;
  font-size: 13px;
  font-weight: 800;
}
.modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
}
.modal__foot-btns { display: flex; gap: 10px; }

/* ==========================================================================
   LOGIN MODAL
   ========================================================================== */

.modal__panel--login { width: 380px; text-align: center; padding: 34px 30px 28px; }
.login-brand { font-size: 30px; margin-bottom: 6px; }
.login-sub { color: var(--muted-2); font-size: 12px; font-weight: 600; margin-bottom: 24px; }

.field { display: block; text-align: left; margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  background: #0d1326;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 123, 246, .18);
}

#login-err {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  margin: 2px 0 10px;
}
.login-actions { display: flex; gap: 10px; }
.login-actions .btn { flex: 1; padding: 12px 0; }

/* ==========================================================================
   V2 — AUTH TABS · VERIFY BANNER · ADMIN LINK · FAUCET
   ========================================================================== */

/* — admin link — */
.admin-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: var(--r-btn);
  background: rgba(157, 92, 240, .14);
  border: 1px solid rgba(157, 92, 240, .45);
  color: #c9a6ff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.admin-link:hover { background: rgba(157, 92, 240, .28); color: #fff; }

/* — faucet cooldown state — */
#faucet-btn.is-cooldown[disabled] {
  opacity: .82;
  filter: none;
  cursor: default;
  background: linear-gradient(180deg, #263352, #1b2540);
  box-shadow: none;
  color: var(--muted);
}

/* — verify banner (top of main) — */
.verify-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(90deg, rgba(240, 162, 29, .16), rgba(240, 162, 29, .04) 60%), var(--panel);
  border: 1px solid rgba(240, 162, 29, .4);
  border-radius: var(--r-row);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.verify-banner .ico { width: 20px; height: 20px; color: var(--gold-2); flex: none; }
.verify-banner__text { font-size: 12.5px; font-weight: 600; color: #e6ddc9; flex: 1; min-width: 0; line-height: 1.5; }
.verify-banner__text b { color: #fff; font-weight: 800; }
#verify-email { color: var(--gold-2); font-weight: 700; }
.verify-banner .btn { flex: none; }
.verify-banner #resend-verify[disabled] { opacity: .55; }

/* — auth tabs + panels — */
.auth-tabs {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  padding: 10px 4px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.auth-tab:hover { color: #fff; }
.auth-tab.is-active {
  background: linear-gradient(180deg, #3b86f8, var(--blue-2));
  color: #fff;
  box-shadow: 0 3px 10px rgba(47, 123, 246, .35);
}
.auth-panel { display: block; }
.auth-panel[hidden] { display: none; }

.btn--block { width: 100%; padding: 13px 0; }

.field__hint {
  display: block;
  min-height: 13px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  margin-top: 5px;
  text-align: left;
}
.field__hint.is-bad  { color: var(--red); }
.field__hint.is-good { color: var(--green); }
.field input.is-bad { border-color: var(--red); }

#reg-err { min-height: 18px; color: var(--red); font-size: 12px; font-weight: 700; margin: 2px 0 10px; }

.auth-resend {
  display: block;
  width: 100%;
  text-align: center;
  margin: -2px 0 12px;
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
}
.auth-resend:hover { color: #fff; }
.auth-fineprint { margin-top: 12px; color: var(--muted-2); font-size: 10.5px; font-weight: 600; text-align: center; }

@media (max-width: 1100px) {
  .balance-chip { display: none; }
}
@media (max-width: 880px) {
  .admin-link { display: none; }
  #faucet-btn { padding: 10px 12px; font-size: 11px; }
}

/* ==========================================================================
   CREATE / JOIN MODALS
   ========================================================================== */

.modal__panel--pick { width: 590px; }

.side-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.side-pick__label { color: var(--muted); font-size: 12px; font-weight: 800; margin-right: auto; }
.side-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  border-radius: var(--r-btn);
  background: var(--bubble);
  border: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  transition: border-color .15s, color .15s, background .15s, transform .08s;
}
.side-chip .rc { width: 26px; height: 26px; }
.side-chip:hover { color: #fff; }
.side-chip:active { transform: scale(.96); }
#side-h.is-active { border-color: var(--blue); color: #fff; background: #10203c; box-shadow: 0 0 14px rgba(47, 123, 246, .25); }
#side-t.is-active { border-color: var(--gold); color: #fff; background: #2b2010; box-shadow: 0 0 14px rgba(240, 162, 29, .25); }

.pick-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pick-sub__label { color: var(--muted-2); font-size: 12px; font-weight: 700; }
.pick-sub__helpers { display: flex; gap: 8px; }
.pick-sub__helpers .hv-btn { padding: 7px 14px; }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(99px, 1fr));
  gap: 10px;
  max-height: 340px;
  min-height: 140px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(7, 11, 22, .5);
  border-radius: var(--r-row);
}
.inv-grid:empty::before {
  content: "No items yet — hit Free Items for a free drop.";
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  padding: 40px 10px;
}

.inv-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 9px;
  background: #0d1326;
  border: 2px solid transparent;
  border-radius: var(--r-row);
  transition: border-color .12s, background .12s, transform .08s;
  text-align: center;
  min-width: 0;
}
.inv-item:hover { background: #111a33; transform: translateY(-1px); }
.inv-item:active { transform: scale(.96); }
.inv-item.is-selected {
  border-color: var(--blue);
  background: #10203c;
  box-shadow: 0 0 12px rgba(47, 123, 246, .28);
}
.inv-item .item-thumb { width: 52px; height: 52px; }
.inv-item__name {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-item.is-selected .inv-item__name { color: #fff; }
.inv-item__val { font-size: 11px; font-weight: 800; color: var(--gold-2); }

.sel-total {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
}
.sel-total__label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.sel-usd { color: var(--muted-2); font-size: 12px; font-weight: 700; }

.join-target {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bubble);
  border-radius: var(--r-row);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.join-target__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
#join-target { font-size: 17px; font-weight: 800; color: var(--gold-2); }
.join-hint { flex-basis: 100%; color: var(--muted-2); font-size: 11.5px; font-weight: 600; }
.join-hint.is-bad { color: var(--red); }

/* ==========================================================================
   GAME MODAL — the frame-modal design
   ========================================================================== */

.modal__panel--game {
  width: 905px;
  padding: 30px 30px 20px;
  /* radial spotlight top-center + faint 40px grid (per frames) */
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(47, 123, 246, .32), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(120, 140, 190, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(120, 140, 190, .05) 39px 40px),
    linear-gradient(180deg, #0a101f, #080c18);
  overflow-x: hidden;
}
/* face-based tint: client toggles .gm--h / .gm--t / .gm--edge on #game-modal */
#game-modal.gm--t .modal__panel--game {
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(240, 162, 29, .30), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(190, 160, 120, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(190, 160, 120, .05) 39px 40px),
    linear-gradient(180deg, #0f0d18, #0a0914);
}
#game-modal.gm--edge .modal__panel--game {
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(160, 165, 180, .22), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(150, 155, 175, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(150, 155, 175, .05) 39px 40px),
    linear-gradient(180deg, #0c0e15, #090a10);
}

#gm-close { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(18, 26, 46, .7); }

.gm__top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 20px;
  margin-bottom: 26px;
}

.gm__player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 26px;
}
.gm__avatar-wrap { display: block; }
.gm__player img {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3.5px solid var(--ring, var(--blue));
  background: var(--bubble);
  box-shadow: 0 0 24px rgba(0, 0, 0, .5);
}
.gm__id { display: flex; align-items: center; gap: 8px; }
#gm-l-name, #gm-r-name { font-size: 15px; font-weight: 800; }

.level-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 9px;
  border: 1.6px solid currentColor;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
}
.level-pill.lv--gray, .level-pill.lv--green, .level-pill.lv--orange,
.level-pill.lv--red, .level-pill.lv--purple { background: transparent; }
.level-pill.lv--gray   { color: #8a93b0; }
.level-pill.lv--green  { color: var(--green); }
.level-pill.lv--orange { color: #e8862c; }
.level-pill.lv--red    { color: var(--red); }
.level-pill.lv--purple { color: #9d5cf0; }

.gm__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 240px;
}

#gm-status {
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
  min-height: 20px;
}

/* — 3-face 3D coin — */
.coin3d {
  width: 190px;
  height: 190px;
  perspective: 900px;
  flex: none;
}
.coin3d__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.coin3d__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.coin3d__face svg { width: 100%; height: 100%; }
.coin3d__face--h {
  transform: rotateY(0deg) translateZ(8px);
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .5));
}
.coin3d__face--t {
  transform: rotateY(180deg) translateZ(8px);
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .5));
}
/* colored glow only as a landing/win burst (.land added by the client on land) */
.coin3d.land .coin3d__face--h {
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .5)) drop-shadow(0 0 26px rgba(47, 138, 247, .55));
}
.coin3d.land .coin3d__face--t {
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .5)) drop-shadow(0 0 26px rgba(240, 162, 29, .55));
}
.coin3d__face--edge {
  inset: auto;
  left: 50%;
  top: 0;
  width: 16px;
  height: 100%;
  margin-left: -8px;
  border-radius: 8px;
  backface-visibility: visible;
  transform: rotateY(90deg);
  background: linear-gradient(90deg, #6f7688, #cfb469 30%, #8a8f9c 50%, #cfb469 70%, #6f7688);
  box-shadow: 0 0 18px rgba(207, 180, 105, .35);
}

/* static poses (client sets on #gm-coin) */
.coin3d.face-h    .coin3d__inner { transform: rotateY(0deg); }
.coin3d.face-t    .coin3d__inner { transform: rotateY(180deg); }
.coin3d.face-edge .coin3d__inner { transform: rotateY(90deg); }

/* spin scaffolding — client adds .spin-h / .spin-t / .spin-edge to #gm-coin.
   3.2s ease-out, >=6 full turns, ends on the landed face (edge: 90deg + wobble) */
.coin3d.spin-h .coin3d__inner {
  animation: coin-spin-h 3.2s cubic-bezier(.15, .85, .25, 1) forwards;
}
.coin3d.spin-t .coin3d__inner {
  animation: coin-spin-t 3.2s cubic-bezier(.15, .85, .25, 1) forwards;
}
.coin3d.spin-edge .coin3d__inner {
  animation: coin-spin-edge 3.4s cubic-bezier(.15, .85, .25, 1) forwards;
}
@keyframes coin-spin-h {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(2160deg); }   /* 6 turns -> H */
}
@keyframes coin-spin-t {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(2340deg); }   /* 6.5 turns -> T */
}
@keyframes coin-spin-edge {
  0%   { transform: rotateY(0deg); }
  82%  { transform: rotateY(2262deg); }   /* overshoot past the rim… */
  90%  { transform: rotateY(2242deg); }   /* …wobble back… */
  96%  { transform: rotateY(2254deg); }
  100% { transform: rotateY(2250deg); }   /* …rest on the edge (90deg) */
}

/* landing squash bounce (client adds .land after the spin) */
.coin3d.land { animation: coin-land .5s cubic-bezier(.3, 1.6, .4, 1); }
@keyframes coin-land {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.12, .86); }
  65%  { transform: scale(.95, 1.06); }
  100% { transform: scale(1); }
}

/* — stat bars — */
.gm__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 14px;
}
.gm__stat {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(13, 19, 38, .9);
  border: 1px solid rgba(26, 33, 56, .8);
  border-radius: var(--r-btn);
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 800;
}
.ico--clover { width: 18px; height: 18px; color: var(--green); }
.gm__total { margin-left: auto; color: var(--gold-2); font-weight: 800; }

/* — item lists — */
.gm__lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.gm__items {
  list-style: none;
  background: rgba(9, 13, 26, .6);
  border: 1px solid rgba(26, 33, 56, .55);
  border-radius: var(--r-row);
  padding: 4px 14px;
  min-height: 248px;
  max-height: 290px;
  overflow-y: auto;
}
.gm__items:empty::before {
  content: "No items yet";
  display: block;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  padding: 104px 0;
}
.gm-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 2px;
}
.gm-item + .gm-item { border-top: 1px solid rgba(26, 33, 56, .45); }
.gm-item__name {
  font-size: 14px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gm-item__val {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-2);
  flex: none;
}

/* — footer — */
.gm__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
#gm-created { color: var(--muted-2); font-size: 12px; font-weight: 700; }

/* ==========================================================================
   FAIRNESS MODAL
   ========================================================================== */

.modal__panel--fair { width: 540px; }
.fair-explain {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.65;
  margin-bottom: 18px;
}
.fair-explain b { color: #fff; }
.fair-explain code {
  background: var(--bubble);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--blue-text);
}
.fair-fields { display: flex; flex-direction: column; gap: 8px; }
.fair-field {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: baseline;
  background: rgba(13, 19, 38, .7);
  border-radius: var(--r-btn);
  padding: 10px 12px;
}
.fair-field dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fair-field dd { min-width: 0; }
.fair-field code {
  display: block;
  font-size: 11px;
  color: #cdd5ea;
  word-break: break-all;
  line-height: 1.5;
}

/* ==========================================================================
   HISTORY MODAL
   ========================================================================== */

.modal__panel--history { width: 640px; }
#history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}
#history-list:empty::before {
  content: "No resolved games yet — go flip something.";
  display: block;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 700;
  padding: 70px 0;
}
.hist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(13, 19, 38, .7);
  border-radius: var(--r-btn);
  padding: 11px 14px;
}
.hist-row .rc { width: 28px; height: 28px; }
.hist-row__date { color: var(--muted-2); font-size: 11.5px; font-weight: 700; width: 108px; flex: none; }
.hist-row__vs {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hist-row__value { font-size: 13.5px; font-weight: 800; flex: none; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 10px;
  border-radius: var(--r-chip);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  flex: none;
}
.badge--win  { background: rgba(53, 196, 111, .16); color: var(--green); }
.badge--loss { background: rgba(225, 75, 75, .16);  color: var(--red); }
.badge--edge { background: rgba(240, 162, 29, .16); color: var(--gold-2); }

/* ==========================================================================
   TOAST / FX / SHAKE / FLASH
   ========================================================================== */

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 500;
  max-width: 340px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--r-row);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55);
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  display: none;
}
#toast.is-open, #toast.open, #toast.show, #toast.active {
  display: block;
  animation: toast-in .22s cubic-bezier(.2, 1.2, .4, 1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
}
#toast.toast--gold  { border-left-color: var(--gold); }
#toast.toast--green { border-left-color: var(--green); }
#toast.toast--red   { border-left-color: var(--red); }

#fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 400;
  pointer-events: none;
}

/* EDGE screen shake (client adds body.shake for 600ms) */
body.shake { animation: shake .6s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(5px, -2px); }
  30%, 50%, 70% { transform: translate(-9px, 3px); }
  40%, 60% { transform: translate(9px, -3px); }
}

/* white flash helper (client adds body.flash, removes after ~500ms) */
body.flash::after {
  content: "";
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 350;
  pointer-events: none;
  animation: flash-out .45s ease-out forwards;
}
@keyframes flash-out { from { opacity: .85; } to { opacity: 0; } }

/* ==========================================================================
   RESPONSIVE-ISH
   ========================================================================== */

@media (max-width: 1100px) {
  #app { grid-template-columns: 0 minmax(0, 1fr) 250px; }
  #chat { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  #main { padding: 22px 22px 50px; }
}

@media (max-width: 880px) {
  #app { grid-template-columns: 0 minmax(0, 1fr) 0; }
  #sidenav { display: none; }
  .subnav { padding: 0 18px; }
  .subnav__socials { display: none; }
  .me-text { display: none; }
  .row__value-label { display: none; }
  .row__actions { width: auto; }
  .modal__panel--game { padding: 22px 16px 16px; }
  .gm__stats, .gm__lists { gap: 12px; }
  .gm__player img { width: 72px; height: 72px; }
  .coin3d { width: 140px; height: 140px; }
}

/* ==========================================================================
   V3 — LOGIN WITH ROBLOX (public-bio verification sub-flow in #auth-modal)
   ========================================================================== */

/* — divider between local auth and the Roblox button — */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.auth-divider::before,
.auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* — the "Login with Roblox" button — */
.btn--rblx {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: linear-gradient(180deg, #232936, #151a26);
  border: 1px solid #38415a;
  color: #fff;
}
.btn--rblx:hover {
  background: linear-gradient(180deg, #2b3244, #1a2030);
  border-color: #4a5677;
  filter: none;
}
.btn--rblx .ico--rblx { width: 15px; height: 15px; color: #fff; flex: none; }

/* — sub-flow chrome — */
#rblx-flow { text-align: left; }
.rblx-back {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  margin-bottom: 14px;
}
.rblx-back:hover { color: #fff; }
.rblx-step { display: block; text-align: left; }
.rblx-step[hidden] { display: none; }
.rblx-fineprint {
  margin-top: 12px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}
#rblx-err { min-height: 18px; color: var(--red); font-size: 12px; font-weight: 700; margin: 2px 0 10px; }

/* — step 2: "Is this you?" card — */
.rblx-question { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 14px; text-align: center; }
.rblx-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bubble);
  border: 1px solid var(--line);
  border-radius: var(--r-row);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.rblx-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--blue);
  background: #0d1326;
  flex: none;
  object-fit: cover;
}
.rblx-card__names { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rblx-card__display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  min-width: 0;
}
.rblx-card__display > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rblx-verified {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2f8af7;
  color: #fff;
  font-size: 9.5px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rblx-card__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rblx-btns { display: flex; gap: 10px; }
.rblx-btns .btn { flex: 1; padding: 12px 0; }

/* — step 3: phrase + status — */
.rblx-instruct { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 10px; line-height: 1.45; }
.rblx-phrase-row { display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px; }
#rblx-phrase {
  flex: 1;
  display: block;
  min-width: 0;
  background: #0d1326;
  border: 1px dashed #2c3b63;
  border-radius: var(--r-btn);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--blue-text);
  word-break: break-word;
  user-select: all;
  -webkit-user-select: all;
}
.rblx-copy { flex: none; align-self: center; }
.rblx-copy.is-copied { color: var(--green); border-color: var(--green); }
.rblx-profile-link {
  display: block;
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 800;
  text-decoration: underline;
  margin-bottom: 12px;
}
.rblx-profile-link:hover { color: #fff; }
.rblx-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.5;
}
.rblx-status.is-wait { color: var(--gold-2); }
.rblx-status.is-ok   { color: var(--green); }
.rblx-status.is-err  { color: var(--red); }
.rblx-spinner {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: var(--blue-text);
  animation: rblx-spin .8s linear infinite;
  display: inline-block;
}
@keyframes rblx-spin { to { transform: rotate(360deg); } }
.rblx-expiry { font-size: 10.5px; font-weight: 700; color: var(--muted-2); margin-bottom: 10px; }
#rblx-check { margin-top: 6px; }
#rblx-restart { margin-top: 8px; }
#rblx-check[disabled], #rblx-lookup-btn[disabled], #rblx-yes[disabled] { opacity: .6; cursor: default; }

/* ==========================================================================
   V5 — TEAM COINFLIP (1v1 / 2v2 / 3v3 / 4v4)
   ========================================================================== */

/* — create modal: mode chips — */
.mode-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 12px;
}
.mode-pick__label { color: var(--muted); font-size: 12px; font-weight: 800; margin-right: auto; }
.mode-chip {
  padding: 8px 15px;
  border-radius: var(--r-btn);
  background: var(--bubble);
  border: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  transition: border-color .15s, color .15s, background .15s, transform .08s;
}
.mode-chip:hover { color: #fff; }
.mode-chip:active { transform: scale(.96); }
.mode-chip.is-active {
  border-color: var(--blue);
  color: #fff;
  background: #10203c;
  box-shadow: 0 0 10px rgba(47, 123, 246, .22);
}
.mode-hint {
  color: var(--muted-2);
  font-size: 11.5px;
  font-weight: 600;
  margin: -6px 0 10px;
}

/* — join modal: team choice — */
.join-team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bubble);
  border-radius: var(--r-row);
  padding: 10px 16px;
  margin-bottom: 12px;
}
.join-team-row__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: auto;
}
.team-chip {
  padding: 8px 15px;
  border-radius: var(--r-btn);
  background: var(--panel);
  border: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s, transform .08s;
}
.team-chip:hover { color: #fff; }
.team-chip:active { transform: scale(.96); }
#join-team-a.is-active {
  border-color: var(--blue);
  color: #fff;
  background: #10203c;
  box-shadow: 0 0 10px rgba(47, 123, 246, .22);
}
#join-team-b.is-active {
  border-color: var(--gold);
  color: #fff;
  background: #2b2010;
  box-shadow: 0 0 10px rgba(240, 162, 29, .22);
}

/* — lobby rows: mode badge + stacked team avatars — */
.row__mode {
  flex: none;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .5px;
  color: var(--blue-text);
  background: rgba(47, 123, 246, .12);
  border: 1px solid rgba(47, 123, 246, .35);
  border-radius: 6px;
  padding: 3px 7px;
}
.row--t .row__mode {
  color: var(--gold-2);
  background: rgba(240, 162, 29, .12);
  border-color: rgba(240, 162, 29, .35);
}
.row__stack {
  display: flex;
  align-items: center;
  flex: none;
}
.row__stack-av, .row__slot-open {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin-left: -8px;
  background: var(--bubble);
  flex: none;
}
.row__stack > :first-child { margin-left: -4px; }
.row__stack-av {
  object-fit: cover;
  border: 2px solid var(--panel);
}
.row__slot-open {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #222b47;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 800;
}

/* — game modal: team rosters inside the item lists — */
.gm-team-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px 7px;
}
.gm-team-player + .gm-team-player,
.gm-item + .gm-team-player { border-top: 1px solid rgba(26, 33, 56, .45); }
.gm-team-player__av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bubble);
  border: 2px solid var(--line);
  flex: none;
}
.gm-team-player__name {
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gm-team-player__val {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-2);
  flex: none;
}
.gm-team-player--open { color: var(--muted-2); }
.gm-team-player--open .gm-team-player__name { font-weight: 700; color: var(--muted-2); }
.gm-team-player__plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px dashed #222b47;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted-2);
  flex: none;
}
/* the team's items sit slightly indented under each player header */
.gm-team-player ~ .gm-item .item-thumb--sm { margin-left: 4px; }

/* winning team's list gets a lasting highlight on resolve */
.gm__items.is-winner {
  border-color: rgba(53, 196, 111, .55);
  box-shadow: 0 0 18px -4px rgba(53, 196, 111, .4);
}

/* — winner payouts under the coin — */
.gm-payouts {
  width: 100%;
  max-width: 320px;
  background: rgba(13, 19, 38, .92);
  border: 1px solid rgba(53, 196, 111, .35);
  border-radius: var(--r-btn);
  padding: 10px 12px;
  font-size: 12px;
}
.gm-payouts__title {
  color: var(--green);
  font-weight: 900;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.gm-payouts__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-weight: 700;
}
.gm-payouts__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gm-payouts__val { color: var(--green); font-weight: 800; flex: none; }

/* ==========================================================================
   V6 — MM2ROLL: sections · items-only · clearer team UI · per-slot Add Bot
   ========================================================================== */

/* — main sections (Coinflip / Jackpot / Marketplace / Profile share #main) — */
.app-section { min-width: 0; }
.soon-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px dashed #1c2440;
  border-radius: var(--r-panel);
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  padding: 30px;
}

/* — game modal: readable N/M players pill next to TEAM A/B — */
.gm-team-count {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(47, 123, 246, .14);
  border: 1px solid rgba(47, 123, 246, .4);
  color: var(--blue-text);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}
.gm-team-count.is-full {
  background: rgba(53, 196, 111, .12);
  border-color: rgba(53, 196, 111, .4);
  color: var(--green);
}

/* — team roster (v6 rework): each slot is a clear card-row inside the list — */
.gm__items--team { padding: 8px 10px; max-height: 340px; }
.gm__items--team .gm-team-player {
  background: rgba(18, 26, 46, .75);
  border: 1px solid rgba(26, 33, 56, .8);
  border-radius: var(--r-btn);
  padding: 8px 10px;
  margin: 8px 0 4px;
}
.gm__items--team .gm-team-player + .gm-team-player,
.gm__items--team .gm-item + .gm-team-player { border-top: 1px solid rgba(26, 33, 56, .8); }
.gm__items--team .gm-item { padding: 7px 4px 7px 12px; }
.gm-team-player__slot {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 123, 246, .16);
  color: var(--blue-text);
  font-size: 10px;
  font-weight: 900;
}
.gm-team-player--open {
  border-style: dashed !important;
  border-color: #2a3352 !important;
  background: rgba(10, 15, 30, .55) !important;
}
.gm-team-player__addbot {
  margin-left: auto;
  flex: none;
  padding: 6px 12px;
  border-radius: var(--r-btn);
  background: rgba(240, 162, 29, .14);
  border: 1px solid rgba(240, 162, 29, .45);
  color: var(--gold-2);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition: background .15s, color .15s, transform .08s;
}
.gm-team-player__addbot:hover { background: rgba(240, 162, 29, .28); color: #fff; }
.gm-team-player__addbot:active { transform: scale(.95); }
.gm-team-player--open .gm-team-player__name { margin-right: 8px; }

/* team-mode value chip under each roster header */
.gm-team-player__val { font-size: 12.5px; }

/* — Add Bot modal reuses the pick chassis; slightly narrower. It opens ON TOP
   of the game modal, so it stacks above the shared .modal z-index — */
#addbot-modal { z-index: 120; }
#addbot-modal .modal__panel--pick { width: 540px; }
#addbot-modal .inv-grid { max-height: 300px; }

/* ==========================================================================
   V6 — JACKPOT (lobby cards, the wheel, deposit picker, fairness)
   ========================================================================== */

/* — lobby — */
#jp-list { display: flex; flex-direction: column; gap: 13px; }

.jp-empty {
  text-align: center;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 700;
  padding: 90px 0;
  border: 1px dashed #1c2440;
  border-radius: var(--r-panel);
}

.jp-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 88px;
  padding: 12px 16px 12px 22px;
  background: linear-gradient(90deg, rgba(240, 162, 29, .10), rgba(240, 162, 29, 0) 34%), var(--panel);
  border-radius: var(--r-row);
  overflow: hidden;
  cursor: pointer;
  animation: row-in .35s ease-out both;
}
.jp-card__bar {
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
}
.jp-card__pot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  flex: none;
}
.jp-card__pot-val { font-size: 18px; font-weight: 800; color: var(--gold-2); }
.jp-card__pot-label { font-size: 10.5px; font-weight: 800; color: var(--muted-2); text-transform: uppercase; letter-spacing: .05em; }

.jp-card__entries {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.jp-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: none;
  width: 46px;
}
.jp-slot__av {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--blue);
  background: var(--bubble);
}
.jp-slot__pct { font-size: 10px; font-weight: 800; }
.jp-slot--open { justify-content: flex-start; }
.jp-slot__plus {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px dashed #222b47;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-size: 15px;
  font-weight: 800;
}
.jp-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex: none;
}

/* — recent spins strip under the lobby — */
#jp-recent-wrap { margin-top: 26px; }
.jp-recent__title {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}
#jp-recent { display: flex; flex-direction: column; gap: 8px; }
.jp-recent__row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bubble);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s;
}
.jp-recent__row:hover { background: #172037; }
.jp-recent__date { color: var(--muted-2); font-weight: 600; width: 118px; flex: none; }
.jp-recent__chip { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.jp-recent__who {
  flex: 1;
  color: var(--muted);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jp-recent__val { font-weight: 800; color: var(--text); flex: none; }

/* — round modal (same dark spotlight framing as the coinflip game modal) — */
.modal__panel--jackpot {
  width: 880px;
  padding: 26px 28px 18px;
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(240, 162, 29, .26), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(190, 160, 120, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(190, 160, 120, .05) 39px 40px),
    linear-gradient(180deg, #0d0c16, #090812);
  overflow-x: hidden;
}
#jp-modal.jp--win .modal__panel--jackpot {
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(53, 196, 111, .26), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(120, 190, 150, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(120, 190, 150, .05) 39px 40px),
    linear-gradient(180deg, #0a1116, #080d11);
}
#jp-modal.jp--house .modal__panel--jackpot {
  background:
    radial-gradient(560px 300px at 50% -40px, rgba(160, 165, 180, .22), transparent 72%),
    repeating-linear-gradient(0deg,  transparent 0 39px, rgba(150, 155, 175, .05) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(150, 155, 175, .05) 39px 40px),
    linear-gradient(180deg, #0c0e15, #090a10);
}
#jp-modal .jp-close { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(18, 26, 46, .7); }

.jp-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 44px;
}
.jp-head__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.jp-head__pot {
  margin-left: auto;
  background: var(--bubble);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-2);
  white-space: nowrap;
}

.jp-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: start;
}

/* — the wheel — */
.jp-wheel-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.jp-wheel-wrap {
  position: relative;
  width: 300px;
  height: 300px;
  flex: none;
}
.jp-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* arcs painted by the client via conic-gradient */
  background: conic-gradient(#1c2440 0deg 360deg);
  border: 7px solid #1a2138;
  box-shadow:
    0 0 0 2px rgba(240, 162, 29, .25),
    0 18px 50px rgba(0, 0, 0, .6),
    inset 0 0 40px rgba(0, 0, 0, .45);
  will-change: transform;
}
.jp-wheel.is-idle { animation: jp-idle 36s linear infinite; }
@keyframes jp-idle { to { transform: rotate(360deg); } }

.jp-pointer {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 0; height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 22px solid var(--gold-2);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .6));
}
.jp-pointer::after {
  content: "";
  position: absolute;
  left: -6px;
  top: -24px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
}

.jp-hub {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 104px; height: 104px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #141c33, #0b101f 78%);
  border: 3px solid #222b47;
  box-shadow: 0 0 26px rgba(0, 0, 0, .65), inset 0 0 18px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.jp-hub__label {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .14em;
}
#jp-hub-pot { font-size: 17px; font-weight: 800; color: var(--gold-2); max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.jp-status {
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .6);
  min-height: 20px;
}
.jp-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 40px;
}

/* — entries panel — */
.jp-side { min-width: 0; }
.jp-side__title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}
.jp-side__count {
  background: rgba(47, 123, 246, .14);
  border: 1px solid rgba(47, 123, 246, .4);
  color: var(--blue-text);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 800;
}
.jp-entries {
  list-style: none;
  background: rgba(9, 13, 26, .6);
  border: 1px solid rgba(26, 33, 56, .55);
  border-radius: var(--r-row);
  padding: 8px 10px;
  min-height: 248px;
  max-height: 330px;
  overflow-y: auto;
}
.jp-entry {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border-radius: var(--r-btn);
  transition: opacity .3s, box-shadow .3s;
}
.jp-entry + .jp-entry { border-top: 1px solid rgba(26, 33, 56, .45); }
.jp-entry__chip { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.jp-entry__av {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
  background: var(--bubble);
  flex: none;
}
.jp-entry__id { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.jp-entry__name {
  font-size: 12.5px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jp-entry__bot {
  flex: none;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: .06em;
  color: var(--muted-2);
  border: 1px solid #2a3352;
  border-radius: 4px;
  padding: 1px 5px;
}
.jp-entry__items { flex: none; color: var(--muted-2); font-size: 10.5px; font-weight: 700; }
.jp-entry__val { flex: none; font-size: 12px; font-weight: 800; color: var(--gold-2); }
.jp-entry__pct { flex: none; font-size: 12px; font-weight: 800; min-width: 44px; text-align: right; }

.jp-entry--open { color: var(--muted-2); }
.jp-entry--open .jp-entry__name { color: var(--muted-2); font-weight: 700; flex: 1; }
.jp-entry__plus {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px dashed #222b47;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted-2);
  flex: none;
  margin-left: 19px;
}

.jp-entry--house {
  margin-top: 6px;
  background: rgba(92, 32, 51, .16);
  border: 1px dashed rgba(225, 75, 75, .35);
}
.jp-entry--house + .jp-entry,
.jp-entry + .jp-entry--house { border-top: 0; }
.jp-entry__name--house { color: var(--red); letter-spacing: .08em; flex: 1; }
.jp-entry__pct--house { color: var(--red); }

/* resolve: winner glows, everyone else dims */
.jp-entries.is-done .jp-entry { opacity: .38; }
.jp-entries.is-done .jp-entry.is-winner {
  opacity: 1;
  box-shadow: 0 0 0 1.5px var(--green), 0 0 18px -2px rgba(53, 196, 111, .5);
  background: rgba(53, 196, 111, .08);
}
#jp-modal.jp--house .jp-entries.is-done .jp-entry--house { opacity: 1; box-shadow: 0 0 0 1.5px var(--red), 0 0 18px -2px rgba(225, 75, 75, .4); }

.jp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
#jp-created { color: var(--muted-2); font-size: 12px; font-weight: 700; }

/* — deposit picker + fairness stack above the round modal — */
#jp-pick-modal { z-index: 120; }
#jp-fair-modal { z-index: 130; }
#jp-pick-modal .inv-grid { max-height: 300px; }
#jp-pick-info { font-size: 14px; font-weight: 800; color: var(--gold-2); }

/* — fairness segments table — */
.jp-fair-segs__title {
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.jp-fair-segs { display: flex; flex-direction: column; gap: 5px; max-height: 200px; overflow-y: auto; }
.jp-fair-seg {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bubble);
  border-radius: var(--r-btn);
  padding: 7px 10px;
  font-size: 12px;
}
.jp-fair-seg__chip { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.jp-fair-seg__name {
  font-weight: 800;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jp-fair-seg__band { flex: none; color: var(--blue-text); font-size: 11px; background: rgba(7, 11, 22, .6); border-radius: 5px; padding: 2px 7px; }
.jp-fair-seg__val { flex: none; color: var(--muted); font-size: 11px; font-weight: 700; }

/* — responsive: stack the wheel above the entries on narrow screens — */
@media (max-width: 980px) {
  .jp-body { grid-template-columns: 1fr; }
  .jp-entries { min-height: 0; }
}
@media (max-width: 880px) {
  .modal__panel--jackpot { padding: 22px 16px 14px; }
  .jp-wheel-wrap { width: 250px; height: 250px; }
  .jp-hub { width: 92px; height: 92px; }
  .jp-card { flex-wrap: wrap; }
  .jp-card__actions { width: 100%; justify-content: flex-start; }
}

/* ==========================================================================
   V6 — PROFILE · MARKETPLACE · INFO PAGES (§6/§7/§8, profile-market)
   ========================================================================== */

/* — clickable player identities (names/avatars that open a public profile) — */
.plink { cursor: pointer; }
span.plink:hover, .chat-msg__name.plink:hover, .gm-team-player__name.plink:hover,
.jp-entry__name.plink:hover, #gm-l-name.plink:hover, #gm-r-name.plink:hover {
  color: var(--blue-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
img.plink { transition: filter .15s, transform .12s; }
img.plink:hover { filter: brightness(1.25); transform: translateY(-1px); }
.row__avatar.plink:hover, .row__opp.plink:hover, .jp-slot.plink:hover { filter: brightness(1.2); }

/* — static (read-only) grid cells: browsable, never selectable — */
.inv-item--static { cursor: default; }
.inv-item--static:hover { background: #0d1326; transform: none; }

/* — public profile modal + own-profile section share the .pf-* pieces — */
#profile-modal { z-index: 140; }   /* stacks above game/jackpot modals */
.modal__panel--profile { width: 720px; }
.pf-body { min-height: 120px; }

.pf-head {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(120deg, rgba(47, 123, 246, .10), rgba(47, 123, 246, 0) 55%), var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-panel);
  padding: 18px 22px;
  margin-bottom: 14px;
}
.pf-avatar {
  width: 76px; height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--blue);
  background: var(--bubble);
  flex: none;
}
.pf-id { flex: 1; min-width: 0; }
.pf-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.pf-name__text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-you {
  flex: none;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--blue-text);
  background: rgba(47, 123, 246, .16);
  border: 1px solid rgba(47, 123, 246, .45);
  border-radius: 999px;
  padding: 2px 8px;
}
.pf-joined { color: var(--muted-2); font-size: 12px; font-weight: 700; margin-top: 5px; }
.pf-worth { text-align: right; flex: none; }
.pf-worth b { display: block; font-size: 21px; font-weight: 800; color: var(--gold-2); }
.pf-worth span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.pf-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.pf-stat {
  background: rgba(13, 19, 38, .7);
  border: 1px solid rgba(26, 33, 56, .8);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  min-width: 0;
}
.pf-stat b {
  display: block;
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pf-stat span {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.pf-inv-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 10px;
  font-size: 14px;
  font-weight: 800;
}
.pf-inv-count { color: var(--muted-2); font-size: 11.5px; font-weight: 700; }
.pf-body .pf-inv-grid { max-height: 300px; }
#profile-root .pf-inv-grid { max-height: 520px; }

/* — marketplace scaffold (§6) — */
.pm-cta {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 26px 28px;
  margin-bottom: 22px;
  border-radius: var(--r-panel);
  border: 1px solid var(--line);
  background:
    radial-gradient(420px 140px at 88% 0%, rgba(240, 162, 29, .12), transparent 70%),
    linear-gradient(120deg, rgba(47, 123, 246, .14), rgba(47, 123, 246, 0) 55%),
    var(--panel);
  overflow: hidden;
}
.pm-cta__badge {
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .1em;
  color: var(--gold-2);
  background: rgba(240, 162, 29, .14);
  border: 1px solid rgba(240, 162, 29, .45);
  border-radius: 999px;
  padding: 3px 10px;
}
.pm-cta__title { font-size: 21px; font-weight: 900; letter-spacing: -.3px; }
.pm-cta__sub {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  max-width: 560px;
}
.pm-cta .btn { margin-top: 6px; }

.pm-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.pm-toolbar__title { font-size: 14px; font-weight: 800; }
.pm-count { color: var(--muted-2); font-size: 11.5px; font-weight: 700; }
.pm-search {
  margin-left: auto;
  background: var(--bubble);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 600;
  width: 230px;
  max-width: 100%;
}
.pm-search::placeholder { color: var(--muted-2); }
.pm-search:focus { border-color: rgba(47, 123, 246, .6); outline: none; }
#market-root .pm-grid { max-height: 560px; }

/* — info modal: Rules / Provably Fair / TOS / AML / Support (§8) — */
#info-modal { z-index: 150; }      /* readable on top of anything */
.modal__panel--info { width: 620px; }
.info-body {
  max-height: 64vh;
  overflow-y: auto;
  padding-right: 6px;
}
.info-body h3 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--blue-text);
  margin: 16px 0 8px;
}
.info-body h3:first-child { margin-top: 0; }
.info-body p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.7;
  margin-bottom: 10px;
}
.info-body ul {
  margin: 2px 0 14px;
  padding-left: 20px;
}
.info-body li {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
  margin-bottom: 7px;
}
.info-body li::marker { color: var(--blue); }
.info-actions { margin-top: 14px; }

@media (max-width: 720px) {
  .pf-head { flex-wrap: wrap; }
  .pf-worth { text-align: left; }
  .pm-search { margin-left: 0; width: 100%; }
}
