#crop-overlay {
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    position: absolute;
    box-sizing: border-box;
    z-index: 10;
    cursor: grab;
    touch-action: none;
    top: 0;
    left: 0;
}

#image {
    touch-action: none;
    user-select: none;
    cursor: default;
    image-rendering: -webkit-optimize-contrast;
    max-width: none;
    max-height: none;
    min-width: 0;
    min-height: 0;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#drag-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#drag-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

#drag-overlay .overlay-content {
    text-align: center;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-container {
    padding-top: 24px;
    border-top: var(--border-thin);
}

#preview {
    width: 100%;
    border: 2px solid var(--accent);
    border-radius: 2px;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 14px;
    pointer-events: auto;
    z-index: 20;
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-btn {
    background: var(--bg-surface);
    border: 1px solid var(--accent);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.2s;
}

.zoom-btn:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.skeleton {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.skeleton.visible {
    display: flex;
}

.skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    height: 20px;
    width: 200px;
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--accent) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 2px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

#crop-overlay {
    transition: box-shadow 0.2s ease;
}

#crop-overlay:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px rgba(202, 200, 244, 0.3);
}

#crop-overlay.dragging {
    transition: none;
}

#crop-overlay.keyboard-nav {
    box-shadow: 0 0 0 3px var(--accent), 0 0 0 6px rgba(202, 200, 244, 0.3);
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tool-header-title {
    flex: 1;
    text-align: center;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}
.custom-size-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.custom-size-row .input-brutal {
    width: 80px;
}
.custom-size-row .label-brutal {
    margin: 0;
}

@media (max-width: 768px) {
    .tool-sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: auto;
        max-height: 0;
        z-index: 50;
        overflow: hidden;
        transition: max-height var(--transition-medium);
        border-right: none;
        border-bottom: var(--border-medium);
    }

    .tool-sidebar.open {
        max-height: 60vh;
    }

    .tool-sidebar-content {
        padding: 16px;
    }
}