body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 12px;
    margin: 0;
}

.eval-page {
    max-width: 960px;
    margin: 0 auto;
}

.eval-page header {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.eval-card {
    background: white;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

.eval-card h2 {
    margin: 0 0 12px;
    font-size: 1.15em;
    color: #333;
}

.eval-hint {
    color: #666;
    font-size: 0.92em;
    margin: 0 0 14px;
    line-height: 1.45;
}

.dropzone {
    border: 2px dashed #c5cae9;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.eval-upload-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.eval-upload-row.has-photos {
    grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.28fr);
}

.eval-upload-row.has-photos .dropzone {
    padding: 14px 10px;
}

.eval-upload-row.has-photos .dropzone-icon {
    font-size: 1.6em;
    margin-bottom: 4px;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #667eea;
    background: #eef0ff;
}

.dropzone input {
    display: none;
}

.dropzone-icon {
    font-size: 2.2em;
    margin-bottom: 8px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 0;
    align-content: start;
}

.preview-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8eaf6;
    background: #fafafa;
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.preview-meta {
    padding: 8px;
    font-size: 0.8em;
}

.preview-meta label {
    display: block;
    color: #555;
    margin-bottom: 4px;
}

.preview-meta select {
    width: 100%;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 0.95em;
}

.preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

@media (max-width: 640px) {
    .eval-upload-row.has-photos {
        grid-template-columns: 1fr;
    }
}

.eval-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.eval-form-row label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9em;
    color: #444;
    font-weight: 600;
}

.eval-form-row input,
.eval-form-row select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 400;
}

.eval-form-row input:focus,
.eval-form-row select:focus {
    outline: none;
    border-color: #667eea;
}

.selection-control {
    position: relative;
    display: block;
}

.selection-control select {
    width: 100%;
}

.selection-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #e2e6ff;
    color: #4a5568;
    font-size: 16px;
    line-height: 20px;
    cursor: pointer;
    transform: translateY(-50%);
}

.selection-clear:hover {
    background: #c5cae9;
}

.selection-control select:not(:disabled) {
    padding-right: 38px;
}

html.theme-dark .selection-clear {
    background: #333957;
    color: #f3f4f6;
}

html.theme-dark .selection-clear:hover {
    background: #4b557f;
}

.eval-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary {
    padding: 11px 22px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
}

.btn-primary:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.btn-secondary {
    padding: 11px 18px;
    background: #f0f2ff;
    color: #4a5568;
    border: 1px solid #d8dcf0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.eval-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.92em;
}

.eval-status.info {
    background: #eef0ff;
    color: #4a5568;
}

.eval-status.error {
    background: #ffe8e8;
    color: #9b2c2c;
}

.eval-status.loading {
    background: #fff8e6;
    color: #744210;
}

.eval-results {
    display: none;
}

.eval-results.visible {
    display: block;
}

.summary-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.summary-box h2 {
    color: white;
    margin-bottom: 8px;
}

.summary-box p {
    margin: 0;
    line-height: 1.5;
    opacity: 0.95;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat-box {
    background: #f8f9ff;
    border: 1px solid #e8eaf6;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.stat-box .value {
    font-size: 1.35em;
    font-weight: 700;
    color: #333;
}

.stat-box .label {
    font-size: 0.82em;
    color: #666;
    margin-top: 4px;
}

.id-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.id-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.id-list--selectable .id-choice {
    border-bottom: 1px solid #eee;
}

.id-list--selectable .id-choice:last-child {
    border-bottom: none;
}

.id-choice-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
}

.id-choice-label:hover {
    background: #f8f9ff;
}

.id-choice-label:has(input:checked) {
    background: #eef0ff;
    border: 1px solid #c5cae9;
}

.id-choice-body {
    flex: 1;
    min-width: 0;
}

.id-choice-label input[type="radio"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.custom-species-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.9em;
    color: #444;
    font-weight: 600;
}

.custom-species-label input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 400;
}

.custom-species-label input:focus {
    outline: none;
    border-color: #667eea;
}

.confirm-actions {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 2px solid #eef0ff;
}

.btn-confirm {
    width: 100%;
    padding: 14px 22px;
    font-size: 16px;
}

@media (min-width: 500px) {
    .btn-confirm {
        width: auto;
        min-width: 280px;
    }
}

.id-name {
    font-weight: 600;
    color: #333;
}

.id-score {
    color: #667eea;
    font-weight: 700;
    white-space: nowrap;
}

.id-common {
    display: block;
    font-size: 0.85em;
    color: #777;
    font-weight: 400;
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 600;
    background: #e6ffed;
    color: #276749;
}

.badge.warn {
    background: #fff3cd;
    color: #856404;
}

.comparable-list {
    display: grid;
    gap: 8px;
}

.comparable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}

.comparable-item:hover {
    background: #f0f2ff;
    border-color: #d8dcf0;
}

.comparable-price {
    font-weight: 700;
    color: #667eea;
    white-space: nowrap;
}

.comparable-meta {
    font-size: 0.85em;
    color: #666;
}

.finder-link-inline {
    display: inline-block;
    margin-top: 10px;
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.finder-link-inline:hover {
    text-decoration: underline;
}

/* Contraste des résultats sur le fond sombre du thème */
html.theme-dark .id-choice-label:hover {
    background: #181818;
}

html.theme-dark .id-choice-label:has(input:checked) {
    background: #22243a;
    border-color: #667eea;
}

html.theme-dark .id-name,
html.theme-dark .comparable-item {
    color: #f3f4f6;
}

html.theme-dark .id-common,
html.theme-dark .comparable-meta {
    color: #cbd5e1;
}

html.theme-dark .comparable-item {
    background: #181818;
    border-color: #333;
}

html.theme-dark .comparable-item:hover {
    background: #22243a;
    border-color: #667eea;
}

html.theme-dark .comparable-price,
html.theme-dark .id-score {
    color: #a5b4fc;
}

@media (max-width: 600px) {
    .comparable-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

.age-result {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 8px;
}

.age-ref {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-top: 12px;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 10px;
    border: 1px solid #e8eaf6;
}

.age-ref img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.age-ref-meta {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

@media (orientation: portrait) {
    .eval-page {
        max-width: none;
    }

    .eval-form-row,
    .preview-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .eval-actions,
    .eval-actions .btn-primary,
    .eval-actions .btn-secondary,
    .btn-confirm {
        width: 100%;
    }

    .comparable-item,
    .age-ref,
    .id-list li {
        flex-direction: column;
        align-items: flex-start;
    }

    .id-choice-label {
        align-items: flex-start;
    }
}

@media (orientation: landscape) and (min-width: 901px) {
    body {
        padding: 8px;
    }

    .eval-page header {
        padding: 10px 16px;
        margin-bottom: 8px;
    }

    .eval-card {
        padding: 12px 16px;
        margin-bottom: 8px;
    }

    .eval-card h2 {
        margin-bottom: 6px;
    }

    .eval-hint {
        margin-bottom: 8px;
    }

    .eval-upload-row.has-photos .preview-item img {
        height: 92px;
    }

    .eval-form-row {
        gap: 8px;
        margin-top: 10px;
    }

    .eval-form-row input,
    .eval-form-row select {
        padding: 7px 10px;
    }

    .eval-actions {
        margin-top: 10px;
    }

    .summary-box {
        padding: 12px 16px;
        margin-bottom: 8px;
    }

    .stat-box {
        padding: 8px;
    }

    .id-choice-label {
        padding: 7px 8px;
    }

    .confirm-actions {
        margin-top: 10px;
        padding-top: 10px;
    }
}
