/* ============================================================================
   Trade Battle v2 — game.css
   ใช้ design tokens จาก /css/style.css
   ============================================================================ */

.tb-disclaimer {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  margin: 0 0 24px;
  text-align: center;
}
html[data-theme="light"] .tb-disclaimer { background: rgba(184,134,11,0.14); color: #1a2233; }

.tb-section-head { margin-bottom: 16px; }
.tb-section-head h3 { font-size: 18px; font-weight: 700; margin: 0; }

/* ---------- SETUP ---------- */
.tb-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}
.tb-setup-card {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 20px;
}
.tb-setup-title {
  font-size: 13px; font-weight: 700; margin: 0 0 14px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px;
}

.tb-market-options { display: flex; gap: 10px; }
.tb-market-option {
  flex: 1;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card-flat);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}
.tb-market-option:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tb-market-option.selected { border-color: var(--gold); background: var(--gold-soft); }
.tb-market-emoji {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gold-soft); color: var(--gold);
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
  flex-shrink: 0;
}
.tb-market-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.tb-market-desc { font-size: 12px; color: var(--text-mute); }

.tb-tf-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tb-tf-option {
  background: var(--bg-card-flat);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px 6px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
  font-family: inherit;
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tb-tf-option:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tb-tf-option.selected { border-color: var(--gold); background: var(--gold-soft); }
.tb-tf-val {
  font-size: 22px; font-weight: 800; color: var(--text);
  font-family: 'JetBrains Mono', monospace; line-height: 1;
}
.tb-tf-val span { font-size: 12px; font-weight: 600; color: var(--text-mute); }
.tb-tf-mult {
  font-size: 12px; font-weight: 700; color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
}
.tb-mult-gold { color: var(--gold); }
@media (max-width: 480px) {
  .tb-tf-options { grid-template-columns: repeat(2, 1fr); }
  .tb-market-options { flex-direction: column; }
}

/* Live preview price */
.tb-preview-price {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-wrap: wrap;
}
.tb-preview-label { font-size: 14px; color: var(--text-dim); }
.tb-preview-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.tb-preview-source {
  font-size: 11px; color: var(--text-mute);
  background: var(--green-soft); color: var(--green);
  padding: 2px 8px; border-radius: 100px;
}

/* Start button */
.tb-start-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--gold), #f4d264);
  color: #0a1628;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-weight: 700; font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-gold);
  transition: all .2s;
}
.tb-start-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.tb-start-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.tb-start-arrow { font-size: 20px; }

.tb-ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--line); color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 14px 24px; border-radius: 12px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  font-family: inherit;
}
.tb-ghost-btn:hover { background: var(--line-strong); }

/* ---------- COUNTDOWN / WAITING shared header ---------- */
.tb-countdown-header, .tb-waiting-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
  padding: 16px;
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.tb-countdown-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-match-market, .tb-match-tf, .tb-match-choice {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.tb-match-choice {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-soft);
}
html[data-theme="light"] .tb-match-market,
html[data-theme="light"] .tb-match-tf { background: rgba(10,22,40,0.06); }

.tb-countdown-timer, .tb-waiting-timer {
  display: flex; align-items: baseline; gap: 6px;
}
.tb-cd-label { font-size: 12px; color: var(--text-mute); }
.tb-cd-seconds {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px; font-weight: 800;
  color: var(--gold);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tb-cd-unit { font-size: 14px; color: var(--text-mute); }

/* ---------- CHART ---------- */
.tb-chart-panel {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.tb-chart-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.tb-chart-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.tb-chart-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
#tbChart, #tbWaitChart {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------- DECISION ---------- */
.tb-decision-panel {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 20px;
}
.tb-decision-label {
  font-size: 15px; font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  text-align: center;
}
.tb-choice-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 480px) {
  .tb-choice-group { grid-template-columns: 1fr; }
}
.tb-choice {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--bg-card-flat);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px 8px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  color: var(--text);
  font-weight: 600; font-size: 15px;
}
.tb-choice:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tb-choice-icon { font-size: 24px; font-weight: 800; }
.tb-choice-sub { font-size: 11px; color: var(--text-mute); font-weight: 500; }

.tb-choice[data-choice="up"]   { color: var(--green); }
.tb-choice[data-choice="down"] { color: var(--red); }
.tb-choice[data-choice="flat"] { color: var(--gold); }
.tb-choice[data-choice="up"].selected   { border-color: var(--green); background: var(--green-soft); }
.tb-choice[data-choice="down"].selected { border-color: var(--red);   background: var(--red-soft); }
.tb-choice[data-choice="flat"].selected { border-color: var(--gold);  background: var(--gold-soft); }

.tb-confirm-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--gold), #f4d264);
  color: #0a1628;
  border: none;
  padding: 14px;
  border-radius: 10px;
  font-weight: 700; font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.tb-confirm-btn:hover:not(:disabled) { filter: brightness(1.08); }
.tb-confirm-btn:disabled {
  background: var(--line);
  color: var(--text-mute);
  cursor: not-allowed;
}

/* ---------- WAITING / ENTRY display ---------- */
.tb-entry-card {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.tb-entry-row {
  display: flex; align-items: center; justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.tb-entry-row:last-child { margin-bottom: 0; }
.tb-entry-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-mute); font-weight: 600;
  flex: 1; text-align: center;
}
.tb-entry-divider {
  font-size: 18px; color: var(--text-mute);
}
.tb-entry-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex: 1; text-align: center;
}
.tb-entry-start { color: var(--text); }
.tb-entry-end { color: var(--gold); }
.tb-entry-live-row {
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  gap: 10px;
}
html[data-theme="light"] .tb-entry-live-row { background: rgba(10,22,40,0.04); }
.tb-entry-live-row .tb-entry-label { flex: 0 0 auto; text-align: left; }
.tb-entry-live {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  flex: 1; text-align: right;
}
.tb-entry-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 700;
  flex: 0 0 auto;
  min-width: 70px; text-align: right;
}
.tb-entry-pct.positive { color: var(--green); }
.tb-entry-pct.negative { color: var(--red); }
.tb-entry-pct.neutral { color: var(--text-mute); }

/* ---------- RESULT ---------- */
.tb-result-card {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.tb-result-icon { font-size: 56px; margin-bottom: 8px; }
.tb-result-title { font-size: 24px; font-weight: 800; margin: 0 0 20px; }

.tb-result-prices {
  display: flex; align-items: center; justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}
.tb-result-price-box {
  flex: 1;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 14px;
}
html[data-theme="light"] .tb-result-price-box { background: rgba(10,22,40,0.04); }
.tb-result-price-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 800;
  color: var(--gold);
  margin-top: 4px;
}
.tb-result-arrow { font-size: 24px; color: var(--text-mute); }

.tb-result-detail {
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
  text-align: left;
}
html[data-theme="light"] .tb-result-detail { background: rgba(10,22,40,0.04); }
.tb-result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  font-size: 14px;
}
.tb-result-row:not(:last-child) { border-bottom: 1px solid var(--line); }
.tb-result-key { color: var(--text-mute); }
.tb-result-val {
  font-weight: 700; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.tb-result-big .tb-result-val { font-size: 18px; }
.tb-result-big .tb-result-val.correct { color: var(--green); }
.tb-result-big .tb-result-val.wrong { color: var(--red); }

.tb-result-points {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
.tb-port-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-mute); font-weight: 600;
}
.tb-result-score-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px; font-weight: 800;
  color: var(--gold);
  margin-top: 4px;
}
.tb-result-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- STATS / TIER ---------- */
.tb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 12px;
}
.tb-stat-tile {
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.tb-stat-tile-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-mute); margin-bottom: 6px;
}
.tb-stat-tile-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 800;
  color: var(--text);
}
.tb-stat-tile-sub { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.tb-tier-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px; font-weight: 700;
  border: 1px solid;
}
.tb-tier-badge[data-tier="Bronze"]   { color: #cd7f32; border-color: #cd7f32; background: rgba(205,127,50,0.12); }
.tb-tier-badge[data-tier="Silver"]   { color: #c0c0c0; border-color: #c0c0c0; background: rgba(192,192,192,0.12); }
.tb-tier-badge[data-tier="Gold"]     { color: #d4af37; border-color: #d4af37; background: rgba(212,175,55,0.12); }
.tb-tier-badge[data-tier="Platinum"] { color: #e5e4e2; border-color: #e5e4e2; background: rgba(229,228,226,0.12); }
.tb-tier-badge[data-tier="Diamond"]  { color: #b9f2ff; border-color: #b9f2ff; background: rgba(185,242,255,0.12); }

/* ---------- ACHIEVEMENTS ---------- */
.tb-ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.tb-ach-card {
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  opacity: 0.4;
  filter: grayscale(1);
}
.tb-ach-card.unlocked {
  opacity: 1;
  filter: none;
  border-color: var(--gold);
  background: var(--gold-soft);
}
.tb-ach-emoji { font-size: 30px; margin-bottom: 4px; }
.tb-ach-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.tb-ach-desc { font-size: 11px; color: var(--text-mute); line-height: 1.4; }

/* ---------- HISTORY ---------- */
.tb-history-row, .tb-lb-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.tb-history-row:hover, .tb-lb-row:hover { border-color: var(--line-strong); }
.tb-lb-row.me { border-color: var(--gold); background: var(--gold-soft); }
.tb-rank {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  background: var(--line); color: var(--text-dim);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.tb-lb-row[data-rank="1"] .tb-rank { background: linear-gradient(135deg, #d4af37, #f4d264); color: #0a1628; }
.tb-lb-row[data-rank="2"] .tb-rank { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #0a1628; }
.tb-lb-row[data-rank="3"] .tb-rank { background: linear-gradient(135deg, #cd7f32, #e89757); color: #0a1628; }
.tb-lb-info, .tb-history-info { flex: 1; min-width: 0; }
.tb-lb-name, .tb-history-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-lb-meta, .tb-history-meta { font-size: 11px; color: var(--text-mute); }
.tb-lb-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px; font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.tb-flag { font-size: 16px; }

.tb-history-outcome {
  font-size: 13px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
}
.tb-history-outcome.correct { background: var(--green-soft); color: var(--green); }
.tb-history-outcome.wrong { background: var(--red-soft); color: var(--red); }
.tb-history-outcome.pending { background: var(--line); color: var(--text-mute); }

/* ---------- TABS ---------- */
.tb-tabs {
  display: flex; gap: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 3px;
}
html[data-theme="light"] .tb-tabs { background: rgba(10,22,40,0.06); }
.tb-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px; font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.tb-tab.active { background: var(--bg-card-flat); color: var(--text); }

/* ---------- RULES ---------- */
.tb-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 14px;
}
.tb-rule-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.tb-rule-num {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #f4d264);
  color: #0a1628;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
}
.tb-rule-card strong { display: block; margin-bottom: 4px; font-size: 14px; }
.tb-rule-card p { margin: 0; color: var(--text-mute); font-size: 13px; line-height: 1.5; }

/* ---------- FAQ ---------- */
.tb-faq-item {
  background: var(--bg-card-flat);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.tb-faq-q {
  padding: 14px 18px;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.tb-faq-q:hover { background: rgba(0,0,0,0.15); }
html[data-theme="light"] .tb-faq-q:hover { background: rgba(10,22,40,0.04); }
.tb-faq-q::after { content: "+"; font-size: 18px; color: var(--gold); flex-shrink: 0; }
.tb-faq-item.open .tb-faq-q::after { content: "−"; }
.tb-faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.tb-faq-item.open .tb-faq-a { max-height: 500px; }
.tb-faq-a p { padding: 0 18px 16px; font-size: 14px; color: var(--text-mute); line-height: 1.7; margin: 0; }

/* ---------- EMPTY ---------- */
.tb-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 20px;
  font-size: 14px;
}

/* ---------- ANIMATIONS ---------- */
@keyframes tb-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.tb-pulse { animation: tb-pulse 1.5s ease infinite; }

/* ---------- TradingView big chart wrapper ---------- */
.tb-tv-wrapper {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 14px 0;
  margin-bottom: 18px;
  overflow: hidden;
}
.tb-tv-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  padding: 0 4px;
  flex-wrap: wrap; gap: 6px;
}
.tb-tv-title { font-size: 13px; font-weight: 700; color: var(--text); }
.tb-tv-source {
  font-size: 11px; font-weight: 600;
  background: var(--green-soft); color: var(--green);
  padding: 2px 8px; border-radius: 100px;
}

/* TF buttons on big chart */
.tb-chart-tf {
  display: flex; gap: 3px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  padding: 3px;
}
html[data-theme="light"] .tb-chart-tf { background: rgba(10,22,40,0.06); }
.tb-chart-tf-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 12px; font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: all .15s;
}
.tb-chart-tf-btn:hover { color: var(--text); }
.tb-chart-tf-btn.active {
  background: var(--gold);
  color: #0a1628;
}
#tbTvWidget {
  width: 100%;
  height: 400px;
  min-height: 320px;
}
#tbTvWidget iframe { border-radius: 8px; display: block; }
@media (max-width: 600px) {
  #tbTvWidget { height: 320px; }
}

/* ---------- Sparkline ในการ์ดตลาด ---------- */
.tb-sparkline {
  display: block;
  width: 100%;
  max-width: 140px;
  height: 28px;
  margin-top: 8px;
  opacity: 0.9;
}
/* ปรับ market option ให้รองรับ sparkline */
.tb-market-option { align-items: flex-start; }

/* ---------- MODAL (nickname) ---------- */
.tb-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.tb-modal {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 28px 24px;
  position: relative;
  box-shadow: var(--shadow);
}

/* ---------- ONLINE WIDGET ---------- */
.tb-online-widget {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.tb-online-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.tb-online-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.tb-online-title b { color: var(--green); }
.tb-online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.tb-online-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: 140px; overflow-y: auto;
}
.tb-empty-inline { color: var(--text-mute); font-size: 13px; }

.tb-online-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 6px 4px 8px;
  font-size: 12px;
  transition: all .15s;
}
html[data-theme="light"] .tb-online-chip { background: rgba(10,22,40,0.04); }
.tb-online-chip.me { border-color: var(--gold); background: var(--gold-soft); }
.tb-online-chip-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  display: grid; place-items: center; font-weight: 700; font-size: 11px;
}
.tb-online-chip-name {
  color: var(--text); font-weight: 600;
  max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-online-chip-btn {
  background: var(--gold);
  color: #0a1628;
  border: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  font-family: inherit;
  line-height: 1;
}
.tb-online-chip-btn:hover { filter: brightness(1.1); }
.tb-online-chip-btn:disabled {
  background: var(--line); color: var(--text-mute); cursor: not-allowed;
}

/* Accepting toggle */
.tb-accepting-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-dim);
}
.tb-accepting-toggle input { display: none; }
.tb-toggle-slider {
  width: 36px; height: 20px;
  background: var(--line-strong);
  border-radius: 100px;
  position: relative;
  transition: background .2s;
}
.tb-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.tb-accepting-toggle input:checked + .tb-toggle-slider {
  background: var(--green);
}
.tb-accepting-toggle input:checked + .tb-toggle-slider::after {
  transform: translateX(16px);
}

/* Idle modal seconds */
.tb-idle-seconds {
  font-family: 'JetBrains Mono', monospace;
  font-size: 56px; font-weight: 800;
  color: var(--red);
  line-height: 1;
}

/* ---------- TAB NAV (Solo | Challenge) ---------- */
.tb-tab-nav {
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 20px;
}
html[data-theme="light"] .tb-tab-nav { background: rgba(10,22,40,0.06); }
.tb-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tb-tab-btn:hover { color: var(--text); }
.tb-tab-btn.active {
  background: var(--bg-card-flat);
  color: var(--gold);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.tb-tab-badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
  min-width: 16px;
  text-align: center;
  margin-left: 2px;
}

/* ---------- CHALLENGE section ---------- */
.tb-challenge-grid {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 20px;
}
.tb-sub-tabs {
  display: flex; gap: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
}
html[data-theme="light"] .tb-sub-tabs { background: rgba(10,22,40,0.06); }
.tb-sub-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px; font-weight: 600;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.tb-sub-tab.active { background: var(--bg-card-flat); color: var(--text); }

.tb-players-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 480px;
  overflow-y: auto;
  padding: 2px;
}
.tb-player-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all .15s ease;
}
html[data-theme="light"] .tb-player-card { background: rgba(10,22,40,0.04); }
.tb-player-card:hover { border-color: var(--gold); transform: translateY(-1px); }
.tb-player-card.selected { border-color: var(--gold); background: var(--gold-soft); }
.tb-player-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.tb-player-info { flex: 1; min-width: 0; }
.tb-player-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-player-meta { font-size: 11px; color: var(--text-mute); }

/* H2H challenge rows */
.tb-h2h-card {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
}
html[data-theme="light"] .tb-h2h-card { background: rgba(10,22,40,0.04); }
.tb-h2h-card.pending { border-left: 3px solid var(--gold); }
.tb-h2h-card.accepted { border-left: 3px solid var(--blue, #3b82f6); }
.tb-h2h-card.completed { border-left: 3px solid var(--green); }
.tb-h2h-card.won { border-left: 3px solid var(--green); background: var(--green-soft); }
.tb-h2h-card.lost { border-left: 3px solid var(--red); background: var(--red-soft); }

.tb-h2h-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap; gap: 8px;
}
.tb-h2h-vs {
  font-size: 14px; font-weight: 700; color: var(--text);
}
.tb-h2h-vs .vs-sep { color: var(--text-mute); margin: 0 8px; font-weight: 500; }
.tb-h2h-meta { font-size: 11px; color: var(--text-mute); }
.tb-h2h-status {
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 100px;
  text-transform: uppercase;
}
.tb-h2h-status.pending { background: var(--gold-soft); color: var(--gold); }
.tb-h2h-status.accepted { background: rgba(59,130,246,0.12); color: #60a5fa; }
.tb-h2h-status.won { background: var(--green-soft); color: var(--green); }
.tb-h2h-status.lost { background: var(--red-soft); color: var(--red); }
.tb-h2h-status.draw { background: var(--line); color: var(--text-dim); }
.tb-h2h-status.expired { background: var(--line); color: var(--text-mute); }

.tb-h2h-body { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; line-height: 1.5; }
.tb-h2h-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tb-h2h-mini-btn {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.tb-h2h-mini-btn:hover { border-color: var(--gold); color: var(--gold); }
.tb-h2h-mini-btn.primary {
  background: linear-gradient(135deg, var(--gold), #f4d264);
  color: #0a1628;
  border: none;
}
.tb-h2h-mini-btn.primary:hover { filter: brightness(1.08); }
.tb-h2h-mini-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* Challenge choice modal (for accept) */
.tb-challenge-choice-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.tb-challenge-choice-modal {
  background: var(--bg-card-flat);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 24px;
}

