.results-page {
    max-width: 1100px;
    margin: auto;
}

.results-title {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.results-title h1 {
    margin: 0 0 6px;
}

.results-subtitle {
    color: #64748b;
    margin: 0;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
}

.stat-box strong {
    display: block;
    font-size: 28px;
}

.stat-box span {
    color: #64748b;
    font-size: 14px;
}

.results-filters {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    background: #fff;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    margin-bottom: 22px;
}

.results-filters input[type=search] {
    flex: 2;
    min-width: 200px;
    width: auto;
}

.results-filters select {
    flex: 1;
    min-width: 170px;
    width: auto;
}

.results-filters label {
    display: flex;
    gap: 10px;
    align-items: center;
}

.attempt-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 24px;
    margin: 0 0 20px;
    box-shadow: 0 3px 12px #0f172a05;
}

.attempt-card[hidden] {
    display: none !important;
}

.attempt-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 18px;
}

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

.attempt-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 14px;
}

.kind-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 7px;
    padding: 3px 9px;
}

.kind-badge.retake {
    background: #f5f3ff;
    color: #6d28d9;
}

.attempt-score {
    white-space: nowrap;
    text-align: right;
    font-size: 24px;
    font-weight: 700;
}

.attempt-score small {
    display: block;
    font-size: 13px;
    color: #64748b;
    font-weight: 400;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 10px;
}

.answer-cell {
    border: 1px solid #fda4af;
    background: #fff1f2;
    border-radius: 10px;
    padding: 10px 12px;
    color: #881337;
    min-height: 78px;
}

.answer-cell.correct {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.answer-cell b {
    font-size: 12px;
    display: block;
    opacity: .85;
    margin-bottom: 5px;
}

.answer-cell span {
    font-size: 16px;
    font-weight: 650;
}

.answer-cell small {
    display: block;
    font-size: 11px;
    margin-top: 3px;
}

.only-errors .answer-cell.correct {
    display: none;
}

.result-empty {
    padding: 30px;
    background: white;
    border-radius: 16px;
    color: #64748b;
}

.kbd-help {
    font-size: 13px;
    color: #64748b;
    margin: 18px 0 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.summary-card {
    background: #fff;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    display: grid;
}

.summary-card h2 {
    font-size: 20px;
}

.summary-card dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

.summary-card dd {
    margin: 0;
    font-weight: 650;
}

.summary-card dt {
    color: #64748b;
}

.summary-card a.btn {
    text-align: center;
    margin-top: auto;
}

@media (max-width: 650px) {
    .results-stats {
        grid-template-columns: 1fr;
    }

    .attempt-head,
    .results-title {
        flex-direction: column;
    }

    .attempt-score {
        text-align: left;
    }

    .answer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
