/* Giao diện bổ sung (phần lớn kiểu dáng dùng lớp Tailwind viết thẳng trong HTML/JS) */

/* KaTeX: cỡ chữ công thức và công thức dài cuộn ngang */
.katex {
  font-size: 1.05em;
  text-rendering: auto;
}
.katex-display-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}
.katex-display-wrapper::-webkit-scrollbar {
  height: 4px;
}
.katex-display-wrapper::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Hình TikZ co theo khung, phóng to khi bấm */
.tikz-host svg {
  max-width: 100%;
  height: auto;
  overflow: visible;
}
/* Khung hình gọn: thanh nút chỉ hiện khi rê chuột (máy có chuột).
   Hình lỗi thì vẫn hiện như cũ. Màn hình cảm ứng giữ nguyên thanh nút. */
@media (hover: hover) {
  .tikz-figure:not(.tz-has-error) {
    border-color: transparent;
    transition: border-color 0.15s;
  }
  .tikz-figure:not(.tz-has-error):hover,
  .tikz-figure:not(.tz-has-error):focus-within {
    border-color: #e2e8f0;
  }
  /* Thanh nút vẫn chiếm chỗ riêng phía trên hình (không phủ lên hình), chỉ ẩn/hiện */
  .tikz-figure:not(.tz-has-error) .tz-toolbar {
    background: transparent;
    border-bottom-color: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
  }
  .tikz-figure:not(.tz-has-error):hover .tz-toolbar,
  .tikz-figure:not(.tz-has-error):focus-within .tz-toolbar {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Bố cục \immini: hình bám sát mép trên; ở thẻ câu hỏi có tag ID6 thì kéo hình lên ngang tag */
.immini-fig > .tikz-figure:first-child {
  margin-top: 0;
}
@media (min-width: 640px) {
  .pull-figure > .immini-row:first-child > .immini-fig {
    margin-top: -2.25rem;
  }
}
/* Ngân hàng chia 2 cột (màn hình ≥1280px): cột hình \immini nhỏ lại để chữ đề rộng hơn */
@media (min-width: 1280px) {
  .bank-grid .immini-fig {
    max-width: 38%;
  }
}

.tikz-zoom svg {
  width: min(85vw, 900px);
  height: auto;
  max-height: 80vh;
  overflow: visible;
}

/* Màu bôi đen chữ */
::selection {
  background-color: #ccfbf1;
  color: #0f766e;
}

/* Khi in */
@media print {
  @page {
    size: A4 portrait;
    margin: 1.5cm;
  }
  body {
    background-color: white !important;
    color: black !important;
    font-size: 12pt;
  }
  header,
  footer,
  nav,
  button,
  .print-hidden {
    display: none !important;
  }
}
