/* ================= TRANG CHỦ NGƯỜI DÙNG (/home) =================
   Trang này extends base.html nên chỉ nạp biz.css — KHÔNG có landing.css.
   Vì vậy tuyệt đối không dùng token --ld-* (chỉ tồn tại trong landing.css),
   mọi màu lấy từ bảng token của biz.css để tự khớp light/dark.

   Màu chấm điểm: --success/--warning của biz.css đủ tương phản khi làm THANH
   (đồ hoạ, ≥3:1) nhưng KHÔNG đủ khi làm CHỮ trên nền trắng (--success #10b981
   chỉ ~2.5:1). Nên tách riêng biến cho chữ. */
.uh-tour {
  --uh-ok: #10b981;    --uh-mid: #f59e0b;    --uh-bad: #ef4444;
  --uh-ok-t: #047857;  --uh-mid-t: #b45309;  --uh-bad-t: #b91c1c;
}
[data-theme="dark"] .uh-tour {
  --uh-ok-t: #34d399;  --uh-mid-t: #fbbf24;  --uh-bad-t: #f87171;
}

.uh-page { width: min(1140px, calc(100% - 32px)); margin: 26px auto 64px; }

/* ---- Lời chào ---- */
.uh-hero h1 {
  font-family: var(--font-display); font-size: 30px; line-height: 1.2;
  margin: 0; color: var(--text);
}
.uh-hero-sub { margin: 10px 0 0; max-width: 620px; font-size: 14.5px; color: var(--text-2); }

/* ---- Khung khối ---- */
.uh-tour, .uh-room {
  margin-top: 24px; padding: 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.uh-tour-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.uh-tour-head h2 { margin: 0; font-size: 19px; color: var(--text); }
.uh-replay {
  flex: none; padding: 7px 12px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: color .15s, border-color .15s;
}
.uh-replay:hover { color: var(--brand); border-color: var(--brand); }

.uh-tour-grid { display: grid; grid-template-columns: 216px 1fr; gap: 24px; }

/* ---- Cột tab ---- */
.uh-tabs { display: flex; flex-direction: column; gap: 6px; }
.uh-tab {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid transparent; background: none;
  font-family: inherit; text-align: left; color: var(--text-2);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.uh-tab:hover { background: var(--surface-2); }
.uh-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.uh-tab[aria-selected="true"] {
  background: var(--brand-soft); border-color: var(--brand); color: var(--text);
}
.uh-tab-txt b { font-size: 14px; font-weight: 700; }

/* Số thứ tự + vòng đếm thời gian.
   KHÔNG dùng CSS animation cho vòng đếm: userhome.js vẽ nó trong cùng vòng lặp
   với bộ đếm nhịp để tạm dừng/chạy tiếp không bị lệch. CSS animation lại đè
   được lên inline style nên hai bên cùng vẽ là hỏng. */
.uh-tab-n { position: relative; flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.uh-tab-n svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.uh-tab-n .ring {
  fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 0 101;      /* chu vi 2πr với r=16 ≈ 100.5 */
}
.uh-tab-n i {
  position: relative; font-style: normal; font-weight: 800; font-size: 12.5px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-3);
}
.uh-tab[aria-selected="true"] .uh-tab-n i { background: var(--brand); color: #fff; }

/* ---- Panel ---- */
.uh-panels { min-width: 0; }
.uh-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.uh-mini {
  padding: 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px;
}
/* Nhãn loại: giúp phân biệt Mock / Practice Pack / Quiz ngay từ cái nhìn đầu */
.uh-kind {
  display: inline-block; margin-bottom: 12px; padding: 3px 9px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand);
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.uh-hint { margin: 10px 0 0; font-size: 11px; color: var(--text-3); text-align: center; }
.uh-hint.done { color: var(--brand); }
.uh-hint b { color: var(--text-2); }

.uh-how h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.uh-why { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--text-2); }
.uh-why b { color: var(--text); }
.uh-steps {
  margin: 0 0 16px; padding-left: 19px;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12.8px; line-height: 1.5; color: var(--text-2);
}
.uh-steps b { color: var(--text); font-weight: 700; }
.uh-go { display: inline-flex; }

/* Nút bên trong mô phỏng: khử style mặc định của <button> */
.uh-db, .uh-pill, .uh-day, .uh-book, .uh-fc, .uh-mc-act, .uh-qz-roll {
  font-family: inherit; cursor: pointer;
}

/* ---- 1. Mock: thẻ đề đầy đủ, 2 phiên, có tính giờ ---- */
.uh-mock-card {
  padding: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.uh-mc-top { display: flex; align-items: center; justify-content: space-between; }
.uh-mc-prov { font-size: 9.5px; font-weight: 800; letter-spacing: .09em; color: var(--text-3); }
.uh-chip { padding: 3px 7px; border-radius: 999px; font-size: 9.5px; font-weight: 800; letter-spacing: .06em; }
.uh-chip.free { background: var(--uh-ok); color: #fff; }
.uh-mc-title { margin-top: 10px; font-size: 15px; font-weight: 800; color: var(--text); }
.uh-mc-meta { margin-top: 2px; font-size: 11px; color: var(--text-3); }
.uh-mc-sess {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 9px; padding: 8px 10px; font-size: 11.5px;
  border: 1px solid var(--border); border-radius: 9px;
}
.uh-mc-lbl { font-weight: 700; letter-spacing: .06em; color: var(--text-3); }
.uh-mc-act { border: 0; background: none; font-size: 11.5px; padding: 0; }
.uh-mc-act.go { color: var(--brand); font-weight: 700; }
.uh-mc-act.lock { color: var(--text-3); cursor: default; }
.uh-mc-sess.running { border-color: var(--brand); background: var(--brand-soft); }
.uh-mc-sess.running .uh-mc-lbl { color: var(--brand); }
/* thanh tiến độ hiện ra khi bấm Bắt đầu — cho thấy mock là đề CÓ TÍNH GIỜ */
.uh-mc-bar { height: 4px; margin-top: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.uh-mc-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width 1s linear; }

/* ---- 2. Dashboard: ô chỉ số + donut + thanh theo môn ---- */
.uh-dash-top { display: flex; align-items: center; gap: 14px; }
.uh-donut { flex: none; transform: rotate(-90deg); }
.uh-do-bg, .uh-do-fg { fill: none; stroke-width: 4.2; }
.uh-do-bg { stroke: var(--border); }
.uh-do-fg {
  stroke: var(--uh-ok); stroke-linecap: round;
  stroke-dasharray: 0 100;   /* chu vi ≈ 100 nên dasharray đọc thẳng ra % */
  transition: stroke-dasharray .9s cubic-bezier(.2,.7,.3,1);
}
.uh-tiles { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.uh-tile {
  padding: 6px 8px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border);
}
.uh-tile b { display: block; font-size: 14px; font-weight: 800; color: var(--text); }
.uh-tile i { display: block; margin-top: 1px; font-style: normal; font-size: 9.5px; color: var(--text-3); }

.uh-dash-bars { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.uh-db {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 4px 6px; font-size: 11px;
  background: none; border: 1px solid transparent; border-radius: 8px;
  transition: opacity .25s, background .15s, border-color .15s;
}
.uh-db:hover { background: var(--surface-2); }
.uh-db:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.uh-db-n { flex: none; width: 84px; color: var(--text-2); text-align: left; }
.uh-db-t { flex: 1; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.uh-db-t i { display: block; height: 100%; width: var(--w); border-radius: 4px; }
.uh-db-t i.ok { background: var(--uh-ok); }
.uh-db-t i.mid { background: var(--uh-mid); }
.uh-db-t i.bad { background: var(--uh-bad); }
.uh-db-p { flex: none; width: 30px; text-align: right; font-weight: 700; }
.uh-db-p.ok { color: var(--uh-ok-t); }
.uh-db-p.mid { color: var(--uh-mid-t); }
.uh-db-p.bad { color: var(--uh-bad-t); }
.uh-dash-bars.picked .uh-db { opacity: .35; }
.uh-dash-bars.picked .uh-db.on { opacity: 1; border-color: var(--brand); background: var(--brand-soft); }

/* ---- 3. Practice Pack: cột lọc môn + thẻ đề ---- */
.uh-pp { display: grid; grid-template-columns: 96px 1fr; gap: 12px; }
.uh-pp-lbl { margin-bottom: 6px; font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--text-3); }
.uh-pill {
  display: block; width: 100%; margin-bottom: 4px; padding: 5px 8px;
  font-size: 10.5px; color: var(--text-2); text-align: left;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  transition: border-color .15s, background .15s, color .15s;
}
.uh-pill:hover { border-color: var(--brand-2); color: var(--brand); }
.uh-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.uh-pill.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 700; }
.uh-pp-card {
  margin-bottom: 8px; padding: 9px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.uh-pp-card b { display: block; font-size: 12px; color: var(--text); }
.uh-pp-card span { display: block; margin-top: 1px; font-size: 10px; color: var(--text-3); }
.uh-pp-card em {
  display: inline-block; margin-top: 7px; padding: 4px 10px;
  font-style: normal; font-size: 10.5px; font-weight: 700;
  background: var(--brand); color: #fff; border-radius: 7px;
}

/* ---- 4. Flashcard: thẻ hai mặt, bấm để lật ---- */
.uh-fc {
  display: block; width: 100%; height: 128px; padding: 0;
  background: none; border: 0; perspective: 800px;
}
.uh-fc:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 11px; }
.uh-fc-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.uh-fc[aria-pressed="true"] .uh-fc-inner { transform: rotateY(180deg); }
.uh-fc-face {
  position: absolute; inset: 0; padding: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow);
}
.uh-fc-tag { font-size: 9px; font-weight: 800; letter-spacing: .1em; color: var(--text-3); }
.uh-fc-front b { font-size: 19px; color: var(--text); }
.uh-fc-back { transform: rotateY(180deg); font-size: 12.5px; line-height: 1.5; color: var(--text-2); }

/* ---- 5. Quiz: bộ câu ngẫu nhiên hôm nay + lịch theo ngày ---- */
.uh-qz-today {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding: 9px 11px; font-size: 11.5px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.uh-qz-today b { font-size: 16px; font-weight: 800; color: var(--brand); }
.uh-qz-roll {
  margin-left: auto; padding: 4px 9px; font-size: 10.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 7px;
  transition: color .15s, border-color .15s;
}
.uh-qz-roll:hover { color: var(--brand); border-color: var(--brand); }
.uh-qz-roll.spin { animation: uh-roll .5s ease-out; }
@keyframes uh-roll { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.uh-daily { display: flex; gap: 5px; }
.uh-day {
  flex: 1; aspect-ratio: 1; gap: 1px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 9.5px; color: var(--text-3);
  background: none; border: 1px solid var(--border); border-radius: 8px;
  transition: background .15s, color .15s, border-color .15s;
}
.uh-day:hover { border-color: var(--brand-2); }
.uh-day:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.uh-day i { font-style: normal; font-size: 11px; }
/* nền xanh dùng màu trong suốt để hợp cả light lẫn dark */
.uh-day.done { background: rgba(16, 185, 129, .14); border-color: transparent; color: var(--uh-ok-t); }
.uh-day.today { border-color: var(--brand); color: var(--brand); font-weight: 800; }
.uh-streak { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--text-2); }
.uh-streak b { font-size: 15px; color: var(--brand); font-variant-numeric: tabular-nums; }

/* ---- 6. Sách: bìa theo trung tâm ra đề ---- */
.uh-books { display: flex; gap: 8px; }
.uh-book {
  flex: 1; min-height: 104px; padding: 10px 9px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  border-radius: 9px; border: 1px solid transparent; text-align: left;
  background: linear-gradient(160deg, var(--brand), #1e40af); color: #fff;
  transition: transform .15s;
}
.uh-book:hover { transform: translateY(-2px); }
.uh-book:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.uh-book-p { font-size: 8.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.uh-book-t { font-size: 11.5px; font-weight: 800; line-height: 1.25; }
.uh-book em { font-style: normal; font-size: 9px; }
.uh-book.locked { background: var(--surface-2); border-color: var(--border); color: var(--text-3); }
.uh-book.locked:hover { transform: none; }
.uh-book.shake { animation: uh-shake .34s ease-in-out; }
@keyframes uh-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
/* Trang sách xem thử: mấy vệt xám gợi ý dòng chữ, không giả làm nội dung thật */
.uh-peek {
  margin-top: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.uh-peek span { display: block; height: 7px; border-radius: 4px; background: var(--surface-2); }
.uh-peek span:nth-child(1) { width: 94%; }
.uh-peek span:nth-child(2) { width: 100%; }
.uh-peek span:nth-child(3) { width: 88%; }
.uh-peek span:nth-child(4) { width: 56%; }

/* ================= KHỐI "PHÒNG THI HOẠT ĐỘNG THẾ NÀO" =================
   Phòng thi được nhúng qua iframe ở kích thước cố định 1360x760 rồi thu nhỏ
   bằng transform, thay vì cho nó co giãn tự do. Lý do: phòng thi là bố cục
   toàn màn hình (thanh trên, cột số câu, thanh dưới) — ép hẹp lại thì các
   thanh dồn cục, nhìn không còn giống phần mềm thi thật nữa.
   Hệ số --s do userhome.js tính theo bề ngang thật của khung. */
.uh-room-sub { margin: -6px 0 16px; font-size: 13px; color: var(--text-2); max-width: 640px; }
.uh-room-frame {
  --s: 1;
  position: relative; width: 100%; overflow: hidden;
  height: calc(760px * var(--s));
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff;                 /* nền phòng thi là trắng, tránh nháy tối */
}
.uh-room-frame iframe {
  position: absolute; left: 0; top: 0;
  width: 1360px; height: 760px; border: 0;
  transform: scale(var(--s)); transform-origin: 0 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .uh-tour-grid { grid-template-columns: 1fr; }
  /* Tab đổi thành hàng ngang cuộn được */
  .uh-tabs { flex-direction: row; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .uh-tab { flex: none; }
}
@media (max-width: 640px) {
  .uh-panel { grid-template-columns: 1fr; gap: 16px; }
  .uh-hero h1 { font-size: 25px; }
  .uh-tour, .uh-room { padding: 16px; }
  .uh-tiles { grid-template-columns: 1fr; }
}
