:root {
    --bg-color: #ffffff;
    --text-color: #2f4f4f;
    --header-bg: #ffffff;
    --border-color: #eeeeee;
    --accent-color: var(--theme-accent, #85C1E9);
    --audio-bg: #ffffff;
    --audio-shadow: rgba(0,0,0,0.2);
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --link-color: #6e92ac;
}
body.theme-dark {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-bg: #1a1a1a;
    --border-color: #444444;
    --accent-color: var(--theme-accent-dark, #3a5f7d);
    --audio-bg: #222222;
    --audio-shadow: rgba(0,0,0,0.5);
    --link-color: #90c4d0;
}
body.theme-sepia {
    --bg-color: #f4ecd8;
    --text-color: #433422;
    --header-bg: #e9e1c9;
    --border-color: #d5cdb4;
    --accent-color: #d1bfae;
    --audio-bg: #f4ecd8;
    --audio-shadow: rgba(67, 52, 34, 0.2);
    --link-color: #7b5e40;
}
body.font-serif {
    --font-family: 'Merriweather', Georgia, serif;
}

html, body {
    margin: 0; padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--bg-color);
}
body {
    font-family: var(--font-family);
    color: var(--text-color);
    display: flex; flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

#content-wrapper { 
    flex: none; width: 100%; box-sizing: border-box; 
    background: var(--header-bg); z-index: 10; border-bottom: 1px solid var(--border-color);
    transition: margin-top 0.3s ease-in-out, background-color 0.3s;
}

.date-carousel {
    display: flex; width: 100%; padding: 0; margin: 0; box-sizing: border-box;
}
.date-item { 
    flex: 1 1 0; width: auto; text-align: center; padding: 10px 5px; 
    border-right: 1px solid var(--border-color); box-sizing: border-box; overflow: hidden;
}
.date-item:last-child { border-right: none; }
.date-item.today { background-color: var(--accent-color); border-right: none; }
.date-header a { font-weight: bold; font-size: 1.1em; display: block; margin-bottom: 5px; color: var(--text-color); text-decoration: none; }
.date-readings a { display: inline; font-size: 0.9em; color: var(--text-color); text-decoration: none; opacity: 0.9; }
.date-readings a:hover, .date-header a:hover { text-decoration: underline; }

#split-container {
    flex: 1; min-height: 0; position: relative; 
    background-color: var(--bg-color);
}
#reading-content, #gateway-content {
    position: absolute; top: 0; bottom: 0; left: 0; right: 0; 
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 20px; padding-bottom: 160px; box-sizing: border-box; font-size: 1em; line-height: 1.6; display: none; 
}
#gateway-content {
    padding: 0; display: none; flex-direction: column; overflow: hidden;
}
#iframe-wrapper {
    flex: 1; position: relative; min-height: 0; width: 100%; background-color: var(--bg-color); z-index: 1;
    display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#reading-frame { flex: 1 1 auto; transform-origin: 0 0; width: 100%; height: 100%; min-height: 100%; border: none; display: block; }
#reading-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-color); opacity: 0.6; font-style: italic; }

.swipe-zone { position: absolute; top: 0; bottom: 0; width: 35px; z-index: 20; background: transparent; }
#swipe-left { left: 0; }
#swipe-right { right: 0; }

.reading-toolbar {
    display: flex; width: 100%; align-items: center; position: relative; padding: 4px 20px; margin-bottom: 10px; margin-top: 10px;
    border-bottom: 1px solid var(--border-color); box-sizing: border-box; font-family: 'Roboto', sans-serif; flex: none;
}
.reading-toolbar button { background: none; border: none; cursor: pointer; color: var(--text-color); padding: 4px; border-radius: 50%; transition: all 0.2s; display: flex; align-items: center; justify-content: center; opacity: 0.7; }
.reading-toolbar button:hover { background-color: var(--border-color); opacity: 1; }
.reading-toolbar button span { font-size: 24px; }
.font-slider-container { display: flex; align-items: center; margin-right: 5px; color: var(--text-color); opacity: 0.7;}
.font-slider { -webkit-appearance: none; width: 100px; height: 4px; background: var(--border-color); border-radius: 2px; outline: none; margin: 0 5px; }
.font-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--link-color); cursor: pointer; }
.font-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--link-color); cursor: pointer; border: none; }
.custom-select-wrapper { position: relative; display: inline-block; }
.custom-select-wrapper::after { content: "\e5c5"; font-family: "Material Icons"; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); pointer-events: none; color: var(--text-color); opacity: 0.7; }
#lang-select { appearance: none; -webkit-appearance: none; background: transparent; border: 1px solid var(--border-color); padding: 6px 30px 6px 12px; border-radius: 20px; font-size: 14px; color: var(--text-color); cursor: pointer; font-family: 'Roboto', sans-serif; outline: none; }
#lang-select:focus { border-color: var(--link-color); }

.reading-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-color); font-family: 'Roboto', sans-serif; }
.nav-btn { display: flex; align-items: center; color: var(--text-color); text-decoration: none; cursor: pointer; font-weight: bold; font-size: 0.9em; padding: 10px 15px; border-radius: 4px; transition: background 0.2s; user-select: none; }
.nav-btn:hover { background-color: var(--border-color); }
.nav-btn.today-btn { opacity: 0.8; }
.nav-btn.today-btn:hover { opacity: 1; }

.audio-fab { position: fixed; bottom: 20px; right: 20px; display: flex; align-items: center; background: var(--audio-bg); border-radius: 30px; box-shadow: 0 4px 12px var(--audio-shadow); padding: 8px 12px; z-index: 1000; transition: transform 0.3s, opacity 0.3s; }
.audio-fab.hidden { transform: translateY(100px); opacity: 0; pointer-events: none; }
.audio-fab button { background: none; border: none; cursor: pointer; color: var(--text-color); display: flex; align-items: center; padding: 4px; }
.audio-fab button:hover { opacity: 0.7; }
.audio-progress-container { width: 120px; height: 6px; background: var(--border-color); margin: 0 10px; border-radius: 3px; cursor: pointer; overflow: hidden; }
#fab-progress-bar { height: 100%; width: 0%; background: var(--link-color); transition: width 0.1s linear; pointer-events: none; }

.esv-text { display:inline; color: var(--text-color); }
.esv-text h2 { font-size: 1.15em; font-weight: bold; margin-bottom: 5px; font-style: italic; }
.esv-text h3 { font-size: 1.1em; font-weight: 300; margin-bottom: 0.75em; margin-top: 1.25em; font-style: italic; }
.esv-text h3.psalm-book { font-family: 'Roboto', sans-serif; font-style: normal; letter-spacing: 0.2em; padding-left: 4em; text-transform: uppercase; }
.esv-text p { margin-bottom: 0; font-size: 108%; line-height: 150%; text-indent: 1.5em; }
.esv-text h2#top { border:none; padding:0; }
.esv-text h2.book-name { font-family: 'Roboto', sans-serif; font-size: 2em; font-style: normal; font-variant: small-caps; font-weight: normal; padding: 1em 0 0.7em 0; border-bottom: 1px solid var(--border-color); margin-left: 0; }
.esv-text p.line { margin: 0; text-indent: -3.5em; padding-left: 5.5em; clear:both; }
.esv-text p.indent { text-indent: -4em; padding-left: 7em; }
.esv-text p.indent-2, .esv-text p.psalm-doxology { text-indent: -5em; padding-left: 9em; }
.esv-text p.declares { text-indent: -2em; padding-left: 11em; }
.esv-text p.extra-space { margin-top: 1em; }
.esv-text p.starts-chapter, .esv-text p.john8, .esv-text p.same-paragraph { text-indent:0; }
span.small-caps, span.divine-name, .esv-text h4.speaker, .esv-text h4.psalm-acrostic-title, .esv-text h4.psalm-title { font-variant: small-caps; }
.esv-text a { color: var(--link-color); text-decoration: none; }
.esv-text a:hover { text-decoration: underline; }
.esv-text span.footnote, .esv-text a.fn, .esv-text a.cf { font-size: 0.7em; vertical-align: top; color: var(--link-color); text-decoration: none; font-weight: normal; opacity: 0.85; }
.esv-text .footnotes p { font-size: 90%; line-height: 120%; text-indent: 0; }
.esv-text small.audio { font-size: 0 !important; display: inline-block; text-decoration: none; cursor: pointer; vertical-align: baseline; position: relative; top: 0px; }
.esv-text small.audio::before { content: "\1F50A"; font-size: 16px; color: var(--link-color); font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
.esv-text .chapter-num, .esv-text b.chapter-num, .esv-text span.chapter-num, .esv-text .verse-num, .esv-text b.verse-num, .esv-text span.verse-num { font-weight: normal !important; font-size: 0.7em !important; vertical-align: super !important; line-height: 0; color: inherit !important; }
.esv-text .chapter-num, .esv-text b.chapter-num, .esv-text span.chapter-num { float: none !important; display: inline !important; margin: 0 !important; padding-right: 4px; }

.batch-expanded-refs { margin-top: 15px; padding: 15px; background: var(--header-bg); border-top: 1px solid var(--border-color); font-size: 0.95em; color: var(--text-color); }
.batch-header-title { color: var(--link-color); font-weight: bold; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 5px; }
.batch-ref-item { margin-bottom: 15px; }
.batch-ref-heading { font-weight: bold; color: var(--text-color); margin-bottom: 5px; font-size: 1.1em; display: flex; align-items: center; line-height: 1.4; }
.batch-ref-heading .audio { display: none !important; }
.batch-source-box { margin-bottom: 20px; padding: 15px; background-color: var(--header-bg); border-left: 4px solid var(--link-color); color: var(--text-color); font-family: 'Roboto', sans-serif; }
.batch-source-ref { font-weight: bold; color: var(--link-color); margin-bottom: 5px; display: block; }

.fade-in { animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: -1000px 0; } 100% { background-position: 1000px 0; } }
.skeleton { animation: shimmer 2s infinite linear; background: linear-gradient(to right, var(--border-color) 4%, var(--bg-color) 25%, var(--border-color) 36%); background-size: 1000px 100%; height: 20px; margin-bottom: 10px; border-radius: 4px; }

.share-tooltip { display: none; position: fixed; z-index: 1000; background-color: transparent; padding: 0; box-shadow: none; border-radius: 0; font-size: 14px; font-family: 'Roboto', sans-serif; align-items: center; justify-content: center; transition: opacity 0.2s; user-select: none; margin-top: 10px; gap: 10px; }
.tooltip-btn { display: flex; align-items: center; padding: 8px 12px; cursor: pointer; background-color: #222; color: #fff; border-radius: 4px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); white-space: nowrap; }
.tooltip-btn:hover { background-color: #000; }
.tooltip-btn span { font-size: 16px; margin-right: 6px; }
.share-tooltip.flash-message-mode { gap: 0; }
.share-tooltip.flash-message-mode .tooltip-btn { background-color: #222; cursor: default; width: 100%; justify-content: center; }
.ref-tooltip-box { flex-direction: column; background-color: var(--header-bg); color: var(--text-color); box-shadow: 0 4px 10px rgba(0,0,0,0.3); text-align: center; align-items: center; gap: 8px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; z-index: 2147483647; }
.ref-content { font-size: 1.1rem; line-height: 1.4; padding: 15px; }
.ref-footer { font-size: 0.9rem; border-top: 1px solid var(--border-color); padding: 8px; background: rgba(0,0,0,0.05); width: 100%; box-sizing: border-box; }

@media (orientation: landscape) {
    #split-container { flex-direction: row; }
    #gateway-content { height: 100%; flex: 3; }
}