/* Test passing report (statistics) pages — overview, per-user and per-question
   reports plus the single-user result. Mirrors the Maui statistics screens. */

.ts-root {
    --ts-color: var(--green-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 0 0 40px;
    box-sizing: border-box;
}

/* ---------- State panels ---------- */

.ts-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 48px 24px;
    background: var(--surface-raised);
    border-radius: var(--r-md);
    box-shadow: var(--elev-1);
}

.ts-panel__crown {
    color: var(--yellow-color);
    margin-bottom: 4px;
}

.ts-panel__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ts-panel__sub {
    margin: 0;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 420px;
}

.ts-button {
    margin-top: 12px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--r-xs);
    font-family: var(--font-family);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.ts-button--primary {
    background: var(--ts-color);
    color: #fff;
}

/* ---------- Empty state ---------- */

.ts-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 56px 24px;
}

.ts-empty__icon {
    color: var(--blue-color);
    opacity: .9;
    margin-bottom: 12px;
}

.ts-empty__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ts-empty__sub {
    margin: 0;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-tertiary);
    max-width: 420px;
}

/* ---------- Metric cards ---------- */

.ts-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 28px;
}

.ts-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 108px;
    padding: 16px 12px;
    border-radius: 16px;
    color: #fff;
    overflow: hidden;
}

/* The same motifs the app prints on its statistics tiles, faded into the corner. */
.ts-card::after {
    content: "";
    position: absolute;
    right: -14px;
    top: -10px;
    width: 116px;
    height: 116px;
    background-color: #fff;
    opacity: .2;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
    pointer-events: none;
}

.ts-card--wide {
    grid-column: span 2;
    min-height: 64px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}

    .ts-card--wide::after {
        right: 24px;
        top: 50%;
        transform: translateY(-50%);
        width: 72px;
        height: 72px;
    }

.ts-card--blue {
    background: var(--blue-color);
}

    .ts-card--blue::after {
        -webkit-mask-image: url("/images/cards/o_style_icon.svg");
        mask-image: url("/images/cards/o_style_icon.svg");
    }

.ts-card--yellow {
    background: var(--yellow-color);
}

    .ts-card--yellow::after {
        -webkit-mask-image: url("/images/cards/ellipse_style_icon.svg");
        mask-image: url("/images/cards/ellipse_style_icon.svg");
    }

.ts-card--green {
    background: var(--green-color);
}

    .ts-card--green::after {
        -webkit-mask-image: url("/images/cards/arrow_style_icon.svg");
        mask-image: url("/images/cards/arrow_style_icon.svg");
    }

.ts-card--red {
    background: var(--red-color);
}

    .ts-card--red::after {
        -webkit-mask-image: url("/images/cards/dotted_style_icon.svg");
        mask-image: url("/images/cards/dotted_style_icon.svg");
    }

.ts-card__label {
    position: relative;
    z-index: 1;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    max-width: 136px;
    line-height: 1.25;
}

.ts-card__value {
    position: relative;
    z-index: 1;
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
}

.ts-card--wide .ts-card__label {
    font-size: 14px;
    font-weight: 400;
    max-width: none;
}

.ts-card--wide .ts-card__value {
    font-size: 22px;
}

/* ---------- Report sections ---------- */

.ts-section {
    margin-bottom: 28px;
}

/* A plain tappable row, as in the app — the title, the crown when the section is
   locked and the chevron that opens the full report. */
.ts-section__head {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0;
    margin-bottom: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.ts-section__title {
    font-family: var(--font-family);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ts-crown {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: inline-block;
}

.ts-section__chevron {
    margin-left: auto;
    color: var(--text-secondary);
    display: inline-flex;
}

.ts-section__head:hover .ts-section__chevron {
    color: var(--text-primary);
}

.ts-section__locked {
    margin: 0;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-secondary);
    padding: 16px;
    background: var(--surface-raised);
    border-radius: var(--r-sm);
    box-shadow: var(--elev-1);
}

/* ---------- Lists ---------- */

.ts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ts-user {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 12px;
    row-gap: 6px;
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: var(--r-sm);
    background: var(--surface-raised);
    box-shadow: var(--elev-1);
    cursor: pointer;
    text-align: left;
    transition: background-color .15s ease;
}

.ts-user:hover {
    background: var(--surface-sunken);
}

.ts-user__avatar {
    grid-row: span 2;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.ts-user__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.ts-user__name {
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-user__counts {
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Verdict of the attempt, printed under the name with its tick or cross. */
.ts-verdict {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
}

.ts-verdict--ok {
    color: var(--green-color);
}

.ts-verdict--fail {
    color: var(--red-color);
}

.ts-badge {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: var(--r-full);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
}

.ts-badge--ok {
    background: rgba(28, 205, 157, .14);
    color: var(--green-color);
}

.ts-badge--fail {
    background: rgba(255, 105, 81, .14);
    color: var(--red-color);
}

/* ---------- Question rows ---------- */

.ts-question {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: var(--r-sm);
    background: var(--surface-raised);
    box-shadow: var(--elev-1);
}

.ts-question__title {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.ts-question__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
}

.ts-question__accuracy,
.ts-question__time {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-secondary);
}

/* "Подробнее" — the expander the app puts on the right of the accuracy line. */
.ts-question__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 0;
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-action);
    cursor: pointer;
}

.ts-question__toggle-chevron {
    display: inline-flex;
    transition: transform .18s ease;
}

.ts-question__toggle--open .ts-question__toggle-chevron {
    transform: rotate(90deg);
}

.ts-question__details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ts-question__image {
    max-height: 160px;
    align-self: flex-start;
    border-radius: var(--r-sm);
    background: var(--surface-sunken);
    object-fit: contain;
}

/* Correct answer, printed as chips next to the "Ответ:" label. */
.ts-answer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 4px;
}

.ts-answer--stacked {
    flex-direction: column;
    gap: 8px;
}

.ts-answer__label {
    flex: 0 0 auto;
    padding-top: 5px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    color: var(--green-color);
}

.ts-answer__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ts-answer__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ts-answer__pair {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.ts-answer__dash {
    font-family: var(--font-family);
    font-size: 12px;
    color: var(--text-secondary);
}

.ts-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    min-width: 25px;
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--surface-sunken);
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
}

/* Three coloured rows closing the report: right, wrong, skipped. */
.ts-question__counts {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.ts-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.ts-count__icon {
    display: inline-flex;
    opacity: .5;
}

.ts-count--ok {
    background: var(--green-color);
}

.ts-count--fail {
    background: var(--red-color);
}

.ts-count--skip {
    background: var(--text-tertiary);
}

/* ---------- Participant chip on the single-result hero ---------- */
.tr-hero__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 6px auto 0;
    padding: 6px 14px 6px 6px;
    border-radius: var(--r-full);
    background: rgba(22, 30, 57, .07);
    color: inherit;
}

.tr-hero__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.tr-hero__user-name {
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 600;
}

/* ---------- Filter tabs ---------- */

.ts-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ts-filter-tab {
    padding: 8px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--r-full);
    background: var(--surface-raised);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s ease;
}

.ts-filter-tab--active {
    background: var(--ts-color);
    border-color: var(--ts-color);
    color: #fff;
}

.ts-list-loader {
    text-align: center;
    padding: 16px;
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---------- Wider screens ---------- */

@media (min-width: 768px) {
    .ts-card {
        padding: 16px;
    }

    .ts-question {
        padding: 14px 16px;
    }
}
