:root {
    --bg: #0d0c12;
    --bg-soft: #1b1a22;
    --bg-card: rgba(33, 32, 43, 0.85);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --primary: #ff3b5c;
    --primary-soft: rgba(255, 59, 92, 0.18);
    --text: #f5f5f5;
    --text-muted: #a6a6b7;
    --shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
    --surface: #1b1a22;
    font-family: 'Poppins', sans-serif;
}

/* Light Theme */
[data-theme="light"] {
    --bg: #f8f9fa;
    --bg-soft: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --primary: #ff3b5c;
    --primary-soft: rgba(255, 59, 92, 0.08);
    --text: #1a1a1a;
    --text-muted: #6b6b7b;
    --shadow: 0 24px 48px rgba(0, 0, 0, 0.08);
    --surface: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(circle at top right, rgba(255, 59, 92, 0.12), transparent 40%), var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light theme specific adjustments */
[data-theme="light"] body {
    background: radial-gradient(circle at top right, rgba(255, 59, 92, 0.06), transparent 40%), var(--bg);
}

[data-theme="light"] .app-header {
    background: rgba(248, 249, 250, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Light theme - text inputs and textareas */
[data-theme="light"] input,
[data-theme="light"] textarea {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus {
    background: #ffffff;
    border-color: rgba(255, 59, 92, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.08);
}

/* Light theme - editor panel textareas specifically */
[data-theme="light"] .editor-panel textarea {
    background: #ffffff;
    color: var(--text);
}

[data-theme="light"] .editor-panel textarea:focus {
    background: #ffffff;
}

/* Light theme - cards and panels */
[data-theme="light"] .step-card,
[data-theme="light"] .editor-panel,
[data-theme="light"] .preview-panel,
[data-theme="light"] .ai-reference-preview,
[data-theme="light"] .preview-container {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Light theme - step number badges */
[data-theme="light"] .step-number {
    background: rgba(255, 59, 92, 0.15);
    color: #e5334f;
}

/* Light theme - buttons */
[data-theme="light"] .ghost-button {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .ghost-button:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .primary-action {
    box-shadow: 0 4px 12px rgba(255, 59, 92, 0.25);
}

/* Light theme - status and messages */
[data-theme="light"] .status-panel {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--border);
}

/* Light theme - preview and print areas */
[data-theme="light"] .live-preview {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Light theme - Visualizer promo section */
[data-theme="light"] .visualizer-promo {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Light theme - modal overlays */
[data-theme="light"] .modal-overlay {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .modal-container {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Light theme - modal inputs */
[data-theme="light"] .modal-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-input:focus {
    outline: 2px solid rgba(255, 59, 92, 0.25);
}

/* Light theme - donation input */
[data-theme="light"] .donation-input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text);
}

/* Light theme - mini preview */
[data-theme="light"] .mini-preview {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.2);
}

/* Light theme - profile menu */
[data-theme="light"] #profileMenu {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Theme toggle button styling */
#themeToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#themeToggle:hover {
    transform: rotate(20deg);
}

#themeToggle svg {
    transition: all 0.3s ease;
}

a {
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 90px 24px 60px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: rgba(13, 12, 18, 0.8);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.nav-logo span {
    color: var(--primary);
}

.nav-donate {
    background: transparent;
    color: var(--text);
    padding: 10px 24px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 59, 92, 0.3);
}

.nav-donate:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 59, 92, 0.5);
}

.app-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex: 1;
    flex-wrap: wrap;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.nav-cta {
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 59, 92, 0.25);
}

.nav-cta:hover,
.nav-cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 59, 92, 0.35);
}

.hero {
    display: grid;
    gap: 32px;
    align-items: center;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    margin-bottom: 40px;
}

.hero-text h1 {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-text p {
    color: var(--text-muted);
    max-width: 520px;
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.primary-action,
.secondary-action,
.ghost-button {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Smaller buttons inside step cards */
.step-card .primary-action,
.step-card .ghost-button {
    font-size: 0.8rem;
    padding: 8px 14px;
}

.primary-action {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 24px rgba(255, 59, 92, 0.23);
}

.primary-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.primary-action:not(:disabled):hover,
.primary-action:not(:disabled):focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(255, 59, 92, 0.28);
}

.secondary-action {
    border: 1px solid var(--border);
    color: var(--text);
    background: transparent;
}

.secondary-action:hover,
.secondary-action:focus-visible {
    border-color: var(--primary);
    color: #fff;
}

/* Display Toggle Buttons */
.display-toggle {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: var(--text-muted) !important;
    opacity: 0.7;
    transition: all 0.2s ease !important;
}

.display-toggle:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1) !important;
}

.display-toggle.active {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
    color: #10b981 !important;
    opacity: 1;
}

[data-theme="light"] .display-toggle {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: var(--text-muted) !important;
}

[data-theme="light"] .display-toggle.active {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #059669 !important;
}

/* Preview Header Row */
.preview-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
}

.preview-header-row h2 {
    margin: 0;
    margin-right: 8px;
    white-space: nowrap;
}

.header-spacer {
    flex: 1;
    min-width: 10px;
}

.header-btn {
    font-size: 13px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] .header-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Mobile responsive header */
@media (max-width: 768px) {
    .preview-header-row {
        gap: 6px;
        justify-content: center;
    }

    .preview-header-row h2 {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }

    .header-spacer {
        display: none;
    }

    .header-btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

.hero-preview {
    background: linear-gradient(180deg, rgba(30, 30, 42, 0.85) 0%, rgba(25, 24, 32, 0.9) 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px;
    box-shadow: var(--shadow);
    position: relative;
}

.hero-mockup {
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.hero-mockup-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-weight: 600;
}

.mockup-title {
    font-size: 1.1rem;
}

.mockup-key {
    color: var(--primary);
}

.hero-mockup-body {
    display: grid;
    gap: 12px;
}

.mockup-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.mockup-chord {
    font-weight: 600;
    color: var(--primary);
    width: 52px;
}

.mockup-lyric {
    color: rgba(255, 255, 255, 0.84);
    flex: 1;
    padding-left: 16px;
}

.hero-caption {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.workflow h2,
.editor h2,
.next-steps h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
}

.workflow-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-card h3 {
    font-size: 1rem;
    margin: 0;
}

.step-card p {
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
    color: var(--text-muted);
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.upload-tile {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: border 0.2s ease, background 0.2s ease;
}

.upload-tile:hover,
.upload-tile:focus {
    border-color: var(--primary);
    background: rgba(255, 59, 92, 0.08);
}

.upload-icon {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 6px;
}

.upload-label {
    font-weight: 600;
    display: block;
    font-size: 0.85rem;
}

.upload-note {
    font-size: 0.7rem;
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.preview-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.preview-panel img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
    display: none;
}

.preview-placeholder {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.75rem;
}

/* AI Reference Preview in Step 3 */
.ai-reference-preview {
    margin-top: 12px;
}

.ai-reference-preview h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--text);
}

.reference-subtitle {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0 0 8px 0;
}

.reference-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
    color: var(--text);
}

.reference-content .preview-placeholder {
    text-align: center;
    display: block;
    padding: 20px 10px;
    font-size: 0.7rem;
}

.status-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 8px 12px;
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.status-panel.processing {
    background: rgba(255, 209, 92, 0.1);
    border-color: rgba(255, 209, 92, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-flex;
    flex-shrink: 0;
}

.status-dot.idle {
    background: var(--text-muted);
}

.status-dot.processing {
    background: #ffd15c;
    animation: pulse 1.2s infinite ease-in-out;
    box-shadow: 0 0 8px rgba(255, 209, 92, 0.8);
}

.status-dot.success {
    background: #4fd18b;
}

.status-dot.error {
    background: #ff3b5c;
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.status-panel.processing .status-text {
    color: #ffd15c;
    font-weight: 500;
}

.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-panel.processing .progress-bar-container {
    opacity: 1;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff3b5c, #ffd15c, #4fd18b);
    background-size: 200% 100%;
    animation: progressShimmer 2s linear infinite;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 15px rgba(255, 209, 92, 0.6), 0 0 5px rgba(255, 209, 92, 0.8);
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.status-hint {
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.3;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.4);
        opacity: 0.5;
    }
}

.feature-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    color: var(--text-muted);
    display: grid;
    gap: 4px;
    font-size: 0.8rem;
}

.editor {
    position: relative;
    z-index: 0;
    margin-top: 20px;
    margin-bottom: 48px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editor-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.transpose-controls {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.transpose-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px 10px;
    color: var(--text-muted);
}

.transpose-label input {
    width: 64px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}

.transpose-label input:focus {
    outline: none;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost-button:hover,
.ghost-button:focus-visible {
    background: rgba(255, 255, 255, 0.12);
}

.column-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Layout dropdowns (columns and pages) */
.layout-select {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    min-width: 110px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 28px;
}

.layout-select:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

.layout-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.editor-actions {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
}

.editor-columns {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.editor-columns-three {
    grid-template-columns: repeat(3, 1fr);
}

.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor-panel header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-panel header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.editor-panel header small {
    color: var(--text-muted);
    font-size: 0.85rem;
}


.visual-editor-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.visual-editor-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.mini-preview {
    width: 100%;
    min-height: 480px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(20, 20, 28, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.mini-preview img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    display: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.mini-preview .mini-preview-placeholder {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.4;
}

.reanalyze-block {
    display: none; /* Temporarily hidden until feedback flow is ready */
}

.reanalyze-block label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.reanalyze-block textarea {
    width: 100%;
    min-height: 80px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(20, 20, 28, 0.7);
    color: var(--text);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.reanalyze-block textarea:focus {
    outline: none;
    border-color: rgba(255, 59, 92, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.1);
}

.editor-panel textarea {
    min-height: 340px;
    resize: vertical;
    background: rgba(10, 10, 18, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 16px;
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

.editor-panel textarea:focus {
    outline: none;
    border-color: rgba(255, 59, 92, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.1);
}

/* Visual Editor - make it taller for better editing */
#visualEditor {
    min-height: 500px;
    font-size: 10px;
    white-space: pre;
    overflow-x: auto;
    word-wrap: normal;
}

/* SongBook Format - make it shorter since it's just a reference */
#songbookOutput {
    min-height: 200px;
}

.next-steps {
    margin-top: 80px;
}

.next-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.next-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.next-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.next-card p {
    margin: 0;
    color: var(--text-muted);
}

.next-footer {
    color: var(--text-muted);
    margin-top: 24px;
}

.next-footer a {
    color: var(--primary);
}

/* Donation Section Styles */
.donation-amount-container {
    margin-bottom: 20px;
    text-align: left;
}

.donation-label {
    display: block;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.donation-input {
    width: 100%;
    background: rgba(10, 10, 18, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.2s ease, outline 0.2s ease;
}

.donation-input:focus {
    outline: 2px solid rgba(255, 59, 92, 0.35);
    border-color: var(--primary);
}

.donation-input::placeholder {
    color: var(--text-muted);
}

.app-footer {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: rgba(13, 12, 18, 0.9);
}

/* Live Print Preview Section */
.preview-section {
    margin: 48px 0;
}

.preview-section-content {
    position: relative;
    z-index: 1;
}

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

.preview-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.preview-controls-row {
    width: 100%;
    margin-bottom: 32px;
}

.preview-controls {
    display: flex;
    gap: 24px;
    align-items: center;
}

.font-size-control,
.line-height-control,
.char-spacing-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.font-size-control span,
.line-height-control span,
.char-spacing-control span {
    display: inline-block;
    min-width: 35px;
    color: var(--text);
    font-weight: 500;
}

.preview-controls input[type="range"] {
    width: 120px;
    accent-color: var(--primary);
}

/* Mobile: Stack controls vertically */
@media (max-width: 768px) {
    .preview-controls-row > div {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .font-size-control,
    .line-height-control,
    .char-spacing-control {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        width: 100%;
    }

    .preview-controls-row label {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        width: 100%;
    }

    /* Layout Customization - Row 0: Display controls (2-column grid) */
    .layout-controls-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
        align-items: stretch !important;
    }

    .layout-controls-row > div,
    .layout-controls-row > label {
        width: 100%;
        min-width: 0 !important;
        justify-content: center;
    }

    /* Badges checkbox - full width */
    .layout-controls-row > label:last-child {
        grid-column: 1 / -1;
    }

    /* Layout Customization - Row 1: Sliders (stack vertically) */
    .layout-sliders-row {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .layout-sliders-row > label {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        width: 100%;
    }
}

.preview-container {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 210mm; /* A4 width */
    min-height: 297mm; /* A4 height */
    max-width: 100%;
    margin: 0 auto;
}

.live-preview {
    font-family: 'Courier New', monospace;
    font-size: 8.5pt;
    line-height: 1.5;
    color: black;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 8px 20px 20px 20px;
    columns: 2;
    column-gap: 40px;
    column-fill: auto;
    margin: 0 auto;
    position: relative;
    min-height: 297mm; /* A4 height */
    /* Direction will be set dynamically by JavaScript based on content */
}

.live-preview > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Preview Logo - The Faith Sound */
.preview-page {
    position: relative;
}

.preview-logo {
    position: absolute;
    top: 11px;
    right: 0;
    z-index: 10;
    opacity: 0.85;
    pointer-events: none;
    direction: ltr; /* Always render logo LTR regardless of content direction */
}

/* RTL: Move logo to left corner */
.preview-page:has(.live-preview[dir="rtl"]) .preview-logo,
.preview-page[dir="rtl"] .preview-logo {
    right: auto;
    left: 20px;
    direction: ltr; /* Keep logo text LTR */
}

/* Print styles for logo */
@media print {
    .preview-logo {
        position: absolute;
        top: 5mm;
        right: 0;
        opacity: 0.7;
        direction: ltr;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    [dir="rtl"] .preview-logo {
        right: auto;
        left: 20px;
    }
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6);
    max-width: 480px;
    width: 100%;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.modal-body {
    padding: 24px 28px;
}

.modal-body p {
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.modal-input {
    width: 100%;
    background: rgba(10, 10, 18, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.2s ease, outline 0.2s ease;
}

.modal-input:focus {
    outline: 2px solid rgba(255, 59, 92, 0.35);
    border-color: var(--primary);
}

.modal-input::placeholder {
    color: var(--text-muted);
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px 28px 24px;
    justify-content: flex-end;
}

.modal-footer .ghost-button,
.modal-footer .primary-action {
    min-width: 100px;
}

@media (max-width: 720px) {
    .header-container {
        padding: 0 16px;
    }

    .nav-logo {
        font-size: 1.2rem;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-header .primary-action {
        width: 100%;
    }

    .nav-menu {
        display: none;
    }

    .nav-cta {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .container {
        padding-top: 136px;
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .editor-header {
        align-items: flex-start;
    }

    .preview-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .preview-controls input[type="range"] {
        width: 100%;
    }

    .transpose-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .transpose-controls .ghost-button {
        flex: 1;
        min-width: 60px;
    }

    .transpose-label {
        flex: 1 1 100%;
        margin-top: 8px;
    }

    .transpose-label input {
        width: 100%;
    }

    .mini-preview {
        max-width: 100%;
        min-height: 240px;
    }

    .modal-container {
        margin: 0 16px;
        max-width: calc(100% - 32px) !important;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .ghost-button,
    .modal-footer .primary-action {
        width: 100%;
    }

    /* Subscription modal mobile fixes */
    #subscriptionModal .modal-container {
        max-width: calc(100vw - 32px) !important;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    #subscriptionModal .modal-body {
        padding: 16px !important;
    }

    #subscriptionModal .pricing-card {
        min-width: 100% !important;
        padding: 20px !important;
    }

    #subscriptionModal .modal-body > div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* Make pricing cards stack on mobile */
    .pricing-card h3 {
        font-size: 1.2rem !important;
    }

    .pricing-card ul {
        font-size: 13px !important;
    }
}

/* Live Preview - Minimalist Chord Sheet Styling */
#livePreview {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
    padding: 8px 16px;
    font-size: 14px;
    /* Prevent orphan/widow lines for better column breaks */
    orphans: 3;
    widows: 3;
}

/* Style chords bold and inline */
#livePreview b {
    color: #000;
    font-weight: 600;
    font-size: 1em;
}

/* Song Header Container - fixed line-height */
.song-header {
    line-height: 1.4 !important;
    column-span: all;
    -webkit-column-span: all;
    margin: 0;
    padding: 0;
}

.song-header:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove gap between header and first section */
.song-header + .song-section-block,
.song-header + * {
    margin-top: 0 !important;
}

/* Minimalist Title */
.song-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px 0;
    text-align: start;
    column-span: all;
    -webkit-column-span: all;
    display: block;
    width: 100%;
}

/* Minimalist Metadata */
.song-meta {
    text-align: start;
    font-size: 12px;
    margin: 0 0 2px 0;
    color: #666;
    column-span: all;
    -webkit-column-span: all;
    display: block;
    width: 100%;
}

/* Minimalist Section Headers */
.section-header {
    font-weight: 700;
    font-size: 14px;
    margin: 6px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Prevent section headers from breaking away from their content */
    break-after: avoid;
    -webkit-column-break-after: avoid;
    page-break-after: avoid;
}

/* ✅ CIRCULAR SECTION BADGES */
.section-badges-row {
    display: flex;
    gap: 6px;
    margin: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
    /* Span across all columns so both columns start at same height */
    column-span: all;
    -webkit-column-span: all;
    break-inside: avoid;
    page-break-inside: avoid;
    /* Ensure it stays together */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* RTL: Align badges to the right to match first column */
[dir="rtl"] .section-badges-row,
.live-preview[dir="rtl"] .section-badges-row {
    justify-content: flex-end;
}

/* Reduce space after badges row */
.section-badges-row + * {
    margin-top: 0 !important;
}

/* Hide badges when checkbox is unchecked */
.hide-badges .section-badges-row {
    display: none !important;
}

/* Styled prompt modal - higher z-index to appear above other modals */
#styledPromptModal {
    z-index: 99999 !important;
}

/* Hide scrollbar for webkit browsers but keep functionality */
.section-badges-row::-webkit-scrollbar {
    height: 4px;
}

.section-badges-row::-webkit-scrollbar-track {
    background: transparent;
}

.section-badges-row::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 2px;
}

.section-badges-row::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    border-radius: 50%;
    font-weight: 600;
    font-size: 12px !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    border: 2px solid;
    padding: 0 6px;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Mobile: Auto-resize circles to fit all in one row */
@media (max-width: 768px) {
    .section-badges-row {
        overflow-x: visible; /* Remove scroll on mobile */
        justify-content: space-between;
        gap: 3px; /* Reduce gap from 6px to 3px */
        margin: 2px 0; /* Reduce margin from 4px to 2px */
    }

    .section-badge {
        /* Calculate size to fit 10 badges with smaller gaps */
        /* Formula: (100% - (9 gaps × 3px)) / 10 badges */
        min-width: calc((100% - 27px) / 10);
        max-width: calc((100% - 27px) / 10);
        width: calc((100% - 27px) / 10);
        height: auto;
        aspect-ratio: 1 / 1; /* Keep circles perfectly round */
        padding: 0; /* Remove padding to save space */
        font-size: clamp(8px, 2.5vw, 11px) !important; /* Responsive font size */
        line-height: normal !important;
        letter-spacing: normal !important;
        border-width: 1.5px; /* Slightly thinner border on mobile */
        flex-shrink: 1; /* Allow shrinking if needed */
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .section-badges-row {
        gap: 2px; /* Even smaller gap on very small screens */
        margin: 1px 0;
    }

    .section-badge {
        /* Recalculate for 2px gaps */
        min-width: calc((100% - 18px) / 10);
        max-width: calc((100% - 18px) / 10);
        width: calc((100% - 18px) / 10);
        font-size: clamp(7px, 2.2vw, 9px) !important;
        line-height: normal !important;
        letter-spacing: normal !important;
        border-width: 1px;
        padding: 0;
    }
}

/* Badge Colors - Matching Screenshot */
.badge-intro {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #3b82f6;
}

.badge-verse {
    background: rgba(168, 85, 247, 0.1);
    border-color: #a855f7;
    color: #a855f7;
}

.badge-chorus {
    background: rgba(249, 115, 22, 0.1);
    border-color: #f97316;
    color: #f97316;
}

.badge-bridge {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.badge-prechorus {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    color: #22c55e;
}

.badge-outro {
    background: rgba(236, 72, 153, 0.1);
    border-color: #ec4899;
    color: #ec4899;
}

.badge-other {
    background: rgba(156, 163, 175, 0.1);
    border-color: #9ca3af;
    color: #9ca3af;
}

/* Repeat count superscript - small number showing how many times a section repeats */
.repeat-count {
    font-size: 10px;
    font-weight: 700;
    margin-left: 2px;
    vertical-align: super;
    position: relative;
    top: -2px;
}

/* ✅ EDITOR SONG STRUCTURE BADGES */
.editor-song-structure {
    margin: 12px 0;
    padding: 12px;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
}

/* Song Section Blocks - Minimal spacing for space efficiency */
.song-section-block {
    margin: 1px 0;
    padding: 2px 4px;
    border: 1px dashed #f97316; /* ORANGE DASHED BORDER - section blocks */
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    background-color: rgba(249, 115, 22, 0.02); /* Very subtle orange tint */
    /* Keep each section block together - don't split across columns/pages */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
}

/* Subtle hover effect for leader to know sections are clickable */
.song-section-block:hover {
    background-color: rgba(139, 92, 246, 0.05);
}

/* Selected section - soft 2-second blinking animation */
.song-section-block.section-selected {
    border-color: rgba(139, 92, 246, 1);
    border-width: 2px;
    background: rgba(139, 92, 246, 0.15);
    animation: sectionBlink 1s ease-in-out 2;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

@keyframes sectionBlink {
    0%, 100% {
        background: rgba(139, 92, 246, 0.08);
        box-shadow: 0 0 4px rgba(139, 92, 246, 0.3);
    }
    50% {
        background: rgba(139, 92, 246, 0.25);
        box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
    }
}

/* Static border after animation - subtle but visible */
.song-section-block.section-selected-static {
    border-color: rgba(139, 92, 246, 0.7);
    border-width: 2px;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1);
}

/* Overflow Notification Toast */
.overflow-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.98) 0%, rgba(251, 140, 0, 0.98) 100%);
    border: 2px solid rgba(255, 152, 0, 0.5);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(255, 152, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    max-width: 400px;
    opacity: 0;
    transform: translateX(450px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.overflow-notification.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.overflow-notification-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: white;
}

.overflow-icon {
    font-size: 28px;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.overflow-text {
    flex: 1;
}

.overflow-text strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.overflow-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
    line-height: 1.4;
}

.overflow-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.overflow-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Success Toast Notification */
.success-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.98) 0%, rgba(56, 142, 60, 0.98) 100%);
    border: 2px solid rgba(76, 175, 80, 0.5);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(76, 175, 80, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    max-width: 400px;
    opacity: 0;
    transform: translateX(450px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.success-toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.success-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 500;
    font-size: 16px;
}

.success-toast-icon {
    font-size: 28px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .success-toast {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .overflow-notification {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

/* Print Styles - Clean Chord Chart Formatting */
@media print {
    @page {
        margin: 10mm;
        size: A4;
    }

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        margin: 0;
        padding: 0;
        font-family: 'Courier New', monospace;
    }

    /* Hide everything except the live preview */
    .app-header,
    .hero,
    .workflow,
    .next-steps,
    .app-footer,
    .editor,
    .editor-workspace,
    .editor-actions-section,
    .session-section,
    .support-section,
    .visualizer-promo,
    .preview-header,
    .preview-controls-row,
    .preview-controls,
    .metadata-controls,
    .editor-actions,
    .session-controls,
    #authMessage,
    select,
    button,
    input,
    label {
        display: none !important;
    }

    .container {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Show only preview section for printing */
    .preview-section {
        display: block !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .preview-container {
        background: white !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
    }

    /* Hide A4 label during print */
    .preview-container > div[style*="position: absolute"] {
        display: none !important;
    }

    /* Show the live preview content */
    #livePreview {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
        color: black !important;
        background: white !important;
        border: none !important;
        aspect-ratio: auto !important;
        min-height: auto !important;
        font-size: 10.5pt;
        line-height: 1.5;
        columns: 2;
        column-gap: 40px;
        column-rule: 1px solid rgba(0, 0, 0, 0.2);
        column-fill: auto;
    }

    /* Style bold tags (chords) in black - minimalist */
    #livePreview b {
        color: #000 !important;
        font-weight: 600 !important;
        font-size: 1em !important;
    }

    /* Song header container - fixed line-height for print */
    .song-header {
        line-height: 1.3 !important;
        column-span: all !important;
        margin: 0 !important;
        break-after: avoid !important;
    }

    /* Minimalist print formatting */
    .song-title {
        font-size: 12pt !important;
        font-weight: 700 !important;
        text-align: start !important;
        margin: 0 0 3px 0 !important;
        column-span: all !important;
        break-after: avoid !important;
        display: block !important;
        width: 100% !important;
    }

    .song-meta {
        text-align: start !important;
        font-size: 9pt !important;
        margin: 0 0 1.5px 0 !important;
        column-span: all !important;
        break-after: avoid !important;
        color: #666 !important;
        display: block !important;
        width: 100% !important;
    }

    .section-header {
        font-weight: 700 !important;
        font-size: 10.5pt !important;
        text-transform: uppercase !important;
        margin: 12px 0 6px 0 !important;
        letter-spacing: 0.5px !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    /* Print-friendly badges */
    .section-badges-row {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 3px !important;
        margin: 4px 0 !important;
        column-span: all !important;
        justify-content: flex-start !important;
    }

    .section-badge {
        min-width: 18px !important;
        min-height: 18px !important;
        width: 18px !important;
        height: 18px !important;
        padding: 0 !important;
        font-size: 7pt !important;
        font-weight: 500 !important;
        background: #f5f5f5 !important;
        border: 1px solid #999 !important;
        color: #444 !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    /* Minimalist section blocks for print */
    .song-section-block {
        margin: 9px 0 !important;
        padding: 6px 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    /* Hide the hidden print preview div - we use livePreview instead */
    #printPreview {
        display: none !important;
    }

    /* Format the printed chord chart */
    .print-chart {
        font-family: 'Courier New', monospace;
        font-size: 11pt;
        line-height: 1.5;
        color: black;
        white-space: pre-wrap;
        page-break-inside: avoid;
    }

    .print-chart h1 {
        font-size: 16pt;
        font-weight: bold;
        margin: 0 0 6px 0;
        text-align: center;
        column-span: all;
    }

    .print-chart h2 {
        font-size: 13pt;
        font-weight: normal;
        font-style: italic;
        margin: 0 0 8px 0;
        text-align: center;
        column-span: all;
    }

    .print-chart .meta {
        font-size: 10pt;
        margin-bottom: 10px;
        column-span: all;
    }

    .print-chart .section {
        margin: 8px 0;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .print-chart .section-title {
        font-weight: bold;
        font-size: 12pt;
        margin: 8px 0 4px 0;
        break-after: avoid;
    }

    /* Prevent page breaks in the middle of sections */
    .chord-line,
    .lyric-line {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .chord-line {
        color: black;
        font-weight: bold;
        font-size: 13pt;
        margin: 0;
        line-height: 1.3;
        letter-spacing: 0.3px;
    }

    .lyric-line {
        color: black;
        margin: 0 0 6px 0;
        line-height: 1.3;
        font-size: 11pt;
    }

    @page {
        margin: 1cm;
        size: A4 portrait;
    }
}

/* ============================================
   SIDE MENU - Hamburger & Sliding Panel
   ============================================ */

/* Hamburger Button */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: relative;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.4s ease-in-out;
    transform-origin: left center;
}

.hamburger-btn:hover span {
    background: var(--text);
}

/* Hamburger to F transformation when menu is open */
.hamburger-btn.active span {
    position: absolute;
    left: 0;
}

.hamburger-btn.active span:nth-child(1) {
    /* Top line - proportional top bar of F */
    top: 0;
    width: 75%;
}

.hamburger-btn.active span:nth-child(2) {
    /* Middle line - shorter middle bar of F */
    top: 50%;
    transform: translateY(-50%);
    width: 55%;
}

.hamburger-btn.active span:nth-child(3) {
    /* Bottom line - becomes vertical stem of F */
    top: 0;
    width: 3px;
    height: 100%;
    border-radius: 2px;
}

/* Side Menu Overlay */
.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.side-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Side Menu Panel */
.side-menu-panel {
    position: fixed;
    top: 0;
    left: -340px;
    width: 320px;
    height: 100vh;
    background: var(--bg-soft);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-menu-panel.active {
    left: 0;
}

/* Side Menu Header */
.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.side-menu-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
}

.side-menu-close {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: opacity 0.2s;
}

.side-menu-close:hover {
    opacity: 0.7;
}

/* Side Menu Content (scrollable) */
.side-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* Side Menu Sections */
.side-menu-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.side-menu-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.side-menu-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Side Menu Buttons */
.side-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.side-menu-btn {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.side-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
}

.side-menu-btn.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
}

.side-menu-btn.primary:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.side-menu-btn.orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: white;
}

.side-menu-btn.orange:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.side-menu-btn.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border: none;
    color: white;
}

.side-menu-btn.purple:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.side-menu-btn.green {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: white;
}

.side-menu-btn.green:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.side-menu-btn.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
}

.side-menu-btn.blue:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.side-menu-btn.full-width {
    width: 100%;
    text-align: center;
}

/* Side Menu Row (for sliders, inputs, selects) */
.side-menu-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.side-menu-row:last-child {
    margin-bottom: 0;
}

.side-menu-row label {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 80px;
}

.side-menu-row input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    height: 6px;
}

.side-menu-row span {
    font-size: 0.85rem;
    color: var(--text);
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* Side Menu Select */
.side-menu-select {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.side-menu-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Side Menu Input */
.side-menu-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.85rem;
}

.side-menu-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Side Menu Checkbox */
.side-menu-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-width: auto !important;
}

.side-menu-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.side-menu-checkbox span {
    font-size: 0.85rem;
    color: var(--text);
    min-width: auto !important;
    text-align: left !important;
}

/* Key Grid */
.side-menu-key-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 10px 0;
}

.key-btn {
    padding: 8px 4px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.key-btn:hover {
    background: rgba(255, 59, 92, 0.15);
    border-color: var(--primary);
}

.key-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Transpose Buttons */
.side-menu-transpose-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.side-menu-transpose-btns span {
    flex: 1;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.side-menu-transpose-btns .side-menu-btn {
    padding: 8px 16px;
    text-align: center;
}

/* Light theme adjustments */
[data-theme="light"] .side-menu-panel {
    background: #ffffff;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .side-menu-header {
    background: #f8f9fa;
}

/* Only apply light background to non-colored buttons */
[data-theme="light"] .side-menu-btn:not(.primary):not(.orange):not(.purple):not(.green):not(.blue) {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .side-menu-btn:not(.primary):not(.orange):not(.purple):not(.green):not(.blue):hover {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .side-menu-select,
[data-theme="light"] .side-menu-input {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .key-btn {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .key-btn:hover {
    background: rgba(255, 59, 92, 0.1);
}

/* Mobile adjustments for side menu */
@media (max-width: 768px) {
    .side-menu-panel {
        width: 85vw;
        max-width: 320px;
        left: -90vw;
    }
}
