:root{
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";

  /* Argon palette (accent + light base) */
  /* Darker forest green accents */
  --argon-forest: #1b5f3f;
  --argon-forest-2: #1f6f45;
  --argon-beige: #f3f0e8;
  --argon-ink: #0a0f0d;

  /* Dark mode base (fintech) */
  --bg: #0b0f14;
  --panel: #0f1620;
  --panel-2: #0c121a;
  --text: #e7edf5;
  --muted: #9aa8ba;
  --border: rgba(231,237,245,.10);
  --border-2: rgba(231,237,245,.16);
  --shadow: 0 10px 35px rgba(0,0,0,.40);

  --accent: var(--argon-forest-2);
  --accent-2: #4fcf8a;
  /* Shared green for rgba(..., alpha) — overridden slightly darker in light theme */
  --accent-rgb: 31, 111, 69;
  --accent-mint-rgb: 79, 207, 138;

  --danger: #ff5a70;
  --warn: #f6c177;
  --ok: #34d399;

  --radius: 14px; /* rounded containers/cards */
  --radius-soft: 999px; /* pills */
  --radius-sm: 10px;
  --radius-lg: 18px;

  /* Focus ring used by buttons, links, nav items, inputs */
  --ring: 0 0 0 3px rgba(var(--accent-rgb), .28);
  --ring-strong: 0 0 0 4px rgba(var(--accent-rgb), .35);

  --t-fast: 120ms cubic-bezier(.2, .6, .3, 1);
  --t-med: 180ms cubic-bezier(.2, .6, .3, 1);
}

html[data-theme="light"]{
  --bg: var(--argon-beige);
  --panel: rgba(255,255,255,.65);
  --panel-2: rgba(255,255,255,.45);
  --text: #0f1720;
  --muted: rgba(15,23,32,.60);
  --border: rgba(15,23,32,.10);
  --border-2: rgba(15,23,32,.14);
  --shadow: 0 12px 40px rgba(15,23,32,.10);
  /* Very slightly darker forest + mint so accents stay crisp on beige */
  --argon-forest: #174a34;
  --argon-forest-2: #1b5a3d;
  --accent: var(--argon-forest-2);
  --accent-2: #42b87a;
  --accent-rgb: 27, 104, 65;
  --accent-mint-rgb: 62, 188, 124;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-sans);
  color: var(--text);
  /* Fixed to viewport so long pages do not “drift” into untinted regions (looked like the whole UI darkened when scrolling). */
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 800px at 15% 0%, rgba(var(--accent-mint-rgb),.08), transparent 55%),
    radial-gradient(900px 700px at 85% 30%, rgba(var(--accent-rgb),.10), transparent 60%);
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
}

/* Light theme: remove green "wash" from page background */
html[data-theme="light"] body{
  background-image: radial-gradient(900px 700px at 15% 0%, rgba(15,23,32,.05), transparent 55%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a{ color:inherit; text-decoration:none; }
button, input, select, textarea{ font-family: inherit; }

.app-shell{
  min-height:100%;
  display:flex;
  align-items:stretch;
}

.loading{
  margin:auto;
  text-align:center;
  border:1px solid var(--border);
  border-radius: var(--radius);
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  padding:28px 26px;
  box-shadow: var(--shadow);
}
.loading__brand{
  letter-spacing:.08em;
  font-weight:700;
  text-transform:uppercase;
}
.loading__sub{
  margin-top:10px;
  color: var(--muted);
  font-size: 13px;
}

.layout{
  display:flex;
  width:100%;
  min-height: 0;
}

.sidebar-backdrop{
  display: none;
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.mobile-menu-toggle{
  display: none;
  order: -1;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: inherit;
  cursor: pointer;
}
.mobile-menu-toggle:hover{
  border-color: var(--border-2);
  background: rgba(255,255,255,.08);
}
.mobile-menu-toggle .nav-icon--menu{
  width: 20px;
  height: 20px;
}

.sidebar{
  width: 18%;
  min-width: 260px;
  max-width: 320px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  padding: 18px 16px;
  position: sticky;
  top:0;
  height: 100vh;
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.sidebar__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 4px 0;
}
.sidebar__close-mobile{
  display: none;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  flex: 1;
  min-width: 0;
}
.brand__text{
  font-weight:700;
  letter-spacing:.06em;
  text-transform:uppercase;
  font-size: 13px;
}

.section-label{
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity:.9;
  padding: 6px 10px;
}

.nav{
  display:flex;
  flex-direction:column;
  gap: 6px;
  padding: 0 6px;
}
.nav-item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 10px;
  border: 1px solid transparent;
  color: rgba(231,237,245,.88);
  cursor:pointer;
  user-select:none;
}
html[data-theme="light"] .nav-item{ color: rgba(15,23,32,.82); }
.nav-item:hover{
  background: rgba(255,255,255,.03);
  border-color: var(--border);
}
.nav-item[aria-current="page"]{
  border-color: rgba(var(--accent-rgb),.50);
  background: rgba(var(--accent-rgb),.12);
}
.nav-icon{
  width:16px; height:16px;
  opacity:.9;
}
.nav-text{
  font-size: 13px;
  font-weight: 600;
  opacity:.95;
}

.groups{
  display:flex;
  flex-direction:column;
  gap: 6px;
  padding: 0 6px;
}

.group-pill{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 10px;
  border: 1px solid transparent;
  cursor:pointer;
  position: relative;
}
.group-pill__code{
  font-size: 11px;
  letter-spacing: .08em;
  opacity: .85;
}
.dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3b5c;
  box-shadow: 0 0 0 4px rgba(255,59,92,.14);
  display:inline-block;
}
.group-pill__dot{
  position:absolute;
  right: 8px;
  top: 8px;
  left: auto;
  transform: none;
}
.group-pill--unread{
  padding-right: 30px;
}
.group-pill:hover{
  border-color: var(--border);
  background: rgba(255,255,255,.03);
}
.group-pill[aria-current="true"]{
  border-color: rgba(var(--accent-rgb),.50);
  background: rgba(var(--accent-rgb),.12);
}
.group-pill__name{
  font-size: 13px;
  font-weight: 650;
}
.group-pill__meta{
  font-size: 12px;
  color: var(--muted);
}

.sidebar__bottom{
  margin-top:auto;
  padding: 10px 6px 6px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.sidebar-link{
  font-size: 12px;
  color: var(--muted);
  text-decoration: underline;
  padding: 2px 4px;
  width: fit-content;
  align-self: center;
}
.sidebar-link:hover{
  color: var(--text);
}

.btn{
  appearance:none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 650;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
}
a.btn{ text-decoration: none; box-sizing: border-box; }
.btn:hover{ border-color: var(--border-2); }
.btn--primary{
  border-color: rgba(var(--accent-rgb),.55);
  background: linear-gradient(180deg, rgba(var(--accent-rgb),.30), rgba(var(--accent-rgb),.12));
}
.btn--danger{
  border-color: rgba(255,90,112,.45);
  background: rgba(255,90,112,.10);
}
.btn--ghost{
  border-color: transparent;
  background: transparent;
}
.btn--small{ padding: 8px 10px; font-size: 12px; }

.main{
  width: 82%;
  padding: 22px 24px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.breadcrumb{
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  order: 0;
}
.breadcrumb a:hover{ text-decoration: underline; }

.userbox{
  order: 1;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 6px 0px;
}
.avatar{
  width: 26px; height: 26px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight: 750;
  font-size: 12px;
  color: rgba(255,255,255,.92);
  /* Solid fill — gradient looked like a bug on initials avatars (lighter band at bottom). */
  background-color: var(--accent);
  border:1px solid rgba(255,255,255,.12);
  overflow: hidden;
}
html[data-theme="light"] .avatar{ color: rgba(255,255,255,.95); }
.avatar--btn{
  padding:0;
  cursor:pointer;
  position: relative;
  border: none;
}
.avatar__img{
  width:100%;
  height:100%;
  border-radius: 999px;
  object-fit: cover;
  display:block;
}
.avatar__edit{
  position:absolute;
  right:-4px;
  top:-4px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15,22,32,.92);
  color: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
}
html[data-theme="light"] .avatar__edit{
  background: rgba(15,23,32,.92);
}
.avatar__notify-dot{
  position: absolute;
  left: -2px;
  top: -2px;
  z-index: 3;
}
.nav-item--with-badge{
  position: relative;
}
.nav-item__dot{
  position: absolute;
  right: 6px;
  top: 8px;
}
.nav-item--unread{
  padding-right: 22px;
}
/* Arbiting list: unread dot sits top-right above the Open action (see .arbiting-row__actions) */
.arbiting-row__actions{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.arbiting-row__actions .arbiting-row__dot{
  flex-shrink: 0;
}
.userbox__name{
  font-size: 13px;
  font-weight: 650;
}
.userbox__actions{
  display:flex;
  align-items:center;
  gap: 6px;
}

.card{
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.03);
  box-shadow: var(--shadow);
}
.card--hero{
  --hero-icon-width: 40px;
  --hero-icon-gap: 14px;
  --hero-text-gutter: calc(var(--hero-icon-width) + var(--hero-icon-gap));
  padding: 18px 18px;
  display:flex;
  align-items: stretch;
  justify-content:space-between;
  gap: 16px;
}
.hero__left{
  display:flex;
  gap: var(--hero-icon-gap);
  align-items:flex-start;
  flex: 1 1 auto;
  min-width: 0;
}
.hero__right{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  flex: 0 0 min(220px, 32%);
  min-width: 0;
}
.hero__actions{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
}
.hero__primary-actions{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
}
.hero__primary-actions > .btn{
  flex: 1 1 0;
  min-height: 44px;
}
.hero__action--secondary{
  flex: 0 0 auto;
}
.hero__body{
  min-width: 0;
  flex: 1 1 auto;
}
.hero__title-row{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__title-row .hero__title{
  flex: 1 1 auto;
  min-width: 0;
}
.hero__invite-btn{
  flex: 0 0 auto;
}
.hero__icon{
  width: var(--hero-icon-width);
  height: var(--hero-icon-width);
  flex: 0 0 var(--hero-icon-width);
  display:grid;
  place-items:center;
  border:1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  color: var(--accent-2);
  font-weight: 800;
}
.hero__icon--btn{
  cursor:pointer;
  line-height: 1;
  font-size: 18px;
  position: relative;
}
.hero__icon--btn:hover{
  background: rgba(255,255,255,.03);
  border-color: var(--border-2);
}
.hero__icon--btn::after{
  content: "✎";
  position: absolute;
  right: -6px;
  top: -6px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: rgba(255,255,255,.10);
  border: 1px solid var(--border);
  color: rgba(231,237,245,.92);
}
html[data-theme="light"] .hero__icon--btn::after{
  background: rgba(255,255,255,.70);
  border-color: rgba(15,23,32,.14);
  color: rgba(15,23,32,.80);
}

.emoji-grid{
  display:grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.emoji-cell{
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-size: 20px;
  cursor:pointer;
}
.emoji-cell:hover{
  background: rgba(255,255,255,.03);
  border-color: var(--border-2);
}
@media (max-width: 720px){
  .emoji-grid{ grid-template-columns: repeat(6, 1fr); }
}
.hero__title{
  font-size: 20px;
  font-weight: 750;
  letter-spacing:-.02em;
}
.hero__sub{
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}
.pills{
  display:flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap:wrap;
}
.pill{
  border-radius: var(--radius-soft);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.02);
}
.pill--accent{
  border-color: rgba(var(--accent-rgb),.55);
  color: rgba(91,210,143,.92);
  background: rgba(var(--accent-rgb),.12);
}

.tabs{
  display:flex;
  gap: 14px;
  margin-top: 16px;
  border-bottom:1px solid var(--border);
}
.tab{
  padding: 10px 4px 12px;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  cursor:pointer;
  border-bottom: 2px solid transparent;
}
.tab[aria-selected="true"]{
  color: var(--text);
  border-bottom-color: rgba(var(--accent-rgb),.92);
}

.content{
  margin-top: 16px;
  padding: 14px 14px;
}

.table{
  width:100%;
  border-collapse: collapse;
}
.table--fixed{
  table-layout: fixed;
}
.table--fixed td,
.table--fixed th{
  vertical-align: middle;
}
.table--fixed .right{
  font-variant-numeric: tabular-nums;
}
.table th{
  text-align:left;
  font-size: 11px;
  letter-spacing:.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.table td{
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.wallet-stack{
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

/* Inset scroll regions share one surface color (home groups, bet history, recommended friends). */
.scroll-surface{
  background: var(--panel-2);
  scrollbar-color: var(--border) var(--panel-2);
}
.scroll-surface::-webkit-scrollbar{
  width: 8px;
  height: 8px;
}
.scroll-surface::-webkit-scrollbar-track{
  background: var(--panel-2);
}
.scroll-surface::-webkit-scrollbar-thumb{
  background: var(--border);
  border-radius: 6px;
}

.wallet-ledger-scroll{
  max-height: 19rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.wallet-ledger-scroll .table{
  margin: 0;
  background: transparent;
}
.wallet-ledger-scroll .table tbody,
.wallet-ledger-scroll .table tbody tr,
.wallet-ledger-scroll .table tbody td{
  background: transparent;
}
.wallet-ledger-scroll thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  /* Opaque bar so scrolling rows never show through the header */
  background-color: var(--panel);
  color: var(--muted);
  box-shadow: 0 1px 0 var(--border);
}
html[data-theme="light"] .wallet-ledger-scroll thead th{
  /* Match other sticky headers; avoid cream #f2efe8 vs panel-2 body mismatch */
  background-color: var(--panel);
  color: var(--muted);
}

/* Wallet bet history — higher-contrast type */
.wallet-history-head{
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
}
.wallet-history-card .wallet-ledger-scroll .wallet-ledger-table th{
  color: color-mix(in srgb, var(--text) 58%, var(--muted));
  font-weight: 850;
  border-bottom-color: var(--border-2);
}
.wallet-history-card .wallet-ledger-scroll .wallet-ledger-table td{
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
}
.wallet-ledger-when{
  color: color-mix(in srgb, var(--text) 76%, var(--muted)) !important;
  font-weight: 550;
}
.wallet-ledger-type{
  font-weight: 650;
}
.wallet-ledger-note{
  margin-top: 4px;
  font-size: 12px;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
  font-weight: 500;
}
.wallet-ledger-amt{
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
html[data-theme="light"] .wallet-ledger-amt--neg{
  color: #b42338;
}
html[data-theme="light"] .wallet-ledger-amt--pos{
  color: #0f5c3d;
}
.wallet-ledger-amt--neg{
  color: color-mix(in srgb, var(--danger) 92%, var(--text));
}
.wallet-ledger-amt--pos{
  color: color-mix(in srgb, var(--ok) 92%, var(--text));
}
.right{ text-align:right; }
.leaderboard-table th.leaderboard-num,
.leaderboard-table td.leaderboard-num{
  text-align:center;
}
.muted{ color: var(--muted); }
.hint{
  font-size: 12px;
  line-height: 1.35;
}

.recommend-sent-btn{
  min-width: 42px;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
}
.recommend-friend-list .recommend-friend-row{
  align-items: center;
}
.recommend-friend-list--scroll{
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
}
@media (max-width: 520px){
  .recommend-friend-list--scroll{ max-height: 300px; }
}

.row-action{
  display:flex;
  gap: 8px;
  justify-content:flex-end;
}

.grid2{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
  align-items: stretch;
}

.form{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.field label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea{
  width:100%;
  padding: 10px 10px;
  border:1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  outline:none;
}
.field-static{
  width: 100%;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  font-weight: 650;
  font-size: 13px;
  line-height: 1.2;
}
html[data-theme="light"] .field-static{
  background: rgba(255,255,255,.60);
  border-color: rgba(15,23,32,.10);
  color: rgba(15,23,32,.92);
}
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea{
  background: rgba(255,255,255,.60);
}
.field textarea{ resize: vertical; min-height: 88px; }

.kpi{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  padding: 10px 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.kpi__label{ color: var(--muted); font-size: 12px; }
.kpi__value{ font-weight: 750; letter-spacing:-.02em; }

.auth{
  width: 100%;
  max-width: 980px;
  margin: 60px auto;
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 14px;
  padding: 0 18px;
}
.auth__panel{ padding: 18px 18px; }
.auth__title{ font-size: 26px; font-weight: 800; letter-spacing:-.03em; }
.auth__subtitle{ margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth__fineprint{ margin-top: 10px; color: var(--muted); font-size: 12px; }
.auth__feature{
  padding: 18px 18px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.auth__feature h3{ margin:0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.auth__feature ul{ margin: 10px 0 0; padding-left: 16px; color: rgba(231,237,245,.86); }
html[data-theme="light"] .auth__feature ul{ color: rgba(15,23,32,.82); }
.auth__feature li{ margin: 8px 0; font-size: 13px; line-height: 1.4; }

.auth--simple{
  width: min(1100px, calc(100vw - 36px));
  margin: clamp(24px, 6vh, 72px) auto;
  display:flex;
  justify-content:center;
}
.auth__panel--simple{
  width: 100%;
  padding: clamp(16px, 2.2vw, 26px);
  background: radial-gradient(900px 420px at 10% 0%, rgba(var(--accent-rgb),.12), transparent 60%),
              linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
}
.auth__brand{
  display:flex;
  flex-direction:column;
  gap: 6px;
}
.auth__tabs{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  margin-top: 14px;
}
.auth__actions{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin-top: 10px;
}

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.70);
  backdrop-filter: blur(6px);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 1000;
}
.modal-backdrop[aria-hidden="false"]{ display:flex; }
.modal-backdrop::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background: radial-gradient(900px 600px at 20% 10%, rgba(var(--accent-rgb),.12), transparent 55%);
}
.modal{
  width: min(680px, 96vw);
  position: relative;
  border:1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.modal__header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.modal__title{
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -.02em;
}
.modal__body{ padding: 14px 16px 16px; }
.modal__close{
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display:grid;
  place-items:center;
}
.modal__grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal__footer{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  padding-top: 10px;
}

/* Ensure consistent modal field contrast */
.modal .field input,
.modal .field select,
.modal .field textarea{
  background: var(--panel-2);
  border-color: var(--border-2);
}
.modal .field input::placeholder,
.modal .field textarea::placeholder{
  color: rgba(154,168,186,.75);
}
html[data-theme="light"] .modal-backdrop{
  background: rgba(15,23,32,.32);
}
html[data-theme="light"] .modal{
  background: rgba(255,255,255,.92);
}
html[data-theme="light"] .modal .field input,
html[data-theme="light"] .modal .field select,
html[data-theme="light"] .modal .field textarea{
  background: rgba(255,255,255,.92);
  border-color: rgba(15,23,32,.14);
  color: rgba(15,23,32,.92);
}

.chat-thread{
  display:flex;
  flex-direction:column;
  gap: 10px;
  max-height:360px;
  overflow:auto;
  padding-right:4px;
}
.chat-bubble{
  max-width: 88%;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 12px 14px;
  background: rgba(255,255,255,.045);
}
.chat-bubble--me{
  margin-left: auto;
  background: rgba(255,255,255,.045);
  border-color: var(--border);
}
.chat-meta{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.chat-name{ font-weight: 800; font-size: 12px; letter-spacing:.02em; }
.chat-time{ font-size: 12px; color: var(--muted); }
.chat-text{ font-size: 13px; line-height: 1.45; }

.market-hero{
  padding: 22px 22px;
  background: radial-gradient(900px 420px at 10% 0%, rgba(var(--accent-rgb),.12), transparent 60%),
              linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
}
.market-card{
  /* Reduce green cast on long pages */
  background: radial-gradient(900px 420px at 10% 0%, rgba(255,255,255,.03), transparent 60%),
              linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
}
.market-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}
.market-card__title{
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -.03em;
  line-height: 1.12;
}
.market-card__desc{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.market-meta{
  margin-top: 12px;
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  align-items:center;
}

.chance{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.chance__label{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 900;
}
.chance__bar{
  margin-top: 10px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow:hidden;
  display:flex;
  background: rgba(255,255,255,.02);
}
.chance__yes{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  padding-left: 12px;
  background: rgba(var(--accent-rgb),.30);
  color: rgba(231,237,245,.94);
  font-weight: 950;
}
.chance__no{
  flex: 1 1 auto;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding-right: 12px;
  background: rgba(255,90,112,.24);
  color: rgba(231,237,245,.92);
  font-weight: 950;
}
.chance__sub{
  margin-top: 10px;
  display:flex;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
  color: var(--muted);
  font-size: 13px;
}

.bet-box{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.bet-box__top{
  display:flex;
  justify-content:space-between;
  gap: 10px;
  flex-wrap:wrap;
  align-items:flex-end;
}
.bet-box__title{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 950;
}
.pick-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pick-btn{
  text-align:left;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.70);
  cursor:pointer;
}
.pick-btn:hover{ background: rgba(255,255,255,.03); }
.pick-btn[disabled]{ opacity:.55; cursor:not-allowed; }
.pick-btn__head{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap: 10px;
}
.pick-btn__label{
  font-weight: 950;
  letter-spacing: -.02em;
  font-size: 14px;
}
.pick-btn__odds{
  font-weight: 950;
  font-size: 14px;
  color: rgba(15,23,32,.92);
}
.pick-btn__preview{
  margin-top: 10px;
  font-size: 13px;
  color: rgba(15,23,32,.70);
  font-weight: 850;
}
.pick-btn--yes{
  border-color: rgba(var(--accent-rgb),.35);
  color: rgba(var(--accent-rgb),.92);
}
.pick-btn--no{
  border-color: rgba(255,90,112,.30);
  color: rgba(255,90,112,.92);
}
.pick-btn--yes.pick-btn--active{
  border-color: rgba(var(--accent-rgb),.60);
  background: rgba(var(--accent-rgb),.92);
  color: rgba(255,255,255,.96);
  box-shadow: none;
}
.pick-btn--no.pick-btn--active{
  border-color: rgba(255,90,112,.60);
  background: rgba(255,90,112,.90);
  color: rgba(255,255,255,.96);
  box-shadow: none;
}
.pick-btn--active .pick-btn__odds{ color: rgba(255,255,255,.95); }
.pick-btn--active .pick-btn__preview{ color: rgba(255,255,255,.85); }
.pill--yes{
  border-color: rgba(var(--accent-rgb),.55);
  background: rgba(var(--accent-rgb),.12);
  color: rgba(91,210,143,.92);
}
.pill--no{
  border-color: rgba(255,90,112,.40);
  background: rgba(255,90,112,.10);
  color: rgba(255,90,112,.92);
}
.admin-box{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.admin-box summary{
  cursor:pointer;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

.depth{
  border:1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.depth__head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap: 10px;
  flex-wrap:wrap;
}
.depth__title{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 950;
}

.depth-table{
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow:hidden;
  background: rgba(255,255,255,.01);
}
.depth-table__head{
  display:grid;
  grid-template-columns: 1fr .8fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.depth-table__h{
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 950;
}
.depth-table__h--bid{ text-align:right; }
.depth-table__h--price{ text-align:center; }
.depth-table__h--ask{ text-align:left; }

.depth-table__row{
  position:relative;
  display:grid;
  grid-template-columns: 1fr .8fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  overflow:hidden;
}
.depth-table__row:last-child{ border-bottom:none; }
.depth-table__row--best{
  background: rgba(255,255,255,.03);
}
.depth-table__bar{
  position:absolute;
  top:0; bottom:0;
  opacity:.65;
  pointer-events:none;
}
.depth-table__bar--bid{
  left:0;
  background: rgba(var(--accent-rgb),.18);
}
.depth-table__bar--ask{
  right:0;
  background: rgba(255,90,112,.14);
}
.depth-table__cell{
  position:relative;
  z-index:1;
  font-size: 13px;
  font-weight: 900;
}
.depth-table__cell--bid{
  text-align:right;
  color: rgba(var(--accent-rgb),.92);
}
.depth-table__cell--price{
  text-align:center;
  color: var(--text);
}
.depth-table__cell--ask{
  text-align:left;
  color: rgba(255,90,112,.92);
}

.order-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.order-tabs{ display:flex; gap: 8px; flex-wrap:wrap; }

@media (max-width: 720px){
  .pick-grid{ grid-template-columns: 1fr; }
  .order-grid{ grid-template-columns: 1fr; }
  .chance__bar{ height: 34px; }
  .market-card__title{ font-size: 22px; }
}
.market-title{
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.05;
}
.market-sub{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.status-pill{
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .10em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.status-pill--open{
  border-color: rgba(var(--accent-rgb),.38);
  background: rgba(var(--accent-rgb),.16);
  color: rgba(91,210,143,.92);
}
.prob{
  margin-top: 14px;
}
.prob__label{
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
}
.prob__bar{
  height: 12px;
  border-radius: 999px;
  margin-top: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  overflow:hidden;
}
.prob__fill{
  height:100%;
  background: linear-gradient(90deg, rgba(var(--accent-rgb),.92), rgba(var(--accent-mint-rgb),.55));
}
.prob__ends{
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.big-cta{
  width:100%;
  padding: 16px 14px;
  font-size: 16px;
  font-weight: 850;
  border-radius: 14px;
}

.mini-list{
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.mini-card{
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  cursor:pointer;
}
.mini-card:hover{
  border-color: var(--border-2);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
.mini-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 12px;
}
.mini-title{
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.08;
}
.mini-sub{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.mini-row{
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.mini-row b{ color: rgba(231,237,245,.92); }
html[data-theme="light"] .mini-row b{ color: rgba(15,23,32,.92); }
.mini-prob{
  margin-top: 12px;
}
.mini-prob .prob__bar{ height: 10px; }
.mini-prob .prob__label{ font-size: 12px; }
.mini-prob .prob__ends{ font-size: 12px; }

/* Friend pickers (create group modal, group members “Add people”): full-width row, checkbox flush right. */
.member-pick-row.list-link{
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
.member-pick-row__text{
  min-width: 0;
  flex: 1 1 auto;
}
.member-pick-row__check-wrap{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  align-self: center;
  min-height: 40px;
}
.member-pick-row__check{
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.list-link{
  display:flex;
  flex-direction:column;
  gap: 2px;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor:pointer;
}
.list-link:hover{
  background: rgba(255,255,255,.03);
  border-color: var(--border);
}
.list-link[aria-current="true"]{
  background: rgba(var(--accent-rgb),.12);
  border-color: rgba(var(--accent-rgb),.28);
}
.list-title{ font-weight: 850; font-size: 13px; }
.list-sub{ font-size: 12px; color: var(--muted); }

.row-list{
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow:hidden;
}
.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  cursor:pointer;
  background: rgba(255,255,255,.01);
}
.row:last-child{ border-bottom: none; }
.row:hover{ background: rgba(255,255,255,.03); }
.row[aria-current="true"]{
  background: rgba(var(--accent-rgb),.12);
}
.row__left{ display:flex; flex-direction:column; gap: 2px; }
.row__name{ font-weight: 900; font-size: 13px; }
.row__sub{ color: var(--muted); font-size: 12px; }
.row__right{ display:flex; align-items:center; gap: 10px; }

/* Market bet rows */
.bet-row{
  padding: 12px 14px;
}
.bet-row__head{
  display:flex;
  align-items:center;
  gap: 10px;
}
.bet-row__amt{
  font-weight: 950;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.bet-row__kpi{
  text-align:right;
  min-width: 132px;
}
.bet-row__kpiLabel{
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
}
.bet-row__kpiValue{
  margin-top: 4px;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.row__dot{
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ff3b5c;
  box-shadow: 0 0 0 4px rgba(255,59,92,.14);
}
.pnl{ font-weight: 900; }
.pnl--pos{ color: var(--ok); }
.pnl--neg{ color: var(--danger); }

.friends-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  padding: 0 2px;
  margin-bottom: 10px;
}
.friends-head__label{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 850;
}

/* Inset panel cards — blend with the body surface so they read as the same shade as everything around them. */
.home-groups-card,
.home-recent-bets,
.wallet-history-card{
  background: var(--bg);
  border-color: var(--border);
}
.home-groups-card.card.content,
.wallet-history-card.card.content{
  box-shadow: none;
}
/* Inner scroll surfaces sit on top of the section card; keep them transparent so they inherit the darker container shade. */
.home-groups-card .home-groups,
.wallet-history-card .wallet-ledger-scroll{
  background: transparent;
}
.home-groups-card .home-groups::-webkit-scrollbar-track,
.wallet-history-card .wallet-ledger-scroll::-webkit-scrollbar-track{
  background: transparent;
}

.home-groups{
  display:flex;
  flex-direction:column;
  gap: 10px;
  max-height: 220px; /* ~2 rows, then scroll */
  overflow:auto;
  padding: 8px 6px 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Home My Stats — recent bet rows: question left, YES + amount right */
.home-recent-bets{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px;
}
.home-recent-bet{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.home-recent-bet:last-child{ border-bottom: none; padding-bottom: 0; }
.home-recent-bet:first-child{ padding-top: 0; }
.home-recent-bet__main{
  min-width: 0;
  flex: 1 1 auto;
}
.home-recent-bet__side{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-align: right;
}

/* Home: Your groups + Recent bets — darker secondary type (esp. light theme) */
.home-groups-head,
.home-recent-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.home-groups-head__title,
.home-recent-head__title{
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 900;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}
.home-groups-head__meta,
.home-recent-head__link{
  font-size: 12px;
  font-weight: 650;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  text-decoration: none;
}
.home-recent-head__link{
  text-decoration: underline;
  text-underline-offset: 2px;
}
.home-recent-bet__date{
  margin-top: 4px;
  font-size: 12px;
  color: color-mix(in srgb, var(--text) 74%, var(--muted));
}
.home-recent-empty{
  color: color-mix(in srgb, var(--text) 70%, var(--muted));
  font-size: 13px;
}
html[data-theme="light"] .home-groups-card .home-group__desc{
  color: rgba(15, 23, 32, 0.78);
}
html[data-theme="light"] .home-groups-card .home-group .pill{
  color: rgba(15, 23, 32, 0.72);
  border-color: rgba(15, 23, 32, 0.18);
  background: rgba(255, 255, 255, 0.5);
}
html[data-theme="light"] .home-groups-card .home-group{
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(15, 23, 32, 0.14);
}
html[data-theme="light"] .home-groups-card .home-group:hover{
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(15, 23, 32, 0.2);
}
html[data-theme="dark"] .home-groups-card .home-group .pill{
  color: color-mix(in srgb, var(--text) 58%, var(--muted));
  border-color: var(--border-2);
}
.home-groups-card .home-group__desc{
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
}

/* Wallet header row — wraps cleanly on phones */
.wallet-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.wallet-header__title{ min-width: 0; flex: 1 1 200px; }
.wallet-header__add{ flex: 0 0 auto; }
@media (max-width: 640px){
  .wallet-header__add{ width: 100%; }
}

/* Wallet — group P/L table: align header with numeric column */
.wallet-group-table th,
.wallet-group-table td{
  vertical-align: middle;
}
.wallet-group-table th.right,
.wallet-group-table td.right{
  text-align: right;
  padding-right: 12px;
  font-variant-numeric: tabular-nums;
}
.wallet-group-table th:first-child,
.wallet-group-table td:first-child{
  padding-left: 12px;
}
.home-group{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  text-decoration:none;
  color: var(--text);
}
.home-group:hover{
  background: rgba(255,255,255,.03);
  border-color: var(--border-2);
}
.home-group__name{
  font-weight: 950;
  letter-spacing:-.02em;
}
.home-group__desc{
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.home-group__meta{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
}
.home-group__right{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.home-group__arrow{
  color: var(--muted);
  opacity: 0.52;
  transform: translateX(0);
  transition: opacity var(--t-fast), transform var(--t-fast), color var(--t-fast);
  font-weight: 950;
}
.home-group:hover .home-group__arrow{
  opacity: 1;
  color: var(--text);
  transform: translateX(2px);
}
.empty{
  border: 1px dashed var(--border-2);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.02);
}
.empty__title{ font-weight: 950; }

.stats-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.stat-tile{
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.stat-label{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 950;
}
.stat-num{
  margin-top: 8px;
  font-size: 16px;
  font-weight: 950;
}
.stat-num--pos{ color: var(--ok); }
.stat-num--neg{ color: var(--danger); }
.mini-pnl{ font-weight: 950; }
.mini-pnl--pos{ color: var(--ok); }
.mini-pnl--neg{ color: var(--danger); }

.profile-card{
  border:1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  padding: 14px;
}
.profile-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.profile-identity{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
}
.profile-avatar{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight: 850;
  color: rgba(255,255,255,.92);
  background-color: var(--accent);
  border: 1px solid rgba(255,255,255,.14);
  flex: 0 0 auto;
  overflow: hidden;
}
.profile-name{
  font-size: 16px;
  font-weight: 850;
  letter-spacing:-.02em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.profile-username{
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.stat-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.stat{
  border:1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.015);
}
.stat__label{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 850;
}
.stat__value{
  margin-top: 6px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing:-.02em;
}

.dm-card{
  border:1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  padding: 14px;
  margin-top: 12px;
}
.dm-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.dm-title{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 850;
}
.chat-thread--dm{
  max-height: 320px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.14);
}
html[data-theme="light"] .chat-thread--dm{ background: rgba(255,255,255,.55); }
.dm-form{
  display:flex;
  gap: 10px;
  margin-top: 10px;
}
.dm-form input{
  flex: 1 1 auto;
  color: var(--text);
  caret-color: var(--text);
}
html[data-theme="light"] .dm-form input{
  color: rgba(15,23,32,.92);
  caret-color: rgba(15,23,32,.92);
}

.compose{
  align-items:stretch;
}
.add-friend-wrap{
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.compose--compact input{
  height: 42px;
  background: rgba(255,255,255,.035);
  border-color: rgba(255,255,255,.10);
  color: var(--text);
  caret-color: var(--text);
}
html[data-theme="light"] .compose--compact input{
  border-color: rgba(15,23,32,.14);
  color: rgba(15,23,32,.92);
  caret-color: rgba(15,23,32,.92);
}
.compose--compact .btn{
  height: 42px;
  padding: 0 14px;
}
.compose--embedded input{
  background: transparent;
  border-color: transparent;
  color: var(--text);
  caret-color: var(--text);
}
.compose--embedded input:focus{
  border-color: transparent;
  box-shadow: none;
}
html[data-theme="light"] .compose--embedded input{
  color: rgba(15,23,32,.92);
  caret-color: rgba(15,23,32,.92);
}
.compose--embedded{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  padding: 6px;
  background: rgba(255,255,255,.02);
}
html[data-theme="light"] .compose--embedded{
  border-color: rgba(15,23,32,.14);
  background: rgba(255,255,255,.60);
}

.notice{
  margin-top: 10px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
  color: var(--muted);
}
.notice--ok{ color: rgba(91,210,143,.92); }
.notice--err{ color: var(--danger); }
.compose input:focus{
  border-color: rgba(var(--accent-rgb),.55);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.16);
}
.compose input{
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.045);
  color: var(--text);
  caret-color: var(--text);
}
.compose input::placeholder{
  color: rgba(154,168,186,.75);
}
html[data-theme="light"] .compose input{
  background: rgba(255,255,255,.70);
  color: rgba(15,23,32,.92);
  caret-color: rgba(15,23,32,.92);
}
html[data-theme="light"] .compose input::placeholder{
  color: rgba(15,23,32,.45);
}
.compose .btn{
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
}

/* Friends page: full-width list on top; DM + profile in two columns below (desktop). */
.friends-layout{
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}
.friends-layout > .friends-top.card.content{
  margin-top: 0;
  width: 100%;
}
.friends-layout .card.content{
  padding: 16px 16px;
}
.friends-below{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
  width: 100%;
  min-width: 0;
}
.friends-below > .friends-profile.card.content{
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  box-sizing: border-box;
}
.friends-below > .friends-profile .profile-card{
  flex: 0 0 auto;
}
.friends-profile{
  min-height: 0;
}
.friends-dm{
  margin-top: 0;
  min-width: 0;
}
.friends-layout .friends-profile{
  display:flex;
  flex-direction:column;
}
.friends-layout .friends-profile > .profile-card{
  margin-top: 0;
}
/* DM + Profile: same title bar height; content starts on one horizontal line */
.friends-below .friends-pane-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
  margin-bottom: 10px;
}
.friends-below .chat-thread--dm{
  margin-top: 0;
}
@media (min-width: 921px){
  .friends-below{
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
@media (max-width: 920px){
  .friends-below{
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   UI polish pass — cohesive transitions, focus states, refined surfaces.
   Pure additions/overrides; safe to remove without breaking layout.
   ===================================================================== */

/* Reusable label style for section "eyebrows" (small uppercase tags). */
.eyebrow{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

/* Smooth, consistent transitions across interactive surfaces. */
.btn,
.nav-item,
.group-pill,
.tab,
.card,
.row,
.list-link,
.mini-card,
.home-group,
.stat-tile,
.stat,
.pick-btn,
.field input,
.field select,
.field textarea,
.compose input,
.pill,
.emoji-cell{
  transition: background-color var(--t-fast), border-color var(--t-fast),
              box-shadow var(--t-fast), transform var(--t-fast),
              color var(--t-fast);
}

/* Focus-visible: a single, accessible accent ring everywhere. */
.btn:focus-visible,
a.btn:focus-visible,
.nav-item:focus-visible,
.group-pill:focus-visible,
.tab:focus-visible,
.list-link:focus-visible,
.row:focus-visible,
.mini-card:focus-visible,
.home-group:focus-visible,
.pick-btn:focus-visible,
.emoji-cell:focus-visible,
.avatar--btn:focus-visible,
.modal__close:focus-visible{
  outline: none;
  box-shadow: var(--ring);
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.compose input:focus-visible,
.compose input:focus{
  outline: none;
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: var(--ring);
}

/* Buttons — slightly tighter feel + clearer primary hover. */
.btn{
  line-height: 1.1;
}
.btn:hover{
  background: rgba(255,255,255,.05);
}
.btn:active{ transform: translateY(1px); }
.btn--primary:hover{
  border-color: rgba(var(--accent-rgb), .70);
  background: linear-gradient(180deg, rgba(var(--accent-rgb),.42), rgba(var(--accent-rgb),.18));
}
.btn--danger:hover{
  border-color: rgba(255,90,112,.60);
  background: rgba(255,90,112,.16);
}
.btn--ghost:hover{
  background: rgba(255,255,255,.04);
}
.btn[disabled],
.btn[aria-disabled="true"]{
  opacity: .55;
  cursor: not-allowed;
}

/* Sidebar — rounded nav items and a calmer hover state. */
.nav-item{
  border-radius: 12px;
}
.nav-item:hover{
  background: rgba(255,255,255,.05);
}
.group-pill{
  border-radius: 12px;
}

/* Tabs — clearer hover + slightly thicker active underline. */
.tab:hover{ color: var(--text); }
.tab[aria-selected="true"]{
  border-bottom-width: 3px;
  margin-bottom: -1px;
}

/* Card hierarchy: nested cards stay flat so the outer card carries the elevation. */
.card .card{
  box-shadow: none;
}

/* Cards/rows hover affordance. */
.row{
  border-radius: 0;
}
.row:hover{
  background: rgba(255,255,255,.04);
}
.row-list{
  border-radius: var(--radius);
}
.mini-card{
  border-radius: var(--radius-lg);
}
.mini-card:hover{
  transform: translateY(-1px);
  border-color: var(--border-2);
}
.home-group{
  border-radius: var(--radius);
}
.home-group:hover{
  transform: translateY(-1px);
}

/* KPI block — unify radius across pages. */
.kpi{
  border-radius: var(--radius);
}

/* Stat tiles + friend profile stats use the same radius scale. */
.stat-tile,
.stat,
.bet-box,
.chance,
.depth,
.admin-box,
.empty,
.pick-btn,
.field-static,
.field input,
.field select,
.field textarea{
  border-radius: var(--radius);
}
.stat-tile:hover,
.stat:hover{
  border-color: var(--border-2);
}

/* Tables — readable rows + tabular numerics. */
.table tbody tr{
  transition: background-color var(--t-fast);
}
.table tbody tr:hover{
  background: rgba(255,255,255,.025);
}
.table td.right,
.table th.right{
  font-variant-numeric: tabular-nums;
}

/* Notices — consistent shape, status-tinted backgrounds. */
.notice{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-size: 13px;
  line-height: 1.45;
}
.notice--ok{
  background: rgba(91,210,143,.08);
  border-color: rgba(91,210,143,.32);
  color: rgba(91,210,143,.95);
}
.notice--err{
  background: rgba(255,90,112,.08);
  border-color: rgba(255,90,112,.32);
  color: var(--danger);
}

/* Pills — even padding and tabular numerals so values line up. */
.pill{ font-variant-numeric: tabular-nums; }
.pills{ row-gap: 8px; }

/* Status pill: tighter to the row when used near titles. */
.status-pill{ flex: 0 0 auto; }

/* Market detail — slightly smaller title so the card reads as one unit. */
.market-card__title{ font-size: 22px; }
@media (max-width: 720px){
  .market-card__title{ font-size: 20px; }
}

/* Wallet stack — make the table rows feel evenly weighted. */
.wallet-stack .table td:first-child,
.wallet-stack .table th:first-child{ padding-left: 12px; }
.wallet-stack .table td:last-child,
.wallet-stack .table th:last-child{ padding-right: 12px; }

/* Modal close + small action buttons line up nicely. */
.modal__close{
  border-radius: 999px;
}

/* Light theme tweaks: keep light variants consistent with new ring/notice. */
html[data-theme="light"] .nav-item:hover{
  background: rgba(15,23,32,.04);
}
html[data-theme="light"] .btn:hover{
  background: rgba(15,23,32,.04);
}
html[data-theme="light"] .row:hover{
  background: rgba(15,23,32,.04);
}
html[data-theme="light"] .table tbody tr:hover{
  background: rgba(15,23,32,.03);
}
html[data-theme="light"] .notice--ok{
  background: rgba(40,160,100,.12);
  color: rgba(20,90,55,.95);
}
html[data-theme="light"] .notice--err{
  background: rgba(220,60,80,.10);
  color: rgba(150,30,50,.95);
}

@media (min-width: 921px){
  .sidebar-backdrop{
    display: none !important;
    pointer-events: none !important;
  }
  .mobile-menu-toggle{
    display: none !important;
  }
  .sidebar__close-mobile{
    display: none !important;
  }
  .layout.sidebar--open .sidebar{
    transform: none !important;
  }
}

@media (max-width: 920px){
  body.sidebar-drawer-open{
    overflow: hidden;
    touch-action: none;
  }
  .stats-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar-backdrop{
    display: block;
    position: fixed;
    inset: 0;
    z-index: 150;
    /* Fully opaque — same as page background so nothing shows through when the drawer is open */
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
  }
  .layout.sidebar--open .sidebar-backdrop{
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar{
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(304px, 92vw);
    max-width: 320px;
    min-width: 0;
    z-index: 160;
    height: 100vh;
    max-height: 100dvh;
    transform: translateX(-108%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .layout.sidebar--open .sidebar{
    transform: translateX(0);
  }
  .sidebar__close-mobile{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-menu-toggle{
    display: inline-flex;
  }
  .main{
    width: 100%;
    min-width: 0;
    flex: 1;
    padding: 12px 14px;
  }
  .layout{
    flex-direction: row;
    position: relative;
    min-height: 100vh;
  }
  .grid2{
    grid-template-columns: 1fr;
  }
  .auth{
    grid-template-columns: 1fr;
    margin-top: 28px;
  }
  .modal__grid{
    grid-template-columns: 1fr;
  }
  .card--hero{
    flex-direction: column;
    align-items: stretch;
  }
  .home-group{
    flex-direction: column;
    align-items: flex-start;
  }
  .home-group__right{
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .breadcrumb{
    font-size: 11px;
  }
}

/* ---------- Accessibility & comfortable touch targets ---------- */
.skip-link{
  position:absolute;
  left: -9999px;
  top: 12px;
  z-index: 10000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration:none;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.skip-link:focus{
  left: 12px;
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

#main-content:focus{
  outline: none;
}

.btn:focus-visible,
.pick-btn:focus-visible,
.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible{
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.modal[role="dialog"]{
  outline: none;
}

/* =====================================================================
   Mobile UX pass — phones (<=920px tablet, <=640px phone, <=420px small).
   Goals: comfortable tap targets, fewer wraps, edge-to-edge sheets,
   scrollable tabs, no horizontal page overflow, safe-area aware.
   ===================================================================== */

@media (max-width: 920px){
  /* Slightly tighter outer padding without choking content. */
  .main{
    padding: 12px 12px env(safe-area-inset-bottom, 12px);
  }

  /* Top bar: keep menu, breadcrumb, avatar visible; "Sign out" stays as button. */
  .topbar{
    margin-bottom: 10px;
    gap: 10px;
  }
  .breadcrumb{
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .userbox{ gap: 8px; }
  .userbox__name{
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hero card: stack neatly; actions align with pill row (icon + gap). */
  .card--hero{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 14px;
  }
  .hero__left{
    width: 100%;
  }
  .hero__title{ font-size: 19px; }
  .hero__right{
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-left: var(--hero-text-gutter);
    box-sizing: border-box;
  }
  .hero__actions{
    flex: 0 0 auto;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
  }
  .hero__primary-actions{
    flex: 0 0 auto;
    width: 100%;
  }
  .hero__primary-actions > .btn{
    flex: 0 0 auto;
    width: 100%;
    min-height: 44px;
  }
  .hero__action--secondary{
    width: 100%;
  }

  /* Group page: tabs scroll horizontally instead of wrapping. */
  .tabs{
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px;
  }
  .tabs::-webkit-scrollbar{ display: none; }
  .tab{
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 12px 6px 14px;
    font-size: 14px;
  }
}

/* Phone breakpoint — denser real-estate optimizations. */
@media (max-width: 640px){
  .content{ padding: 12px 12px; }

  /* Cards: tighter inner padding so content gets the room. */
  .card.content{ padding: 12px 12px; }

  /* Inputs: ensure ≥16px to prevent iOS focus zoom. */
  .field input,
  .field select,
  .field textarea,
  .compose input,
  .compose--compact input{
    font-size: 16px;
  }
  .field input,
  .field select,
  .field textarea{
    min-height: 44px;
    padding: 12px 12px;
    border-radius: var(--radius);
  }

  /* Buttons: comfortable tap area. */
  .btn{ min-height: 44px; }
  .btn--small{ min-height: 40px; padding: 8px 12px; }

  /* Avatar (topbar) — enlarge to a usable tap target. */
  .avatar{ width: 32px; height: 32px; font-size: 13px; }
  .avatar--btn{ min-width: 32px; min-height: 32px; }
  .mobile-menu-toggle{ width: 44px; height: 44px; }

  /* Sidebar nav items: bigger touch targets when drawer is open. */
  .nav-item{ padding: 12px 12px; }
  .group-pill{ padding: 12px 12px; }

  /* Home: recent bets stack vertically; total/amount column right-aligned. */
  .home-recent-bet{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 0;
  }
  .home-recent-bet__side{
    width: 100%;
    justify-content: space-between;
  }

  /* Home group cards: compact two-line layout still works. */
  .home-group{
    padding: 12px;
  }
  .home-group__meta .pill,
  .home-group__right .pill{
    font-size: 11px;
    padding: 5px 9px;
  }

  /* Stats tiles label/value sizes a touch smaller for two columns. */
  .stat-tile{ padding: 10px 12px; }
  .stat-num{ font-size: 15px; }

  /* Friends: profile column doesn’t force tall stretch on phones. */
  .friends-below > .friends-profile.card.content{
    min-height: 0;
    height: auto;
  }
  .chat-thread,
  .chat-thread--dm{
    max-height: 55vh;
  }
  .dm-form,
  .compose{
    gap: 8px;
  }

  /* Wallet: header row stacks (title + Add funds wraps below); table easier to scan. */
  .wallet-stack .card.content > div:first-child{
    gap: 10px;
  }
  .wallet-group-table th,
  .wallet-group-table td{
    padding: 10px 8px;
  }
  .wallet-ledger-scroll{
    max-height: 50vh;
  }
  .wallet-ledger-scroll .table th,
  .wallet-ledger-scroll .table td{
    padding: 10px 8px;
    font-size: 12.5px;
  }

  /* Group markets list: bigger title + visible chevron-like affordance. */
  .mini-card{ padding: 14px 14px; }
  .mini-title{ font-size: 18px; }
  .mini-row{ gap: 10px 14px; }

  /* Market detail: place-bet CTA + amount input fill the column. */
  .market-card__title{ font-size: 19px; line-height: 1.2; }
  .market-title{ font-size: 26px; }
  .pick-grid{ grid-template-columns: 1fr; }
  .pick-btn__label{ font-size: 16px; }
  .pick-btn__odds{ font-size: 15px; }
  .market-top{ gap: 10px; }
  .market-top > div:last-child{ width: 100%; justify-content: space-between; }
  #placeOrder.btn--primary{ min-height: 48px; font-size: 15px; }

  /* Arbiting list rows: action buttons full-width below content. */
  .arbiting-row{
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
  }
  .arbiting-row__actions{
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }
  .arbiting-row__actions .btn{ min-height: 40px; }

  /* Pill bars: wrap nicely. */
  .pills{ gap: 8px 8px; }

  /* Row lists with trailing action buttons: allow them to wrap. */
  .row{ flex-wrap: wrap; }
  .row__right{ flex-wrap: wrap; gap: 8px; }

  /* Member pick rows: keep checkbox right, but keep target large enough. */
  .member-pick-row.list-link{ padding: 12px 12px; }
  .member-pick-row__check{ width: 22px; height: 22px; }

  /* Modals become bottom sheets / full sheets on phones. */
  .modal-backdrop{
    padding: 0;
    align-items: flex-end;
    justify-content: stretch;
  }
  .modal{
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .modal__header{
    padding: 18px 14px 10px;
    position: relative;
  }
  .modal__close{ width: 44px; height: 44px; }
  .modal__header::before{
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-2);
  }
  .modal__body{
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px 16px;
  }
  .modal__footer{
    position: sticky;
    bottom: 0;
    background: var(--panel);
    margin: 12px -14px 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0));
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .modal__footer .btn{ flex: 1 1 auto; min-height: 44px; }

  /* Emoji modal grid stays usable. */
  .emoji-grid{ grid-template-columns: repeat(6, 1fr); }
  .emoji-cell{ height: 48px; font-size: 22px; }

  /* Recommended friends list shorter so content above it is reachable. */
  .recommend-friend-list--scroll{ max-height: 260px; }
}

/* Small phones (≤420px): squeeze a bit more, keep tap targets. */
@media (max-width: 420px){
  .userbox__name{ display: none; }
  .topbar{ gap: 8px; }
  .hero__title{ font-size: 18px; }
  .hero__sub{ font-size: 12px; }
  .market-title{ font-size: 22px; }
  .market-card__title{ font-size: 18px; }
  .breadcrumb{ font-size: 11px; }
  .home-group__name{ font-size: 14px; }
  .stat-tile{ padding: 10px; }
  .stat-num{ font-size: 14px; }
  .home-groups{ max-height: 280px; }
  .auth__title{ font-size: 22px; }
  .auth--simple{ margin: 16px auto; }
  .auth__panel--simple{ padding: 14px; }
  .auth__tabs .btn,
  .auth__actions .btn{ flex: 1 1 auto; }
  /* Tabs even more compact */
  .tab{ font-size: 13px; padding: 10px 4px 12px; }
}

@media (max-width: 520px){
  .stats-grid{
    grid-template-columns: 1fr;
  }
  .btn{ min-height: 44px; }
  .btn--small{ min-height: 40px; }
}

/* Prevent any rogue horizontal scroll caused by long invite codes / urls. */
.card,
.row,
.mini-card,
.home-group,
.profile-card,
.kpi,
.bet-box,
.chance,
.depth{
  min-width: 0;
}

/* Long usernames / emails wrap gracefully on phones. */
@media (max-width: 640px){
  .row__name,
  .row__sub,
  .list-title,
  .list-sub,
  .profile-username,
  .market-card__title,
  .mini-title{
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
