:root {
    --bg: #0a0a0a; --bg-soft: #121212; --card: #1a1a1a; --card-2: #212121;
    --text: #f0f0f0; --muted: #a0a0a0; --brand: #e0ac01;
    --radius-lg: 16px; --radius-md: 12px;
    --shadow-soft: 0 8px 30px rgba(0,0,0,0.4);
    --border: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="light"] {
    --bg: #f8f9fa; --bg-soft: #ffffff; --card: #ffffff; --card-2: #f1f3f5;
    --text: #212529; --muted: #6c757d; --border: 1px solid #dee2e6;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 12px 16px; }

/* CABEÇALHO E RODAPÉ */
.topbar { position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(150%) blur(12px); background: rgba(10,10,10,0.85); border-bottom: var(--border); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand .logo { width: 44px; height: 44px; }
.brand .stack { line-height: 1.1; }
.brand .sub { font-size: 13px; color: var(--muted); }
.brand strong { font-size: 18px; }
.footer { max-width: 1200px; margin: 40px auto; padding: 20px 16px; color: var(--muted); font-size: 14px; text-align: center; border-top: var(--border); }

/* --- NOVO LAYOUT DE PILHA DE CARDS --- */
#card-stack-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    margin: 5vh auto; /* Margem dinâmica para melhor centralização vertical */
    height: 380px;
    perspective: 1200px;
}
.event-card-stacked {
    background: var(--card);
    border: var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    position: absolute;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    z-index: calc(100 - var(--i));
    transform: translateY(calc(var(--i) * -15px)) scale(calc(1 - (var(--i) * 0.04)));
    opacity: calc(1 - (var(--i) * 0.25));
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}
.event-card-stacked:hover {
    transform: translateY(calc(var(--i) * -15px - 5px)) scale(calc(1 - (var(--i) * 0.04) + 0.01));
}
.event-card-stacked.card-exit-left {
    transform: translateX(-600px) rotate(-25deg) !important;
    opacity: 0 !important;
}

.card-link-area { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: var(--radius-lg); overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: var(--border); background: var(--card-2); }
.league-logo { width: 24px; height: 24px; object-fit: contain; }
.league-name { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; }
.sport-tag { font-size: 11px; font-weight: 700; color: #000; background: var(--brand); padding: 3px 8px; border-radius: 5px; margin-left: auto; flex-shrink: 0; }
.card-body { padding: 20px; display: flex; justify-content: space-between; align-items: center; flex-grow: 1; }
.team-info { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; width: 120px; }
.team-logo { width: 80px; height: 80px; object-fit: contain; }
.team-name { font-weight: 600; font-size: 18px; line-height: 1.2; }
.event-time-vs { display: flex; flex-direction: column; align-items: center; font-size: 20px; font-weight: 700; color: var(--muted); }
.time-badge { font-size: 28px; font-weight: 900; color: var(--brand); margin-top: 5px; }
.card-footer { text-align: center; font-size: 18px; font-weight: 600; padding: 15px; border-top: var(--border); }
.card-close-btn { position: absolute; top: 10px; right: 10px; z-index: 101; background: rgba(0,0,0,0.4); color: white; border: none; border-radius: 50%; width: 30px; height: 30px; font-size: 20px; line-height: 30px; text-align: center; cursor: pointer; transition: background .2s; }
.card-close-btn:hover { background: rgba(0,0,0,0.7); }

/* NAVEGAÇÃO DA PILHA E ESTADO VAZIO */
.stack-nav { text-align: center; margin-top: 20px; }
.btn-nav { background: var(--brand); color: #000; border: none; padding: 14px 40px; font-size: 18px; font-weight: 700; border-radius: 100px; cursor: pointer; transition: all .2s; box-shadow: var(--shadow-soft); }
.btn-nav:hover { background: #ffdd6a; transform: translateY(-2px); }
.card-stack-empty { text-align: center; padding: 40px; background: var(--card); border-radius: var(--radius-lg); }
.card-stack-empty h3 { margin-top: 0; }

/* DETALHES, TABELAS E FORMULÁRIOS */
.detail-header { text-align: center; padding: 20px; background: var(--card); border-radius: var(--radius-lg); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border-radius: var(--radius-lg); overflow: hidden; margin-top: 20px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--card-2); }
th { color: var(--muted); font-size: 12px; }
.btn { appearance: none; border: 0; cursor: pointer; border-radius: 12px; padding: 10px 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .2s all ease; position: relative; }
.btn-brand { background: var(--brand); color: #000; }
.btn-brand:hover { background: #ffdd6a; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
input[type="text"], input[type="email"], textarea { width: 100%; padding: 12px 16px; background: var(--card-2); border: var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 16px; font-family: inherit; }
textarea { resize: vertical; min-height: 120px; }
.feedback-message { padding: 15px; margin-bottom: 20px; border-radius: var(--radius-md); font-weight: 600; text-align: center; }
.feedback-message.success { background-color: rgba(0, 200, 83, 0.1); border: 1px solid #00c853; color: #00c853; }
.feedback-message.error { background-color: rgba(255, 82, 82, 0.1); border: 1px solid #ff5252; color: #ff5252; }
#histats_counter { position: fixed; bottom: 10px; left: 10px; z-index: 100; opacity: 0.7; }

/* --- RESPONSIVIDADE PARA CELULARES --- */
@media (max-width: 600px) {
    .wrap { padding: 12px 8px; }
    #card-stack-container {
        height: 340px;
        margin: 20px auto;
    }
    .team-logo { width: 60px; height: 60px; }
    .team-name { font-size: 16px; }
    .time-badge { font-size: 24px; }
    .card-footer { font-size: 16px; }
    .events-section h2 { font-size: 24px; }
    .btn-nav { padding: 12px 30px; font-size: 16px; }
}