:root {
  --bg-main: #090d16;
  --bg-card: #111726;
  --bg-card-hover: #161e31;
  --bg-card-inner: #0b101c;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.15);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.12);
  --accent-green-border: rgba(16, 185, 129, 0.3);

  --accent-purple: #a855f7;
  --accent-purple-bg: rgba(168, 85, 247, 0.12);
  --accent-purple-border: rgba(168, 85, 247, 0.3);

  --accent-amber: #f59e0b;
  --accent-amber-bg: rgba(245, 158, 11, 0.12);
  --accent-amber-border: rgba(245, 158, 11, 0.3);

  --accent-blue: #3b82f6;
  --accent-blue-bg: rgba(59, 130, 246, 0.12);
  --accent-blue-border: rgba(59, 130, 246, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow-green: 0 0 25px -4px rgba(16, 185, 129, 0.35);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* =========================================
   1. MAIN HEADER
   ========================================= */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 16px rgba(56, 189, 248, 0.15);
  flex-shrink: 0;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.brand-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 2px;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--accent-green-bg);
  border: 1px solid var(--accent-green-border);
  color: var(--accent-green);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; filter: brightness(1.2); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
}

.sync-counter {
  font-family: monospace;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* =========================================
   2. KPI METRICS GRID
   ========================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
}

.kpi-card.highlight-green {
  border-left: 4px solid var(--accent-green);
}
.kpi-card.highlight-purple {
  border-left: 4px solid var(--accent-purple);
}
.kpi-card.highlight-amber {
  border-left: 4px solid var(--accent-amber);
}
.kpi-card.highlight-blue {
  border-left: 4px solid var(--accent-blue);
}

.kpi-card .kpi-icon {
  font-size: 22px;
  margin-bottom: 8px;
}

.kpi-info .kpi-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-info .kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin: 4px 0 2px 0;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* =========================================
   3. CONTROLS BAR: SEARCH & TABS
   ========================================= */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: var(--bg-card-hover);
}

.clear-search-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.clear-search-btn:hover {
  color: var(--text-main);
}

.filter-tabs {
  display: flex;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.tab-btn {
  padding: 9px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: #1e293b;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-badge {
  font-size: 11px;
  font-family: monospace;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

/* =========================================
   4. CONTENT & PLAYERS GRID
   ========================================= */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.section-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
}

.results-count {
  font-size: 13px;
  color: var(--text-dim);
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

/* Player Card */
.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.player-card:hover {
  border-color: var(--border-highlight);
  background: var(--bg-card-hover);
}

/* Active Online Player Card Highlight */
.player-card.is-online {
  border-color: var(--accent-green-border);
  box-shadow: var(--shadow-glow-green);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.05) 0%, var(--bg-card) 60%);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.player-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1e293b, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.player-avatar.online::after {
  content: '';
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 8px var(--accent-green);
}

.player-info-text .player-name {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-role {
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-role.director {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-role.student {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.player-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.online {
  background: var(--accent-green-bg);
  border: 1px solid var(--accent-green-border);
  color: var(--accent-green);
}

.status-pill.recent {
  background: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  color: var(--accent-amber);
}

.status-pill.offline {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
}

/* Multi-Table Banner */
.multitable-banner {
  background: rgba(16, 185, 129, 0.12);
  border: 1px dashed var(--accent-green-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: #34d399;
  font-weight: 600;
}

.multitable-count {
  font-size: 15px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
}

/* Active Tables Accordion */
.active-tables-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.table-row-item {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  transition: border-color 0.2s;
}

.table-row-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.table-hero-nick {
  font-weight: 600;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.table-type-badge.mystery {
  background: var(--accent-purple-bg);
  border: 1px solid var(--accent-purple-border);
  color: var(--accent-purple);
}

.table-type-badge.ko {
  background: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  color: var(--accent-amber);
}

.table-type-badge.mtt {
  background: var(--accent-blue-bg);
  border: 1px solid var(--accent-blue-border);
  color: var(--accent-blue);
}

.table-right-meta {
  text-align: right;
}

.table-buyin {
  font-weight: 700;
  color: #f8fafc;
}

.table-hands {
  font-size: 11px;
  color: var(--text-dim);
}

/* Player Footer */
.player-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.btn-view-aliases {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-view-aliases:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: var(--border-highlight);
}

/* =========================================
   5. ALIASES DICTIONARY TABLE
   ========================================= */
.aliases-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.aliases-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.aliases-table th {
  background: var(--bg-card-inner);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
}

.aliases-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.aliases-table tr:hover td {
  background: var(--bg-card-hover);
}

.nick-code {
  font-family: monospace;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

/* =========================================
   6. MODAL FOR ALIASES
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.aliases-tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.alias-tag {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 13px;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alias-tag-copy {
  cursor: pointer;
  font-size: 11px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.alias-tag-copy:hover {
  opacity: 1;
}

/* =========================================
   7. LOADING & EMPTY STATES
   ========================================= */
.loading-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.main-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 12.5px;
}

/* Recent Tournaments Accordion */
.recent-accordion {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.recent-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #fbbf24;
  user-select: none;
}

.recent-summary::-webkit-details-marker {
  display: none;
}

.recent-summary .chevron {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.recent-accordion[open] .recent-summary .chevron {
  transform: rotate(180deg);
}

/* =========================================
   8. LOGIN SCREEN OVERLAY
   ========================================= */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #10192d 0%, #060911 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(12px);
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.login-card {
  background: rgba(17, 23, 38, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
  animation: cardFadeIn 0.4s ease-out;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  margin-bottom: 28px;
}

.login-logo-box {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  padding: 10px;
}

.login-logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.6));
}

.login-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: rgba(11, 16, 28, 0.9);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.input-with-icon input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
  background: #0f172a;
}

.login-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.btn-login {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  font-size: 15px;
  padding: 13px;
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-login:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fff;
}

/* =========================================
   9. LIVE TELEMETRY BADGES (Stack, BBs, etc.)
   ========================================= */
.telemetry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.tel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
}

/* Stack BB Badges */
.stack-badge.short-stack {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #f87171;
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.stack-badge.med-stack {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.stack-badge.deep-stack {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.pos-badge {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.blinds-badge {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
}

.players-badge {
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.cards-badge {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
  font-family: monospace;
  font-weight: 700;
}

/* =========================================
   10. LAST 10 TOURNAMENTS ACCORDION
   ========================================= */
.history-accordion {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
}

.history-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #93c5fd;
  user-select: none;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-summary .chevron {
  font-size: 14px;
  transition: transform 0.2s ease;
}

.history-accordion[open] .history-summary .chevron {
  transform: rotate(180deg);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.history-item {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.history-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Responsive */
@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .players-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   STALE DATA BANNER
   ========================================= */
.stale-banner {
  background: var(--accent-amber-bg);
  border: 1px solid var(--accent-amber-border);
  color: var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

/* =========================================
   ADMIN
   ========================================= */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-card-wide {
  grid-column: 1 / -1;
}

.admin-card h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  color: var(--text-main);
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-form input,
.admin-form select,
.admin-role {
  background: var(--bg-card-inner);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  flex: 1 1 160px;
  min-width: 0;
}

.admin-role {
  flex: none;
}

.admin-status {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-detail {
  font-size: 12px;
  color: var(--text-dim);
  word-break: break-word;
}

.admin-msg { font-size: 13px; min-height: 18px; }
.admin-msg.ok, .admin-ok { color: var(--accent-green); }
.admin-msg.err, .admin-err { color: #f87171; }
.admin-warn { color: var(--accent-amber); }
.admin-you { color: var(--text-dim); font-size: 12px; }

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .admin-card .aliases-table-container {
    overflow-x: auto;
  }
}

/* =========================================
   MOBILE (até 640px)
   ========================================= */
@media (max-width: 640px) {
  .app-container {
    padding: 14px 12px 24px;
  }

  /* Cabeçalho em duas linhas: marca em cima, ações embaixo */
  .main-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }
  .brand { gap: 10px; }
  .brand-logo { width: 44px; height: 44px; }
  .brand-text h1 {
    font-size: 20px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .brand-text .subtitle { display: none; }
  .header-actions {
    width: 100%;
    gap: 8px;
  }
  .sync-status { flex: 0 0 auto; }
  .sync-text { display: none; }
  .header-actions .btn {
    flex: 1;
    padding: 10px 12px;
    min-height: 44px;
    white-space: nowrap;
  }

  /* Indicadores 2x2 compactos */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .kpi-card { padding: 12px 14px; }
  .kpi-card .kpi-icon { display: none; }
  .kpi-info .kpi-label { font-size: 10px; letter-spacing: 0.04em; }
  .kpi-info .kpi-value { font-size: 24px; }
  .kpi-sub { display: none; }

  /* Busca e abas: abas numa faixa rolável */
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .search-box { min-width: 0; width: 100%; }
  .search-box input { font-size: 16px; }
  .filter-tabs {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 40px;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Cartão do jogador */
  .players-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .player-card { padding: 14px; }
  .player-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .player-name {
    flex-wrap: wrap;
    gap: 6px;
  }
  .multitable-banner {
    flex-wrap: wrap;
    gap: 4px;
  }
  .table-row-item { padding: 10px 12px; }
  .table-row-top {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }
  .table-hero-nick { flex-wrap: wrap; }
  .table-right-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .history-item > div:last-child { text-align: left !important; }
  .player-card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-view-aliases { min-height: 36px; }

  /* Tabelas viram cartões empilhados */
  .aliases-table-container { overflow: visible; }
  .aliases-table thead { display: none; }
  .aliases-table,
  .aliases-table tbody,
  .aliases-table tr,
  .aliases-table td {
    display: block;
    width: 100%;
  }
  .aliases-table tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .aliases-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    border: none;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .aliases-table td[data-label]::before {
    content: attr(data-label);
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    flex-shrink: 0;
  }
  .aliases-table td.cell-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 8px;
  }
  .admin-card .aliases-table-container { overflow-x: visible; }

  /* Admin */
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card { padding: 14px; min-width: 0; }
  .admin-status, .admin-msg { overflow-wrap: anywhere; }
  .admin-form input,
  .admin-form select,
  .admin-role {
    font-size: 16px;
    min-height: 44px;
  }
  .admin-form .btn { min-height: 44px; width: 100%; }

  /* Janela de aliases em tela cheia */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-content {
    max-width: none;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    overflow-y: auto;
  }

  /* Login */
  .login-card { width: calc(100% - 24px); padding: 24px 18px; }
  .input-with-icon input { font-size: 16px; }
}

/* Tablet e celular (até 900px): evita estouro de largura */
@media (max-width: 900px) {
  .main-header { flex-wrap: wrap; gap: 12px; }
  .brand-text h1 { flex-wrap: wrap; gap: 6px; }
  .header-actions { flex-wrap: wrap; }
  .filter-tabs {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; white-space: nowrap; }
  .admin-card { min-width: 0; }
  .admin-status, .admin-msg { overflow-wrap: anywhere; }
}

/* =========================================
   BOTÃO COPIAR ID (número do Suprema após o "_" do nick)
   ========================================= */
.copy-id-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border: 1px solid var(--accent-blue-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  transition: background 0.15s ease;
}
.copy-id-btn:hover { background: rgba(59, 130, 246, 0.22); }
.copy-id-btn.copied,
.alias-tag-copy.copied {
  color: var(--accent-green);
  background: var(--accent-green-bg);
  border-color: var(--accent-green-border);
}
.nick-cell {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.nick-cell .copy-id-btn { margin-left: 0; }

@media (max-width: 640px) {
  .copy-id-btn {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
  }
}

/* Horários de início e fim do torneio */
.table-times {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}
.table-times strong {
  color: var(--text-main);
  font-weight: 600;
}
