*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #222633;
    --border: #2a2e3d;
    --text: #e1e4ed;
    --text-muted: #8b8fa3;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
}

h1 span { color: var(--accent); }

/* Upload area */
.upload-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
}

.upload-card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 16px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.05);
}

.drop-zone p { color: var(--text-muted); }
.drop-zone .icon { font-size: 2rem; margin-bottom: 8px; }

.file-list {
    list-style: none;
    margin-bottom: 16px;
}

.file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.file-list li .size { color: var(--text-muted); }

.file-list li .remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.1rem;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
}

input[type="text"]::placeholder { color: var(--text-muted); }
input[type="text"]:focus { border-color: var(--accent); }

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

/* Projects list */
.projects-list h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.2s;
}

.project-card:hover { border-color: var(--accent); }

.project-info { flex: 1; }

.project-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.project-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-queued { background: rgba(139, 143, 163, 0.15); color: var(--text-muted); }
.status-processing { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.status-done { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-error { background: rgba(239, 68, 68, 0.15); color: var(--error); }

.project-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-view {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 6px 12px;
    font-size: 0.8rem;
    text-decoration: none;
    border-radius: var(--radius);
}

.btn-view:hover { background: rgba(99, 102, 241, 0.1); }

/* Progress */
.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Viewer */
#viewer-container {
    width: 100%;
    height: calc(100vh - 60px);
    position: relative;
}

#viewer-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.viewer-header a { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.viewer-header h2 { font-size: 1rem; }

.viewer-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(26, 29, 39, 0.9);
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.viewer-controls button {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.85rem;
}

.viewer-controls button:hover { color: var(--accent); }

.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 1rem;
}

@media (max-width: 600px) {
    .container { padding: 16px 12px; }
    .upload-card { padding: 20px; }
    .form-row { flex-direction: column; }
    .project-card { flex-direction: column; align-items: flex-start; }
}
