/* Bản nhạc, đàn phím, máy đếm nhịp (/cong-cu/am-nhac). Tệp nạp ở mọi trang → lớp có tiền tố amn-. */
.chinh:has(> .amn) { max-width: 1480px; }
.amn-dau h1 { margin-bottom: .25em; }
.amn-an { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.amn-tab { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; }
.amn-tab [role="tab"] { flex: none; min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--vien); background: var(--the);
  color: var(--chu); font: inherit; font-weight: 600; cursor: pointer; }
.amn-tab [role="tab"]:hover { border-color: var(--c-vien); color: var(--c-dam); }
.amn-tab [role="tab"][aria-selected="true"] { background: var(--c-dam); border-color: var(--c-dam); color: #fff; }

/* Chọn bài */
.amn-bai { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; margin-bottom: 14px; }
.amn-bai__chon { flex: 1 1 260px; margin: 0; }
.amn-bai__chon select { width: 100%; }
.amn-bai__nut { margin: 0; }

.amn-hai { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
.amn-soan, .amn-xem { margin: 0; min-width: 0; }
.amn-mau-bao { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-nho); background: var(--nhan-nhat); color: var(--nhan-dam); font-size: .9375rem; }
.amn-dong { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
.amn-dong .field { margin-bottom: 10px; }

/* Nút chèn nốt */
.amn-chen { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; padding: 10px; border: 1px solid var(--vien); border-radius: var(--r-nho); background: var(--bg); }
.amn-nhom { display: flex; flex-direction: column; gap: 3px; }
.amn-nhom__ten { font-size: .8125rem; font-weight: 600; color: var(--phu); }
.amn-nhom__nut { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.amn-nhom__nut button { min-height: 38px; min-width: 44px; padding: 4px 10px; border: 1px solid var(--c-vien); border-radius: 8px; background: var(--the);
  color: var(--c-dam); font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer; }
.amn-nhom__nut button:hover:not(:disabled) { background: var(--c-nhat); }
.amn-nhom__nut button[aria-pressed="true"] { background: var(--c-dam); border-color: var(--c-dam); color: #fff; }
.amn-nhom__nut button:disabled { opacity: .45; cursor: not-allowed; }
.amn-not button { min-width: 52px; }

.amn-soan textarea { width: 100%; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9375rem; line-height: 1.5; }
.amn-soan textarea[readonly] { background: var(--bg); }
.amn-loi { margin: 0 0 12px; padding: 8px 12px; border-left: 4px solid var(--do); border-radius: 6px; background: var(--do-nhat); color: var(--do); font-size: .9rem; }
.amn-loi p { margin: 0; }
.amn-loi p + p { margin-top: 4px; }
.amn-cach summary { cursor: pointer; font-weight: 600; color: var(--c-dam); }
.amn-bang { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: .875rem; }
.amn-bang th, .amn-bang td { padding: 5px 8px; border-bottom: 1px solid var(--vien); text-align: left; vertical-align: top; }
.amn-bang code { font-size: .875rem; white-space: nowrap; }

/* Xem, nghe */
.amn-choi { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.amn-choi__o { margin: 0; min-width: 150px; }
.amn-choi__o input { width: 100%; }
.amn-dich { display: flex; align-items: center; gap: 6px; }
.amn-dich__ten { font-size: .875rem; font-weight: 600; }
.amn-dich__so { min-width: 2.2em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.amn-trang-thai { min-height: 1.4em; margin: 8px 0 4px; }
.amn-khuong { min-height: 180px; }
.amn-khuong svg { display: block; }
.amn-khuong .abcjs-note, .amn-khuong .abcjs-rest { cursor: pointer; }
.amn-khuong .amn-sang { fill: #c2410c; stroke: #c2410c; }
.amn-nguon { margin: 6px 0 0; }

/* Đàn phím */
.amn-dan-chon { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-bottom: 12px; }
.amn-dan-chon .field--check { margin: 0; }
.amn-dan-chon .amn-dan-chon__am { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.amn-dan-chon__am label { margin: 0; }
.amn-dan-chon__am input { width: 160px; min-height: 0; padding: 0; border: 0; }
.amn-dan-khung { overflow-x: auto; padding-bottom: 6px; }
.amn-dan { position: relative; display: flex; min-width: 720px; height: clamp(200px, 32vw, 300px); user-select: none; -webkit-user-select: none; touch-action: none; }
.amn-phim { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; padding: 0 0 12px;
  font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.amn-phim--trang { flex: 1; border: 1px solid #9aa5a7; border-radius: 0 0 8px 8px; background: linear-gradient(#fff, #f3f4f1); color: var(--chu); }
.amn-phim--trang + .amn-phim--trang, .amn-phim--den + .amn-phim--trang { margin-left: -1px; }
.amn-phim--den { position: absolute; top: 0; z-index: 2; width: calc(100% / 15 * .62); height: 60%; border: 1px solid #111; border-radius: 0 0 6px 6px;
  background: linear-gradient(#3a3f41, #15191a); color: #f1f1f1; padding-bottom: 8px; }
.amn-phim--trang.amn-phim--bam { background: linear-gradient(#e2ebf7, #c9daf0); }
.amn-phim--den.amn-phim--bam { background: linear-gradient(#27466f, #093166); }
.amn-phim__ten { font-weight: 700; font-size: 1rem; }
.amn-phim--den .amn-phim__ten { font-size: .75rem; }
.amn-phim__chu { display: none; font-size: .8125rem; color: var(--phu); }
.amn-phim--den .amn-phim__chu { color: #c9ced0; font-size: .6875rem; }
.amn-dan--chu .amn-phim__chu { display: block; }
.amn-phim__may { order: -1; min-width: 1.6em; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--vien); font-size: .75rem; font-family: ui-monospace, Consolas, monospace; color: var(--phu); background: var(--the); }
.amn-phim--den .amn-phim__may { border-color: #555; background: #2a2f31; color: #d6d9da; font-size: .6875rem; }
.amn-dan--khong-phim .amn-phim__may { visibility: hidden; }

/* Máy đếm nhịp */
.amn-nhip { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 12px 0; text-align: center; }
.amn-nhip__loai { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.amn-nhip__loai button { min-width: 72px; min-height: 48px; padding: 6px 14px; border: 1px solid var(--c-vien); border-radius: 999px; background: var(--the);
  color: var(--c-dam); font: inherit; font-size: 1.125rem; font-weight: 700; cursor: pointer; }
.amn-nhip__loai button[aria-pressed="true"] { background: var(--c-dam); border-color: var(--c-dam); color: #fff; }
.amn-den { display: flex; gap: clamp(8px, 2vw, 18px); flex-wrap: wrap; justify-content: center; }
.amn-den__o { display: grid; place-items: center; width: clamp(46px, 8vw, 84px); aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--c-vien);
  background: var(--bg); color: var(--phu); font-size: clamp(1.1rem, 2.4vw, 1.8rem); font-weight: 800; transition: background .06s, transform .06s; }
.amn-den__o--manh { border-color: var(--nhan-dam); }
.amn-den__o--vua { border-color: #5b86c4; }
.amn-den__o--sang { background: var(--c); border-color: var(--c); color: #fff; transform: scale(1.08); }
.amn-den__o--manh.amn-den__o--sang { background: var(--nhan); border-color: var(--nhan-dam); color: var(--c-dam); }
.amn-den__o--vua.amn-den__o--sang { background: #5b86c4; border-color: #5b86c4; }
.amn-toc { display: flex; align-items: center; gap: 18px; }
.amn-toc__nut { min-width: 56px; min-height: 56px; font-size: 1.6rem; line-height: 1; }
.amn-toc__so { display: flex; flex-direction: column; min-width: 5.5em; }
.amn-toc__so output { font-size: clamp(2.6rem, 6vw, 4rem); font-weight: 800; line-height: 1.1; color: var(--c-dam); font-variant-numeric: tabular-nums; }
.amn-toc__so span { font-size: .9375rem; color: var(--phu); }
.amn-bpm { width: min(520px, 100%); }
.amn-bat { min-width: 200px; min-height: 54px; font-size: 1.125rem; }
.amn-bat--chay { background: var(--do); border-color: var(--do); }
.amn-nhip > p { margin: 0; }
.amn-chan { margin-top: 18px; }

@media (max-width: 1024px) {
  .amn-hai { grid-template-columns: minmax(0, 1fr); }
  .amn-xem { order: -1; }
}
@media (max-width: 640px) {
  .amn-dong { grid-template-columns: 1fr 1fr; }
  .amn-dong__ten { grid-column: 1 / -1; }
  .amn-bai__nut .nut { flex: 1 1 auto; }
  .amn-dan { min-width: 0; height: 190px; }
  .amn-phim { padding-bottom: 8px; }
  .amn-phim__may, .amn-phim--den .amn-phim__ten, .amn-phim--den .amn-phim__chu { display: none !important; }
  .amn-phim__ten { font-size: .625rem; letter-spacing: -.02em; }
  .amn-chon-phim { display: none !important; }
  .amn-phim__chu { font-size: .6875rem; }
}

/* In: chỉ khuông nhạc */
@media print {
  body:has(.amn) * { visibility: hidden !important; }
  body:has(.amn) .amn-in, body:has(.amn) .amn-in * { visibility: visible !important; }
  body:has(.amn) .amn-in { position: absolute; left: 0; top: 0; width: 100%; }
  body:has(.amn) .amn-sang { fill: #000 !important; stroke: #000 !important; }
  body:has(.amn) .dau, body:has(.amn) .demo-bar, body:has(.amn) .chan, body:has(.amn) .tab-day { display: none !important; }
}
