﻿/* Shell/base stylesheet â€” Betano-inspired dark theme.
   Brand: #FF3D00 (laranja) sobre #0E0F22 (azul-noite).
   Per-game rules live in /static/css/games/*.css and load on demand. */

:root {
  --brand: #ff3d00;
  --brand-2: #e63500;
  --brand-soft: rgba(255, 61, 0, .14);
  --bg: #0e0f22;
  --bg2: #15162c;
  --panel: #191a33;
  --panel2: #212243;
  --line: #2b2c50;
  --txt: #f4f5ff;
  --muted: #9295bb;
  --win: #12b76a;
  --gold: #ffd666;
  --loss: #ef4444;
  --radius: 14px;
}

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

body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Haffer", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand h1, .topbar h2 { font-family: "MD Nichrome", "Archivo Black", "Inter", sans-serif; }

.app {
  display: grid;
  grid-template-areas: "nav nav" "side main";
  grid-template-columns: 262px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  transition: grid-template-columns .18s ease;
  position: relative;
}

.app.app-collapsed {
  grid-template-columns: 0 1fr;
}

.app.app-collapsed .sidebar {
  position: fixed;
  top: 50px;
  left: 0;
  height: calc(100vh - 50px);
  z-index: 35;
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
}

.app.app-collapsed .sidebar.show {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* --------------------------------------------------------------- topnav */
.topnav {
  grid-area: nav;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  height: 50px; /* reduz 20% de 62px */
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  box-shadow: 0 4px 22px rgba(255, 61, 0, .22);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topnav .logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 21px; letter-spacing: .4px; color: #fff;
  text-transform: lowercase;
}
.topnav .logo .bolt { font-size: 22px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.25)); }
.topnav .nav-links { display: flex; gap: 4px; }
.topnav .nav-links a {
  color: rgba(255,255,255,.9); text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 8px 13px; border-radius: 10px; transition: .15s;
}
.topnav .nav-links a:hover { background: rgba(0,0,0,.16); color: #fff; }
.topnav .spacer { margin-left: auto; }

.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .who { display: flex; align-items: center; gap: 9px; }
.userbox .avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0,0,0,.28); font-size: 18px; overflow: hidden;
}
.userbox-avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.userbox .who small { display: block; color: rgba(255,255,255,.8); font-size: 10.5px; line-height: 1.1; }
.userbox .who b { font-size: 13px; }
.balance-pill {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.30); padding: 8px 14px; border-radius: 999px;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.balance-pill span { font-size: 10px; color: rgba(255,255,255,.75); font-weight: 600; }
.balance-pill b { color: #fff; font-size: 14px; }
.btn-ghost {
  background: rgba(0,0,0,.22); color: #fff; border: 1px solid rgba(255,255,255,.35);
  padding: 8px 14px; border-radius: 10px; font-weight: 800; font-size: 12px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(0,0,0,.34); }

/* -------------------------------------------------------------- sidebar */
.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #111226, #0c0d1d);
  position: sticky;
  top: 50px;
  height: calc(100vh - 50px);
  overflow: auto;
  transition: transform .18s ease, opacity .18s ease;
  will-change: transform;
}
.side-sec { font-size: 10px; letter-spacing: 1.4px; color: var(--muted); text-transform: uppercase; }

.games { display: flex; flex-direction: column; gap: 7px; }
.game-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  cursor: pointer;
  transition: .16s;
}
.game-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.game-item.active { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.game-item .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-item strong { font-size: 12.5px; }
.game-item small { color: var(--muted); font-size: 10px; }
.pool-card { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--bg2); }
.pool-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 9.5px; letter-spacing: .8px; color: var(--muted); }
.pool-head b { font-size: 15px; color: var(--gold); font-variant-numeric: tabular-nums; }
.pool-bar { height: 6px; margin: 8px 0 6px; border-radius: 4px; background: rgba(148, 163, 184, .18); overflow: hidden; }
.pool-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--gold)); transition: width .4s; }
.pool-card small { color: var(--muted); font-size: 9.5px; }

/* --------------------------------------------------------------- main */
.main { grid-area: main; display: flex; flex-direction: column; gap: 16px; padding: 18px; min-width: 0; min-height: 0; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; flex-shrink: 0; }

#stage { display: flex; flex-direction: column; min-height: 0; }


#stage { display: block; min-height: 120px; }

.panel { padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.panel h3 { margin-bottom: 12px; font-size: 13px; letter-spacing: .3px; }
.tag { color: var(--muted); font-size: 9.5px; font-weight: 400; }

/* -------------------------------------------------------------- admin */
.admin { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; color: var(--muted); letter-spacing: .3px; }
.row { display: flex; gap: 7px; }
.row input {
  flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt); font-size: 13px;
}
.row button {
  padding: 9px 14px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 800; white-space: nowrap;
}
.row button:hover { background: var(--brand-2); }
.divider { height: 1px; background: var(--line); }
.out {
  background: #0a0b1a; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font-size: 10.5px; color: #9fe8b5; max-height: 120px;
  overflow: auto; white-space: pre-wrap; font-family: Consolas, monospace;
}

/* --------------------------------------------------- history & toggle */
.toggle { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.toggle input { display: none; }
.toggle span {
  position: relative; width: 34px; height: 19px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); transition: .16s; flex: none;
}
.toggle span::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 13px; height: 13px; border-radius: 50%; background: var(--muted); transition: .16s;
}
.toggle input:checked + span { background: var(--brand-soft); border-color: var(--brand); }
.toggle input:checked + span::after { left: 17px; background: var(--brand); }

/* -------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 130%);
  background: var(--panel2); border: 1px solid var(--brand); color: var(--txt);
  padding: 12px 20px; border-radius: 12px; font-size: 13px; transition: .3s; z-index: 80;
  max-width: 90vw;
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { border-color: var(--loss); }

/* -------------------------------------------------------------- login */
.auth-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: none; place-items: center;
  background: radial-gradient(1200px 500px at 50% -10%, rgba(255,61,0,.22), transparent 60%), #0a0b18;
  padding: 20px;
}
.auth-overlay.show { display: grid; }
.auth-card {
  width: 100%; max-width: 400px; padding: 30px 26px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55); text-align: center;
}
.auth-card .logo { font-size: 30px; font-weight: 900; color: #fff; text-transform: lowercase; letter-spacing: .5px; }
.auth-card .logo .bolt { color: var(--brand); }
.auth-card p { color: var(--muted); font-size: 12.5px; margin: 8px 0 22px; }
.auth-card .stack { display: flex; flex-direction: column; gap: 10px; }
.btn-discord {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #5865f2; color: #fff; border: none; border-radius: 12px;
  padding: 13px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.btn-discord:hover { background: #4752c4; }
.btn-brand {
  background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 13px; font-weight: 800; font-size: 14px; cursor: pointer;
}
.btn-brand:hover { background: var(--brand-2); }
.auth-card input {
  padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--txt); font-size: 14px; text-align: center;
}
.auth-card .hint { margin-top: 16px; font-size: 10.5px; color: var(--muted); }

@media (max-width: 1150px) {
  .app { grid-template-areas: "nav" "main"; grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom { grid-template-columns: 1fr; }
}

.sidebar-toggle {
  position: fixed;
  top: 6px;
  left: 10px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform .12s ease, background .12s ease;
  line-height: 1;
}
.sidebar-toggle:hover { background: rgba(0, 0, 0, .4); }
.sidebar-toggle:active { transform: scale(.96); }


/* ------------------------------------------- telas de conta (rank/historico) */
/* Compartilhado com o painel admin: mesmas classes de tabela e KPI, para o
   jogador e o admin lerem listas do mesmo jeito. */

.view { max-width: 900px; }
.view h3 { font-size: 15px; margin-bottom: 4px; }
.view h4 {
  margin: 20px 0 8px; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
}
.view .muted { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; }
.kpi {
  padding: 12px 14px; border-radius: 14px;
  background: var(--panel2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px;
}
.kpi span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.kpi b { font-size: 19px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 11px; color: var(--muted); }

.table-wrap { overflow-x: auto; margin-top: 10px; }
.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.grid th {
  text-align: left; padding: 8px 10px; white-space: nowrap;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.grid td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, .05); white-space: nowrap; }
.grid tbody tr:hover { background: rgba(255, 255, 255, .03); }
.grid small.block { display: block; font-size: 10.5px; color: var(--muted); }

.avatar.sm { width: 24px; height: 24px; }
.avatar.text { display: grid; place-items: center; font-size: 11px; background: rgba(0,0,0,.28); border-radius: 50%; }
.view .who { display: flex; align-items: center; gap: 8px; }

.pos { color: #2ee6a8; }
.neg { color: #ff5c7a; }

/* Abas: usadas pelo rank do jogador e pelo painel admin. */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.tabs .tab {
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted);
  font-size: 12px; font-weight: 700; text-transform: capitalize;
}
.tabs .tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Filtros em pílula do histórico. */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 4px; }
.chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 700;
}
.chip.on { background: rgba(255,255,255,.10); color: var(--txt); border-color: var(--brand); }

.empty {
  padding: 22px 14px; text-align: center; color: var(--muted); font-size: 12.5px;
  border: 1px dashed var(--line); border-radius: 14px; margin-top: 12px;
}

.grid td.pos-num { color: var(--muted); font-variant-numeric: tabular-nums; width: 34px; }
.grid b.pos { font-variant-numeric: tabular-nums; }

/* Podio do top 3: o topo da linha de ORDER BY merece mais que uma tabela. */
.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  align-items: end; margin-top: 16px;
}
.podium-card {
  position: relative; padding: 16px 12px 14px; border-radius: 16px; text-align: center;
  background: var(--panel2); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
/* O primeiro colocado cresce e ganha o acento da marca. */
.podium-card.place-0 {
  padding-top: 22px; border-color: var(--brand);
  background: linear-gradient(180deg, rgba(255,61,0,.16), var(--panel2));
}
.podium-card .podium-medal { font-size: 22px; line-height: 1; }
.podium-card b { font-size: 17px; font-variant-numeric: tabular-nums; }
.podium-card small { font-size: 10.5px; color: var(--muted); }
.podium-card .who { flex-direction: column; gap: 6px; font-size: 12.5px; }

@media (max-width: 560px) {
  .podium { grid-template-columns: 1fr; }
}
