/* pages/ex-common.css — khối dùng chung của các màn làm bài mới (templates/pages/ex/*.html):
   lớp phủ toàn màn hình (thanh trên 56px + thân + chân 72px), vạch tiến độ, biểu tượng trang dạng ô,
   nút cấp độ, ô số liệu, nút "Tra từ" nổi. Chỉ dùng biến trong tokens.css.
   Khối nên gom vào base.css sau: .exi-full/.exi-bar/.exi-foot (màn toàn trang của bản vẽ), .exi-stat, .exi-spin. */

body.exi-lock { overflow: hidden; }
.exi-grow { flex-grow: 1; }
.exi-kicker { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.exi-h1 { margin: 0 0 18px; font-size: 36px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.exi-crumb-link { color: var(--muted); text-decoration: none; }
.exi-crumb-link:hover { color: var(--ink); text-decoration: underline; }

/* Biểu tượng trang dạng ô màu (bản vẽ DH_1 / TT_1 / FC_D1: 64px, bo 14px, không có ảnh bìa) */
.exi-icon {
  width: 64px; height: 64px; margin-top: 56px;
  border-radius: var(--r-lg); display: grid; place-items: center;
}
.exi-start .page-title { margin-top: 18px; }

/* Nút cấp độ N5–N1 */
.exi-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.exi-level {
  min-width: 48px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.exi-level:hover { border-color: var(--faint); }
.exi-level.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.btn-primary:disabled, .btn-primary:disabled:hover {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg));
  border-color: transparent; color: var(--on-accent); cursor: default;
}
.btn:disabled { cursor: default; }

.exi-tips-title { margin-top: 28px; }
.exi-tips { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.8; color: var(--text); }
.exi-empty { margin-bottom: 16px; }

/* ── Lớp phủ toàn màn hình ───────────────────────────────────────── */
.exi-full {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
}
.exi-full[hidden] { display: none; }
.exi-bar {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.exi-bar-x {
  width: 36px; height: 36px; flex-shrink: 0;
  border: 0; border-radius: var(--r); background: none; color: var(--ink);
  display: grid; place-items: center; cursor: pointer; text-decoration: none;
}
.exi-bar-x:hover { background: var(--bg-soft); color: var(--ink); }
.exi-bar-crumb {
  min-width: 0; font-size: 14px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.exi-bar-count { font-size: 13px; color: var(--muted); }
.exi-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.exi-with-foot { flex-grow: 1; min-height: 0; }
.exi-foot {
  height: 72px; flex-shrink: 0;
  display: flex; align-items: center;
  padding: 0 20px; border-top: 1px solid var(--line); background: var(--bg);
}
.exi-foot-in { max-width: 760px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.exi-foot-note { font-size: 13px; color: var(--muted); }

/* Vạch tiến độ (bản vẽ: 5 vạch 4px trong khung rộng 220px) */
.exi-segs { display: flex; gap: 4px; width: 220px; flex-shrink: 0; }
.exi-seg { flex-grow: 1; height: 4px; border-radius: 2px; background: var(--line); }
.exi-seg.is-on { background: var(--accent); }
.exi-segs .progress-bar { width: 100%; }

/* Ô số liệu (Điểm / Đúng / Sai) */
.exi-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 26px; }
.exi-stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); }
.exi-stat p { margin: 0; font-size: 13px; color: var(--muted); }
.exi-stat b { display: block; margin-top: 4px; font-size: 24px; font-weight: 700; }
.exi-stat small { font-size: 14px; font-weight: 400; color: var(--muted); }

/* Vòng xoay chờ */
.exi-spin {
  display: inline-block; width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: exi-spin 0.8s linear infinite;
}
@keyframes exi-spin { to { transform: rotate(360deg); } }
.exi-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 80px 20px; font-size: 14px; color: var(--muted);
}

/* Nút "Tra từ" nổi khi bôi chọn chữ (js/pages/ex/common.js bindButtonLookup) */
.exi-lookup-fab {
  position: fixed; z-index: 400;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 16px; border: 0; border-radius: 20px;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-pop); -webkit-tap-highlight-color: transparent;
}
.exi-lookup-fab[hidden] { display: none; }

@media (max-width: 860px) {
  .exi-icon { width: 50px; height: 50px; margin-top: 28px; border-radius: 10px; }
  .exi-icon svg { width: 25px; height: 25px; }
  .exi-bar { padding: 0 12px; }
  .exi-bar-crumb { display: none; }
  .exi-segs { width: 140px; }
  .exi-foot { height: 76px; padding: 0 16px; }
  .exi-foot-note { display: none; }
  .exi-foot .exi-grow { display: none; }
  .exi-foot-in > .btn-primary:last-child { flex-grow: 1; }
  .exi-levels { gap: 5px; }
  .exi-level { min-width: 38px; padding: 0 8px; }
  .exi-h1 { font-size: 28px; }
  .exi-stats { gap: 8px; }
  .exi-stat { padding: 12px; }
  .exi-stat b { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .exi-spin { animation-duration: 2.4s; }
}
