:root {
            --bg-color: #f3f4f6;
            --paper-color: #ffffff;
            --border-color: #d1d5db;
            --text-color: #111827;
            --active-tab: #2563eb;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', system-ui, sans-serif;
        }

        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* Chia đôi màn hình */
        .container {
            display: flex;
            width: 100%;
            height: 100%;
        }

        /* Khung Editor (Bên trái) */
        .editor-section {
            width: 40%;
            height: 100%;
            display: flex;
            flex-direction: column;
            border-right: 1px solid var(--border-color);
            background: #fff;
        }

        /* Tabs Header */
        .tabs-header {
            display: flex;
            background: #1f2937;
        }
        .tab-btn {
            flex: 1;
            padding: 12px 15px;
            background: transparent;
            color: #9ca3af;
            border: none;
            cursor: pointer;
            font-weight: bold;
            font-size: 0.95rem;
            transition: all 0.2s;
            border-bottom: 3px solid transparent;
        }
        .tab-btn:hover {
            color: #fff;
            background: #374151;
        }
        .tab-btn.active {
            color: #fff;
            border-bottom: 3px solid var(--active-tab);
            background: #374151;
        }

        .toolbar {
            padding: 15px;
            background: #f9fafb;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .toolbar button {
            background: #000;
            color: #fff;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            font-weight: 500;
        }

        .toolbar button:hover {
            background: #333;
        }

        /* Editor Panels */
        .editor-panel {
            display: none;
            flex-direction: column;
            flex-grow: 1;
            height: 100%;
        }
        .editor-panel.active {
            display: flex;
        }

        .editor-footer {
            margin-top: auto; /* Push to bottom */
            padding: 15px 20px;
            background: #fff;
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            justify-content: center;
            font-size: 0.85rem;
        }
        .editor-footer a {
            color: #4b5563;
            text-decoration: none;
            transition: color 0.2s;
        }
        .editor-footer a:hover {
            color: var(--active-tab);
            text-decoration: underline;
        }

        .mobile-only {
            display: none;
        }
        @media (max-width: 768px) {
            .desktop-only {
                display: none;
            }
            .editor-footer.mobile-only {
                display: flex;
                margin-top: auto;
                margin-bottom: 0;
                padding-bottom: 15px;
                border-top: none;
                background: transparent;
                font-size: 11px;
            }
        }

        textarea {
            flex-grow: 1;
            width: 100%;
            resize: none;
            padding: 20px;
            font-family: monospace;
            font-size: 14px;
            border: none;
            outline: none;
            background: #282c34;
            color: #abb2bf;
            line-height: 1.5;
        }

        /* Khung Giấy (Bên phải) */
        .paper-section {
            width: 60%;
            height: 100%;
            padding: 40px;
            overflow-y: auto;
            background-color: #e5e7eb;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }

        .paper {
            width: 100%;
            max-width: 850px;
            min-height: 1100px;
            background: var(--paper-color);
            box-shadow: 0 4px 6px rgba(0,0,0,0.1);
            padding: 40px;
            border: 1px solid #d1d5db;
        }

        .paper-view {
            display: none;
        }
        .paper-view.active {
            display: block;
        }

        /* Modal Styles */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.6);
            z-index: 2000;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }
        .modal-overlay.active {
            display: flex;
        }
        .modal-content {
            background: #fff;
            padding: 30px;
            border-radius: 12px;
            width: 100%;
            max-width: 550px;
            position: relative;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
            max-height: 90vh;
            overflow-y: auto;
        }
        .modal-close {
            position: absolute;
            top: 15px; right: 15px;
            background: #f3f4f6; border: none; font-size: 16px; cursor: pointer; color: #4b5563;
            width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center;
        }
        .modal-close:hover { background: #e5e7eb; color: #111827; }
        .guide-section {
            display: none;
        }
        .guide-section.active {
            display: block;
        }
        .guide-section h3 { margin-bottom: 15px; color: #111827; font-size: 1.2rem; }
        .guide-section h4 { margin-top: 20px; margin-bottom: 8px; color: #2563eb; font-size: 1rem; }
        .guide-section ul { padding-left: 20px; color: #374151; line-height: 1.6; font-size: 0.95rem; }
        .guide-section li { margin-bottom: 6px; }
        .guide-section p { color: #4b5563; font-size: 0.95rem; margin-bottom: 10px; }
        .guide-section code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-weight: bold; color: #d97706; }

        /* Chords Styling (Hợp âm chuẩn) */
        .lyric-line {
            font-size: 18px;
            line-height: 2.8; /* Khoảng cách để nhét hợp âm ở trên */
            white-space: pre-wrap;
            font-family: 'Segoe UI', system-ui, sans-serif;
            margin-bottom: 5px;
        }
        ruby {
            ruby-position: over;
            ruby-align: start; /* Căn trái hợp âm với chữ */
        }
        rt {
            color: #2563eb;
            font-weight: bold;
            font-family: monospace;
            font-size: 15px;
            text-align: left;
            transform: translateY(-5px);
        }

        /* Làm nhạt màu số thứ tự ô nhịp trong bản nhạc */
        .abcjs-measure-number {
            fill: #9ca3af !important;
        }

        /* Responsive cho Mobile và iPad */
        .mobile-fab {
            display: none;
        }
        @media (max-width: 768px) {
            .container {
                flex-direction: column;
            }
            .editor-section {
                width: 100%;
                height: 40%;
                border-right: none;
                border-bottom: 1px solid var(--border-color);
            }
            .paper-section {
                width: 100%;
                height: 60%;
                padding: 15px;
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
            }
            .paper {
                padding: 20px;
                min-height: auto;
            }
            /* Floating Action Button for mobile */
            .mobile-fab {
                display: flex;
                position: fixed;
                bottom: 10px;
                right: 10px;
                width: 44px;
                height: 44px;
                border-radius: 22px;
                background: #2563eb;
                color: white;
                align-items: center;
                justify-content: center;
                box-shadow: 0 4px 6px rgba(0,0,0,0.3);
                border: none;
                cursor: pointer;
                z-index: 1000;
                transition: background 0.2s;
            }
            .mobile-fab:active { background: #1d4ed8; }
            /* Toggle Preview Mode */
            .container.mobile-preview-mode .editor-section {
                display: none !important;
            }
            .container.mobile-preview-mode .paper-section {
                height: 100% !important;
            }
        }

        /* Khi in chỉ in phần giấy đang active */
        @media print {
            body, .container, .paper-section, .paper {
                height: auto !important;
                overflow: visible !important;
                display: block !important;
                background: none !important;
            }
            .editor-section {
                display: none !important;
            }
            .paper {
                box-shadow: none !important;
                border: none !important;
                max-width: 100% !important;
                margin: 0 !important;
                padding: 0 !important;
            }
            svg {
                page-break-inside: avoid;
                break-inside: avoid;
            }
        }

        /* Circle of Fifths Styling */
        #svg-circle-container svg {
            width: 100%;
            max-width: 600px;
            height: auto;
            transition: transform 0.5s ease-in-out;
        }
        .chord-card {
            background: #f3f4f6;
            border: 1px solid #d1d5db;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 10px;
        }
        .chord-card h3 {
            margin-bottom: 5px;
            color: #2563eb;
        }
        .chord-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
            gap: 10px;
            margin-top: 10px;
        }
        .chord-box {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 4px;
            padding: 8px;
            text-align: center;
            font-weight: bold;
            box-shadow: 0 1px 2px rgba(0,0,0,0.05);
        }
        .chord-roman {
            font-size: 0.75rem;
            color: #6b7280;
            margin-bottom: 3px;
        }
        .circle-text {
            cursor: pointer;
            user-select: none;
            transition: opacity 0.2s;
        }
        .circle-text:hover {
            opacity: 0.7;
        }
        .circle-wedge {
            cursor: pointer;
            fill: transparent;
        }
        .circle-wedge:hover {
            fill: rgba(37, 99, 235, 0.1);
        }