:root {
    --font-scale: 1;
    /* Colors for the tabs and menu; church branding will override these */
    --brand: #1976D2;
    --brand-dark: #0d47a1;
    --brand-soft: #e3f2fd;
    --tab-bg: #ffffff;
    --tab-ink: #5a6573;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 40px;
}

/* Header */
.header {
    text-align: center;
    padding: 15px 20px;
    background: white;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo-link {
    display: block;
}

.logo {
    max-width: 100%;
    width: 100%;
    height: auto;
    margin-bottom: 0;
}

.header h1 {
    color: #1976D2;
    font-size: 28px;
    font-weight: 600;
}

/* Toolbar Section */
.toolbar-section {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 8px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.toolbar-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1976D2;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 100px;
    justify-content: center;
}

.toolbar-button:hover {
    background: #e3f2fd;
    border-color: #1976D2;
    transform: translateY(-2px);
}

.toolbar-button:active {
    transform: translateY(0);
}

.toolbar-button svg {
    flex-shrink: 0;
}

/* About Panel */
.about-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.about-panel.open {
    right: 0;
}

.about-panel-content {
    padding: 20px;
}

.about-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.about-panel-header h2 {
    color: #1976D2;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.close-about-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-about-button:hover {
    background: #f5f5f5;
    color: #1976D2;
}

.about-panel-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.version-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.version-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.version-number {
    font-size: 28px;
    font-weight: 700;
    color: white;
}

.about-description {
    font-size: 16px;
    line-height: 1.8;
    color: #555;
    margin: 0;
}

.help-section {
    margin-bottom: 20px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    color: #1976D2;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.help-section p {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin: 0;
}

.tools-button-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-item-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1976D2;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.tool-item-button:hover {
    background: #e3f2fd;
    border-color: #1976D2;
    transform: translateX(4px);
}

.tool-item-button:active {
    transform: translateX(2px);
}

.tool-item-button svg {
    flex-shrink: 0;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}

.backup-button {
    background: #4CAF50;
    color: white;
}

.backup-button:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.restore-button {
    background: #2196F3;
    color: white;
}

.restore-button:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.action-button svg {
    flex-shrink: 0;
}

/* Generate Study Guide Button */
#generateStudyGuideButton {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#generateStudyGuideButton:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

#generateStudyGuideButton:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Generate Devotional Button */
#generateDevotionalButton {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#generateDevotionalButton:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

#generateDevotionalButton:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Search Bible Button */
#searchBibleButton {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#searchBibleButton:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

#searchBibleButton:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#loadBibleChapterButton {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

#loadBibleChapterButton:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

#loadBibleChapterButton:disabled {
    background: linear-gradient(135deg, #9E9E9E 0%, #BDBDBD 100%);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Check for Updates Button */
#checkUpdatesButton {
    background: linear-gradient(135deg, #FF9800 0%, #FFA726 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
}

#checkUpdatesButton:hover {
    background: linear-gradient(135deg, #F57C00 0%, #FF9800 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 152, 0, 0.4);
}

/* Sample Questions Section */
.sample-questions-section {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.sample-questions-toggle {
    width: 100%;
    padding: 18px 20px;
    background: white;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #1976D2;
    transition: background 0.2s;
}

.sample-questions-toggle:hover {
    background: #f5f5f5;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.sample-questions-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.sample-questions-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.sample-questions-content.expanded {
    max-height: 2000px;
}

.questions-grid {
    padding: 0 20px 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.question-category {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 12px;
}

.category-title {
    font-size: 13px;
    font-weight: 700;
    color: #1976D2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0;
    margin: 0 0 10px 0;
    border-bottom: 2px solid #e3f2fd;
}

.sample-question {
    padding: 10px 12px;
    margin: 6px 0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: calc(14px * var(--font-scale));
    line-height: 1.4;
    border: 1px solid transparent;
}

.sample-question:hover,
.sample-question:active {
    background: #e3f2fd;
    color: #1976D2;
    border-color: #1976D2;
    transform: translateX(3px);
}

/* Offline Notice */
.offline-notice {
    background: #ff9800;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Install Button */
.install-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(76, 175, 80, 0.3);
    margin-bottom: 20px;
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.4);
}

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

.install-button svg {
    width: 24px;
    height: 24px;
}

/* Input Section */
.input-section {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

#questionInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: calc(16px * var(--font-scale));
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    margin-bottom: 15px;
}

#questionInput:focus {
    outline: none;
    border-color: #1976D2;
}

#questionInput:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.button-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.clear-button {
    flex: 1;
    padding: 15px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.clear-button:hover {
    background: #616161;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.clear-button:active {
    transform: translateY(0);
}

.submit-button {
    flex: 2;
    padding: 15px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(25, 118, 210, 0.3);
}

.submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(25, 118, 210, 0.4);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Dive Deeper Button */
.dive-deeper-button {
    flex: 2;
    padding: 15px;
    background: linear-gradient(135deg, #7B1FA2 0%, #6A1B9A 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(123, 31, 162, 0.3);
}

.dive-deeper-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(123, 31, 162, 0.4);
}

.dive-deeper-button:active {
    transform: translateY(0);
}

.dive-deeper-button:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Sub-Questions Panel */
.sub-questions-panel {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 20px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.sub-questions-panel.expanded {
    max-height: 800px;
    opacity: 1;
    padding: 20px;
}

.sub-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.sub-questions-header h3 {
    margin: 0;
    color: #7B1FA2;
    font-size: 20px;
}

.close-sub-questions {
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s, transform 0.2s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sub-questions:hover {
    color: #7B1FA2;
    transform: rotate(90deg);
    background: #f5f5f5;
}

.sub-questions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sub-question-item {
    padding: 15px;
    background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border-left: 4px solid #7B1FA2;
}

.sub-question-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(123, 31, 162, 0.2);
    background: linear-gradient(135deg, #e1bee7 0%, #d1c4e9 100%);
}

/* Related questions under an answer (from Dive Deeper) */
.related-questions {
    margin-top: 20px;
}

.related-questions h3 {
    font-size: 16px;
    color: #7B1FA2;
    margin: 0 0 10px;
}

.related-questions[hidden] {
    display: none;
}

.related-questions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-question {
    text-align: left;
    font: inherit;
    font-size: 15px;
    color: inherit;
    padding: 12px 14px;
    background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
    border: none;
    border-left: 4px solid #7B1FA2;
    border-radius: 12px;
    cursor: pointer;
}

.related-question:hover {
    background: linear-gradient(135deg, #e1bee7 0%, #d1c4e9 100%);
}

.related-question.asked {
    opacity: 0.7;
}

.related-question.asked::before {
    content: '✓ ';
    color: #7B1FA2;
    font-weight: 700;
}

.answer-dive-deeper-button {
    display: block;
    margin-top: 16px;
    padding: 10px 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #7B1FA2;
    background: none;
    border: 2px solid #7B1FA2;
    border-radius: 10px;
    cursor: pointer;
}

.answer-dive-deeper-button:hover {
    background: #f3e5f5;
}

.answer-dive-deeper-button[hidden] {
    display: none;
}

.no-sub-questions {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

/* Loading */
.loading {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 16px;
}

/* Answer Section */
.answer-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    outline: none;
}

.answer-section:focus {
    outline: none;
}

.answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.answer-section h2 {
    color: #1976D2;
    font-size: 24px;
    margin-bottom: 0;
    font-weight: 600;
    outline: none;
}

.answer-section h2:focus {
    outline: none;
}

.copy-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(25, 118, 210, 0.3);
    min-width: 40px;
    min-height: 40px;
}

.copy-button:hover {
    background: linear-gradient(135deg, #1565C0 0%, #0d47a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(25, 118, 210, 0.4);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button svg {
    flex-shrink: 0;
}

.answer-content {
    font-size: calc(16px * var(--font-scale));
    line-height: 1.8;
    color: #333;
    margin-bottom: 20px;
}

.answer-content p {
    margin-bottom: 15px;
}

.answer-content h1,
.answer-content h2,
.answer-content h3 {
    color: #1976D2;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.answer-content h1 {
    font-size: calc(24px * var(--font-scale));
}

.answer-content h2 {
    font-size: calc(22px * var(--font-scale));
}

.answer-content h3 {
    font-size: calc(20px * var(--font-scale));
}

.answer-content strong {
    font-weight: 600;
    color: #000;
}

.answer-content em {
    font-style: italic;
}

.answer-content a {
    color: #1976D2;
    text-decoration: none;
    border-bottom: 1px solid #1976D2;
}

.answer-content a:hover {
    color: #1565C0;
    border-bottom-color: #1565C0;
}

.answer-content ul,
.answer-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.answer-content li {
    margin-bottom: 8px;
}

.answer-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #d32f2f;
}

.answer-content pre {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
}

.answer-content pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.answer-content blockquote {
    border-left: 4px solid #1976D2;
    padding-left: 15px;
    margin: 15px 0;
    color: #666;
    font-style: italic;
}

/* Citations Section */
/* "Preached on this" card under Ask answers; colors match the citations toggle and study-guide Ask buttons */
.preached-card {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
}

.preached-card-heading {
    font-size: calc(15px * var(--font-scale));
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.preached-card-badge {
    padding: 3px 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    font-size: calc(13px * var(--font-scale));
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.preached-card-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preached-theme {
    padding: 6px 12px;
    background: #1976D2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preached-theme:hover {
    background: #1565C0;
}

.citations-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e0e0e0;
}

.citations-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    font-weight: 600;
    color: #1976D2;
}

.citations-toggle:hover {
    background: #e3f2fd;
    border-color: #1976D2;
}

.citations-toggle.active {
    background: #e3f2fd;
    border-color: #1976D2;
}

.citations-toggle-text {
    flex-grow: 1;
    text-align: left;
}

.citations-toggle-icon {
    transition: transform 0.3s;
    flex-shrink: 0;
    margin-left: 10px;
}

.citations-toggle.active .citations-toggle-icon {
    transform: rotate(180deg);
}

.citations-count {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin-left: 8px;
}

.citations-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.citations-content.expanded {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.citations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 0;
}

.citation-item {
    padding: 12px 15px;
    background: #f5f5f5;
    border-radius: 10px;
    border-left: 4px solid #1976D2;
    font-size: 14px;
    line-height: 1.6;
}

.citation-author {
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 4px;
}

.citation-title {
    color: #666;
    font-style: italic;
}

.processing-time {
    text-align: right;
    color: #999;
    font-size: 12px;
    margin-top: 15px;
}

/* History Section */
.history-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-section h2 {
    color: #1976D2;
    font-size: 24px;
    font-weight: 600;
}

.clear-history-button {
    padding: 8px 16px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-history-button:hover {
    background: #d32f2f;
}

.see-more-history-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    margin-top: 15px;
    background: linear-gradient(135deg, #1976D2 0%, #2196F3 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}

.see-more-history-button:hover {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.4);
}

.see-more-history-button svg {
    transition: transform 0.2s ease;
}

.see-more-history-button:hover svg {
    transform: translateY(2px);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 15px;
    background: #f5f5f5;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    position: relative;
}

.history-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.history-item-delete {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 59, 48, 0.3);
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    font-size: 20px;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    transform: scale(1.1);
}

.history-item-delete:active {
    transform: scale(0.95);
}

.history-question {
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 8px;
    font-size: calc(15px * var(--font-scale));
}

.history-answer {
    color: #666;
    font-size: calc(14px * var(--font-scale));
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Dive Deeper History Items */
.dive-deeper-item {
    background: linear-gradient(135deg, #f3e5f5 0%, #ede7f6 100%);
    border-left: 4px solid #7B1FA2;
}

.dive-deeper-item:hover {
    background: linear-gradient(135deg, #e1bee7 0%, #d1c4e9 100%);
    cursor: default;
}

.dive-deeper-item .history-question {
    color: #7B1FA2;
}

.history-sub-questions {
    margin-top: 10px;
}

.history-sub-questions-title {
    font-size: 13px;
    font-weight: 600;
    color: #6A1B9A;
    margin-bottom: 8px;
}

.history-sub-question {
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    border-left: 3px solid #9C27B0;
}

.history-sub-question:hover {
    background: #f3e5f5;
    transform: translateX(5px);
}

.history-sub-question:last-child {
    margin-bottom: 0;
}

.history-empty {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 16px;
}

/* Notes Section */
.notes-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.notes-section h2 {
    color: #1976D2;
    font-size: 24px;
    font-weight: 600;
}

.notes-header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toggle-visibility-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-visibility-button:hover {
    background: #616161;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.toggle-visibility-button svg {
    transition: transform 0.2s;
}

.toggle-visibility-button.hidden svg {
    transform: rotate(180deg);
}

.notes-content-wrapper {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    max-height: 10000px;
    opacity: 1;
}

.notes-content-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.toggle-notes-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.toggle-notes-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.4);
}

.toggle-notes-button svg {
    transition: transform 0.2s;
}

.toggle-notes-button.active svg {
    transform: rotate(45deg);
}

/* Notes Form */
.notes-form-container {
    margin-bottom: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
}

#noteTextarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.3s;
    margin-bottom: 12px;
}

#noteTextarea:focus {
    outline: none;
    border-color: #1976D2;
}

.notes-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.word-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.word-count.warning {
    color: #ff9800;
}

.word-count.error {
    color: #f44336;
    font-weight: 600;
}

.notes-form-buttons {
    display: flex;
    gap: 10px;
}

.cancel-note-button {
    padding: 10px 20px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-note-button:hover {
    background: #616161;
}

.save-note-button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}

.save-note-button:hover {
    background: linear-gradient(135deg, #1565C0 0%, #0d47a1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.4);
}

.save-note-button:disabled {
    background: #bdbdbd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Notes Search */
.notes-search-container {
    position: relative;
    margin-bottom: 20px;
}

.notes-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.notes-search-input:focus {
    outline: none;
    border-color: #1976D2;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Notes List */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.note-date {
    font-size: 12px;
    color: #999;
    font-weight: 500;
    white-space: nowrap;
}

.note-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.note-action-button {
    padding: 6px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-action-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.note-action-button.ask-note {
    color: #4CAF50;
}

.note-action-button.ask-note:hover {
    background: #e8f5e9;
}

.note-action-button.copy-note {
    color: #1976D2;
}

.note-action-button.copy-note:hover {
    background: #e3f2fd;
}

.note-action-button.edit-note {
    color: #ff9800;
}

.note-action-button.edit-note:hover {
    background: #fff3e0;
}

.note-action-button.delete-note {
    color: #f44336;
}

.note-action-button.delete-note:hover {
    background: #ffebee;
}

.note-action-button svg {
    width: 18px;
    height: 18px;
}

.note-content {
    color: #333;
    font-size: calc(14px * var(--font-scale));
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.notes-empty {
    text-align: center;
    color: #999;
    padding: 30px;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .header {
        padding: 12px 15px;
    }

    .header h1 {
        font-size: 24px;
    }

    .logo {
        max-width: 100%;
    }

    .questions-grid {
        grid-template-columns: 1fr;
        padding: 0 15px 15px 15px;
    }

    .sample-questions-toggle {
        padding: 15px;
        font-size: 15px;
    }

    .answer-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .add-to-note-button {
        margin-right: 0;
        padding: 8px 12px;
    }

    .copy-button {
        padding: 8px;
        min-width: 36px;
        min-height: 36px;
    }

    .copy-button svg {
        width: 18px;
        height: 18px;
    }

    .answer-section h2,
    .history-section h2 {
        font-size: 20px;
    }

    .citations-toggle {
        padding: 12px 15px;
        font-size: 15px;
    }

    .citations-toggle-icon {
        width: 18px;
        height: 18px;
    }
}

/* PWA Install Prompt */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Study Guide Maker Styles */

/* Recent Prompts Dropdown */
.study-guide-recent-prompts-dropdown {
    margin-bottom: 15px;
}

.recent-prompts-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 8px;
}

.recent-prompts-label svg {
    flex-shrink: 0;
}

.recent-prompts-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231976D2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 45px;
}

.recent-prompts-select:hover {
    border-color: #1976D2;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
}

.recent-prompts-select:focus {
    outline: none;
    border-color: #1976D2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.recent-prompts-select option {
    padding: 10px;
    font-size: 15px;
}

.recent-prompts-select option:first-child {
    color: #757575;
    font-style: italic;
}

.study-guide-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.study-guide-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.study-guide-buttons .action-button,
.study-guide-buttons .clear-button {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 0;
}

.study-guide-buttons .clear-button {
    background: #757575;
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(117, 117, 117, 0.3);
}

.study-guide-buttons .clear-button:hover {
    background: #616161;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(117, 117, 117, 0.4);
}

.study-guide-help-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1976D2 0%, #2196F3 100%);
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 15px 0 0 0;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.3);
}

.study-guide-help-toggle:hover {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
    border-color: transparent;
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.4);
    transform: translateY(-1px);
}

.study-guide-help-toggle.active {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
    border-color: transparent;
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.4);
}

.study-guide-help-toggle .toggle-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.study-guide-help-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.study-guide-help-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.study-guide-help-content.expanded {
    max-height: 1000px;
    transition: max-height 0.5s ease;
}

.study-guide-help-box {
    background: #f9f9f9;
    border-left: 4px solid #1976D2;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0 0 0;
}

.study-guide-help-box h4 {
    color: #1976D2;
    font-size: 15px;
    margin: 15px 0 10px 0;
}

.study-guide-help-box h4:first-child {
    margin-top: 0;
}

.study-guide-help-list {
    margin: 10px 0 10px 20px;
    padding: 0;
    line-height: 1.8;
}

.study-guide-help-list li {
    margin: 8px 0;
    color: #333;
    font-size: 14px;
}

.study-guide-examples {
    margin: 10px 0 10px 20px;
    padding: 0;
    line-height: 1.8;
}

.study-guide-examples li {
    margin: 8px 0;
    color: #555;
    font-size: 14px;
    font-style: italic;
}

.study-guide-tips {
    margin: 10px 0 10px 20px;
    padding: 0;
    line-height: 1.8;
}

.study-guide-tips li {
    margin: 8px 0;
    color: #333;
    font-size: 14px;
}

.study-guide-tips strong {
    color: #1976D2;
}

.study-guide-prompt-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.study-guide-prompt-input:focus {
    outline: none;
    border-color: #1976D2;
}

.study-guide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px 20px;
    background: #f5f5f5;
    border-radius: 10px;
    margin-top: 20px;
}

.study-guide-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e3f2fd;
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.study-guide-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.study-guide-counter {
    margin-top: 10px !important;
    color: #1976D2 !important;
    font-weight: 600 !important;
    font-size: 16px !important;
}

.study-guide-result {
    margin-top: 20px;
}

.study-guide-elapsed-time {
    margin-top: 15px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    text-align: center;
    color: #1976D2;
    font-size: 13px;
    font-weight: 600;
}

.study-guide-lesson {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #1976D2;
}

.study-guide-lesson-title {
    font-size: 18px;
    font-weight: 600;
    color: #1976D2;
    margin-bottom: 10px;
}

.study-guide-lesson-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.study-guide-questions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.study-guide-question-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.study-guide-question-text {
    flex: 1;
    color: #333;
    line-height: 1.5;
}

.study-guide-ask-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #1976D2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.study-guide-ask-button:hover {
    background: #1565C0;
    transform: translateY(-1px);
}

.study-guide-ask-button:active {
    transform: translateY(0);
}

/* Study Guide in History */
.history-item.study-guide-item {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border-left: 4px solid #4caf50;
}

.history-item.study-guide-item .history-question {
    color: #2e7d32;
    font-weight: 600;
}

.study-guide-history-content {
    margin-top: 10px;
}

.study-guide-history-lesson {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.study-guide-history-lesson:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.study-guide-history-lesson-title {
    font-weight: 600;
    color: #2e7d32;
    margin-bottom: 8px;
    font-size: 14px;
}

.study-guide-history-lesson-description {
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.study-guide-history-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 0;
    margin-top: 10px;
}

.study-guide-history-question-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.study-guide-history-question-text {
    flex: 1;
    color: #333;
    font-size: 13px;
    line-height: 1.5;
}

.study-guide-history-ask-button {
    padding: 4px 10px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.study-guide-history-ask-button:hover {
    background: #45a049;
    transform: translateY(-1px);
}

.study-guide-history-ask-button:active {
    transform: translateY(0);
}

/* Study Guide Export Buttons */
.study-guide-export-buttons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    padding-top: 8px;
    flex-wrap: wrap;
}

.study-guide-export-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #1976D2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.study-guide-export-button.copy-clipboard-button {
    background: #4caf50;
}

.study-guide-export-button:hover {
    background: #1565C0;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.study-guide-export-button.copy-clipboard-button:hover {
    background: #45a049;
}

.study-guide-export-button:active {
    transform: translateY(0);
}

.study-guide-export-button svg {
    flex-shrink: 0;
}

/* Bible Browse */
.bible-browse-dropdowns {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    align-items: flex-end;
    min-width: 0;
}

.bible-browse-dropdown-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bible-browse-dropdown-group .recent-prompts-select {
    font-size: 13px;
    padding: 8px 32px 8px 10px;
    background-size: 16px;
    background-position: right 8px center;
    padding-right: 32px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bible-browse-label {
    font-size: 13px;
    font-weight: 600;
    color: #1976D2;
}

.bible-browse-verses {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.bible-browse-verse {
    display: flex;
    gap: 8px;
    line-height: 1.7;
    padding: 4px 0;
    border-bottom: 1px solid #e8e8e8;
    color: #333;
    font-size: 0.97em;
}

.bible-browse-verse:last-child {
    border-bottom: none;
}

.bible-browse-verse-num {
    font-weight: 700;
    color: #1976D2;
    white-space: nowrap;
    min-width: 2.2em;
    flex-shrink: 0;
}

.bible-browse-verse-text {
    flex: 1;
}

/* Bible Search result cards (dark-mode overrides below) */
.bible-search-result {
    margin-bottom: 24px;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bible-search-result-ref {
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.bible-search-result-text {
    margin-bottom: 12px;
    font-style: italic;
    line-height: 1.7;
    color: #333;
    font-size: 1.02em;
}

.bible-search-result-verses {
    margin-bottom: 12px;
}

.bible-browse-summary {
    margin-top: 20px;
    padding: 14px 16px;
    background: #e3f2fd;
    border-radius: 8px;
    border-left: 4px solid #1976D2;
}

.bible-browse-summary-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1565C0;
    margin-bottom: 6px;
}

.bible-browse-summary-text {
    color: #333;
    line-height: 1.65;
    font-size: 0.96em;
}

.bible-translation-note {
    margin-top: 18px;
    font-size: 0.82em;
    color: #888;
    font-style: italic;
    line-height: 1.5;
    border-top: 1px solid #e0e0e0;
    padding-top: 10px;
}

/* ============================================================
   AUTH MODAL CLASSES (moved from inline styles in index.html)
   ============================================================ */
.auth-modal-overlay {
    background: rgba(0, 0, 0, 0.55);
}

.auth-modal-panel {
    background: #fff;
}

.auth-modal-header {
    border-bottom: 1px solid #e0e0e0;
}

.auth-modal-title {
    color: #1565C0;
}

.auth-modal-close {
    color: #666;
}

.auth-modal-body {
    color: #333;
}

/* ============================================================
   SYNC STATUS STATES
   ============================================================ */
#syncStatus {
    background: #f5f5f5;
    color: #444;
}

#syncStatus.status-error {
    background: #ffebee;
    color: #c62828;
}

#syncStatus.status-success {
    background: #e8f5e9;
    color: #2e7d32;
}

#syncStatus.status-warning {
    background: #fff3e0;
    color: #e65100;
}

/* ============================================================
   USER GREETING
   ============================================================ */
.user-greeting {
    color: #555;
}

/* ============================================================
   FONT SIZE BUTTONS
   ============================================================ */
.font-size-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1976D2;
    font-size: 12px;
    font-weight: 700;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.font-size-btn:hover {
    background: #e3f2fd;
    border-color: #1976D2;
}

.font-size-btn:active {
    transform: scale(0.95);
}

.font-size-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   DARK MODE TOGGLE BUTTON
   ============================================================ */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1976D2;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.dark-mode-toggle:hover {
    background: #e3f2fd;
    border-color: #1976D2;
}

/* ============================================================
   DARK THEME  [data-theme="dark"]
   ============================================================ */

/* --- Body & background --- */
[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0e17 100%);
    color: #f0f0fa;
}

/* --- White card surfaces --- */
[data-theme="dark"] .header,
[data-theme="dark"] .toolbar-section,
[data-theme="dark"] .sample-questions-section,
[data-theme="dark"] .input-section,
[data-theme="dark"] .loading,
[data-theme="dark"] .answer-section,
[data-theme="dark"] .sub-questions-panel,
[data-theme="dark"] .history-section,
[data-theme="dark"] .notes-section,
[data-theme="dark"] .about-panel {
    background: #1e1e2e;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

/* --- Toolbar buttons --- */
[data-theme="dark"] .toolbar-button {
    background: #252535;
    color: #64b5f6;
}

[data-theme="dark"] .toolbar-button:hover {
    background: #0a1929;
    border-color: #64b5f6;
}

[data-theme="dark"] .dark-mode-toggle {
    background: #252535;
    color: #64b5f6;
}

[data-theme="dark"] .dark-mode-toggle:hover {
    background: #0a1929;
    border-color: #64b5f6;
}

[data-theme="dark"] .font-size-btn {
    background: #252535;
    color: #64b5f6;
}

[data-theme="dark"] .font-size-btn:hover {
    background: #0a1929;
    border-color: #64b5f6;
}

/* --- About / Help panel --- */
[data-theme="dark"] .about-panel-header {
    border-bottom-color: #3a3a5a;
}

[data-theme="dark"] .about-panel-header h2 {
    color: #64b5f6;
}

[data-theme="dark"] .close-about-button {
    color: #a0a0b0;
}

[data-theme="dark"] .close-about-button:hover {
    background: #252535;
    color: #64b5f6;
}

[data-theme="dark"] .about-description,
[data-theme="dark"] .help-section p {
    color: #d0d0e4;
}

[data-theme="dark"] .help-section h3 {
    color: #64b5f6;
}

[data-theme="dark"] .tool-item-button {
    background: #252535;
    color: #64b5f6;
}

[data-theme="dark"] .tool-item-button:hover {
    background: #0a1929;
    border-color: #64b5f6;
}

/* --- Sample questions --- */
[data-theme="dark"] .sample-questions-toggle {
    background: #1e1e2e;
    color: #64b5f6;
}

[data-theme="dark"] .sample-questions-toggle:hover {
    background: #252535;
}

[data-theme="dark"] .question-category {
    background: #252535;
}

[data-theme="dark"] .category-title {
    color: #64b5f6;
    border-bottom-color: #0a1929;
}

[data-theme="dark"] .sample-question {
    background: #1e1e2e;
    color: #f0f0fa;
}

[data-theme="dark"] .sample-question:hover,
[data-theme="dark"] .sample-question:active {
    background: #0a1929;
    color: #64b5f6;
    border-color: #64b5f6;
}

/* --- Question input --- */
[data-theme="dark"] #questionInput {
    background: #252535;
    border-color: #3a3a5a;
    color: #f0f0fa;
}

[data-theme="dark"] #questionInput:focus {
    border-color: #64b5f6;
}

[data-theme="dark"] #questionInput::placeholder {
    color: #7a7a8a;
}

[data-theme="dark"] #questionInput:disabled {
    background: #1a1a2e;
    color: #7a7a8a;
}

/* --- Spinner / loading --- */
[data-theme="dark"] .spinner {
    border-color: #252535;
    border-top-color: #64b5f6;
}

[data-theme="dark"] .loading p {
    color: #b8b8cc;
}

/* --- Answer section --- */
[data-theme="dark"] .answer-section h2 {
    color: #64b5f6;
}

[data-theme="dark"] .answer-content {
    color: #f0f0fa;
}

[data-theme="dark"] .answer-content h1,
[data-theme="dark"] .answer-content h2,
[data-theme="dark"] .answer-content h3 {
    color: #64b5f6;
}

[data-theme="dark"] .answer-content strong {
    color: #ffffff;
}

[data-theme="dark"] .answer-content a {
    color: #64b5f6;
    border-bottom-color: #64b5f6;
}

[data-theme="dark"] .answer-content a:hover {
    color: #90caf9;
    border-bottom-color: #90caf9;
}

[data-theme="dark"] .answer-content code {
    background: #252535;
    color: #ef9a9a;
}

[data-theme="dark"] .answer-content pre {
    background: #252535;
}

[data-theme="dark"] .answer-content pre code {
    color: #e0e0e8;
}

[data-theme="dark"] .answer-content blockquote {
    border-left-color: #64b5f6;
    color: #a0a0b0;
}

/* --- Citations --- */
[data-theme="dark"] .citations-section {
    border-top-color: #3a3a5a;
}

[data-theme="dark"] .citations-toggle {
    background: #252535;
    border-color: #3a3a5a;
    color: #64b5f6;
}

[data-theme="dark"] .citations-toggle:hover,
[data-theme="dark"] .citations-toggle.active {
    background: #0a1929;
    border-color: #64b5f6;
}

[data-theme="dark"] .citations-count {
    color: #a0a0b0;
}

[data-theme="dark"] .citation-item {
    background: #252535;
    border-left-color: #64b5f6;
}

[data-theme="dark"] .citation-author {
    color: #64b5f6;
}

[data-theme="dark"] .citation-title {
    color: #a0a0b0;
}

[data-theme="dark"] .processing-time {
    color: #7a7a8a;
}

/* --- Sub-questions (Dive Deeper) panel --- */
[data-theme="dark"] .sub-questions-header {
    border-bottom-color: #3a3a5a;
}

[data-theme="dark"] .sub-questions-header h3 {
    color: #ce93d8;
}

[data-theme="dark"] .close-sub-questions {
    color: #a0a0b0;
}

[data-theme="dark"] .close-sub-questions:hover {
    color: #ce93d8;
    background: #252535;
}

[data-theme="dark"] .sub-question-item {
    background: linear-gradient(135deg, #2a1a35 0%, #1e1530 100%);
    border-left-color: #ce93d8;
}

[data-theme="dark"] .sub-question-item:hover {
    background: linear-gradient(135deg, #311a3e 0%, #231838 100%);
    box-shadow: 0 4px 8px rgba(206, 147, 216, 0.2);
}

[data-theme="dark"] .related-questions h3,
[data-theme="dark"] .related-question.asked::before,
[data-theme="dark"] .answer-dive-deeper-button {
    color: #ce93d8;
}

[data-theme="dark"] .related-question {
    background: linear-gradient(135deg, #2a1a35 0%, #1e1530 100%);
    border-left-color: #ce93d8;
}

[data-theme="dark"] .related-question:hover {
    background: linear-gradient(135deg, #311a3e 0%, #231838 100%);
}

[data-theme="dark"] .answer-dive-deeper-button {
    border-color: #ce93d8;
}

[data-theme="dark"] .answer-dive-deeper-button:hover {
    background: #2a1a35;
}

[data-theme="dark"] .no-sub-questions {
    color: #7a7a8a;
}

/* --- History section --- */
[data-theme="dark"] .history-section h2 {
    color: #64b5f6;
}

[data-theme="dark"] .history-item {
    background: #252535;
}

[data-theme="dark"] .history-item:hover {
    background: #0a1929;
}

[data-theme="dark"] .history-question {
    color: #64b5f6;
}

[data-theme="dark"] .history-answer {
    color: #c0c0d4;
}

[data-theme="dark"] .history-empty {
    color: #9a9aaa;
}

/* Dive Deeper history items */
[data-theme="dark"] .dive-deeper-item {
    background: linear-gradient(135deg, #2a1a35 0%, #1e1530 100%);
    border-left-color: #ce93d8;
}

[data-theme="dark"] .dive-deeper-item:hover {
    background: linear-gradient(135deg, #311a3e 0%, #231838 100%);
}

[data-theme="dark"] .dive-deeper-item .history-question {
    color: #ce93d8;
}

[data-theme="dark"] .history-sub-questions-title {
    color: #ba68c8;
}

[data-theme="dark"] .history-sub-question {
    background: #1e1e2e;
    color: #f0f0fa;
    border-left-color: #ab47bc;
}

[data-theme="dark"] .history-sub-question:hover {
    background: #2a1a35;
}

/* --- Notes section --- */
[data-theme="dark"] .notes-section h2 {
    color: #64b5f6;
}

[data-theme="dark"] .notes-form-container {
    background: #252535;
    border-color: #3a3a5a;
}

[data-theme="dark"] #noteTextarea {
    background: #1e1e2e;
    border-color: #3a3a5a;
    color: #f0f0fa;
}

[data-theme="dark"] #noteTextarea:focus {
    border-color: #64b5f6;
}

[data-theme="dark"] #noteTextarea::placeholder {
    color: #7a7a8a;
}

[data-theme="dark"] .word-count {
    color: #b8b8cc;
}

[data-theme="dark"] .notes-search-input {
    background: #252535;
    border-color: #3a3a5a;
    color: #f0f0fa;
}

[data-theme="dark"] .notes-search-input:focus {
    border-color: #64b5f6;
}

[data-theme="dark"] .notes-search-input::placeholder {
    color: #7a7a8a;
}

[data-theme="dark"] .search-icon {
    color: #7a7a8a;
}



[data-theme="dark"] .note-date {
    color: #7a7a8a;
}

[data-theme="dark"] .note-content {
    color: #f0f0fa;
}

[data-theme="dark"] .notes-empty {
    color: #7a7a8a;
}

[data-theme="dark"] .note-action-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* --- Study guide maker --- */
[data-theme="dark"] .study-guide-help-box {
    background: #252535;
    border-left-color: #64b5f6;
}

[data-theme="dark"] .study-guide-help-box h4 {
    color: #64b5f6;
}

[data-theme="dark"] .study-guide-help-list li,
[data-theme="dark"] .study-guide-tips li {
    color: #e0e0e8;
}

[data-theme="dark"] .study-guide-examples li {
    color: #b8b8c8;
}

[data-theme="dark"] .study-guide-tips strong {
    color: #64b5f6;
}

[data-theme="dark"] .study-guide-prompt-input {
    background: #252535;
    border-color: #3a3a5a;
    color: #e0e0e8;
}

[data-theme="dark"] .study-guide-prompt-input:focus {
    border-color: #64b5f6;
}

[data-theme="dark"] .study-guide-loading {
    background: #252535;
}

[data-theme="dark"] .study-guide-loading p {
    color: #a0a0b0;
}

[data-theme="dark"] .study-guide-counter {
    color: #64b5f6 !important;
}

[data-theme="dark"] .study-guide-elapsed-time {
    background: #0a1929;
    color: #64b5f6;
}

[data-theme="dark"] .study-guide-lesson {
    background: #252535;
    border-left-color: #64b5f6;
}

[data-theme="dark"] .study-guide-lesson-title {
    color: #64b5f6;
}

[data-theme="dark"] .study-guide-lesson-description {
    color: #b8b8c8;
}

[data-theme="dark"] .study-guide-question-item {
    background: #1e1e2e;
    border-color: #3a3a5a;
}

[data-theme="dark"] .study-guide-question-text {
    color: #e0e0e8;
}

/* Study guide history items */
[data-theme="dark"] .history-item.study-guide-item {
    background: linear-gradient(135deg, #0d1f0d 0%, #121a0e 100%);
    border-left-color: #66BB6A;
}

[data-theme="dark"] .history-item.study-guide-item .history-question {
    color: #81c784;
}

[data-theme="dark"] .study-guide-history-lesson-title {
    color: #81c784;
}

[data-theme="dark"] .study-guide-history-lesson-description {
    color: #b8b8c8;
}

[data-theme="dark"] .study-guide-history-question-item {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(102, 187, 106, 0.2);
}

[data-theme="dark"] .study-guide-history-question-text {
    color: #e0e0e8;
}

/* --- Recent prompts dropdown --- */
[data-theme="dark"] .recent-prompts-label {
    color: #64b5f6;
}

[data-theme="dark"] .recent-prompts-select {
    background-color: #252535;
    border-color: #3a3a5a;
    color: #e0e0e8;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364b5f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

[data-theme="dark"] .recent-prompts-select:hover {
    border-color: #64b5f6;
    box-shadow: 0 2px 4px rgba(100, 181, 246, 0.15);
}

[data-theme="dark"] .recent-prompts-select:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

[data-theme="dark"] .recent-prompts-select option {
    background: #1e1e2e;
    color: #e0e0e8;
}

/* --- Bible browse --- */
[data-theme="dark"] .bible-browse-label {
    color: #64b5f6;
}

[data-theme="dark"] .bible-browse-verse {
    border-bottom-color: #2e2e4e;
    color: #e0e0e8;
}

[data-theme="dark"] .bible-browse-verse-num {
    color: #64b5f6;
}

[data-theme="dark"] .bible-search-result {
    background: #1e1e2e;
    border: 1px solid #3a3a5a;
    box-shadow: none;
}

[data-theme="dark"] .bible-search-result-ref {
    color: #64b5f6;
}

[data-theme="dark"] .bible-search-result-text {
    color: #e0e0e8;
}

[data-theme="dark"] .bible-browse-summary {
    background: #0a1929;
    border-left-color: #64b5f6;
}

[data-theme="dark"] .bible-browse-summary-label {
    color: #42a5f5;
}

[data-theme="dark"] .bible-browse-summary-text {
    color: #e0e0e8;
}

[data-theme="dark"] .bible-translation-note {
    color: #7a7a8a;
    border-top-color: #3a3a5a;
}

/* --- Auth modal --- */
[data-theme="dark"] .auth-modal-overlay {
    background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .auth-modal-panel {
    background: #1e1e2e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .auth-modal-header {
    border-bottom-color: #3a3a5a;
}

[data-theme="dark"] .auth-modal-title {
    color: #64b5f6;
}

[data-theme="dark"] .auth-modal-close {
    color: #a0a0b0;
}

[data-theme="dark"] .auth-modal-body {
    color: #e0e0e8;
}

/* --- Sync status --- */
[data-theme="dark"] #syncStatus {
    background: #252535;
    color: #b8b8c8;
}

[data-theme="dark"] #syncStatus.status-error {
    background: #2e1010;
    color: #ef9a9a;
}

[data-theme="dark"] #syncStatus.status-success {
    background: #0d1f0d;
    color: #a5d6a7;
}

[data-theme="dark"] #syncStatus.status-warning {
    background: #2e2010;
    color: #ffcc80;
}

/* --- User greeting --- */
[data-theme="dark"] .user-greeting {
    color: #a0a0b0;
}

/* Premium (Stripe) */
.limit-message { color: #d32f2f; }
.plan-box { margin: 16px 0 8px; padding: 12px; border: 1px solid var(--border-color, #e2e8f0); border-radius: 8px; }
.plan-title { font-weight: 600; }
.plan-detail { font-size: 0.8rem; opacity: 0.7; margin-top: 2px; }
.upgrade-button { width: 100%; margin-top: 8px; }
.usage-box { margin: 16px 0; font-size: 0.85rem; }
.usage-heading { font-weight: 600; margin-bottom: 4px; }
.usage-row { display: flex; justify-content: space-between; padding: 2px 0; }
.billing-message { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; padding: 10px 16px; border-radius: 8px; background: #2f855a; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.billing-message.error { background: #c53030; }


/* ============================================================
   TABS, HEADER AND MENU
   ============================================================ */

[data-theme="dark"] {
    --brand: #64b5f6;
    --brand-dark: #90caf9;
    --brand-soft: #0a1929;
    --tab-bg: #1e1e2e;
    --tab-ink: #a0a0b8;
}

.app-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 12px;
    text-align: left;
    padding: 10px 14px;
}

.app-header .logo-link {
    flex: 0 1 auto;
    min-width: 0;
}

.app-header .logo {
    width: auto;
    height: 52px;
    max-width: 300px;
    object-fit: contain;
    object-position: left center;
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    cursor: pointer;
}

.icon-button:hover {
    filter: brightness(0.95);
}

.auth-text-button {
    border: 1px solid var(--brand);
    background: transparent;
    color: var(--brand);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.tab-bar {
    display: flex;
    gap: 4px;
    order: 3;
    flex-basis: 100%;
    justify-content: center;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--tab-ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tab-button[aria-current="page"] {
    color: var(--brand);
    background: var(--brand-soft);
}

/* Computers and tablets: the tabs sit in their own row under the logo */
@media (min-width: 600px) {
    .tab-bar {
        border-top: 1px solid #eef0f4;
        padding-top: 8px;
    }

    [data-theme="dark"] .tab-bar {
        border-top-color: #33334a;
    }
}

/* Phones: the tabs are a bar along the bottom of the screen */
@media (max-width: 599px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    /* The logo has its own row on phones (owner's choice, 2026-11-26); the buttons sit below it on the right */
    .app-header {
        row-gap: 4px;
    }

    .app-header .logo-link {
        flex-basis: 100%;
    }

    .app-header .logo {
        height: 40px;
        max-width: 100%;
    }

    .tab-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        gap: 0;
        background: var(--tab-bg);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .tab-button {
        flex: 1;
        flex-direction: column;
        gap: 2px;
        padding: 7px 0 8px;
        border-radius: 0;
        font-size: 11px;
    }

    .tab-button[aria-current="page"] {
        background: transparent;
    }
}

/* Closed slide-in panels sit just off screen; keep their shadow from showing at the edge */
.about-panel:not(.open) {
    box-shadow: none;
}

/* One tab shows at a time */
.tab-screen {
    display: none;
}

.tab-screen.active {
    display: block;
}

/* The former slide-in panels, now tab screens: a white card like the rest of the page */
.tab-screen > .about-panel-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.tab-screen-header {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-screen-header h2 {
    color: var(--brand);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.bible-search-area {
    margin-bottom: 28px;
}

/* Menu */
.menu-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 14px;
}

.menu-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
}

.menu-display-label {
    flex: 1;
    font-size: 14px;
    color: #555;
}

[data-theme="dark"] .tab-screen > .about-panel-content {
    background: #1e1e2e;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .tab-screen-header {
    border-bottom-color: #33334a;
}

[data-theme="dark"] .menu-display-label {
    color: #c0c0d0;
}

[data-theme="dark"] .tab-bar {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Bible tab */
.link-button {
    background: none;
    border: none;
    padding: 6px 0;
    color: var(--brand);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.bible-chapter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chapter-arrow {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.chapter-arrow[hidden] {
    visibility: hidden;
    display: inline-block;
}

.bible-browse-verse.verse-highlight {
    background: var(--brand-soft);
    border-radius: 6px;
    box-shadow: inset 3px 0 0 var(--brand);
}

.ask-about-chapter {
    display: block;
    margin: 18px auto 4px;
    padding: 10px 18px;
    border: 1px solid var(--brand);
    border-radius: 20px;
    background: transparent;
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.bible-search-result-text .bible-browse-verse-text::before { content: '\201C'; }
.bible-search-result-text .bible-browse-verse-text::after { content: '\201D'; }

.bible-offline-note {
    color: #b26a00;
    font-size: 14px;
    margin-bottom: 10px;
}

a.scripture-ref {
    color: var(--brand);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

/* Tap a verse */
.bible-browse-verse[data-ref] {
    cursor: pointer;
}

.bible-browse-verse.verse-selected {
    background: var(--brand-soft);
    border-radius: 6px;
    outline: 2px solid var(--brand);
}

.verse-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 10px;
    padding: 8px;
    border-radius: 12px;
    background: #1c2430;
}

.verse-action-bar button {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.back-to-passage {
    display: block;
    margin-top: 12px;
}

[data-theme="dark"] .verse-action-bar {
    background: #0a1929;
}

/* Saved tab */
.saved-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.saved-switch-button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--brand);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.saved-switch-button[aria-pressed="true"] {
    background: var(--brand);
    color: #fff;
}

/* The Saved tab itself shows or hides notes, so the old hide-notes eye is not needed there */
#savedScreen .toggle-visibility-button {
    display: none;
}

[data-theme="dark"] .saved-switch-button {
    background: #1e1e2e;
}

[data-theme="dark"] .saved-switch-button[aria-pressed="true"] {
    background: var(--brand);
    color: #0f0e17;
}

/* Recent questions and answers under Ask */
.ask-recent-section {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ask-recent-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ask-recent-header h2 {
    font-size: 18px;
    color: var(--brand);
    margin: 0;
}

.ask-recent-list {
    display: flex;
    flex-direction: column;
}

.ask-recent-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 12px 2px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.ask-recent-item:first-child {
    border-top: none;
}

.ask-recent-item:hover .ask-recent-question {
    color: var(--brand);
}

.ask-recent-question {
    font-weight: 600;
    color: #333;
}

.ask-recent-answer {
    color: #666;
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .ask-recent-section {
    background: #1e1e2e;
}

[data-theme="dark"] .ask-recent-item {
    border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .ask-recent-question {
    color: #e0e0e0;
}

[data-theme="dark"] .ask-recent-answer {
    color: #a0a0b8;
}

/* Dark mode shows a light-blue copy of the logo; the dark blue one is hard to see on the dark header */
.logo-dark {
    display: none;
}

[data-theme="dark"] .logo-dark {
    display: block;
}

[data-theme="dark"] .logo-light {
    display: none;
}

/* ── Notes: the ✎ button, the note sheet, the "Added to …" message ───────────────────────────────────────────── */
.note-fab {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--brand);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 900;
}

.note-fab:hover {
    background: var(--brand-dark);
}

body.note-sheet-open .note-fab {
    display: none;
}

.note-sheet {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 520px;
    height: 100vh;
    height: 100dvh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.note-sheet.open {
    right: 0;
}

.note-sheet-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 14px 4px;
}

.note-sheet-title {
    flex: 1;
    min-width: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--brand);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px 8px;
    background: transparent;
    font-family: inherit;
}

.note-sheet-title:hover,
.note-sheet-title:focus {
    border-color: rgba(0, 0, 0, 0.15);
    outline: none;
}

.note-sheet-icon {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex: none;
}

.note-sheet-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px;
}

.note-sheet-menu button {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: white;
    border-radius: 16px;
    padding: 6px 12px;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    color: #333;
}

.note-sheet-menu[hidden] {
    display: none;
}

.note-sheet-menu .note-delete {
    color: #c62828;
}

.note-sheet-date {
    padding: 0 22px 8px;
    font-size: 13px;
    color: #888;
}

.note-sheet-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px 10px;
}

.note-empty {
    color: #888;
    padding: 20px 8px;
    text-align: center;
}

.note-item {
    position: relative;
    padding: 12px 40px 12px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    background: #f7f8fb;
    line-height: 1.5;
}

.note-item-text .note-text {
    white-space: pre-wrap;
    cursor: text;
}

.note-item-answer {
    background: #eef4fc;
}

.note-item-verse {
    background: #f4f0fa;
}

.note-item-question {
    background: #fff8e6;
}

.note-item-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
}

.note-item-remove:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #c62828;
}

.note-answer-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.note-answer-question,
.note-question-text {
    font-weight: 600;
}

.note-answer-hint {
    font-size: 13px;
    color: var(--brand);
}

.note-answer-body {
    margin-top: 8px;
    font-size: 15px;
}

.note-answer-sources-label {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.note-answer-sources {
    margin: 4px 0 0 18px;
    font-size: 13px;
    color: #666;
}

.note-verse-ref {
    font-weight: 600;
}

.note-verse-text {
    font-style: italic;
}

.note-edit-box,
#noteComposer {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    padding: 10px;
    font: inherit;
    resize: vertical;
    box-sizing: border-box;
    background: white;
    color: inherit;
}

.note-edit-buttons,
.note-composer-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.note-edit-buttons button,
.note-composer-buttons button {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.note-edit-cancel {
    background: #e0e0e0;
    color: #333;
}

.note-edit-save,
.note-add-button {
    background: #4caf50;
    color: white;
}

.note-ask-button {
    background: var(--brand);
    color: white;
}

.note-sheet-status {
    padding: 0 14px;
    font-size: 14px;
    color: #555;
}

.note-sheet-status:empty {
    display: none;
}

.note-composer {
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: inherit;
}

.note-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100% - 32px);
    background: #263238;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    font-size: 15px;
}

.note-toast[hidden] {
    display: none;
}

.note-toast-open {
    border: none;
    background: none;
    color: #90caf9;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 599px) {
    .note-fab {
        right: 16px;
        bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .note-toast {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

[data-theme="dark"] .note-sheet,
[data-theme="dark"] .note-sheet-menu button,
[data-theme="dark"] .note-edit-box,
[data-theme="dark"] #noteComposer {
    background: #1e1e2e;
    color: #e0e0e0;
}

[data-theme="dark"] .note-sheet-title {
    color: #64b5f6;
}

[data-theme="dark"] .note-sheet-menu button,
[data-theme="dark"] .note-edit-box,
[data-theme="dark"] #noteComposer {
    border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .note-item {
    background: #252535;
}

[data-theme="dark"] .note-item-answer {
    background: #1d2a3d;
}

[data-theme="dark"] .note-item-verse {
    background: #2a2440;
}

[data-theme="dark"] .note-item-question {
    background: #33301f;
}

[data-theme="dark"] .note-answer-hint {
    color: #64b5f6;
}

[data-theme="dark"] .note-composer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

/* Add to note buttons */
.add-to-note-button {
    margin-left: auto;
    margin-right: 8px;
    padding: 10px 14px;
    background: var(--brand-soft);
    color: var(--brand);
    border: 1px solid var(--brand);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.add-to-note-button[hidden] {
    display: none;
}

.study-guide-note-button {
    padding: 6px 10px;
    margin-right: 6px;
    background: transparent;
    color: #1976D2;
    border: 1px solid #1976D2;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

[data-theme="dark"] .add-to-note-button,
[data-theme="dark"] .study-guide-note-button {
    color: #64b5f6;
    border-color: #64b5f6;
}

.note-question-ask {
    margin-top: 8px;
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    background: var(--brand);
    color: white;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Saved tab: note cards */
.note-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-align: left;
    padding: 14px 15px;
    background: #f5f5f5;
    border: none;
    border-radius: 12px;
    border-left: 4px solid #1976D2;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.note-card:hover {
    background: #e3f2fd;
}

.note-card-title {
    font-weight: 600;
    font-size: 16px;
    color: #1976D2;
}

.note-card-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #888;
}

.note-card-preview {
    color: #555;
    font-size: 14px;
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .note-card {
    background: #252535;
    border-left-color: #64b5f6;
}

[data-theme="dark"] .note-card:hover {
    background: #2d2d42;
}

[data-theme="dark"] .note-card-title {
    color: #64b5f6;
}

[data-theme="dark"] .note-card-preview {
    color: #b0b0c8;
}

/* Print just the note (⋯ → Print) */
@media print {
    body.printing-note > *:not(#noteSheet) {
        display: none !important;
    }

    body.printing-note #noteSheet {
        position: static;
        width: auto;
        max-width: none;
        height: auto;
        box-shadow: none;
        display: block;
        background: white;
        color: black;
    }

    body.printing-note .note-sheet-icon,
    body.printing-note .note-sheet-menu,
    body.printing-note .note-composer,
    body.printing-note .note-sheet-status,
    body.printing-note .note-item-remove,
    body.printing-note .note-question-ask,
    body.printing-note .note-answer-hint {
        display: none !important;
    }

    body.printing-note .note-sheet-title {
        border: none;
        color: black;
    }

    body.printing-note .note-sheet-items {
        overflow: visible;
    }

    body.printing-note .note-item {
        break-inside: avoid;
        background: none;
        border: 1px solid #ccc;
    }
}

[data-theme="dark"] .note-sheet-menu .note-delete {
    color: #ef9a9a;
}

[data-theme="dark"] .note-ask-button,
[data-theme="dark"] .note-question-ask {
    background: #1976D2;
}
