/* RESET E ESTILOS GERAIS */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #e6f7ff 0%, #cce7ff 100%); color: #333; min-height: 100vh; padding: 10px; display: flex; flex-direction: column; align-items: center; overflow-x: hidden; }

/* CONTAINER PRINCIPAL */
.app-container { width: 100%; max-width: 900px; background: white; border-radius: 20px; box-shadow: 0 10px 30px rgba(0, 102, 204, 0.15); overflow: hidden; margin-bottom: 15px; }

/* CABEÇALHO */
.header { background: linear-gradient(to right, #0066cc, #3399ff); color: white; padding: 18px 12px; text-align: center; position: relative; }
.header h1 { font-size: 1.6rem; margin-bottom: 5px; font-weight: 700; padding-right: 60px; }
.header p { font-size: 0.95rem; opacity: 0.9; line-height: 1.3; }

/* BOTÃO PROFESSOR */
.teacher-btn { position: absolute; top: 18px; right: 12px; background: rgba(255, 255, 255, 0.2); border: 2px solid white; color: white; border-radius: 50px; padding: 8px 15px; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.3s; z-index: 10; }
.teacher-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* SELEÇÃO DE FASE */
.phase-selector { display: flex; background: #e6f2ff; padding: 8px; border-radius: 12px; margin: 12px; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.phase-selector::-webkit-scrollbar { display: none; }
.phase-btn { flex: 0 0 auto; min-width: 100px; padding: 10px 12px; border: none; border-radius: 10px; background: white; color: #3399ff; font-weight: 600; cursor: pointer; transition: all 0.3s; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 0.85rem; }
.phase-btn.active { background: linear-gradient(to right, #0066cc, #3399ff); color: white; box-shadow: 0 4px 10px rgba(0, 102, 204, 0.2); }

.phase-info { background: #f0f9ff; padding: 10px 15px; border-radius: 12px; margin: 0 12px 15px; border-left: 4px solid #0066cc; font-size: 0.95rem; color: #0066cc; line-height: 1.4; }

/* ÁREA DE JOGO */
.game-area { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 15px 12px; }

/* IMAGEM */
.image-container { width: 100%; max-width: 280px; height: 250px; border-radius: 16px; overflow: hidden; background: linear-gradient(145deg, #f0f9ff, #e6f2ff); display: flex; align-items: center; justify-content: center; border: 4px solid #4da6ff; box-shadow: 0 6px 15px rgba(77, 166, 255, 0.2); }
.image-container img { max-width: 90%; max-height: 90%; object-fit: contain; }
.placeholder-image { text-align: center; color: #99ccff; padding: 20px; }
.placeholder-image i { font-size: 3.5rem; margin-bottom: 15px; display: block; }

/* SÍLABAS */
.syllable-counter { background: #f0f9ff; padding: 15px; border-radius: 16px; width: 100%; max-width: 500px; border: 3px solid #4da6ff; }
.syllable-counter h3 { text-align: center; color: #0066cc; font-size: 1.2rem; margin-bottom: 15px; font-weight: 700; }
.syllable-grid { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.syllable-box { width: 55px; height: 55px; border-radius: 12px; background: white; border: 3px solid #3399ff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; position: relative; flex-shrink: 0; }
.syllable-box.selected { background: #e6f2ff; border-color: #0066cc; transform: scale(1.05); box-shadow: 0 4px 10px rgba(0, 102, 204, 0.2); }
.syllable-dot { width: 35px; height: 35px; border-radius: 50%; background: linear-gradient(145deg, #0066ff, #3399ff); display: none; box-shadow: inset 0 2px 5px rgba(255,255,255,0.5); }
.syllable-box.selected .syllable-dot { display: block; }

/* FONEMAS E ESCRITA */
.phoneme-container, .write-container { background: #f0f9ff; padding: 20px; border-radius: 16px; border: 3px solid #4da6ff; width: 100%; max-width: 500px; margin-bottom: 20px; text-align: center; }
.phoneme-inputs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.phoneme-input { width: 50px; height: 50px; border: 2px solid #3399ff; border-radius: 10px; font-size: 1.5rem; text-align: center; font-weight: 800; color: #0066cc; text-transform: uppercase; }
.phoneme-input.correct { background: #d9f2d9; border-color: #00cc66; color: #006600; }
.phoneme-input.incorrect { background: #ffe6e6; border-color: #ff6666; color: #cc0000; }

.word-input { width: 100%; max-width: 300px; padding: 15px; border: 3px solid #3399ff; border-radius: 12px; font-size: 1.5rem; text-align: center; font-weight: 700; color: #0066cc; text-transform: uppercase; letter-spacing: 1px; }
.word-input.correct { background: #d9f2d9; border-color: #00cc66; }
.word-input.incorrect { background: #ffe6e6; border-color: #ff6666; }

/* CONTROLES E FEEDBACK */
.game-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; max-width: 500px; }
.game-btn { padding: 14px 20px; font-size: 1rem; border: none; border-radius: 50px; cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; min-width: 140px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); color: white; }
.btn-check { background: linear-gradient(to right, #00cc66, #00b359); }
.btn-retry { background: linear-gradient(to right, #ff9900, #e68a00); }
.btn-next { background: linear-gradient(to right, #9966ff, #884de0); }

.feedback { margin-top: 20px; padding: 15px; border-radius: 12px; text-align: center; font-size: 1rem; font-weight: 700; width: 100%; max-width: 500px; display: none; }
.feedback.success { background: #d9f2d9; color: #006600; border: 2px solid #00cc66; }
.feedback.error { background: #ffe6e6; color: #cc0000; border: 2px solid #ff6666; }
.word-result { font-size: 1.8rem; color: #0066cc; font-weight: 800; margin: 12px 0; letter-spacing: 2px; }

/* ESTATÍSTICAS */
.stats { display: flex; justify-content: space-around; background: #f0f9ff; padding: 15px; border-radius: 12px; margin-top: 20px; width: 100%; max-width: 500px; border: 2px solid #b3e0ff; }
.stat-item { text-align: center; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: #0066cc; }

/* ÁREA DO PROFESSOR */
.teacher-area { display: none; padding: 15px 12px; }
.teacher-mode .teacher-area { display: block; }
.teacher-mode .game-area { display: none; }

.teacher-tabs { display: flex; background: #f0f9ff; border-bottom: 2px solid #cce7ff; border-radius: 10px 10px 0 0; }
.teacher-tab { flex: 1; padding: 14px 8px; background: none; border: none; font-weight: 600; color: #3399ff; cursor: pointer; }
.teacher-tab.active { color: #0066cc; background: white; }
.teacher-tab-content { display: none; padding: 20px 15px; background: white; border-radius: 0 0 10px 10px; }
.teacher-tab-content.active { display: block; }

.add-section { background: #f0f9ff; padding: 20px 15px; border-radius: 16px; border: 3px dashed #4da6ff; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; color: #0066cc; font-weight: 700; }
.form-group input { width: 100%; padding: 12px; border: 3px solid #3399ff; border-radius: 10px; }

.upload-area { border: 3px dashed #3399ff; border-radius: 10px; padding: 20px; text-align: center; margin-bottom: 20px; background: white; cursor: pointer; }
.image-preview { margin-top: 15px; text-align: center; }
.preview-img { max-width: 180px; max-height: 180px; border-radius: 10px; border: 3px solid #3399ff; }

/* EDITOR DE SÍLABAS */
.syllable-editor { background: white; padding: 15px; border-radius: 12px; border: 3px solid #3399ff; margin-top: 20px; }
.syllable-inputs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.syllable-input { width: 65px; height: 50px; border: 3px solid #3399ff; border-radius: 8px; font-size: 1.3rem; text-align: center; font-weight: 800; background: #f0f9ff; text-transform: uppercase; }
.syllable-control-btn { padding: 10px 15px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; color: white; }
.add-syllable { background: #00cc66; }
.remove-syllable { background: #ff6666; }

/* BANCO DE PALAVRAS */
.word-card { background: #f0f9ff; border-radius: 12px; padding: 12px; border: 3px solid #b3e0ff; text-align: center; position: relative; }
.word-card img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.words-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 15px; }
.word-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.word-action-btn { width: 28px; height: 28px; border-radius: 50%; border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.edit-btn { background: #3399ff; }
.delete-btn { background: #ff6666; }

/* MODAL */
.password-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 15px; }
.password-box { background: white; padding: 25px 20px; border-radius: 18px; text-align: center; max-width: 400px; width: 100%; }
.password-input { width: 100%; padding: 12px; border: 3px solid #3399ff; border-radius: 10px; margin-bottom: 15px; text-align: center; }
.password-btn { width: 100%; padding: 12px; background: #00cc66; color: white; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; }

/* RESPONSIVIDADE */
@media (min-width: 600px) {
    .image-container { max-width: 320px; height: 300px; }
    .syllable-box { width: 65px; height: 65px; }
    .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
}