/* ══════════════════════════════════════════════════════════════════════
   თეორიის ეკრანები — ბილეთის ბარათი, გამოცდაზე დაშვება, შედეგი.
   ნიმუში: starti.ge/martvis-mocmobis-biletebi-teoria.php

   ბილეთის ბარათი განზრახ არ იყენებს საიტის „ღია" ბარათებს: ბილეთი
   საგამოცდო მასალაა და მუქ ჩარჩოში იკითხება ისე, როგორც გამოცდაზე —
   იგივე კითხვა, იგივე ნუმერაცია, იგივე განლაგება. ერთადერთი განსხვავება
   სასწავლო რეჟიმშია: სწორი პასუხი მწვანედ ანათებს.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --tk-ink: #1a2e35;         /* ბილეთის ფონი */
  --tk-line: #ffffff;        /* ბადის ხაზი */
  --tk-ok: #5fd389;          /* სწორი პასუხი */
  --tk-bad: #ef4444;
  --tk-radius: 10px;
}

/* ══════════ ბილეთის ბარათი ══════════ */

.tkc {
  position: relative;
  margin: 0 0 1.5rem;
  border-radius: var(--tk-radius);
  background: var(--tk-ink);
  box-shadow: 0 6px 24px rgb(7 26 61 / 10%);
}

/* სურათი + კითხვის ზოლი */
.tkc__wrap {
  position: relative;
  line-height: 0;
  background: var(--tk-ink);
  border-radius: var(--tk-radius) var(--tk-radius) 0 0;
  overflow: hidden;
}

.tkc__wrap picture { display: block; width: 100%; }

.tkc__img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 0;
  cursor: zoom-in;
}

/* ბილეთის სურათს ქვედა კიდეზე შავი ზოლი აქვს — იქ ორიგინალში პასუხების
   ველები იყო. კითხვის ტექსტი სწორედ ამ ზოლზე დგება, ისე, როგორც
   საგამოცდო ბლანკზე.
   ზოლი ნატურალურ სიგანეზე 77 px-ია (1000 px სურათზე) — ე.ი. ყოველთვის
   სიგანის 7.7%. პროცენტული `margin-top` სწორედ შემცველის **სიგანეს**
   ეყრდნობა, ამიტომ გადაფარვა თავისით ჰყვება ნებისმიერ ზომას და
   JS-ით გაზომვა საერთოდ არ სჭირდება. */
.tkc__wrap--tall .tkc__q {
  position: relative;
  z-index: 2;
  margin-top: -7.7%;
}

/* განიერი, დაბალი სურათი (ნიშნების ზოლი 1000×226) — ზოლი არ აქვს,
   ტექსტი უბრალოდ ქვემოთ დგება */
.tkc__wrap--wide .tkc__q { position: relative; margin-top: 0; }

/* უსურათო ბილეთზე ნიშნულები კითხვის ზოლზე დგება — ტექსტს მარჯვნიდან
   ადგილი უნდა დაუტოვოს, თორემ გრძელი კითხვა მათ ქვეშ ამოდის. */
.tkc__wrap--noimg .tkc__q { padding-right: 96px; }
@media (max-width: 720px) { .tkc__wrap--noimg .tkc__q { padding-right: 84px; } }

.tkc__q {
  padding: 18px 16px;
  background: #1a2e35d1;
  color: #fff;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}
.tkc__q p { margin: 0; }

/* ── ნიშნულები (ნომერი, განმარტება) ── */
/* ნიშნულები სურათზე დგას, ამიტომ ჩვეულებრივ მილულულია — ნიშნების
   ზოლიან ბილეთზე (1000×226) სრული სიხშირით ისინი მეოთხე ნიშანს
   ფარავდნენ. კურსორის მიტანაზე ან ფოკუსზე სრულად ჩნდება; სენსორულ
   ეკრანზე კი მუდამ საკმარისად ხილულია, რომ თითით მოხვდე. */
.tkc__badges {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  opacity: .3;
  transition: opacity .18s ease;
}
.tkc:hover .tkc__badges,
.tkc:focus-within .tkc__badges { opacity: 1; }
@media (hover: none) {
  .tkc__badges { opacity: .85; }
}

.tkc__badge,
.tkc__no {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 8px;
  background: #fff;
  color: #333335;
  box-shadow: 0 2px 6px rgb(0 0 0 / 20%), 0 1px 2px rgb(0 0 0 / 10%);
  text-decoration: none;
  flex-shrink: 0;
}

.tkc__badge {
  width: 36px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 15%);
  cursor: pointer;
  transition: transform .15s cubic-bezier(.4, 0, .2, 1), background-color .15s;
}
.tkc__badge:hover { background: #f8f9fa; transform: translateY(-2px) scale(1.05); }
.tkc__badge svg { width: 17px; height: 17px; }

.tkc__no {
  min-width: 36px;
  padding: 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.5px;
}

/* ── პასუხების ბადე ── */
.tkc__answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--tk-line);
}

.tkc__a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--tk-ink);
  border-right: 1px solid var(--tk-line);
  border-bottom: 1px solid var(--tk-line);
  text-align: start;
  font: inherit;
  color: #fff;
}
.tkc__a:nth-child(2n) { border-right: none; }

/* ბოლო რიგს ქვედა ხაზი აღარ სჭირდება, კუთხეები კი მრგვალდება */
.tkc--2 .tkc__a { border-bottom: none; }
.tkc--3 .tkc__a:nth-child(3),
.tkc--3 .tkc__a:nth-child(4),
.tkc--4 .tkc__a:nth-child(3),
.tkc--4 .tkc__a:nth-child(4) { border-bottom: none; }
.tkc--2 .tkc__a:nth-child(1),
.tkc--3 .tkc__a:nth-child(3),
.tkc--4 .tkc__a:nth-child(3) { border-bottom-left-radius: var(--tk-radius); }
.tkc--2 .tkc__a:nth-child(2),
.tkc--3 .tkc__a:nth-child(4),
.tkc--4 .tkc__a:nth-child(4) { border-bottom-right-radius: var(--tk-radius); }

/* ცარიელი უჯრა 3 პასუხზე — დაშტრიხული, რომ პასუხად არ აღიქმებოდეს */
.tkc__a--void {
  background-image:
    repeating-linear-gradient(45deg, transparent 0 10px, rgb(255 255 255 / 0%) 10px, rgb(255 255 255 / 8%) 11px),
    repeating-linear-gradient(-45deg, transparent 0 10px, rgb(255 255 255 / 0%) 10px, rgb(255 255 255 / 8%) 11px);
}

.tkc__a.is-ok { background: var(--tk-ok); }
.tkc__a.is-ok .tkc__at { color: #08281a; }
.tkc__a.is-bad { background: var(--tk-bad); }

.tkc__an {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  background: #fff;
  color: #111;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.tkc__at { flex: 1; font-size: 15px; line-height: 1.45; color: #fff; }

/* ── განმარტება ── */
.tkc__explain {
  border-top: 1px solid rgb(255 255 255 / 12%);
  color: #fff;
}
.tkc__explain > summary {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tkc__explain > summary::-webkit-details-marker { display: none; }
.tkc__explain > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-inline-start: auto;
  border-right: 2px solid rgb(255 255 255 / 65%);
  border-bottom: 2px solid rgb(255 255 255 / 65%);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s ease;
}
.tkc__explain[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }

.tkc__explain-body {
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.65;
  color: rgb(255 255 255 / 88%);
}

/* ბილეთში გამოყენებული საგზაო ნიშნები */
.tkc__signs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgb(255 255 255 / 12%);
}
.tkc__signs-l {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgb(255 255 255 / 85%);
}
.tkc__sign {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
}
.tkc__sign + .tkc__sign { border-top: 1px solid rgb(255 255 255 / 8%); }
.tkc__sign img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  box-sizing: border-box;
}
.tkc__sign b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.tkc__sign p { margin: 0; font-size: 13px; line-height: 1.55; color: rgb(255 255 255 / 78%); }

/* ── მობილური: ერთი სვეტი ──
   ორ ვიწრო სვეტში ქართული პასუხი 5–6 ხაზად იშლება და ბადე ირღვევა. */
@media (max-width: 720px) {
  .tkc__answers { grid-template-columns: 1fr; }
  .tkc__a {
    border-right: none;
    border-bottom: 1px solid var(--tk-line);
    border-radius: 0 !important;
    min-height: 62px;
    padding: 12px 13px;
  }
  .tkc__a:last-child {
    border-bottom: none;
    border-bottom-left-radius: var(--tk-radius) !important;
    border-bottom-right-radius: var(--tk-radius) !important;
  }
  .tkc__a--void { display: none; }
  .tkc__an { width: 34px; height: 34px; font-size: 19px; }
  .tkc__at { font-size: 15px; }
  .tkc__q { padding: 14px 13px; font-size: 15.5px; }
  .tkc__badges { top: 6px; right: 6px; gap: 4px; }
  .tkc__badge { width: 32px; height: 32px; }
  .tkc__no { min-width: 32px; height: 32px; padding: 0 6px; font-size: 13px; }
}

/* ══════════ სურათის გადიდება ══════════ */
.tkz {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background: rgb(8 20 28 / 82%);
}
.tkz.is-open { display: flex; }
.tkz img {
  max-width: min(98vw, 1400px);
  max-height: calc(100vh - 80px);
  width: auto;
  height: auto;
  border: 2px solid #fff;
  border-radius: 4px;
  cursor: zoom-out;
}

/* ══════════ გამოცდაზე დაშვება ══════════ */

.xs { display: grid; gap: 1.25rem; margin-bottom: 2rem; }

/* კატეგორიის ფილა — ჩვენივე აიქონებით */
.xs-cats {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: .5rem;
}

.xs-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: .35rem;
  padding: .6rem .35rem .5rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.xs-cat:hover { border-color: #94a3b8; transform: translateY(-2px); }
.xs-cat.is-on {
  border-color: var(--brand, #155EEF);
  box-shadow: 0 0 0 2px rgb(21 94 239 / 18%);
}

.xs-cat__i { display: block; width: 100%; height: 42px; }
.xs-cat__i img { width: 100%; height: 100%; object-fit: contain; display: block; }
.xs-cat__l { font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.2; }

/* დაწყების ღილაკი */
.xs-go {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: 1rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #16C79A, #0f9c78);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(22 199 154 / 28%);
}
.xs-go:hover { filter: brightness(1.05); }
.xs-go svg { width: 20px; height: 20px; }

/* პირობები */
.xs-params {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
}
.xs-param {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .8rem .9rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: #fff;
}
.xs-param span { font-size: 12px; color: var(--muted, #64748b); }
.xs-param b { font-size: 20px; font-variant-numeric: tabular-nums; }
.xs-param--warn b { color: #C2410C; }
.xs-param--ok b { color: #047857; }

/* თემები */
.xs-topics {
  padding: 1rem 1.1rem 1.2rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 14px;
  background: #fff;
}
.xs-topics__hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
}
.xs-topics__hd h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  font-size: 17px;
}
.xs-topics__hd h2 svg { width: 18px; height: 18px; }

.xs-all {
  padding: .45rem .9rem;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 999px;
  background: #f8fafc;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.xs-all:hover { border-color: #94a3b8; }

.xs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .35rem .9rem;
}

.xs-topic {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
}
.xs-topic:hover { background: #f8fafc; }
.xs-topic input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.xs-topic__box {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
}
.xs-topic input:checked + .xs-topic__box {
  border-color: var(--brand, #155EEF);
  background: var(--brand, #155EEF);
}
.xs-topic input:checked + .xs-topic__box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.xs-topic input:focus-visible + .xs-topic__box { outline: 2px solid var(--brand, #155EEF); outline-offset: 2px; }

.xs-topic__t { flex: 1; min-width: 0; }
.xs-topic__t b { font-variant-numeric: tabular-nums; color: var(--muted, #64748b); font-weight: 600; }
.xs-topic__n {
  font-size: 12px;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
}

.xs-warn {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .9rem 0 0;
  padding: .6rem .8rem;
  border-radius: 8px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 13.5px;
}
.xs-warn svg { width: 16px; height: 16px; flex-shrink: 0; }

.ex-rules--wide { margin-bottom: 2rem; }

@media (max-width: 900px) {
  .xs-cats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .xs-params { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .xs-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .xs-cat__i { height: 34px; }
  .xs-cat__l { font-size: 11.5px; }
  .xs-grid { grid-template-columns: 1fr; }
  .xs-go { font-size: 16px; padding: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .xs-cat, .tkc__badge, .tkc__explain > summary::after { transition: none; }
}

/* შედეგის განხილვაში ბილეთი თეთრ ბარათშია ჩასმული — საკუთარი
   აჩრდილი და ქვედა შუალედი იქ ზედმეტია. */
.rz-item .tkc { margin: 0; box-shadow: none; }

/* ══════════ ვარჯიში ══════════
   იგივე ბარათია, ოღონდ პასუხი ღილაკია და დაწკაპუნებამდე ნეიტრალურია. */
button.tkc__a { cursor: pointer; width: 100%; }
button.tkc__a:not(:disabled):hover { background: #22404a; }
button.tkc__a:disabled { cursor: default; }
button.tkc__a:focus-visible { outline: 2px solid var(--tk-ok); outline-offset: -3px; }

.tkc__explain-body--open {
  padding: 14px 16px 16px;
  background: var(--tk-ink);
  border-top: 1px solid rgb(255 255 255 / 12%);
  border-radius: 0 0 var(--tk-radius) var(--tk-radius);
}
.tkc__explain-body--open p { margin: .5rem 0 0; }
.tkc__verdict { display: block; font-size: 14.5px; }
.tkc__verdict.is-ok { color: var(--tk-ok); }
.tkc__verdict.is-bad { color: #fca5a5; }

/* პასუხის შემდეგ ბარათს ქვედა კუთხეები აღარ სჭირდება — განმარტება მოსდევს */
.tkc:has(.tkc__explain-body--open) .tkc__a:last-of-type,
.tkc:has(.tkc__explain-body--open) .tkc__a { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.qz-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 0;
}
.qz-bar__hint { font-size: 12.5px; color: var(--muted, #64748b); }
@media (max-width: 560px) {
  .qz-bar__hint { display: none; }
  .qz-bar .v2-btn { flex: 1; justify-content: center; }
}
