.main-container-app {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px 64px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    box-sizing: border-box;
}

.oe-card {
    width: 100%;
    max-width: 860px;
    background: var(--card-bg, #fff);
    border: 1px solid #e8ecf1;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
}

.oe-head {
    text-align: center;
    margin-bottom: 24px;
}

.oe-head h1 {
    margin: 0 0 8px;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: var(--text);
}

.oe-head p {
    margin: 0;
    font-size: 14px;
    color: var(--muted-foreground);
}

.oe-drop {
    display: block;
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    padding: 44px 24px;
    text-align: center;
    cursor: pointer;
    background: #f9fafb;
    transition: border-color 0.2s, background 0.2s;
    pointer-events: auto;
    user-select: none;
}

.oe-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.oe-drop:hover,
.oe-drop.is-dragover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.oe-drop__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    color: var(--primary);
}

.oe-drop__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
}

.oe-drop__hint {
    margin: 0;
    font-size: 13px;
    color: var(--muted-foreground);
}

.oe-file-name {
    margin-top: 10px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
    word-break: break-all;
}

.oe-editor {
    display: none;
}

.oe-editor.is-visible {
    display: block;
}

.oe-canvas-wrap {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    touch-action: none;
    cursor: crosshair;
}

.oe-canvas-wrap canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.oe-canvas-wrap #oeImageCanvas {
    z-index: 1;
}

.oe-canvas-wrap #oePaintCanvas {
    z-index: 2;
    pointer-events: auto;
}

.oe-brush-cursor {
    position: absolute;
    border: 2px solid rgba(239, 68, 68, 0.85);
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    transform: translate(-50%, -50%);
    display: none;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.oe-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.oe-brush-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.oe-brush-slider {
    flex: 1;
    min-width: 120px;
    accent-color: var(--primary);
    height: 6px;
}

.oe-brush-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    min-width: 48px;
    text-align: right;
}

.oe-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.oe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    border: none;
}

.oe-btn--primary {
    flex: 1;
    min-width: 160px;
    background: var(--grad);
    color: var(--primary-foreground);
}

.oe-btn--primary:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
}

.oe-btn--primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.oe-btn--ghost {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.oe-btn--ghost:hover:not(:disabled) {
    background: #f8fafc;
}

.oe-btn--ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.oe-btn--download {
    background: #16a34a;
    color: #fff;
    text-decoration: none;
}

.oe-btn--download:hover {
    opacity: 0.92;
    color: #fff;
}

.oe-error {
    display: none;
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 13px;
    text-align: center;
}

.oe-error.is-visible {
    display: block;
}

.oe-progress {
    display: none;
    margin-top: 14px;
}

.oe-progress.is-visible {
    display: block;
}

.oe-progress__bar {
    height: 6px;
    border-radius: 999px;
    background: #eef2ff;
    overflow: hidden;
    border: 1px solid #e0e7ff;
}

.oe-progress__fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #5B5FF8, #9aa0ff);
    transition: width 0.15s linear;
}

.oe-progress__text {
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.oe-output-actions {
    display: none;
    margin-top: 14px;
    gap: 10px;
}

.oe-output-actions.is-visible {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .oe-card { padding: 24px 16px; }
    .oe-toolbar { flex-direction: column; align-items: stretch; }
    .oe-actions { flex-direction: column; }
    .oe-btn { width: 100%; }
}
