:root {
    --bg-color: #f0f7ff;
    --text-color: #1a1a1a;
    --book-color: #0056b3;
    --chapter-color: #e67e22;
    --verse-num-color: #27ae60;
    --font-main: 'Lora', serif;
    --font-title: 'Cinzel', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background: url('../img/background.png') center/cover no-repeat fixed;
    background-color: #1a252f;
    color: var(--text-color);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: fixed;
}

.hidden { display: none !important; }

/* Splash Screen */
.splash-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
    perspective: 1500px;
}

.bible-cover {
    width: 260px;
    height: 380px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.bible-cover.open {
    transform: scale(1.5) translateZ(200px);
    opacity: 0;
}

.cover-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 5px 15px 15px 5px;
    overflow: hidden;
    backface-visibility: hidden;
    z-index: 2;
}

.cover-image { width: 100%; height: 100%; object-fit: cover; }
.cover-spine { position: absolute; width: 40px; height: 100%; background: #0056b3; left: -20px; transform: rotateY(-90deg); }
.cover-back { position: absolute; width: 100%; height: 100%; background: #0056b3; transform: rotateY(180deg); border-radius: 15px 5px 5px 15px; }
.tap-hint { color: #fff; margin-top: 40px; font-family: var(--font-title); letter-spacing: 2px; }



/* Header & Selectors */
.main-header {
    background-color: #fff;
    padding: 8px 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.selectors { display: flex; gap: 10px; }
.selector-wrapper { position: relative; }

.custom-select {
    padding: 6px 15px;
    border: 1px solid #eee;
    border-radius: 20px;
    background: #f8f9fa;
    color: var(--book-color);
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-select:hover { background: #f0f0f0; }

/* Inline Dropdown - Abre para baixo */
.inline-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 220px;
    max-height: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.2s ease-out;
}

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

.dropdown-list {
    overflow-y: auto;
    padding: 5px 0;
}

.dropdown-item {
    padding: 12px 20px;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    color: #333;
}

.dropdown-item:hover { background: #f0f7ff; color: var(--book-color); }

.dropdown-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 15px;
    overflow-y: auto;
}

.grid-item {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
}

.grid-item:hover { background: var(--chapter-color); color: white; }

/* Reader Container */
#main-app { height: 100vh; display: flex; flex-direction: column; background-color: transparent; }
.reader-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 10px; position: relative; }

.book-page {
    width: 100%; max-width: 700px; height: 98%; background-color: var(--bg-color); color: var(--text-color);
    border-radius: 4px; padding: 20px 25px; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.page-content { flex: 1; overflow: hidden; line-height: 1.5; font-size: 1.1rem; text-align: justify; }
.page-footer { padding-top: 10px; text-align: center; font-size: 0.75rem; opacity: 0.6; border-top: 1px solid rgba(0,0,0,0.05); }

/* Bible Typography */
.book-title-small { color: #0056b3 !important; font-family: var(--font-title); font-size: 1.2rem; margin-bottom: 2px; text-align: center; }
.chapter-title-small { color: #e67e22 !important; font-size: 0.95rem; margin-bottom: 12px; text-align: center; }
.verse { margin-bottom: 6px; display: inline; }
.verse-num { color: #27ae60 !important; font-weight: bold; font-size: 0.75rem; vertical-align: super; margin-right: 4px; }

/* Settings Menu */
.side-menu {
    position: fixed; top: 0; left: -300px; width: 300px; height: 100%; background: white; z-index: 2000;
    box-shadow: 10px 0 30px rgba(0,0,0,0.3); transition: left 0.3s ease; padding: 25px; color: #333;
}
.side-menu.open { left: 0; }
.menu-section { margin-bottom: 30px; }
.color-picker-group { display: flex; flex-direction: column; gap: 15px; }
.picker-item { display: flex; justify-content: space-between; align-items: center; }
.picker-item input[type="color"] { width: 40px; height: 40px; border: none; border-radius: 50%; cursor: pointer; }
.font-options { display: flex; gap: 10px; }
.font-btn { flex: 1; padding: 10px; border: 1px solid #ddd; background: #f8f9fa; cursor: pointer; border-radius: 8px; }
.font-btn.active { background: #0056b3; color: white; border-color: #0056b3; }
.reset-btn { width: 100%; padding: 12px; background: #f1f2f6; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; }

.icon-btn { background: none; border: none; font-size: 1.2rem; color: #555; padding: 8px; cursor: pointer; }

/* Presets de Cores */
.presets-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.preset-btn { border: 2px solid transparent; border-radius: 8px; padding: 8px; cursor: pointer; background: none; transition: all 0.2s ease; }
.preset-btn:hover { transform: scale(1.1); border-color: #0056b3; }
.preset-btn span { display: block; width: 100%; aspect-ratio: 1; border-radius: 4px; }

/* Botao de Instalacao */
.install-btn {
    position: absolute;
    bottom: 30px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 86, 179, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.5s ease-out;
}

.install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 86, 179, 0.6);
}

.install-btn:active {
    transform: translateY(0);
}

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

/* Touch Navigation */
.touch-areas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; pointer-events: none; }
.touch-area { flex: 1; pointer-events: auto; cursor: pointer; }

@media (max-width: 480px) {
    .book-page { padding: 15px 20px; }
    .page-content { font-size: 1rem; }
    .inline-dropdown { width: 180px; }
    .dropdown-grid { grid-template-columns: repeat(4, 1fr); }
    
    /* Saturação e Matrix no máximo para mobile */
    #bg-color-picker,
    #text-color-picker {
        filter: saturate(2) contrast(1.3);
    }
}
