* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1a1e;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 12px;
    gap: 10px;
}

/* ── Option selector (animals) ─────────────────────────────────────── */
.options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-shrink: 0;
    overflow-x: auto;
    padding: 4px 0;
}

.option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 6px;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border-color 0.2s ease, transform 0.1s ease;
    background: #1f1f23;
}

.option.selected {
    border-color: #4f6ef7;
    transform: scale(1.05);
}

.option img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 4px;
}

.option span {
    font-size: 12px;
    color: #ccc;
}

/* ── Toolbar ─────────────────────────────────────────────── */

.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #252529;
    border: 1px solid #333;
    border-radius: 10px;
    flex-shrink: 0;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    color: #ccc;
    background: #2e2e34;
    border: 1px solid #444;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}
.upload-btn:hover {
    background: #38383f;
    border-color: #5a5a5a;
}

.color-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.color-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#colorPicker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border: 2px solid #444;
    border-radius: 7px;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s;
}
#colorPicker:hover {
    border-color: #666;
}
#colorPicker::-webkit-color-swatch-wrapper {
    padding: 2px;
}
#colorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}
#colorPicker::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.duration-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
#durationSelect {
    padding: 5px 8px;
    font-size: 13px;
    color: #ccc;
    background: #2e2e34;
    border: 1px solid #444;
    border-radius: 7px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
#durationSelect:hover {
    border-color: #666;
}
#durationSelect option {
    background: #2e2e34;
    color: #ccc;
}

.toolbar-spacer {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-secondary {
    background: #2e2e34;
    color: #bbb;
    border-color: #444;
}
.btn-secondary:hover {
    background: #38383f;
    color: #ddd;
    border-color: #555;
}

.btn-primary {
    background: #4f6ef7;
    color: #fff;
    border-color: #4f6ef7;
}
.btn-primary:hover {
    background: #6382ff;
    border-color: #6382ff;
}
.btn-primary:active {
    background: #3d5bd9;
    transform: scale(0.98);
}

/* ── Panels ──────────────────────────────────────────────── */

.panels {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #222226;
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
    min-width: 0;
}

.panel-header {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #777;
    background: #252529;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.panel-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* Placeholder */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #555;
    font-size: 13px;
    user-select: none;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.placeholder.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

/* Canvas */
#canvas {
    display: none;
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
    image-rendering: pixelated;
    border-radius: 4px;
}
#canvas.visible {
    display: block;
}

/* Video */
#resultVideo {
    display: none;
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    outline: none;
}
#resultVideo.visible {
    display: block;
}

/* ── Status bar ──────────────────────────────────────────── */

.status-bar {
    padding: 6px 14px;
    background: #252529;
    border: 1px solid #333;
    border-radius: 10px;
    min-height: 32px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#status {
    font-size: 12px;
    color: #888;
    transition: color 0.3s;
}
#status:empty::before {
    content: "Ready";
    color: #555;
}
#status.processing {
    color: #e8b84d;
}
#status.done {
    color: #5ec269;
}
#status.error {
    color: #e05252;
}

/* ── Loading Screen ────────────────────────────────────────── */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #333;
    border-top-color: #4f6ef7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #ccc;
    font-size: 14px;
}