/* DrumSheet's second interface (DRUMSHEET_UI2, 2026-11-12, docs/DESIGN_2026-11-12_DRUMSHEET_UI2.md).
 * ISOLATION: this file must not import anything from the shared css directory.
 *
 * Every rule is under html.nt-ui2, a class that nt-ui2.js sets only while the switch is on for the account, and only on
 * /drumsheet. Without the class this file changes nothing, so the page of an account outside the switch (and Notate) is
 * the page as it was.
 *
 * What the class does:
 *   1. the app bar keeps to ONE row on every screen (a phone had three or four): the four document buttons become a
 *      menu where the bar is narrow, the wordmark steps aside on a phone, the save state is its dot there
 *   2. the toolbar stays on screen while the score scrolls (the tools and the play button were a scroll back to the top
 *      away), as a full-width bar under the app bar; it is one row where that fits, and a single scrolling row on a
 *      phone and on a short screen (a phone held sideways gave the score a quarter of the screen)
 *   3. the font, the score size and the shortcut sheet live in a settings panel (nt-ui2.js moves that cluster): a card
 *      under its button, or a bottom sheet on a phone held upright
 *   4. finger-sized controls on a touch screen
 */

/* ── 1. the app bar ─────────────────────────────────────────────────────────────────────────────────────────── */
html.nt-ui2 .nt-appbar {
    flex-wrap: nowrap; gap: 8px; margin-bottom: 0; min-height: 52px;
    position: relative; z-index: 45;              /* its menu opens over the toolbar (40), under the long-press popover (50) */
}
html.nt-ui2 .nt-appbar .nt-brand, html.nt-ui2 .nt-appbar .nt-chip, html.nt-ui2 .nt-appbar .nt-save-state { flex: none; }
html.nt-ui2 .nt-title-wrap { flex: 1 1 140px; min-width: 64px; }
html.nt-ui2 .ui2-more { display: contents; }
html.nt-ui2 #nt-ui2-more { display: none; padding: 7px 9px; }
@media (max-width: 900px) {
    html.nt-ui2 #nt-ui2-more { display: inline-flex; }
    html.nt-ui2 #nt-ui2-more[aria-expanded="true"] { border-color: var(--nt-accent); color: var(--nt-accent); }
    html.nt-ui2 .ui2-more {
        display: none; position: absolute; top: calc(100% - 2px); right: max(8px, env(safe-area-inset-right)); z-index: 2;
        flex-direction: column; align-items: stretch; gap: 2px; min-width: 196px; padding: 6px;
        background: var(--nt-card); border: 1px solid var(--nt-border-soft); border-radius: 14px;
        box-shadow: var(--nt-shadow-md);
    }
    html.nt-ui2.ui2-more-open .ui2-more { display: flex; }
    html.nt-ui2 .ui2-more > .nt-chip {
        justify-content: flex-start; gap: 10px; min-height: 46px; padding: 0 14px; font-size: 15px;
        border-color: transparent; box-shadow: none; background: transparent;
    }
    html.nt-ui2 .ui2-more > .nt-chip:hover { background: var(--nt-hover); color: var(--nt-text); border-color: transparent; }
}
@media (max-width: 600px) {
    html.nt-ui2 .nt-appbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
    html.nt-ui2 .nt-appbar .nt-logo-text { display: none; }
    html.nt-ui2 .nt-appbar .nt-brand { padding: 3px; }
    /* the dot says it; the words stay for the call to sign in or subscribe (.nt-save-cta is a button) */
    html.nt-ui2 .nt-save-state:not(.nt-save-cta) { font-size: 0; gap: 0; padding: 8px; }
}

/* ── 2. the toolbar ─────────────────────────────────────────────────────────────────────────────────────────── */
html.nt-ui2 #nt-toolbar {
    position: sticky; top: var(--sat); z-index: 40;
    max-width: none; margin: 0 -14px 12px;
    padding: 6px max(14px, calc((100vw - 1200px) / 2));
    gap: 6px 10px;
    border: 0; border-bottom: 1px solid var(--nt-border-soft); border-radius: 0;
    /* the first shadow fills the status-bar inset above a stuck bar (an app's web view), the second lifts it off the score */
    box-shadow: 0 calc(-1 * var(--sat)) 0 0 var(--nt-card), 0 8px 14px -12px rgba(15, 23, 42, .45);
}
html.nt-ui2 #nt-toolbar #nt-palette { gap: 6px 8px; }
html.nt-ui2 #nt-toolbar .nt-tb-cluster { gap: 6px; }
html.nt-ui2 #nt-toolbar .nt-tb-sep { margin: 6px 0; }
html.nt-ui2 #nt-ui2-set { margin-left: auto; gap: 6px; }
html.nt-ui2 #nt-ui2-set[aria-expanded="true"] { border-color: var(--nt-accent); color: var(--nt-accent); }
/* the separator that stood before the moved cluster now stands before the settings button, which is pushed to the row's end */
html.nt-ui2 #nt-toolbar > .nt-tb-sep.ui2-sep-end { display: none; }
/* one row from a tablet lying down to a laptop: the three sound buttons are their pictures, the mode names are tighter.
   Measured: with a mouse the row fits from 1000 px like this and from 1340 px with the words; finger-sized controls need
   1080 px like this and never fit with the words below 1500 px. Narrower than that the toolbar is two rows, words kept. */
@media (min-width: 1000px) and (max-width: 1339px) and (pointer: fine), (min-width: 1080px) and (max-width: 1499px) and (pointer: coarse) {
    html.nt-ui2 #nt-met, html.nt-ui2 #nt-drum-snd, html.nt-ui2 #nt-audio-btn, html.nt-ui2 #nt-ui2-set {
        font-size: 0; gap: 0; padding-left: 10px; padding-right: 10px;
    }
    html.nt-ui2 #nt-toolbar .nt-seg .nt-chip { padding-left: 9px; padding-right: 9px; }
}
/* the beat lens keeps its bar between the top of the screen and its sheet: while it is open the toolbar scrolls with the page */
html.nt-ui2.ui2-lens #nt-toolbar { position: static; }
/* a phone, and any short screen: one scrolling row (the page's own rule below 721 px, here also by height), playback first */
@media (max-height: 520px) {
    html.nt-ui2 #nt-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    html.nt-ui2 #nt-toolbar::-webkit-scrollbar { display: none; }
    html.nt-ui2 #nt-toolbar > * { flex: none; }
    html.nt-ui2 #nt-toolbar #nt-palette, html.nt-ui2 #nt-toolbar .nt-tb-cluster, html.nt-ui2 #nt-toolbar .nt-pal-group { flex-wrap: nowrap; }
    html.nt-ui2 #nt-toolbar .nt-tb-cluster[aria-label="재생"] { order: -1; }
    html.nt-ui2 #nt-toolbar .nt-tb-sep { display: none; }
}
@media (max-width: 720px), (max-height: 520px) {
    html.nt-ui2 #nt-toolbar { padding-right: 0; }
    /* the settings button rides the row's right edge, so it is on screen wherever the row is scrolled to */
    html.nt-ui2 #nt-ui2-set {
        position: sticky; right: 0; order: 99; z-index: 1; margin-left: auto; align-self: stretch;
        font-size: 0; gap: 0; padding: 0 12px; min-width: 52px;
        border: 0; border-left: 1px solid var(--nt-border-soft); border-radius: 0; box-shadow: -10px 0 12px -8px rgba(15, 23, 42, .22);
        background: var(--nt-card);
    }
    html.nt-ui2 #nt-ui2-set[aria-expanded="true"] { border-color: var(--nt-border-soft); }
}

/* ── 3. the settings panel ──────────────────────────────────────────────────────────────────────────────────── */
html.nt-ui2 #nt-ui2-panel {
    position: fixed; z-index: 9400;               /* over the practice-audio bar (9380) and the mini bar (9390), under the lens sheet (9600) */
    width: 330px; max-width: calc(100vw - 16px); max-height: calc(100vh - 76px); overflow-y: auto;
    padding: 4px 16px 14px;
    background: var(--nt-card); border: 1px solid var(--nt-border-soft); border-radius: 16px;
    box-shadow: var(--nt-shadow-md);
}
html.nt-ui2 #nt-ui2-back { position: fixed; inset: 0; z-index: 9399; background: rgba(15, 23, 42, .32); display: none; }
html.nt-ui2 .ui2-panel-head { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
html.nt-ui2 .ui2-panel-head b { font-size: 16px; }
html.nt-ui2 .ui2-panel-close {
    width: 44px; height: 44px; margin-right: -10px; border: 0; border-radius: 12px; background: none; color: var(--nt-dim);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
html.nt-ui2 .ui2-panel-close:hover { background: var(--nt-hover); color: var(--nt-text); }
html.nt-ui2 #nt-ui2-panel .nt-tb-cluster { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; }
html.nt-ui2 #nt-ui2-panel .nt-hdr-sel {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px;
    border: 0; border-top: 1px solid var(--nt-divider); border-radius: 0; background: none; box-shadow: none; overflow: visible;
}
html.nt-ui2 #nt-ui2-panel .nt-view-label { font-size: 15px; font-weight: 600; color: var(--nt-text); }
html.nt-ui2 #nt-ui2-panel .nt-view-select { min-height: 44px; min-width: 172px; font-size: 15px; }
/* the size row has no label of its own on the page */
html.nt-ui2 #nt-ui2-panel .nt-zoom-seg::before { content: '악보 크기'; margin-right: auto; font-size: 15px; font-weight: 600; color: var(--nt-text); }
html.nt-ui2 #nt-ui2-panel .nt-zoom-seg { gap: 6px; }
html.nt-ui2 #nt-ui2-panel .nt-zoom-btn, html.nt-ui2 #nt-ui2-panel .nt-zoom-val {
    min-height: 44px; border: 1px solid var(--nt-border); border-radius: 10px; background: var(--nt-card);
}
html.nt-ui2 #nt-ui2-panel .nt-zoom-btn { width: 48px; font-size: 21px; }
html.nt-ui2 #nt-ui2-panel .nt-zoom-val { min-width: 66px; font-size: 14.5px; color: var(--nt-text); }
html.nt-ui2 #nt-ui2-panel #nt-keys-btn { min-height: 48px; margin-top: 4px; justify-content: center; font-size: 15px; }
/* a phone held upright: a sheet from the bottom, the score dimmed behind it */
@media (max-width: 720px) and (orientation: portrait) {
    html.nt-ui2 #nt-ui2-panel {
        left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; max-height: 70vh;
        border: 0; border-radius: 20px 20px 0 0; padding: 6px 18px calc(18px + var(--sab));
        box-shadow: 0 -12px 40px rgba(15, 23, 42, .22);
    }
    html.nt-ui2 #nt-ui2-panel::before {
        content: ''; display: block; width: 40px; height: 4px; margin: 4px auto 0; border-radius: 999px; background: var(--nt-border);
    }
    html.nt-ui2.ui2-panel-open #nt-ui2-back { display: block; }
}

/* ── 4. finger sizes ────────────────────────────────────────────────────────────────────────────────────────── */
@media (pointer: coarse) {
    html.nt-ui2 #nt-toolbar .nt-chip, html.nt-ui2 .nt-appbar .nt-chip { min-height: 44px; min-width: 44px; }
    html.nt-ui2 #nt-toolbar .nt-seg .nt-chip { min-height: 40px; min-width: 40px; }
    html.nt-ui2 #nt-toolbar .nt-bpm-input { min-height: 44px; }
    html.nt-ui2 #nt-toolbar .nt-met-set { min-width: 40px; }
    html.nt-ui2 .nt-appbar .nt-title-input { min-height: 44px; }
    html.nt-ui2 .nt-appbar .nt-brand { min-height: 44px; min-width: 44px; justify-content: center; }
}

@media print {
    html.nt-ui2 #nt-ui2-panel, html.nt-ui2 #nt-ui2-back, html.nt-ui2 #nt-ui2-more, html.nt-ui2 #nt-ui2-set { display: none !important; }
}
