/* Страницы тестов: карточки «вопрос → ответ». Опирается на токены из style.css (UI 3.0). */
.tests-body { background: #f6f6f8; }
.tp { padding-bottom: 4rem; }
.tp-wrap { max-width: 920px; }
.tp .ico { width: 1.1em; height: 1.1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Заголовок ---------- */
.tp-hero { position: relative; padding: 2.8rem 0 1.4rem; }
.tp-hero::after {
  content: ""; position: absolute; top: -40px; right: -60px; width: 320px; height: 320px; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255, 73, 194, .22), rgba(255, 73, 194, 0) 68%); pointer-events: none;
}
.tp-eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--ui-pink-2); }
.tp-hero h1 { margin: .4rem 0 .6rem; font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.06; color: var(--ui-ink); }
.tp-hero p { max-width: 52ch; margin: 0 0 1.1rem; font-size: 1.02rem; color: #6b6b73; }
.tp-meta { display: flex; flex-wrap: wrap; gap: .5rem; }
.tp-meta span { padding: .35rem .85rem; border-radius: 999px; background: #fff; border: 1px solid var(--ui-line); font-size: .85rem; color: #6b6b73; }
.tp-meta b { color: var(--ui-pink-2); font-weight: 800; }

/* ---------- Панель управления ---------- */
.tp-bar {
  position: sticky; top: 70px; z-index: 20; display: flex; align-items: center; gap: .75rem; margin: 1rem 0 1.25rem; padding: .5rem;
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--ui-line); border-radius: 999px; box-shadow: 0 18px 36px -26px rgba(17, 17, 17, .5);
}
.tp-search { flex: 1; display: flex; align-items: center; gap: .6rem; height: 44px; margin: 0; padding: 0 1rem; border-radius: 999px; color: #9a9aa2; cursor: text; transition: box-shadow .25s, background .25s; }
.tp-search:focus-within { background: #fff; box-shadow: 0 0 0 3px rgba(255, 73, 194, .22); color: var(--ui-pink-2); }
.tp-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .95rem; color: var(--ui-ink); }
.tp-switch { display: inline-flex; align-items: center; gap: .55rem; margin: 0; padding: 0 .4rem 0 .2rem; cursor: pointer; user-select: none; }
.tp-switch input { position: absolute; opacity: 0; pointer-events: none; }
.tp-switch__track { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #d9d9de; transition: background .3s var(--ui-ease); }
.tp-switch__track i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .35s var(--ui-ease); }
.tp-switch input:checked + .tp-switch__track { background: var(--ui-grad); }
.tp-switch input:checked + .tp-switch__track i { transform: translateX(20px); }
.tp-switch input:focus-visible + .tp-switch__track { outline: 3px solid rgba(255, 73, 194, .4); outline-offset: 2px; }
.tp-switch__label { font-size: .9rem; font-weight: 600; color: var(--ui-ink); }
.tp-count { flex: none; padding: 0 1rem 0 .3rem; font-size: .82rem; font-weight: 600; color: #8a8a92; white-space: nowrap; }

/* ---------- Карточки ---------- */
.tp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.tp-card {
  display: flex; gap: 1rem; padding: 1.2rem 1.3rem; background: #fff; border: 1px solid var(--ui-line); border-radius: 24px;
  transition: transform .35s var(--ui-ease), box-shadow .35s var(--ui-ease), border-color .25s;
}
.tp-card:hover { transform: translateY(-2px); border-color: #f3c3e5; box-shadow: 0 24px 40px -30px rgba(255, 73, 194, .65); }
.tp-num {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 15px;
  background: var(--ui-ink); color: #fff; font-size: .95rem; font-weight: 800; letter-spacing: .02em; transition: background .3s;
}
.tp-card:hover .tp-num { background: var(--ui-grad); }
.tp-body { flex: 1; min-width: 0; }
.tp-q { margin: .2rem 0 .85rem; font-size: 1.04rem; font-weight: 500; line-height: 1.5; color: var(--ui-ink); overflow-wrap: anywhere; }

.tp-ans {
  position: relative; padding: .8rem 1rem .85rem 1.1rem; border-radius: 16px; background: var(--ui-pink-soft); overflow: hidden;
  transition: opacity .35s var(--ui-ease), max-height .45s var(--ui-ease), padding .35s var(--ui-ease), margin .35s;
  max-height: 600px;
}
.tp-ans::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ui-grad); }
.tp-ans__label { display: block; margin-bottom: .3rem; font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-pink-2); }
.ans__row { display: flex; align-items: flex-start; gap: .7rem; }
.opt { display: grid; place-items: center; flex: none; min-width: 1.7rem; height: 1.7rem; padding: 0 .35rem; border-radius: 9px; background: var(--ui-grad); color: #fff; font-size: .85rem; font-weight: 800; }
.ans__text { color: #2b2b30; font-weight: 500; line-height: 1.55; overflow-wrap: anywhere; padding-top: .05rem; }
.ans__text.is-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; padding-top: .1rem; }
.ans__pairs { display: flex; flex-wrap: wrap; gap: .45rem; }
.pair { padding: .3rem .8rem; border-radius: 999px; background: #fff; border: 1px solid #f3c3e5; font-weight: 700; color: var(--ui-pink-2); font-size: .9rem; }

.tp-reveal {
  display: none; margin-top: .1rem; padding: .5rem 1.1rem; border-radius: 999px; border: 1.5px solid var(--ui-line); background: #fff;
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--ui-ink); cursor: pointer;
  transition: border-color .25s, color .25s, background .25s, transform .3s var(--ui-ease);
}
.tp-reveal:hover { border-color: var(--ui-pink); color: var(--ui-pink-2); background: var(--ui-pink-soft); transform: translateY(-1px); }
.tp-reveal:focus-visible { outline: 3px solid rgba(255, 73, 194, .4); outline-offset: 2px; }

/* режим самопроверки: ответы скрыты */
.ans-off .tp-card:not(.is-open) .tp-ans { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
.ans-off .tp-card:not(.is-open) .tp-reveal { display: inline-block; }
.ans-off .tp-card.is-open .tp-reveal { display: inline-block; margin-top: .75rem; }
.ans-off .tp-card.is-open .tp-reveal::before { content: "Скрыть ответ"; }
.ans-off .tp-card.is-open .tp-reveal { font-size: 0; }
.ans-off .tp-card.is-open .tp-reveal::before { font-size: .85rem; }

.tp-card[hidden], .tp-empty[hidden] { display: none !important; }
mark.tp-hit { padding: 0 .15em; border-radius: 4px; background: #ffd7f2; color: inherit; }
.tp-empty { display: grid; justify-items: center; gap: .4rem; padding: 3.5rem 1rem; text-align: center; color: #8a8a92; }
.tp-empty .ico { width: 2.6rem; height: 2.6rem; color: #cfcfd6; }
.tp-empty b { color: var(--ui-ink); font-size: 1.05rem; }

.tp-foot { display: flex; justify-content: center; margin-top: 2.5rem; }

@media (max-width: 767.98px) {
  .tp-hero { padding-top: 1.8rem; }
  .tp-bar { top: 64px; flex-wrap: wrap; border-radius: 26px; padding: .45rem; gap: .35rem .5rem; }
  .tp-search { flex: 1 1 100%; }
  .tp-switch { margin-left: .5rem; }
  .tp-count { margin-left: auto; }
  .tp-card { flex-direction: column; gap: .7rem; padding: 1rem; border-radius: 22px; }
  .tp-num { width: 38px; height: 38px; border-radius: 13px; }
  .tp-q { font-size: 1rem; margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .tp-card, .tp-ans, .tp-switch__track i { transition-duration: .01s !important; } }
