/* ============================================================
   旅学成长层 · quest-ui.css  v1.0.0
   站点：zgdgt.cn   主题：深色霓虹（复用站点 CSS 变量，含 fallback）
   依赖：无。零 CDN。可独立缓存。
   命名空间：全部以 .zgq- 前缀，z-index 99990 起，不侵入页面样式。
   ============================================================ */

.zgq-root {
  --zgq-primary: var(--primary, #2dd4bf);
  --zgq-accent:  var(--accent,  #f0b35e);
  --zgq-glow:    var(--glow,    #22d3ee);
  --zgq-bg:      var(--bg,      #070d18);
  --zgq-card:    var(--card,    #0d1830);
  --zgq-soft:    var(--bg-soft, #0b1424);
  --zgq-ink:     var(--ink,     #dbe7f4);
  --zgq-muted:   var(--muted,   #8ba0b8);
  --zgq-line:    var(--line,    #182741);

  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99990;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--zgq-ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 1. 悬浮 HUD ---------- */
.zgq-hud {
  position: relative;
  width: 268px;
  padding: 14px 16px 15px;
  border-radius: 18px;
  border: 1px dashed rgba(45, 212, 191, .42);      /* 虚线边框 */
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(34, 211, 238, .14), transparent 58%),
    linear-gradient(160deg, rgba(13, 24, 48, .97), rgba(7, 13, 24, .97));
  box-shadow:
    0 10px 34px rgba(0, 0, 0, .5),
    0 0 0 1px rgba(45, 212, 191, .07) inset,
    0 0 26px rgba(34, 211, 238, .13);               /* 霓虹光晕 */
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: width .28s cubic-bezier(.4, 0, .2, 1), padding .28s, border-radius .28s;
  overflow: hidden;
}

/* 顶部流光扫描线 */
.zgq-hud::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--zgq-primary), transparent);
  opacity: .8;
  animation: zgq-scan 3.6s linear infinite;
}
@keyframes zgq-scan {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* 折叠态：只留圆形等级徽标 */
.zgq-hud.zgq-fold {
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.zgq-hud.zgq-fold .zgq-hud-body,
.zgq-hud.zgq-fold .zgq-hud-foot { display: none; }
.zgq-hud.zgq-fold::before { display: none; }

.zgq-hud-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 11px;
}

/* 等级环（SVG） */
.zgq-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}
.zgq-ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.zgq-ring .zgq-ring-bg { stroke: rgba(139, 160, 184, .2); }
.zgq-ring .zgq-ring-fg {
  stroke: url(#zgq-ring-grad);
  stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.34, 1.2, .48, 1);
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, .75));   /* 霓虹 */
}
.zgq-ring-lv {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--zgq-primary);
  text-shadow: 0 0 10px rgba(45, 212, 191, .6);
}
.zgq-ring-lv small { font-size: 8px; opacity: .75; margin-right: 1px; }

.zgq-meta { min-width: 0; flex: 1; }
.zgq-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--zgq-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zgq-title span.zgq-emoji { font-size: 15px; }

.zgq-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--zgq-muted);
  font-variant-numeric: tabular-nums;
}

/* XP 进度条 */
.zgq-bar {
  position: relative;
  height: 7px;
  border-radius: 99px;
  background: rgba(139, 160, 184, .16);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, .1) inset;
}
.zgq-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--zgq-primary), var(--zgq-glow) 55%, var(--zgq-accent));
  box-shadow: 0 0 12px rgba(45, 212, 191, .7);
  transition: width .9s cubic-bezier(.34, 1.2, .48, 1);
  position: relative;
}
/* 流动高光 */
.zgq-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38), transparent);
  background-size: 42% 100%;
  background-repeat: no-repeat;
  animation: zgq-shine 2.4s ease-in-out infinite;
}
@keyframes zgq-shine {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}

.zgq-hud-foot {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}
.zgq-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px dashed rgba(139, 160, 184, .3);
  background: rgba(11, 20, 36, .7);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--zgq-ink);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .12s;
  user-select: none;
  -webkit-user-select: none;
}
.zgq-chip:hover { border-color: rgba(45, 212, 191, .55); background: rgba(13, 24, 48, .95); }
.zgq-chip:active { transform: scale(.95); }
.zgq-chip.zgq-hot { border-color: rgba(240, 179, 94, .6); color: var(--zgq-accent); }

/* ---------- 2. XP 飘字 ---------- */
.zgq-float {
  position: fixed;
  z-index: 99995;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: .4px;
  color: var(--zgq-accent, #f0b35e);
  text-shadow: 0 0 14px rgba(240, 179, 94, .85), 0 2px 6px rgba(0, 0, 0, .6);
  pointer-events: none;
  white-space: nowrap;
  animation: zgq-float-up 1.35s cubic-bezier(.2, .9, .3, 1) forwards;
}
.zgq-float.zgq-float-xp { color: #f0b35e; }
.zgq-float.zgq-float-badge { color: #2dd4bf; font-size: 15px; }
@keyframes zgq-float-up {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  22%  { opacity: 1; transform: translate(-50%, -22px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -84px) scale(.94); }
}

/* ---------- 3. Toast ---------- */
.zgq-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99996;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}
.zgq-toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed rgba(45, 212, 191, .45);
  background: linear-gradient(155deg, rgba(13, 24, 48, .98), rgba(7, 13, 24, .98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .55), 0 0 22px rgba(34, 211, 238, .14);
  animation: zgq-toast-in .42s cubic-bezier(.2, 1.1, .3, 1);
  /* ⚠️ 必须是 none：toast 只是通知，身上没有任何事件绑定，
     吃掉指针事件只会挡住下层真正要点的东西。
     实测（375px 窄屏）toast 曾以 auto 盖在采风光点上，导致学生完全点不开。 */
  pointer-events: none;
}
.zgq-toast.zgq-out { animation: zgq-toast-out .32s ease forwards; }
@keyframes zgq-toast-in {
  from { opacity: 0; transform: translateX(26px) scale(.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes zgq-toast-out {
  to { opacity: 0; transform: translateX(26px) scale(.96); }
}
.zgq-toast-ico {
  flex: 0 0 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 17px;
  background: radial-gradient(circle at 50% 40%, rgba(45, 212, 191, .28), rgba(45, 212, 191, .06));
  border: 1px solid rgba(45, 212, 191, .35);
}
.zgq-toast.zgq-gold .zgq-toast-ico {
  background: radial-gradient(circle at 50% 40%, rgba(240, 179, 94, .3), rgba(240, 179, 94, .06));
  border-color: rgba(240, 179, 94, .4);
}
.zgq-toast-body { min-width: 0; }
.zgq-toast-t { font-size: 13.5px; font-weight: 800; margin-bottom: 2px; }
.zgq-toast-d { font-size: 12px; color: var(--zgq-muted); line-height: 1.45; }

/* ---------- 4. 升级演出 ---------- */
.zgq-celebrate {
  position: fixed;
  inset: 0;
  z-index: 99997;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 48%, rgba(34, 211, 238, .16), rgba(7, 13, 24, .82) 62%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: zgq-fade-in .3s ease;
  cursor: pointer;
  /* ⚠️ 这一层永远不吃指针事件。
     升级演出是一块覆盖全屏的浮层，若拦截点击，页面下方的入口就会失效——
     AR 页实测：#btnVirtual 被本层（z-index:99997）盖住，点击超时，
     学生根本走不进玩法。
     现在只有卡片本身可点（.zgq-ce-card 单独恢复 auto），
     其余区域的点击直接穿透到页面，学生可以照常操作。
     退场由 quest-core.js 的自动消退 + 开始操作即让位来负责。 */
  pointer-events: none;
}
@keyframes zgq-fade-in { from { opacity: 0; } to { opacity: 1; } }
.zgq-celebrate.zgq-out { animation: zgq-fade-out .4s ease forwards; }
@keyframes zgq-fade-out { to { opacity: 0; } }

.zgq-ce-card {
  position: relative;
  width: min(360px, calc(100vw - 48px));
  padding: 30px 26px 26px;
  text-align: center;
  border-radius: 24px;
  border: 1px dashed rgba(240, 179, 94, .55);
  background:
    radial-gradient(130% 110% at 50% 0%, rgba(240, 179, 94, .16), transparent 62%),
    linear-gradient(165deg, rgba(13, 24, 48, .99), rgba(7, 13, 24, .99));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 44px rgba(240, 179, 94, .2);
  animation: zgq-pop .55s cubic-bezier(.2, 1.3, .4, 1);
  pointer-events: auto;   /* 外层已设 none，卡片本身单独恢复可点 */
}
@keyframes zgq-pop {
  0%   { opacity: 0; transform: scale(.82) translateY(18px); }
  100% { opacity: 1; transform: none; }
}
/* 旋转光环 */
.zgq-ce-halo {
  position: absolute;
  top: -46px;
  left: 50%;
  width: 132px;
  height: 132px;
  margin-left: -66px;
  border-radius: 50%;
  border: 1px dashed rgba(45, 212, 191, .5);
  animation: zgq-spin 9s linear infinite;
  pointer-events: none;
}
.zgq-ce-halo::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(240, 179, 94, .32);
}
@keyframes zgq-spin { to { transform: rotate(360deg); } }

.zgq-ce-lv {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(150deg, var(--zgq-primary), var(--zgq-glow));
  box-shadow: 0 0 34px rgba(45, 212, 191, .6), 0 0 0 6px rgba(45, 212, 191, .1);
}
.zgq-ce-kicker {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--zgq-accent);
  text-transform: uppercase;
}
.zgq-ce-name {
  margin: 7px 0 6px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .5px;
  background: linear-gradient(96deg, var(--zgq-primary), var(--zgq-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.zgq-ce-desc { font-size: 13px; color: var(--zgq-muted); line-height: 1.6; }
.zgq-ce-btn {
  margin-top: 18px;
  width: 100%;
  min-height: 44px;
  border: 1px dashed rgba(45, 212, 191, .5);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(45, 212, 191, .18), rgba(34, 211, 238, .1));
  color: var(--zgq-ink);
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s;
}
.zgq-ce-btn:hover { box-shadow: 0 0 20px rgba(45, 212, 191, .35); }
.zgq-ce-btn:active { transform: scale(.97); }

/* 粒子 */
.zgq-dot {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  z-index: 99996;
  pointer-events: none;
  animation: zgq-dot-fly 1.35s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes zgq-dot-fly {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--zgq-dx), var(--zgq-dy)) scale(.3); }
}

/* ---------- 4.5 沉浸环节任务卡（由 immersive-bridge.js 注入） ---------- */
.zgq-imm {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 99989;
  width: 268px;
  border-radius: 16px;
  border: 1px dashed rgba(240, 179, 94, .42);
  background:
    radial-gradient(115% 130% at 10% 0%, rgba(240, 179, 94, .12), transparent 58%),
    linear-gradient(160deg, rgba(13, 24, 48, .96), rgba(7, 13, 24, .96));
  box-shadow: 0 10px 32px rgba(0, 0, 0, .48), 0 0 22px rgba(240, 179, 94, .11);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: #dbe7f4;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  animation: zgq-toast-in .5s cubic-bezier(.2, 1.1, .3, 1);
}
.zgq-imm-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-bottom: 1px dashed rgba(240, 179, 94, .22);
}
.zgq-imm-ic { font-size: 15px; }
.zgq-imm-t {
  flex: 1;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #f0b35e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zgq-imm-x {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px dashed rgba(139, 160, 184, .32);
  background: rgba(11, 20, 36, .6);
  color: #8ba0b8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.zgq-imm-x:hover { color: #2dd4bf; border-color: rgba(45, 212, 191, .5); }

.zgq-imm-list { padding: 10px 13px; display: grid; gap: 8px; }
.zgq-imm-fold .zgq-imm-list,
.zgq-imm-fold .zgq-imm-f { display: none; }

.zgq-imm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(139, 160, 184, .24);
  background: rgba(11, 20, 36, .55);
  transition: all .3s;
}
.zgq-imm-item .zi { font-size: 13px; filter: grayscale(1); opacity: .55; }
.zgq-imm-item .zn { flex: 1; font-size: 12.5px; font-weight: 700; color: #8ba0b8; }
.zgq-imm-item .zp {
  font-size: 11px;
  font-weight: 800;
  color: #f0b35e;
  font-variant-numeric: tabular-nums;
}
.zgq-imm-item.done {
  border-style: solid;
  border-color: rgba(45, 212, 191, .45);
  background: linear-gradient(140deg, rgba(45, 212, 191, .13), rgba(34, 211, 238, .04));
}
.zgq-imm-item.done .zi { filter: none; opacity: 1; }
.zgq-imm-item.done .zn { color: #dbe7f4; }

.zgq-imm-f {
  padding: 9px 13px 11px;
  font-size: 11.5px;
  color: #8ba0b8;
  border-top: 1px dashed rgba(139, 160, 184, .18);
}
.zgq-imm-f b { color: #f0b35e; }
.zgq-imm-all { border-color: rgba(45, 212, 191, .5); }

@media (max-width: 720px) {
  /* 移动端降到右下 HUD 上方，避免与 AR 页底部图鉴冲突 */
  .zgq-imm {
    left: 12px;
    right: 12px;
    bottom: auto;
    top: 62px;
    width: auto;
  }
  .zgq-imm-item .zn { font-size: 12px; }
}

/* ---------- 5. 无障碍与降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .zgq-root *, .zgq-toast, .zgq-celebrate, .zgq-dot, .zgq-float {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .zgq-bar-fill::after { display: none; }
}

/* ---------- 6. 响应式 ---------- */
@media (max-width: 720px) {
  .zgq-root { right: 12px; bottom: 12px; }
  .zgq-hud { width: min(268px, calc(100vw - 24px)); }
  .zgq-hud.zgq-fold { width: 56px; height: 56px; }
  /* ⚠️ 窄屏下不能用「底部通栏」：环幕视窗与策划盘都在页面下方，
     toast 会长时间盖住学生要点的光点与选项（实测 375px 下如此）。
     移到顶部通栏——上方只有标题与导语，不承载任何操作。 */
  .zgq-toasts { top: 12px; bottom: auto; right: 12px; left: 12px; max-width: none; }
  .zgq-toast { padding: 11px 12px; }
}
@media (max-width: 400px) {
  .zgq-title { font-size: 13.5px; }
  .zgq-chip { font-size: 11px; }
}
