/* Trang gốc: lớp chứa bốn demo gốc. Phần thanh trên và khung demo chép từ css/ops.css và css/guide.css
   (trang gốc không nạp hai tệp đó). Sửa kiểu ở đó thì chép lại sang đây. */

.live-shell { position: fixed; inset: 0; z-index: 100; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--deep); }
.live-shell[hidden] { display: none; }
/* Đang ở trang gốc: lớp này vẫn nằm trong khung nhìn để các demo khởi động, nhưng vô hình và không nhận chuột */
.live-shell.is-bg { opacity: 0; pointer-events: none; }
.live-main { position: relative; min-height: 0; overflow: hidden; overflow: clip; }
html.live-open, html.live-open body { overflow: hidden; }

.ops-bar {
  position: relative; z-index: var(--z-sticky); min-width: 0;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line); background: var(--deep);
}
.ops-brand { display: grid; place-items: center; min-width: var(--tap); min-height: var(--tap); flex: none; }
.ops-brand img { width: 58px; height: 26px; object-fit: contain; }

/* Bộ chuyển sản phẩm: bốn nút icon, nút đang xem hiện tên */
.ops-switch { display: flex; align-items: center; gap: 2px; flex: none; padding-left: 12px; border-left: 1px solid var(--line); }
.sw {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: var(--fs-small); font-weight: 700; color: var(--ice); white-space: nowrap;
  transition: border-color 200ms var(--ease), background-color 200ms var(--ease);
}
.sw .ic { width: 18px; height: 18px; color: var(--sky); }
.sw:hover { border-color: var(--line-strong); color: var(--white); }
.sw[aria-current="page"] { border-color: var(--line-strong); background: var(--panel); color: var(--white); }
.sw[aria-current="page"] .ic { color: var(--cyan-light); }
.sw:not([aria-current]) { padding: 0; }
.sw:not([aria-current]) .sw-name { display: none; }
.sw-dot { display: none; }

.ops-home {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ice);
}
.ops-home span { display: none; }
.ops-home svg { width: 18px; height: 18px; }
.ops-home:hover { color: var(--white); }


.sw:not([aria-current]) .sw-name { display: none; }
.sw-dot { display: none; }
@keyframes sim-blink { 50% { opacity: 0.3; } }
.sim-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--cyan); animation: sim-blink 2.4s ease-in-out infinite; }

/* ---------- Demo gốc nhúng trong trang ---------- */
.live-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--cyan); border-radius: var(--radius);
  font-size: var(--fs-small); font-weight: 700; color: var(--white); white-space: nowrap;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
}
.live-btn[hidden] { display: none; }
.live-btn:hover { background: var(--panel); border-color: var(--cyan-light); }
.live-btn[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); }
.live-ic { display: inline-grid; }
.live-ic svg { width: 16px; height: 16px; color: var(--cyan-light); }
.live-btn[aria-pressed="true"] .live-ic svg { color: var(--white); }
.ops-main { position: relative; }
.live { position: absolute; inset: 0; z-index: var(--z-full); background: var(--deep); }
.live[hidden] { display: none; }
/* Đang xem demo gốc: thẻ, đồng hồ và nút hướng dẫn của bản 3D không áp dụng */
body.is-live .ops-tabs, body.is-live .ops-clock, body.is-live .sim-pill, body.is-live .ops-about { display: none; }

/* Thanh trên khi xem demo gốc: logo · bốn thẻ sản phẩm có tên và chấm trạng thái · tiến độ tải sẵn · mở thẻ mới · toàn màn hình · tất cả mô hình.
   Thấp hơn bản 3D (48px) vì demo gốc đã có thanh tiêu đề riêng. */
body.is-live .ops-bar { height: 48px; gap: 12px; }
body.is-live .ops-switch { flex: 1; min-width: 0; gap: 4px; }
body.is-live .sw { position: relative; height: 36px; padding: 0 12px; }
body.is-live .sw .sw-name { display: inline; }
body.is-live .sw[aria-current="page"] { background: var(--blue); border-color: var(--blue); }
body.is-live .sw[aria-current="page"] .ic { color: var(--white); }
/* Chấm trạng thái: vòng rỗng nhấp nháy = đang tải, chấm xanh lục = đã sẵn (kèm chữ trong title và dòng tiến độ) */
body.is-live .sw-dot, .live-status .sw-dot { display: block; flex: none; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--ice); }
body.is-live .sw[data-state=""] .sw-dot { display: none; }
[data-state="loading"] > .sw-dot { animation: sim-blink 1.2s ease-in-out infinite; }
[data-state="ready"] > .sw-dot { border-color: var(--ok); background: var(--ok); }
body.is-live .sw[aria-current="page"][data-state="ready"] .sw-dot { border-color: var(--white); background: var(--white); }

.live-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.live-tools[hidden], .live-status[hidden], .live-tools .tool[hidden] { display: none; }
.live-status { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; font-size: var(--fs-small); font-weight: 700; color: var(--white); white-space: nowrap; }
.live-tools .tool { width: 36px; height: 36px; }
.live-tools .tool svg { width: 18px; height: 18px; }
body.is-live .ops-home { width: auto; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-small); font-weight: 700; color: var(--white); }
body.is-live .ops-home span { display: inline; }
body.is-live .ops-home:hover { border-color: var(--cyan-light); }
@media (max-width: 1279px) {
  body.is-live .ops-home { width: 36px; padding: 0; justify-content: center; }
  body.is-live .ops-home span { display: none; }
}
@media (max-width: 1099px) {
  /* Hẹp: chỉ thẻ đang xem hiện tên */
  body.is-live .sw:not([aria-current]) { padding: 0 10px; }
  body.is-live .sw:not([aria-current]) .sw-name { display: none; }
  .live-status span { display: none; }
}
@media (max-width: 999px) {
  body.is-live .ops-bar { height: auto; gap: 0 4px; }
  body.is-live .ops-switch { justify-content: flex-start; gap: 2px; }
  body.is-live .sw { height: 40px; min-width: 40px; padding: 0 8px; }
  body.is-live .sw-dot { position: absolute; right: 4px; top: 5px; width: 6px; height: 6px; }
  body.is-live .sw[aria-current="page"] .sw-dot { position: static; }
  .live-tools { align-self: center; gap: 4px; }
  .live-tools .tool, body.is-live .ops-home { width: 40px; height: 40px; }
  .live-status, #live-full { display: none; }
}
@media (max-width: 559px) {
  body.is-live .ops-home { display: inline-flex; }
  body.is-live .sw[aria-current="page"] .sw-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) { [data-state="loading"] > .sw-dot { animation: none; } }
@media (max-width: 999px) {
  .live-btn { height: 40px; align-self: center; padding: 0 10px; }
  body.is-live .ops-tabs { display: none; }
}
@media (max-width: 559px) {
  /* Thanh trên chật: logo đã dẫn về trang gốc nên nhường chỗ nút trang gốc cho nút Demo gốc (chỉ icon) */
  .ops-home { display: none; }
  .live-btn { width: 40px; padding: 0; justify-content: center; }
  .live-btn #live-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (prefers-reduced-motion: reduce) { .live-btn { transition: none; } }

/* Chờ demo gốc: ảnh bìa sản phẩm và dòng trạng thái, khung hiện dần khi tải xong */
.live { background-size: cover; background-position: center; }
.live::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, #060926 0%, #060926b3 30%, #06092666 100%); }
.live-wait { position: absolute; left: 20px; bottom: 24px; z-index: 1; display: flex; align-items: center; gap: 10px; font-size: var(--fs-small); font-weight: 700; }
.live-wait .sim-dot { width: 8px; height: 8px; }
/* Bốn khung demo chồng lên nhau. Khung đang xem ở trên, khung đang khởi động nằm dưới (vô hình nhưng vẫn vẽ),
   khung đã khởi động xong bị đẩy ra ngoài khung nhìn để trình duyệt tạm ngưng. */
.live iframe { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; border: 0; background: var(--deep); opacity: 0; pointer-events: none; }
.live iframe.is-on { z-index: 2; pointer-events: auto; transition: opacity 400ms var(--ease); }
.live iframe.is-on.is-ready { opacity: 1; }
.live iframe.is-parked { translate: -300vw 0; }
.live.is-ready .live-wait { display: none; }
@media (prefers-reduced-motion: reduce) { .live iframe { transition: none; } }

@media (max-width: 999px) {
  .live-shell .ops-bar { flex-wrap: nowrap; padding: 0 8px 0 max(8px, env(safe-area-inset-left)); }
  .live-shell .ops-brand { height: 48px; min-width: 48px; }
  .live-shell .ops-brand img { width: 46px; height: 21px; }
  .live-shell .ops-switch { padding-left: 0; border-left: 0; }
}
