:root { --bg-color: #ffffff; --text-color: #1e293b; --btn-bg: #e2e8f0; --btn-hover: #cbd5e1; --primary: #3b82f6; --board-bg: #f8fafc; --cell-border: #cbd5e1; 
--correct: #22c55e; --present: #eab308; --absent: #64748b; --key-text: #1e293b; --dist-bg: #94a3b8; }
body.dark-mode { --bg-color: #050505; --text-color: #f8fafc; --btn-bg: #1f2937; --btn-hover: #374151; --board-bg: #111827; --cell-border: #374151; --primary: #3b82f6; 
--absent: #334155; --key-text: #f8fafc; --dist-bg: #334155; }

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); transition: 0.3s; display: flex; flex-direction: column; min-height: 100vh; touch-action: manipulation; }

.top-bar { display: flex; justify-content: space-between; align-items: center; padding: max(20px, env(safe-area-inset-top)) 20px 20px 20px; width: 100%; }
.icon-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-color); cursor: pointer; transition: 0.2s; padding: 8px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { color: var(--primary); transform: scale(1.1); }
.lang-btn { font-size: 1rem; font-weight: bold; border: 2px solid var(--text-color); border-radius: 50%; width: 36px; height: 36px; padding: 0; }
.right-icons { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; }

.container { display: flex; flex-direction: column; align-items: center; flex-grow: 1; padding: 10px 20px; width: 100%; max-width: 500px; margin: 0 auto; }
.game-header { margin-bottom: 20px; }
h1 { font-size: 2.5rem; text-align: center; }

/* Tabuleiro */
.wordle-board { display: grid; grid-template-rows: repeat(6, 1fr); grid-gap: 5px; margin-bottom: 30px; width: 100%; max-width: 350px; }
.wordle-row { display: grid; grid-template-columns: repeat(5, 1fr); grid-gap: 5px; }
.wordle-tile { width: 100%; aspect-ratio: 1; border: 2px solid var(--cell-border); display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; text-transform: uppercase; transition: all 0.15s ease; border-radius: 8px; user-select: none; }
.wordle-tile.filled { border-color: var(--text-color); animation: popIn 0.1s; }
.wordle-tile.selected-tile { border: 3px solid var(--primary) !important; background-color: rgba(59, 130, 246, 0.1); box-shadow: 0 0 10px rgba(59, 130, 246, 0.4); transform: scale(1.02); }

/* Estados das Letras */
.wordle-tile.correct { background-color: var(--correct) !important; color: white; border-color: var(--correct); }
.wordle-tile.present { background-color: var(--present) !important; color: white; border-color: var(--present); }
.wordle-tile.absent { background-color: var(--absent) !important; color: white; border-color: var(--absent); }

@keyframes popIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } }
.shake { animation: shake 0.4s; }

/* Teclado Virtual */
.keyboard { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; user-select: none; }
.key-row { display: flex; justify-content: center; gap: 6px; width: 100%; }
.key { flex: 1; height: 50px; background-color: var(--btn-bg); color: var(--key-text); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 1.1rem; cursor: pointer; border: none; text-transform: uppercase; transition: 0.2s; max-width: 45px; }
.key:active { transform: scale(0.95); filter: brightness(0.9); }
.key.large { flex: 2.5; font-size: 0.9rem; max-width: 85px; }
.key.medium-large { flex: 1.2; font-size: 1rem; max-width: 55px; } 

/* FOCO E VISIBILIDADE BAIXA NO TECLADO */
.key.correct { background-color: var(--correct); color: white; }
.key.present { background-color: var(--present); color: white; }
.key.absent { background-color: var(--absent); color: white; opacity: 0.35; }

/* Modais e Componentes */
.primary-btn { background-color: var(--primary); color: white; border: none; padding: 14px 20px; font-size: 1.1rem; font-weight: bold; border-radius: 10px; cursor: pointer; width: 100%; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.primary-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.pulse-btn { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 15px; }
.modal-overlay.open { display: flex; }
.modal-content { background-color: var(--board-bg); color: var(--text-color); padding: 35px 25px; border-radius: 16px; width: 100%; max-width: 440px; border: 2px solid var(--cell-border); box-shadow: 0 20px 50px rgba(0,0,0,0.3); position: relative; box-sizing: border-box; }
.modal-content h2 { margin-bottom: 15px; color: var(--primary); text-align: center; font-size: 1.8rem; }
.modal-content p { white-space: pre-line; text-align: left; line-height: 1.6; margin-bottom: 30px; font-size: 1.05rem; }
.close-btn { background-color: var(--btn-bg); color: var(--text-color); border: none; padding: 14px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; width: 100%; transition: 0.2s; margin-top: 10px; box-sizing: border-box; }
.close-btn:hover { filter: brightness(0.9); }

/* Estatísticas */
.stats-modal-content { padding: 30px 20px; max-width: 400px; width: 100%; }
.stats-grid { display: flex; justify-content: space-between; margin-bottom: 25px; padding: 0 5px; }
.stat-box { display: flex; flex-direction: column; align-items: center; width: 22%; }
.stat-num { font-size: 2rem; font-weight: bold; line-height: 1; margin-bottom: 5px; }
.stat-label { font-size: 0.7rem; text-transform: uppercase; text-align: center; opacity: 0.8; }
.dist-title { font-size: 1.1rem; text-transform: uppercase; margin-bottom: 15px; opacity: 0.9; text-align: center; }
.dist-chart { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; width: 100%; }
.dist-row { display: flex; align-items: center; width: 100%; }
.dist-label { width: 25px; font-weight: bold; font-size: 1.1rem; text-align: right; margin-right: 10px; }
.dist-bar-container { flex-grow: 1; display: flex; background-color: var(--dist-bg); border-radius: 4px; overflow: hidden; opacity: 0.3; transition: 0.3s; width: 100%; }
.dist-bar-container.has-value { opacity: 1; }
.dist-bar { background-color: var(--dist-bg); min-width: 8%; color: white; text-align: right; padding: 2px 8px; font-weight: bold; border-radius: 4px; font-size: 0.9rem; }
.dist-bar.active { background-color: var(--primary); }

.stats-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 15px; padding-top: 20px; border-top: 1px solid var(--cell-border); width: 100%; box-sizing: border-box; }
.timer-section { display: flex; flex-direction: column; align-items: center; flex: 1; border-right: 1px solid var(--cell-border); padding-right: 10px; }
.share-section { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; }
.share-section .primary-btn { font-size: 1rem; padding: 12px 10px; display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; }
.next-word-label { font-size: 0.8rem !important; text-transform: uppercase; margin-bottom: 5px !important; opacity: 0.8; }
.countdown-timer { font-size: 1.8rem; font-weight: bold; font-family: 'Orbitron', monospace; }

@media (max-width: 400px) {
    .stats-footer { flex-direction: column; gap: 15px; }
    .timer-section { border-right: none; padding-right: 0; width: 100%; border-bottom: 1px solid var(--cell-border); padding-bottom: 15px; }
    .share-section { width: 100%; }
    .stat-num { font-size: 1.6rem; }
}

.rules-subtitle { font-weight: bold; opacity: 0.8; margin-bottom: 20px; text-align: center !important; border-bottom: 1px dashed var(--cell-border); padding-bottom: 10px; }
.rules-examples { display: flex; flex-direction: column; gap: 18px; margin-bottom: 25px; }
.example-item { display: flex; flex-direction: column; gap: 8px; }
.example-row { display: flex; gap: 5px; max-width: 180px; }
.example-row .wordle-tile { width: 32px; height: 32px; font-size: 1.1rem; border-radius: 4px; border-width: 1px; }
.example-text { font-size: 0.95rem !important; opacity: 0.9; margin-bottom: 0 !important; line-height: 1.4; }

.word-reveal { font-size: 2.2rem; font-weight: bold; letter-spacing: 5px; margin: 10px 0 25px 0; text-transform: uppercase; padding: 10px; background: rgba(0,0,0,0.1); border-radius: 8px; display: inline-block; }
.text-center { text-align: center; }

.toast-container { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 3000; pointer-events: none; width: 90%; max-width: 300px; }
.toast { background-color: #ef4444; color: white; padding: 12px 24px; border-radius: 8px; font-weight: bold; box-shadow: 0 4px 12px rgba(0,0,0,0.3); animation: fadeInOut 2s forwards; text-align: center; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateY(-20px); } 15% { opacity: 1; transform: translateY(0); } 85% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } }

.fb-input { width: 100%; padding: 12px; margin-bottom: 15px; border-radius: 8px; border: 1px solid var(--cell-border); background-color: var(--bg-color); color: var(--text-color); font-family: inherit; font-size: 1rem; box-sizing: border-box; }
.fb-file-label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: var(--text-color); text-align: left; }
.fb-input-file { margin-bottom: 20px; width: 100%; color: var(--text-color); }
.ad-container { margin-top: auto; display: flex; justify-content: center; width: 100%; min-height: 90px; }

/* Menu Lateral */
.side-menu { position: fixed; top: 0; left: -250px; width: 250px; height: 100%; background-color: var(--board-bg); box-shadow: 2px 0 10px rgba(0,0,0,0.2); transition: 0.3s; z-index: 1000; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.side-menu.open { left: 0; }
.side-menu h2 { margin-bottom: 30px; color: var(--primary); border-bottom: 2px solid var(--cell-border); padding-bottom: 10px; font-size: 1.5rem;}
.side-menu ul { list-style: none; }
.side-menu li { margin-bottom: 15px; }
.side-menu a { text-decoration: none; color: var(--text-color); font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.side-menu a.active { color: var(--primary); font-weight: bold; }
.menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999; }
.menu-overlay.open { display: block; }
.menu-category { font-size: 0.85rem; font-weight: bold; color: var(--primary); opacity: 0.7; margin-bottom: 8px; letter-spacing: 1px; pointer-events: none; }