/* ===== Hoạt cảnh minh hoạ cho câu hỏi (dùng cho type 'hint'/'guess' có trường "anim") =====
   Tất cả bằng CSS + emoji, chạy offline, nét trên máy chiếu. */

.anim-stage {
  grid-column: 1 / -1;
  margin: 2px 0 14px;
  border-radius: 16px;
  border: 2px solid var(--gold);
  background: linear-gradient(135deg, #fff9ef 0%, #fff3ee 100%);
  padding: 16px 18px;
  overflow: hidden;
}

/* Clip hoạt cảnh nhúng (nplus1-story.html) trong câu hỏi */
.anim-frame {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: clamp(380px, 52vh, 540px);
  border: 0;
  border-radius: 12px;
  background: transparent;
}

/* Hàng đầu: nhãn cấp gợi ý + chú thích */
.n1-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.n1-lvl {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: 13px;
  background: linear-gradient(180deg, #ec3b33, var(--red)); color: #fff;
}
.n1-cap {
  flex: 1 1 240px; font-size: clamp(15px, 1.9vw, 20px); font-weight: 600;
  line-height: 1.5; color: var(--ink);
}
.n1-cap strong { color: var(--red-dark); }
.n1-cap .g { color: #1f7a34; }

/* Sân khấu App ↔ Database */
.n1-track {
  position: relative;
  height: clamp(130px, 20vh, 190px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px;
}
.n1-path {
  position: absolute; left: 15%; right: 20%; top: 50%; height: 0;
  border-top: 4px dashed var(--gold-deep); opacity: .45; z-index: 1;
}
.n1-node {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: clamp(96px, 15vw, 150px); text-align: center;
}
.n1-node .ico { font-size: clamp(46px, 7.5vw, 78px); line-height: 1; filter: drop-shadow(0 3px 5px rgba(90,20,15,.18)); }
.n1-node .lbl { font-weight: 800; color: var(--red-dark); font-size: clamp(13px, 1.6vw, 16px); }
.n1-node .sub { font-size: 12px; color: var(--muted); }

/* Khách ngồi bàn (cảnh 1) */
.n1-guests { display: flex; gap: 2px; font-size: clamp(22px, 3.5vw, 34px); }

/* Con thoi chạy qua lại (query / bồi bàn) */
.n1-token {
  position: absolute; top: 50%; z-index: 4;
  transform: translate(-50%, -50%);
  font-size: clamp(30px, 5vw, 52px);
  animation: n1-shuttle 2.4s ease-in-out infinite;
  white-space: nowrap;
}
.n1-token .tag {
  position: absolute; left: 50%; top: -18px; transform: translateX(-50%);
  font-size: 12px; font-weight: 800; color: var(--red-dark);
  background: #fff; border: 1.5px solid var(--gold); border-radius: 999px;
  padding: 1px 8px; white-space: nowrap;
}
@keyframes n1-shuttle {
  0%   { left: 16%; transform: translate(-50%, -50%) scaleX(1); }
  44%  { left: 78%; transform: translate(-50%, -50%) scaleX(1); }
  50%  { left: 78%; transform: translate(-50%, -50%) scaleX(-1); }
  94%  { left: 16%; transform: translate(-50%, -50%) scaleX(-1); }
  100% { left: 16%; transform: translate(-50%, -50%) scaleX(1); }
}

/* Đếm số chuyến (cảnh 1) — các chấm sáng dần theo vòng lặp */
.n1-trips { display: flex; gap: 7px; justify-content: center; margin-top: 12px; align-items: center; }
.n1-trips .cap { font-size: 13px; font-weight: 700; color: var(--gold-deep); }
.n1-trips i { width: 15px; height: 15px; border-radius: 50%; background: var(--gold); opacity: .22; animation: n1-blink 2.4s infinite; }

/* Cảnh 3: thanh truy vấn dồn lên + con số lớn */
.n1-count { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.n1-bar { position: relative; flex: 1 1 260px; height: 30px; border-radius: 999px; background: #f1e2db; overflow: hidden; min-width: 200px; }
.n1-bar > span { position: absolute; inset: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--red)); animation: n1-fill 2.2s ease-out forwards; }
.n1-bar .t0 { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 800; color: #7a5b00; z-index: 2; }
.n1-bar .t1 { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 800; color: #fff; z-index: 2; }
.n1-big { font-size: clamp(40px, 8vw, 74px); font-weight: 900; color: var(--red); line-height: 1; animation: n1-pop .5s .5s both; }
.n1-big small { display: block; font-size: 14px; color: var(--muted); font-weight: 700; }

/* Cảnh 4: so sánh Sai / Đúng */
.n1-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.n1-col { border-radius: 14px; padding: 12px 12px 14px; position: relative; overflow: hidden; }
.n1-col.bad { background: #fdeceb; border: 2px solid var(--bad); }
.n1-col.good { background: #e9f8ee; border: 2px solid var(--ok); }
.n1-col h4 { font-size: clamp(14px, 1.8vw, 17px); margin-bottom: 8px; }
.n1-col.bad h4 { color: var(--bad); }
.n1-col.good h4 { color: #1f7a34; }
.n1-mini { position: relative; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 4px; }
.n1-mini .m { font-size: clamp(28px, 4vw, 40px); z-index: 2; }
.n1-arrows { position: absolute; left: 40px; right: 40px; top: 50%; transform: translateY(-50%); height: 22px; }
.n1-arrows i { position: absolute; top: 0; font-size: 18px; opacity: 0; }
.n1-col.bad .n1-arrows i { animation: n1-run 1.3s linear infinite; }
.n1-col.good .n1-arrows i.big { font-size: 26px; animation: n1-run 1.8s ease-in-out infinite; }
.n1-col .cap { margin-top: 8px; font-size: 13px; font-weight: 700; }
.n1-col.bad .cap { color: var(--bad); }
.n1-col.good .cap { color: #1f7a34; }

@keyframes n1-blink { 0%, 100% { opacity: .22; } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes n1-fill { to { width: 100%; } }
@keyframes n1-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes n1-run { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: 100%; opacity: 0; } }

/* Cover trước khi mở gợi ý đầu */
.n1-cover { text-align: center; padding: 20px 10px; }
.n1-cover .em { font-size: clamp(48px, 9vw, 84px); animation: n1-pop .5s both; }
.n1-cover .tt { font-weight: 800; color: var(--red-dark); font-size: clamp(17px, 2.4vw, 24px); margin-top: 6px; }
.n1-cover .ds { color: var(--muted); font-size: 14px; margin-top: 4px; }

@media (max-width: 600px) {
  .n1-split { grid-template-columns: 1fr; }
  .n1-track { height: 130px; }
}
