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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f4f6f9;
    color: #1f2937;
    line-height: 1.5;
    padding: 2rem 1rem;
}

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

header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

header p {
    color: #6b7280;
}

.dropzone {
    border: 2px dashed #b0b8c4;
    border-radius: 12px;
    background: #fff;
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.dropzone-text {
    color: #6b7280;
    font-size: 1rem;
}

.browse {
    color: #2563eb;
    text-decoration: underline;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    cursor: grab;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card.sortable-ghost {
    opacity: 0.4;
}

.card .thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}

.card .meta {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card .index-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card .remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
}

.card .remove:hover {
    background: rgba(220, 38, 38, 0.9);
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

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

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:not(:disabled):hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #e5e7eb;
    color: #1f2937;
}

.btn-secondary:not(:disabled):hover {
    background: #d1d5db;
}

.status {
    margin-top: 1rem;
    text-align: center;
    min-height: 1.25rem;
    color: #6b7280;
}

.status.error {
    color: #dc2626;
}
