/* ─── CryptoKartz Shared Styles — Institutional Design System v2.0 ───────── */
/* Tier-1 trading-desk aesthetic: dark canvas, electric-green accent, Inter,  */
/* tabular numerals, flat components, no chrome gradients.                    */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

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

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  /* Canvas & Surfaces */
  --canvas:      #0b0c0e;
  --surface:     #141518;
  --surface-2:   #1a1c21;
  --surface-3:   #20232b;

  /* Borders */
  --border:        #272a32;
  --border-strong: #363b48;
  --border-focus:  rgba(0, 232, 122, 0.55);

  /* Accent — CK electric green */
  --accent:        #00e87a;
  --accent-dim:    rgba(0, 232, 122, 0.10);
  --accent-border: rgba(0, 232, 122, 0.22);
  --accent-hover:  #00ff88;
  --accent-text:   #00e87a;

  /* Typography */
  --text-1:  #f0f2f5;
  --text-2:  #8c91a0;
  --text-3:  #4f5566;

  /* Semantic: win/loss only — no colour-as-decoration */
  --win:       #00c853;
  --win-dim:   rgba(0, 200, 83, 0.10);
  --win-border:rgba(0, 200, 83, 0.22);
  --loss:      #ff3d57;
  --loss-dim:  rgba(255, 61, 87, 0.10);
  --loss-border:rgba(255, 61, 87, 0.22);
  --caution:   #f5a623;
  --caution-dim:rgba(245, 166, 35, 0.10);
  --info:      #4a9eff;
  --info-dim:  rgba(74, 158, 255, 0.10);

  /* Legacy colour aliases — keep so existing pages don't break */
  --purple-deep:   var(--canvas);
  --purple-mid:    var(--surface-2);
  --purple-bright: var(--accent);
  --blue-electric: var(--info);
  --blue-cyan:     var(--info);
  --purple-glow:   var(--accent);
  --white:         var(--text-1);
  --gray-light:    var(--text-2);
  --gray-mid:      var(--text-3);
  --green-success: var(--win);
  --red-error:     var(--loss);
  --yellow-warn:   var(--caution);

  /* Semantic compat */
  --color-positive: var(--win);
  --color-negative: var(--loss);
  --color-caution:  var(--caution);
  --color-info:     var(--info);
  --color-live:     var(--win);
  --color-offline:  var(--text-3);

  /* Spacing — 4 px base grid */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Type scale — 12/14/16/20/24/32/48 */
  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   0.875rem;  /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg:   1.125rem;  /* 18px (≈ 20px target) */
  --text-xl:   1.25rem;   /* 20px */
  --text-2xl:  1.5rem;    /* 24px */
  --text-3xl:  2rem;      /* 32px */
  --text-4xl:  3rem;      /* 48px */

  /* Border radius — institutional = subtle, not bubbly */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   10px;
  --radius-2xl:  12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.6);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.65);
  --shadow-lg:   0 8px 24px rgba(0,0,0,0.7);
  --shadow-glow: 0 0 20px rgba(0,232,122,0.12);

  /* Glass compat — now flat */
  --glass-bg:     var(--surface);
  --glass-border: 1px solid var(--border);
  --glass-hover:  var(--surface-2);

  --container-px: clamp(16px, 4vw, 48px);
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--canvas);
  color: var(--text-1);
  overflow-x: hidden;
  line-height: 1.55;
  min-height: 100vh;
  word-wrap: break-word;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  font-feature-settings: "cv02","cv03","cv04","cv11";
}

/* Tabular numerals — applied to every numeric display globally */
.number, .stat-value, .bc-amount, .stat-box .number,
[data-live], [data-admin-metric],
.balance-card .bc-amount,
.stat-box-pro .stat-value,
.delta-pill, .prize-pool-value,
.vault-balance-value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ─── Background — no animated grid, no glow orbs ───────────────────────── */
.bg-grid { display: none; }
.glow-orb, .glow-orb-1, .glow-orb-2 { display: none; }

.content {
  position: relative;
  z-index: 1;
  animation: contentFadeIn 0.2s ease-out;
}
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Selection ──────────────────────────────────────────────────────────── */
::selection {
  background: rgba(0, 232, 122, 0.18);
  color: var(--text-1);
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── Navigation ─────────────────────────────────────────────────────────── */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 60px;
}

/* Top nav bar */
body > header,
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 200;
}

.app-nav .logo {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
  text-decoration: none;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
}

.app-nav .logo img {
  width: clamp(32px, 5vw, 40px);
  height: clamp(32px, 5vw, 40px);
  min-width: 32px;
  min-height: 32px;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  min-height: 36px;
}

.nav-links a:hover {
  color: var(--text-1);
  background: var(--surface-2);
}
.nav-links a:active { background: var(--surface-3); }
.nav-links a.active {
  color: var(--text-1);
  background: var(--surface-2);
}

.nav-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: middle;
}

.nav-links .btn-nav {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #081a10;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.nav-links .btn-nav:hover { background: var(--accent-hover); }
.nav-links .btn-nav:active { opacity: 0.88; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  padding: 28px 32px;
  border-radius: var(--radius-2xl);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.card-sm {
  padding: 20px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:hover { border-color: var(--border-strong); }
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,232,122,0.10);
}
.form-input::placeholder { color: var(--text-3); }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234f5566' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
select.form-input option { background: #1a1c21; color: #f0f2f5; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
  min-height: 40px;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #081a10;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); opacity: 0.9; }
.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-danger {
  background: var(--loss-dim);
  color: var(--loss);
  border: 1px solid var(--loss-border);
}
.btn-danger:hover { background: rgba(255,61,87,0.18); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border-strong); }

.btn-sm { padding: 7px 14px; font-size: 0.8125rem; border-radius: var(--radius-sm); min-height: 32px; }
.btn-full { width: 100%; }

/* Keyboard focus */
.btn:focus-visible, .form-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 14px;
  display: none;
}
.alert-error {
  background: var(--loss-dim);
  border: 1px solid var(--loss-border);
  color: var(--loss);
}
.alert-success {
  background: var(--win-dim);
  border: 1px solid var(--win-border);
  color: var(--win);
}
.alert.show { display: block; }

/* ─── Option Cards ───────────────────────────────────────────────────────── */
.option-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.option-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.option-card:hover { border-color: var(--border-strong); background: var(--surface-3); }
.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-border);
}
.option-card .icon { font-size: 1.6rem; margin-bottom: 6px; display: block; }
.option-card .label { font-weight: 600; font-size: 0.8125rem; }
.option-card .desc { font-size: 0.75rem; color: var(--text-3); margin-top: 3px; }
.option-card input[type="radio"], .option-card input[type="checkbox"] {
  position: absolute; opacity: 0; pointer-events: none;
}

/* ─── Section Headers ────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.section-title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--text-1);
}

.section-desc {
  font-size: 0.9375rem;
  color: var(--text-2);
  max-width: 520px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-box {
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.2s;
}
.stat-box:hover { border-color: var(--border-strong); }

.stat-box .number {
  font-family: 'Inter', sans-serif;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.stat-box .label {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 200px;
}

.data-table td.email-col { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.data-table td.address-col { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

.data-table tr:hover td { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: none; }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-purple { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.badge-green  { background: var(--win-dim);    color: var(--win);    border: 1px solid var(--win-border); }
.badge-yellow { background: var(--caution-dim);color: var(--caution);border: 1px solid rgba(245,166,35,0.2); }
.badge-blue   { background: var(--info-dim);   color: var(--info);   border: 1px solid rgba(74,158,255,0.2); }
.badge-live   { background: var(--win-dim);    color: var(--win);    border: 1px solid var(--win-border); }
.badge-demo   { background: var(--info-dim);   color: var(--info);   border: 1px solid rgba(74,158,255,0.2); }
.badge-hot    { background: var(--loss-dim);   color: var(--loss);   border: 1px solid var(--loss-border); }
.badge-new    { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }

/* ─── Loading Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(240,242,245,0.15);
  border-top-color: var(--text-1);
  border-radius: 50%;
  animation: spin 0.55s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Portal Legal Footer ────────────────────────────────────────────────── */
.portal-legal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px 18px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.portal-legal-footer a {
  font-size: 0.6875rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.15s;
}
.portal-legal-footer a:hover { color: var(--text-2); }
.portal-legal-footer span { font-size: 0.6875rem; color: var(--text-3); opacity: 0.5; }

/* ─── Version Footer ─────────────────────────────────────────────────────── */
.ck-version-footer {
  text-align: center;
  padding: 16px 16px 22px;
  font-size: 0.6875rem;
  color: var(--text-3);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
}

/* ─── Hamburger ──────────────────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 101;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.25s;
}

/* ─── Mobile Nav ─────────────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--canvas);
  z-index: 100;
  transition: opacity 0.2s, transform 0.2s;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}
.mobile-nav.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.mobile-nav-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  padding: 20px;
}
.mobile-nav-inner a {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  padding: 13px 28px;
  border-radius: var(--radius-lg);
  transition: all 0.15s;
  width: 100%;
  max-width: 280px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
}
.mobile-nav-inner a .nav-icon { width: 18px; height: 18px; }
.mobile-nav-inner a:hover, .mobile-nav-inner a.active {
  color: var(--text-1);
  background: var(--surface-2);
}
.mobile-nav-inner .btn-nav {
  background: var(--accent);
  color: #081a10;
  font-size: 1rem;
  padding: 13px 28px;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 280px;
  text-align: center;
}
.mobile-menu-open body { overflow: hidden; }

/* ─── Text utilities ─────────────────────────────────────────────────────── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.truncate-address {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
  display: inline-block;
  cursor: help;
}

/* ─── Gradient text utility — accented, not chrome-decorated ────────────── */
.gradient-text {
  color: var(--accent);
  background: none;
  -webkit-text-fill-color: unset;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INSTITUTIONAL COMPONENT LIBRARY  v2.0
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Skeleton Loaders ───────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-text  { height: 13px; margin-bottom: 7px; border-radius: 3px; }
.skeleton-title { height: 22px; margin-bottom: 10px; border-radius: 4px; }
.skeleton-value { height: 38px; margin-bottom: 7px; border-radius: 6px; }
.skeleton-card  { height: 110px; border-radius: var(--radius-lg); }
.skeleton-btn   { height: 40px; border-radius: var(--radius-md); }
.skeleton-row   { height: 44px; border-radius: var(--radius-sm); margin-bottom: 3px; }

/* ─── Live Pulse Dot ─────────────────────────────────────────────────────── */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0,200,83,0.6); }
  70%  { box-shadow: 0 0 0 5px rgba(0,200,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,200,83,0); }
}

.ck-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.ck-live-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background 0.3s;
}
.ck-live-dot[data-ws-status="live"]::before {
  background: var(--win);
  animation: pulse-ring 2s ease-out infinite;
}
.ck-live-dot[data-ws-status="live"] { color: var(--win); }
.ck-live-dot[data-ws-status="connecting"]::before,
.ck-live-dot[data-ws-status="reconnecting"]::before { background: var(--caution); }
.ck-live-dot[data-ws-status="connecting"],
.ck-live-dot[data-ws-status="reconnecting"] { color: var(--caution); }
.ck-live-dot[data-ws-status="error"]::before { background: var(--loss); }
.ck-live-dot[data-ws-status="error"] { color: var(--loss); }
.ck-live-dot:not([data-ws-status]),
.ck-live-dot[data-ws-status="idle"] { color: var(--text-3); }

/* ─── Balance Flash ──────────────────────────────────────────────────────── */
@keyframes balanceFlash {
  0%   { color: var(--win); }
  60%  { color: var(--win); }
  100% { color: inherit; }
}
.balance-flash { animation: balanceFlash 0.7s ease-out; }

@keyframes metricFlash {
  0%   { color: var(--win); }
  100% { color: inherit; }
}
.metric-flash { animation: metricFlash 0.45s ease-out; }

/* ─── Count-up tick animation ────────────────────────────────────────────── */
@keyframes numTick {
  0%   { opacity: 0.5; transform: translateY(-4px); }
  100% { opacity: 1;   transform: translateY(0); }
}
.num-tick { animation: numTick 0.25s ease-out; }

/* ─── Chart Containers ───────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow: hidden;
}
.chart-wrap canvas { display: block; width: 100% !important; }
.chart-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--space-3);
}

/* ─── Pro Stat Box ───────────────────────────────────────────────────────── */
.stat-box-pro {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-box-pro:hover { border-color: var(--border-strong); }
/* Accent top-bar on hover */
.stat-box-pro::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-box-pro:hover::after { opacity: 0.6; }

.stat-box-pro .stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: var(--space-2);
}
.stat-box-pro .stat-value {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat-box-pro .stat-delta {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: var(--space-1);
}
.stat-box-pro .stat-delta.positive { color: var(--win); }
.stat-box-pro .stat-delta.negative { color: var(--loss); }
.stat-box-pro .stat-delta.neutral  { color: var(--text-3); }

/* ─── StatTile — new institutional component ─────────────────────────────── */
.stat-tile {
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.2s;
}
.stat-tile:hover { border-color: var(--border-strong); }
.stat-tile .tile-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.stat-tile .tile-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.stat-tile .tile-sub {
  font-size: 0.75rem;
  color: var(--text-3);
}
.stat-tile .tile-delta {
  font-size: 0.75rem;
  font-weight: 600;
}
.stat-tile .tile-delta.up   { color: var(--win); }
.stat-tile .tile-delta.down { color: var(--loss); }

/* ─── Game Card Pro ──────────────────────────────────────────────────────── */
.game-card-pro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.game-card-pro:hover { border-color: var(--border-strong); background: var(--surface-2); }
.game-card-pro:active { background: var(--surface-3); }
.game-card-pro .gc-icon { font-size: 2rem; line-height: 1; }
.game-card-pro .gc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.game-card-pro .gc-name {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.game-card-pro .gc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.game-card-pro .gc-desc { font-size: 0.8125rem; color: var(--text-3); line-height: 1.5; }
.game-card-pro .gc-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.game-card-pro .gc-edge { font-size: 0.6875rem; color: var(--text-3); }

/* ─── Tag variants ───────────────────────────────────────────────────────── */
.tag-skill  { color: var(--info); }
.tag-chance { color: var(--caution); }
.tag-mixed  { color: var(--accent); }

/* ─── Tester role badge ──────────────────────────────────────────────────── */
.nav-role-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--caution-dim);
  color: var(--caution);
  border: 1px solid rgba(245,166,35,0.25);
  border-radius: var(--radius-sm);
  padding: 2px 7px;
  display: inline-flex;
  align-items: center;
}

/* ─── Balance Card ───────────────────────────────────────────────────────── */
.balance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  position: relative;
  overflow: hidden;
}
/* Subtle accent left-bar on balance card */
.balance-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.6;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.balance-card .bc-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-3);
}
.balance-card .bc-amount {
  font-family: 'Inter', sans-serif;
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: var(--space-1);
  font-variant-numeric: tabular-nums;
}
.balance-card .bc-usd {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-bottom: var(--space-4);
  font-variant-numeric: tabular-nums;
}
.balance-card .bc-currency {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-right: 2px;
}

/* ─── Live Feed ──────────────────────────────────────────────────────────── */
.live-feed {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow-y: auto;
}
.live-feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  animation: feedItemIn 0.2s ease-out;
  transition: background 0.1s;
}
.live-feed-item:hover { background: var(--surface-2); }
.live-feed-item:last-child { border-bottom: none; }
@keyframes feedItemIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.live-feed-item .lf-icon { font-size: 0.875rem; flex-shrink: 0; margin-top: 1px; }
.live-feed-item .lf-body { flex: 1; min-width: 0; }
.live-feed-item .lf-title { font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-feed-item .lf-sub { font-size: 0.6875rem; color: var(--text-3); margin-top: 1px; }
.live-feed-item .lf-time { font-size: 0.6875rem; color: var(--text-3); flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─── WS Status Bar ──────────────────────────────────────────────────────── */
.ws-status-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  color: var(--text-3);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: all 0.25s;
}
.ws-status-bar[data-ws-status="live"] {
  background: var(--win-dim);
  border-color: var(--win-border);
  color: var(--win);
}
.ws-status-bar[data-ws-status="reconnecting"],
.ws-status-bar[data-ws-status="connecting"] {
  background: var(--caution-dim);
  border-color: rgba(245,166,35,0.2);
  color: var(--caution);
}

/* ─── Delta pills ────────────────────────────────────────────────────────── */
.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.delta-pill.up   { background: var(--win-dim);     color: var(--win); }
.delta-pill.down { background: var(--loss-dim);    color: var(--loss); }
.delta-pill.flat { background: var(--surface-2);   color: var(--text-3); }

/* ─── Table toolbar ──────────────────────────────────────────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.table-toolbar .search-input {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.table-toolbar .search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,232,122,0.08);
}
.table-toolbar .search-input::placeholder { color: var(--text-3); }

/* ─── Trust badges ───────────────────────────────────────────────────────── */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: border-color 0.15s;
}
.trust-badge:hover { border-color: var(--border-strong); }

/* ─── Section divider ────────────────────────────────────────────────────── */
.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-8) 0 var(--space-6);
  color: var(--text-3);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  gap: var(--space-3);
}
.empty-state .es-icon  { font-size: 2.5rem; opacity: 0.25; margin-bottom: var(--space-2); }
.empty-state .es-title { font-family: 'Inter', sans-serif; font-weight: 600; font-size: 1rem; color: var(--text-2); }
.empty-state .es-sub   { font-size: 0.8125rem; color: var(--text-3); max-width: 280px; line-height: 1.6; }

/* ─── Prize Pool Ticker ──────────────────────────────────────────────────── */
.prize-pool-ticker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-2xl);
  padding: 10px 20px;
}
.prize-pool-ticker .pp-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.prize-pool-ticker .pp-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.prize-pool-ticker .pp-unit {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
}

/* ─── Pause State Banner ─────────────────────────────────────────────────── */
.pause-banner {
  display: none;
  width: 100%;
  background: var(--caution-dim);
  border-bottom: 1px solid rgba(245,166,35,0.25);
  padding: 9px 20px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--caution);
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.pause-banner.active { display: flex; }

/* ─── Action Feedback States ─────────────────────────────────────────────── */
/* Applied by ds-toast.js — these are the loading/success/error button states */
.btn[data-state="loading"] {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}
.btn[data-state="loading"] .btn-text { opacity: 0; }
.btn[data-state="loading"] .btn-spinner { display: inline-block; }
.btn .btn-spinner { display: none; }

/* ─── Toast System (ds-toast.js) ─────────────────────────────────────────── */
#ck-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ck-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease-out;
  pointer-events: all;
  font-size: 0.875rem;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(8px) scale(0.96); }
}
.ck-toast.dismissing { animation: toastOut 0.18s ease-in forwards; }
.ck-toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.ck-toast-body { flex: 1; min-width: 0; }
.ck-toast-title { font-weight: 600; color: var(--text-1); }
.ck-toast-sub   { font-size: 0.75rem; color: var(--text-3); margin-top: 2px; }
.ck-toast-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.ck-toast-close:hover { color: var(--text-1); }
/* Toast variants */
.ck-toast-success { border-color: var(--win-border); }
.ck-toast-error   { border-color: var(--loss-border); }
.ck-toast-warning { border-color: rgba(245,166,35,0.25); }
.ck-toast-info    { border-color: rgba(74,158,255,0.2); }

/* ─── Async surface states ───────────────────────────────────────────────── */
[data-state="loading"] .state-loading { display: block; }
[data-state="loading"] .state-empty,
[data-state="loading"] .state-error,
[data-state="loading"] .state-content { display: none; }

[data-state="empty"] .state-empty { display: block; }
[data-state="empty"] .state-loading,
[data-state="empty"] .state-error,
[data-state="empty"] .state-content { display: none; }

[data-state="error"] .state-error { display: block; }
[data-state="error"] .state-loading,
[data-state="error"] .state-empty,
[data-state="error"] .state-content { display: none; }

[data-state="success"] .state-content { display: block; }
[data-state="success"] .state-loading,
[data-state="success"] .state-empty,
[data-state="success"] .state-error { display: none; }

/* Hide state-siblings by default until parent sets data-state */
.state-loading, .state-empty, .state-error { display: none; }
.state-content { display: block; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-nav { padding: 0 20px; min-height: 56px; }
  .app-nav .logo img { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
  .nav-links { gap: 6px; flex-wrap: wrap; }
  .nav-links a { font-size: 0.8125rem; }
  .card { padding: 20px 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-title { font-size: 1.375rem; }
  .option-cards { grid-template-columns: repeat(2, 1fr); }
  .balance-card .bc-amount { font-size: var(--text-3xl); }
  .table-toolbar { gap: 8px; }
  #ck-toast-container { bottom: 16px; right: 16px; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  .mobile-nav { display: block; }
  .app-nav { padding: 0 16px; min-height: 52px; }
  .app-nav .logo { display: flex !important; align-items: center !important; font-size: 1rem; }
  .app-nav .logo img { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
}

@media (max-width: 480px) {
  .app-nav { padding: 0 14px; min-height: 50px; }
  .stats-grid { grid-template-columns: 1fr; }
  .option-cards { grid-template-columns: 1fr; }
  .card { padding: 16px 18px; }
  .section-title { font-size: 1.25rem; }
  .btn { padding: 9px 18px; font-size: 0.875rem; }
  .form-input { padding: 9px 12px; font-size: 0.9rem; }
  .balance-card { padding: var(--space-6); }
  .balance-card .bc-amount { font-size: var(--text-2xl); }
  .live-feed { max-height: 220px; }
  .chart-wrap { padding: var(--space-4); }
  .ck-toast { min-width: 240px; max-width: calc(100vw - 32px); }
}

@media (max-width: 375px) {
  .app-nav { padding: 0 12px; }
}

/* ─── RBAC v2: Tester / Demo Mode Styles (Task #1222625) ──────────────────── */
/* Applied via body.ck-tester-mode when role === 'tester' */

/* Nav role badge */
.nav-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(217, 119, 6, 0.2);
  border: 1px solid rgba(217, 119, 6, 0.5);
  color: #f59e0b;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Hide live-only elements for testers */
.ck-tester-mode [data-live-only],
.ck-tester-mode .wallet-connect-prompt,
.ck-tester-mode .deposit-cta,
.ck-tester-mode .withdraw-btn { display: none !important; }

/* Demo mode bet button styling (orange gradient) */
.ck-tester-mode .flip-btn,
.ck-tester-mode .bet-btn,
.ck-tester-mode .play-btn,
.ck-tester-mode .crash-btn,
.ck-tester-mode button[id$="-btn"]:not([id*="cancel"]):not([id*="close"]):not([id*="menu"]) {
  background: linear-gradient(135deg, #d97706, #f59e0b) !important;
}
