/* Loto+ web: mesmo visual do aplicativo (tema claro, cartões coloridos por jogo, barra na cor do jogo). */
:root {
  --brand: #185b9c;
  --brand-dark: #0e3f70;
  --green: #33cc33;
  --bg: #f2f5f9;
  --surface: #fff;
  --stroke: #dde5ee;
  --text: #1e2a38;
  --text-2: #667585;
  --game: #185b9c;
  --game-dark: #0e3f70;
  --game-accent: #185b9c;
  --game-soft: color-mix(in srgb, var(--game-accent) 22%, var(--surface));
  --link: #185b9c;
  --row: #eef2f6;
  --hover: #f1f4f8;
  --hover-green: #eef6ee;
  --hover-red: #fbeaec;
  --radius: 20px;
  --shadow: 0 2px 10px rgba(30, 42, 56, .10);
}

/* ---------- Tema escuro (js/theme.js põe data-theme="dark" no <html>) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131a;
  --surface: #18202b;
  --stroke: #2b3647;
  --text: #e6ecf3;
  --text-2: #98a6b8;
  --link: #7db8f2;
  --row: #222c3a;
  --hover: #243044;
  --hover-green: #1d2c22;
  --hover-red: #33222a;
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --game-soft: color-mix(in srgb, var(--game-accent) 35%, var(--surface));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
[hidden] { display: none !important; }

#app { flex: 1; width: 100%; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Home ---------- */
.strip {
  height: 6px;
  background: linear-gradient(90deg, #930089 0 11.11%, #209869 0 22.22%, #f78100 0 33.33%, #260085 0 44.44%, #7fb800 0 55.55%, #a61324 0 66.66%, #cb852b 0 77.77%, #a8cf45 0 88.88%, #2e3078 0);
}
.hero {
  background: var(--surface);
  border-radius: 0 0 36px 36px;
  box-shadow: 0 6px 18px rgba(30, 42, 56, .10);
  text-align: center;
  padding-bottom: 34px;
}
.hero img { width: min(300px, 70vw); margin-top: 34px; }
.hero p { margin: 10px 0 0; color: var(--text-2); font-size: 1.05rem; }
.section-title { margin: 40px 0 4px; font-size: 1.6rem; }
.section-sub { margin: 0 0 24px; color: var(--text-2); }

.games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 200px;
  padding: 22px;
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--game), var(--game-dark));
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(30, 42, 56, .22); }
.game-card .dots { position: absolute; top: 22px; left: 22px; width: 64px; height: 64px; }
.game-card .dots i { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .28); }
.game-card .dots i:nth-child(1) { width: 34px; height: 34px; left: 0; top: 0; }
.game-card .dots i:nth-child(2) { width: 26px; height: 26px; left: 28px; top: 12px; background: rgba(255, 255, 255, .4); }
.game-card .dots i:nth-child(3) { width: 24px; height: 24px; left: 6px; top: 34px; background: #fff; }
.game-card h3 { margin: 0; font-size: 1.5rem; }
.game-card span { opacity: .85; }

.note {
  margin: 28px 0 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .92rem;
}
.editions-title { margin-top: 40px; }
.editions { display: grid; grid-template-columns: 1fr; margin-top: 16px; }
.edition { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 24px; }
.edition + .edition { border-top: 1px solid var(--stroke); }
.edition h3 { margin: 0 0 8px; color: var(--link); font-size: 1.2rem; }
.edition p { margin: 0 0 18px; color: var(--text-2); font-size: .95rem; line-height: 1.45; flex: 1; }
.edition img { width: 200px; max-width: 100%; height: auto; display: block; }
@media (min-width: 700px) {
  .editions { grid-template-columns: repeat(2, 1fr); }
  .edition + .edition { border-top: 0; border-left: 1px solid var(--stroke); }
}
.db-status { margin: 22px 0 56px; text-align: center; color: var(--text-2); font-size: .9rem; white-space: pre-line; }

/* ---------- Barra de topo (cor do jogo) ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--game);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.topbar .wrap { display: flex; align-items: center; height: 60px; gap: 8px; }
.topbar .back {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: #fff; display: grid; place-items: center; text-decoration: none;
}
.topbar .back:hover { background: rgba(255, 255, 255, .16); }
.topbar .title { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 700; min-width: 0; }
.topbar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .title svg { width: 32px; height: 32px; flex: none; }
.topbar .about {
  width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center;
}
.topbar .about img { width: 26px; }

main.page { padding: 24px 0 120px; }

/* ---------- Ações do jogo ---------- */
.actions { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 8px; }
.action {
  display: flex; align-items: center; gap: 18px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text);
  transition: transform .15s, box-shadow .15s;
}
.action:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(30, 42, 56, .16); }
.action .ico { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--game-accent); display: grid; place-items: center; }
.action .ico svg { width: 28px; height: 28px; fill: #fff; }
.action b { display: block; font-size: 1.15rem; }
.action small { color: var(--text-2); font-size: .92rem; }

/* ---------- Resultados ---------- */
.status-line { color: var(--text-2); font-size: .9rem; margin: 0 0 12px; }
.results { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); overflow: hidden; }
.result { padding: 16px 20px; border-bottom: 1px solid var(--stroke); }
.result:last-child { border-bottom: 0; }
.result .head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.result .head b { font-size: 1.05rem; }
.result .head span { color: var(--text-2); font-size: .92rem; }
.balls { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.ball {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--game-accent); color: #fff; font-weight: 700; font-size: .92rem;
  display: grid; place-items: center;
}
.result .sub { color: var(--text-2); font-size: .9rem; }
.result .draw-label { margin: 10px 0 0; font-weight: 700; color: var(--game-accent); font-size: .9rem; }
.more { display: block; margin: 20px auto 0; padding: 12px 28px; border: 1px solid var(--game-accent); border-radius: 26px; background: var(--surface); color: var(--game-accent); font-weight: 700; }

/* ---------- Análise ---------- */
.group-title { margin: 32px 0 12px; font-size: 1.4rem; color: var(--game-accent); }
.group-title:first-child { margin-top: 0; }
.panels { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.panel { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.panel h3 { margin: 0; padding: 16px 18px 4px; font-size: 1.05rem; }
.panel .hint { margin: 0; padding: 0 18px 8px; color: var(--text-2); font-size: .82rem; }
.panel .scroll { max-height: 50vh; overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 9px 12px; text-align: center; font-size: .92rem; }
table.grid th { position: sticky; top: 0; background: var(--surface); color: var(--text-2); font-size: .8rem; border-bottom: 1px solid var(--stroke); }
table.grid td { border-bottom: 1px solid var(--row); }

/* ---------- Gerar jogo ---------- */
.cfg { background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.cfg-head { display: flex; align-items: center; justify-content: space-between; }
.cfg-head b { font-size: 1.05rem; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; }
.icon-btn:hover { background: var(--hover-green); }
.icon-btn svg { width: 28px; height: 28px; }
.cfg .empty { text-align: center; color: var(--text-2); padding: 10px 0 8px; }
.cfg-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 0; }
.cfg-row .icon-btn:hover { background: var(--hover-red); }
.field { margin: 20px 0 0; }
.field label { display: block; font-weight: 700; margin: 0 0 6px 4px; }
.field input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid var(--stroke); border-radius: 14px; background: var(--surface); font-size: 1rem;
}
.field input:focus { outline: 2px solid var(--game-accent); border-color: transparent; }
.total { margin: 18px 4px 0; font-size: 1.1rem; font-weight: 700; }
.btn-main {
  display: block; width: 100%; height: 60px; margin-top: 18px; border: 0; border-radius: 30px;
  background: var(--game); color: #fff; font-size: 1.1rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: var(--shadow);
}
.btn-main:disabled { opacity: .6; }
.generated { margin-top: 18px; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.generated h3 { margin: 0 0 4px; font-size: 1.05rem; }
.generated .warn { margin: 0 0 6px; color: var(--text-2); font-size: .9rem; }
.generated ol { margin: 8px 0 0; padding: 0; list-style: none; font-family: ui-monospace, Consolas, monospace; font-size: .98rem; }
.generated li { padding: 6px 0; word-spacing: .15em; }
.generated li i { font-style: normal; font-weight: 700; color: var(--game-accent); }

/* Botões flutuantes */
.fab {
  position: fixed; bottom: 22px; z-index: 30;
  width: 58px; height: 58px; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3); text-decoration: none;
  transition: transform .15s;
}
.fab:hover { transform: scale(1.08); }
.fab svg { width: 28px; height: 28px; fill: #fff; }
.fab.left { left: max(18px, calc((100vw - 1080px) / 2 + 20px)); background: var(--game); }
.fab.center { left: 50%; margin-left: -29px; background: var(--green); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: 0 16px 40px rgba(0, 0, 0, .35); }
.modal.soft { background: var(--bg); }
.modal .mh { padding: 18px 20px; background: var(--game); color: #fff; font-size: 1.15rem; font-weight: 700; }
.modal.soft .mh { background: transparent; color: var(--text); font-size: 1.3rem; padding-bottom: 8px; }
.modal .mb { overflow: auto; }
.modal .mf { display: flex; justify-content: flex-end; gap: 6px; padding: 10px; }
.modal .mf button { border: 0; background: transparent; padding: 10px 16px; border-radius: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.modal .mf button.ok { color: var(--game-accent); }
.modal .mf button:hover { background: var(--hover); }
.opt { padding: 15px 20px; border: 0; border-bottom: 1px solid var(--stroke); background: var(--surface); width: 100%; text-align: left; font-size: .98rem; }
.opt.on { background: var(--game-soft); }
.num-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 14px 18px; }
.num-grid button { height: 44px; border-radius: 22px; border: 1px solid var(--stroke); background: var(--surface); font-weight: 600; }
.num-grid button.on { background: var(--game-accent); border-color: var(--game-accent); color: #fff; }
.modal .hint { padding: 12px 20px 0; margin: 0; color: var(--text-2); font-size: .88rem; }
.save-opts { padding: 8px 16px; display: grid; gap: 10px; }
.save-opt { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--stroke); border-radius: var(--radius); background: var(--surface); text-align: left; width: 100%; }
.save-opt:hover { box-shadow: var(--shadow); }
.save-opt .ico { width: 44px; height: 44px; border-radius: 50%; background: var(--game); display: grid; place-items: center; flex: none; }
.save-opt .ico svg { width: 22px; height: 22px; fill: #fff; }
.save-opt b { display: block; }
.save-opt small { color: var(--text-2); }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; background: #333; color: #fff; padding: 12px 20px; border-radius: 24px; font-size: .92rem; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }

.loading { padding: 48px 0; text-align: center; color: var(--text-2); }
.error { padding: 28px; text-align: center; color: #a61324; background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius); }

footer.site { margin-top: auto; padding: 28px 20px 36px; text-align: center; color: var(--text-2); font-size: .9rem; border-top: 1px solid var(--stroke); background: var(--surface); }
footer.site a { margin: 0 10px; text-decoration: none; }
footer.site a:hover { text-decoration: underline; }
footer.site .by { margin-top: 12px; }
footer.site .by img { height: 34px; vertical-align: middle; margin-left: 8px; }

@media (max-width: 820px) {
  .games { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .panels { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
  .topbar .title { font-size: 1.1rem; }
}

/* ---------- Sobre o Loto+ (modal) ---------- */
.topbar .about { border: 0; padding: 0; cursor: pointer; }
.fab.right { right: max(18px, calc((100vw - 1080px) / 2 + 20px)); background: var(--brand); }
.about-body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 24px 8px; }
.about-logo { width: 220px; max-width: 80%; }
.about-link { display: inline-block; padding: 8px 12px; color: var(--link); text-decoration: underline; font-size: 1rem; }
.about-body > .about-logo + .about-link { margin-top: 14px; }
.about-version { color: var(--text-2); margin-top: 2px; }
.about-by { color: var(--text-2); margin-top: 36px; }
.about-cbpd { width: 260px; max-width: 90%; margin-top: 10px; }
.about-legal { display: flex; flex-direction: column; align-items: center; margin-top: 30px; }
.about-disclaimer { margin: 24px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-2); text-align: center; }

/* ---------- Botões flutuantes na barra de topo (computador) ----------
   No celular eles flutuam (Ver Estatística à esquerda, Salvar ao centro). A partir de 900 px de largura
   passam para a barra de topo, antes do botão "Sobre", em tamanho de ícone de barra. */
.topbar .fabs { display: contents; }
@media (min-width: 900px) {
  .topbar .fabs { display: flex; align-items: center; gap: 10px; margin-right: 12px; }
  .topbar .fabs .fab {
    position: static; margin: 0; width: 40px; height: 40px; box-shadow: none;
    background: rgba(255, 255, 255, .2);
  }
  .topbar .fabs .fab:hover { background: rgba(255, 255, 255, .34); transform: none; }
  .topbar .fabs .fab.center { background: var(--green); }
  .topbar .fabs .fab.center:hover { background: #2bb82b; }
  .topbar .fabs .fab svg { width: 22px; height: 22px; }
}

/* ---------- Tema claro/escuro: botão e logos ---------- */
/* Lua no tema claro, sol no escuro; os dois SVGs ficam no botão e o CSS escolhe qual mostrar */
.theme-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: inherit; }
.theme-btn svg { width: 24px; height: 24px; fill: currentColor; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
.topbar .theme-btn { color: #fff; }
.topbar .theme-btn:hover { background: rgba(255, 255, 255, .16); }
.hero { position: relative; }
.hero .theme-btn { position: absolute; top: 18px; right: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--stroke); box-shadow: var(--shadow); }

/* Logo com o nome: a escura (letras brancas) no tema escuro */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }
:root[data-theme="dark"] .logo-light { display: none; }
/* A logo do CBPD tem letras escuras: no tema escuro ela fica sobre uma placa branca */
:root[data-theme="dark"] .about-cbpd,
:root[data-theme="dark"] footer.site .by img { background: #fff; border-radius: 10px; padding: 4px 10px; }

/* Números da Sorte: combo "quantos sortear dos escolhidos" */
.num-count { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px 0; font-size: .95rem; }
.num-count select { height: 40px; padding: 0 10px; border: 1px solid var(--stroke); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
