:root {
  --bg: #07111f;
  --panel: #0d1b2d;
  --panel2: #11243a;
  --border: #203750;
  --text: #f4f7fb;
  --muted: #91a4ba;
  --green: #20e39a;
  --blue: #2d8cff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: 95px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px;
  border-bottom: 1px solid var(--border);
  background: #091625;
}

h1 {
  margin: 0;
  font-size: 24px;
}

header p, .subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.online {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

main {
  width: min(900px, 92%);
  margin: 25px auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.match-card,
.analysis-card,
.stat-card {
  background: linear-gradient(145deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin: 14px 0;
}

.competition {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 15px;
}

.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.match-card button {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #04120d;
  font-weight: 800;
  cursor: pointer;
}

.bankroll-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #091625;
  border-top: 1px solid var(--border);
  padding: 10px;
}

nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

nav button span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

@media (max-width: 600px) {
  header {
    padding: 16px;
  }

  .teams {
    grid-template-columns: 1fr;
  }

  .bankroll-grid {
    grid-template-columns: 1fr 1fr;
  }
}
/* Sélecteur de sports */

.sport-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0 12px;
}

.sport-btn {
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.sport-btn:hover {
  border-color: var(--blue);
  color: var(--text);
}

.sport-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.sport-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0;
}

.analysis-title {
  margin-top: 25px;
}

.analysis-title p {
  color: var(--muted);
}

.prediction-card h3 {
  margin-top: 5px;
}

@media (max-width: 600px) {
  .sport-selector {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== BANKROLL ===== */

.bet-manager {
  margin-top: 30px;
}

.bet-manager h3 {
  margin: 24px 0 14px;
  color: #ffffff;
}

#betForm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px;
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
}

#betForm input,
#betForm select {
  width: 100%;
  padding: 12px 14px;
  color: #ffffff;
  background: #0d0d0d;
  border: 1px solid #333333;
  border-radius: 8px;
  box-sizing: border-box;
}

#betForm button {
  padding: 12px 18px;
  color: #000000;
  font-weight: 700;
  background: #d8ff00;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.bet-history-item {
  margin-bottom: 12px;
  padding: 16px 18px;
  background: #151515;
  border: 1px solid #2a2a2a;
  border-left: 4px solid #d8ff00;
  border-radius: 10px;
}

.bet-history-item p {
  margin: 7px 0;
}

.bet-history-item select {
  margin-left: 8px;
  padding: 7px 10px;
  color: #ffffff;
  background: #0d0d0d;
  border: 1px solid #444444;
  border-radius: 6px;
}

.bet-history-item button {
  margin-top: 12px;
  padding: 7px 12px;
  color: #ffffff;
  background: #b42323;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

@media (max-width: 800px) {
  #betForm {
    grid-template-columns: 1fr;
  }
}

/* Stabiliser les dimensions du graphique */
#performances .performance-panel {
  min-width: 0;
  max-width: 100%;
}

#performances .capital-chart {
  position: relative;
  width: 100%;
  height: 300px;
  min-height: 300px;
  max-height: 300px;
  overflow: hidden;
}

#performances #capitalChart {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Présentation de l'onglet Performances */
#performances .bankroll-grid {
  gap: 16px;
  margin-bottom: 24px;
}

#performances .performance-panel {
  box-sizing: border-box;
  margin-top: 24px;
  padding: 22px;
  background: #101f30;
  border: 1px solid #243b53;
  border-radius: 16px;
}

#performances .performance-panel h3 {
  margin: 0 0 16px;
  color: #f1f5f9;
  font-size: 19px;
}

#performances .performance-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

#performanceSportFilter {
  padding: 10px 14px;
  max-width: 100%;
  background: #091525;
  color: #e2e8f0;
  border: 1px solid #34506b;
  border-radius: 9px;
  font: inherit;
}

#performances .performance-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 22px;
}

#performances .performance-periods button {
  padding: 10px 15px;
  background: #182c42;
  color: #cbd5e1;
  border: 1px solid #34506b;
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
}

#performances .performance-periods button:hover {
  background: #24415d;
}

#performances .performance-periods button.active {
  background: #2dd4bf;
  border-color: #2dd4bf;
  color: #062923;
  font-weight: 700;
}

#performances .performance-periods button:focus-visible,
#performanceSportFilter:focus-visible {
  outline: 2px solid #2dd4bf;
  outline-offset: 3px;
}

#performances .performance-table-wrapper {
  overflow-x: auto;
}

#performances .performance-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

#performances .performance-table th,
#performances .performance-table td {
  padding: 14px 12px;
  text-align: right;
  border-bottom: 1px solid #243b53;
}

#performances .performance-table th {
  color: #94a3b8;
  font-size: 13px;
}

#performances .performance-table td {
  color: #e2e8f0;
}

#performances .performance-table th:first-child,
#performances .performance-table td:first-child {
  text-align: left;
}

@media (max-width: 600px) {
  #performances .performance-panel {
    padding: 14px;
  }

  #performances .performance-periods button {
    padding: 9px 11px;
    font-size: 13px;
  }
}

.recent-trends {
  margin-top: 24px;
}

.trend-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.trend-periods button {
  padding: 10px 14px;
  background: #182c42;
  color: #e2e8f0;
  border: 1px solid #34506b;
  border-radius: 9px;
  font: inherit;
  cursor: pointer;
}

.trend-periods button[aria-pressed="true"] {
  background: #2dd4bf;
  color: #062923;
  border-color: #2dd4bf;
  font-weight: 700;
}

.trend-periods button:focus-visible {
  outline: 2px solid #2dd4bf;
  outline-offset: 3px;
}

.trend-table-wrapper {
  overflow-x: auto;
}

.trend-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  text-align: center;
}

.trend-table th,
.trend-table td {
  padding: 16px 10px;
}

.trend-table thead th {
  color: #e2e8f0;
  font-size: 14px;
}

.trend-table tbody th {
  background: #14263a;
  color: #f1f5f9;
  font-weight: 600;
}

.trend-value {
  width: 23%;
  border-radius: 5px;
}

.trend-value strong {
  display: block;
  font-size: 25px;
}

.trend-value span {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

.trend-red-dark {
  background: #b91c1c;
  color: #ffffff;
}

.trend-red-light {
  background: #f29b91;
  color: #431411;
}

.trend-green-light {
  background: #cee9ab;
  color: #203615;
}

.trend-green-dark {
  background: #287a35;
  color: #ffffff;
}

.trend-empty {
  background: #243447;
  color: #cbd5e1;
}

.trend-note {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .trend-table th,
  .trend-table td {
    padding: 12px 6px;
    font-size: 12px;
  }

  .trend-value strong {
    font-size: 20px;
  }
}
