/* =====================================================================
   CONTROLE DE JOGOS - estilo
   Tema escuro com destaque roxo. Tudo responsivo (celular e computador).
   ===================================================================== */
:root {
  --bg: #0f0f16;
  --bg-2: #14141d;
  --surface: #1a1a26;
  --surface-2: #222231;
  --border: #2c2c40;
  --text: #ecebf5;
  --muted: #9b9bb4;
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(139, 92, 246, .16);
  --green: #22c55e;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #38bdf8;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(124, 58, 237, .18), transparent 60%), var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
::selection { background: var(--accent); color: #fff; }

.carregando-inicial {
  min-height: 100vh; display: grid; place-content: center; gap: 12px; justify-items: center; color: var(--muted);
}

/* ---------- Layout ------------------------------------------------ */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-2); border-right: 1px solid var(--border);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.marca img { width: 36px; height: 36px; }
.marca strong { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.marca small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav-grupo { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14px; transition: .15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.ativo { background: var(--accent-soft); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .badge { margin-left: auto; }
.sidebar .rodape { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topo {
  display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 22, .7); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topo h1 { font-size: 19px; font-weight: 700; }
.topo .espaco { flex: 1; }
.btn-menu { display: none; }
.conteudo { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.aviso-vendo { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Componentes ------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(124, 58, 237, .35); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.perigo { color: var(--red); }
.btn.perigo:hover { border-color: var(--red); background: rgba(248, 113, 113, .1); }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--muted); }
.btn.fantasma:hover { color: var(--text); background: var(--surface); }
.btn.pequeno { padding: 6px 10px; font-size: 13px; }
.btn.icone { padding: 8px; width: 38px; height: 38px; }
.btn svg { width: 18px; height: 18px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.jogando  { background: rgba(251, 191, 36, .16); color: var(--yellow); }
.badge.pendente { background: rgba(248, 113, 113, .16); color: var(--red); }
.badge.zerado   { background: rgba(34, 197, 94, .16); color: var(--green); }
.badge.roxo     { background: var(--accent-soft); color: #c4b5fd; }

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--muted); }
.campo input, .campo select, .campo textarea, .busca input {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); outline: none; transition: .15s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus, .busca input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.campo textarea { min-height: 90px; resize: vertical; }
.campo select option { background: var(--surface); }
.campo .ajuda { font-size: 12px; color: var(--muted); }
.campo input[type="file"] { padding: 8px; }
.campo input[type="date"] { color-scheme: dark; }
.linha-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.segmento { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.segmento button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 13px; }
.segmento button.ativo { background: var(--surface-2); color: #fff; }
.segmento button.ativo.jogando { color: var(--yellow); }
.segmento button.ativo.pendente { color: var(--red); }
.segmento button.ativo.zerado { color: var(--green); }

.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.cartao + .cartao { margin-top: 18px; }
.cartao h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.cartao h2 .badge { margin-left: auto; }
.cartao h2 svg { width: 18px; height: 18px; color: var(--accent); flex: none; }

.busca { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.busca input { padding-left: 38px; }
.barra { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.barra select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); }

.vazio { text-align: center; color: var(--muted); padding: 50px 20px; }
.vazio svg { width: 48px; height: 48px; opacity: .5; margin: 0 auto 10px; }
.vazio strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---------- Painel ---------------------------------------------------- */
.saudacao { margin-bottom: 20px; }
.saudacao h2 { font-size: 26px; font-weight: 800; }
.saudacao p { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; transition: .15s; color: var(--text);
}
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile .icone { width: 44px; height: 44px; border-radius: 12px; display: grid; place-content: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile .icone svg { width: 22px; height: 22px; }
.tile .icone.amarelo { background: rgba(251, 191, 36, .16); color: var(--yellow); }
.tile .icone.vermelho { background: rgba(248, 113, 113, .16); color: var(--red); }
.tile .icone.verde { background: rgba(34, 197, 94, .16); color: var(--green); }
.tile .icone.azul { background: rgba(56, 189, 248, .16); color: var(--blue); }
.tile .icone.rosa { background: rgba(244, 114, 182, .16); color: #f472b6; }
.tile strong { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.tile span { color: var(--muted); font-size: 13px; }

.secao-titulo { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.secao-titulo h3 { font-size: 16px; }
.secao-titulo a { font-size: 13px; font-weight: 600; }

/* ---------- Cards de jogos ---------------------------------------- */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.jogo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  position: relative; transition: .18s; cursor: pointer; display: flex; flex-direction: column;
}
.jogo-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #3b3b56; }
.capa { aspect-ratio: 3 / 4; background: var(--surface-2); position: relative; overflow: hidden; }
.capa img { width: 100%; height: 100%; object-fit: cover; }
.capa .sem-capa { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 14px; color: #fff; font-weight: 800; font-size: 22px; background: linear-gradient(135deg, #3b2a6b, #1c1c2e); }
.capa .sem-capa small { display: block; font-size: 11px; font-weight: 500; opacity: .7; margin-top: 4px; }
.capa .status { position: absolute; left: 8px; top: 8px; }
.capa .fav { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-content: center; cursor: pointer; }
.capa .fav svg { width: 16px; height: 16px; }
.capa .fav.ativo { color: #f472b6; }
.capa .conquista { position: absolute; right: 8px; bottom: 8px; height: 26px; padding: 0 8px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: var(--yellow); display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; }
.capa .conquista svg { width: 14px; height: 14px; }
.capa .conquista.completo { color: var(--green); }

/* ---------- Metas / conquistas ------------------------------------ */
.metas { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.meta { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); }
.meta-check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--muted); background: transparent; color: #fff; display: grid; place-content: center; cursor: pointer; flex: none; font-weight: 800; font-size: 14px; padding: 0; }
.meta.ok .meta-check { background: var(--green); border-color: var(--green); color: #0b1a10; }
.meta-texto { flex: 1; font-size: 14px; }
.meta.ok .meta-texto { color: var(--muted); text-decoration: line-through; }
.meta .btn.icone { width: 28px; height: 28px; padding: 4px; }
.meta .btn.icone svg { width: 14px; height: 14px; }
.meta-nova { display: flex; gap: 8px; }
.meta-nova input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); outline: none; }
.meta-nova input:focus { border-color: var(--accent); }
.metas-cabeca { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.capa .nota { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .65); padding: 2px 8px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.jogo-card .info { padding: 10px 12px 12px; }
.jogo-card .info h4 { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jogo-card .info .meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.grade.compacta { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* ---------- Login ------------------------------------------------- */
.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.caixa-login { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.caixa-login .marca { justify-content: center; padding-bottom: 6px; }
.caixa-login p.sub { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.caixa-login .btn { width: 100%; }
.caixa-login .trocar { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ---------- Estatísticas ------------------------------------------ */
.barras { display: flex; flex-direction: column; gap: 10px; }
.barra-item { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barra-item .rotulo { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-item .trilha { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.barra-item .preenche { height: 100%; background: linear-gradient(90deg, var(--accent), #c4b5fd); border-radius: 999px; }
.barra-item .valor { font-weight: 700; min-width: 30px; text-align: right; }
.colunas { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.coluna { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 11px; color: var(--muted); }
.coluna .haste { width: 100%; max-width: 34px; background: linear-gradient(180deg, #c4b5fd, var(--accent)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.coluna b { color: var(--text); }
.grade-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grade-stats .cartao + .cartao { margin-top: 0; }
.lista-simples { display: flex; flex-direction: column; gap: 8px; }
.lista-simples .item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; background: var(--bg-2); }
.lista-simples .item img, .lista-simples .item .mini { width: 40px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
.lista-simples .item .nome { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-simples .item .valor { font-weight: 700; color: var(--accent); }

/* ---------- Comparar ---------------------------------------------- */
.ranking { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.jogador { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.jogador.eu { border-color: var(--accent); }
.jogador .cabeca { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.jogador .posicao { font-size: 22px; font-weight: 800; color: var(--accent); width: 34px; }
.jogador .nome { font-weight: 700; font-size: 16px; }
.jogador .metricas { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jogador .metricas div { background: var(--bg-2); border-radius: 10px; padding: 8px 10px; }
.jogador .metricas b { display: block; font-size: 18px; }
.jogador .metricas span { font-size: 12px; color: var(--muted); }
.jogador .acoes { margin-top: 12px; display: flex; gap: 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: #c4b5fd; display: grid; place-content: center; font-weight: 800; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.grande { width: 96px; height: 96px; font-size: 34px; }
.avatar.pequeno { width: 30px; height: 30px; font-size: 13px; }

/* ---------- Tabela ------------------------------------------------ */
table.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th, .tabela td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.tabela th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tabela img.mini { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }

/* ---------- Modal / toast ----------------------------------------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow); }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.modal .acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--surface-2); border: 1px solid var(--border); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: subir .25s ease; }
.toast.erro { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); }
@keyframes subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.preview-img { width: 120px; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.preview-img.larga { width: 100%; max-width: 360px; aspect-ratio: 16/9; }
.form-acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.form-acoes .direita { margin-left: auto; }
.form-max { max-width: 820px; }

.carregando { display: grid; place-content: center; padding: 60px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: girar .8s linear infinite; margin: 0 auto 10px; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Responsivo -------------------------------------------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .22s; z-index: 40; box-shadow: var(--shadow); }
  .sidebar.aberta { transform: none; }
  .fundo-menu { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 35; }
  .btn-menu { display: inline-flex; }
  .conteudo { padding: 16px; }
  .topo { padding: 12px 16px; }
  .grade { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .barra-item { grid-template-columns: 90px 1fr auto; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile strong { font-size: 18px; }
}
