/* Meta-chords song detail practice controls: CTN two-row structure with MTC palette.
   Only song detail pages load this file; sheet/diagram pages are untouched. */

/* Row 1: actions and shares, like CTN's compact meta strip. */
#ja-content .mc-song-actions:not(.mc-diagram-actions) {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    white-space: nowrap;
    gap: 10px;
    margin: 7px 0 8px;
    padding: 4px 10px 9px;
    border-bottom: 1px solid #edf0f2;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) > * {
    flex: 0 0 auto;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-download {
    min-height: 32px;
    padding: 4px 6px;
    border-color: transparent !important;
    background: transparent !important;
    color: #c65c44 !important;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-download:hover {
    background: #fff4f0 !important;
    border-color: transparent !important;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-action:not(.mc-song-download) {
    min-height: 32px;
    padding: 4px 8px;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-share {
    min-height: 32px;
}

/* Inline action symbols follow CTN's lightweight metadata treatment. */
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) .mc-song-download svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
#ja-content .mc-song-actions:not(.mc-diagram-actions) a[onclick*="clickEditChord"]::before {
    content: "✎";
    margin-right: 6px;
    font-size: 15px;
    font-weight: normal;
}
#toolBar.mc-chord-toolbar #scrlDiv {
    justify-content: center;
}

/* Row 2: single compact, swipeable strip; chevron stays visible at the end. */
#ja-content .mc-song-top-toolbar {
    display: flex;
    align-items: stretch;
    float: left;
    clear: both;
    box-sizing: border-box;
    width: calc(100% - 20px);
    min-width: 0;
    margin: 5px 10px 12px;
    border: 1px solid #e2e5e9;
    border-radius: 8px;
    background: #fafbfc;
    color: #334155;
    font: 14px/1.35 Arial, Helvetica, sans-serif;
}
#ja-content .mc-song-top-viewport {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    padding: 6px 9px;
}
#ja-content .mc-song-top-main,
#ja-content .mc-song-top-settings {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
}
#ja-content .mc-song-top-settings[hidden] { display: none !important; }
#ja-content .mc-song-top-toolbar .mc-song-tool,
#ja-content .mc-song-top-toolbar .chord-comp,
#ja-content .mc-song-top-toolbar .mc-song-top-options {
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    box-sizing: border-box;
    min-height: 34px;
    margin: 0 !important;
    padding: 2px 7px !important;
    gap: 5px;
    float: none !important;
    border: 1px solid #e2e6eb;
    border-radius: 6px !important;
    background: #fff !important;
    color: #334155;
    white-space: nowrap;
}
#ja-content .mc-song-top-toolbar .chord-lb,
#ja-content .mc-song-top-toolbar .mc-song-tool-label,
#ja-content .mc-song-top-toolbar .mc-song-top-label {
    display: inline-block;
    flex: 0 0 auto;
    padding: 0 3px !important;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    line-height: 28px;
}
#ja-content .mc-song-top-toolbar .mc-song-top-options label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    cursor: pointer;
}
#ja-content .mc-song-top-toolbar input[type="checkbox"] {
    accent-color: #de6c52;
    margin: 0;
}
#ja-content .mc-song-top-toolbar input[type="button"]:not(#c-color),
#ja-content .mc-song-top-toolbar #changeScreen,
#ja-content .mc-song-top-toolbar .mc-song-view-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 28px;
    min-width: 29px;
    width: auto;
    margin: 0 2px !important;
    padding: 2px 6px !important;
    background: #f3f4f6 !important;
    border: 1px solid #e2e6eb;
    border-radius: 5px !important;
    color: #334155 !important;
    font-size: 14px;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
#ja-content .mc-song-top-toolbar #changeScreen {
    min-width: 40px;
}
#ja-content .mc-song-top-toolbar input[type="button"]:disabled {
    color: #94a3b8 !important;
    cursor: not-allowed;
    opacity: .75;
}
#ja-content .mc-song-top-toolbar input[type="button"]:not(#c-color):hover:not(:disabled),
#ja-content .mc-song-top-toolbar .mc-song-view-trigger:hover {
    background: #fff1ed !important;
    border-color: #e6b6a9;
}
#ja-content .mc-song-top-toolbar select {
    box-sizing: border-box;
    height: 29px;
    min-width: 42px;
    margin: 0 2px;
    padding: 2px 6px;
    border: 1px solid #dfe3e8;
    border-radius: 5px;
    background: #fff !important;
    color: #334155 !important;
    font-size: 13px;
}
#ja-content .mc-song-top-toolbar #ch-type { min-width: 85px; }
#ja-content .mc-song-top-toolbar #ch-font { display: inline-block; width: 52px !important; }
#ja-content .mc-song-top-toolbar #chord-manip,
#ja-content .mc-song-top-toolbar #ch-size-div {
    display: inline-flex;
    align-items: center;
    float: none !important;
    gap: 3px;
}
#ja-content .mc-song-top-toolbar .ccb2 { float: none !important; }
#ja-content .mc-song-top-toolbar #ch-size-div input[type="button"] { width: 28px; }
#ja-content .mc-song-top-toolbar #ch-tone,
#ja-content .mc-song-top-toolbar #ch-index {
    font-variant-numeric: tabular-nums;
    color: #334155;
    font-weight: 600;
}
#ja-content .mc-song-top-toggle {
    flex: 0 0 36px;
    width: 36px;
    padding: 0;
    border: 0;
    border-left: 1px solid #e2e5e9;
    border-radius: 0 7px 7px 0;
    background: #f8f9fa;
    color: #475467;
    font: 19px Arial, sans-serif;
    cursor: pointer;
}
#ja-content .mc-song-top-toggle:hover { background: #eef1f5; }
#ja-content .mc-song-top-toolbar :is(button, a, select, input):focus-visible {
    outline: 2px solid #de6c52;
    outline-offset: 2px;
}
@media (max-width: 600px) {
    #ja-content .mc-song-top-toolbar { width: calc(100% - 10px); margin: 5px 5px 12px; }
    #ja-content .mc-song-top-viewport { padding: 5px 6px; gap: 5px; }
    #ja-content .mc-song-top-main,
    #ja-content .mc-song-top-settings { gap: 5px; }
    #ja-content .mc-song-actions:not(.mc-diagram-actions) { padding: 4px 5px 9px; }
}

/* v2: Meta actions share Artist's line; both rows wrap, never scroll. */
#ja-content .article-info.mc-song-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    clear: both;
}
#ja-content .article-info.mc-song-info > .mc-song-artist { flex: 0 0 auto; }
#ja-content .article-info.mc-song-info > .mc-song-actions:not(.mc-diagram-actions) {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    float: none;
    clear: none;
    box-sizing: border-box;
    width: auto;
    max-width: 100%;
    min-width: 0;
    gap: 6px 9px;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: visible;
    white-space: normal;
}
#ja-content .article-info.mc-song-info > #bottomtitlebanner {
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
}
#ja-content .mc-song-top-viewport {
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    padding: 6px 8px;
}
#ja-content .mc-song-top-main {
    display: contents;
}
#ja-content .mc-song-top-settings,
#ja-content .mc-song-top-settings[hidden] {
    display: contents !important;
}
#ja-content .mc-song-top-toggle { display: none !important; }
#ja-content .mc-song-top-toolbar .mc-legacy-view-state { display: none !important; }
#ja-content .mc-song-top-toolbar .mc-song-view-trigger { min-width: 40px; }
#ja-content .mc-song-top-toolbar #mc-view-compact { min-width: 32px; }
#ja-content .mc-song-top-toolbar .mc-song-center-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 5px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}
/* Do not force a background color on #c-color: changeColor() sets it inline. */
#ja-content .mc-song-top-toolbar #c-color {
    box-sizing: border-box;
    width: 32px !important;
    min-width: 32px;
    height: 28px;
    margin: 0 2px !important;
    padding: 0 !important;
    border: 1px solid #b9c2cf;
    border-radius: 5px !important;
    background-image: none !important;
    color: transparent !important;
    font-size: 0;
    cursor: pointer;
}
#ja-content .mc-song-top-toolbar #c-color:hover:not(:disabled) {
    border-color: #de6c52;
    box-shadow: 0 0 0 2px rgba(222,108,82,.18);
}
#toolBar.mc-chord-toolbar #scrlDiv {
    flex-wrap: wrap !important;
    justify-content: center;
    overflow-x: visible !important;
}
/* Native fullscreen plus CSS-only fallback for both View modes. */
#mc-exit-song-view { display: none !important; }
html.mc-song-fullscreen #mc-exit-song-view {
    display: block !important;
    position: fixed;
    z-index: 1000001;
    top: 9px;
    right: 10px;
    min-width: 46px;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff !important;
    color: #334155 !important;
    font: 17px Arial, Helvetica, sans-serif;
    cursor: pointer;
}
html.mc-song-fullscreen #ja-col22,
html.mc-song-fullscreen #ja-header,
html.mc-song-fullscreen #pg-header,
html.mc-song-fullscreen #ja-topnav,
html.mc-song-fullscreen #ja-footer { display: none !important; }
html.mc-song-fullscreen #main-box,
html.mc-song-fullscreen #ja-contentwrap,
html.mc-song-fullscreen #ja-content {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
}
html.mc-song-fullscreen .mc-song-top-toolbar .mc-song-view { display: none !important; }
html.mc-song-fullscreen .mc-song-top-toolbar {
    margin-right: 56px !important;
    width: calc(100% - 66px) !important;
}
html.mc-song-compact-view #chord-lyrics:not(.disable-select-text) { line-height: 1.55556 !important; }
@media (max-width: 600px) {
    #ja-content .article-info.mc-song-info { gap: 6px 10px; }
    #ja-content .article-info.mc-song-info > .mc-song-actions:not(.mc-diagram-actions) { gap: 6px; }
    #ja-content .mc-song-top-viewport { flex-wrap: wrap; padding: 5px; }
}

/* Chord labels in Above mode must be positioned above their lyric character.
   Restore the original .chk placement on all viewports, not only mobile.
   Keep the label from enlarging the normal text line box. */
#ja-content #chord-lyrics .chk {
    display: inline-block;
    position: relative;
    width: 0;
    white-space: nowrap;
    vertical-align: baseline;
    top: auto;
    bottom: 0.85em;
    line-height: 1;
    font-weight: bold;
}

/* The legacy toolbar forces display:inline-flex!important on chord groups.
   These scoped hidden rules must override it when Hide chords is checked. */
#ja-content .mc-song-top-toolbar .mc-song-inline-option[hidden],
#ja-content .mc-song-top-toolbar .mc-song-instrument-group[hidden] {
    display: none !important;
}

/* When chords are hidden, Transpose is irrelevant too.  Override the legacy
   inline-flex!important chord group rule just like Instrument and Inline. */
#ja-content .mc-song-top-toolbar .mc-song-transpose-group[hidden] {
    display: none !important;
}

/* Row 1: understated text separators between Artist, Download, Edit and Share.
   Only song-detail actions use this class; diagram listing UI is unchanged. */
#ja-content .article-info.mc-song-info .mc-song-meta-separator {
    display: inline-block;
    align-self: center;
    flex: 0 0 auto;
    color: #9aa4b2;
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    user-select: none;
}

/* Keep View and YouTube visible when the chord settings are collapsed.
   The earlier all-visible override used display:contents!important even
   for [hidden], which prevented the toolbar from collapsing. */
#ja-content .mc-song-top-settings[hidden] {
    display: none !important;
}
#ja-content .mc-song-top-settings:not([hidden]) {
    display: contents !important;
}
#ja-content .mc-song-top-toolbar .mc-song-top-toggle {
    display: inline-flex !important;
    flex: 0 0 36px;
    align-self: stretch;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    margin: 0 0 0 auto;
    border: 0;
    border-left: 1px solid #e2e5e9;
    border-radius: 0 7px 7px 0;
    background: #f8f9fa !important;
    color: #475467 !important;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}
#ja-content .mc-song-top-toolbar .mc-song-top-toggle:hover {
    background: #eef1f5 !important;
}

/* Scroll controls: the numerical selector is now a first-class control
   between - and +. Never allow its width to collapse on mobile. */
#toolBar.mc-chord-toolbar #scrlDiv #ch-speed {
    display: inline-block !important;
    box-sizing: border-box;
    min-width: 56px;
    width: 60px;
    height: 30px;
    margin: 0 3px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* On phones, omit the entire View group, while keeping YouTube and the
   remaining chord/lyrics controls accessible. Desktop View is unchanged. */
@media (max-width: 600px) {
    #ja-content .mc-song-top-toolbar .mc-song-view {
        display: none !important;
    }
}