/* Global app shell styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', -apple-system, sans-serif;
    background-color: var(--verde-fundo, #E8F0E4);
    color: var(--texto, #333333);
    overflow: hidden;
}

#app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

.screen {
    width: 100%;
    min-height: 100%;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── COMMON UI ─── */
.btn-primary, .btn-secondary, .btn-full {
    border: none;
    border-radius: var(--radius-lg, 16px);
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
    letter-spacing: 1px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: rgba(69, 107, 81, 0.95);
    color: #ffffff !important;
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.1), 0 4px 10px rgba(0,0,0,0.25);
}

.btn-primary .btn-text {
    color: #ffffff !important;
}

.btn-primary:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.05), 0 2px 5px rgba(0,0,0,0.2);
}

.btn-primary:hover {
    background: rgba(79, 117, 91, 0.98);
}

.btn-secondary {
    background: #e3e8e5;
    color: #124036 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.btn-secondary .btn-text {
    color: #124036 !important;
}

.btn-secondary:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background: #eff3f0;
}

.btn-full {
    width: 100%;
    display: block;
    margin-top: 20px;
}

.btn-large {
    width: 250px;
    padding: 16px 24px;
    font-size: 18px;
    margin-bottom: 16px;
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-bar h1 {
    margin: 0;
    font-size: 18px;
    color: var(--verde-principal);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--verde-principal);
}

/* ─── TELA 0: SPLASH SCREEN ─── */
.splash-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--verde-fundo);
}

.splash-logo {
    animation: pulse 2s infinite ease-in-out;
}

.splash-loading {
    margin-top: 40px;
    text-align: center;
}

.loading-bar {
    width: 200px;
    height: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 10px;
}

.loading-progress {
    height: 100%;
    background: var(--verde-principal);
    width: 0%;
    animation: loadProgress 2s forwards ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes loadProgress {
    to { width: 100%; }
}

/* ─── TELA 1: MAIN MENU ─── */
.main-menu-screen {
    position: relative;
    height: 100vh; height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: #075855;
    overflow-x: hidden;
}

.menu-bg {
    display: none;
}

.menu-content {
    width: 100%;
    max-width: 360px;
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.menu-logo {
    width: 150%;
    max-width: 600px;
    margin-top: -20px;
    margin-bottom: -50px;
    position: relative;
    z-index: 1;
}

.menu-cover-image {
    width: 100%;
    height: auto;
    border: none;
    border-radius: 0;
    display: block;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 16px;
    position: relative;
    z-index: 10;
}

.menu-buttons .btn-large {
    width: 100%;
    margin-bottom: 0;
}

.menu-footer {
    margin-top: 40px;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ─── TELA 2: CONFIG PARTIDA ─── */
.config-game-screen {
    min-height: 100vh;
    background-color: var(--verde-fundo);
}

.config-content {
    padding: 24px;
}

.config-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.config-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
}

.toggle-group, .difficulty-select {
    display: flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn, .diff-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
}

.toggle-btn.active, .diff-btn.active {
    background: white;
    color: var(--verde-principal);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.input-field {
    width: 100%;
    padding: 12px;
    border: 2px solid #eee;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.config-footer {
    padding: 24px;
}

/* ─── TELA 6: CONFIGURAÇÕES ─── */
.settings-screen {
    min-height: 100vh;
    background-color: var(--cor-pergaminho, #Fdfbf7);
}

.settings-content {
    padding: 24px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.setting-row label {
    font-weight: 600;
}

.slider {
    width: 150px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider-toggle {
    background-color: var(--verde-principal);
}

input:checked + .slider-toggle:before {
    transform: translateX(22px);
}

.dropdown-select {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
}

.settings-footer {
    padding: 24px;
    display: flex;
    gap: 12px;
}

.settings-footer button {
    flex: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9999;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ─── TELA 3: TUTORIAL ─── */
.tutorial-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.btn-text {
    background: none; border: none; font-weight: bold; color: #666; cursor: pointer;
}
.tutorial-game-bg {
    flex: 1;
    background: var(--verde-fundo);
    position: relative;
}
.tutorial-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5);
}
.mascot-dialogue {
    position: absolute; bottom: 40px; left: 5%; width: 90%;
    background: white; border-radius: 16px; padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; gap: 16px; align-items: flex-start;
}
.mascot-avatar {
    width: 60px; height: 60px; font-size: 40px;
    background: var(--verde-fundo); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.mascot-text h3 { margin: 0 0 8px 0; color: var(--verde-principal); }
.mascot-text p { margin: 0 0 16px 0; line-height: 1.4; }
.dialogue-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* ─── TELA 4: COMO JOGAR ─── */
.rules-screen, .credits-screen {
    min-height: 100vh;
    background: var(--cor-pergaminho);
}
.rules-content, .credits-content { padding: 24px; }
.rules-tabs {
    display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto;
}
.tab-btn {
    padding: 8px 16px; border: none; border-radius: 20px;
    background: #e0e0e0; color: #555; font-weight: bold; cursor: pointer; white-space: nowrap;
}
.tab-btn.active {
    background: #2E7D32; color: #FFFFFF; /* Dark green background with explicitly white text */
}
.rules-body {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    color: #333333;
}
.rules-body.hidden {
    display: none;
}
.rules-body h2 { color: #2E7D32; margin-top: 0; }
.rules-body h3 { color: #D4853E; margin-top: 24px; }
.rules-body ul, .rules-body ol { margin-left: 20px; }
.rules-body p, .rules-body li { line-height: 1.6; }

/* ─── TELA 5: CRÉDITOS ─── */
.credits-content { text-align: center; }
.credits-logo { margin: 20px 0 40px 0; }
.credit-block { margin-bottom: 24px; }
.credit-block strong { color: var(--verde-principal); display: block; margin-bottom: 8px; }
.credit-block p { margin: 0; color: #555; }
