* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a1a;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
h1 {
    margin: 20px 0;
    font-size: 1.5rem;
}
.container {
    width: 100%;
    max-width: 500px;
    padding: 10px;
}
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror for selfie */
}
/* Oval overlay */
.oval-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.oval-overlay svg {
    width: 100%;
    height: 100%;
}
/* Oval state animations (auto-trigger) */
@keyframes ovalPulse {
    0%, 100% { stroke-width: 1.0; stroke-opacity: 0.2; filter: drop-shadow(0 0 0 transparent); }
    50%      { stroke-width: 2.5; stroke-opacity: 1;   filter: drop-shadow(0 0 18px rgba(255, 193, 7, 0.9)); }
}
#ovalStroke.oval-positioning {
    stroke: rgb(255, 193, 7) !important;
    animation: ovalPulse 2s ease-in-out infinite;
}
#ovalStroke.oval-ready {
    stroke: rgb(76, 175, 80) !important;
    stroke-width: 2.0;
    stroke-opacity: 1;
    filter: drop-shadow(0 0 14px rgba(76, 175, 80, 0.8));
}
/* Countdown + Capturing: pulsing green — "hold still, active process" */
@keyframes ovalGreenPulse {
    0%, 100% { stroke-width: 1.2; stroke-opacity: 0.5; filter: drop-shadow(0 0 0 transparent); }
    50%      { stroke-width: 2.5; stroke-opacity: 1;   filter: drop-shadow(0 0 18px rgba(76, 175, 80, 0.9)); }
}
#ovalStroke.oval-countdown,
#ovalStroke.oval-capturing {
    stroke: rgb(76, 175, 80) !important;
    animation: ovalGreenPulse 1.5s ease-in-out infinite;
}
/* Status text */
.status-text {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}
/* Countdown */
.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: bold;
    text-shadow: 0 4px 8px rgba(0,0,0,0.8);
    pointer-events: none;
    display: none;
}
/* Controls */
.controls {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
button {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#verifyBtn {
    background: #4CAF50;
    color: white;
}
#retryBtn {
    background: #2196F3;
    color: white;
    display: none;
}
/* Results */
#results {
    margin-top: 20px;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.9rem;
    display: none;
    width: 100%;
    max-width: 600px;
}
.result-pass { color: #4CAF50; }
.result-fail { color: #f44336; }
.result-rejected { color: #ff9800; }
.result-stepup { color: #ff9800; }
.result-header {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #444;
}
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}
.result-table th, .result-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #444;
}
.result-table th {
    color: #888;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.status-pass { color: #4CAF50; font-weight: 600; }
.status-warn { color: #ffaa00; font-weight: 600; }
.status-fail { color: #f44336; font-weight: 600; }
.status-rejected { color: #ff9800; font-weight: 600; }
.status-review { color: #ff9800; font-weight: 600; }
.status-skip { color: #888; font-style: italic; }
.raw-response {
    margin-top: 15px;
    padding: 10px;
    background: #1a1a1a;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}
.raw-response-title {
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 5px;
}
/* Live status updates */
#liveStatus {
    margin-top: 15px;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 8px;
    display: none;
    width: 100%;
    max-width: 500px;
}
.live-step {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.live-step.pending { color: #888; }
.live-step.processing { color: #2196F3; }
.live-step.done { color: #4CAF50; }
.live-step.rejected { color: #ff9800; }
.live-step.failed { color: #f44336; }
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #444;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Mode strip */
#modeStrip {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    width: 100%;
}
.mode-pill {
    font-family: monospace;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.mode-pill.on {
    background: #e67e22;
    color: #fff;
}
.mode-pill.off {
    background: #2d3436;
    color: #55efc4;
}
/* Run config section in results */
.run-config {
    margin-top: 15px;
}
.run-config summary {
    cursor: pointer;
    color: #888;
    font-size: 0.8rem;
    font-weight: 600;
    user-select: none;
}
.run-config-content {
    margin-top: 8px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #999;
    line-height: 1.6;
}
.run-config-content .cfg-label {
    color: #666;
    display: inline-block;
    width: 110px;
}
/* Trial label gate */
#trialLabel {
    margin-top: 20px;
    padding: 20px;
    background: #2a2a2a;
    border-radius: 8px;
    display: none;
    width: 100%;
    max-width: 500px;
    text-align: center;
}
#trialLabel h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #ccc;
}
.label-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 15px;
}
.label-btn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
}
.label-btn.real {
    border: 2px solid #4CAF50;
    color: #4CAF50;
}
.label-btn.real.selected {
    background: #4CAF50;
    color: #fff;
}
.label-btn.spoof {
    border: 2px solid #f44336;
    color: #f44336;
}
.label-btn.spoof.selected {
    background: #f44336;
    color: #fff;
}
/* Post-results notes form */
#trialNotes {
    margin-top: 15px;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    display: none;
    width: 100%;
    max-width: 600px;
}
#trialNotes .notes-header {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 8px;
}
#trialNotesInput {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    border: 1px solid #444;
    border-radius: 6px;
    background: #1a1a1a;
    color: #fff;
    margin-bottom: 10px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}
#submitNotes {
    background: #2196F3;
    color: white;
    padding: 10px 24px;
    font-size: 0.9rem;
}
#submitNotes:disabled {
    background: #444;
    color: #888;
}
.notes-saved {
    color: #4CAF50;
    font-size: 1rem;
    font-weight: 600;
    margin-left: 10px;
    display: none;
}
/* Age + gender feedback row */
.feedback-row {
    margin-top: 15px;
    display: none;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    max-width: 600px;
}
.feedback-card {
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
}
#ageFeedback {
    flex: 1;
    min-width: 280px;
}
#genderFeedback {
    flex: 1;
    min-width: 280px;
}
.age-fb-disabled {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}
.age-fb-summary {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #ccc;
}
.age-fb-question {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #ccc;
}
.age-fb-question strong { color: #fff; }
.age-fb-btns {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.age-fb-btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    border: 2px solid #555;
    color: #999;
}
.age-fb-btn.yes.selected {
    border-color: #e67e22;
    background: #e67e22;
    color: #fff;
}
.age-fb-btn.no.selected {
    border-color: #4CAF50;
    background: #4CAF50;
    color: #fff;
}
.age-fb-saved {
    color: #4CAF50;
    font-size: 1rem;
    font-weight: 600;
    display: none;
}
/* Gender feedback */
.gender-fb-summary {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #ccc;
}
.gender-fb-btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    border: 2px solid #555;
    color: #999;
}
.gender-fb-btn.selected {
    border-color: #2196F3;
    background: #2196F3;
    color: #fff;
}
.gender-fb-saved {
    color: #4CAF50;
    font-size: 1rem;
    font-weight: 600;
    display: none;
}
/* Feedback status row (Saved + Edit) */
.feedback-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
/* Edit buttons next to Saved indicators */
.edit-btn {
    padding: 4px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    border: 2px solid #b8860b;
    color: #daa520;
    display: none;
}
.edit-btn:hover {
    background: #daa520;
    color: #000;
}
/* Error */
#error {
    margin-top: 20px;
    padding: 15px;
    background: #4a1a1a;
    border-radius: 8px;
    display: none;
    width: 100%;
    max-width: 500px;
}

/* User-facing card for technical quality failures (lighting, blur, etc). */
/* Sits snugly under .video-wrapper: visually continuous, informational only. */
.message-card {
    margin-top: 12px;
    padding: 16px 18px;
    background: #2a2519;
    border: 1px solid #3a3424;
    border-radius: 8px;
    color: #f4e4b8;
}
.message-card[hidden] {
    display: none;
}
.message-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #ffd88a;
}
.message-card__description {
    font-size: 0.95rem;
    line-height: 1.45;
    color: #d8d0b8;
}
