/* Modern Sacred — Stitch Design Language */

:root {
    /* Color Palette — Navy-Purple Liturgical */
    --primary-color: #6366f1;
    --primary-color-rgb: 99, 102, 241;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;

    --accent-purple: #a855f7;
    --accent-rose: #be185d;

    --background-base: #0f0f12;
    --background-surface: #18182e;
    --background-highlight: #20203d;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #475569;

    --border-color: rgba(255, 255, 255, 0.06);

    /* Layout */
    --header-height: auto;
    --nav-height: 76px;
    --border-radius: 16px;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --primary-color: #4f46e5;
    --primary-light: #6366f1;
    --background-base: #f6f6f8;
    --background-surface: #ffffff;
    --background-highlight: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #cbd5e1;
    --border-color: rgba(0, 0, 0, 0.08);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--background-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Libre Baskerville', 'Crimson Text', Georgia, serif;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

/* Helpers */
.hidden {
    display: none !important;
}

.mobile-only {
    display: flex;
}

.desktop-only {
    display: none;
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: flex;
    }
}

/* --- Layout --- */

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    /* Mobile: Column direction usually, but flex row works if main wraps or sidebar is hidden */
    flex-direction: column;
}

/* .app-container media query removed */

/* Sidebar (Desktop Fixed) */
/* Sidebar REMOVED */

/* Header Actions & Toggles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-text-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-text-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-text-toggle.full-width {
    width: 100%;
    text-align: center;
    padding: 10px;
}

/* Sidebar Header Controls */
.sidebar-header-controls {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

/* Tab Content Logic */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

.tab-content.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hide original Control Header since we have tabs now */
.control-header {
    display: none;
}

/* Sidebar Contents */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo h1 {
    font-size: 1.25rem;
    margin: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--background-highlight);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--background-highlight);
    color: var(--primary-color);
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Important for flex shrinking */
    margin-left: 0;
    padding-bottom: var(--nav-height);
    /* Space for bottom nav */
}

/* .app-main media query removed (margin-left) */

/* Header */
.app-header {
    background-color: rgba(16, 19, 34, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    transition: all 0.3s ease;
}

[data-theme="light"] .app-header {
    background-color: rgba(246, 246, 248, 0.92);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.header-greeting {
    font-size: 1.1rem;
    font-weight: 700;
}

/* --- Header Components --- */
.header-title-area {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.card-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-purple);
    font-family: 'Inter', sans-serif;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Libre Baskerville', 'Crimson Text', serif;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.rite-toggle {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--accent-purple);
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
}

.rite-toggle:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

[data-theme="light"] .rite-toggle {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    color: var(--primary-color);
}

/* --- Modal Selector Group --- */
.selector-group {
    margin-bottom: 16px;
}

.selector-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-family: 'Inter', sans-serif;
}

.modal-body .modern-select {
    background-color: var(--background-highlight);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    padding-right: 2em;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Content Area */
.content-area {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
}

@media (min-width: 769px) {
    .content-area {
        padding: 24px;
    }
}

/* --- Components --- */

/* Controls */
/* Controls */
.controls-section {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    border: none;
}

/* Header Specific Controls */
.header-controls {
    width: 100%;
    margin-bottom: 0;
}

.header-controls .modern-select {
    font-size: 1.1rem;
    padding: 0;
    height: 100%;
}

/* Sticky Controls - REMOVED */
.sticky-controls {
    display: none;
}

.control-header {
    display: none;
}

.grid-controls {
    display: block;
    margin-bottom: 0;
}

.control-group {
    margin-bottom: 0;
}

.control-group label {
    display: none;
}

.modern-select {
    width: 100%;
    background-color: transparent;
    color: var(--text-primary);
    border: none;
    padding: 4px 0;
    border-radius: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    appearance: none;
    outline: none;
    cursor: pointer;
    line-height: 1.2;
    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='white' 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 center;
    background-size: 1em;
    padding-right: 1.2em;
    text-overflow: ellipsis;
}

/* Adjust light mode arrow color */
[data-theme="light"] .modern-select {
    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='black' 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");
}

.modern-select:focus {
    border-color: transparent;
    background-color: transparent;
}

.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
}

/* Chants */
.chant-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chant-item {
    background-color: var(--background-surface);
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.chant-item:hover {
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.06);
}

[data-theme="light"] .chant-item {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chant-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.chant-type {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-purple);
    margin-bottom: 4px;
}

.chant-name {
    font-size: 1.15rem;
    margin: 0;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

.text-content {
    font-family: 'Libre Baskerville', 'Crimson Text', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.chant-item.ordinary {
    border-left: 3px solid var(--accent-purple);
}

.chant-item.ordinary .chant-type {
    color: var(--text-secondary);
}

/* GABC */
.gabc-editor {
    width: 100%;
    min-height: 150px;
    background-color: #0d0d0d;
    color: #4CAF50;
    font-family: monospace;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.chant-preview {
    overflow-x: auto;
    padding: 10px 0;
}

.chant-preview svg {
    filter: invert(1) hue-rotate(180deg);
    max-width: 100%;
    height: auto;
}

[data-theme="light"] .chant-preview svg {
    filter: none;
}

text.annotation {
    font-weight: 600;
    font-variant: small-caps;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

/* Gradient fade above nav */
.bottom-nav::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to top, var(--background-base), transparent);
    pointer-events: none;
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    background-color: rgba(16, 19, 34, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 24px;
    padding-bottom: 24px;
}

[data-theme="light"] .bottom-nav-inner,
[data-theme="light"] .bottom-nav {
    background-color: transparent;
}

[data-theme="light"] .bottom-nav-inner {
    background-color: rgba(246, 246, 248, 0.92);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .bottom-nav::before {
    background: linear-gradient(to top, var(--background-base), transparent);
}

.bottom-nav .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
    border-radius: 0;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: transparent !important;
    transition: color 0.2s ease;
}

.bottom-nav .nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: transform 0.15s ease;
}

.bottom-nav .nav-item.active svg {
    transform: scale(1.05);
}

.bottom-nav .nav-item .icon {
    display: flex;
    font-size: 1.4rem;
    margin-bottom: 1px;
}

.bottom-nav .nav-item.active {
    color: var(--text-primary);
}

.bottom-nav .nav-item:not(.active) {
    color: var(--text-tertiary);
}

/* Buttons */
.btn-icon,
.icon-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background-color 0.2s ease;
}

#themeToggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] #themeToggle {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.btn-icon:hover,
.icon-button:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-pill {
    background-color: var(--background-highlight);
    color: var(--text-primary);
    border: none;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-pill:hover {
    background-color: var(--background-surface);
}

/* Readings */
.reading-version {
    margin-bottom: 2rem;
    text-align: justify;
    line-height: 1.6;
}

.reading-version h4 {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.reading-version span {
    display: inline;
    margin-right: 4px;
    white-space: normal;
}

/* --- Settings Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.modal-content {
    background-color: var(--background-surface);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 28px;
    position: relative;
    z-index: 2001;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .modal-content {
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.setting-group {
    margin-bottom: 24px;
}

.setting-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    position: relative;
}

[data-theme="light"] .segmented-control {
    background-color: var(--background-highlight);
}

.segment {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.segment:hover {
    color: var(--text-primary);
}

.segment.active {
    background-color: var(--background-highlight);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .segment.active {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Toggle List */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.toggle-item span {
    font-size: 1rem;
    font-weight: 500;
}

/* Toggle Switch (iOS Style) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background-highlight);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Chant Context Menu (Floating Toolbar) */
.chant-context {
    position: absolute;
    z-index: 9999;
    background-color: var(--background-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.chant-context .btn-group {
    display: flex;
    gap: 2px;
}

.chant-context .btn-group-vertical {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.chant-context .btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
    width: 100%;
    transition: background-color 0.2s;
}

.chant-context .btn:hover {
    background-color: var(--background-highlight);
}

.chant-context .btn-primary {
    color: var(--primary-color);
    font-weight: 600;
}

.chant-context .btn-danger {
    color: #ff453a;
}

.chant-context .btn-success {
    color: #30d158;
}

.chant-context .glyphicon {
    display: inline-block;
    font-family: 'Glyphicons Halflings', sans-serif;
    font-style: normal;
    font-weight: 400;
    line-height: 1;
}

/* Fallback icons */
.chant-context .glyphicon-play::before {
    content: "▶";
    margin-right: 4px;
}

.chant-context .glyphicon-step-backward::before {
    content: "⏮";
}

.chant-context .glyphicon-step-forward::before {
    content: "⏭";
}

.chant-context .glyphicon-pause::before {
    content: "⏸";
}

.chant-context .glyphicon-stop::before {
    content: "⏹";
}

.chant-context .glyphicon-plus::before {
    content: "+";
}

.chant-context .glyphicon-minus::before {
    content: "-";
}

.chant-context .glyphicon-remove::before {
    content: "✕";
}

.chant-context .glyphicon-arrow-left::before {
    content: "←";
}

.chant-context .glyphicon-arrow-right::before {
    content: "→";
}

.chant-context .glyphicon-check::before {
    content: "✓";
}

.chant-context .glyphicon-unchecked::before {
    content: "☐";
}

/* Active note styles */
svg.ChantScore .active {
    fill: var(--accent-purple) !important;
    stroke: var(--accent-purple) !important;
}

svg.ChantScore .porrectus-left {
    fill: var(--accent-purple) !important;
}

svg.ChantScore .porrectus-right {
    fill: var(--accent-purple) !important;
}

/* Ensure toolbar doesn't get clipped */
body {
    position: relative;
}

/* --- Tools Navigation Bar --- */
.tools-nav {
    display: flex;
    gap: 0;
    overflow-x: auto;
    white-space: nowrap;
    background-color: var(--background-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tools-nav::-webkit-scrollbar {
    display: none;
}

.tools-nav a {
    display: inline-block;
    padding: 10px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tools-nav a:hover {
    color: var(--text-primary);
}

.tools-nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* --- Versiculum / Response Styling --- */
.versiculum {
    color: var(--accent-purple);
    font-weight: 700;
    margin-right: 4px;
    font-family: 'Libre Baskerville', 'Crimson Text', serif;
    font-size: 1.1em;
}

.asperges-verses {
    font-family: 'Libre Baskerville', 'Crimson Text', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    margin-top: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
}

.asperges-verses div {
    margin-bottom: 4px;
}

/* --- Extra Verses Section (Introit ad libitum) --- */
.extra-verses-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.extra-verses-section label {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 600;
}

.extra-verses-section .sel-psalms {
    font-size: 0.85rem;
    padding: 4px 8px;
    background-color: var(--background-highlight);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.extra-verses-section .txtPsalmVerses {
    font-size: 0.85rem;
    padding: 4px 8px;
    background-color: var(--background-highlight);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: 100px;
}

/* Rubric text */
.rubric {
    font-family: 'Libre Baskerville', 'Crimson Text', serif;
    font-size: 1.05em;
    font-style: italic;
    color: var(--accent-purple) !important;
    margin: 0.5em 0 0.25em;
}

/* Tempus visibility (toggled by JS) */
[tempus="-pasch"] {
    display: inline;
}

[tempus="pasch"] {
    display: none;
}

.tempus-pasch [tempus="-pasch"] {
    display: none;
}

.tempus-pasch [tempus="pasch"] {
    display: inline;
}

/* --- Auto Light/Dark Mode Detection --- */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --primary-color: #4f46e5;
        --primary-light: #6366f1;
        --accent-purple: #9333ea;
        --background-base: #f6f6f8;
        --background-surface: #ffffff;
        --background-highlight: #e2e8f0;
        --text-primary: #0f172a;
        --text-secondary: #64748b;
        --text-tertiary: #cbd5e1;
        --border-color: rgba(0, 0, 0, 0.08);
    }

    :root:not([data-theme="dark"]) .app-header {
        background-color: rgba(246, 246, 248, 0.92);
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }

    :root:not([data-theme="dark"]) .bottom-nav-inner {
        background-color: rgba(246, 246, 248, 0.92);
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    :root:not([data-theme="dark"]) .bottom-nav::before {
        background: linear-gradient(to top, var(--background-base), transparent);
    }

    :root:not([data-theme="dark"]) .chant-preview svg {
        filter: none;
    }

    :root:not([data-theme="dark"]) .modern-select {
        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='black' 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");
    }

    :root:not([data-theme="dark"]) #themeToggle {
        background: rgba(0, 0, 0, 0.04);
        border: 1px solid rgba(0, 0, 0, 0.08);
        color: var(--text-primary);
    }

    :root:not([data-theme="dark"]) .segment.active {
        background-color: #ffffff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    :root:not([data-theme="dark"]) .gabc-editor {
        background-color: #f5f5f5;
        color: #2e7d32;
    }

    :root:not([data-theme="dark"]) .chant-item {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
}

/* ===== Settings Panel ===== */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.icon-btn:hover {
    background: rgba(var(--primary-color-rgb, 99, 102, 241), 0.1);
}

.settings-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.settings-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -320px;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 910;
    background: var(--surface-primary, #1a1a2e);
    border-left: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.active {
    right: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.settings-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-header .icon-btn {
    font-size: 1.5rem;
    line-height: 1;
}

.settings-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.settings-group {
    margin-bottom: 24px;
}

.settings-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    margin-bottom: 10px;
    font-weight: 500;
}

.settings-options {
    display: flex;
    gap: 8px;
}

.settings-option {
    flex: 1;
    padding: 9px 0;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    background: var(--surface-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    cursor: pointer;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s;
}

.settings-option:hover {
    background: rgba(var(--primary-color-rgb, 99, 102, 241), 0.08);
    border-color: rgba(var(--primary-color-rgb, 99, 102, 241), 0.3);
}

.settings-option.active {
    background: var(--primary-color, #6366f1);
    color: #fff;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb, 99, 102, 241), 0.3);
}

.settings-colors {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    border-color: var(--text-primary, #fff);
    transform: scale(1.1);
    box-shadow: 0 0 0 2px var(--surface-primary, #1a1a2e), 0 0 12px rgba(var(--primary-color-rgb), 0.4);
}

/* ===== Selector Bar ===== */
.selector-bar {
    background: var(--surface-primary, #ffffff);
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
    padding: 12px 16px;
    position: sticky;
    top: 60px;
    /* Below header */
    z-index: 99;
}

:root[data-theme="dark"] .selector-bar {
    background: var(--surface-primary, #1a1a2e);
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selector-group.hidden {
    display: none;
}

/* Modern Select Styling */
.modern-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--surface-secondary, #f3f4f6);
    border: 1px solid var(--border-subtle, #e5e7eb);
    border-radius: 8px;
    padding: 10px 14px;
    padding-right: 36px;
    font-size: 0.95rem;
    color: var(--text-primary, #111827);
    width: 100%;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: all 0.2s;
}

:root[data-theme="dark"] .modern-select {
    background-color: var(--surface-secondary, rgba(255, 255, 255, 0.05));
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #f9fafb);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
}

.modern-select:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 99, 102, 241), 0.15);
}

/* Year Segmented Control */
.year-segments {
    display: flex;
    background: var(--surface-secondary, #f3f4f6);
    padding: 4px;
    border-radius: 8px;
    width: 100%;
}

:root[data-theme="dark"] .year-segments {
    background: var(--surface-secondary, rgba(255, 255, 255, 0.05));
}

.segment {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary, #6b7280);
    padding: 6px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

:root[data-theme="dark"] .segment {
    color: var(--text-secondary, #9ca3af);
}

.segment.active {
    background: var(--surface-primary, #ffffff);
    color: var(--primary-color, #6366f1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

:root[data-theme="dark"] .segment.active {
    background: var(--surface-tertiary, #2e2e42);
    color: var(--primary-light, #818cf8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ===== Ad Libitum Search ===== */
.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    background-color: var(--surface-secondary, rgba(255,255,255,0.05));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 10px 14px 10px 38px;
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 99,102,241), 0.15);
}

[data-theme="light"] .search-input {
    background-color: #fff;
    border-color: rgba(0,0,0,0.1);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--background-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
}

.search-result-item {
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    line-height: 1.4;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--background-highlight);
    color: var(--primary-light);
}

/* 5-tab bottom nav — slightly smaller labels */
.bottom-nav .nav-item span {
    font-size: 0.6rem;
}

/* Inline header dropdown */
#headerDropdown {
    position: fixed;
    left: 0;
    right: 0;
    background: var(--background-surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    z-index: 500;
    max-height: 65vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: none;
}
#headerDropdown.open {
    display: block;
    animation: dropdownReveal 0.18s ease;
}
@keyframes dropdownReveal {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hdd-group {
    padding: 10px 20px 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent-purple);
    background: var(--background-highlight);
    position: sticky;
    top: 0;
    z-index: 1;
}
.hdd-item {
    padding: 13px 20px;
    font-size: 1rem;
    font-family: 'Libre Baskerville', serif;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
.hdd-item:last-child { border-bottom: none; }
.hdd-item:hover { background: var(--background-highlight); }
.hdd-item.selected {
    color: var(--primary-color);
    font-weight: 700;
    background: rgba(168,85,247,0.07);
}
[data-theme="light"] .hdd-item.selected {
    background: rgba(79,70,229,0.07);
}

/* Modern Select (used for Ordinarium in settings) */
.modern-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--surface-secondary, rgba(255,255,255,0.05));
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    color: var(--text-primary);
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    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='currentColor' 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: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modern-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 99,102,241), 0.15);
}
[data-theme="light"] .modern-select {
    background-color: #fff;
    border-color: rgba(0,0,0,0.1);
    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='%234b5563' 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");
}

/* Ad Libitum search in body */
.adlibitum-body-search {
    width: 100%;
}
.adlibitum-body-search .search-input-wrapper {
    position: relative;
}
.adlibitum-body-search .search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: var(--background-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    max-height: 260px;
    overflow-y: auto;
    z-index: 600;
}

/* --- Modern Sticky Player Bar (Spotify Style) --- */
.modern-player-bar {
    position: fixed;
    bottom: 82px; /* Sits exactly above the bottom navigation */
    left: 0;
    right: 0;
    height: auto;
    padding: 12px 0;
    background: var(--surface-secondary, #1a1a24);
    border-top: 1px solid var(--border-subtle, rgba(255,255,255,0.05));
    border-bottom: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    z-index: 1000;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.4s;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
[data-theme="light"] .modern-player-bar {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0,0,0,0.08);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
}
.modern-player-bar.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* --- Progress Bar --- */
.player-progress-container {
    position: absolute;
    top: -15px; /* Shift up so the clickable area overlaps the border */
    left: 0;
    right: 0;
    height: 30px; /* Huge clickable area for fat fingers */
    cursor: pointer;
    background: transparent;
    z-index: 10;
}
.player-progress-bar {
    position: absolute;
    bottom: 12px; /* Center the visible bar inside the 30px container */
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(100, 100, 100, 0.2);
    transition: height 0.2s ease;
}
.player-progress-container:hover .player-progress-bar {
    height: 6px;
    bottom: 11px;
}
.player-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color, #4f46e5);
    border-radius: 0 4px 4px 0;
    transition: width 0.1s linear;
}

/* Hide the legacy util.js popup completely */
#mediaControls {
    display: none !important;
}

/* --- Advanced Note Popup (.chant-context) --- */
.chant-context {
    position: absolute;
    background: var(--surface-primary, #ffffff);
    border: 1px solid var(--border-color, rgba(0,0,0,0.1));
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 1050;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}
[data-theme="dark"] .chant-context {
    background: var(--surface-secondary, #2a2a35);
    border: 1px solid var(--border-subtle, rgba(255,255,255,0.1));
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.chant-context .btn-group {
    display: flex;
    width: 100%;
}
.chant-context button {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.05));
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    font-weight: 500;
}
[data-theme="dark"] .chant-context button {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.chant-context button:hover {
    background: var(--surface-hover, rgba(0,0,0,0.05));
}
.chant-context button.btn-primary {
    background: var(--primary-color, #4f46e5);
    color: white;
}
.chant-context button.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}
[data-theme="dark"] .chant-context button.btn-success {
    color: #34d399;
}
.chant-context button.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.chant-context button.btn-info {
    background: var(--surface-tertiary, rgba(0,0,0,0.03));
}
[data-theme="dark"] .chant-context button.btn-info {
    background: rgba(255,255,255,0.05);
}
/* Hide the redundant Play and Pitch buttons in the popup since they are in the modern player bar */
.chant-context .btn-group,
.chant-context button.disabled {
    display: none !important;
}


.player-bar-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

/* Left: Info */
.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 30%;
    min-width: 0;
}
.player-note-icon {
    display: none; /* Removed as requested */
}
.player-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.player-chant-name {
    font-family: 'Libre Baskerville', 'Crimson Text', serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-chant-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Center controls (Now pushed right) */
.player-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex: 0 0 auto;
}
.player-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
}
.player-btn-secondary {
    width: 44px;
    height: 44px;
    background: var(--surface-tertiary, rgba(100,100,100,0.1));
}
.player-btn-secondary:hover {
    background: rgba(100,100,100,0.2);
    transform: scale(1.05);
}
.player-btn-secondary:active {
    transform: scale(0.95);
}
.player-btn-primary {
    background: var(--primary-color, #4f46e5);
    color: #ffffff !important;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.player-btn-primary svg {
    fill: #ffffff !important;
}
.player-btn-primary:hover {
    transform: scale(1.05);
    background: var(--primary-color-hover, #4338ca);
}
.player-btn-primary:active {
    transform: scale(0.95);
}

/* Options (Now on its own full-width row) */
.player-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex: 1 1 100%;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.05));
    font-family: 'Inter', sans-serif;
}
[data-theme="dark"] .player-options {
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Remove the old media query that forces 3 lines, because it's now 2 lines naturally via flex-wrap! */
@media (max-width: 768px) {
    .modern-player-bar {
        bottom: 74px; /* Adjust for bottom nav */
    }
    .player-options {
        flex-wrap: nowrap; /* Force all parameters on the same line as requested */
        gap: 8px;
        justify-content: space-around;
    }
}
.player-tempo-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.player-btn-option {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.player-btn-option:hover {
    color: var(--primary-color);
}
.player-btn-option.active {
    color: var(--primary-color);
}
.player-tempo-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

[data-theme="dark"] .player-btn-option.active {
    filter: invert(53%) sepia(85%) saturate(2227%) hue-rotate(222deg) brightness(101%) contrast(92%); /* Approximates primary color */
}

#playerPitchDown, #playerPitchUp, #playerBtnSolesmes, .tempo-minus, .tempo-plus {
    background: var(--surface-tertiary, rgba(100,100,100,0.1));
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    width: 32px !important;
    height: 32px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
[data-theme="light"] #playerPitchDown, [data-theme="light"] #playerPitchUp, [data-theme="light"] #playerBtnSolesmes, [data-theme="light"] .tempo-minus, [data-theme="light"] .tempo-plus {
    background: rgba(100,100,100,0.1);
}
#playerPitchDown:active, #playerPitchUp:active, #playerBtnSolesmes:active, .tempo-minus:active, .tempo-plus:active {
    transform: scale(0.9);
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Card active playing state */
.chant-card.is-playing {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

/* Note Highlighting (SVG) */
svg.ChantScore use[source-index].active {
    fill: var(--primary-color, #ef5350) !important;
    color: var(--primary-color, #ef5350) !important;
    filter: drop-shadow(0px 0px 3px rgba(239, 83, 80, 0.5));
}
svg.ChantScore text[source-index].active {
    fill: var(--primary-color, #ef5350) !important;
}
svg.ChantScore use[source-index] {
    cursor: pointer;
    transition: fill 0.2s;
}
svg.ChantScore use[source-index]:hover {
    fill: var(--primary-light, #ff8a80) !important;
}