/* Photo controls sit beside the finished artwork, never inside its frame. */
.sim-oncover-tools {
    position: absolute; z-index: 5; bottom: 10px; left: 10px; right: 10px;
    display: flex; justify-content: center; align-items: center; gap: 4px;
    padding: 4px; border-radius: 12px; background: #ce4b00f2; color: #fff;
    box-shadow: 0 4px 12px #0002;
}
.sim-oncover-tools[hidden] { display: none; }
.sim-oncover-tools button {
    min-width: 44px; min-height: 44px; padding: 5px 9px;
    border: 0; border-radius: 8px; background: #fff; color: #24203d;
    font: inherit; font-size: 1rem; font-weight: 800; cursor: pointer;
}
.sim-oncover-tools button:focus-visible { outline: 3px solid #ffca45; outline-offset: 2px; }
.sim-oncover-tools output { flex: 1; text-align: center; font-size: .8rem; font-weight: 800; }
.sim-oncover-tools #simPhotoDragDone { font-size: .75rem; background: #ffe4b6; }
.sim-photo-tools {
    width: min(100%, 540px);
    min-width: 0;
    margin-top: 25px;
    color: #24203d;
    container: simPhotoTools / inline-size;
}

.sim-photo-tools__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sim-photo-tools button,
.sim-photo-replace {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid #d7cbbb;
    border-radius: 10px;
    background: #fffdfa;
    color: #24203d;
    font: inherit;
    font-size: .73rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
}

.sim-photo-tools svg { width: 17px; height: 17px; flex: 0 0 auto; }
.sim-photo-tools button:not(:disabled):hover,
.sim-photo-replace:hover { border-color: #ce4b00; background: #fff1df; }
.sim-photo-tools button:focus-visible,
.sim-photo-tools input:focus-visible,
.sim-photo-replace:focus-visible { outline: 3px solid #ce4b00; outline-offset: 3px; }
.sim-photo-tools button:disabled { cursor: default; opacity: .5; }

.sim-photo-tools .sim-photo-drag-toggle {
    flex: 1 1 180px;
    border-color: #ce4b00;
    background: #ce4b00;
    color: #fff;
}
.sim-photo-tools .sim-photo-drag-toggle:not(:disabled):hover,
.sim-photo-tools .sim-photo-drag-toggle[aria-pressed="true"] {
    border-color: #ce4b00;
    background: #ce4b00;
    color: #fff;
}
.sim-photo-replace { flex: 0 1 auto; }
.sim-photo-help { margin: 10px 0 14px; color: #635d70; font-size: .73rem; line-height: 1.55; }

.sim-photo-editor {
    min-width: 0;
    margin: 0;
    padding: 14px;
    border: 1px solid #d8d4c7;
    border-radius: 15px;
    background: #fff9ee;
}
.sim-photo-editor legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0 6px;
    color: #24203d;
    font-size: .83rem;
    font-weight: 900;
    line-height: 1.35;
}
.sim-photo-editor__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 12px; }
.sim-photo-control { min-width: 0; }
.sim-photo-control__label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sim-photo-control__label label,
.sim-photo-control__title { display: block; margin: 0 0 6px; color: #4d465b; font-size: .7rem; font-weight: 800; }
.sim-photo-control output { align-self: flex-start; color: #9b3b06; font-size: .7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sim-photo-range { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 7px; }
.sim-photo-tools input[type="range"] {
    display: block;
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    padding: 0;
    accent-color: #ce4b00;
    cursor: pointer;
}
.sim-photo-tools input[type="range"]:disabled { cursor: default; opacity: .55; }
.sim-photo-button-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 5px; }
.sim-photo-button-row button { flex: 1 1 44px; padding: 8px 5px; }
.sim-photo-editor__footer { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #e9dfd1; }
.sim-photo-editor__footer button { flex: 1 1 125px; }

.sim-photo-frame { position: relative; user-select: none; -webkit-user-select: none; }
.sim-photo-frame img { pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.sim-photo-hit-area { pointer-events: none; outline: none; }
.sim-photo-hit-area.is-ready { pointer-events: all; cursor: grab; }
.sim-photo-hit-area.is-editing { touch-action: none; stroke: #ffdd7c; stroke-width: 10; stroke-dasharray: 18 12; }
.sim-photo-hit-area.is-dragging { cursor: grabbing; }
.sim-photo-hit-area:focus-visible { stroke: #fff3ba; stroke-width: 12; stroke-dasharray: 18 12; }
#simCoverOverlay,
#simPhotoMat,
#simPhotoInnerRim,
#simPhotoRim { pointer-events: none; }

@container simPhotoTools (max-width: 420px) {
    .sim-photo-editor__grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
    .sim-photo-tools { margin-top: 20px; }
    .sim-photo-editor { padding: 12px; }
    .sim-photo-editor__grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
    .sim-photo-tools__actions > * { flex: 1 1 100%; }
    .sim-photo-editor__footer { gap: 7px; }
    .sim-photo-editor__footer button { flex-basis: 100%; }
}
