body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background-color: #f0f2f5;
    margin: 0;
}

h1 {
    color: #333;
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

fieldset {
    border: 1px solid #ccc;
    border-radius: 4px;
}

.base-size {
    margin: 8px 0 0;
    font-size: 14px;
    color: #555;
}

#widthInput,
#heightInput {
    width: 70px;
    margin-right: 10px;
}

.size-ref-row {
    margin-top: 10px;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
}
.zoom-control input[type="range"] {
    width: 160px;
}
#zoomValueText {
    font-size: 14px;
    color: #555;
    width: 45px;
}

.error-text {
    color: #c0392b;
    min-height: 1.2em;
    margin: 4px 0 12px;
}

.hint {
    font-size: 14px;
    color: #555;
    margin: 4px 0 8px;
}

#previewWrapper {
    display: grid;
    place-items: center;
    margin-top: 10px;
}

#previewStage {
    position: relative;
    display: none;
    width: 600px;
    height: 500px;
    overflow: hidden;
    background-color: #2c2c2c;
    border: 1px solid #444;
    cursor: grab;
}

#previewStage.dragging {
    cursor: grabbing;
}

#dimImage {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#cropWindow {
    position: absolute;
    overflow: hidden;
    border: 2px solid #e066ff;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

#previewImage {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}
