/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: linear-gradient(145deg, #1e2b3a 0%, #2c3e50 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

#app {
    background: #ecf0f1;
    border-radius: 32px;
    padding: 24px;
    max-width: 820px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* ===== HEADER ===== */
header h1 {
    color: #2c3e50;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

#info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    background: #34495e;
    padding: 10px 18px;
    border-radius: 60px;
    color: white;
    font-weight: 600;
}

#turno {
    background: #f1c40f;
    color: #2c3e50;
    padding: 4px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    white-space: nowrap;
}

#pontuacao {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #2c3e50;
    padding: 4px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    flex-wrap: wrap;
}

#pontuacao .ponto-j1 { color: #3498db; font-size: 1.2rem; }
#pontuacao .ponto-j2 { color: #e74c3c; font-size: 1.2rem; }
#pontuacao .nome-j1 { color: #3498db; }
#pontuacao .nome-j2 { color: #e74c3c; }
#pontuacao .pontos-j1 { color: #3498db; font-weight: 700; }
#pontuacao .pontos-j2 { color: #e74c3c; font-weight: 700; }

#timer {
    background: #e67e22;
    padding: 4px 14px;
    border-radius: 30px;
    font-size: 0.95rem;
    min-width: 70px;
    text-align: center;
}

.btn-encerrar {
    background: #e74c3c;
    border: none;
    color: white;
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}
.btn-encerrar:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* ===== CONFIGURAÇÃO ===== */
#configuracao {
    background: #f8f9fa;
    padding: 30px 24px;
    border-radius: 24px;
    margin: 20px 0;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
}

#configuracao h2 {
    text-align: center;
    margin-bottom: 24px;
    color: #2c3e50;
}

.campo-nome,
.campo-tempo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.campo-nome label,
.campo-tempo label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 100px;
}

.campo-nome input,
.campo-tempo input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #bdc3c7;
    border-radius: 12px;
    font-size: 1rem;
    transition: 0.2s;
    min-width: 140px;
}
.campo-nome input:focus,
.campo-tempo input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.25);
}

.campo-tempo input {
    max-width: 100px;
}
.dica {
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-left: 8px;
}

hr {
    margin: 24px 0;
    border: 1px solid #bdc3c7;
}

.config-tamanho,
.config-intervalo,
.config-negativos,
.config-operacoes {
    margin-bottom: 20px;
}

.config-tamanho h3,
.config-intervalo h3,
.config-negativos h3,
.config-operacoes h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.config-tamanho label {
    font-weight: 500;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.config-tamanho input {
    width: 80px;
    padding: 8px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.intervalo-inputs {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}
.intervalo-inputs label {
    font-weight: 600;
    color: #2c3e50;
}
.intervalo-inputs input {
    width: 80px;
    padding: 8px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}

.config-negativos label {
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
}
.config-negativos input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: #3498db;
}

.ops-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
}
.ops-checkboxes label {
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
}
.ops-checkboxes input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    accent-color: #3498db;
}

#btn-iniciar {
    background: #27ae60;
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 60px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 8px;
    width: 100%;
}
#btn-iniciar:hover {
    background: #2ecc71;
    transform: scale(1.02);
}

.erro {
    color: #e74c3c;
    font-weight: 600;
    margin-top: 12px;
    text-align: center;
    min-height: 1.5rem;
}

/* ===== TABULEIRO ===== */
#jogo {
    margin: 16px 0;
}

#tabuleiro {
    display: grid;
    gap: 4px;
    background: #7f8c8d;
    padding: 10px;
    border-radius: 16px;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.2);
}

.casa {
    aspect-ratio: 1 / 1;
    background: #d4a373;
    border: 2px solid #5d4037;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #2c3e50;
    cursor: pointer;
    transition: 0.15s ease;
    user-select: none;
    text-align: center;
    padding: 2px;
    word-break: break-word;
}

.casa.escura {
    background: #8b5a2b;
}

.casa.revelada-j1 {
    background: #3498db !important;
    color: white;
    cursor: default;
    border-color: #2980b9;
}
.casa.revelada-j2 {
    background: #e74c3c !important;
    color: white;
    cursor: default;
    border-color: #c0392b;
}

.casa:hover:not(.revelada-j1):not(.revelada-j2) {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(0,0,0,0.3);
    z-index: 2;
}

/* ===== MENSAGEM FINAL ===== */
#mensagem-final {
    text-align: center;
    background: #ecf0f1;
    padding: 24px 16px;
    margin-top: 20px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#mensagem-final h2 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 8px;
}

#placar-final {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
}

.botoes-final {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-secundario {
    background: #3498db;
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: 60px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
}
.btn-secundario:hover {
    transform: scale(1.04);
    filter: brightness(1.1);
}
.btn-secundario:last-child {
    background: #e67e22;
}

/* ===== MODAL ===== */
#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

#modal.hidden {
    display: none;
}

#modal-content {
    background: white;
    padding: 32px 28px;
    border-radius: 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.pergunta-destaque {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
}

#resposta {
    font-size: 1.6rem;
    padding: 10px;
    width: 100%;
    border: 2px solid #bdc3c7;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 12px;
}
#resposta:focus {
    border-color: #3498db;
    outline: none;
}

#btn-responder {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 60px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
}
#btn-responder:hover {
    background: #2ecc71;
}

#feedback {
    margin-top: 12px;
    font-weight: 600;
    min-height: 1.8rem;
}

/* ===== OVERLAY DE VITÓRIA ===== */
#overlay-vitoria {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease;
}
#overlay-vitoria.hidden {
    display: none;
}
#vitoria-content {
    text-align: center;
    padding: 40px;
    animation: zoomIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#vitoria-mensagem {
    font-size: 4rem;
    font-weight: 900;
    color: #f1c40f;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.6), 0 0 60px rgba(241, 196, 15, 0.3);
    animation: pulse 1.2s ease-in-out infinite alternate;
    background: rgba(44, 62, 80, 0.6);
    padding: 20px 40px;
    border-radius: 60px;
    backdrop-filter: blur(4px);
    border: 3px solid #f1c40f;
    box-shadow: 0 0 40px rgba(241, 196, 15, 0.3);
}
#vitoria-mensagem span {
    color: white;
}
.confetes {
    font-size: 3rem;
    margin-top: 20px;
    animation: confetes 2s infinite alternate;
}
.confetes span {
    display: inline-block;
    margin: 0 8px;
    animation: flutuar 2s infinite alternate;
}
.confetes span:nth-child(2) { animation-delay: 0.2s; }
.confetes span:nth-child(3) { animation-delay: 0.4s; }
.confetes span:nth-child(4) { animation-delay: 0.6s; }
.confetes span:nth-child(5) { animation-delay: 0.8s; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes pulse {
    0% { transform: scale(1); text-shadow: 0 0 20px rgba(241, 196, 15, 0.6); }
    100% { transform: scale(1.05); text-shadow: 0 0 40px rgba(241, 196, 15, 1), 0 0 80px rgba(241, 196, 15, 0.6); }
}
@keyframes confetes {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-10px) rotate(5deg); }
}
@keyframes flutuar {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-20px) scale(1.2); }
}

/* ===== RODAPÉ ===== */
footer {
    text-align: center;
    margin-top: 24px;
    color: #7f8c8d;
    font-size: 0.9rem;
}
footer .assinatura {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 4px;
}

/* ===== UTILITÁRIOS ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVO ===== */
@media (max-width: 600px) {
    #app { padding: 16px; }
    #info { flex-direction: column; align-items: stretch; border-radius: 30px; }
    #turno, #pontuacao, #timer, .btn-encerrar { justify-content: center; text-align: center; }
    .campo-nome, .campo-tempo, .intervalo-inputs { flex-direction: column; align-items: stretch; }
    .campo-nome label, .campo-tempo label { min-width: auto; }
    .campo-tempo input { max-width: 100%; }
    .config-tamanho label { flex-direction: column; align-items: stretch; }
    .ops-checkboxes { flex-direction: column; gap: 8px; }
    .casa { font-size: 0.7rem; }
    #vitoria-mensagem { font-size: 2.5rem; padding: 15px 25px; }
    .confetes { font-size: 2rem; }
}
@media (max-width: 400px) {
    .casa { font-size: 0.6rem; border-width: 1px; }
    #tabuleiro { gap: 2px; padding: 6px; }
}