/* ===========================================
   Study Console - Full-screen preparation workspace
   =========================================== */

/* Modal overlay */
.study-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: study-fade-in 0.2s ease;
}

@keyframes study-fade-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Modal content container */
.study-modal-content {
    width: 95vw;
    height: 92vh;
    background: var(--background);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.14),
        0 24px 60px rgba(0, 0, 0, 0.22);
}

/* Header */
.study-header {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.5rem;
    flex-shrink: 0;
    cursor: grab;
    gap: 0.75rem;
}

.study-header:active {
    cursor: grabbing;
}

/* Restore default cursor on interactive elements inside the header */
.study-header button,
.study-header input,
.study-header select {
    cursor: pointer;
}

.study-header input[type="text"] {
    cursor: text;
}

.study-save-nudge {
    padding: 0.45rem 1.5rem;
    background: rgba(255, 165, 0, 0.06);
    border-bottom: 1px solid rgba(255, 165, 0, 0.15);
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.study-nudge-save {
    padding: 0.15rem 0.5rem !important;
    font-size: 0.75rem !important;
    margin-left: 0.25rem;
}

.study-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

/* Study name input */
.study-name-input {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    font-family: 'Crimson Text', serif;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.4rem 0.65rem;
    min-width: 200px;
    max-width: 400px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, color 0.2s;
}

.study-name-input:hover {
    color: var(--primary);
    text-shadow: none;
    border-color: var(--border);
    background: var(--surface);
}

.study-name-input:focus {
    color: var(--primary);
    text-shadow: none;
    outline: none;
    border-color: var(--primary);
    background: var(--background);
    box-shadow: 0 0 0 3px rgba(91, 75, 138, 0.1);
}

.study-name-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-style: italic;
}

.study-name-input:focus::placeholder {
    color: var(--text-secondary);
}

.study-verse-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    font-weight: 500;
}

.study-saved-badge {
    font-size: 0.72rem;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.study-live-badge {
    font-size: 0.72rem;
    color: var(--secondary);
    background: rgba(139, 115, 85, 0.1);
    border: 1px solid rgba(139, 115, 85, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.study-header-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Header buttons now use shared .frosted-header-btn in styles.css */

/* Study list dialog — Mac-style overlay with search */
.study-list-overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: study-fade-in 0.15s ease;
}

.study-list-dialog {
    width: 420px;
    max-height: 70vh;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow:
        0 0 0 0.5px rgba(0, 0, 0, 0.12),
        0 4px 16px rgba(0, 0, 0, 0.14),
        0 24px 60px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: study-dialog-in 0.2s ease-out;
}

@keyframes study-dialog-in {
    from { opacity: 0; transform: scale(0.95) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.study-list-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border);
}

.study-list-dialog-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.study-list-dialog-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
}

.study-list-dialog-close:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.08);
}

.study-list-search-wrap {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}

.study-list-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.study-list-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 75, 138, 0.1);
}

.study-list-search::placeholder {
    color: var(--text-secondary);
}

.study-list-items {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.study-list-empty {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.study-list-item {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.15rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.study-list-item:last-child {
    border-bottom: none;
}

.study-list-item:hover {
    background: var(--highlight);
}

.study-list-item.active {
    background: var(--highlight);
    border-left: 3px solid var(--primary);
}

.study-list-item-info {
    flex: 1;
    min-width: 0;
}

.study-list-item-name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.study-list-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.study-list-item-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.3rem;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
}

.study-list-item:hover .study-list-item-delete {
    opacity: 0.5;
}

.study-list-item-delete:hover {
    opacity: 1 !important;
    color: #c0392b;
}

.study-list-dialog-footer {
    padding: 0.55rem 1.15rem;
    border-top: 1px solid var(--border);
    background: var(--highlight);
    border-radius: 0 0 12px 12px;
}

.study-list-dialog-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* close button now uses shared .frosted-close-btn in styles.css */

/* Body - two panel layout */
.study-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Panels — equal 50/50 split */
.study-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.study-panel-left {
    border-right: 1px solid rgba(0, 0, 0, 0.09);
}

.study-panel-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: transparent;
    flex-shrink: 0;
}

.study-panel-tab {
    flex: 0 0 auto;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.study-panel-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

.study-panel-tab.active {
    color: #007aff;
    border-bottom-color: #007aff;
}

.study-panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Dictionary move button */
.study-dict-move-btn {
    margin-left: auto;
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: color 0.2s, background 0.2s;
}

.study-dict-move-btn:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
}

.study-verses-panel {
    overflow-y: auto;
    padding: 1rem;
    flex: 1;
}

/* Study text tab */
.study-text-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}

/* Rich text formatting toolbar */
.study-text-toolbar {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.study-fmt-btn {
    width: 32px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.study-fmt-btn:hover {
    background: var(--bg-tertiary);
}

.study-fmt-btn.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.study-fmt-sep {
    width: 1px;
    background: var(--border);
    margin: 2px 4px;
}

/* Contenteditable rich text editor */
.study-text-editable {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
    background: var(--background);
    outline: none;
}

.study-text-editable:empty::before {
    content: "Write your study notes here...";
    color: var(--text-secondary);
    font-style: italic;
}

/* Formatting inside editable area */
.study-text-editable h3 {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 0.5em 0 0.3em;
}

.study-text-editable h4 {
    font-size: 1.15rem;
    font-weight: bold;
    margin: 0.4em 0 0.2em;
}

.study-text-editable ul,
.study-text-editable ol {
    padding-left: 1.5em;
    margin: 0.3em 0;
}

.study-text-editable li {
    margin: 0.15em 0;
}

/* Read mode: rendered study text */
.study-text-preview {
    flex: 1;
    min-height: 0;
    padding: 1rem 1.25rem;
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
    overflow-y: auto;
}

.study-text-preview h3 {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 0.5em 0 0.3em;
}

.study-text-preview h4 {
    font-size: 1.15rem;
    font-weight: bold;
    margin: 0.4em 0 0.2em;
}

.study-text-preview ul,
.study-text-preview ol {
    padding-left: 1.5em;
    margin: 0.3em 0;
}

.study-text-preview li {
    margin: 0.15em 0;
}

/* Mode toggle button in the tab bar */
.study-text-mode-btn {
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color 0.2s;
    margin-left: auto;
}
.study-text-mode-btn:hover {
    color: var(--primary);
}

/* Dictionary content (tabbed behind study text or verses) */
.study-dictionary-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Dictionary word list */
.study-word-list {
    flex: 0 0 auto;
    max-height: 35%;
    overflow-y: auto;
    border-bottom: 2px solid var(--border);
}

.study-word-list-header {
    position: sticky;
    top: 0;
    background: var(--highlight);
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

.study-word-items {
    padding: 0.25rem 0;
}

.study-word-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.study-word-item:hover {
    background: var(--highlight);
}

.study-word-item.active {
    background: var(--highlight);
    border-left-color: var(--primary);
}

.study-word-num {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.8rem;
    min-width: 3.5rem;
}

.study-word-lemma {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
}

.study-word-translit {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
}

.study-word-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
}

.study-word-item:hover .study-word-remove {
    opacity: 0.5;
}

.study-word-remove:hover {
    opacity: 1 !important;
    color: var(--text-primary);
}

/* Strong's definition panel */
.study-strongs-display {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

/* Empty states */
.study-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.study-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.study-empty-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.study-empty-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.study-dict-empty {
    padding: 1.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
}

/* Verse cards */
.study-verse-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    padding: 0;
    transition: box-shadow 0.2s, opacity 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.study-verse-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 6px 16px rgba(0, 0, 0, 0.07);
}

.study-verse-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.study-verse-card.drag-over-above {
    border-top: 3px solid var(--primary);
    margin-top: -2px;
}

.study-verse-card.drag-over-below {
    border-bottom: 3px solid var(--primary);
    margin-bottom: -2px;
}

/* Card header */
.study-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px 10px 0 0;
}

.study-card-grip {
    cursor: grab;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 0 0.25rem;
    user-select: none;
    letter-spacing: 2px;
}

.study-card-grip:active {
    cursor: grabbing;
}

.study-card-ref {
    font-weight: 700;
    color: var(--primary);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    flex: 1;
}

.study-card-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Study card action buttons use .verse-action-btn from styles.css */

.study-card-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    line-height: 1;
}

.study-card-remove:hover {
    opacity: 1;
    color: #c0392b;
}

/* Card text */
.study-card-text {
    padding: 0.75rem;
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Inline Strong's links in verse text */
.study-strongs-inline {
    color: var(--primary);
    font-size: 0.7em;
    font-weight: 600;
    cursor: pointer;
    vertical-align: super;
    padding: 0 0.1rem;
    transition: color 0.15s, background 0.15s;
    border-radius: 2px;
}

.study-strongs-inline:hover {
    background: rgba(var(--primary-rgb, 139, 69, 19), 0.1);
    text-decoration: underline;
}

/* Selected Strong's word highlight in study verse cards */
.study-card-text .word-selected,
.study-strongs-inline.word-selected {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 2px rgba(91, 75, 138, 0.3);
}

/* Notes toggle */
.study-notes-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    border-top: 1px solid var(--border);
    transition: background 0.15s;
    user-select: none;
}

.study-notes-toggle:hover {
    background: var(--highlight);
}

.study-notes-arrow {
    font-size: 0.65rem;
    transition: transform 0.15s;
}

/* Notes content */
.study-notes-content {
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    background: var(--highlight);
    border-radius: 0 0 8px 8px;
}

.study-notes-content.collapsed {
    display: none;
}

.study-note-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.study-note-item:last-child {
    border-bottom: none;
}

.study-note-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
}

.study-note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.25rem;
}

.study-note-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.study-note-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.study-note-item:hover .study-note-actions {
    opacity: 1;
}

.study-note-edit,
.study-note-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.study-note-edit {
    color: var(--primary);
}

.study-note-edit:hover {
    background: var(--primary);
    color: white;
}

.study-note-delete {
    color: #e74c3c;
}

.study-note-delete:hover {
    background: #e74c3c;
    color: white;
}

/* Note editing */
.study-note-item.editing {
    padding: 0.5rem 0;
}

.study-note-edit-textarea,
.study-note-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    background: var(--surface);
    color: var(--text-primary);
    box-sizing: border-box;
}

.study-note-edit-textarea:focus,
.study-note-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(91, 75, 138, 0.15);
}

.study-note-edit-actions,
.study-note-add-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.study-note-save,
.study-note-submit {
    padding: 0.3rem 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.study-note-save:hover,
.study-note-submit:hover {
    background: var(--primary-dark);
}

.study-note-cancel,
.study-note-add-cancel {
    padding: 0.3rem 0.75rem;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.study-note-cancel:hover,
.study-note-add-cancel:hover {
    background: var(--highlight);
    color: var(--text-primary);
}

/* Add study note button — in study-notes-header */
.study-note-add-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.15s, background 0.15s;
}

.study-notes-section:hover .study-note-add-btn {
    opacity: 1;
}

.study-note-add-btn:hover {
    background: var(--primary);
    color: white;
    opacity: 1;
}

/* Add note area */
.study-note-add-area {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}

/* Notes placeholder - removed, using toggle with (0) instead */
.study-notes-toggle.no-notes {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ================================================
   GLOBAL BIBLE NOTES TOGGLE — above verse list
   ================================================ */
.study-bible-notes-global-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    background: var(--highlight);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.study-bible-notes-hide-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    transition: background 0.15s, color 0.15s;
}

.study-bible-notes-hide-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* ================================================
   BIBLE NOTES — read-only layer on verse cards
   ================================================ */
.bible-notes-section {
    border-top: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    background: var(--highlight);
    opacity: 0.75;
}

.bible-notes-header {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.bible-note-item {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.bible-note-item:last-child {
    border-bottom: none;
}

.bible-note-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: pre-wrap;
}

.bible-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.2rem;
}

.bible-note-date {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.bible-note-use-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.bible-note-item:hover .bible-note-use-btn {
    opacity: 1;
}

.bible-note-use-btn:hover {
    background: rgba(210, 170, 50, 0.25);
    color: #7a5c00;
    opacity: 1;
}

.bible-note-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.bible-note-inject-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.bible-note-item:hover .bible-note-inject-btn {
    opacity: 1;
}

.bible-note-inject-btn:hover {
    background: rgba(60, 120, 210, 0.15);
    color: #1a4fa0;
    opacity: 1;
}

/* Global hide toggle — CSS class on .study-verses-panel */
.study-verses-panel.bible-notes-hidden .bible-notes-section {
    display: none;
}

/* ================================================
   STUDY NOTES — editable gold layer on verse cards
   ================================================ */
.study-notes-section {
    border-top: 1px solid rgba(210, 170, 50, 0.3);
    padding: 0.4rem 0.75rem 0.5rem;
    background: rgba(255, 248, 220, 0.35);
}

.study-notes-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
}

.study-notes-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #8a6a00;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Dark theme override for study notes */
@media (prefers-color-scheme: dark) {
    .study-notes-section {
        background: rgba(80, 60, 0, 0.2);
        border-top-color: rgba(180, 140, 0, 0.3);
    }
    .study-notes-label {
        color: #c8a430;
    }
}

/* Slim bar in read-mode — holds the Edit button */
.study-read-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

/* Mobile bottom nav — hidden on desktop */
.study-mobile-nav {
    display: none;
    flex-direction: row;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.study-mobile-tab {
    flex: 1;
    padding: 0.6rem 0;
    font-size: 0.75rem;
    background: none;
    border: none;
    border-top: 3px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.study-mobile-tab.active {
    color: var(--primary);
    border-top-color: var(--primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .study-mobile-nav { display: flex; }

    /* Panels hidden by default — JS adds mobile-active to the visible one */
    .study-panel-left,
    .study-panel-right {
        display: none;
        max-height: none;
    }

    .study-panel-left.mobile-active,
    .study-panel-right.mobile-active {
        display: flex;
        flex: 1;
        max-height: none;
    }

    /* Per-panel tab bars + move-dict button replaced by bottom nav */
    .study-panel-tabs,
    .study-dict-move-btn { display: none; }
}

/* Responsive */
@media (max-width: 900px) {
    .study-modal-content {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .study-body {
        flex-direction: column;
    }

    .study-panel-left {
        border-right: none;
        border-bottom: 2px solid var(--border);
    }
}

@media (max-width: 480px) {
    .study-header {
        flex-direction: column;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        cursor: default;
        position: relative;
    }

    .study-header:active {
        cursor: default;
    }

    .study-header > .study-close-btn {
        position: absolute;
        top: 0.5rem;
        right: 0.75rem;
    }

    .study-header-left {
        gap: 0.5rem;
        min-width: 0;
        padding-right: 2rem;
    }

    .study-header-right {
        gap: 0.35rem;
        flex-wrap: wrap;
    }

    .study-name-input {
        min-width: 120px;
        max-width: none;
        font-size: 1rem;
        padding: 0.3rem 0.5rem;
    }

    .study-new-btn,
    .study-save-btn,
    .study-saveas-btn,
    .study-list-btn,
    .study-export-btn,
    .study-delete-btn,
    .study-mode-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .study-panel-left {
        max-height: 45%;
    }

    .study-card-text {
        font-size: 0.95rem;
    }

    .study-fmt-btn {
        min-width: 36px;
        min-height: 36px;
    }

    .study-verse-count,
    .study-saved-badge,
    .study-live-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.45rem;
    }
}

/* ────────────────────────────────────────────────────────────────────────────
   TOUCH DEVICES — show hover-only action buttons at reduced opacity
   ──────────────────────────────────────────────────────────────────────────── */
/* ────────────────────────────────────────────────────────────────────────────
   COMMENTARY CARDS IN STUDY
   ──────────────────────────────────────────────────────────────────────────── */
.study-commentary-section {
    margin-top: 1rem;
}

.study-commentary-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: #D4A017;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid #D4A01733;
    margin-bottom: 0.5rem;
}

.study-commentary-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-left: 4px solid #D4A017;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.study-commentary-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 6px 16px rgba(0, 0, 0, 0.07);
}

.study-commentary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
}

.study-commentary-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: #D4A017;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
}

.study-commentary-ref {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.study-commentary-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-left: auto;
}

/* Commentary card action buttons use .verse-action-btn from styles.css */

.study-commentary-remove {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.25rem;
    opacity: 0.5;
    transition: all 0.15s;
}

.study-commentary-remove:hover {
    color: #e74c3c;
    opacity: 1;
}

.study-commentary-text {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.study-commentary-text:not(.expanded)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--background));
}

.study-commentary-text.expanded {
    max-height: none;
}

.study-commentary-expand {
    display: block;
    width: 100%;
    background: none;
    border: none;
    border-top: 1px solid var(--border);
    color: #D4A017;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem;
    cursor: pointer;
}

.study-commentary-expand:hover {
    background: #D4A01710;
}

.study-commentary-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-top: 1px solid var(--border);
}

.study-commentary-inject-btn {
    background: none;
    border: none;
    color: #D4A017;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.study-commentary-inject-btn:hover {
    background: #D4A01715;
}

@media (hover: none) {
    .study-list-item-delete { opacity: 0.5; }
    .study-word-remove { opacity: 0.5; }
    .study-note-add-btn { opacity: 0.7; }
    .study-note-actions { opacity: 0.7; }
    .bible-note-use-btn { opacity: 0.7; }
    .bible-note-inject-btn { opacity: 0.7; }
    .study-commentary-remove { opacity: 0.5; }
    .study-commentary-actions button { opacity: 0.7; }
}
