html, body {
    overflow-x: hidden; /* Prevent zoom-related scroll issues */
    user-select: none;
    touch-action: none; /* Disable pinch zoom and double-tap zoom */
    -ms-touch-action: manipulation; /* IE */
}

body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: url("../assets/bg_tile.png") fixed repeat;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 100dvh;
    margin: 0;
}


#dialog-overlay:has(#pdf-can) .field-row button:nth-last-of-type(2) {
    margin-left: auto
}




.share-container.combobox button {
    position: unset;
    padding-left: 14px;
    min-width: 40px;
}

.share-container.combobox button:has(span) {
    min-width: 75px;
}
.share-container.combobox button,
.share-container.combobox button:before,
.share-container.combobox button:after {
    border-radius: var(--border-radius);
    background-position: center left;
}

#share-options {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 9px;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#share-options.hidden {
    display: none;
}










.name {white-space: nowrap}

.low-res {
    filter: blur(5px);
    transition: filter 0.5s ease-out;
    transform: translateZ(0);
}

.high-res-loaded {
    filter: blur(0);
}


.main-window {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100dvh;
    top: 0;
    left: 0;
}

.main-window .title-bar {
    flex-flow: row wrap;
}


.main-window .window-body {
    display: flex;
    flex-direction: column;
    flex: 1;

    overflow-y: auto;
    /*border-bottom: 1px solid #d0ddec;
    transition: all 0.3s ease;*/
}

.main-window .status-bar > img {
    display: none;
}





#pdf-container {
    flex: 1;
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-flow: row wrap;
    justify-content: space-evenly;

    transition: all 0.66s ease-out;
    transform: translateZ(0);
}



.pdf-block {
    display: flex;
    flex-direction: column;
    width: 154px;
    height: 222px;
    margin: 10px;
    padding-top: 10px;
    align-items: center;
}
.pdf-block:hover {
    cursor: help;
}

.pdf-block * {
    /*transition: all 0.45s ease;*/
    transition: all .3s ease-in-out;
    transform: translateZ(0px); /* force GPU rendering */
}

.pdf-block .framer {
    position: relative;
    z-index: 5;
    margin: auto 0;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .1), 0 9px 20px 0 rgba(0, 0, 0,.25);
    background-color: #fff;
    /*max-height: calc(100% - 48px);*/
    /*max-width: calc(100% - 20px);*/
    overflow: hidden;
    /*align-self: center;*/
}
.pdf-block .framer,
.pdf-block .framer:before,
.pdf-block .framer:after,
.pdf-block img {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.pdf-block .framer:before,
.pdf-block .framer:after {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 1;
    top: 0;
    /*right: 0;*/
    /*bottom: 0;*/
    background: white;
    border: 1px solid #d9d9d9;
}

.pdf-block .framer:before {
    left: -3px;
}

.pdf-block .framer:after {
    left: -6px;
}

.pdf-block img {
    position: relative;
    z-index: 2;
    transform-origin: 0 50%;
    transform: rotateY(0);
    /*object-fit: scale-down;*/
    /*box-shadow: 4px 7px 7px 0 rgba(0, 0, 0, 0.27);*/
    max-width: 100%;
    max-height: 100%;
    display: inline-block;
}

.pdf-block .title {
    padding: 14px;
    pointer-events: none;
    margin-top: 10px;
    line-height: 10px;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.pdf-block .download-btn {
    position: absolute;
    z-index: 7;
    bottom: calc(45px - 3px);
    left: 50%;
    transform: translate(-50%, 0%);
    transition: opacity .45s ease-in-out !important;
    opacity: 0;

    /*
    bottom: -11px;*/
}
.pdf-block [role=progressbar]{
    position: absolute;
    z-index: 8;
    width: 60%;
    bottom: 30px;
    left: 50%;
    margin: 0;
    transform: translate(-50%, 0%);
    /*height: 8px;*/
}

/*
.pdf-block:has([role=progressbar]) .download-btn {
    border-bottom-right-radius: 0px;
    border-bottom-left-radius: 0px;
    border-bottom-width: 0px;
}
*/

.pdf-block [role=progressbar]>div {
    /*background-image: linear-gradient(180deg, #f3f3f3af, #fcfcfcaf 15%, #dbdbdbaf 50%, transparent 0), radial-gradient(circle at 0 180%, #0000002f 16.67%, transparent 100%), radial-gradient(circle at 55% -20%, #0000002f 16.67%, transparent 100%), linear-gradient(180deg, transparent 75%, #ffffff55), linear-gradient(180deg, transparent 24%, #cacaca33 0, #d5d5d533);*/
}








[role="menubar"] input {
    height: 100%;
    border: 0;
    border-radius: 0;
}

[role=menubar]>span {
    padding: 6px 10px;
}



#pagination,
[id*="btn"] {
    display: none;
}

#pagination-input {
    width: 30px;
    text-align: center
}


#page-numbers {
    text-align: center;
    user-select: none;
    padding: 6px 10px;
}

#page-numbers * {
    pointer-events: none;
    display: none;
}

#page-numbers *:last-child {
    display: inline-block;
}






.window[role=dialog]:has(.tabs) {
    overflow: hidden;
    display: flex;
    flex-flow: column;
    height: 100dvh;
    width: 100vw;

}

.window-body.has-space:has(.tabs) {
    padding: 6px;
    flex: 1;
    display: flex;
    flex-flow: column;
    overflow: hidden;
}

.tabs{
    display: flex;
    flex-flow: column;
    flex: 1;
    overflow: hidden;
    padding-top: 2px;
    margin-top: -2px;
}

.tabs [role=tabpanel] {
    flex: 1;
    flex-flow: column;
    overflow-y: auto;
}

.tabs [role=tabpanel]:not([hidden="true"]) {
    display: flex;
    overflow-x: hidden;
}

.tabs .has-scrollbar {
    flex: 1;
    overflow-y : auto;
}

.tabs li small:last-of-type {
    display: block;
}

.tabs .with-icon:first-child {
    margin-bottom: 15px;
}

.tabs fieldset .tab-end {
    margin-top: 10px;
}


/*

.tabs #tab-C ul ul {
    padding-inline-start: 2em;
}
.tabs #tab-C li + li,
.tabs #tab-C li > ul {
    margin-top: .5em;
}
*/




/* Dialog overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*background: rgba(0, 0, 0, 0.5);
    background: url("../assets/bg_tile.png") fixed repeat;*/
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: crosshair;
}

.dialog-box {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;

    display: flex;
    flex-direction: column;
    cursor: default;
}

.dialog-box .window-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.dialog-box .window-body fieldset {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

#pdf-preview,
#pdf-canvas {
    display: block;
    margin-top: -64px; /* -56px */
}

#pdf-can {
    flex: 1;
    overflow-x: hidden;
    display: flex;
    flex-flow: column;
    align-items: center;

    background-color: #525659;
    padding: 8px;

    /*transform-origin: 0 0; /* Ensure zooming works from the top-left corner */
    /*cursor: zoom-in; /* Default zoom-in cursor */
    /*transition: transform 0.3s ease; /* Smooth zooming */
}
#pdf-can canvas {
    max-width: 100%;
    max-height: 100%;
    margin-bottom:8px;
}




#loading {
    margin: auto;
}

#load-more {
    display: none;
    flex-basis: 100%;
}

#load-more.able-to-load {
    display: block;
    padding: 20px 0 30px;
}

#loading.done-loading {
    display: none;
}



.changelog li {
    transition: all .3s ease-in-out;
}

.changelog:hover li:not(:hover) {
    opacity: 0.5;
}
.changelog li:hover {
    cursor: crosshair;
}
.changelog li > time:first-child,
.changelog li:last-child:before {
    content: ' ';
    float: left;
    width: 76px;
    text-align: right;
    margin-right: 10px;
}
.changelog li:has(time) span {
    overflow: auto;
    display: block;
}
.changelog li:has(time):after {
    content: "";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}
.changelog li:last-child {
    margin-top: 10px;
}


#versionList + p {
    margin-top: 10px;
}

#versionList li + li {
    margin-top: 8px;
}
#versionList li:first-child span:after {
    content: "Latest";
    border: 1px solid #1a7f37;
    color: #1a7f37;
    font-weight: normal;
    padding: 1px 6px;
    border-radius: 20px;
    font-size: 11px;
    margin-left: 6px;
}

#versionList a *:first-child {
    color: #1f2328;
    font-weight: bold;
    font-size: 125%;
    display: inline-flex;
}

#versionList a small,
#versionList a time {
    color: #59636e;
    display: block;
    margin: 2px 0;
    font-size: smaller;
}
#versionList a:hover,
#versionList a:hover *{
    text-decoration: none;
    color: #0969da!important;
}




/* Resizable class */
.resizable {
    position: relative;
    resize: both;
    overflow: auto;
    /*min-width: 100px;
    min-height: 100px;
    border: 1px solid #ccc;*/
}

/* Movable class */
.draggable {
    position: absolute; /* Allows for dragging within the page */
    //cursor: grab; /* Change the cursor to indicate it's movable */
}



@media /*(hover: hover) and*/ (min-width: 940px) and (min-height: 450px) {



    .window[role=dialog]{
        max-width: 370px;
    }

    .window.grande[role=dialog] {
        max-width: 520px;
    }

    .window[role=dialog]:has(.tabs) {
        max-height: 500px;
        height: 80dvh;
    }


    .dialog-box {
        width: 80vw;
        height: 95dvh;
    }
    #pdf-container {
        /*align-content: space-evenly;*/
    }
    .pdf-block {
        width: 200px;
        height: 300px;
    }
    .pdf-block .framer {
        transform: rotateY(0) rotateZ(0) scale(0.9);
    }
    .pdf-block:hover .framer {
        transform: rotateY(-6deg) rotateZ(-3deg) scale(1) translateY(-10px);
        box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.25), 0 9px 20px 0 rgba(0, 0, 0, 0.45);
    }
    .pdf-block:hover img {
        transform: rotateY(-25deg);
        box-shadow: 1px 1px 5px 5px rgba(0, 0, 0, 0.2);
    }
    .pdf-block:hover .download-btn,
    .pdf-block:hover [role=progressbar] {
        opacity: 1;
    }

    @supports (hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none) {
        .pdf-block:hover .framer {
            transform: rotateZ(-3deg) scale(1);
        }
    }



    /*
    .pdf-block:hover .title {
    opacity: 0.2;
    font-style: italic;
    }*/



    /*
    .main-window .status-bar {
        border-top: 1px solid #d0ddec;
        padding: 8px 24px;
        background-color: #f1f5fb;
        font-size: large;
        color: #485d95;
        transition: transform 0.3s ease;
    }

    .main-window .status-bar img {
        display: block;
        height: 70px;
    }

    .main-window.status-hidden .status-bar {
        transform: translateY(100%);
    }*/

}

@media (max-width: 940px) {
    body {
    }
    .pdf-block {
    }
}