/* ==========================================
   1. CORE VARIABLES & BASE STYLES
   ========================================== */
:root {
    --bg: #fdfbf7;
    --txt: #1a1a1a;
    --card-bg: #ffffff;
    --primary: #2c3e50;
    --accent: #e74c3c; /* Muted Red */
    --muted: #999999;
    --border: #eeeeee;
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    margin: 0; 
    padding: 0; 
    color: var(--txt);
    overflow-x: hidden;
}

/* Bulma Mobile Grid Fix */
.columns.is-mobile > .column.is-6-mobile { width: 50%; }

/* ==========================================
   2. SPLASH SCREEN
   ========================================== */
#splash {
    position: fixed; inset: 0; background: #fff; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.8s ease-out;
}
.splash-logo {
    width: 140px; height: 140px; object-fit: contain;
    animation: PulseZoom 2s infinite ease-in-out alternate;
    display: none;
}
.loading-txt { 
    margin-top: 25px; font-size: 0.75rem; letter-spacing: 2px; 
    color: var(--muted); font-weight: 700; text-transform: uppercase;
}
@keyframes PulseZoom { 
    0% { transform: scale(0.95); opacity: 0.8; } 
    100% { transform: scale(1.1); opacity: 1; } 
}

/* ==========================================
   3. PORTAL UI (MAIN VIEW)
   ========================================== */
.view { display: none; padding-bottom: 120px; opacity: 0; transition: opacity 0.6s; }
.view.is-active { display: block; opacity: 1; }

.ph { padding: 1.5rem; display: flex; justify-content: center; }
.top-logo { 
    height: 70px; width: 70px; object-fit: contain; 
    background: #fff; padding: 5px; border: 1px solid var(--border); border-radius: 12px; 
}

.mh { text-align: center; padding: 0 1rem; }
.cw { 
    width: 150px; height: 150px; margin: 0 auto; 
    border-radius: 50%; overflow: hidden; 
    background: #f4f4f4; box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}
.cw img { width: 100%; height: 100%; object-fit: cover; }

.leader-name { font-size: 1.3rem; font-weight: 800; margin-top: 1.2rem; color: var(--primary); }
.leader-title { 
    font-size: 0.7rem; color: var(--muted); font-weight: 700; 
    text-transform: uppercase; letter-spacing: 1px; margin-top: 4px;
}

.acts { display: flex; justify-content: center; gap: 30px; margin-top: 25px; }
.act-btn { display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: 0.2s; }
.act-btn:active { transform: scale(0.9); }
.act-btn i { font-size: 1.6rem; color: #333; margin-bottom: 6px; }
.act-btn span { font-size: 0.6rem; font-weight: 800; color: #666; letter-spacing: 1px; }

.sep-line { width: 100%; height: 1px; background: var(--border); margin: 2rem 0; }

/* ==========================================
   4. ASSOCIATE CARDS
   ========================================== */
.card-base {
    background: var(--card-bg); border-radius: 20px; padding: 1.2rem 1rem;
    display: flex; flex-direction: column; align-items: center;
    border: 1px solid #f0f0f0; box-shadow: var(--shadow);
    height: 100%; cursor: pointer; transition: 0.2s;
    position: relative;
}
.card-base:active { 
    transform: scale(0.96); 
    background-color: #f0f0f0;
    border-color: var(--accent);
}

.aa { 
    width: 80px; height: 80px; border-radius: 50%; overflow: hidden; 
    background: #f8f8f8; margin-bottom: 0.8rem; object-fit: cover;
    border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.ln { font-size: 0.9rem; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; text-align: center; }
.branch-info { text-align: center; margin-bottom: 10px; }
.b-name { display: block; font-size: 0.65rem; font-weight: 600; color: #4a4a4a; }
.b-loc { display: block; font-size: 0.6rem; color: var(--muted); }

.sm-acts { display: flex; gap: 10px; margin-top: auto; opacity: 0.3; }
.sm-acts i { font-size: 0.9rem; }

/* ==========================================
   5. DRAWERS & MODALS
   ========================================== */
.oc { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100dvh; /* dvh for mobile fix */ 
    background: rgba(255,255,255,0.98); z-index: 6000; 
    opacity: 0; pointer-events: none; transition: opacity .3s; 
    display: flex; align-items: center; justify-content: center;
}
.oc.is-open { opacity: 1; pointer-events: auto; }
.occ { width: 100%; max-width: 450px; padding: 2rem; position: relative; max-height: 90vh; overflow-y: auto; }

.c-btn-x { 
    position: absolute; top: 20px; right: 20px;
    border: none; background: none; font-size: 1.5rem; cursor: pointer; z-index: 10;
}

.custom-select { 
    position: relative; width: 100%; height: 50px; 
    background: #fff; border: 1px solid #ddd; border-radius: 12px; margin-bottom: 10px;
}
.custom-select select {
    width: 100%; height: 100%; padding: 0 15px; background: transparent;
    border: none; outline: none; font-size: 1rem; font-weight: 600; appearance: none;
    font-family: 'Courier New', Courier, monospace;
}
.custom-select .caret { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: #333; pointer-events: none; }

.s-btn { 
    width: 100%; padding: 16px; background: #222; color: #fff; 
    font-weight: 700; text-transform: uppercase; border: none; border-radius: 12px; cursor: pointer;
}

.drawer-list { margin-top: 1rem; }
.vi { 
    padding: 12px 0; border-bottom: 1px solid #f9f9f9; cursor: pointer; 
    font-size: 0.95rem; transition: 0.2s;
}
.vi:active { background: #f5f5f5; }
.drawer-user-name { font-weight: 700; font-size: 1.1rem; margin-top: 10px; color: var(--primary); }

/* ==========================================
   6. UNIFIED PLAYER OVERLAY
   ========================================== */
#pv { 
    position: fixed; inset: 0; background: #fff; z-index: 7000; 
    transform: translateY(100%); transition: transform .45s cubic-bezier(.2,.8,.2,1); 
    display: flex; flex-direction: column; 
}
#pv.is-open { transform: translateY(0); }

.p-head { padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.ib { border: none; background: none; font-size: 1.4rem; color: #333; cursor: pointer; padding: 10px; }

/* Mode-Bible (Verse List) */
.vl { flex: 1; overflow-y: auto; padding: 2rem 1.5rem 180px; font-family: 'Courier New', Courier, monospace; }
.vi b { font-size: 0.75rem; vertical-align: super; margin-right: 8px; color: var(--muted); }
.vi.is-active { color: #000; font-weight: 700; border-left: 3px solid var(--accent); padding-left: 10px; }

/* Mode-Book (Artwork Stage) */
#bookStage { flex: 1; display: none; align-items: center; justify-content: center; padding-bottom: 80px; }
.book-cover-large { 
    width: 250px; height: 250px; object-fit: cover; 
    border-radius: 24px; box-shadow: 0 30px 60px rgba(0,0,0,0.15); 
}

/* Visibility Toggles based on Mode */
#pv.mode-bible .vl { display: block; }
#pv.mode-bible #bookStage { display: none; }
#pv.mode-book .vl { display: none; }
#pv.mode-book #bookStage { display: flex; }

/* Player Footer */
.p-foot { position: absolute; bottom: 0; width: 100%; background: #fff; box-shadow: 0 -10px 40px rgba(0,0,0,0.05); }
.sc-wrap { position: relative; height: 4px; background: #eee; width: 100%; }
.sc-prog { height: 100%; background: var(--accent); width: 0%; }
.sc-inp { position: absolute; top: -15px; left: 0; width: 100%; height: 35px; opacity: 0; cursor: pointer; }

.ctrl-row { display: flex; padding: 1rem 1.5rem 2.5rem; align-items: center; }
.foot-left { width: 80px; position: relative; }
.footer-art { 
    width: 70px; height: 70px; border-radius: 12px; object-fit: cover; 
    position: absolute; top: -45px; border: 3px solid #fff; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); background:#eee; 
}
.foot-name { font-size: 0.55rem; font-weight: 800; margin-top: 35px; text-transform: uppercase; color: var(--muted); text-align: center;}

.foot-right { flex: 1; padding-left: 15px; }
.track-ref { font-size: 0.85rem; font-weight: 800; text-align: center; margin-bottom: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
.btn-deck { display: flex; justify-content: space-between; align-items: center; }
.c-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #444; }
.play-btn { font-size: 2rem; color: #000; }

/* ==========================================
   7. MINI PLAYER (STICKY)
   ========================================== */
#mp { 
    position: fixed; bottom: 0; width: 100%; height: 75px; 
    background: rgba(255,255,255,0.92); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid var(--border); display: flex; align-items: center; 
    padding: 0 1rem; z-index: 5000; 
    transform: translateY(100%); transition: .3s ease-out; 
}
#mp.is-visible { transform: translateY(0); }
.ma { width: 45px; height: 45px; border-radius: 8px; margin-right: 12px; object-fit: cover; background: #eee; }

/* ==========================================
   8. DEVOTIONAL READER
   ========================================== */
.reader-container { 
    max-width: 600px !important; background: #fdfbf7 !important; 
    height: 100dvh; /* dvh for mobile fix */
    display: block !important; padding: 4rem 2rem !important; 
}
.reader-header { text-align: center; margin-bottom: 2.5rem; }
.reader-date { font-size: 0.75rem; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
.reader-title { font-size: 1.7rem; font-weight: 800; margin: 12px 0; color: var(--primary); font-family: sans-serif; }
.reader-sep { width: 40px; height: 3px; background: var(--accent); margin: 0 auto; }

.reader-body { 
    font-family: 'Georgia', serif; font-size: 1.15rem; line-height: 1.85; 
    color: #333; padding-bottom: 120px; 
}

/* Scripture Link Interaction */
.scrip-link {
    display: inline-flex; align-items: center; color: var(--accent); 
    font-weight: 700; cursor: pointer; background: #fdf2f2; 
    padding: 2px 8px; border-radius: 6px; margin: 0 2px;
    font-family: 'Courier New', monospace; font-size: 0.85rem;
}
.scrip-link i { margin-left: 6px; font-size: 0.7rem; opacity: 0.7; }
.scrip-link:active { background: #f9e1e1; transform: scale(0.98); }