:root {
    --bg: #f6f7fb;
    --card-bg: #ffffff;
    --text: #1f2330;
    --text-muted: #6c7280;
    --primary: #2e6cff;
    --primary-hover: #1e54d8;
    --border: #e3e6ef;
    --error-bg: #fdecec;
    --error-text: #a31515;
    --info-bg: #eef3fe;
    --info-text: #1e54d8;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

.brand {
    text-align: center;
    padding: 32px 16px 8px;
}

.brand__name {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.5px;
}

.brand__tagline {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    font-style: italic;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(20, 28, 50, 0.04);
}

.card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.hint {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 16px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.form--inline { flex-direction: row; align-items: center; }

.form label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    color: var(--text-muted);
    gap: 4px;
}

.form input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text);
    background: #fff;
}

.form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 108, 255, 0.15);
}

.form button {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
}

.form button:hover { background: var(--primary-hover); }

.btn--secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn--secondary:hover {
    background: #f0f2f8;
    color: var(--text);
}

.btn--link {
    display: inline-block;
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.btn--link:hover { background: var(--primary-hover); }

.flash {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash li {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.flash--error { background: var(--error-bg); color: var(--error-text); }
.flash--info  { background: var(--info-bg); color: var(--info-text); }
.flash--message { background: var(--info-bg); color: var(--info-text); }

/* ---------------- Progress / Gallery (Slice 3) ---------------- */

.card--wide { max-width: 100%; }
.container:has(.gallery-grid) { max-width: 1280px; }

.progress {
    width: 100%;
    height: 10px;
    background: #e8ecf5;
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0 8px;
}
.progress__bar {
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6c9bff);
    animation: progress-shimmer 1.6s linear infinite;
}
@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(330%); }
}

.engines {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}
.engines--inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
}
.engine {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f0f2f8;
    color: var(--text-muted);
}
.engine--success { background: #e6f5ec; color: #1f7a3a; }
.engine--failed { background: var(--error-bg); color: var(--error-text); }
.engine--zero_results { background: #fff5e0; color: #946800; }
.engine--quota_exceeded { background: #fde8f0; color: #9a1146; }
.engine--running { background: var(--info-bg); color: var(--info-text); }
.engine__name { font-weight: 600; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 16px;
}
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 540px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

.gallery-cell {
    position: relative;
    display: block;
    background: #eef0f6;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}
.gallery-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .15s ease;
}
.gallery-cell:hover img { transform: scale(1.05); }
.gallery-cell__missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
    font-size: 12px;
}
