/* ============ SALA DE JOGOS — estilos gerais ============ */
:root {
  --bg: #0F0A26; --bg2: #171037; --panel: #1E1648; --panel2: #271D5C; --line: rgba(255,255,255,.10);
  --text: #F5F3FF; --muted: #B4AED8; --dim: #8079AD;
  --violet: #8B5CF6; --pink: #EC4899; --orange: #F97316; --cyan: #22D3EE; --yellow: #FACC15; --green: #22C55E; --red: #EF4444;
  --grad: linear-gradient(135deg, #8B5CF6 0%, #D946EF 55%, #F97316 100%);
  --r: 18px; --shadow: 0 18px 50px rgba(0,0,0,.35);
  --font-d: 'Fredoka', 'Nunito', system-ui, sans-serif; --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: #0F0A26; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 500px at 10% -10%, rgba(139,92,246,.28), transparent 60%),
              radial-gradient(700px 500px at 100% 0%, rgba(236,72,153,.18), transparent 60%),
              radial-gradient(800px 600px at 50% 110%, rgba(34,211,238,.10), transparent 60%); }
a { color: var(--cyan); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
h1, h2, h3, h4 { font-family: var(--font-d); font-weight: 600; margin: 0 0 .4em; line-height: 1.15; letter-spacing: .2px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: .86rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.grow { flex: 1; }
.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 16px; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-icon { width: 44px; height: 44px; filter: drop-shadow(0 6px 14px rgba(217,70,239,.35)); flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: .95; }
.logo-big { padding-bottom: .12em; }
.logo-small { font-family: var(--font); font-weight: 800; font-size: .72rem; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }
.logo-big { font-family: var(--font-d); font-weight: 700; font-size: 1.75rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.xl .logo-icon { width: 92px; height: 92px; }
.logo.xl .logo-small { font-size: 1.05rem; letter-spacing: 5px; }
.logo.xl .logo-big { font-size: 3.6rem; }

/* ---------- botões & campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 12px 20px;
  font-weight: 800; background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(217,70,239,.30); transition: transform .12s, filter .12s, opacity .12s; text-decoration: none; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.btn.ghost { background: rgba(255,255,255,.06); box-shadow: none; border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255,255,255,.10); }
.btn.danger { background: var(--red); box-shadow: 0 8px 22px rgba(239,68,68,.25); }
.btn.ok { background: var(--green); box-shadow: 0 8px 22px rgba(34,197,94,.25); }
.btn.sm { padding: 8px 14px; border-radius: 11px; font-size: .9rem; }
.btn.lg { padding: 16px 26px; font-size: 1.1rem; border-radius: 16px; }
.btn.block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: .9rem; color: var(--muted); }
.input, .field input, .field select, .field textarea, select.input {
  width: 100%; background: rgba(255,255,255,.05); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none; transition: border .15s, background .15s; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--violet); background: rgba(139,92,246,.08); }
select option { background: var(--bg2); color: var(--text); }
.hint { font-size: .82rem; color: var(--dim); }
.pw-rules { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.pw-rules span { font-size: .78rem; padding: 3px 9px; border-radius: 99px; background: rgba(255,255,255,.06); color: var(--dim); border: 1px solid var(--line); }
.pw-rules span.ok { color: #86EFAC; border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.10); }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); font-size: .8rem; font-weight: 800; padding: 6px; }
.error-box { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #FCA5A5; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .92rem; }

/* ---------- cartões ---------- */
.card { background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; font-weight: 800; font-size: .82rem; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.pill.y1 { background: rgba(34,211,238,.14); border-color: rgba(34,211,238,.4); color: #A5F3FC; }
.pill.y2 { background: rgba(250,204,21,.14); border-color: rgba(250,204,21,.4); color: #FDE68A; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.25); display: inline-block; }

/* ---------- avatar ---------- */
.av { --c: #8B5CF6; width: 38px; height: 38px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; font-size: .85rem;
  background: var(--c); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2), 0 0 0 2px rgba(255,255,255,.18); font-family: var(--font-d); letter-spacing: .5px; }
.av.lg { width: 56px; height: 56px; font-size: 1.15rem; } .av.sm { width: 28px; height: 28px; font-size: .7rem; }

/* ---------- topo ---------- */
.topbar { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(14px); background: rgba(15,10,38,.72); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 68px; }
.topbar nav { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.navlink { padding: 8px 14px; border-radius: 11px; color: var(--muted); font-weight: 800; text-decoration: none; background: none; border: 0; }
.navlink:hover, .navlink.on { color: var(--text); background: rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 12px 5px 5px; border-radius: 99px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-weight: 800; }

/* ---------- autenticação ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(20px, 5vw, 72px); overflow: hidden; }
.auth-hero h1 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); margin-top: 28px; }
.auth-hero p { color: var(--muted); max-width: 470px; font-size: 1.08rem; }
.hero-games { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 30px; max-width: 520px; }
.hero-games div { aspect-ratio: 1; border-radius: 18px; display: grid; place-items: center; color: #fff; box-shadow: var(--shadow); animation: floaty 5s ease-in-out infinite; }
.hero-games div:nth-child(2) { animation-delay: -1s; } .hero-games div:nth-child(3) { animation-delay: -2s; } .hero-games div:nth-child(4) { animation-delay: -3s; } .hero-games div:nth-child(5) { animation-delay: -4s; }
.hero-games svg { width: 58%; height: 58%; }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: min(470px, 100%); }
.tabs { display: flex; background: rgba(255,255,255,.05); border: 1px solid var(--line); padding: 5px; border-radius: 14px; margin-bottom: 20px; }
.tabs button { flex: 1; padding: 10px; border: 0; background: none; border-radius: 10px; font-weight: 800; color: var(--muted); }
.tabs button.on { background: var(--grad); color: #fff; }
.two { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.field input, .field select, .field textarea, .input { min-width: 0; }
.year-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.year-pick label { cursor: pointer; position: relative; }
.year-pick input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.year-pick .yc { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 10px; border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.04); transition: .15s; }
.year-pick .yc b { font-family: var(--font-d); font-size: 2rem; line-height: 1; }
.year-pick .yc span { color: var(--muted); font-weight: 700; font-size: .85rem; }
.year-pick input:checked + .yc { border-color: transparent; background: var(--grad); box-shadow: 0 10px 26px rgba(217,70,239,.35); }
.year-pick input:checked + .yc span { color: #fff; }
.year-pick input:focus-visible + .yc { outline: 3px solid var(--cyan); }

/* ---------- início ---------- */
.home-hero { padding: 34px 0 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.home-hero h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; padding: 18px 0 40px; }
.game-card { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); min-height: 230px; padding: 22px; display: flex; flex-direction: column; justify-content: flex-end;
  text-align: left; color: #fff; background: var(--bg2); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; min-height: 250px; }
.game-card:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.game-card .gc-art { position: absolute; inset: 0; z-index: 0; }
.game-card .gc-icon { position: absolute; right: 18px; top: 16px; width: 88px; height: 88px; opacity: .95; color: #fff; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
.game-card h3 { position: relative; font-size: 1.65rem; margin-bottom: 4px; text-shadow: 0 3px 12px rgba(0,0,0,.4); }
.game-card p { position: relative; margin: 0 0 14px; color: rgba(255,255,255,.88); font-weight: 600; max-width: 75%; }
.game-card .play { position: relative; align-self: flex-start; background: rgba(255,255,255,.95); color: #1B1240; padding: 9px 18px; border-radius: 12px; font-weight: 900; font-size: .92rem; }
.art-naval { background: radial-gradient(circle at 75% 30%, rgba(34,211,238,.45), transparent 45%), linear-gradient(160deg, #0B3B5C, #071A33 70%); }
.art-naval::after { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(34,211,238,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(34,211,238,.12) 1px, transparent 1px); background-size: 28px 28px; }
.art-missao { background: radial-gradient(circle at 80% 25%, rgba(249,115,22,.55), transparent 45%), linear-gradient(160deg, #3B0D0D, #120707 75%); }
.art-missao::after { content: 'CONFIDENCIAL'; position: absolute; left: -10px; top: 40px; transform: rotate(-12deg); font-family: var(--font-d); font-weight: 700; letter-spacing: 4px; font-size: 1.3rem; color: rgba(239,68,68,.35); border: 3px solid rgba(239,68,68,.35); padding: 2px 12px; border-radius: 8px; }
.art-arena { background: radial-gradient(ellipse at 50% 120%, #22C55E 0%, #15803D 35%, transparent 60%), radial-gradient(circle at 20% 10%, rgba(250,204,21,.5), transparent 35%), linear-gradient(180deg, #0F2F1F, #0A1F14); }
.art-milhao { background: radial-gradient(circle at 75% 25%, rgba(250,204,21,.55), transparent 42%), radial-gradient(circle at 10% 100%, rgba(59,130,246,.5), transparent 50%), linear-gradient(160deg, #10205A, #070E2E 75%); }
.art-erra { background: radial-gradient(circle at 70% 20%, rgba(236,72,153,.6), transparent 45%), radial-gradient(circle at 10% 90%, rgba(139,92,246,.6), transparent 50%), linear-gradient(160deg, #3A0F5C, #170B33 75%); }

/* ---------- configurar partida ---------- */
.setup { display: grid; grid-template-columns: 340px 1fr; gap: 22px; padding: 26px 0 40px; align-items: start; }
.setup-side { position: sticky; top: 90px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); }
.setup-side .banner { position: relative; min-height: 190px; padding: 20px; display: flex; flex-direction: column; justify-content: flex-end; }
.setup-side .banner h2 { position: relative; font-size: 1.8rem; }
.setup-side .banner .gc-icon { position: absolute; right: 16px; top: 16px; width: 86px; height: 86px; color: #fff; }
.setup-side .rules { background: var(--panel); padding: 18px 20px; }
.setup-side .rules ol { margin: 0; padding-left: 20px; color: var(--muted); }
.setup-side .rules li { margin-bottom: 6px; }
.step { margin-bottom: 22px; }
.step h3 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.step h3 .n { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; font-size: 1rem; }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.disc { text-align: left; padding: 16px; border-radius: 16px; border: 2px solid var(--line); background: rgba(255,255,255,.04); transition: .15s; }
.disc:hover:not(:disabled) { border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.08); }
.disc b { display: block; font-size: 1.05rem; font-family: var(--font-d); font-weight: 600; }
.disc span { color: var(--muted); font-size: .84rem; font-weight: 700; }
.disc.on { border-color: transparent; background: var(--grad); }
.disc.on span { color: #fff; }
.disc:disabled { opacity: .45; cursor: not-allowed; }
.players-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: rgba(255,255,255,.04); text-align: left; position: relative; }
.pl.on { border-color: var(--green); background: rgba(34,197,94,.10); }
.pl .chk { margin-left: auto; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 900; }
.pl.on .chk { background: var(--green); border-color: var(--green); }
.pl .st { font-size: .76rem; font-weight: 800; color: #86EFAC; display: flex; align-items: center; gap: 5px; }
.pl .st.busy { color: var(--yellow); }
.pl .st i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 16px; }
.start-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }

/* ---------- sala de espera ---------- */
.lobby { max-width: 760px; margin: 30px auto; }
.lobby-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.lobby-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-weight: 800; }
.lobby-item .badge { margin-left: auto; font-size: .8rem; padding: 4px 10px; border-radius: 99px; }
.badge.joined { background: rgba(34,197,94,.15); color: #86EFAC; } .badge.invited { background: rgba(250,204,21,.15); color: #FDE68A; }
.badge.declined, .badge.left, .badge.expired { background: rgba(239,68,68,.15); color: #FCA5A5; }
.pulse { animation: pulse 1.4s ease-in-out infinite; } @keyframes pulse { 50% { opacity: .45 } }

/* ---------- ranking ---------- */
.rank-filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.rank-filters select { width: auto; min-width: 160px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; max-width: 640px; margin: 20px auto 26px; }
.podium .pd { text-align: center; }
.podium .pd .blk { margin-top: 10px; border-radius: 16px 16px 6px 6px; padding: 14px 8px; font-family: var(--font-d); font-weight: 700; font-size: 2rem; }
.podium .p1 .blk { background: linear-gradient(180deg, #FACC15, #CA8A04); height: 150px; color: #422006; }
.podium .p2 .blk { background: linear-gradient(180deg, #E2E8F0, #94A3B8); height: 115px; color: #1E293B; }
.podium .p3 .blk { background: linear-gradient(180deg, #FDBA74, #C2410C); height: 90px; color: #431407; }
.podium .nm { font-weight: 900; margin-top: 6px; } .podium .pt { color: var(--muted); font-weight: 800; font-size: .9rem; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 900; }
.tbl tr.me td { background: rgba(139,92,246,.14); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.medal { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; font-size: .85rem; background: rgba(255,255,255,.08); }
.medal.m1 { background: #FACC15; color: #422006; } .medal.m2 { background: #CBD5E1; color: #1E293B; } .medal.m3 { background: #FB923C; color: #431407; }

/* ---------- modal & toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(6,4,20,.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fadein .18s; }
.modal { position: relative; width: min(480px, 100%); max-height: 90vh; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); animation: pop .22s cubic-bezier(.2,1.4,.4,1); }
.modal.wide { width: min(860px, 100%); }
.modal-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; font-size: 1.6rem; color: var(--muted); line-height: 1; padding: 6px; }
@keyframes fadein { from { opacity: 0 } } @keyframes pop { from { transform: scale(.9); opacity: 0 } }
#toasts { position: fixed; z-index: 200; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); }
.toast { background: #2A2063; border: 1px solid var(--line); padding: 12px 18px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); animation: pop .2s; max-width: 520px; text-align: center; }
.toast.err { background: #5B1730; border-color: rgba(239,68,68,.5); } .toast.ok { background: #14532D; border-color: rgba(34,197,94,.5); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .4s; }
.invite-card { text-align: center; }
.invite-card .gi { position: relative; overflow: hidden; width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 12px; display: grid; place-items: center; }
.invite-card .gi svg, .hero-games svg { position: relative; z-index: 1; }
.hero-games div { overflow: hidden; }
.invite-card .gi svg { width: 60%; height: 60%; color: #fff; }

.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--pink); animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg) } }
.footer { text-align: center; color: var(--dim); font-size: .82rem; padding: 26px 16px 34px; }

@media (max-width: 900px) {
  .auth { grid-template-columns: minmax(0,1fr); }
  .auth-hero { padding-bottom: 8px; min-height: auto; }
  .auth-hero .hero-games, .auth-hero p { display: none; }
  .auth-hero h1 { display: none; }
  .setup { grid-template-columns: 1fr; }
  .setup-side { position: static; }
  .topbar .wrap { min-height: 60px; }
  .logo-big { font-size: 1.4rem; } .logo-icon { width: 38px; height: 38px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: minmax(0,1fr); gap: 0; }
  .games-grid { grid-template-columns: 1fr; }
  .logo.xl .logo-big { font-size: 2.7rem; } .logo.xl .logo-icon { width: 70px; height: 70px; }
}
