* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: #0f0f14; color: #fff; padding: 20px; display: flex; justify-content: center; }

#game-container {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 2px solid #2a2a3a;
    position: relative; /* Importante para posicionar a janela flutuante */
}

h2 { text-align: center; color: #00ff88; margin-bottom: 20px; font-size: 1.4rem; }

/* Tela de Entrada */
.setup-screen { display: flex; flex-direction: column; gap: 15px; }
.input-group { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.input-group input {
    width: 45%; background: #0f0f14; border: 2px dashed #444; border-radius: 8px;
    color: #00ff88; font-size: 1.8rem; text-align: center; padding: 10px; outline: none;
}
.btn-start { background: #00bcff; color: #fff; border: none; padding: 14px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; width: 100%; margin-top: 10px; }

/* Tela do Jogo */
.game-screen { display: none; flex-direction: column; gap: 20px; }

/* O CADERNO DIGITAL (GRADE) */
.notebook-board {
    background: #0f0f14; padding: 15px; border-radius: 8px; border: 1px solid #333; 
    display: flex; flex-direction: column; overflow-x: auto;
}
.notebook-line {
    display: flex;
    justify-content: flex-start;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2.2rem;
    font-weight: bold;
    height: 40px;
    line-height: 40px;
}

/* Cada célula representa uma coordenada na nossa matriz */
.cell {
    width: 32px;
    text-align: center;
    position: relative;
}

/* Cores dos Elementos baseados no seu design original */
.digit-dividendo { color: #ffd700; }
.digit-sub { color: #ff4a4a; }
.digit-resto { color: #fff; }
.digit-dropped { color: #00ff88; }

/* Chave e Quociente Alinhados na Grade de Pitágoras */
.cell-divisor { color: #00bcff; border-left: 4px solid #fff; border-bottom: 4px solid #fff; }
.cell-extended-key { border-bottom: 4px solid #fff; }
.cell-quocient { color: #00ff88; letter-spacing: 2px; text-align: left; padding-left: 2px; }
.cell-border-left { border-left: 4px solid #fff; }

/* Controles e Teclado */
.control-panel { display: flex; flex-direction: column; gap: 10px; position: relative; }
.panel-title { text-align: center; font-size: 0.9rem; color: #111; font-weight: bold; text-transform: uppercase; }
.numeric-keyboard { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.btn-num { background: #2a2a3a; color: #fff; border: 2px solid #444; padding: 12px; font-size: 1.2rem; font-weight: bold; border-radius: 6px; cursor: pointer; }
.btn-num:hover { background: #3a3a52; border-color: #00bcff; }

/* Botão do Peteleco */
.btn-peteleco {
    background: #00bcff; color: white; border: none; padding: 14px; 
    font-size: 1.2rem; font-weight: bold; border-radius: 8px; cursor: pointer; 
    margin-top: 10px; text-align: center; display: none;
    animation: balanca 0.5s infinite alternate;
}
@keyframes balanca { 0% { transform: scale(1); } 100% { transform: scale(1.04); } }

/* Mascote Feedback */
.feedback-area {
    background: #0f0f14; padding: 12px; border-radius: 8px; min-height: 70px;
    display: flex; align-items: center; gap: 12px; font-size: 1rem; border-left: 4px solid #00bcff;
}
.mascote { font-size: 2.2rem; animation: bounce 0.6s infinite alternate; }
@keyframes bounce { 0% { transform: translateY(0); } 100% { transform: translateY(-6px); } }

/* Botão de Tabuada Principal */
.btn-tabuada {
    background: #8e44ad; color: #fff; border: none; padding: 10px;
    font-size: 0.95rem; font-weight: bold; border-radius: 6px; cursor: pointer;
    width: 100%; margin-top: 5px; text-align: center; display: flex; justify-content: center; align-items: center; gap: 8px;
}
.btn-tabuada:hover { background: #9b59b6; }

/* NOVA JANELA FLUTUANTE DA TABUADA (Ajustada no topo direito por cima de tudo) */
.tabuada-popup {
    display: none; 
    position: absolute;
    top: 105px; /* Alinhado lateralmente à área do caderno */
    right: 25px;
    width: 180px;
    background: #11111d; 
    border: 2px solid #8e44ad;
    border-radius: 8px; 
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.7);
    z-index: 10;
}
.tabuada-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #aaa;
    font-weight: bold;
}
.btn-close-tabuada {
    background: none; border: none; color: #ff4a4a; font-weight: bold; cursor: pointer; font-size: 1rem;
}
.tabuada-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: 'Courier New', Courier, monospace; 
    font-size: 0.95rem; 
    color: #e0b0ff;
    max-height: 200px;
    overflow-y: auto;
}
.tabuada-item { background: #1a1a2e; padding: 3px 6px; border-radius: 4px; text-align: left; }

/* Ajuste para telas muito pequenas não cobrir a conta toda */
@media (max-width: 480px) {
    .tabuada-popup {
        width: 150px;
        right: 15px;
        top: 110px;
        font-size: 0.85rem;
    }
}