/* WORKING VERSION - See /future folder for planned features */
/* DO NOT modify this file directly - see INTEGRATION-GUIDE.md for safe development */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* Screen reader only class for SEO and accessibility */
.sr-only {
    position: absolute !important;
    left: -10000px !important;
    top: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(1px, 1px, 1px, 1px) !important;
    white-space: nowrap !important;
    font-size: 0 !important;
    line-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    display: block !important;
}

/* Font imports moved to HTML for async loading */

:root {
    --bg-primary: #080808;
    --bg-secondary: #080808;
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --accent: #f6ad55;
    --border: #374151;
    
    /* Dynamic viewport heights for Safari mobile */
    --vh: 1vh;
    --real-vh: 1vh;
    --app-height: 100vh;
    
    /* Safe area insets for notched devices */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
}

body, html {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    /* Handle safe areas */
    padding-left: var(--safe-area-left);
    padding-right: var(--safe-area-right);
}

/* iOS Safari specific optimizations for full-screen experience */
@supports (-webkit-touch-callout: none) {
    body, html {
        /* Use dynamic viewport height when available */
        height: 100vh;
        height: calc(var(--real-vh, 1vh) * 100);
        height: var(--app-height);
    }
    
    body {
        /* Prevent bounce scrolling and enable smooth scrolling */
        overscroll-behavior-y: none;
        -webkit-overflow-scrolling: touch;
        /* Full viewport on iOS with safe area support */
        min-height: 100vh;
        min-height: calc(var(--real-vh, 1vh) * 100);
        padding-top: var(--safe-area-top);
        padding-bottom: var(--safe-area-bottom);
    }
    
    /* Ensure app container uses full available height */
    .app-container {
        min-height: 100vh;
        min-height: calc(var(--real-vh, 1vh) * 100);
        min-height: var(--app-height);
    }
}

/* Modern browsers with dynamic viewport support */
@supports (height: 100dvh) {
    body, html {
        height: 100dvh;
    }
    
    .app-container {
        min-height: 100dvh;
    }
}

/* Hide main page scrollbar for cleaner 2-column experience */
body {
    overflow-y: auto;
}

/* Hide mobile navigation buttons on desktop by default */
.mobile-nav-buttons {
    display: none;
}

/* Custom main scrollbar styling to match commentary */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.3);
    border-radius: 0;
}

body::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 0;
    border: 2px solid transparent;
    background-clip: content-box;
}

body::-webkit-scrollbar-thumb:hover {
    background: #e69643;
    background-clip: content-box;
}

/* Modal Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #080808;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.splash-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.splash-close:hover {
    background: var(--accent);
    color: black;
    transform: scale(1.1);
}

.splash-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.splash-logo-icon {
    width: 50px;
    height: 50px;
    background: transparent;
    border: 1.5px solid var(--accent);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: black;
    font-size: 2rem;
    padding: 4px;
}

.splash-logo-icon img {
    width: 120%;
    height: 120%;
    object-fit: contain;
}

.splash-logo-text {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.splash-tagline {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    text-align: center;
}

.splash-instructions {
    max-width: 500px;
    text-align: left;
    margin-bottom: 3rem;
}

.splash-instructions h3 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.splash-instructions ul {
    list-style: none;
    padding: 0;
}

.splash-instructions li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
    line-height: 1.5;
}

.splash-instructions li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 600;
}

.splash-button {
    padding: 1rem 2.5rem;
    background: var(--accent);
    border: none;
    border-radius: 0;
    color: black;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.splash-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(246, 173, 85, 0.4);
}

/* Professional Navigation Bar */
.navbar {
    position: relative;
    background: #080808;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 1rem 0;
    /* Handle safe area for notched devices */
    padding-top: max(1rem, var(--safe-area-top));
    padding-left: var(--safe-area-left);
    padding-right: var(--safe-area-right);
}

.navbar-content {
    width: 100%;
    margin: 0;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: black;
    font-size: 2rem;
    padding: 5px;
    transition: all 0.3s ease;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
}

.nav-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}


.nav-separator {
    color: var(--border);
    font-weight: 300;
}

.feedback-link {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.feedback-link:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

/* Main Container */
.app-container {
    padding: 2rem 0;
    width: 100%;
    margin: 0;
}

/* Simple Search Bar */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    width: 60%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(246, 173, 85, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-size: 0.9rem;
    min-width: 80px;
}

.search-button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(246, 173, 85, 0.1);
}

/* Panel Controls */
.panel-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

/* Tablet Navigation Buttons (integrated with controls) */
.tablet-nav-button {
    display: none; /* Hidden by default */
    padding: 0.75rem 1.2rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 100px;
}

.tablet-nav-button .nav-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.tablet-nav-button .nav-word {
    font-weight: 400;
    font-size: 0.9rem;
}

.tablet-nav-button .nav-verse {
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 1;
}

.tablet-nav-button:hover {
    background: rgba(246, 173, 85, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

/* Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

button.dropdown-button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none !important;
    outline: none;
    min-height: 48px;
    box-shadow: none !important;
}

button.dropdown-button:hover,
button.dropdown-button:focus,
button.dropdown-button:active,
button.dropdown-button:visited,
button.dropdown-button:link {
    text-decoration: none !important;
    border-bottom: 1px solid var(--accent) !important;
    box-shadow: none !important;
}

/* Override any Strong's word styling that might affect buttons */
button.dropdown-button,
button.dropdown-button * {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-color: transparent !important;
    text-underline-offset: 0 !important;
}

/* Ensure no inherited underline styles */
.panel-controls button,
.panel-controls button *,
#translations-button,
#translations-button * {
    text-decoration: none !important;
    border-bottom-style: solid !important;
}

.dropdown-button:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: black;
}

/* File Explorer Dropdown - Soak Bible Theme */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    min-width: 350px;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    opacity: 0;
    visibility: hidden;
    border-width: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown.open .dropdown-menu {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    border-width: 1px;
}

/* File Tree Folder Categories */
.dropdown-category {
    padding: 1rem 1.25rem;
    margin-top: 0;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    position: relative;
}

.dropdown-category:before {
    content: "+";
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    width: 16px;
    text-align: center;
}

.dropdown-category.expanded:before {
    content: "−";
    color: var(--accent);
}

.dropdown-category:hover {
    background: rgba(246, 173, 85, 0.05);
    color: var(--accent);
}

.dropdown-category:hover:before {
    color: var(--accent);
}

/* File Tree Items */
.dropdown-item {
    padding: 0.75rem 1.25rem 0.75rem 3.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(55, 65, 81, 0.3);
    font-size: 1rem;
    position: relative;
    display: none;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    opacity: 0;
    transform: translateX(-10px);
}

.dropdown-item:before {
    content: "└─";
    position: absolute;
    left: 2.2rem;
    color: var(--border);
    font-size: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
}

.dropdown-item.visible {
    display: block;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.dropdown-item:hover {
    background: rgba(246, 173, 85, 0.08);
    color: var(--accent);
    transform: translateX(2px);
}

.dropdown-item:hover:before {
    color: var(--accent);
}

.dropdown-item.selected {
    background: rgba(246, 173, 85, 0.1);
    color: var(--accent);
    border-left: 2px solid var(--accent);
}

.dropdown-item.selected:before {
    color: var(--accent);
}

/* Chapter Only Badge */
.chapter-only-badge {
    background: #444444;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0;
    margin-left: 0.5rem;
    font-weight: 500;
    text-transform: lowercase;
    opacity: 0.8;
    font-family: Inter, sans-serif;
    display: inline-block;
    vertical-align: middle;
}

/* Content Layout - Desktop Optimized */
.content {
    width: 75%;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}


/* Dynamic Study Layout - Aligned Columns */
.study-layout {
    display: grid;
    gap: 2rem;
    align-items: start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Default: Two columns when commentary is visible */
.study-layout {
    grid-template-columns: 1fr 1fr;
}

/* Single column when commentary is hidden */
.study-layout.single-column {
    grid-template-columns: 1fr;
}

/* Three columns for future expansion */
.study-layout.three-column {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Future 3-column layout (ready for notes column) */
.study-layout.three-column {
    grid-template-columns: 1fr 1fr 1fr;
}

.verses-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-self: stretch;
}

.commentary-column {
    max-width: 100%;
    word-wrap: break-word;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content {
        width: 85%;
        padding: 0 0.5rem;
    }
}

@media (max-width: 900px) {
    .content {
        width: 95%;
        padding: 0 0.5rem;
    }
}

/* Tablet: Two-column layout for better screen usage */
@media (min-width: 768px) and (max-width: 1024px) {
    .study-layout {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .study-layout.three-column {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .commentary-column {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    
    .commentary-text {
        max-height: none;
        overflow-y: visible;
    }
}

/* Mobile only: Single column */
@media (max-width: 767px) {
    .study-layout,
    .study-layout.three-column {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .commentary-column {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
    
    .commentary-text {
        max-height: none;
        overflow-y: visible;
    }
}

/* ===============================================
   PANELS - RESPONSIVE DESIGN
   =============================================== */

/* Desktop/Tablet: Rounded corners with card design */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    position: relative;
    transition: all 0.4s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-height: 500px;
    display: flex;
    flex-direction: column;
    height: auto;
    margin-bottom: 1.5rem;
}

/* Desktop only: Enhanced card appearance with subtle borders */
@media (min-width: 1024px) {
    .panel {
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
        background: #080808;
    }
}

/* Tablet: Optimized for touch with better spacing */
@media (min-width: 768px) and (max-width: 1023px) {
    .panel {
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        padding: 1.25rem 1.5rem;
        min-height: 400px;
    }
    
    /* Tablet-optimized typography */
    .verse-text {
        font-size: 1.4rem !important;
        line-height: 1.8 !important;
        margin-bottom: 1.5rem;
        letter-spacing: 0.003em !important;
        word-spacing: 0.005em !important;
    }
    
    .commentary-text {
        font-size: 1.1rem;
        line-height: 1.7;
    }
    
    .treasury-text {
        font-size: 1rem;
    }
    
    .verse-citation {
        font-size: 1rem;
    }
    
    /* Larger touch targets for tablet */
    .panel-toggle {
        padding: 0.5rem 1rem;
        font-size: 0.95rem;
    }
    
    .strongs-word {
        padding: 0.2em 0.3em;
        margin: 0; /* Remove margins to allow word-spacing to work */
    }
    
    /* Hide floating navigation on tablets - use integrated buttons instead */
    .floating-nav {
        display: none !important;
    }
    
    /* Show tablet navigation buttons integrated with controls */
    .tablet-nav-button {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .floating-nav-button {
        width: auto;
        height: 44px;
        padding: 0 16px;
        font-size: 0.95rem;
        border-radius: 8px;
        background: #080808;
        border: 2px solid var(--accent);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        font-weight: 500;
        min-width: 120px;
    }
    
    .floating-nav-button:hover {
        background: rgba(246, 173, 85, 0.1);
        color: var(--accent);
        border-color: var(--accent);
    }
    
    /* Show text, hide icons on tablet+ */
    .floating-nav-button .nav-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        line-height: 1.1;
    }
    
    .floating-nav-button .nav-word {
        font-weight: 400;
        font-size: 0.9rem;
    }
    
    .floating-nav-button .nav-verse {
        font-weight: 400;
        font-size: 0.9rem;
        opacity: 1;
    }
    
    .floating-nav-button .nav-icon {
        display: none;
    }
    
    .floating-nav.left {
        left: 2rem;
    }

    .floating-nav.right {
        right: calc(2rem + 8px);
    }
    
    /* Hide mobile nav buttons on tablet */
    .mobile-nav-buttons {
        display: none;
    }
    
    /* Tablet-optimized controls */
    .search-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .search-input {
        font-size: 1.1rem;
        padding: 0.8rem 1rem;
    }
    
    .dropdown-button {
        padding: 0.7rem 1.2rem;
        font-size: 1rem;
    }
    
    .dropdown-item {
        padding: 0.7rem 1rem;
        font-size: 1rem;
    }
    
    /* Better panel spacing for tablet */
    .verses-column {
        gap: 1.5rem;
    }
    
    .commentary-column .panel {
        margin-bottom: 1.5rem;
    }
    
    /* Touch target optimizations */
    .cross-ref-link {
        padding: 0.3em 0.4em;
        margin: 0.1em;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .feedback-link {
        padding: 0.5rem;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Tablet navbar adjustments */
    .navbar {
        padding: 0.8rem 0;
    }
    
    .logo-icon {
        width: 45px;
        height: 45px;
    }
    
    .logo-text {
        font-size: 1.7rem;
    }
    
    .nav-status {
        font-size: 0.9rem;
    }
}

/* Mobile adjustments with safe area support - Dynamic sizing */
@media (max-width: 767px) {
    .panel {
        padding: 0.5rem 0.5rem;
        margin: 0 0 0.25rem 0;
        min-height: auto;
        height: auto;
        /* Ensure content doesn't get cut off by safe areas */
        padding-left: max(0.5rem, var(--safe-area-left));
        padding-right: max(0.5rem, var(--safe-area-right));
    }
    
    /* Give Bible verse text absolute maximum width */
    .verse-text,
    .commentary-text,
    .treasury-text {
        width: 100%;
        max-width: none;
        padding: 0;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Panel header also uses full width */
    .panel-header {
        margin-left: 0;
        margin-right: 0;
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
}

/* Commentary Panel in Right Column - Scrollable Container */
.commentary-column .panel {
    height: auto;
    min-height: 500px;
    overflow-y: visible;
    padding-right: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Mobile: Commentary panels dynamic height */
@media (max-width: 767px) {
    .commentary-column .panel {
        min-height: auto;
        margin-bottom: 0.25rem;
    }
    
    /* Categories have consistent spacing - no extra margins */
}

/* Only limit height on commentary, not treasury */
.commentary-column #commentary-panel {
    max-height: calc(100vh - 12rem);
    overflow-y: auto;
}

/* Treasury panel should show all content */
.commentary-column #treasury-panel {
    max-height: none;
    overflow-y: visible;
}

/* Apply scrollbar styling to the panel instead of commentary-text */
.commentary-column .panel::-webkit-scrollbar {
    width: 8px;
}

.commentary-column .panel::-webkit-scrollbar-track {
    background: rgba(55, 65, 81, 0.3);
    border-radius: 0;
}

.commentary-column .panel::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 0;
    border: 2px solid transparent;
    background-clip: content-box;
}

.commentary-column .panel::-webkit-scrollbar-thumb:hover {
    background: #e69643;
    background-clip: content-box;
}

/* Firefox scrollbar styling for panel */
.commentary-column .panel {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) rgba(55, 65, 81, 0.3);
}

.commentary-text {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
}

/* Old commentary-text scrollbar styling removed - now handled by panel */

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.panel-toggle {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.panel-toggle:hover,
.panel-toggle.active {
    background: rgba(246, 173, 85, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

/* Balanced Academic Typography - Optimized for Bible Study */
.verse-text {
    font-size: clamp(1.4rem, 3.2vw, 1.9rem);
    font-weight: 300;
    line-height: 1.8;
    text-align: left;
    margin-bottom: 3rem;
    width: 100%;
    letter-spacing: 0.01em;
    word-spacing: 0.03em;
    text-rendering: optimizeLegibility;
    -webkit-font-feature-settings: "liga", "kern";
    font-feature-settings: "liga", "kern";
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex-grow: 1;
}

/* Verse Numbers - Professional Academic Styling */
.verse-number {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--accent);
    background: rgba(246, 173, 85, 0.1);
    padding: 0.2em 0.5em;
    border-radius: 0;
    margin-right: 0.75em;
    vertical-align: top;
    line-height: 1.2;
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
    border: 1px solid rgba(246, 173, 85, 0.2);
    font-variant-numeric: lining-nums;
}

.verse-citation {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Academic Strong's Words - Clear Indication */
.strongs-word {
    position: relative;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0.05em 0.2em;
    border-radius: 0;
    font-weight: 300;
    text-decoration: underline;
    text-decoration-color: rgba(246, 173, 85, 0.6);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    text-decoration-style: dashed;
}

.strongs-word:hover {
    color: var(--accent);
    background: rgba(246, 173, 85, 0.12);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    text-decoration-style: dashed;
    transform: translateY(-1px);
    text-shadow: 0 1px 3px rgba(246, 173, 85, 0.3);
    font-weight: 300;
}

.strongs-word:active {
    transform: translateY(0);
    background: rgba(246, 173, 85, 0.2);
}

/* ===============================================
   TOOLTIPS - RESPONSIVE DESIGN
   =============================================== */

/* Desktop (1024px+): Full size tooltips */
@media (min-width: 1024px) {
    .tooltip {
        position: fixed;
        background: var(--bg-secondary);
        border: 1.5px solid var(--accent);
        border-radius: 12px;
        padding: 2rem;
        color: var(--text-primary);
        font-size: 1rem;
        line-height: 1.65;
        z-index: 1000;
        backdrop-filter: blur(25px);
        box-shadow: 0 35px 100px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(246, 173, 85, 0.1);
        max-width: min(90vw, 480px);
        min-width: 320px;
        font-weight: 400;
        letter-spacing: 0.01em;
    }
}

/* Tablet (768px-1023px): Sized for tablet screens with Go button */
@media (min-width: 768px) and (max-width: 1023px) {
    .tooltip {
        position: fixed;
        background: var(--bg-secondary);
        border: 1.5px solid var(--accent);
        border-radius: 12px;
        padding: 0;
        color: var(--text-primary);
        font-size: 0.95rem;
        line-height: 1.6;
        z-index: 1000;
        backdrop-filter: blur(20px);
        box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5);
        max-width: min(80vw, 420px);
        min-width: 280px;
        font-weight: 400;
        letter-spacing: 0.01em;
        display: flex;
        flex-direction: column;
    }
    
    .tooltip-content {
        padding: 1.5rem;
        flex: 1;
    }
    
    .tooltip-actions {
        padding: 0.75rem 1.5rem;
        border-top: 1px solid var(--border);
        display: flex;
        justify-content: flex-end;
        background: #080808;
    }
    
    .tooltip-go-button {
        padding: 0.4rem 0.8rem;
        background: transparent;
        border: 1px solid var(--accent);
        border-radius: 6px;
        color: var(--text-primary);
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .tooltip-go-button:hover {
        background: rgba(246, 173, 85, 0.1);
        color: var(--accent);
        border-color: var(--accent);
    }
    
    .tooltip-go-button:active {
        transform: scale(0.95);
        background: rgba(246, 173, 85, 0.2);
    }
}

/* Mobile (Under 768px): Hide ALL tooltips - using popup instead */
@media (max-width: 767px) {
    .tooltip,
    .cross-ref-tooltip {
        display: none !important;
    }
    
    /* Flat design for mobile - dynamic sizing, minimal borders */
    .panel {
        border-radius: 0 !important;
        border: none !important;
        border-bottom: none !important;
        box-shadow: none !important;
        margin-bottom: 1rem !important;
        min-height: auto !important;
        height: auto !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* Hide floating navigation on mobile only */
    .floating-nav {
        display: none !important;
    }
    
    /* Show inline mobile navigation buttons - larger and more prominent */
    .mobile-nav-buttons {
        display: flex !important;
        justify-content: space-between;
        gap: 1.2rem;
        margin-top: 1.5rem;
        padding-top: 0;
        border-top: none;
    }
    
    .mobile-nav-btn {
        flex: 1;
        padding: 0.6rem 1rem;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: 10px;
        color: var(--text-primary);
        font-size: 0.9rem;
        font-weight: 400;
        cursor: pointer;
        transition: all 0.2s ease;
        font-family: inherit;
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-nav-btn:active {
        background: rgba(246, 173, 85, 0.1);
        border-color: var(--accent);
        color: var(--accent);
    }
    
    .mobile-nav-btn:disabled {
        opacity: 0.3;
        cursor: not-allowed;
        transform: none;
        background: transparent;
        border-color: var(--border);
    }
}
    
    /* Disable hover effects on Strong's words on mobile */
    .strongs-word:hover {
        background: transparent;
        transform: none;
    }
    
    /* Visual feedback for tapped cross-ref links */
    .cross-ref-link:active {
        background: rgba(246, 173, 85, 0.2);
        transform: scale(0.95);
    }
}

.tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--accent);
}

.tooltip.tooltip-above::before {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid var(--accent);
}

.tooltip .hebrew-text {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--accent);
    text-shadow: 0 1px 2px rgba(246, 173, 85, 0.2);
    letter-spacing: 0.02em;
}

.tooltip .transliteration {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 450;
    letter-spacing: 0.01em;
}

.tooltip .definition {
    margin-bottom: 1rem;
    font-weight: 450;
    line-height: 1.7;
    color: var(--text-primary);
}

.tooltip .kjv-usage {
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: 1rem;
    line-height: 1.6;
    font-style: italic;
}

/* ===============================================
   FLOATING NAVIGATION - RESPONSIVE DESIGN
   =============================================== */

/* Base Floating Navigation */
.floating-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 500;
}

/* Desktop (1024px+): Full size, fully visible */
@media (min-width: 1024px) {
    .floating-nav.left {
        left: 2rem;
    }

    .floating-nav.right {
        right: calc(2rem + 8px);
    }

    .floating-nav-button {
        width: auto;
        height: 48px;
        padding: 0 20px;
        border-radius: 8px;
        background: #080808;
        border: 1px solid var(--border);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        cursor: pointer;
        transition: all 0.4s ease;
        font-size: 1rem;
        font-family: inherit;
        font-weight: 500;
        backdrop-filter: blur(20px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        min-width: 140px;
    }
    
    /* Show text, hide icons on desktop */
    .floating-nav-button .nav-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        line-height: 1.1;
    }
    
    .floating-nav-button .nav-word {
        font-weight: 400;
        font-size: 1rem;
    }
    
    .floating-nav-button .nav-verse {
        font-weight: 400;
        font-size: 1rem;
        opacity: 1;
    }
    
    .floating-nav-button .nav-icon {
        display: none;
    }

    /* Rectangular buttons don't need padding adjustments */

    .floating-nav-button:hover {
        background: rgba(246, 173, 85, 0.1);
        color: var(--accent);
        border-color: var(--accent);
    }
    
    /* Mobile nav buttons hidden on desktop */
    .mobile-nav-buttons {
        display: none !important;
    }
}

/* Tablet (768px-1023px): Medium size, fully visible */
@media (min-width: 768px) and (max-width: 1023px) {
    .floating-nav.left {
        left: 10px;
    }

    .floating-nav.right {
        right: 10px;
    }

    .floating-nav-button {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background: #080808;
        border: 1px solid var(--border);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.4s ease;
        font-size: 1.4rem;
        font-family: inherit;
        backdrop-filter: blur(20px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    }

    .floating-nav-button:active {
        background: var(--accent);
        border-color: var(--accent);
        color: black;
        transform: scale(0.95);
    }
}

/* Mobile (Under 768px): Smaller, fully visible with safe area support */
@media (max-width: 767px) {
    .floating-nav.left {
        left: max(10px, var(--safe-area-left));
    }

    .floating-nav.right {
        right: max(10px, var(--safe-area-right));
    }

    .floating-nav-button {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #080808;
        border: 2px solid var(--accent);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1.3rem;
        font-family: inherit;
        backdrop-filter: blur(15px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    }
    
    /* Mobile: Show icons, hide text */
    .floating-nav-button .nav-text {
        display: none;
    }
    
    .floating-nav-button .nav-icon {
        display: inline;
    }

    .floating-nav-button:active {
        background: var(--accent);
        border-color: var(--accent);
        color: black;
        transform: scale(0.9);
    }
}

/* Common disabled state for all breakpoints */
.floating-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Academic Commentary Text */
.commentary-text {
    font-size: 1.15rem;
    line-height: 1.75;
    text-align: left;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    color: var(--text-primary);
    flex-grow: 1;
}

.commentary-text p {
    margin-bottom: 1.5em;
    text-indent: 1.5em;
}

.commentary-text p:first-child {
    text-indent: 0;
}

.commentary-text i {
    font-style: italic;
    color: var(--accent);
    font-weight: 450;
}

.commentary-text strong,
.commentary-text b {
    font-weight: 600;
    color: var(--text-primary);
}

.commentary-text em {
    font-style: italic;
    color: var(--accent);
    text-shadow: 0 1px 1px rgba(246, 173, 85, 0.1);
}

/* Treasury of Scripture Knowledge Styling */
.treasury-text {
    font-size: 1rem;
    line-height: 1.7;
    text-align: left;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    color: var(--text-primary);
    flex-grow: 1;
}

.cross-ref-section {
    margin-bottom: 1.5rem;
    padding: 0;
}

.cross-ref-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    opacity: 0.9;
}

.cross-ref-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}

.cross-ref-link {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
}

.cross-ref-link:hover {
    background: rgba(246, 173, 85, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.cross-ref-votes {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.3rem;
    opacity: 0.7;
}

/* Academic Reading Enhancements */
.verse-text:focus-within {
    outline: 2px solid rgba(246, 173, 85, 0.3);
    outline-offset: 4px;
    border-radius: 0;
}

.verse-text::selection {
    background: rgba(246, 173, 85, 0.2);
    text-shadow: none;
}

.commentary-text::selection {
    background: rgba(246, 173, 85, 0.15);
}

/* Academic Panel Enhancements */
.panel-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    font-variant: small-caps;
}

/* Premium Focus States */
.strongs-word:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    background: rgba(246, 173, 85, 0.15);
    border-radius: 0;
}

/* Academic Spacing and Rhythm - Uniform Panels */
/* Panel styles moved to main panel definition above */

/* Ensure consistent panel header alignment */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    min-height: auto;
    flex-shrink: 0;
}

/* Hidden panels */
.hidden {
    display: none;
}

/* Loading state */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    text-align: center;
    gap: 1rem;
}

.loading small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer Section */
.site-footer {
    margin-top: 4rem;
    padding: 3rem 2rem 2rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1000px;
    margin: 0 auto;
    align-items: start;
}

.footer-left {
    text-align: left;
}

.footer-right {
    text-align: right;
}

.newsletter-signup h3,
.footer-links h3 {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.newsletter-signup p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.footer-links p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 0.8;
}

.credits {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.signup-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.signup-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.signup-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(246, 173, 85, 0.1);
}

.signup-form button {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    min-width: 140px;
}

.signup-form button:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(246, 173, 85, 0.1);
}

.signup-message {
    font-size: 0.95rem;
    padding: 1rem 1.5rem;
    border-radius: 0;
    opacity: 0;
    transition: all 0.3s ease;
    text-align: center;
    margin-top: 1rem;
}

.signup-message.success {
    background: rgba(246, 173, 85, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    opacity: 1;
    transform: translateY(0);
}

.signup-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
    opacity: 1;
    transform: translateY(0);
}

/* Add a subtle glow effect for success */
.signup-message.success {
    box-shadow: 0 4px 15px rgba(246, 173, 85, 0.2);
}

/* Nice fade-in animation */
.signup-message {
    transform: translateY(-10px);
}

@media (max-width: 767px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-left,
    .footer-right {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .signup-form {
        flex-direction: column;
    }

    .site-footer {
        padding: 2rem 1rem;
    }
}

/* Responsive Academic Typography - Desktop only */
@media (min-width: 1024px) and (max-width: 1200px) {
    .verse-text {
        font-size: clamp(1.35rem, 3.5vw, 1.8rem);
        line-height: 1.75;
        word-spacing: 0.005em; /* Match mobile/tablet spacing */
    }
    
    .commentary-text {
        font-size: 1.1rem;
        line-height: 1.7;
    }
    
    .tooltip {
        max-width: min(85vw, 420px);
        padding: 1.75rem;
    }
}

/* ===============================================
   MOBILE-SPECIFIC POPUP SYSTEM
   =============================================== */

/* Mobile TSK Preview Popup - Lower Half with Safari UI handling */
/* Hide mobile popup elements on desktop/tablet */
.tsk-preview-popup,
.tsk-popup-backdrop {
    display: none;
}

@media (max-width: 767px) {
    .tsk-preview-popup {
        display: block !important;
        position: fixed;
        bottom: -100%;
        left: 0;
        right: 0;
        height: 50vh !important;
        height: 50dvh !important; /* Fixed 50% height */
        background: var(--bg-secondary);
        border-top: 2px solid var(--accent);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
        z-index: 900;
        padding: 1.5rem 1rem;
        transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto; /* Allow scroll within fixed height */
    }
}
    
    .tsk-preview-popup.active {
        bottom: 0;
    }
    
    .tsk-preview-popup .popup-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    
    .tsk-preview-popup .popup-title {
        font-size: 1.3rem;
        font-weight: 600;
        color: var(--accent);
        line-height: 1.4;
    }
    
    .tsk-preview-popup .popup-close {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--border);
        border: none;
        color: var(--text-primary);
        font-size: 1.4rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .tsk-preview-popup .popup-close:active {
        background: var(--accent);
        color: black;
        transform: scale(0.9);
    }
    
    .tsk-preview-popup .popup-content {
        font-size: 1.2rem;
        line-height: 1.7;
        color: var(--text-primary);
        margin-bottom: 1.5rem;
    }
    
    .tsk-preview-popup .popup-navigate {
        padding: 1rem 1.5rem;
        background: var(--accent);
        border: none;
        border-radius: 12px;
        color: black;
        font-weight: 600;
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s ease;
        width: 100%;
        min-height: 48px;
    }
    
    .tsk-preview-popup .popup-navigate:active {
        transform: scale(0.96);
        background: #e69643;
    }
    
    /* Backdrop overlay */
    .tsk-popup-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(8, 8, 8, 0.8);
        z-index: 899;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .tsk-popup-backdrop.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Double-tap indicator */
    .cross-ref-link.tapped {
        background: rgba(246, 173, 85, 0.2);
        border-color: var(--accent);
        transform: scale(0.95);
    }
}

@media (max-width: 1023px) {
    .app-container {
        padding: 1rem 0;
    }

    .navbar-content {
        padding: 0 1rem;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }

    .logo-icon {
        width: 45px;
        height: 45px;
        padding: 4px;
    }
    
    .logo-text {
        font-size: 1.6rem;
    }

    .nav-status {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
        font-size: 0.75rem;
    }

    .nav-separator {
        display: none;
    }
    

    /* Mobile Typography Optimization - Much larger for excellent readability */
    .verse-text {
        font-size: clamp(1.8rem, 5.5vw, 2.4rem) !important;
        line-height: 1.9 !important;
        margin-bottom: 3rem !important;
        letter-spacing: 0.003em !important; /* Reduced from 0.008em */
        word-spacing: 0.005em !important; /* Reduced from 0.02em - Strong's gaps too wide */
        font-weight: 300 !important;
    }
    
    .verse-number {
        font-size: 0.7em;
        padding: 0.3em 0.6em;
        margin-right: 0.8em;
        border-radius: 6px;
    }
    
    .verse-citation {
        font-size: 1.1rem;
        margin-bottom: 0;
        text-align: left;
        font-weight: 600;
        color: var(--accent);
    }
    
    .commentary-text {
        font-size: 1.3rem;
        line-height: 1.8;
        text-indent: 1.2em;
    }
    
    .treasury-text {
        font-size: 1.2rem;
        line-height: 1.75;
    }
    
    /* Make cross-references more mobile friendly */
    .cross-ref-link {
        font-size: 1rem;
        padding: 0.5rem 0.8rem;
        margin: 0.3rem 0.3rem 0.3rem 0;
        border-radius: 8px;
        min-height: 44px; /* iOS touch target minimum */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .tooltip {
        max-width: min(95vw, 340px);
        min-width: 280px;
        padding: 1.5rem;
        font-size: 0.95rem;
    }
    
    .tooltip .hebrew-text {
        font-size: 1.4rem;
    }
    
    .tooltip .transliteration {
        font-size: 1.1rem;
    }

    .floating-nav.left {
        left: -25px;
    }

    .floating-nav.right {
        right: -25px;
    }

    .floating-nav-button {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .search-container {
        width: 90%;
        max-width: none;
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.8rem;
        /* Ensure input doesn't get cut off by safe areas */
        margin-left: var(--safe-area-left);
        margin-right: var(--safe-area-right);
    }

    .search-button {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
        min-width: auto;
    }

    /* Better mobile panel controls */
    .panel-controls {
        width: 90%;
        margin: 0 auto 1rem auto;
    }

    .dropdown-button {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        text-align: center;
    }

    /* Mobile-friendly Strong's words */
    .strongs-word {
        padding: 0.1rem 0.2rem;
        margin: 0; /* Remove margins to allow word-spacing to work */
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Better mobile Treasury links */
    .cross-ref-link {
        padding: 0.25rem 0.5rem;
        margin: 0.1rem;
        border-radius: 12px;
        background: rgba(246, 173, 85, 0.1);
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Mobile panel headers - compact with single line below */
    .panel-header {
        padding: 0.5rem 0;
        margin-bottom: 0.75rem;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .panel-toggle {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .splash-logo-text {
        font-size: 2rem;
    }

    .splash-instructions {
        padding: 0 1rem;
    }
}

/* Additional mobile optimization for very small screens */
@media (max-width: 480px) {
    .search-container {
        width: 95%;
        padding: 0 0.5rem;
    }

    .panel {
        margin: 0;
        padding: 0.5rem;
    }

    /* Removed - conflicts with mobile optimization above */

    .commentary-text {
        padding: 1rem;
        font-size: 1rem;
    }

    /* Keep search elements horizontal even on very small screens */
    .search-container {
        flex-direction: row;
        gap: 0.5rem;
    }

    /* Better floating nav for small screens */
    .floating-nav-button {
        width: 54px;
        height: 54px;
        font-size: 1.4rem;
    }

    /* Treasury section headers more readable on mobile */
    .treasury-section {
        margin-bottom: 1rem;
    }

    .treasury-section h3 {
        font-size: 1.1rem;
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
        border-bottom: none;
    }

    /* Better dropdown menu on mobile */
    .dropdown-menu {
        max-height: 60vh;
        overflow-y: auto;
    }

    .dropdown-item {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    /* Categories have consistent spacing - no extra margins */

    /* Cross-references Progressive Disclosure */
    .cross-ref-section.collapsed .cross-ref-link:nth-child(n+6) {
        display: none;
    }
    
    .show-more-refs-btn {
        background: var(--accent);
        color: #000;
        padding: 0.6rem 1.2rem;
        border: none;
        border-radius: 8px;
        margin: 1rem 0;
        min-height: 44px;
        font-size: 0.9rem;
        cursor: pointer;
    }

    /* Header Simplification */
    .nav-status span:first-child {
        display: none; /* Hide "Deep Study Made Simple" tagline */
    }
    
    .navbar-content {
        justify-content: space-between;
    }

    /* Content Hierarchy Improvements */
    .treasury-text > div:first-child {
        font-size: 0.9rem;
        font-weight: 400;
        opacity: 0.7;
        margin-bottom: 1rem;
    }
    
    .cross-ref-list:first-of-type {
        margin-bottom: 1.5rem;
    }
    
    .cross-ref-list:nth-of-type(2) {
        opacity: 0.8;
    }

    /* Email Signup Visual Enhancement */
    .newsletter-signup {
        background: rgba(246, 173, 85, 0.08);
        border: 1px solid rgba(246, 173, 85, 0.3);
        border-radius: 12px;
        padding: 2rem 1.5rem;
        margin: 3rem 0;
    }
    
    .newsletter-signup h3 {
        color: var(--accent);
        margin-bottom: 1rem;
    }

    /* Improve mobile scrolling performance */
    .commentary-text,
    .treasury-text,
    .verse-text {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent text selection on UI elements for better mobile experience */
    .panel-header,
    .panel-toggle,
    .search-button,
    .dropdown-button,
    .floating-nav-button {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    /* Better tap highlight colors on mobile */
    .search-button,
    .panel-toggle,
    .dropdown-button,
    .strongs-word,
    .cross-ref-link {
        -webkit-tap-highlight-color: rgba(246, 173, 85, 0.2);
    }
}