:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --bg: #ffffff;
    --text: #111;
    --gray: #f4f4f4;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding-top: 60px; /* Space for fixed header */
    padding-bottom: 80px; /* Space for audio controls */
    color: var(--text);
    background: var(--bg);
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 600;
}

#back-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 10px 0;
}

/* --- VIEW 1: BOOK LIST --- */
.book-item {
    padding: 1.2rem;
    border-bottom: 1px solid #eee;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.book-item:active {
    background: var(--gray);
}

/* --- VIEW 2: CHAPTER GRID (5 Columns) --- */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    padding: 15px;
}

.chapter-box {
    aspect-ratio: 1; /* Makes them perfect squares */
    background: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
}

.chapter-box:active {
    background: var(--accent);
    color: white;
}

/* --- VIEW 3: READING MODE --- */
.reader-container {
    padding: 20px;
    line-height: 1.8;
    font-size: 1.15rem;
    font-family: 'Georgia', serif; /* Serif is better for reading blocks of text */
}

/* Continuous text styling */
.verse-num {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent);
    vertical-align: top;
    margin-right: 4px;
    position: relative;
    top: -2px;
}

.verse-text {
    /* No display: block here, so they run together */
}

/* --- AUDIO CONTROLS (Floating at bottom) --- */
#audio-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex;
    gap: 10px;
    z-index: 200;
}

#audio-controls button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.active-word {
    background-color: #ffeb3b !important;
    color: black;
    border-radius: 3px;
    transition: background-color 0.1s;
}

/* --- BOTTOM PLAYER BAR --- */
#player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%; /* Full width */
    height: 80px; /* Fixed height */
    background: #222;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box; /* Ensures padding doesn't break width */
    z-index: 200;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

#player-bar.hidden {
    transform: translateY(100%); /* Slide down off screen */
    display: flex !important;
}

/* Left side text styling */
.player-info {
    display: flex;
    flex-direction: column;
}

.player-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-subtitle {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
}

/* Right side controls styling */
.player-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.control-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: white;
    padding: 10px;
    border-radius: 50%;
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255,255,255,0.1);
}

.control-btn svg {
    width: 32px; /* Bigger buttons */
    height: 32px;
    fill: currentColor;
}

/* Adjust main content padding so it doesn't get hidden behind the bar */
body {
    padding-bottom: 100px !important; 
}

.control-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: color 0.2s;
}

.control-btn:hover {
    color: var(--accent);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Make the Play/Pause button slightly larger */
#toggle-play-btn svg {
    width: 32px;
    height: 32px;
}

/* Mobile responsiveness: Center widget on small screens */
@media (max-width: 600px) {
    #player-widget {
        right: 50%;
        transform: translateX(50%);
        bottom: 20px;
        width: auto;
    }
    #player-widget.hidden {
        transform: translate(50%, 100px);
    }
}

.verse-word {
    cursor: pointer; /* Changes mouse to pointer hand */
    border-radius: 3px;
    padding: 0 1px; /* Tiny padding makes the click target better */
}

.verse-word:hover {
    background-color: #e3f2fd; /* Light blue hover effect */
}

/* ... existing CSS ... */

/* Update body padding to account for the fixed player bar everywhere */
body {
    padding-bottom: 100px; 
}

/* Ensure the main container takes up space */
#app-container {
    min-height: 80vh;
}

/* Update Player Bar to slide in */
#player-bar {
    /* ... keep existing styles ... */
    transition: transform 0.3s ease;
}

#player-bar.hidden {
    transform: translateY(100%);
}

/* RESET LINKS */
a {
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* Ensure the links behave like blocks for the list layout */
a.book-item {
    display: block;
}

/* Ensure the links behave like flex containers for the grid */
a.chapter-box {
    display: flex;
    /* Maintain previous flex alignment */
    align-items: center;
    justify-content: center;
}