* {
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

body {
    margin: 0;
    background: #0f172a;
    color: #e2e8f0;
    padding-bottom: 80px;
}

/* Header Ajustado */
.app-header {
    background: #1e293b;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: #4ade80;
}

.btn-lock {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    width: auto;
    margin: 0;
}
.btn-lock.unlocked {
    color: #4ade80;
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

/* App Container */
.app {
    padding: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

h2 {
    margin: 0;
    font-size: 18px;
    color: #f8fafc;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    margin: 0;
    border-radius: 8px;
    font-weight: 600;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

h3 {
    font-size: 14px;
    color: #94a3b8;
    margin: 10px 0 5px 0;
}

/* Helpers */
.big {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-align: center;
    padding: 15px;
    background: #0f172a;
    border-radius: 12px;
    border: 1px solid #334155;
}

.quadra-container {
    background: #0f172a;
    border-radius: 12px;
    border: 1px solid #334155;
    padding: 15px;
    text-align: center;
}

.quadra-match {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.quadra-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
}

.fila-container {
    margin-top: 15px;
    text-align: center;
    background: #0f172a;
    padding: 10px;
    border-radius: 8px;
}
.fila-items {
    color: #cbd5e1;
    font-weight: 500;
    margin-top: 5px;
}

/* Inputs & Buttons */
input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #fff;
    outline: none;
}
input:focus {
    border-color: #4ade80;
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: #22c55e;
    color: #052e16;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s;
}
button:active {
    transform: scale(0.98);
}
.danger {
    background: #ef4444;
    color: white;
}

/* Config Specifics */
.config-action {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #334155;
}
.config-action:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.config-action h3 {
    margin: 0 0 5px 0;
    color: #e2e8f0;
}
.config-action p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 10px 0;
}

.baba-history-item {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}
.baba-date {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}
.baba-winner {
    font-weight: bold;
    color: #fbbf24;
    margin-bottom: 4px;
}
.baba-details {
    font-size: 13px;
    color: #cbd5e1;
}

/* Lists */
.list-simple {
    list-style: none;
    padding: 0;
    margin: 0;
}
.list-simple li {
    padding: 12px;
    border-bottom: 1px solid #334155;
    font-size: 14px;
    color: #cbd5e1;
}
.list-simple li:last-child { border-bottom: none; }

/* HISTORICO NOVO ESTILO */
.hist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.hist-text {
    flex: 1;
}
.hist-actions {
    display: flex;
    gap: 5px;
}
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 6px;
}
.btn-undo {
    background: #3b82f6;
    color: white;
}
.btn-del {
    background: #ef4444;
    color: white;
}
.btn-edit {
    background: #f59e0b;
    color: #fff;
}

/* Times List */
.list-times {
    list-style: none;
    padding: 0;
}
.list-times li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #0f172a;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #334155;
}
.time-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-remove {
    background: transparent;
    color: #ef4444;
    width: auto;
    margin: 0;
    padding: 5px 10px;
    font-size: 20px;
}

/* Placar */
.placar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}
.placar input {
    width: 65px;
    height: 65px;
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.score-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-score {
    width: 45px;
    height: 45px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border-radius: 10px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #4ade80;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.btn-score:active {
    transform: scale(0.9);
    background: #334155;
}

.btn-score.minus {
    color: #ef4444;
}

/* Otimização Mobile para Placar */
@media screen and (max-width: 480px) {
    .placar {
        gap: 10px;
    }
    .score-control {
        gap: 5px;
    }
    .btn-score {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 8px;
    }
    .placar input {
        width: 55px;
        height: 55px;
        font-size: 22px;
    }
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 2px solid #334155;
}
td {
    padding: 12px 2px;
    text-align: center;
    border-bottom: 1px solid #334155;
    font-weight: 500;
    font-size: 13px;
    vertical-align: middle;
}
td:first-child { text-align: left; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: #1e293b;
    border-top: 1px solid #334155;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    background: none;
    border: none;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    margin: 0;
    padding: 0;
}
.nav-item .icon { font-size: 24px; margin-bottom: 4px; }
.nav-item.active { color: #4ade80; }

/* ================== EMBLEMAS ================== */
.emblema-quadra {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.emblema-small {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 50%;
    background: #1e293b;
    border: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}
.emblema-small:active { transform: scale(0.95); }

.placeholder-emblema {
    color: #64748b;
    font-size: 16px;
    font-weight: bold;
}

/* ================== MODAIS CUSTOMIZADOS ================== */
.modal-overlay, .loteria-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

/* Loteria Específico */
.loteria-overlay {
    flex-direction: column;
    overflow-y: auto;
    background: #020617;
}

/* Box Padrão para Alert/Confirm/Prompt */
.modal-box {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 25px;
    border-radius: 16px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-box h3 { margin-top: 0; color: #f8fafc; font-size: 20px; }
.modal-box p { color: #cbd5e1; margin-bottom: 20px; font-size: 15px; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.btn-cancel {
    background: #334155;
    color: #e2e8f0;
}
.btn-confirm {
    background: #22c55e;
    color: #020617;
}

/* Loteria Styles */
.loteria-content { width: 100%; max-width: 500px; margin: 0 auto; text-align: center; }
.loteria-title { font-size: 28px; color: #4ade80; margin-bottom: 30px; text-shadow: 0 0 10px rgba(74, 222, 128, 0.5); letter-spacing: 2px; }
.loteria-section { margin-bottom: 40px; }
.section-label { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 15px; text-transform: uppercase; letter-spacing: 1px; }
.slots-row { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.loteria-ball { background: #1e293b; border: 2px solid #334155; color: #4ade80; border-radius: 12px; width: 130px; height: 60px; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 18px; box-shadow: 0 4px 0 #0f172a; transition: all 0.2s; }
.loteria-ball.revealed { background: #22c55e; color: #020617; border-color: #4ade80; transform: scale(1.05); box-shadow: 0 0 20px rgba(74, 222, 128, 0.4); animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.loteria-ball.pending { color: #64748b; animation: pulse 1s infinite alternate; }

/* Nova classe para a animação de sorteio */
.loteria-ball.shuffle-highlight {
    background: #f59e0b;
    color: #020617;
    border-color: #f59e0b;
    transform: scale(1.1);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
    z-index: 10;
}

@keyframes pulse { from { border-color: #334155; } to { border-color: #4ade80; } }
@keyframes pop { 0% { transform: scale(0.8); } 100% { transform: scale(1.05); } }
.versus { font-weight: bold; color: #64748b; font-size: 20px; }
.btn-fechar-sorteio { background: #fff; color: #020617; margin-top: 20px; animation: fadeIn 0.5s; }

/* Admin Visibility */
.admin-only { display: none; }
.is-admin .admin-only { display: block; }
.is-admin .btn-remove { display: block; }
.btn-remove { display: none; }
/* Listagem Simples (Modais) */
.list-simple { list-style: none; padding: 0; margin: 0; }
.list-simple li { padding: 12px; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; color: #e2e8f0; }
.list-simple li:last-child { border-bottom: none; }
.time-row-left { display: flex; align-items: center; gap: 12px; }
.hist-item:hover { background: #1e293b; }

