:root {
    --bg: #0c0e10;
    --surface: #16191c;
    --surface-2: #1c2024;
    --border: #262b30;
    --text: #e8e9ea;
    --muted: #8b9198;
    --faint: #4a5157;
    --accent: #e8b84b;
    --accent-dim: #7a6531;
    --danger: #e2685c;
    --danger-bg: rgba(226, 104, 92, 0.12);
    --warn: #e0a94a;
    --warn-bg: rgba(224, 169, 74, 0.12);
    --good: #5fbe7c;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}
.back-link:hover { color: var(--text); }

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 80px 20px 60px;
}

.page-head { margin-bottom: 32px; }
.page-head h1 { font-size: 24px; margin: 0 0 6px; }
.page-sub { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.5; }

.field { margin-bottom: 22px; }
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.field-hint { font-size: 13px; color: var(--muted); margin: 0 0 8px; }

.input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}
.input:focus {
    outline: none;
    border-color: var(--accent-dim);
}
select.input { cursor: pointer; }

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.drop-zone.drag-active {
    border-color: var(--accent);
    background: var(--surface);
}
.drop-icon {
    width: 40px;
    height: 40px;
    color: var(--faint);
    margin: 0 auto 10px;
}
.drop-cta { cursor: pointer; font-size: 14px; color: var(--muted); }
.drop-cta-link { color: var(--accent); font-weight: 600; }
.drop-cta-link:hover { text-decoration: underline; }
.drop-hint { font-size: 12px; color: var(--faint); margin: 8px 0 0; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.preview { margin-top: 14px; }
.hidden { display: none; }

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}
.thumb-grid-small { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.thumb {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.thumb img { width: 100%; height: 80px; object-fit: cover; display: block; }
.thumb-caption {
    font-size: 11px;
    color: var(--muted);
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.thumb-size { font-size: 10px; color: var(--faint); padding: 0 6px 4px; }

.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.radio-option:has(input:checked) {
    border-color: var(--accent-dim);
    color: var(--accent);
}
.radio-option input { accent-color: var(--accent); }

.submit-row { margin-top: 28px; text-align: center; }
.btn-primary, .btn-secondary {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    padding: 11px 22px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.15s ease;
}
.btn-primary { background: var(--accent); color: #1a1400; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--faint); }

.spinner {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid rgba(0,0,0,0.25);
    border-top-color: #1a1400;
    border-radius: 50%;
    margin-left: 6px;
    animation: spin 0.7s linear infinite;
    vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.validation-message {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}
.validation-message.warn {
    background: var(--warn-bg);
    color: var(--warn);
    border-color: var(--warn);
}
.validation-message svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.tips {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 8px;
    font-size: 13px;
}
.tips summary { cursor: pointer; font-weight: 600; color: var(--text); }
.tips ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.6; }

.results { margin-top: 40px; }
.results-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.results-head h2 { font-size: 18px; margin: 0; }
.results-block { margin-bottom: 22px; }
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.result-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}
.result-card-head .status { color: var(--good); font-size: 12px; }
.result-card img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
}
.result-download {
    display: block;
    text-align: center;
    padding: 8px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.15s ease;
}
.result-download:hover { opacity: 0.85; }
