* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}
.container {
    max-width: 600px;
    margin: 40px auto;
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}
form, .form-section, .split-left, .split-right {
    max-width: 100%;
    overflow: hidden;
}
.container.layout-wide {
    max-width: 1100px;
}
.split-layout {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
.split-left {
    flex: 1;
    min-width: 0;
}
.split-right {
    width: 340px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}
.preview-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}
.preview-panel h3 {
    font-size: 15px;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.preview-panel canvas {
    width: 100%;
    border-radius: 6px;
}
.preview-zoom-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #666;
}
.preview-zoom-bar input[type="range"] {
    flex: 1;
    margin: 0;
}
.btn-tiny {
    background: #e5e7eb;
    color: #374151;
    border: none;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin: 0;
}
.btn-tiny:hover { background: #d1d5db; }
.preview-placeholder {
    color: #9ca3af;
    text-align: center;
    padding: 60px 20px;
    font-size: 14px;
}
.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    margin-top: 0;
    cursor: pointer;
}
.radio-label input[type="radio"] {
    margin: 0;
}
.field-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}
@media (max-width: 800px) {
    body { padding: 8px; }
    .container, .container.layout-wide {
        max-width: 100%;
        padding: 16px;
        margin: 8px auto;
        border-radius: 8px;
    }
    .split-layout { flex-direction: column; }
    .split-right { width: 100%; position: static; }
    .form-section { padding: 12px; }
    .form-row { flex-direction: column; gap: 0; }
    input[type="text"], textarea, input[type="file"], select, input[type="range"] {
        max-width: 100%;
    }
}
h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #1a1a1a;
}
.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}
.error {
    background: #fff0f0;
    border: 1px solid #e33;
    color: #c00;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
}
label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 16px;
}
input[type="text"], textarea, input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}
textarea { resize: vertical; }
input[type="file"] { padding: 8px; }
button, .btn {
    display: inline-block;
    background: #dc2626;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    text-decoration: none;
    text-align: center;
}
button:hover, .btn:hover { background: #b91c1c; }
.btn-secondary {
    background: #6b7280;
}
.btn-secondary:hover { background: #4b5563; }
video {
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.actions {
    text-align: center;
    margin-top: 20px;
}
.actions a { margin: 0 8px; }

/* Form sections */
.form-section {
    margin-top: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.form-section h3 {
    font-size: 15px;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inline form row for color pickers */
.form-row {
    display: flex;
    gap: 16px;
}
.form-group {
    flex: 1;
}

/* Color picker styling */
input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 4px;
    cursor: pointer;
    background: white;
}

/* Range slider styling */
input[type="range"] {
    width: 100%;
    margin: 8px 0;
    cursor: pointer;
}

/* Select dropdown styling */
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: white;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Download button enhancement */
.btn-download {
    background: #16a34a;
    font-size: 18px;
    padding: 14px 40px;
}
.btn-download:hover {
    background: #15803d;
}

/* Batch processing styles */
.progress-container {
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
}
.progress-bar {
    height: 24px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #16a34a;
    border-radius: 8px;
    transition: width 0.3s ease;
}
.entry-list {
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.entry-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.entry-item:last-child {
    border-bottom: none;
}
.entry-status {
    font-size: 16px;
    width: 20px;
    text-align: center;
}
.entry-done .entry-status { color: #16a34a; }
.entry-failed .entry-status { color: #dc2626; }
.entry-processing .entry-status { color: #f59e0b; }
.entry-title {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.entry-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.entry-badge-done { background: #dcfce7; color: #166534; }
.entry-badge-failed { background: #fee2e2; color: #991b1b; }
.entry-badge-processing { background: #fef3c7; color: #92400e; }
.entry-error {
    width: 100%;
    font-size: 12px;
    color: #991b1b;
    margin-top: 4px;
    padding-left: 30px;
}
.results-list {
    margin: 16px 0;
}
.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.result-title {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.result-done { background: #f0fdf4; }
.result-failed { background: #fef2f2; }

/* Media library */
.media-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.media-item:last-child { border-bottom: none; }
.media-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.media-name {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.media-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.btn-del { color: #dc2626; }
.btn-del:hover { background: #fee2e2; }

/* Thumbnail strip for multi-image */
.thumbnail-strip {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    overflow-x: auto;
    min-height: 0;
}
.thumbnail-strip:empty {
    display: none;
}
.thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: border-color 0.15s;
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.thumb.active {
    border-color: #dc2626;
}
.thumb:hover {
    border-color: #9ca3af;
}
.thumb.active:hover {
    border-color: #dc2626;
}
.thumb-index {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    pointer-events: none;
}
.thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    display: none;
}
.thumb:hover .thumb-remove {
    display: block;
}
.thumb.dragging {
    opacity: 0.4;
}
.thumb.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
