/* TỔNG THỂ & TOOLBAR CHÍNH */
.nlg-sr-container { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.04); width: 100%; max-width: 100%; height: calc(100dvh - 36px); min-height: 420px; margin: 0 auto; border: 1px solid #e2e8f0; color: #334155; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.nlg-sr-container.nlg-fullscreen-mode { position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; width: 100vw !important; height: 100vh !important; max-width: none !important; margin: 0 !important; border-radius: 0 !important; z-index: 999999 !important; background: #ffffff; display: flex; flex-direction: column; overflow: hidden; }
.nlg-fullscreen-mode .nlg-player-panel { flex: 1 1 auto; max-height: none; min-height: 0; }
.nlg-fullscreen-mode #nlg-sheet-wrapper { flex: 1 1 auto; min-height: 0; }
.nlg-sr-toolbar { padding: 20px 25px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 15px; border-bottom: 1px solid #e2e8f0; background: #ffffff; border-top-left-radius: 12px; border-top-right-radius: 12px; }
.nlg-toolbar-group { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
@media (max-width: 900px) { .nlg-sr-toolbar { justify-content: center; } }

/* KHỐI NHẬP LIỆU & DROPDOWN */
.nlg-control-box { display: flex; flex-direction: column; gap: 6px; position: relative; }
.nlg-control-label { font-size: 13px; font-weight: 600; color: #64748b; margin: 0; }
.nlg-input-unified { height: 42px; padding: 0 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 15px; font-weight: 600; color: #0f172a; background: #fff; outline: none; box-sizing: border-box; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.nlg-input-unified:hover { border-color: #94a3b8; }
.nlg-input-unified:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.nlg-btn { height: 42px; min-width: 42px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; color: #334155; cursor: pointer; transition: all 0.15s ease; display: flex; align-items: center; justify-content: center; padding: 0 15px; font-weight: 600; font-size: 14px; }
.nlg-btn:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.nlg-btn:active { background: #e2e8f0; transform: translateY(1px); }
.nlg-btn-center { width: 50px; border-radius: 10px; padding: 0; }

.nlg-popup-dropdown { position: absolute; top: calc(100% + 8px); left: 0; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1); padding: 18px; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); transform: translateY(-10px); min-width: max-content; }
.nlg-popup-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nlg-tab-header { display: flex; background: #f1f5f9; border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.nlg-tab-btn { flex: 1; border: none; background: transparent; padding: 6px 12px; font-size: 13px; font-weight: 600; color: #64748b; cursor: pointer; border-radius: 6px; transition: 0.15s; text-align: center; white-space: nowrap; }
.nlg-tab-btn.active { background: #ffffff; color: #0f172a; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.nlg-tab-content { display: none; }
.nlg-tab-content.active { display: block; }
.nlg-key-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 280px; }
.nlg-key-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 4px; text-align: center; font-size: 15px; font-weight: 700; color: #1e293b; cursor: pointer; background: #f8fafc; transition: 0.15s; }
.nlg-key-card:hover { border-color: #cbd5e1; background: #f1f5f9; }
.nlg-key-card.active { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
.nlg-time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 260px;}
.nlg-time-card { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 5px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; position: relative; background: #f8fafc; }
.nlg-time-card:hover { border-color: #cbd5e1; }
.nlg-time-card .nlg-val { font-size: 20px; font-weight: 800; line-height: 0.9; color: #1e293b; }
.nlg-time-card.active { border-color: #2563eb; background: #eff6ff; }
.nlg-rhythm-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; width: 340px; }
.nlg-rhythm-col h4 { margin: 0 0 12px 0; font-size: 13px; color: #0f172a; border-bottom: 1px solid #f1f5f9; padding-bottom: 6px;}

/* CSS RHYTHM BOX MỚI */
.nlg-box-label { display: inline-block; margin: 0; cursor: pointer; }
.nlg-box-label input[type="checkbox"] { display: none; }
.nlg-rhythm-box { display: flex; align-items: center; justify-content: center; width: 52px; height: 48px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); text-align: center; font-size: 11px; font-weight: 700; line-height: 1.15; color: #1e293b; padding: 4px; }
.nlg-rhythm-box:hover { border-color: #94a3b8; background: #f8fafc; }
.nlg-box-label input[type="checkbox"]:checked + .nlg-rhythm-box { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37,99,235,0.1); }
.nlg-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 10px; }

/* DRAWER CÀI ĐẶT */
.nlg-drawer-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.3); backdrop-filter: blur(2px); z-index: 999998; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.nlg-drawer-overlay.open { opacity: 1; visibility: visible; }
.nlg-custom-drawer { position: fixed; top: 0; right: -420px; width: 360px; height: 100vh; background: #fff; box-shadow: -5px 0 30px rgba(0,0,0,0.1); z-index: 999999; padding: 30px; transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto; display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; }
.nlg-custom-drawer.open { right: 0; }
.nlg-drawer-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #f1f5f9; padding-bottom: 15px; }
.nlg-drawer-header h3 { margin: 0; font-size: 18px; color: #0f172a; font-weight: 700; }
.nlg-drawer-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #94a3b8; padding: 0; }
.nlg-setting-row { display: grid; grid-template-columns: minmax(94px, 1fr) minmax(0, 1.35fr); align-items: center; gap: 14px; margin-bottom: 14px; }
.nlg-setting-row label { font-size: 14px; font-weight: 600; color: #1e293b; }
.nlg-setting-row select { width: 100%; padding: 10px 12px; border-radius: 6px; border: 1px solid #cbd5e1; font-weight: 500; font-size: 14px; color: #1e293b; background-color: #fff; outline: none; cursor: pointer; }
.nlg-setting-row.is-disabled { opacity: 0.46; }
.nlg-setting-row.is-disabled select { cursor: not-allowed; }
.nlg-checkbox-row { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin-bottom: 12px; min-height: 34px; padding: 0; border: 0; border-radius: 0; background: transparent; box-sizing: border-box; transition: 0.15s ease; }
.nlg-checkbox-row:hover { background: transparent; }
.nlg-checkbox-row span { font-size: 14px; font-weight: 700; color: #1e293b; }
.nlg-checkbox-row input { position: relative; width: 42px; height: 24px; margin: 0; flex: 0 0 auto; cursor: pointer; appearance: none; -webkit-appearance: none; border: none; border-radius: 999px; background: #cbd5e1; transition: 0.18s ease; }
.nlg-checkbox-row input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2); transition: 0.18s ease; }
.nlg-checkbox-row input:checked { background: #3b82f6; }
.nlg-checkbox-row input:checked::before { transform: translateX(18px); }
.nlg-vol-row { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.nlg-vol-btn { background: none; border: none; padding: 0; cursor: pointer; color: #64748b; display: flex; align-items: center; transition: 0.2s; width: 26px; height: 26px; }
.nlg-vol-btn:hover { color: #2563eb; }
.nlg-vol-btn.muted { color: #ef4444; }
.nlg-vol-label-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.nlg-vol-label { font-size: 13px; font-weight: 600; color: #1e293b; }
.nlg-slider { -webkit-appearance: none; width: 100%; height: 6px; border-radius: 3px; background: #e2e8f0; outline: none; cursor: pointer; }
.nlg-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #2563eb; cursor: pointer; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.nlg-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.nlg-btn-apply { background: #10b981; color: white; padding: 14px; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; width: 100%; transition: 0.2s; margin-top: 10px;}
.nlg-btn-apply:hover { background: #059669; }
.nlg-drawer-subtitle { margin: 0 0 12px; font-size: 12px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.nlg-primary-settings { display: grid; gap: 14px; margin-bottom: 14px; }
.nlg-primary-settings .nlg-control-box { width: 100%; display: grid; grid-template-columns: minmax(94px, 1fr) minmax(0, 1.35fr); align-items: center; gap: 14px; }
.nlg-primary-settings .nlg-control-label { color: #1e293b; }
.nlg-primary-settings .nlg-input-unified,
.nlg-primary-settings .nlg-btn { width: 100% !important; justify-content: center; }
.nlg-primary-settings .nlg-popup-dropdown { grid-column: 1 / -1; }
.nlg-rhythm-setting-row { position: relative; }
.nlg-rhythm-setting-row .nlg-popup-dropdown { grid-column: 1 / -1; }
.nlg-custom-drawer .nlg-popup-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; display: none; min-width: 0; width: auto; max-width: none; max-height: min(420px, calc(100vh - 140px)); margin-top: 0; overflow-y: auto; transform: translateY(-4px); opacity: 0; visibility: hidden; box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16); border-radius: 10px; padding: 12px; z-index: 1000001; }
.nlg-custom-drawer .nlg-popup-dropdown.open { display: block; opacity: 1; visibility: visible; transform: translateY(0); }
.nlg-custom-drawer .nlg-key-grid,
.nlg-custom-drawer .nlg-time-grid { width: 100%; }
.nlg-custom-drawer #nlg-popup-rhythm { padding: 10px; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-rhythm-grid { width: 100% !important; max-width: 100% !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; align-items: start; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-rhythm-col h4 { margin-bottom: 6px; padding-bottom: 5px; font-size: 10px; text-align: center; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-items-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; justify-items: stretch; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-box-label { display: block; width: 100%; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-rhythm-box { width: 100% !important; min-height: 34px !important; height: auto !important; border-radius: 7px; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-rhythm-box svg,
.nlg-custom-drawer #nlg-popup-rhythm .nlg-rhythm-box img { width: 62% !important; height: 62% !important; }
.nlg-custom-drawer #nlg-popup-rhythm .nlg-box-label input[type="checkbox"]:checked + .nlg-rhythm-box::after { top: 1px; right: 4px; font-size: 8px; }
@media (max-width: 420px) {
    .nlg-custom-drawer { width: min(360px, 100vw); padding: 24px; }
    .nlg-setting-row,
    .nlg-primary-settings .nlg-control-box { grid-template-columns: minmax(82px, 0.9fr) minmax(0, 1.4fr); gap: 10px; }
}

/* CANVAS TOOLBAR */
.nlg-player-panel { order: 2; position: relative; background: #fff; border-radius: 0; display: flex; flex: 1 1 auto; flex-direction: column; height: auto; max-height: none; min-height: 0; overflow: hidden; }
.nlg-canvas-toolbar { display: none; justify-content: space-between; align-items: center; padding: 10px 18px 6px 18px; flex-wrap: wrap; gap: 12px; flex: 0 0 auto; }
.nlg-bottom-toolbar { order: 3; position: relative; flex: 0 0 auto; z-index: 60; min-height: 76px; padding: 8px 18px 10px; border-top: 1px solid #e2e8f0; border-bottom: 0; border-radius: 0 0 12px 12px; background: rgba(255,255,255,0.96); box-shadow: 0 -10px 28px rgba(15,23,42,0.08); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 2fr) minmax(0, 3fr); align-items: center; gap: 0; backdrop-filter: blur(10px); overflow: visible; }
.nlg-primary-toolbar-group { display: none; }
.nlg-transport-group { order: 1; }
.nlg-bottom-inline { order: 3; }
.nlg-actions-group { order: 4; }
.nlg-toolbar-side { min-width: 0; display: grid; grid-template-columns: repeat(var(--nlg-toolbar-columns, 1), minmax(0, 1fr)); align-items: center; justify-items: center; gap: 0; }
.nlg-toolbar-left { grid-column: 1; }
.nlg-toolbar-center { grid-column: 2; width: 100%; display: grid; grid-template-columns: repeat(var(--nlg-toolbar-columns, 2), minmax(0, 1fr)); align-items: center; justify-items: center; gap: 0; z-index: 2; }
.nlg-toolbar-right { grid-column: 3; }
.nlg-toolbar-item { flex: 0 0 auto; }
.nlg-toolbar-overflowed { display: none !important; }
.nlg-more-container { display: none; position: relative; flex: 0 0 auto; }
.nlg-more-container.has-overflow { display: flex; align-items: center; justify-content: center; }
.nlg-bottom-toolbar .nlg-toolbar-group { align-items: center; gap: 14px; }
.nlg-bottom-action,
.nlg-bottom-toolbar .nlg-btn,
.nlg-bottom-toolbar .nlg-pitch-btn,
.nlg-bottom-toolbar .nlg-metro-icon-btn,
.nlg-bottom-toolbar .nlg-more-btn { width: clamp(46px, 5vw, 62px); min-width: clamp(46px, 5vw, 62px); height: 52px; padding: 5px 4px; border: 0; border-radius: 10px; background: transparent; color: #334155; box-shadow: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; line-height: 1; }
.nlg-bottom-toolbar .nlg-btn:hover,
.nlg-bottom-toolbar .nlg-pitch-btn:hover,
.nlg-bottom-toolbar .nlg-metro-icon-btn:hover,
.nlg-bottom-toolbar .nlg-more-btn:hover,
.nlg-bottom-toolbar .nlg-icon-toggle:hover { background: #f1f5f9; border-color: transparent; transform: none; }
.nlg-bottom-action::after { content: attr(data-label); font-size: 10px; font-weight: 800; color: #475569; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.nlg-bottom-toolbar img,
.nlg-bottom-toolbar .nlg-icon-svg { width: 21px !important; height: 21px !important; min-width: 21px !important; opacity: 0.9; }
.nlg-bottom-toolbar .nlg-btn-center { width: clamp(46px, 5vw, 62px); border-radius: 10px; }
.nlg-bottom-toolbar .nlg-action-play { width: 72px; min-width: 72px; height: 62px; border-radius: 14px; background: #f8fafc; }
.nlg-bottom-toolbar .nlg-action-play img { width: 32px !important; height: 32px !important; min-width: 32px !important; opacity: 1; }
.nlg-bottom-toolbar .nlg-action-play::after { display: block !important; font-size: 11px; color: #0f172a; }
.nlg-bottom-toolbar .nlg-action-play.is-playing { background: #fef2f2; color: #ef4444; }
.nlg-bottom-toolbar .nlg-action-play.is-playing::after { color: #ef4444; }

/* CỤM PITCH VÀ METRONOME PILL */
.nlg-inline-tools { display: flex; align-items: center; gap: 16px; flex-wrap: nowrap; }
.nlg-print-btn { color: #1e293b; }
.nlg-print-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.nlg-print-btn .nlg-icon-svg { width: 20px; height: 20px; opacity: 0.72; stroke-width: 1.8; }
.nlg-pitch-container { position: relative; }
.nlg-pitch-btn { width: 42px; height: 42px; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid #e2e8f0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; padding: 0; }
.nlg-pitch-btn:hover { background: #f8fafc; border-color: #cbd5e1; transform: scale(1.05); }
.nlg-popup-pitch-menu { transform: translateX(-50%) translateY(-10px); left: 50%; padding: 12px; width: 170px; min-width: auto; }
.nlg-popup-pitch-menu.open { transform: translateX(-50%) translateY(0); }
.nlg-bottom-toolbar .nlg-popup-pitch-menu { top: auto; bottom: calc(100% + 12px); transform: translateX(-50%) translateY(8px); }
.nlg-bottom-toolbar .nlg-popup-pitch-menu.open { transform: translateX(-50%) translateY(0); }
.nlg-pitch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nlg-pitch-card { padding: 6px 0; text-align: center; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; color: #1e293b; transition: 0.15s; }
.nlg-pitch-card:hover { border-color: #2563eb; background: #eff6ff; color: #2563eb; }

.nlg-transpose-container { position: relative; }
.nlg-transpose-btn { width: 42px; height: 42px; border-radius: 0; background: transparent; box-shadow: none; border: 0; color: #334155; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; padding: 0; }
.nlg-transpose-btn:hover { background: #f1f5f9; color: #0f172a; transform: none; }
.nlg-bottom-toolbar .nlg-transpose-btn,
.nlg-bottom-toolbar .nlg-transpose-btn:hover { border-radius: 10px; }
.nlg-transpose-icon { display: block; font-size: 18px; font-weight: 800; line-height: 1; letter-spacing: 1px; white-space: nowrap; }
.nlg-transpose-btn.is-active { color: #2563eb; background: transparent; }
.nlg-transpose-menu { top: auto; bottom: calc(100% + 12px); left: 50%; width: 190px; min-width: 190px; padding: 14px; transform: translateX(-50%) translateY(8px); }
.nlg-transpose-menu.open { transform: translateX(-50%) translateY(0); }
.nlg-bottom-toolbar .nlg-transpose-menu { position: absolute !important; top: auto !important; bottom: calc(100% + 12px) !important; left: 50% !important; right: auto !important; width: 190px !important; min-width: 190px !important; transform: translateX(-50%) translateY(8px) !important; }
.nlg-bottom-toolbar .nlg-transpose-menu.open { transform: translateX(-50%) translateY(0) !important; }
.nlg-transpose-heading { color: #0f172a; font-size: 13px; font-weight: 900; text-align: center; }
.nlg-transpose-key { margin: 5px 0 11px; color: #64748b; font-size: 12px; font-weight: 700; text-align: center; }
.nlg-transpose-stepper { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; }
.nlg-transpose-stepper button { width: 42px; height: 38px; border: 1px solid #cbd5e1; border-radius: 9px; background: #f8fafc; color: #0f172a; cursor: pointer; font-size: 23px; font-weight: 700; line-height: 1; }
.nlg-transpose-stepper button:hover { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
.nlg-transpose-stepper output { color: #0f172a; font-size: 17px; font-weight: 900; text-align: center; }
.nlg-transpose-reset { width: 100%; min-height: 32px; margin-top: 10px; border: 0; border-radius: 8px; background: #e2e8f0; color: #334155; cursor: pointer; font-size: 12px; font-weight: 800; }
.nlg-transpose-reset:hover { background: #cbd5e1; }

.nlg-metro-pill { display: flex; align-items: center; gap: 14px; background: #f4f4f5; padding: 6px 8px 6px 16px; border-radius: 30px; }
.nlg-metro-control { position: relative; }
.nlg-metro-icon-btn { cursor: pointer; border: 1px solid #e2e8f0; background: #ffffff; }
.nlg-metro-menu,
.nlg-more-menu { top: auto; bottom: calc(100% + 12px); left: 50%; min-width: 220px; width: 220px; padding: 12px; transform: translateX(-50%) translateY(8px); }
.nlg-metro-menu.open,
.nlg-more-menu.open { transform: translateX(-50%) translateY(0); }
.nlg-bottom-toolbar .nlg-metro-menu,
.nlg-bottom-toolbar .nlg-more-menu { position: absolute !important; top: auto !important; bottom: calc(100% + 12px) !important; left: 50% !important; right: auto !important; width: 220px !important; min-width: 220px !important; max-width: calc(100vw - 24px) !important; max-height: min(70vh, 360px) !important; overflow-y: auto !important; transform: translateX(-50%) translateY(8px) !important; }
.nlg-bottom-toolbar .nlg-metro-menu.open,
.nlg-bottom-toolbar .nlg-more-menu.open { transform: translateX(-50%) translateY(0) !important; }
.nlg-metro-menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; font-size: 13px; font-weight: 800; color: #475569; }
.nlg-metro-menu .nlg-tempo-invisible { width: 58px; height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; color: #0f172a; }
.nlg-tempo-stepper { display: grid; grid-template-columns: 30px 58px 30px; align-items: center; gap: 5px; }
.nlg-tempo-stepper button { width: 30px; height: 30px; padding: 0; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; color: #334155; cursor: pointer; font-size: 18px; font-weight: 800; line-height: 1; }
.nlg-tempo-stepper button:hover { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
.nlg-metro-volume-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-top: 10px; border-top: 1px solid #e2e8f0; }
.nlg-metro-volume-row .nlg-vol-label-wrap { gap: 7px; }
.nlg-metro-volume-row .nlg-vol-label { font-size: 12px; color: #475569; }
.nlg-more-menu { display: flex; flex-direction: column; gap: 4px; }
.nlg-more-menu button { width: 100%; border: 0; background: transparent; color: #334155; cursor: pointer; border-radius: 8px; min-height: 42px; padding: 8px 10px; text-align: left; font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.nlg-more-menu button:hover { background: #f1f5f9; color: #0f172a; }
.nlg-more-menu button.is-disabled { opacity: 0.38; filter: grayscale(1); cursor: default; pointer-events: none; }
.nlg-more-item-icon { width: 24px; min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; color: #475569; }
.nlg-more-item-icon img,
.nlg-more-item-icon svg { width: 21px !important; height: 21px !important; min-width: 21px !important; display: block; }
.nlg-more-item-icon .nlg-icon-mark { min-width: 22px; height: 22px; font-size: 11px; }
.nlg-more-item-icon .nlg-transpose-icon { display: inline-flex; width: 24px; height: 22px; align-items: center; justify-content: center; font-size: 16px; letter-spacing: 0; }
.nlg-popup-from-more { z-index: 1003 !important; }
.nlg-metro-pill-left { display: flex; align-items: center; gap: 4px; }
.nlg-tempo-invisible { width: 38px; background: transparent; border: none; font-size: 16px; font-weight: 600; color: #374151; outline: none; text-align: center; padding: 0; font-family: inherit; -moz-appearance: textfield; }
.nlg-tempo-invisible::-webkit-outer-spin-button, .nlg-tempo-invisible::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.nlg-toggle { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0; flex-shrink: 0; }
.nlg-toggle input { opacity: 0; width: 0; height: 0; }
.nlg-slider-toggle { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #d1d5db; transition: .3s; border-radius: 24px; }
.nlg-slider-toggle:before { position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 2px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.nlg-toggle input:checked + .nlg-slider-toggle { background-color: #3b82f6; }
.nlg-toggle input:checked + .nlg-slider-toggle:before { transform: translateX(20px); }
.nlg-icon-toggle { cursor: pointer; user-select: none; }
.nlg-icon-toggle input { display: none; }
.nlg-icon-mark { min-width: 22px; height: 22px; border: 1.8px solid #64748b; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; line-height: 1; color: #334155; box-sizing: border-box; }
.nlg-icon-toggle.is-active { color: #2563eb; background: #eff6ff; }
.nlg-icon-toggle.is-active .nlg-icon-mark { border-color: #2563eb; color: #2563eb; }
.nlg-icon-toggle.is-disabled { opacity: 0.38; pointer-events: none; }
.nlg-pitch-container.is-disabled,
.nlg-transpose-container.is-disabled { opacity: 0.38; filter: grayscale(1); }

/* KHU VỰC SHEET MUSIC */
#nlg-sheet-wrapper { position: relative; width: 100%; overflow-x: hidden; overflow-y: auto; min-height: 0; max-height: none; flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 10px 70px 24px 70px; box-sizing: border-box; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
#nlg-sheet-wrapper.nlg-sheet-centered { justify-content: center; overflow-y: hidden; }
#nlg-sheet-wrapper.nlg-sheet-scrollable { justify-content: flex-start; overflow-y: auto; }
#nlg-sheet-music { width: 100%; max-width: 100%; position: relative; flex: 0 0 auto; overflow: visible; }
#nlg-sheet-music svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.nlg-audio-overlay { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(255,255,255,0.82); backdrop-filter: blur(6px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.22s ease, visibility 0.22s ease; }
.nlg-audio-overlay.is-visible { opacity: 1; visibility: visible; }
.nlg-audio-overlay-card { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; background: rgba(255,255,255,0.96); border: 1px solid rgba(203,213,225,0.92); border-radius: 18px; box-shadow: 0 18px 48px rgba(15,23,42,0.12); padding: 24px 22px 20px; pointer-events: auto; }
.nlg-audio-overlay-spinner { width: 38px; height: 38px; border-radius: 999px; border: 3px solid rgba(148,163,184,0.28); border-top-color: #2563eb; animation: nlgOverlaySpin 0.9s linear infinite; }
.nlg-audio-overlay-title { font-size: 20px; font-weight: 800; color: #0f172a; }
.nlg-audio-overlay-text { font-size: 14px; line-height: 1.5; color: #475569; max-width: 34ch; white-space: pre-line; }
.nlg-audio-overlay-btn { min-width: 190px; height: 42px; border: 0; border-radius: 999px; background: #2563eb; color: #ffffff; font-size: 14px; font-weight: 700; padding: 0 18px; cursor: pointer; transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease; }
.nlg-audio-overlay-btn:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); }
.nlg-audio-overlay-btn:disabled { cursor: wait; opacity: 0.78; }
.nlg-audio-overlay.is-loading .nlg-audio-overlay-btn { background: #94a3b8; }
.nlg-audio-overlay:not(.is-loading) .nlg-audio-overlay-spinner { display: none; }
.nlg-playhead { position: absolute; left: 0; top: 0; z-index: 6; display: none; width: 2.5px; min-height: 0; pointer-events: none; border-radius: 999px; background: #ef4444; will-change: transform, top, height; }
#nlg-countdown { position: absolute; top: 15px; left: 50%; transform: translateX(-50%); z-index: 5; display: none; font-size: 50px; font-weight: 900; color: rgba(37, 99, 235, 0.35); }
@keyframes nlgOverlaySpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes popAnim { 0% { transform: translateX(-50%) scale(1.3); opacity: 0; } 15% { transform: translateX(-50%) scale(1); opacity: 1; } 100% { transform: translateX(-50%) scale(0.9); opacity: 0; } }
@keyframes nlgNoteFlash {
    0% {
        fill: #2563eb;
        stroke: #2563eb;
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(37,99,235,0));
    }
    60% {
        fill: #3b82f6;
        stroke: #3b82f6;
        opacity: 1;
        filter: drop-shadow(0 0 4px rgba(59,130,246,0.28));
    }
    100% {
        fill: currentColor;
        stroke: currentColor;
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(37,99,235,0));
    }
}
.nlg-click-note-part {
    fill: #2563eb !important;
    stroke: #2563eb !important;
    color: #2563eb !important;
    animation: nlgNoteFlash 0.18s ease-out forwards;
}

@media (max-width: 900px) {
    .nlg-sr-container { height: calc(100dvh - 12px); min-height: 360px; }
    .nlg-player-panel { height: auto; max-height: none; }
    #nlg-sheet-wrapper { max-height: none; padding-bottom: 20px; }
    .nlg-canvas-toolbar { align-items: flex-start; padding: 8px 12px 6px; }
    .nlg-inline-tools { justify-content: flex-end; gap: 8px; }
    #nlg-sheet-wrapper { padding-left: 24px; padding-right: 24px; }
    .nlg-audio-overlay { padding: 16px; }
    .nlg-audio-overlay-card { padding: 22px 18px 18px; border-radius: 16px; }
    .nlg-bottom-toolbar { display: grid; gap: 0; padding-left: 10px; padding-right: 10px; }
    .nlg-toolbar-side { display: grid; gap: 0; }
    .nlg-bottom-action,
    .nlg-bottom-toolbar .nlg-btn,
    .nlg-bottom-toolbar .nlg-pitch-btn,
    .nlg-bottom-toolbar .nlg-metro-icon-btn,
    .nlg-bottom-toolbar .nlg-more-btn { width: 50px; min-width: 50px; height: 48px; }
    .nlg-bottom-action::after { display: none; }
    .nlg-bottom-toolbar .nlg-action-play::after { display: none !important; }
}

@media (max-width: 560px) {
    .nlg-sr-toolbar { padding: 14px 12px; }
    .nlg-canvas-toolbar { gap: 8px; }
    .nlg-inline-tools { width: auto; justify-content: center; }
    .nlg-bottom-inline { width: auto; justify-content: center; }
    .nlg-metro-pill { padding-left: 10px; gap: 8px; }
    #nlg-sheet-wrapper { max-height: none; padding: 10px 12px 18px 12px; }
    .nlg-print-btn { min-width: 46px; height: 34px; }
    .nlg-bottom-toolbar { min-height: 66px; display: grid; overflow: visible; padding: 6px 8px 7px; align-items: center; gap: 0; }
    .nlg-toolbar-side { display: grid; gap: 0; }
    .nlg-toolbar-center { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nlg-audio-overlay-card { width: min(300px, 100%); padding: 20px 16px 16px; }
    .nlg-audio-overlay-title { font-size: 18px; }
    .nlg-audio-overlay-text { font-size: 13px; }
    .nlg-audio-overlay-btn { min-width: 170px; height: 40px; font-size: 13px; }
    .nlg-bottom-action,
    .nlg-bottom-toolbar .nlg-btn,
    .nlg-bottom-toolbar .nlg-pitch-btn,
    .nlg-bottom-toolbar .nlg-metro-icon-btn,
    .nlg-bottom-toolbar .nlg-more-btn { width: 40px; min-width: 40px; height: 40px; border-radius: 8px; }
    .nlg-bottom-action::after { display: none; }
    .nlg-bottom-toolbar .nlg-action-play { width: 50px; min-width: 50px; height: 52px; border-radius: 12px; }
    .nlg-bottom-toolbar .nlg-action-play img { width: 27px !important; height: 27px !important; min-width: 27px !important; }
    .nlg-bottom-toolbar .nlg-action-play::after { display: none !important; }
    .nlg-bottom-toolbar img,
    .nlg-bottom-toolbar .nlg-icon-svg { width: 19px !important; height: 19px !important; min-width: 19px !important; }
    .nlg-more-menu,
    .nlg-metro-menu { right: 0; left: auto; transform: translateY(8px); }
    .nlg-more-menu.open,
    .nlg-metro-menu.open { transform: translateY(0); }
    .nlg-bottom-toolbar .nlg-metro-menu { left: 50% !important; right: auto !important; transform: translateX(-50%) translateY(8px) !important; }
    .nlg-bottom-toolbar .nlg-metro-menu.open { transform: translateX(-50%) translateY(0) !important; }
    .nlg-bottom-toolbar .nlg-more-menu { left: 50% !important; right: auto !important; transform: translateX(-50%) translateY(8px) !important; }
    .nlg-bottom-toolbar .nlg-more-menu.open { transform: translateX(-50%) translateY(0) !important; }
}

@media (max-width: 420px) {
    .nlg-bottom-toolbar { gap: clamp(4px, 2.5vw, 9px); }
    .nlg-bottom-inline { gap: 0; }
    .nlg-bottom-action,
    .nlg-bottom-toolbar .nlg-btn,
    .nlg-bottom-toolbar .nlg-pitch-btn,
    .nlg-bottom-toolbar .nlg-metro-icon-btn,
    .nlg-bottom-toolbar .nlg-more-btn { width: 34px; min-width: 34px; height: 38px; }
    .nlg-bottom-toolbar .nlg-action-play { width: 48px; min-width: 48px; height: 50px; }
    .nlg-bottom-toolbar .nlg-action-refresh { display: flex !important; }
}

@page { size: A4 portrait; margin: 22mm 15mm 15mm; }

@media print {
    html, body { width: 100% !important; margin: 0 !important; padding: 0 !important; background: transparent !important; }
    body * { visibility: hidden !important; }
    .nlg-sr-container { width: 100% !important; max-width: none !important; background: transparent !important; border: 0 !important; box-shadow: none !important; margin: 0 auto !important; padding: 0 !important; }
    .nlg-player-panel,
    .nlg-player-panel * { visibility: visible !important; }
    .nlg-player-panel { position: static !important; width: 100% !important; height: auto !important; max-height: none !important; margin: 0 auto !important; padding: 0 !important; overflow: visible !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
    .nlg-canvas-toolbar,
    .nlg-playhead,
    .nlg-audio-overlay,
    #nlg-hidden-audio,
    #nlg-countdown { display: none !important; }
    #nlg-sheet-wrapper { overflow: visible !important; height: auto !important; max-height: none !important; padding: 8mm 0 0 !important; display: block !important; width: 100% !important; background: transparent !important; box-sizing: border-box !important; text-align: center !important; }
    #nlg-sheet-music { display: block !important; width: 100% !important; max-width: 100% !important; height: auto !important; max-height: 238mm !important; background: transparent !important; margin: 0 auto !important; text-align: center !important; }
    #nlg-sheet-music svg { display: block !important; width: auto !important; max-width: 100% !important; max-height: 238mm !important; height: auto !important; margin-left: auto !important; margin-right: auto !important; background: transparent !important; overflow: visible !important; transform-origin: center top !important; }
}
