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

/* ── Base ───────────────────────────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f0f0f0;
    min-height: 100vh;
    padding: 20px;
}

/* ── Container ──────────────────────────────────────────────────────────── */
.container {
    max-width: 760px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
    overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
    background: #1a1a1a;
    color: #fff;
    padding: 32px 30px;
    text-align: center;
}
header h1   { font-size: 2.2em; margin-bottom: 6px; font-weight: 700; }
.subtitle   { font-size: 1em; opacity: 0.8; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { padding: 36px 30px; display: none; }
.section.active { display: block; }

/* ── Intro ──────────────────────────────────────────────────────────────── */
.intro-content { max-width: 660px; margin: 0 auto; }
.intro-content h2 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.8em;
}
.intro-text {
    font-size: 1.05em;
    margin-bottom: 24px;
    color: #555;
}
.instructions {
    background: #f8f9fa;
    padding: 22px 26px;
    border-radius: 10px;
    margin-bottom: 24px;
}
.instructions h3 { color: #333; margin-bottom: 12px; font-size: 1.15em; }
.instructions ol { margin-left: 20px; }
.instructions li { margin-bottom: 8px; color: #555; }

.warning-box {
    background: #fff8e1;
    border-left: 4px solid #f59e0b;
    padding: 14px 18px;
    margin-bottom: 28px;
    border-radius: 5px;
    color: #555;
}
.warning-box strong { color: #92630a; }

/* ── Buttons (generic) ──────────────────────────────────────────────────── */
.btn {
    padding: 11px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}
.btn-primary  { background: #1a1a1a; color: #fff; }
.btn-primary:hover  { background: #333; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary      { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-secondary:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-large { padding: 14px 40px; font-size: 1.15em; width: 100%; max-width: 380px; display: block; margin: 0 auto; }

/* ── Progress ───────────────────────────────────────────────────────────── */
.progress-container {
    background: #e8e8e8;
    border-radius: 6px;
    height: 8px;
    margin-bottom: 6px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: #2196F3;
    border-radius: 6px;
    transition: width 0.35s ease;
    width: 0%;
}
.progress-text {
    display: block;
    text-align: center;
    margin-bottom: 20px;
    color: #666;
    font-size: 0.9em;
    font-weight: 600;
}

/* ── Test section ───────────────────────────────────────────────────────── */
.test-content { max-width: 560px; margin: 0 auto; }

/* ── Plate image ────────────────────────────────────────────────────────── */
.plate-container {
    text-align: center;
    background: #fff;
    padding: 16px;
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}
.plate-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 460px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* ── Answer buttons ─────────────────────────────────────────────────────── */
.answer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
    min-height: 72px; /* prevent layout shift while loading */
}

.answer-btn {
    background: #fff;
    color: #222;
    border: 2px solid #d4d4d4;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 1.75em;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, transform 0.1s;
    min-width: 80px;
    line-height: 1;
    user-select: none;
}
.answer-btn:hover:not(:disabled) {
    background: #f4f4f4;
    border-color: #aaa;
    transform: scale(1.04);
}
.answer-btn:active:not(:disabled) { transform: scale(0.96); }
.answer-btn:disabled { opacity: 0.5; cursor: default; }

.answer-btn.selected {
    background: #1565C0;
    color: #fff;
    border-color: #0D47A1;
}

.answer-btn.nothing-btn {
    background: #fafafa;
    color: #777;
    font-size: 1em;
    padding: 14px 22px;
    border-style: dashed;
}
.answer-btn.nothing-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #999;
    transform: scale(1.02);
}
.answer-btn.nothing-btn.selected {
    background: #546E7A;
    color: #fff;
    border-color: #37474F;
    border-style: solid;
}

/* classify-hint (shown only for plates 22-23) */
#classify-hint {
    display: none;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #fff8e1;
    border-left: 4px solid #f59e0b;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.navigation-buttons .btn { flex: 1; max-width: 200px; }

/* ── Results ────────────────────────────────────────────────────────────── */
.results-content { max-width: 640px; margin: 0 auto; }
.results-content h2 { color: #1a1a1a; margin-bottom: 24px; font-size: 1.8em; text-align: center; }

.result-card {
    background: #1a1a1a;
    color: #fff;
    padding: 28px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}
.result-card h3     { font-size: 1.4em; margin-bottom: 12px; }
.result-label       { font-size: 0.78em; font-weight: 600; text-transform: uppercase;
                      letter-spacing: 0.08em; color: #999; margin-bottom: 4px; }
.accuracy-display   { margin-top: 12px; }
.accuracy-label     { font-size: 1em; opacity: 0.85; }
.accuracy-value     { font-size: 1.9em; font-weight: 700; margin-left: 10px; }

.results-details {
    background: #f8f9fa;
    padding: 20px 24px;
    border-radius: 10px;
    margin-bottom: 20px;
}
.results-details p { margin-bottom: 8px; color: #555; line-height: 1.5; }

.recommendations {
    background: #e3f2fd;
    padding: 20px 24px;
    border-radius: 10px;
    margin-bottom: 28px;
    border-left: 4px solid #2196F3;
}
.recommendations h3 { color: #1565C0; margin-bottom: 12px; }
.recommendations ul { margin-left: 18px; }
.recommendations li { margin-bottom: 8px; color: #555; }

.action-buttons {
    text-align: center;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.action-buttons a.btn { text-decoration: none; }

/* ── Share accordion ─────────────────────────────────────────────────────── */
.share-block {
    margin-bottom: 20px;
    border-radius: 14px;
    overflow: hidden;
    border: 1.5px solid #e0e0e0;
}

.btn-share {
    width: 100%;
    padding: 16px 20px;
    background: #fff;
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background .15s;
}
.btn-share:hover { background: #f8f8f8; }
.share-icon { font-size: 1.1em; }
.share-arrow {
    margin-left: auto;
    font-size: 0.75em;
    color: #999;
    transition: transform .25s ease;
}
.share-block.open .share-arrow { transform: rotate(180deg); }

.share-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
    background: #fafafa;
    border-top: 0px solid #e0e0e0;
    padding: 0 20px;
}
.share-block.open .share-panel {
    max-height: 200px;
    padding: 16px 20px 20px;
    border-top-width: 1px;
}

.share-hint {
    font-size: 0.88em;
    color: #777;
    margin-bottom: 14px;
    line-height: 1.5;
}

.share-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.share-form input[type="email"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 0.95em;
    outline: none;
    transition: border-color .2s;
}
.share-form input[type="email"]:focus { border-color: #1a1a1a; }

.share-status {
    margin-top: 10px;
    font-size: 0.88em;
    min-height: 18px;
}
.share-status.success { color: #2e7d32; }
.share-status.error   { color: #c62828; }

/* ── Participant name field ──────────────────────────────────────────────── */
.participant-field {
    margin-bottom: 24px;
}
.participant-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}
.participant-field label span {
    font-weight: 400;
    color: #999;
    font-size: 0.9em;
}
.participant-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    font-size: 1em;
    color: #333;
    background: #fafafa;
    outline: none;
    transition: border-color .2s;
}
.participant-field input:focus {
    border-color: #1a1a1a;
    background: #fff;
}

/* ── Log link in header ──────────────────────────────────────────────────── */
.log-link {
    display: inline-block;
    margin-top: 8px;
    color: #aaa;
    font-size: 0.85em;
    text-decoration: none;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 12px;
    transition: color .2s, border-color .2s;
}
.log-link:hover { color: #fff; border-color: #aaa; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
    background: #f8f9fa;
    padding: 24px 30px;
    border-top: 1px solid #e8e8e8;
    font-size: 0.85em;
    color: #777;
}
.disclaimer   { margin-bottom: 10px; line-height: 1.6; }
.attribution  { font-size: 0.9em; opacity: 0.8; }
.attribution a { color: #888; text-decoration: none; }
.attribution a:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    body { padding: 10px; }
    header { padding: 24px 20px; }
    header h1 { font-size: 1.7em; }
    .section { padding: 24px 16px; }
    .plate-image { max-height: none; width: 100%; }
    .plate-container {
        padding: 6px;
        border-radius: 10px;
        margin-left: -16px;
        margin-right: -16px;
        border-radius: 0;
        box-shadow: none;
    }
    .answer-btn { font-size: 1.5em; padding: 12px 20px; min-width: 66px; }
    .navigation-buttons { flex-direction: column; align-items: stretch; }
    .navigation-buttons .btn { max-width: 100%; }
}
