/*
 * Екран результату тесту (/tests/test.html): іспит і тема.
 * Окремий простір імен .rs-*, щоб старі правила test.css / site-theme.css / app.css його не зачіпали.
 * Кольори й шрифт — токени сайту з /assets/app.css (--t-*).
 */
.rs { display: grid; gap: 12px; color: var(--t-ink, #0a0a0a); }
.rs * { box-sizing: border-box; }

/* ---------- шапка: вердикт, рахунок, смуга, показники ---------- */
.rs-hero { background: var(--t-card, #fff); border-radius: var(--t-radius, 2rem); padding: 22px 20px 20px; }
.rs-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1.2; background: var(--t-bg, #efeeee); color: var(--t-ink-soft, #272727);
}
.rs-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.is-fail .rs-pill { background: var(--t-red-10, #f6d5d1); color: #b3301f; }
.is-pass .rs-pill { background: var(--t-green-10, #c7ecce); color: #067a1c; }
.is-mid .rs-pill { background: var(--t-yellow-10, #f0dfc3); color: #a35b06; }

.rs-score { display: flex; align-items: baseline; gap: 8px; margin-top: 16px; }
.rs-score b { font-size: 76px; line-height: .85; font-weight: 600; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.rs-score span { font-size: 26px; font-weight: 500; color: var(--t-muted, #6b6a6a); letter-spacing: -.02em; }
.rs-score-l { margin: 8px 0 18px; font-size: 14px; color: var(--t-muted, #6b6a6a); }

/* по сегменту на питання: зелений правильно, червоний помилка, сірий без відповіді */
.rs-bar { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; height: 10px; }
.rs-bar.is-dense { gap: 1px; }
.rs-bar i { display: block; border-radius: 3px; background: #d9d8d8; }
.rs-bar.is-dense i { border-radius: 1px; }
.rs-bar i.ok { background: var(--t-green, #08b529); }
.rs-bar i.bad { background: var(--t-red, #d33a26); }
.rs-bar.is-link i { cursor: pointer; }
@media (hover: hover) { .rs-bar.is-link i:hover { transform: scaleY(1.5); } }
.rs-bar i { transition: transform .15s ease; }

.rs-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0 0; }
.rs-stats > div { background: var(--t-bg, #efeeee); border-radius: 16px; padding: 12px 12px 11px; min-width: 0; }
.rs-stats dt { font-size: 12px; color: var(--t-muted, #6b6a6a); }
.rs-stats dd { margin: 4px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rs-stats small { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--t-muted, #6b6a6a); }
.rs-stats .is-bad dd { color: var(--t-red, #d33a26); }
.rs-stats .is-bad small { color: var(--t-muted, #6b6a6a); }

.rs-note { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: var(--t-muted, #6b6a6a); }

/* дві однакові кнопки на всю ширину */
.rs-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.rs-actions > :only-child { grid-column: 1 / -1; }
.rs-btn {
  appearance: none; -webkit-appearance: none; margin: 0; width: 100%; height: 52px; padding: 0 16px;
  border: 0; border-radius: 999px; font: inherit; font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  background: var(--t-bg, #efeeee); color: var(--t-ink, #0a0a0a); cursor: pointer; transform: none; box-shadow: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rs-btn.is-main { background: var(--t-ink, #0a0a0a); color: #fff; }
.rs-btn:active { transform: scale(.98); }
@media (hover: hover) {
  .rs-btn:hover { background: #e4e3e3; }
  .rs-btn.is-main:hover { background: var(--t-ink-soft, #272727); }
}

/* ---------- місце серед інших (Premium) ---------- */
.rs-rank { background: var(--t-card, #fff); border-radius: 1.5rem; padding: 16px 20px 18px; }
.rs-rank p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--t-ink-soft, #272727); }
.rs-rank p b { font-weight: 600; color: var(--t-ink, #0a0a0a); }
.rs-rank-row { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.rs-rank-row + .rs-rank-row { margin-top: 8px; }
.rs-rank-row span { color: var(--t-muted, #6b6a6a); }
.rs-rank-row i { position: relative; height: 8px; border-radius: 99px; background: var(--t-bg, #efeeee); overflow: hidden; }
.rs-rank-row i::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: var(--t-ink, #0a0a0a); }
.rs-rank-row.is-avg i::before { background: #b9b8b8; }
.rs-rank-row b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rs-rank-wait { margin: 0; padding: 14px 20px; border-radius: 1.5rem; background: var(--t-card, #fff); font-size: 13px; color: var(--t-muted, #6b6a6a); }

/* ---------- продаж замість розбору (без Premium) ---------- */
.rs > .t-sell { margin: 0; background: var(--t-card, #fff); border-radius: 1.5rem; padding: 20px; }

/* ---------- розбір ---------- */
.rs-review { margin-top: 8px; }
.rs-review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 12px; }
.rs-review-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.rs-review-note { font-size: 13px; color: var(--t-muted, #6b6a6a); }
.rs-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: #e2e1e1; }
.rs-seg button {
  appearance: none; border: 0; margin: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--t-ink-soft, #272727); padding: 8px 14px; border-radius: 999px; cursor: pointer; transform: none; box-shadow: none;
}
.rs-seg button i { font-style: normal; color: var(--t-muted, #6b6a6a); margin-left: 3px; }
.rs-seg button.on { background: var(--t-card, #fff); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.rs-list { display: grid; gap: 12px; }
.rs-list.only-bad .rs-item.is-ok { display: none; }

.rs-item { background: var(--t-card, #fff); border-radius: 1.5rem; padding: 16px; scroll-margin-top: calc(90px + var(--pdr-tg-top, 0px)); }
.rs-item-head { display: flex; align-items: center; gap: 10px; }
.rs-no {
  flex: none; display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px;
  font-size: 13px; font-weight: 600; background: var(--t-green-10, #c7ecce); color: #067a1c; font-variant-numeric: tabular-nums;
}
.rs-item.is-bad .rs-no { background: var(--t-red, #d33a26); color: #fff; }
.rs-item-st { font-size: 14px; font-weight: 600; }
.rs-item.is-bad .rs-item-st { color: #b3301f; }
.rs-item.is-ok .rs-item-st { color: #067a1c; }
.rs-item-src { margin-left: auto; font-size: 12px; color: var(--t-muted, #6b6a6a); white-space: nowrap; }

.rs-img { display: block; width: 100%; height: auto; margin-top: 12px; border-radius: 14px; background: var(--t-bg, #efeeee); cursor: zoom-in; }
.rs-q { margin: 14px 0 12px; font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: -.01em; }

.rs-opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rs-opts li {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border-radius: 14px;
  font-size: 15px; line-height: 1.4; color: var(--t-muted, #6b6a6a); background: none; border: 0;
}
.rs-mark {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 0; border-radius: 50%;
  border: 1.5px solid #d2d1d1; font-size: 11px; font-weight: 600; color: var(--t-muted, #6b6a6a); font-style: normal;
}
.rs-opt { min-width: 0; }
.rs-opt em { display: block; margin-top: 3px; font-style: normal; font-size: 12px; font-weight: 600; }
.rs-opts li.is-right { background: var(--t-green-10, #c7ecce); color: var(--t-ink, #0a0a0a); }
.rs-opts li.is-right .rs-mark { background: var(--t-green, #08b529); border-color: var(--t-green, #08b529); color: #fff; font-size: 12px; }
.rs-opts li.is-right em { color: #067a1c; }
.rs-opts li.is-wrong { background: var(--t-red-10, #f6d5d1); color: var(--t-ink, #0a0a0a); }
.rs-opts li.is-wrong .rs-mark { background: var(--t-red, #d33a26); border-color: var(--t-red, #d33a26); color: #fff; font-size: 12px; }
.rs-opts li.is-wrong em { color: #b3301f; }

.rs-expl { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--t-bg, #efeeee); }
.rs-expl > b { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--t-muted, #6b6a6a); }
.rs-expl .t-expl { margin: 0; padding: 0; background: none; font-size: 14px; line-height: 1.55; color: var(--t-ink-soft, #272727); }
.rs-expl .refs { margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--t-blue, #0856b5); }
.rs-item .t-community { margin: 10px 2px 0; font-size: 13px; }

@media (max-width: 380px) {
  .rs-hero { padding: 18px 16px 16px; }
  .rs-score b { font-size: 64px; }
  .rs-stats dd { font-size: 19px; }
  .rs-stats > div { padding: 10px; }
  .rs-review-head h2 { font-size: 20px; }
  .rs-seg button { padding: 7px 11px; font-size: 13px; }
}

/* «N% користувачів відповідають правильно» — тихий рядок під карткою, без старої плашки */
.rs-item .t-community { margin: 10px 4px 0; padding: 0; background: none; border: 0; font-size: 13px; line-height: 1.45; color: var(--t-muted, #6b6a6a); }
.rs-item .t-community b { font-weight: 600; }
.rs-item .t-community.bad b { color: #b3301f; }
.rs-item .t-community.mid b { color: #a35b06; }
.rs-item .t-community.ok b { color: #067a1c; }

/* ---------- виклик другу ---------- */
.rs-btn.is-duel { margin-top: 8px; background: var(--t-green, #08b529); color: #fff; }
@media (hover: hover) { .rs-btn.is-duel:hover { background: #079c24; } }
.rs-btn:disabled { opacity: .7; cursor: default; }
.rs-duel-hint { margin: 8px 0 0; text-align: center; font-size: 12.5px; color: var(--t-muted, #6b6a6a); }
.rs-lead { margin: 14px 0 0; font-size: 15px; line-height: 1.45; color: var(--t-ink-soft, #272727); }
.rs-lead b { font-weight: 600; }

.rs-ava {
  flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; background: var(--t-bg, #efeeee); font-size: 15px; font-weight: 600; color: var(--t-ink-soft, #272727);
}
.rs-ava.is-lg { width: 52px; height: 52px; font-size: 20px; }

.rs-invite .rs-inv-who { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.rs-inv-who b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.rs-inv-who span { font-size: 14px; color: var(--t-muted, #6b6a6a); }
.rs-invite .rs-score { margin-top: 18px; }

.rs-duel { background: var(--t-card, #fff); border-radius: 1.5rem; padding: 16px 16px 10px; }
.rs-duel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 4px 10px; }
.rs-duel-head b { font-size: 17px; font-weight: 600; }
.rs-duel-head span { font-size: 13px; color: var(--t-muted, #6b6a6a); }
.rs-board { list-style: none; margin: 0; padding: 0; }
.rs-board li { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 14px; }
.rs-board li + li { border-top: 1px solid var(--t-bg, #efeeee); }
.rs-board li.is-me { background: var(--t-bg, #efeeee); border-top-color: transparent; }
.rs-board li.is-me + li { border-top-color: transparent; }
.rs-place { flex: none; width: 24px; text-align: center; font-size: 15px; font-weight: 600; color: var(--t-muted, #6b6a6a); font-variant-numeric: tabular-nums; }
.rs-board li.is-top .rs-place { font-size: 18px; }
.rs-bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 500; }
.rs-bname i { margin-left: 6px; font-style: normal; font-size: 12px; font-weight: 500; color: var(--t-muted, #6b6a6a); }
.rs-bscore { flex: none; text-align: right; line-height: 1.15; }
.rs-bscore b { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rs-bscore small { font-size: 12px; color: var(--t-muted, #6b6a6a); font-variant-numeric: tabular-nums; }
.rs-duel-wait { margin: 6px 4px 8px; font-size: 13px; line-height: 1.45; color: var(--t-muted, #6b6a6a); }
/* у плашках виклику вже є емодзі ⚔️ — кольорова крапка зайва */
.rs-hero:not(.is-pass):not(.is-fail):not(.is-mid):not(.is-none) .rs-pill::before { display: none; }

/* реванш надіслано (після іспиту з кнопки «Реванш» у боті) */
.rs-rematch { margin: 14px 0 0; padding: 10px 14px; border-radius: 14px; background: var(--t-yellow-10, #f0dfc3); color: #7a4304; font-size: 14px; line-height: 1.4; text-align: center; }
