:root {
  --bg: #0b1021;
  --panel: #111a33;
  --panel2: #18234a;
  --line: #2b3a6b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent2: #16a34a;
  --gold: #fbbf24;
  --red: #ef4444;
  --blue: #3b82f6;
  --trophy: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: "Fredoka", "Segoe UI", system-ui, sans-serif; }
button, input, select { font-family: inherit; }
.hidden { display: none !important; }

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
#gameCanvas { position: absolute; z-index: 2; touch-action: none; cursor: crosshair; }

.screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; }
.screen.overlay { z-index: 20; background: rgba(5, 8, 20, 0.72); backdrop-filter: blur(6px); align-items: center; justify-content: center; }
#screen-auth { align-items: center; justify-content: center; }

.panel { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 3px solid var(--line); border-radius: 18px; padding: 28px 32px; box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06); }
.auth-panel { width: min(440px, 92vw); text-align: center; }
.logo { font-family: "Press Start 2P", monospace; font-size: 54px; color: #fef3c7; text-shadow: 4px 4px 0 #1e293b, 0 0 30px rgba(251,191,36,0.35); letter-spacing: 3px; }
.logo.small { font-size: 30px; }
.tagline { color: var(--muted); margin: 10px 0 22px; }
label { display: block; text-align: left; font-size: 14px; color: var(--muted); margin: 10px 0; }
label input, .input { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; border-radius: 10px; border: 2px solid var(--line); background: #0d1430; color: var(--text); font-size: 16px; outline: none; }
label input:focus, .input:focus { border-color: var(--accent); }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.error { color: #fca5a5; min-height: 20px; font-size: 14px; }
.info { color: var(--muted); min-height: 20px; font-size: 14px; text-align: center; }
.auth-foot { color: var(--muted); font-size: 12px; margin-top: 14px; line-height: 1.6; }

.btn { padding: 12px 20px; border-radius: 12px; border: 3px solid #0b1021; background: linear-gradient(180deg, #94a3b8, #475569); color: #0b1021; font-weight: 700; font-size: 16px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px; box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25), 0 5px 0 #1e293b; transition: transform 80ms, box-shadow 80ms, filter 120ms; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25), 0 2px 0 #1e293b; }
.btn.primary { background: linear-gradient(180deg, #4ade80, #15803d); color: #f8fafc; }
.btn.danger { background: linear-gradient(180deg, #f87171, #b91c1c); color: #fff; }
.btn.gold { background: linear-gradient(180deg, #fde68a, #d97706); }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.back { padding: 8px 14px; font-size: 13px; }
.btn.play { font-family: "Press Start 2P", monospace; font-size: 28px; padding: 30px 60px; background: linear-gradient(180deg, #4ade80, #15803d); color: #f8fafc; display: flex; flex-direction: column; gap: 10px; align-items: center; border-radius: 20px; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.25), 0 8px 0 #14532d, 0 0 40px rgba(74,222,128,0.35); }
.btn.play span { font-family: "Fredoka", sans-serif; font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.9; }
.btn.nav { width: 100%; text-align: left; margin: 6px 0; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.select { padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: #0d1430; color: var(--text); font-size: 15px; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.toggle input { accent-color: var(--accent); width: 18px; height: 18px; }
.input.code { width: 110px; text-transform: uppercase; text-align: center; letter-spacing: 3px; font-weight: 700; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: rgba(11,16,33,0.85); border-bottom: 2px solid var(--line); backdrop-filter: blur(8px); }
.topbar h2 { margin: 0; font-size: 22px; }
.chip { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; }
.profile-chip { cursor: pointer; }
.chip-name { font-weight: 700; }
.chip-sub { font-size: 12px; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fde68a, #d97706); display: flex; align-items: center; justify-content: center; color: #0b1021; font-weight: 800; border: 3px solid #0b1021; box-shadow: 0 0 0 2px var(--gold); }
.avatar.big { width: 84px; height: 84px; font-size: 30px; }
.trophy::before, .trophy-icon::before { content: "🏆 "; }
.coin { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fef08a, #ca8a04); border: 2px solid #713f12; display: inline-block; }
.chip.coins { padding: 6px 14px; font-weight: 700; color: var(--gold); }
.xpbar { position: relative; flex: 1; max-width: 300px; height: 20px; background: #0d1430; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.xpbar.big { max-width: none; height: 24px; margin: 8px 0; }
.xpfill { height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, #818cf8); transition: width 600ms ease; }
.xpbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.online { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.lobby-main { flex: 1; display: grid; grid-template-columns: 240px 1fr 280px; gap: 24px; padding: 24px; align-items: start; overflow: auto; }
.lobby-left, .lobby-right { display: flex; flex-direction: column; gap: 12px; }
.lobby-center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 60vh; }
.menu-note { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }
.card { background: rgba(17,26,51,0.9); border: 2px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.card-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.league { font-size: 20px; font-weight: 800; }
.league small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.top-list { margin: 0; padding-left: 20px; font-size: 14px; }
.top-list li { margin: 4px 0; display: flex; justify-content: space-between; }
.top-list .t { color: var(--trophy); }
.play-options { color: var(--muted); }
@media (max-width: 900px) { .lobby-main { grid-template-columns: 1fr; } .lobby-left, .lobby-right { order: 2; } }

.queue-panel { text-align: center; width: min(420px, 92vw); }
.spinner { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.queue-title { font-size: 20px; font-weight: 700; }
.queue-sub { color: var(--muted); margin: 8px 0 18px; }
.queue-code { font-family: "Press Start 2P", monospace; font-size: 28px; letter-spacing: 6px; color: var(--gold); margin: 10px 0 18px; }

/* Game */
#screen-game { pointer-events: none; z-index: 3; }
.game-side { position: absolute; top: 0; bottom: 0; width: 220px; display: flex; flex-direction: column; gap: 12px; padding: 16px; pointer-events: auto; justify-content: center; }
.game-side.left { left: 0; }
.game-side.right { right: 0; }
.side-card { background: rgba(11,16,33,0.82); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.side-card.timer { font-family: "Press Start 2P", monospace; font-size: 22px; text-align: center; color: #fef3c7; }
.side-card.timer.hurry { color: #fca5a5; animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.side-name { font-weight: 800; font-size: 16px; }
.side-sub { font-size: 12px; color: var(--muted); }
.side-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; }
.keyrow { display: flex; gap: 4px; flex-wrap: wrap; }
kbd { display: inline-block; min-width: 22px; padding: 2px 5px; border-radius: 5px; background: #1e293b; border: 1px solid #475569; border-bottom-width: 3px; font-size: 11px; text-align: center; font-family: inherit; }
.keyhelp { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.8; }
.emote-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emote { width: 38px; height: 34px; border-radius: 8px; border: 2px solid var(--line); background: #1e293b; color: #fff; font-size: 15px; cursor: pointer; }
.emote:hover { background: #334155; }
.toast { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); background: rgba(11,16,33,0.9); border: 2px solid var(--line); padding: 10px 18px; border-radius: 12px; font-weight: 700; pointer-events: none; }
@media (max-width: 1100px) { .game-side { width: 160px; } .side-card.keys { display: none; } }
@media (max-width: 760px) { .game-side { display: none; } }

/* Result */
.result-panel { width: min(560px, 94vw); text-align: center; }
.result-title { font-family: "Press Start 2P", monospace; font-size: 34px; margin-bottom: 6px; }
.result-title.win { color: #4ade80; text-shadow: 0 0 24px rgba(74,222,128,0.6); }
.result-title.loss { color: #f87171; text-shadow: 0 0 24px rgba(248,113,113,0.5); }
.result-title.draw { color: #fde68a; }
.result-sub { color: var(--muted); margin-bottom: 18px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.reward { background: #0d1430; border: 2px solid var(--line); border-radius: 12px; padding: 12px; }
.reward-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.reward-value { font-size: 28px; font-weight: 800; }
.reward-value.trophy { color: var(--trophy); }
.reward-value.coinv { color: var(--gold); }
.result-extra { margin: 10px 0; min-height: 22px; color: #fde68a; font-weight: 700; }
.result-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-size: 13px; color: var(--muted); margin: 10px 0; text-align: left; }
.result-stats b { color: var(--text); }

/* Pages */
.page { flex: 1; overflow: auto; padding: 24px; max-width: 1000px; width: 100%; margin: 0 auto; }
.profile-head { display: flex; gap: 20px; align-items: center; margin-bottom: 20px; }
.profile-name { font-size: 28px; font-weight: 800; }
.profile-sub { color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 24px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.history .win { color: #4ade80; font-weight: 700; }
.history .loss { color: #f87171; font-weight: 700; }
.history .draw { color: #fde68a; font-weight: 700; }
.og-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.og-tab { padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-weight: 700; }
.og-tab.active { background: var(--accent2); border-color: var(--accent); }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.skin-card { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; position: relative; }
.skin-card.equipped { border-color: var(--accent); box-shadow: 0 0 18px rgba(34,197,94,0.35); }
.skin-card canvas { width: 120px; height: 120px; display: block; margin: 0 auto 8px; }
.skin-name { font-weight: 700; font-size: 14px; }
.skin-rarity { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 4px 0 8px; }
.r-commun { color: var(--muted); } .r-rare { color: #38bdf8; } .r-epique { color: #a855f7; } .r-legendaire { color: #f59e0b; }
.skin-card .btn { width: 100%; padding: 8px; font-size: 12px; }
.skin-lock { font-size: 12px; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin-top: 20px; }
.board { width: 100%; border-collapse: collapse; }
.board th, .board td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.board tr.me { background: rgba(34,197,94,0.12); }
.rules h3 { margin: 18px 0 6px; color: #fde68a; }
.rules p, .rules li { color: #cbd5e1; line-height: 1.6; }
.rules .og-line { display: flex; gap: 12px; align-items: center; margin: 6px 0; }
.rules .og-line canvas { width: 56px; height: 56px; }

#lobbyShowcase { width: min(100%, 720px); height: auto; margin-top: 10px; }

.btn.survival { background: linear-gradient(180deg, #fb923c, #c2410c); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.btn.survival .small { font-size: 11px; font-weight: 500; text-transform: none; opacity: 0.9; }
.options { width: min(100%, 720px); background: rgba(17,26,51,0.9); border: 2px solid var(--line); border-radius: 12px; padding: 8px 14px; color: var(--muted); font-size: 13px; }
.options summary { cursor: pointer; font-weight: 700; color: var(--text); }
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 16px; margin-top: 10px; }
.feature-group { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 6px; }
.feature { display: flex; gap: 8px; align-items: flex-start; color: var(--text); }
.feature input { accent-color: var(--accent); margin-top: 3px; }
.feature small { display: block; color: var(--muted); }
.quest-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.quest-list li { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.quest-list .bar { height: 8px; background: #0d1430; border-radius: 999px; overflow: hidden; }
.quest-list .bar div { height: 100%; background: linear-gradient(90deg, #38bdf8, #818cf8); }
.quest-list .row { margin: 0; justify-content: space-between; }
.quest-list .btn { padding: 4px 10px; font-size: 11px; }
.deal { background: linear-gradient(90deg, rgba(251,191,36,0.15), rgba(239,68,68,0.15)); border: 2px solid var(--gold); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; color: #fde68a; font-weight: 700; }
.skin-card .deal-tag { position: absolute; top: 8px; right: 8px; background: var(--red); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 800; }
.og-tab small { font-weight: 500; color: var(--muted); }

.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.audio-ctl { display: flex; align-items: center; gap: 6px; }
.audio-ctl input[type=range] { width: 70px; accent-color: var(--accent); }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px; }
.icon-btn.off { opacity: 0.4; text-decoration: line-through; }
.audio-mini { display: flex; gap: 8px; justify-content: center; }
.avatar { position: relative; overflow: hidden; }
.avatar img, .avatar canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.small { width: 44px; height: 44px; flex-shrink: 0; }
.avatar.clickable { cursor: pointer; }
.avatar-edit { position: absolute; right: -2px; bottom: -2px; background: var(--panel); border: 2px solid var(--line); border-radius: 50%; width: 26px; height: 26px; font-size: 13px; display: flex; align-items: center; justify-content: center; color: var(--text); z-index: 2; }
.side-card.who { display: flex; gap: 10px; align-items: center; }
.avatar-panel { width: min(640px, 94vw); text-align: center; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 14px 0; }
.avatar-grid .avatar { width: 84px; height: 84px; margin: 0 auto; cursor: pointer; transition: transform 100ms; }
.avatar-grid .avatar:hover { transform: scale(1.08); }
.avatar-grid .avatar.selected { box-shadow: 0 0 0 4px var(--accent); }
.account { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.account label { font-size: 12px; }
.board .avatar { width: 28px; height: 28px; display: inline-flex; vertical-align: middle; margin-right: 8px; font-size: 11px; }

.avatar-panel input[type=file] { display: none !important; }

/* Logo Glouglou Arena */
.logo.glou { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; position: relative; }
.logo.glou .g1 { font-size: 44px; color: #7dd3fc; text-shadow: 4px 4px 0 #1e3a8a, 0 0 28px rgba(125,211,252,0.45); letter-spacing: 2px; }
.logo.glou .g2 { font-size: 22px; color: #fde68a; margin-top: 8px; letter-spacing: 8px; text-shadow: 3px 3px 0 #1e293b; }
.logo.small.glou .g1 { font-size: 22px; } .logo.small.glou .g2 { font-size: 11px; margin-top: 4px; letter-spacing: 5px; }
.logo.glou .bubbles { position: absolute; right: -26px; top: -14px; width: 30px; height: 50px; }
.logo.glou .bubbles i { position: absolute; border: 2px solid #bae6fd; border-radius: 50%; opacity: 0; animation: bub 3s infinite; }
.logo.glou .bubbles i:nth-child(1) { width: 10px; height: 10px; left: 4px; animation-delay: 0s; }
.logo.glou .bubbles i:nth-child(2) { width: 7px; height: 7px; left: 16px; animation-delay: 1s; }
.logo.glou .bubbles i:nth-child(3) { width: 13px; height: 13px; left: 8px; animation-delay: 2s; }
@keyframes bub { 0% { bottom: 0; opacity: 0; } 20% { opacity: 0.9; } 100% { bottom: 50px; opacity: 0; } }

.locked-panel { text-align: center; padding: 28px 20px; background: rgba(255,255,255,0.05); border-radius: 16px; margin-bottom: 16px; }
.locked-panel .locked-icon { font-size: 42px; margin-bottom: 6px; }
.locked-panel .google-btn { justify-content: center; }
.guest-banner { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; padding: 8px 12px; border-radius: 12px; background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.5); font-size: 13px; }
.badge-guest { display: inline-block; font-size: 10px; letter-spacing: 1px; background: #475569; color: #fff; padding: 2px 7px; border-radius: 999px; vertical-align: middle; font-weight: 800; }
.auth-legal { margin-top: 10px; font-size: 11px; opacity: 0.55; } .auth-legal a { color: inherit; }
.or-sep { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; opacity: 0.6; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: currentColor; opacity: 0.4; }
.google-btn { display: flex; justify-content: center; margin: 14px 0; min-height: 44px; }
.badge-modo { display: inline-block; font-size: 10px; letter-spacing: 1px; background: linear-gradient(90deg, #06b6d4, #6366f1); color: #fff; padding: 2px 7px; border-radius: 999px; vertical-align: middle; font-weight: 800; }
.admin-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 10px; background: rgba(255,255,255,0.05); border-radius: 10px; }
.admin-row .admin-name { font-weight: 700; min-width: 140px; }
.admin-row .admin-stats { font-size: 12px; opacity: 0.8; flex: 1; }
.admin-row .admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-row .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #64748b; margin-right: 6px; }
.admin-row .dot.on { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.badge-admin { display: inline-block; font-size: 10px; letter-spacing: 1px; background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; padding: 2px 7px; border-radius: 999px; vertical-align: middle; font-weight: 800; }

.sound-hint { margin-top: 12px; color: #7dd3fc; font-size: 13px; animation: pulse 1.6s infinite; }

.transfer { margin-top: 14px; color: var(--muted); font-size: 13px; }
.transfer summary { cursor: pointer; }
.transfer .input.code { width: 160px; margin: 6px auto; }
