/* ============================================================
   PixelArena - design system próprio (dark-first, "app" e não
   "painel admin" - tipografia grande, cards com profundidade, tab bar
   nativa no mobile). Sem framework CSS, sem build step - CSS puro com
   custom properties, pensado pra rodar bem em hospedagem compartilhada.
   ============================================================ */

:root {
    --bg: #08080b;
    /* Superfícies "elevadas" (sidebar, topbar, tabbar, cards) precisam de
       contraste visível contra --bg mesmo em áreas onde os blobs de
       gradiente do body não alcançam - números baixos demais (0.04-0.045)
       ficavam indistinguíveis do fundo, sidebar/topbar/conteúdo pareciam
       uma coisa só. */
    --bg-elevated: rgba(255, 255, 255, 0.065);
    --bg-card: rgba(255, 255, 255, 0.07);
    --bg-hover: rgba(255, 255, 255, 0.1);
    --bg-input: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.12);
    --border-strong: rgba(255, 255, 255, 0.2);
    --text: #f4f4f6;
    --text-dim: #a1a1ab;
    --text-faint: #6c6c78;
    --accent: #7c6bf7;
    --accent-2: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #7c6bf7 0%, #c04cf9 100%);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    --live: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --blur: blur(22px) saturate(160%);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --tabbar-h: 64px;
    --topbar-h: 60px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 65% 45% at 20% -5%, rgba(124, 107, 247, 0.38), transparent 62%),
        radial-gradient(ellipse 55% 40% at 105% 15%, rgba(192, 76, 249, 0.26), transparent 62%),
        radial-gradient(ellipse 60% 50% at 10% 105%, rgba(52, 211, 153, 0.14), transparent 62%),
        radial-gradient(ellipse 45% 35% at 85% 95%, rgba(56, 189, 248, 0.12), transparent 60%);
}
/* Grade sutil por cima do gradiente - mesma ideia já usada no login do
   painel admin (.login-grid), dá profundidade sem competir com o conteúdo. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.5;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 90%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

/* ---------- Boot / loading ---------- */
.boot-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.boot-logo {
    width: 64px; height: 64px;
    border-radius: 18px;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    box-shadow: 0 0 40px rgba(124, 107, 247, 0.5);
}
.boot-spinner {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 3px solid var(--border-strong);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.app-loading .app-shell { display: none; }

/* ---------- Aviso de WebView suspeito ---------- */
.webview-warning {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 44px 10px 14px;
    background: #78350f;
    color: #fef3c7;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.webview-warning button {
    position: absolute;
    right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: inherit;
    width: 26px; height: 26px; border-radius: 50%;
    cursor: pointer; font-size: 13px;
}
.webview-warning button:hover { background: rgba(255,255,255,0.15); }

/* ---------- Auth screen ---------- */
.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 28px;
    box-shadow: var(--shadow);
}
.auth-logo {
    width: 56px; height: 56px;
    border-radius: 16px;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    margin: 0 auto 18px;
    box-shadow: 0 0 32px rgba(124, 107, 247, 0.45);
}
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin-bottom: 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field input {
    width: 100%;
    padding: 13px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}
.field input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: transform 0.12s, box-shadow 0.12s;
    box-shadow: 0 6px 20px rgba(124, 107, 247, 0.35);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-error {
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.3);
    color: #ffb4c0;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: none;
}
.auth-error.show { display: block; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; min-height: 100dvh; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: calc(var(--topbar-h) + var(--safe-t));
    padding-top: var(--safe-t);
    display: flex; align-items: center; gap: 10px;
    padding-left: 14px; padding-right: 14px;
    background: var(--bg-elevated);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
}
.topbar-title { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.topbar-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-shrink: 0; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-gradient);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
}
.icon-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

/* Menu horizontal no topo (desktop) - site normal, não painel/CMS. Some
   no mobile, vira o hambúrguer + gaveta lateral abaixo. */
.topnav { display: none; align-items: center; gap: 4px; flex: 1; margin-left: 8px; }
/* .hamburger-btn some no desktop via media query lá embaixo - por padrão
   (mobile) herda display:flex de .icon-btn, não precisa de regra própria aqui. */

.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 14px;
    border-radius: 20px;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.nav-item i { font-size: 13px; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-card); color: var(--text); }
.nav-item.nav-cta {
    margin-left: 4px;
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 14px -2px rgba(124, 107, 247, 0.5);
}
.nav-item.nav-cta:hover { background: var(--accent-gradient); opacity: 0.92; }

.main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 16px 40px;
}

/* Gaveta lateral (mobile) - só existe pra abrir via hambúrguer, nunca fica
   fixa/visível na tela como uma sidebar de painel. */
.drawer-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,0.55);
    opacity: 0; transition: opacity 0.2s;
}
.drawer-backdrop.open { display: block; opacity: 1; }

.side-drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 95;
    width: min(280px, 82vw);
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 92%, white 8%);
    border-right: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    padding: 14px 12px calc(20px + var(--safe-b));
    padding-top: calc(14px + var(--safe-t));
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
}
.side-drawer.open { transform: translateX(0); }
.side-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 6px 16px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.side-drawer .nav-item { border-radius: var(--radius-sm); padding: 13px 14px; font-size: 14.5px; }
.side-drawer .nav-item i { width: 20px; font-size: 15px; }

/* ---------- Content building blocks ---------- */
.page-header { margin-bottom: 18px; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--accent-2);
    background: rgba(124, 107, 247, 0.12);
    border: 1px solid rgba(124, 107, 247, 0.25);
    padding: 5px 10px; border-radius: 20px;
    margin-bottom: 10px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); }
.page-header h1 { font-size: 25px; }

/* ---------- Hero (home) ---------- */
.hero { text-align: center; padding: 10px 4px 26px; }
.hero .eyebrow { margin-bottom: 14px; }
.hero h1 {
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 30%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero p { color: var(--text-dim); font-size: 14px; max-width: 480px; margin: 0 auto 22px; line-height: 1.5; }
.hero-search {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 480px;
    margin: 0 auto 22px;
    background: var(--bg-card);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 6px 6px 6px 16px;
    box-shadow: var(--shadow);
}
.hero-search i { color: var(--text-faint); font-size: 14px; }
.hero-search input {
    flex: 1;
    background: none; border: none; outline: none;
    color: var(--text); font-size: 14.5px;
    padding: 10px 0;
    min-width: 0;
}
.hero-search input::placeholder { color: var(--text-faint); }
.hero-search button {
    border: none;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 11px;
    cursor: pointer;
    flex-shrink: 0;
}
.hero-stats { display: flex; align-items: center; justify-content: center; gap: 26px; }
.hero-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-stats strong { font-size: 17px; font-weight: 800; }
.hero-stats span { font-size: 10.5px; color: var(--text-faint); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

.tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.tile {
    background: var(--bg-card);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
}
.tile:active { transform: scale(0.97); }
.tile-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; color: #fff; margin-bottom: 12px;
}
.tile h3 { font-size: 15.5px; margin-bottom: 3px; }
.tile p { margin: 0; font-size: 12px; color: var(--text-dim); }

.section-title { font-size: 15px; font-weight: 800; margin: 22px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 12.5px; color: var(--accent-2); font-weight: 700; cursor: pointer; }

.filters-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.filters-row::-webkit-scrollbar { display: none; }
.chip {
    flex-shrink: 0;
    padding: 9px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-size: 13px; font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.chip.active { background: var(--accent-gradient); color: #fff; border-color: transparent; }

.search-box { position: relative; margin-bottom: 16px; }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-box input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 14.5px;
    outline: none;
}
.search-box input:focus { border-color: var(--accent); }

/* ---------- Game/match cards ---------- */
.match-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}
.match-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.match-comp { font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; }
.match-status { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; }
.match-status.live { background: rgba(239, 68, 68, 0.15); color: var(--live); }
.match-status.live::before { content: '●'; margin-right: 4px; animation: pulse 1.2s infinite; }
.match-status.scheduled { background: var(--bg-elevated); color: var(--text-dim); }
.match-status.finished { background: rgba(52, 211, 153, 0.12); color: var(--success); }
@keyframes pulse { 50% { opacity: 0.3; } }
.match-teams { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.match-team { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.match-team img { width: 34px; height: 34px; object-fit: contain; }
.match-team span { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.match-score { font-size: 20px; font-weight: 800; padding: 0 10px; min-width: 70px; text-align: center; }
.match-channels { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.channel-pill { display: flex; align-items: center; gap: 5px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px; padding: 4px 9px 4px 4px; font-size: 11px; font-weight: 600; color: var(--text-dim); }
.channel-pill img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }

/* ---------- Retro grid ---------- */
.retro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.retro-system {
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.retro-system-cover {
    aspect-ratio: 1;
    background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: var(--text-faint);
    position: relative;
}
.retro-system-cover img { width: 100%; height: 100%; object-fit: cover; }
.retro-system-badge {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,0.6); color: #fff;
    font-size: 9.5px; font-weight: 800;
    padding: 2px 6px; border-radius: 8px;
}
.retro-system-body { padding: 9px 10px; }
.retro-system-body h4 { font-size: 12.5px; margin-bottom: 1px; }
.retro-system-body p { margin: 0; font-size: 10.5px; color: var(--text-faint); }
.retro-system.unsupported { opacity: 0.45; }

.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.game-card { cursor: pointer; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-card); border: 1px solid var(--border); }
.game-cover { aspect-ratio: 3/4; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 22px; }
.game-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-card-body { padding: 8px 9px; }
.game-card-body h4 { font-size: 11.5px; line-height: 1.25; margin: 0; font-weight: 700; }
.load-more-btn {
    display: block; width: 100%; margin-top: 16px; padding: 13px;
    background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-weight: 700; font-size: 13.5px; cursor: pointer;
}

/* ---------- Player screen ---------- */
.player-screen { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; }
.player-topbar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; padding-top: calc(12px + var(--safe-t)); background: rgba(0,0,0,0.6); }
.player-topbar h3 { font-size: 14px; flex: 1; }
#ejs-container { flex: 1; min-height: 0; }
.ad-zone-player { flex-shrink: 0; }
.ad-zone-player:empty { display: none; }
.ad-zone-player .ad-slot { border-radius: 0; height: 64px; }

/* ---------- Anúncios de parceiros ---------- */
.ad-zone { margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px; }
.ad-zone:empty { display: none; margin: 0; }
.ad-slot {
    position: relative;
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    line-height: 0;
}
.ad-slot img, .ad-slot video { width: 100%; height: 100px; object-fit: cover; display: block; }
.ad-badge {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0,0,0,0.55); color: rgba(255,255,255,0.85);
    font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
    padding: 3px 7px; border-radius: 6px;
}
.upsell-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--accent-gradient);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 22px;
    cursor: pointer;
    color: #fff;
}
.upsell-card > i:first-child { font-size: 22px; }
.upsell-card > i:last-child { font-size: 13px; opacity: 0.8; }
.upsell-card div { flex: 1; line-height: 1.35; }
.upsell-card strong { font-size: 14.5px; }
.upsell-card p { margin: 2px 0 0; font-size: 12px; opacity: 0.9; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state i { font-size: 36px; margin-bottom: 12px; display: block; }
.empty-state i.fa-triangle-exclamation { color: var(--warning); }
.spinner-block { display: flex; align-items: center; justify-content: center; padding: 60px 0; }
.spinner-block .boot-spinner { width: 30px; height: 30px; }
.unsupported-note { font-size: 11.5px; color: var(--warning); padding: 10px 12px; background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.25); border-radius: 10px; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
    .tiles { grid-template-columns: repeat(4, 1fr); }
    .retro-grid { grid-template-columns: repeat(4, 1fr); }
    .game-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 960px) {
    .topnav { display: flex; }
    .hamburger-btn { display: none; }
    .main { padding: 26px 32px 40px; }
    .retro-grid { grid-template-columns: repeat(5, 1fr); }
    .game-grid { grid-template-columns: repeat(6, 1fr); }
}
