#workspace {
    display: none;
    text-align: center;
    background: #f6f7fa;
    border: 1px solid #eee;
    border-radius: 3px;
    display: none;
}

.night #workspace {
    background: #181a1b;
    border: 1px solid #444;
}

.control-bar {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.night .control-bar {
    border-bottom: 1px solid #444;
}

.mode-group {
    border-radius: 6px;
    float: left;
    overflow: hidden;
    background-color: #fff;
    border: 1px solid #eee;
}

.night .mode-group {
    border: 1px solid #444;
    background-color: #232627;
}

.control-bar>div:nth-child(1)>div:nth-child(1) {
    margin-right: 0.5rem;
}

.pdfbut {
    padding: 0.2rem 0.5rem;
    border: 0;
    background-color: #fff;
    cursor: pointer;
}

.night .pdfbut {
    color: #bbb;
    background-color: #232627;
}

.pdfbut.r {
    border-right: 1px solid #eee;
}

.night .pdfbut.r {
    border-right: 1px solid #444;
}

.pdfbut.l {
    border-left: 1px solid #eee;
}

.night .pdfbut.l {
    border-left: 1px solid #444;
}

#pageInfo,
#zoomInfo,
#zoom-level {
    padding: 0.2rem 0.5rem;
}

.night #pageInfo, .night #zoomInfo, .night #zoom-level {
    background-color: #232627;
    color: #bbb;
    border: 0;
}


.action-area {
    margin-top: 0.75rem;
    text-align: center;
    padding-bottom: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.action-area button {
    padding: 0.25rem 0.75rem;
    background-color: #FF9800;
    color: #fff;
    border: 0;
    border-radius: 3px;
    font-size: 0.65rem;
    cursor: pointer;
}

.action-area button.clears {
    background-color: #607D8B;
}

#main-area {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    padding: 0 0.5rem;
}

#pdf-container {
    position: relative;
    overflow: visible !important;
    box-sizing: border-box;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

#pdf-container canvas {
    display: block;
    width: auto;
    height: auto;
    border: 1px solid #eee;
}

#dim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2;
    display: none;
}

#crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    border: 2px solid #4a90e2;
    background-color: rgba(74, 144, 226, 0.15);
    cursor: move;
    min-width: 20px;
    min-height: 20px;
    z-index: 5;
    touch-action: none; 
}

.handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: white;
    border: 1px solid #488cdc;
    border-radius: 50%;
    z-index: 6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.h-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.h-n {
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: n-resize;
}

.h-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.h-e {
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    cursor: e-resize;
}

.h-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.h-s {
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    cursor: s-resize;
}

.h-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.h-w {
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    cursor: w-resize;
}

.allpagealert{
    text-align: center;
}

.allpagealert button{
    display: block;
    padding: 0.25rem 0;
    border: 0;
    background-color: #2196F3;
    color: #fff;
    width: 7rem;
    margin: auto;
    border-radius: 3px;
    font-size: 0.6rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.allpagealert button:nth-child(3){
    background-color: #FF9800;
}

.allpagealert button:nth-child(4){
    background-color: #FF9800;
}

.allpagealert button:last-child{
    margin-bottom: 0;
}

#size-tooltip {
    position: fixed;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
    display: none;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

@media screen and (max-width: 450px) {
    .control-bar {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {

    .handle {
        width: 18px !important;
        height: 18px !important;
        border-width: 2px;
    }

    .h-nw { top: -9px; left: -9px; }
    .h-n  { top: -9px; left: 50%; transform: translateX(-50%); }
    .h-ne { top: -9px; right: -9px; }
    .h-e  { top: 50%; right: -10px; transform: translateY(-50%); }
    .h-se { bottom: -9px; right: -9px; }
    .h-s  { bottom: -9px; left: 50%; transform: translateX(-50%); }
    .h-sw { bottom: -9px; left: -9px; }
    .h-w  { top: 50%; left: -9px; transform: translateY(-50%); }
}

#crop-overlay, .handle {
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    pointer-events: auto !important;
}