.visually-hidden
{
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.app-dialog-backdrop
{
    display:none;
    position:fixed;
    inset:0;
    z-index:299;
    background:rgba(42, 48, 58, 0.55);
}

.app-dialog-backdrop.visible
{
    display:block;
}

body.app-dialog-open
{
    overflow:hidden;
}

dialog
{
    position:fixed;
    z-index:300;
    top:50%;
    left:50%;
    margin:0;
    padding:0;
    border:none;
    background:transparent;
    box-shadow:none;
    transform: translateX(-50%) translateY(-50%);
}
dialog:not(.visible)
{
    display:none;
}
dialog.visible
{
    display:flex;
}
.dialog_content
{
    position:relative;
    cursor:default;
    padding:50px;
    background:var(--surface, white);
    border:1px solid var(--border, var(--color3));
    border-radius:0.75rem;
    overflow:hidden;
    box-shadow:
        0 24px 48px rgba(42, 48, 58, 0.18),
        0 8px 16px rgba(42, 48, 58, 0.08);
    box-sizing:border-box;
    @media (max-width: 760px) {
        padding:24px 16px;
    }
}

.dialog_close
{
    position:absolute;
    z-index:3;
    cursor:pointer;
    top:12px;
    right:12px;
    width:40px;
    height:40px;
    padding:0;
    border:none;
    border-radius:999px;
    background:var(--color8, var(--color2));
    display:flex;
    align-items:center;
    justify-content:center;
    transition:background 0.15s ease;
}
.dialog_close:hover
{
    background:var(--color7, var(--color2));
}
.dialog_close:before,
.dialog_close:after
{
    position:absolute;
    top:50%;
    left:50%;
    display:block;
    content:'';
    width:15px;
    height:1px;
    background:var(--color3, black);
    transform:translateX(-50%) translateY(-50%) rotate(45deg);
    transform-origin:50% 50%;
}
.dialog_close:after
{
    transform:translateX(-50%) translateY(-50%) rotate(-45deg);
    transform-origin:50% 50%;
}

h2.dialog_title
{
    background:transparent;
    text-align:center;
    font-size:20px;
    padding-bottom:20px;
}
.dialog_content select
{
    width:100%;
    height:50px;
    line-height:50px;
    font-size:12px;
    padding:0px 10px;
}
.dialog_button
{
    margin-top:20px;
}
.listables
{
    line-height:37px;
    list-style:none;
}
.listables label
{
    display:flex;
    align-items:center;
}
.listables input
{
    display:inline-block;
    width:25px;
    height:25px;
    vertical-align:top;
    margin:0 10px 0 0;
}

/* Embed button */
.partitura_embed_btn
{
    cursor: pointer;
    background: var(--color3) url(../images/embed.svg) 10px center no-repeat;
    background-size: auto 50%;
    color: var(--color4);
    border: none;
    padding: 8px 15px 8px 35px;
    font-size: 12px;
    border-radius: 5px;
    margin-top: 15px;
    display: inline-block;
}
.partitura_embed_btn:hover
{
    opacity: 0.8;
}

/* Embed dialog */
.embed_dialog .dialog_content
{
    max-width: 600px;
    width: 90vw;
}
.embed_intro
{
    margin-bottom: 20px;
    color: var(--color3);
}
.embed_options
{
    background: var(--color7);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}
.embed_options h3,
.embed_preview h3,
.embed_code_container h3
{
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--color3);
}
.embed_option
{
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
}
.embed_option input[type="checkbox"]
{
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.embed_option_height
{
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--color2);
}
.embed_option_height input[type="number"]
{
    width: 80px;
    padding: 5px 10px;
    border: 1px solid var(--color3);
    border-radius: 3px;
    margin: 0 5px;
}
.embed_preview
{
    margin-bottom: 20px;
}
.embed_url
{
    display: block;
    background: var(--color2);
    padding: 10px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-all;
    color: var(--color3);
}
.embed_code_container
{
    position: relative;
}
.embed_code
{
    width: 100%;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid var(--color3);
    border-radius: 3px;
    resize: vertical;
    background: var(--color2);
}
.embed_copy_btn
{
    margin-top: 10px;
}
.embed_copied_msg
{
    display: none;
    margin-left: 15px;
    color: var(--green);
    font-weight: bold;
}
.embed_copied_msg.visible
{
    display: inline;
}

/* Save to list button */
.partitura_addtolist_btn
{
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background-color: var(--green);
    color: var(--color4);
    border: none;
    padding: 0.5rem 0.9rem 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--item-radius, 5px);
    margin-top: 0;
    margin-right: 0;
    text-decoration: none;
    white-space: nowrap;
}

.partitura_addtolist_btn::before
{
    content: '';
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    background: url(../images/save.svg) center / contain no-repeat;
}

.partitura_addtolist_btn:hover
{
    opacity: 0.88;
}

/* Add to list dialog */
.addtolist_dialog .dialog_content
{
    max-width: 480px;
    width: 90vw;
}
.addtolist_intro
{
    margin-bottom: 15px;
    color: var(--color3);
    font-size: 14px;
}
.addtolist_list
{
    background: var(--color7);
    padding:10px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 8px;
}
.addtolist_empty
{
    color: var(--color3);
    opacity: 0.8;
    font-size: 13px;
    margin-top: 8px;
}
.addtolist_list li
{
    margin-bottom: 6px;
}
.addtolist_count
{
    color: var(--color5);
    font-size: 12px;
}
.addtolist_create
{
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--color7);
}
.addtolist_create_title
{
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--color3);
}
.addtolist_create_form
{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.addtolist_new_name
{
    flex: 1;
    min-width: 140px;
    padding: 8px 10px;
    border: 1px solid var(--color7);
    border-radius: 4px;
    font-size: 14px;
}

/* Tag picker dialog */
.tagpicker_dialog .dialog_content
{
    max-width: 34rem;
    width: 90vw;
}

.tagpicker_search
{
    width: 100%;
    margin-bottom: 15px;
    padding: 8px 10px;
    border: 1px solid var(--color7);
    border-radius: 4px;
    background: var(--surface, white);
    color: var(--color3);
    font: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.tagpicker_search:focus
{
    outline: none;
    border-color: var(--color5);
    box-shadow: 0 0 0 3px rgba(159, 109, 65, 0.12);
}

.tagpicker_list
{
    background: var(--color7);
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
}

.tagpicker_list li
{
    margin: 0;
    border-bottom: 1px solid var(--border, var(--color7));
}

.tagpicker_list li:last-child
{
    border-bottom: none;
}

.tagpicker_list .btn
{
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color3);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
}

.tagpicker_list .btn::before
{
    flex-shrink: 0;
}

.tagpicker_list .btn.is-selected
{
    background: var(--color8, var(--color2));
    box-shadow: inset 3px 0 0 var(--color5);
    font-weight: 600;
}

.tagpicker_list .btn.is-active:not(.is-selected)
{
    background: rgba(159, 109, 65, 0.08);
    box-shadow: inset 3px 0 0 var(--color5);
}

.tagpicker_list .btn.is-selected::after
{
    content: '✓';
    margin-left: auto;
    padding-left: 0.5rem;
    color: var(--color5);
    font-weight: 700;
}

.tagpicker_list .btn:not(.is-selected):hover
{
    background: var(--color8, var(--color2));
    opacity: 1;
}

.tagpicker_dialog .dialog_button
{
    margin-top: 20px;
    text-align: center;
}

.tagpicker_done
{
    min-width: 6rem;
}
