/* Sola AI · Văn phòng AI 3D (giai đoạn B). Bản 12 thẻ giữ nguyên, chỉ ẩn khi 3D chạy được. */
#van-phong { box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,.06); }
.office.is-3d .roles { display: none; }

.o3d {
  position: relative; height: clamp(460px, 44vw, 600px); border-radius: 14px; overflow: hidden;
  /* sa bàn sáng nổi trên nền navy, ánh xanh tỏa dưới sàn */
  background:
    radial-gradient(58% 50% at 50% 60%, rgba(47,140,255,.28), transparent 72%),
    linear-gradient(180deg, #0b1830 0%, #071022 100%);
  border: 1px solid var(--border);
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
}
.o3d[hidden] { display: none; }
.o3d.can-pick, .o3d.is-in { cursor: pointer; } /* đã vào văn phòng: bấm sàn để đi */
.o3d.drag { cursor: grabbing; }
.o3d canvas { position: relative; display: block; width: 100%; height: 100%; transition: opacity .5s ease; }

/* ảnh chờ tĩnh (chụp từ chính văn phòng 3D) trong lúc tải, mờ dần khi văn phòng hiện */
.o3d-poster, .o3d-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.o3d-poster { opacity: 0; transition: opacity .5s ease; }
.o3d.is-loading .o3d-poster { opacity: 1; }
.o3d.is-loading canvas { opacity: 0; }
.o3d.is-loading { cursor: progress; }
.o3d.is-loading .o3d-zoom { display: none; }
.o3d.is-loading::after {
  content: "Đang mở văn phòng AI"; position: absolute; left: 50%; bottom: 18px; translate: -50% 0;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  background: rgba(7,16,34,.86); border: 1px solid rgba(120,180,255,.34); color: var(--muted);
  font: 500 14px/1.3 var(--font-body);
}

/* nhãn trên đầu nhân sự: bấm được (mở thẻ thông tin) */
.o3d-tags { position: absolute; inset: 0; pointer-events: none; }
.o3d-tags > * { position: absolute; left: 0; top: 0; will-change: transform; }
.o3d-tag {
  pointer-events: auto; cursor: pointer; margin: 0; translate: -50% -100%; text-align: left;
  padding: 6px 11px 7px; border-radius: 10px; white-space: nowrap;
  background: rgba(7,16,34,.86); border: 1px solid rgba(120,180,255,.34);
  box-shadow: 0 8px 20px rgba(0,8,30,.35);
  color: var(--text); font: 600 13px/1.3 var(--font-body);
  transition: border-color .2s ease, background .2s ease;
}
.o3d-tag b { display: block; font-weight: 600; }
.o3d-tag small { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #a9dcff; }
.o3d-tag small i, .o3d-card .st i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.o3d-tag small i.wait, .o3d-card .st i.wait { background: #ffc24b; box-shadow: 0 0 8px #ffc24b; }
.o3d-tag.is-brain { border-color: rgba(30,214,196,.55); }
.o3d-tag.on { border-color: var(--teal); background: rgba(8,30,48,.94); }
.o3d-tag:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.o3d-tag .dot { display: none; }
/* nhãn bị đè: thu thành chấm sáng (vẫn bấm được) */
.o3d-tag.is-dot { padding: 6px; border: 0; background: none; box-shadow: none; transition: none; } /* đổi sang chấm ngay, không lóe nền tối */
.o3d-tag.on { z-index: 1; }
.o3d-tag.is-dot b, .o3d-tag.is-dot small { display: none; }
.o3d-tag.is-dot .dot {
  display: block; width: 12px; height: 12px; border-radius: 50%; background: var(--teal);
  border: 2px solid #fff; box-shadow: 0 0 0 4px rgba(30,214,196,.25), 0 0 12px var(--teal);
}
.o3d-tag.is-dot.wait .dot { background: #ffc24b; box-shadow: 0 0 0 4px rgba(255,194,75,.25), 0 0 12px #ffc24b; }
/* nhãn "Bạn" trên đầu bot CEO */
.o3d-tag.is-ceo {
  pointer-events: none; padding: 4px 12px 5px; border: 0; background: var(--grad); color: var(--ink);
  font: 700 13px/1.3 var(--font-body); box-shadow: 0 8px 20px rgba(0,8,30,.35);
}
.o3d-room {
  translate: -50% -50%; padding: 3px 9px; border-radius: 6px; white-space: nowrap;
  background: rgba(255,255,255,.88); color: #1d2b45;
  font: 500 11px/1.4 var(--font-mono); letter-spacing: .6px; text-transform: uppercase;
}

/* thẻ thông tin nhân sự */
.o3d-card {
  position: absolute; left: 14px; bottom: 14px; width: 330px; z-index: 2;
  padding: 18px 18px 16px; border-radius: 16px; cursor: auto; user-select: text; -webkit-user-select: text;
  background: rgba(7,16,34,.94); border: 1px solid rgba(120,180,255,.3);
  box-shadow: 0 24px 60px -20px rgba(0,8,30,.8), var(--glow-soft);
  animation: o3dIn .28s cubic-bezier(.23,1,.32,1);
}
.o3d-card[hidden], .o3d-card [hidden] { display: none !important; }
@keyframes o3dIn { from { opacity: 0; transform: translateY(10px); } }
.o3d-card .top { display: flex; align-items: center; gap: 6px; margin: -6px -6px 2px 0; }
.o3d-card .k { flex: 1; font: 500 11px/1.4 var(--font-mono); letter-spacing: 1px; text-transform: uppercase; color: var(--soft); }
.o3d-card .nav { display: flex; gap: 6px; }
.o3d-card h4 { margin: 0 0 6px; font-family: var(--font-head); font-size: 24px; line-height: 1.15; }
.o3d-card .job { margin: 0 0 10px; font-size: 16px; line-height: 1.5; color: var(--muted); }
.o3d-card .st { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 14px; color: #a9dcff; }
.o3d-card .go { display: flex; width: 100%; min-height: 46px; padding: 0 18px; font-size: 15px; gap: 8px; white-space: nowrap; }
.o3d-card .nav button, .o3d-card .o3d-x {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--border-strong); color: var(--text);
  font: 500 20px/1 var(--font-body); transition: transform .15s ease, border-color .2s ease;
}
.o3d-card .nav button:active, .o3d-card .o3d-x:active { transform: scale(.94); }

.o3d-rooms {
  position: absolute; left: 0; right: 0; top: 0; padding: 14px; display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.o3d-rooms::-webkit-scrollbar { display: none; }
.o3d-rooms button {
  flex: none; min-height: 40px; padding: 0 15px; border-radius: 999px; cursor: pointer;
  background: rgba(7,16,34,.82); border: 1px solid var(--border-strong); color: var(--muted);
  font: 500 14px/1 var(--font-body); transition: transform .15s ease, border-color .2s ease, color .2s ease;
}
.o3d-rooms button[aria-pressed="true"] { color: var(--ink); background: var(--grad); border-color: transparent; font-weight: 600; }
.o3d-rooms button:active { transform: scale(.96); }

.o3d-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.o3d-zoom button {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: rgba(7,16,34,.82); border: 1px solid var(--border-strong); color: var(--text);
  font: 500 22px/1 var(--font-body); transition: transform .15s ease, border-color .2s ease;
}
.o3d-zoom button:active { transform: scale(.94); }
.o3d-rooms button:focus-visible, .o3d-zoom button:focus-visible, .o3d-card button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* Vào văn phòng; khi đã vào: Theo CEO / Toàn cảnh, Ra ngoài, dòng "Bạn đang ở" */
.o3d-bar [hidden], .o3d-exit[hidden], .o3d-where[hidden], .o3d-tag[hidden] { display: none !important; }
.o3d-bar { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; display: flex; }
.o3d-enter { min-height: 46px; padding: 0 22px; font-size: 15px; }
.o3d-modes { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(7,16,34,.88); border: 1px solid var(--border-strong); }
.o3d-modes button, .o3d-exit {
  min-height: 38px; padding: 0 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: 500 14px/1 var(--font-body); transition: transform .15s ease, border-color .2s ease, color .2s ease;
}
.o3d-modes button { border: 0; background: none; color: var(--muted); }
.o3d-modes button[aria-pressed="true"] { background: var(--grad); color: var(--ink); font-weight: 600; }
.o3d-exit { position: absolute; top: 14px; right: 14px; min-height: 40px; background: rgba(7,16,34,.88); border: 1px solid var(--border-strong); color: var(--text); }
.o3d-modes button:active, .o3d-exit:active { transform: scale(.96); }
.o3d-modes button:focus-visible, .o3d-exit:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.o3d.is-in .o3d-rooms { right: 118px; } /* chừa chỗ nút Ra ngoài */
.o3d-where {
  position: absolute; left: 14px; top: 64px; padding: 5px 11px; border-radius: 8px; pointer-events: none;
  background: rgba(7,16,34,.86); border: 1px solid rgba(120,180,255,.34); color: var(--muted); font: 500 13px/1.4 var(--font-body);
}
.o3d-where b { color: var(--text); font-weight: 600; }
/* máy tính bảng, máy tính nhỏ: thẻ thông tin bên trái thì hàng nút dạt sang phải */
.o3d.has-card .o3d-bar { left: auto; right: 72px; translate: none; }
html.o3d-lock, html.o3d-lock body { overflow: hidden; }

@media (hover: hover) and (pointer: fine) {
  .o3d-rooms button:hover { color: var(--text); border-color: var(--blue); }
  .o3d-zoom button:hover, .o3d-card .nav button:hover, .o3d-card .o3d-x:hover { border-color: var(--blue); }
  .o3d-tag:hover { border-color: var(--teal); }
  .o3d-modes button:not([aria-pressed="true"]):hover { color: var(--text); }
  .o3d-exit:hover { border-color: var(--blue); }
}

@media (max-width: 760px) {
  .o3d { height: 500px; }
  .o3d-tag { font-size: 12px; padding: 5px 9px 6px; }
  .o3d-tag small { font-size: 11px; }
  .o3d-room { font-size: 10px; padding: 2px 7px; }
  /* điện thoại: thẻ thông tin thành tấm dưới đáy khung */
  .o3d-card { left: 10px; right: 10px; bottom: 10px; width: auto; padding: 14px 14px 12px; }
  .o3d-card h4 { font-size: 22px; margin-bottom: 4px; }
  .o3d-card .k { letter-spacing: .3px; }
  .o3d-card .job { margin-bottom: 6px; }
  .o3d-card .st { margin-bottom: 10px; }
  /* mở thẻ: khung giữ nguyên chiều cao (trang không nhảy), ẩn hàng nút phòng để nhường chỗ cho nhân sự phía trên thẻ */
  .o3d-rooms { transition: opacity .2s ease, visibility .2s; }
  .o3d.has-card .o3d-rooms { opacity: 0; visibility: hidden; }
  .o3d.has-card .o3d-zoom, .o3d.has-card .o3d-bar { display: none; }
  .o3d-bar { left: 14px; translate: none; } /* nút + − nằm góc phải */
  /* vào văn phòng trên điện thoại: mở toàn màn hình */
  .o3d.is-full {
    position: fixed; inset: 0; z-index: 1000; height: 100vh; height: 100dvh;
    border: 0; border-radius: 0; touch-action: none; overscroll-behavior: contain;
  }
}
@media (prefers-reduced-motion: reduce) { .o3d-card { animation: none; } .o3d canvas, .o3d-poster, .o3d-rooms { transition: none; } }
