
/* Variáveis CSS e Suporte a Tema Escuro */
:root {
    --primary-color: #16a34a;
    --primary-hover: #15803d;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e2e8f0;
    --highlight-bg: #dcfce7;
    --highlight-text: #166534;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --focus-ring: 0 0 0 3px rgba(22, 163, 74, 0.4);
    --radius: 12px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --card-bg: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --highlight-bg: #064e3b;
        --highlight-text: #86efac;
        --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    }
}

/* Reset e Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Header */
header { text-align: center; margin-bottom: 40px; }

h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 10px;
    letter-spacing: -0.025em;
}

.subtitle { color: var(--text-muted); font-size: 1.1rem; }

/* Formulários */
.input-section { margin-bottom: 30px; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
    font-size: 0.95rem;
}

.textarea-wrapper { position: relative; }

textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace; /* Monospaced para alinhar números */
    font-size: 1rem;
    background-color: var(--card-bg);
    color: var(--text-main);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Botões */
.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text-main); }

/* Resultados */
#resultsArea {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.summary-box {
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 25px;
    animation: fadeIn 0.5s ease;
}

.game-card {
    background-color: rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: transform 0.2s;
}

.game-card:hover { transform: translateX(4px); }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    background-color: var(--border-color);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge.winner {
    background-color: var(--primary-color);
    color: white;
}

/* Bolas e Animação */
.balls-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ball {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.95rem;
    /* Animação de entrada */
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.ball.hit {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.error-box {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    border-left: 4px solid #b91c1c;
    font-weight: 500;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Keyframes */
@keyframes popIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsividade */
@media (max-width: 600px) {
    .container { padding: 20px; }
    h1 { font-size: 1.8rem; }
    .ball { width: 34px; height: 34px; font-size: 0.85rem; }
    .actions { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
}

/* Acessibilidade: Ocultar visualmente mas manter para screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
