/* ── Variables ── */
:root {
  --accent: #4e9af1;
  --surface: #161b22;
  --surface-raised: #1c2128;
  --border: #30363d;
}

/* ── Base ── */
body {
  background-color: #0d1117;
  color: #c9d1d9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Navbar ── */
#main-nav {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
}

.navbar-brand {
  letter-spacing: -.3px;
}

/* ── Cards ── */
.card {
  background-color: var(--surface);
  border-color: var(--border);
}

.card-header {
  background-color: var(--surface-raised);
  border-bottom-color: var(--border);
  padding: .65rem 1rem;
}

/* ── Stat cards ── */
.stat-card {
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

.stat-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.5px;
  color: #e6edf3;
}

.stat-label {
  font-size: .75rem;
  color: #6e7681;
  margin-top: .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Session timeline ── */
.session-timeline {
  overflow-y: auto;
  max-height: 480px;
}

.session-item {
  border-bottom: 1px solid #1c2128;
  transition: background .1s;
}

.session-item:last-child {
  border-bottom: none;
}

.session-item:hover {
  background-color: #1c2128;
}

.session-time {
  font-variant-numeric: tabular-nums;
  font-size: .75rem;
}

.session-line-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
  flex-shrink: 0;
}

.session-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent);
  border: 2px solid #0d1117;
  flex-shrink: 0;
}

.session-dot.dot-same {
  background-color: #2d5a8a;
}

.session-line {
  width: 2px;
  flex-grow: 1;
  min-height: 24px;
  background-color: #30363d;
  margin-top: 2px;
}

.session-duration {
  font-size: .72rem;
  white-space: nowrap;
}

/* ── Game icons ── */
.game-icon-sm {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: cover;
}

.game-icon-placeholder {
  background-color: #21262d;
  width: 32px;
  height: 32px;
}

/* ── Tables ── */
.table-dark {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: #1c2128;
  --bs-table-border-color: #21262d;
}

.table th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: .6rem;
  padding-bottom: .6rem;
}

/* ── Login page ── */
.login-bg {
  background: radial-gradient(ellipse at 50% 40%, #0d1f33 0%, #0d1117 70%);
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background-color: var(--surface);
  border-color: var(--border);
}

/* ── Alerts ── */
.alert {
  border-radius: 8px;
}

/* ── Touch targets ── */
.btn:not(.btn-close) {
  touch-action: manipulation;
}

.nav-link {
  touch-action: manipulation;
}

/* ── Misc ── */
.font-monospace {
  font-size: .88rem !important;
}

a {
  color: var(--accent);
}

a:hover {
  color: #80bfff;
}

.py-6 {
  padding-top: 3.5rem !important;
  padding-bottom: 3.5rem !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ── Mobile overrides (< 576px) ── */
@media (max-width: 575.98px) {
  .stat-card {
    padding: .65rem !important;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-icon {
    font-size: 1.1rem;
    margin-bottom: .25rem !important;
  }

  .stat-label {
    font-size: .68rem;
  }

  .card-header {
    padding: .5rem .75rem;
    font-size: .9rem;
  }

  .session-timeline {
    max-height: 340px;
  }

  /* Tighter session rows on mobile */
  .session-item {
    padding-left: .65rem !important;
    padding-right: .65rem !important;
  }

  /* Chart containers: ensure a useful minimum height */
  canvas {
    min-height: 180px;
  }

  /* Make toast full-width at bottom on mobile */
  #poll-toast {
    left: 0 !important;
    right: 0 !important;
    padding: .5rem !important;
  }

  #poll-toast-inner {
    width: 100%;
  }
}
