/* ==========================================================
   TKA Quiz — gaya widget (semua selector diawali .tkaq agar
   tidak bentrok dengan CSS halaman induk).
   Tema bisa diubah lewat CSS variable di bawah, mis.:
   #kuis .tkaq { --tkaq-accent: #7c3aed; }
   ========================================================== */

.tkaq {
  --tkaq-accent: #2563eb;
  --tkaq-accent-soft: #dbeafe;
  --tkaq-ok: #15803d;
  --tkaq-ok-soft: #dcfce7;
  --tkaq-bad: #b91c1c;
  --tkaq-bad-soft: #fee2e2;
  --tkaq-text: #1f2937;
  --tkaq-muted: #6b7280;
  --tkaq-border: #d1d5db;
  --tkaq-bg: #ffffff;
  --tkaq-surface: #f9fafb;
  --tkaq-radius: 12px;

  display: block;
  box-sizing: border-box;
  max-width: 100%;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--tkaq-text);
  background: var(--tkaq-bg);
  border: 1px solid var(--tkaq-border);
  border-radius: var(--tkaq-radius);
  container-type: inline-size;
}

.tkaq *,
.tkaq *::before,
.tkaq *::after {
  box-sizing: border-box;
}

/* ---------- Header & progress ---------- */
.tkaq-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tkaq-title {
  margin: 0;
  font-size: 1.15em;
  font-weight: 700;
  line-height: 1.3;
}
.tkaq-count {
  color: var(--tkaq-muted);
  font-size: 0.9em;
}
.tkaq-bar {
  height: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--tkaq-surface);
  border: 1px solid var(--tkaq-border);
  border-radius: 99px;
}
.tkaq-bar > span {
  display: block;
  height: 100%;
  background: var(--tkaq-accent);
}

/* ---------- Layout: teks + soal ---------- */
.tkaq-layout {
  display: grid;
  gap: 14px;
}
@container (min-width: 760px) {
  .tkaq-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  .tkaq-passage-body {
    max-height: min(70vh, 540px);
    overflow: auto;
    padding-right: 6px;
  }
}

.tkaq-passage {
  padding: 12px 14px;
  background: var(--tkaq-surface);
  border: 1px solid var(--tkaq-border);
  border-radius: 10px;
}
.tkaq-passage > summary {
  font-weight: 700;
  cursor: pointer;
}
.tkaq-passage-body {
  margin-top: 8px;
}
.tkaq-passage-title {
  margin: 0 0 6px;
  font-size: 1em;
  font-weight: 700;
}
.tkaq-passage-body p {
  margin: 0 0 0.75em;
}
.tkaq-passage-body p:last-child {
  margin-bottom: 0;
}

/* ---------- Navigator nomor soal ---------- */
.tkaq-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.tkaq-nav button {
  width: 36px;
  height: 36px;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  background: var(--tkaq-bg);
  border: 1px solid var(--tkaq-border);
  border-radius: 8px;
}
.tkaq-nav button.is-answered {
  background: var(--tkaq-accent-soft);
  border-color: var(--tkaq-accent);
}
.tkaq-nav button[aria-current="step"] {
  color: #fff;
  background: var(--tkaq-accent);
  border-color: var(--tkaq-accent);
}

/* ---------- Soal & opsi ---------- */
.tkaq-q-text {
  margin: 0 0 10px;
  font-size: 1em;
  font-weight: 600;
  white-space: pre-line;
}
.tkaq-q-text:focus {
  outline: none;
}
.tkaq-q-no {
  color: var(--tkaq-accent);
}
.tkaq-options {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.tkaq-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  cursor: pointer;
  background: var(--tkaq-bg);
  border: 1px solid var(--tkaq-border);
  border-radius: 10px;
}
.tkaq-opt:hover {
  border-color: var(--tkaq-accent);
}
.tkaq-opt:focus-within {
  outline: 2px solid var(--tkaq-accent);
  outline-offset: 2px;
}
.tkaq-opt.is-selected {
  background: var(--tkaq-accent-soft);
  border-color: var(--tkaq-accent);
}
.tkaq-opt input {
  flex: none;
  margin: 0.3em 0 0;
}
.tkaq-opt-key {
  flex: none;
  min-width: 1.2em;
  font-weight: 700;
}
.tkaq-opt-text {
  min-width: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* ---------- Soal tabel (Similarity / Difference) ---------- */
.tkaq-table-wrap {
  overflow-x: auto;
}
.tkaq-table {
  width: 100%;
  border-collapse: collapse;
}
.tkaq-table th,
.tkaq-table td {
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--tkaq-border);
}
.tkaq-table thead th {
  background: var(--tkaq-surface);
  font-size: 0.9em;
}
.tkaq-table tbody th {
  font-weight: 400;
  text-align: left;
}
.tkaq-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  cursor: pointer;
}
.tkaq-cell input {
  margin: 0;
}
.tkaq-cell:focus-within {
  outline: 2px solid var(--tkaq-accent);
  outline-offset: 2px;
}

/* ---------- Tombol & footer ---------- */
.tkaq-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  margin-top: 16px;
}
.tkaq-btn {
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--tkaq-text);
  cursor: pointer;
  background: var(--tkaq-bg);
  border: 1px solid var(--tkaq-border);
  border-radius: 10px;
}
.tkaq-btn:hover:not(:disabled) {
  border-color: var(--tkaq-accent);
}
.tkaq-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.tkaq-btn--primary {
  color: #fff;
  background: var(--tkaq-accent);
  border-color: var(--tkaq-accent);
}
.tkaq button:focus-visible,
.tkaq summary:focus-visible {
  outline: 2px solid var(--tkaq-accent);
  outline-offset: 2px;
}
.tkaq-notice {
  margin: 12px 0 0;
  padding: 8px 12px;
  color: #92400e;
  background: #fef3c7;
  border-radius: 8px;
  font-size: 0.92em;
}
.tkaq-notice:empty {
  display: none;
}
.tkaq-msg {
  margin: 0;
  padding: 24px 8px;
  text-align: center;
  color: var(--tkaq-muted);
}

/* ---------- Hasil ---------- */
.tkaq-summary {
  margin-bottom: 14px;
  padding: 18px 14px;
  text-align: center;
  background: var(--tkaq-surface);
  border: 1px solid var(--tkaq-border);
  border-radius: 10px;
}
.tkaq-score {
  font-size: 2.2em;
  font-weight: 800;
  line-height: 1.1;
  color: var(--tkaq-accent);
}
.tkaq-grade {
  margin-top: 4px;
  font-weight: 600;
}
.tkaq-summary p {
  margin: 6px 0 0;
  color: var(--tkaq-muted);
}
.tkaq-review-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.tkaq-review {
  padding: 14px;
  background: var(--tkaq-bg);
  border: 1px solid var(--tkaq-border);
  border-left-width: 5px;
  border-radius: 10px;
}
.tkaq-review--ok {
  border-left-color: var(--tkaq-ok);
}
.tkaq-review--bad {
  border-left-color: var(--tkaq-bad);
}
.tkaq-review--none {
  border-left-color: var(--tkaq-muted);
}
.tkaq-review-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.tkaq-review-title {
  margin: 0;
  font-size: 1em;
}
.tkaq-review-q {
  margin: 0 0 10px;
  font-weight: 600;
  white-space: pre-line;
}
.tkaq-badge {
  padding: 2px 10px;
  font-size: 0.85em;
  font-weight: 700;
  border-radius: 99px;
}
.tkaq-badge--ok {
  color: var(--tkaq-ok);
  background: var(--tkaq-ok-soft);
}
.tkaq-badge--bad {
  color: var(--tkaq-bad);
  background: var(--tkaq-bad-soft);
}
.tkaq-badge--none {
  color: var(--tkaq-muted);
  background: var(--tkaq-surface);
  border: 1px solid var(--tkaq-border);
}

/* opsi pada layar hasil (tidak interaktif) */
.tkaq-opt--static {
  cursor: default;
}
.tkaq-opt--static:hover {
  border-color: var(--tkaq-border);
}
.tkaq-opt--static.is-key {
  background: var(--tkaq-ok-soft);
  border-color: var(--tkaq-ok);
}
.tkaq-opt--static.is-wrong {
  background: var(--tkaq-bad-soft);
  border-color: var(--tkaq-bad);
}
.tkaq-tag {
  display: block;
  margin-top: 2px;
  font-size: 0.82em;
  font-weight: 700;
}
.is-key .tkaq-tag {
  color: var(--tkaq-ok);
}
.is-wrong .tkaq-tag {
  color: var(--tkaq-bad);
}

/* pernyataan pada soal tabel (layar hasil) */
.tkaq-stmt {
  margin-bottom: 8px;
  padding: 8px 12px;
  border: 1px solid var(--tkaq-border);
  border-radius: 10px;
}
.tkaq-stmt.is-ok {
  background: var(--tkaq-ok-soft);
  border-color: var(--tkaq-ok);
}
.tkaq-stmt.is-bad {
  background: var(--tkaq-bad-soft);
  border-color: var(--tkaq-bad);
}
.tkaq-stmt-text {
  font-weight: 600;
}
.tkaq-stmt-exp {
  margin-top: 4px;
  font-size: 0.92em;
}

.tkaq-exp {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--tkaq-surface);
  border-radius: 8px;
  font-size: 0.95em;
}
.tkaq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
