/* Boss 节点特殊样式 */
.g-node--boss {
  border: 3px solid #f59e0b !important;
  box-shadow: 0 0 16px rgba(245,158,11,0.3), 0 4px 12px rgba(0,0,0,0.3) !important;
  z-index: 5;
  background: rgba(245,158,11,0.08);
}
.g-node--boss .g-node__icon { font-size: 32px; background: rgba(245,158,11,0.15); }
.g-node--boss .g-node__title { color: #fbbf24; font-weight: 600; font-size: 12px; }
.g-node--boss.g-node--completed {
  border-color: #10b981 !important;
  box-shadow: 0 0 16px rgba(16,185,129,0.3) !important;
  background: rgba(16,185,129,0.1);
}
.g-node--boss.g-node--completed .g-node__title { color: #34d399; }
.g-node--boss.g-node--locked {
  border-color: rgba(71,85,105,0.4) !important;
  box-shadow: none !important;
  opacity: 0.4;
}
/* Boss 弹窗确认按钮 */
.g-boss-confirm {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; margin-top: 16px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white; font-size: 15px; font-weight: 600;
  border: none; border-radius: 12px; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.g-boss-confirm:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(217,119,6,0.4); }
.g-boss-confirm:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.g-boss-confirmed {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; margin-top: 16px;
  background: #D1FAE5; color: #065F46;
  font-size: 15px; font-weight: 600;
  border: 2px solid #6EE7B7; border-radius: 12px;
}
/* 连击特效 */
.g-combo-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
  font-size: 48px; font-weight: 900;
  pointer-events: none; z-index: 9999;
  animation: comboBurst 2s ease-out forwards;
  text-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
}
@keyframes comboBurst {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%,-50%) scale(1.4); opacity: 1; }
  40% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  60% { transform: translate(-50%,-50%) scale(1.1); opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(1.5); opacity: 0; }
}
.g-combo-glow {
  animation: comboGlow 0.8s ease-out;
  will-change: box-shadow;
}
@keyframes comboGlow {
  0% { box-shadow: 0 0 0px rgba(245,158,11,0); }
  50% { box-shadow: 0 0 40px rgba(245,158,11,0.9), 0 0 80px rgba(245,158,11,0.6); }
  100% { box-shadow: 0 0 0px rgba(245,158,11,0); }
}
/* 副本系统样式 */
.g-tab-badge {
  display: inline-block; background: #EF4444; color: white;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
  margin-left: 4px; vertical-align: middle; animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.g-dungeon-card {
  background: white; border-radius: 12px; padding: 16px; margin-bottom: 12px;
  border: 2px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: border-color 0.2s, box-shadow 0.2s; cursor: pointer;
}
.g-dungeon-card:hover { border-color: #8B5CF6; box-shadow: 0 2px 8px rgba(139,92,246,0.15); }
.g-dungeon-card__header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.g-dungeon-card__icon { font-size: 28px; }
.g-dungeon-card__info { flex: 1; }
.g-dungeon-card__name { font-size: 15px; font-weight: 600; color: #1f2937; }
.g-dungeon-card__level { font-size: 12px; color: #6b7280; }
.g-dungeon-card__bar-bg {
  height: 6px; background: #f3f4f6; border-radius: 3px; margin: 8px 0; overflow: hidden;
}
.g-dungeon-card__bar-fill {
  height: 100%; border-radius: 3px; transition: width 0.3s;
}
.g-dungeon-card__meta {
  display: flex; gap: 12px; font-size: 12px; color: #6b7280;
}
.g-dungeon-card__difficulty {
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
}
.g-dungeon-card__difficulty--easy { background: #d1fae5; color: #065f46; }
.g-dungeon-card__difficulty--medium { background: #fef3c7; color: #92400e; }
.g-dungeon-card__difficulty--hard { background: #fee2e2; color: #991b1b; }
.g-dungeon-empty {
  text-align: center; padding: 40px 20px; color: #9ca3af;
}
.g-dungeon-empty__icon { font-size: 48px; margin-bottom: 12px; }
.g-dungeon-empty__text { font-size: 14px; }
.g-dg-q {
  background: #f9fafb; border-radius: 10px; padding: 14px; margin-bottom: 12px;
  border: 2px solid #e5e7eb; transition: border-color 0.2s;
}
.g-dg-q.g-dg-q--correct { border-color: #10b981; background: #ecfdf5; }
.g-dg-q.g-dg-q--wrong { border-color: #ef4444; background: #fef2f2; }
.g-dg-q__title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.g-dg-q__body { font-size: 14px; color: #1f2937; margin-bottom: 10px; }
.g-dg-q__option {
  display: block; width: 100%; text-align: left; padding: 8px 12px; margin: 4px 0;
  background: white; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.g-dg-q__option:hover { border-color: #8B5CF6; background: #f5f3ff; }
.g-dg-q .g-dg-q__option.g-dg-q__option--selected { border-color: #8B5CF6; background: #ede9fe; font-weight: 600; }
.g-dg-q__input {
  width: 100%; padding: 8px 12px; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 13px; font-family: 'Consolas', monospace; outline: none; transition: border-color 0.15s;
}
.g-dg-q__input:focus { border-color: #8B5CF6; box-shadow: 0 0 0 3px rgba(139,92,246,0.1); }
.g-dg-q__explain {
  font-size: 12px; color: #6b7280; margin-top: 6px; padding: 6px 10px;
  background: #fffbeb; border-radius: 6px; display: none;
}
.g-dg-submit {
  width: 100%; padding: 12px; background: linear-gradient(135deg, #8B5CF6, #7C3AED);
  color: white; font-size: 15px; font-weight: 600; border: none; border-radius: 10px;
  cursor: pointer; margin-top: 12px; transition: transform 0.15s, box-shadow 0.15s;
}
.g-dg-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139,92,246,0.3); }
.g-dg-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.g-dg-retry {
  width: 100%; padding: 10px; background: #fef3c7; color: #92400e;
  font-size: 14px; font-weight: 600; border: 1.5px solid #fcd34d; border-radius: 10px;
  cursor: pointer; margin-top: 8px; transition: background 0.15s;
}
.g-dg-retry:hover { background: #fde68a; }
.g-dg-recovered {
  text-align: center; padding: 20px; background: #ecfdf5; border-radius: 12px;
  border: 2px solid #10b981; margin-top: 12px;
}
.g-dg-recovered__icon { font-size: 48px; margin-bottom: 8px; }
.g-dg-recovered__text { font-size: 14px; color: #065f46; font-weight: 600; }
/* 响应式移动端适配 */
@media (max-width: 768px) {
  .gamify-root { padding: 8px; margin-top: -19px; }
  .g-tabs { overflow-x: auto; white-space: nowrap; position: sticky; top: 45px; }
  .g-tab { padding: 6px 12px; font-size: 12px; }
  #tab-map.g-panel--active { display: flex !important; flex-direction: column; height: calc(100vh - 110px); }
  .g-viewport { flex: 1; min-height: 300px; padding: 25px 8px; overflow-x: auto; }
  .g-map { min-width: 360px; }
  .g-node { width: 110px !important; min-height: 85px; padding: 8px; }
  .g-node__icon { font-size: 20px; }
  .g-node__title { font-size: 9px; }
  .g-node__stars { font-size: 10px; }
  .g-chapter-tabs { flex-wrap: wrap; gap: 4px; }
  .g-chtab-btn { padding: 5px 10px; font-size: 10px; }
  .g-footer { font-size: 11px; }
  .g-popover__card { max-width: 95vw; max-height: 85vh; }
  .g-popover__body { flex-direction: column !important; }
  .g-popover__know, .g-popover__tasks { width: 100% !important; }
  .g-lb-table td, .g-lb-table th { padding: 6px 8px; font-size: 11px; }
  .g-me-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .g-me-stat__val { font-size: 18px; }
  .g-result__score { font-size: 16px; }
  .g-result__xp { font-size: 20px; }
  .g-action-row { flex-direction: column; }
  .pid-links a { padding: 6px 12px; font-size: 11px; }
}

/* ===== Base Reset ===== */
.gamify-root *, .gamify-root *::before, .gamify-root *::after { box-sizing: border-box; }
.gamify-root { margin-top: -19px; }

/* ===== Hero — 用户状态卡片，紧贴导航栏下方 ===== */
.g-hero {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
  border-radius: 0 0 16px 16px;
  padding: 16px 24px 20px;
  color: #e0e7ff;
  position: relative;
  overflow: hidden;
}
.g-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 70% 30%, rgba(99,102,241,0.3) 0%, transparent 60%),
              radial-gradient(ellipse at 30% 70%, rgba(139,92,246,0.2) 0%, transparent 50%);
  pointer-events: none;
}
.g-hero__inner { position: relative; z-index: 1; }
.g-hero__top {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.g-hero__avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: 0 0 16px rgba(99,102,241,0.4);
}
.g-hero__info { flex: 1; min-width: 0; }
.g-hero__name {
  font-size: 18px; font-weight: 700; color: #fff;
  line-height: 1.3;
}
.g-hero__tier {
  font-size: 12px; color: #a5b4fc; margin-top: 2px;
}
.g-hero__badges {
  display: flex; gap: 6px; flex-wrap: wrap;
  flex-shrink: 0;
}
.g-hero__badge {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.12);
  color: #c7d2fe; white-space: nowrap;
}
.g-hero__xp-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.g-hero__xp-label {
  font-size: 12px; color: #818cf8; font-weight: 600;
  white-space: nowrap;
}
.g-hero__xp-track {
  flex: 1; height: 8px; background: rgba(255,255,255,0.12);
  border-radius: 4px; overflow: hidden;
}
.g-hero__xp-fill {
  height: 100%; border-radius: 4px; transition: width 0.6s ease;
}
.g-hero__xp-text {
  font-size: 12px; color: #a5b4fc; white-space: nowrap;
}
.g-hero__stats {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.g-hero__stat {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: #c7d2fe;
  padding: 5px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
}
.g-hero__stat-icon { font-size: 15px; }
.g-hero__stat-val { font-weight: 600; }

/* ===== Tabs — 固定在导航栏下方 ===== */
.g-tabs {
  background: rgba(248,250,252,0.98);
  display: flex; gap: 6px; padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  z-index: 100;
  justify-content: center; flex-wrap: wrap;
  position: sticky; top: 45px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  min-height: 44px;
}
.g-tab {
  padding: 7px 14px; border-radius: 16px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: #6b7280;
  background: #fff; border: 1px solid #e5e7eb; white-space: nowrap;
  transition: all 0.2s;
}
.g-tab:hover { background: #eef2ff; color: #4f46e5; }
.g-tab--active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
/* 标签居中容器：占满剩余空间并把内部标签整体居中，「全屏」在其右侧独立放置 */
.g-tabs-center { flex: 1 1 auto; display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ===== Panels — centered, adaptive width ===== */
.g-panel { display: none; padding: 24px 32px; }
.g-panel--active { display: block; }
.g-panel-inner {
  max-width: 1100px; margin: 0 auto;
  width: 100%;
  padding: 0 16px;
}
.g-panel-title {
  margin: 0 0 16px; font-size: 18px; font-weight: 700; color: #1f2937;
}
.g-empty {
  text-align: center; padding: 40px; color: #9ca3af; font-size: 14px;
}

/* ===== Organic Map Container ===== */
.g-map {
  position: relative; overflow: auto;
  background: #0f172a;
  border-radius: 12px;
  margin: 0 auto;
  max-width: 100%;
}
.g-map__bg {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(168,85,247,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(236,72,153,0.04) 0%, transparent 50%);
  background-size: 100% 100%;
}

/* SVG connector layer */
.g-connectors {
  position: absolute; top: 0; left: 0;
  pointer-events: none; z-index: 2;
  overflow: visible;
}

/* Zone label (positioned by JS) — clear of nodes */
.g-zone-label {
  position: absolute; left: 12px; z-index: 4;
  padding: 6px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 700; color: #e2e8f0;
  white-space: nowrap; pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  background: rgba(79,70,229,0.85) !important;
}

/* Fog overlay — use solid bg instead of expensive backdrop-filter */
.g-fog-overlay {
  position: absolute; left: 0; right: 0;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 3;
}
.g-fog-overlay--hidden {
  background: rgba(15,23,42,0.9);
}
.g-fog-overlay--preview {
  background: rgba(30,41,59,0.7);
}
.g-fog-overlay__icon {
  font-size: 40px; opacity: 0.5;
}
.g-fog-overlay__text {
  font-size: 12px; color: #94a3b8; margin-top: 4px;
}

/* ===== Zone Navigation Bar ===== */
.g-zone-nav {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; flex-wrap: wrap;
  background: rgba(30,41,59,0.92);
  border-bottom: 1px solid rgba(71,85,105,0.3);
  border-radius: 10px; margin-bottom: 8px;
}
.g-nav-btn {
  padding: 5px 12px; border-radius: 14px;
  background: rgba(51,65,85,0.6); color: #94a3b8;
  border: 1px solid rgba(71,85,105,0.4); font-size: 12px;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s; font-weight: 600;
}
.g-nav-btn:hover { background: rgba(99,102,241,0.15); color: #c7d2fe; border-color: rgba(99,102,241,0.4); }
.g-nav-btn.g-nav-btn--primary {
  background: #6366f1; color: #fff;
  border-color: #6366f1;
}
.g-nav-btn.g-nav-btn--primary:hover { background: #4f46e5; }

/* ===== PCB Node — variable size by type/status ===== */
.g-node {
  width: 152px; padding: 14px 10px 12px;
  background: rgba(30,41,59,0.85);
  border: 2px solid rgba(71,85,105,0.5);
  border-radius: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  will-change: transform;
  position: absolute;
  z-index: 5;
  box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}
/* Chapter nodes — largest */
.g-node--chapter {
  width: 200px !important;
  padding: 18px 14px 14px;
  border-radius: 20px;
  border-width: 3px;
  border-color: #818cf8 !important;
  background: rgba(99,102,241,0.12);
}
.g-node--chapter .g-node__icon {
  width: 54px; height: 54px; font-size: 28px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-radius: 14px;
}
.g-node--chapter .g-node__title {
  font-size: 14px; font-weight: 800; color: #c7d2fe;
}

/* Active nodes — slightly larger */
.g-node--active {
  border-color: #f59e0b; background: rgba(245,158,11,0.1);
  animation: nodePulse 2.5s ease-in-out infinite;
  z-index: 6;
  will-change: box-shadow;
}
.g-node--active { width: 170px !important; }
.g-node--active .g-node__icon { width: 50px; height: 50px; font-size: 26px; }

/* Completed — standard size */
.g-node--completed { border-color: #10b981; background: rgba(16,185,129,0.1); }
.g-node--completed .g-node__icon { background: rgba(16,185,129,0.2); }

/* Unlocked — slightly smaller */
.g-node--unlocked { border-color: #6366f1; background: rgba(99,102,241,0.08); }
.g-node--unlocked { width: 142px !important; }

/* Locked/fog — smallest */
.g-node--locked {
  opacity: 0.3; cursor: not-allowed; filter: grayscale(60%);
  border-color: rgba(71,85,105,0.3);
  width: 125px !important;
}

/* Node hover & glow */
.g-node::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 18px; opacity: 0; transition: opacity 0.3s;
  border: 2px solid transparent;
}
.g-node:hover:not(.g-node--locked):not(.g-node--fog):not(.g-node--preview-fog) {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 20px rgba(99,102,241,0.15);
  border-color: #818cf8;
  z-index: 10;
}
.g-node:hover:not(.g-node--locked):not(.g-node--fog):not(.g-node--preview-fog)::after {
  opacity: 1;
  border-color: rgba(129,140,248,0.25);
}

/* Active node ring + badge */
.g-node--active::before {
  content: ''; position: absolute; inset: -6px;
  border-radius: 20px; border: 2px solid rgba(245,158,11,0.3);
  animation: ringPulse 2.5s ease-in-out infinite;
}
.g-node--active .g-active-badge {
  position: absolute; top: -8px; right: -6px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #f59e0b; color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(245,158,11,0.4);
  animation: badgeBob 1.5s ease-in-out infinite;
}
/* Fog overlay on individual nodes — use opacity only, no expensive blur filter */
.g-node--fog {
  opacity: 0.04 !important;
  pointer-events: none !important;
}
.g-node--preview-fog {
  opacity: 0.6 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  border: 1.5px dashed #a5b4fc !important;
  background: rgba(79,70,229,0.08) !important;
  filter: none !important;
}

@keyframes nodePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.25); }
  50% { box-shadow: 0 0 0 12px rgba(245,158,11,0); }
}
@keyframes ringPulse {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}
@keyframes badgeBob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Node internals */
.g-node__icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 6px; background: rgba(99,102,241,0.1);
  transition: transform 0.2s;
}
.g-node:hover:not(.g-node--locked) .g-node__icon { transform: scale(1.1); }
.g-node--completed .g-node__stars { margin-top: 3px; font-size: 12px; }
.g-node__star { color: #475569; }
.g-node__star--on { color: #f59e0b; }
.g-node__title { font-size: 13px; font-weight: 700; color: #e2e8f0; line-height: 1.3; word-break: keep-all; }
.g-node__bar {
  width: 100%; height: 5px; background: rgba(71,85,105,0.4); border-radius: 3px;
  margin-top: 6px; overflow: hidden;
}
.g-node__bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* ===== Node Popover ===== */
.g-popover {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.65); z-index: 1000;
  justify-content: center; align-items: center; padding: 20px;
  backdrop-filter: blur(2px);
  will-change: opacity;
}
.g-popover[style*="flex"] { display: flex !important; }
.g-popover__card {
  width: 90%; max-width: 820px; max-height: 86vh;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn 0.25s ease;
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.g-popover__head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}
.g-popover__icon { font-size: 24px; }
.g-popover__title { font-size: 17px; font-weight: 700; flex: 1; }
.g-popover__close {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: #fee2e2; color: #dc2626; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.g-popover__close:hover { background: #fecaca; }
.g-popover__body {
  display: flex; flex: 1; overflow: hidden;
}

/* Knowledge (left) - always visible */
.g-popover__know {
  flex: 0 0 45%; padding: 20px; overflow-y: auto;
  border-right: 1px solid #e5e7eb; background: #fafbff;
}
.g-popover__know h3 { margin-top: 0; font-size: 16px; color: #1e3a8a; border-bottom: 2px solid #e0e7ff; padding-bottom: 6px; }
.g-popover__know p { font-size: 14px; line-height: 1.8; color: #374151; }
.g-popover__know ul, .g-popover__know ol { padding-left: 20px; }
.g-popover__know li { font-size: 14px; line-height: 1.7; color: #374151; margin-bottom: 4px; }
.g-popover__know pre {
  background: #f8fafc; color: #1e293b; border: 1px solid #e2e8f0;
  padding: 12px 16px; border-radius: 10px; font-size: 14px;
  line-height: 1.6; overflow-x: auto; margin: 10px 0;
}
.g-popover__know code { font-size: 14px; }
.g-popover__know table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.g-popover__know th, .g-popover__know td { border: 1px solid #d1d5db; padding: 6px 10px; text-align: left; }
.g-popover__know th { background: #eef2ff; }
.g-popover__know .pid-links { margin-top: 16px; padding-top: 12px; border-top: 2px dashed #c7d2fe; }
.g-popover__know .pid-links a {
  display: inline-block; padding: 6px 14px; margin: 4px 4px 4px 0;
  background: #4f46e5; color: #fff; border-radius: 8px;
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background 0.2s;
}
.g-popover__know .pid-links a:hover { background: #4338ca; }

/* Tasks (right) */
.g-popover__tasks {
  flex: 1; padding: 20px; overflow-y: auto;
}

/* Full-width mode (when hasPids - knowledge only) */
.g-popover__body--full .g-popover__know { flex: 1; border-right: none; }
.g-popover__body--full .g-popover__tasks { display: none; }

/* Intro mode for chapter/section nodes */
.g-popover__body--intro {
  flex-direction: column;
}
.g-popover__body--intro .g-popover__know {
  flex: none;
  width: 100%;
  border-right: none;
  padding: 32px 40px;
  text-align: center;
}
.g-popover__body--intro .g-popover__tasks { display: none; }

/* Intro card content */
.g-intro { max-width: 520px; margin: 0 auto; }
.g-intro__icon {
  font-size: 48px; width: 80px; height: 80px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-radius: 20px; margin-bottom: 16px;
}
.g-intro__text {
  font-size: 15px; line-height: 1.8; color: #4b5563;
  margin: 0 0 20px; padding: 16px 20px;
  background: #f8fafc; border-radius: 12px;
  border-left: 4px solid #8b5cf6;
}
.g-intro__next {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
}

/* Task question style */
.g-q { margin-bottom: 20px; padding: 14px; border-radius: 12px; background: #fff; border: 1px solid #e5e7eb; transition: border-color 0.2s; }
.g-q--answered { border-color: #c7d2fe; background: #fafbff; }
.g-q--correct { border-color: #10b981; background: #f0fdf4; }
.g-q--wrong { border-color: #f87171; background: #fef2f2; }
.g-q__num { font-size: 12px; color: #6b7280; font-weight: 600; margin-bottom: 4px; }
.g-q__text { font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 8px; }
.g-q__choices { display: flex; flex-direction: column; gap: 6px; }
.g-q__choice {
  padding: 9px 14px; border-radius: 10px; border: 1.5px solid #e5e7eb;
  background: #fff; cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.g-q__choice:hover { background: #f0f9ff; border-color: #93c5fd; }
.g-q__choice--sel { background: #eef2ff; border-color: #4f46e5; font-weight: 600; }
.g-q__choice--ok { background: #f0fdf4; border-color: #10b981; color: #059669; }
.g-q__choice--no { background: #fef2f2; border-color: #ef4444; color: #dc2626; }
.g-q__fill { display: flex; gap: 8px; }
.g-q__input {
  flex: 1; padding: 9px 14px; border-radius: 10px;
  border: 1.5px solid #d1d5db; font-size: 15px;
}
.g-q__input:focus { border-color: #4f46e5; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.g-q__btn {
  padding: 8px 16px; border-radius: 10px; border: none;
  background: #4f46e5; color: #fff; font-weight: 600; cursor: pointer;
  transition: background 0.2s;
}
.g-q__btn:hover { background: #4338ca; }
.g-q__code { padding: 12px; background: #f0f9ff; border-radius: 10px; }
.g-q__code a { color: #4f46e5; font-weight: 600; text-decoration: none; }
.g-q__code a:hover { text-decoration: underline; }
.g-q__explain {
  margin-top: 8px; padding: 10px 14px; border-radius: 10px;
  background: #fffbeb; color: #92400e; font-size: 14px;
  border-left: 3px solid #f59e0b; line-height: 1.6; animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Result Area — state-based styling ===== */
.g-result {
  margin-top: 16px; padding: 18px 20px; border-radius: 14px;
  text-align: center; animation: resultPop 0.4s ease;
}
@keyframes resultPop { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.g-result--success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid #10b981;
}
.g-result--partial, .g-result--fail {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 2px solid #f59e0b;
}
.g-result__stars { font-size: 36px; letter-spacing: 2px; margin-bottom: 6px; }
.g-result__stars .star-on { color: #f59e0b; text-shadow: 0 1px 3px rgba(245,158,11,0.3); }
.g-result__stars .star-off { color: #d1d5db; }
.g-result__score { font-size: 16px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.g-result__xp { font-size: 14px; font-weight: 600; color: #059669; margin-bottom: 12px; }
.g-result__combo { font-size: 13px; color: #ea580c; font-weight: 700; margin-bottom: 8px; }
.g-result__break { font-size: 13px; color: #dc2626; }

/* Action buttons after submission */
.g-action-row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.g-btn-next {
  padding: 11px 28px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.25s; box-shadow: 0 4px 14px rgba(16,185,129,0.35);
  display: inline-flex; align-items: center; gap: 6px;
}
.g-btn-next:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,185,129,0.45); background: linear-gradient(135deg, #059669, #047857); }
.g-btn-retry {
  padding: 11px 24px; border-radius: 12px; border: 2px dashed #f59e0b;
  background: #fffbeb; color: #d97706; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.25s;
  display: inline-flex; align-items: center; gap: 6px;
}
.g-btn-retry:hover { background: #fef3c7; transform: translateY(-1px); border-style: solid; }
.g-btn-close-popover {
  padding: 10px 20px; border-radius: 10px; border: 1px solid #d1d5db;
  background: #f9fafb; color: #6b7280; font-size: 13px; cursor: pointer;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px;
}
.g-btn-close-popover:hover { background: #f3f4f6; color: #374151; }
.g-submit-all {
  margin-top: 16px; width: 100%; padding: 12px;
  border-radius: 12px; border: none; background: #4f46e5;
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 3px 10px rgba(79,70,229,0.25);
}
.g-submit-all:hover { background: #4338ca; box-shadow: 0 5px 16px rgba(79,70,229,0.35); transform: translateY(-1px); }
.g-submit-all:active { transform: translateY(0); }
.g-submit-all:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Popover card — adaptive sizing */
.g-popover__card { width: 90%; max-width: 820px; max-height: 86vh; }

/* ===== Leaderboard ===== */
.g-lb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.g-lb-table th, .g-lb-table td { padding: 11px 16px; border-bottom: 1px solid #f3f4f6; text-align: left; }
.g-lb-table th { background: #f8fafc; color: #6b7280; font-weight: 600; font-size: 13px; }
.g-lb-table tr:hover td { background: #f9fafb; }
.g-lb-table a { color: #4f46e5; text-decoration: none; }
.g-lb-table a:hover { text-decoration: underline; }
.g-lb-badge {
  display: inline-block; padding: 2px 8px; border-radius: 8px;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* ===== Tools ===== */
.g-tools-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.g-tool-card {
  flex: 1 1 200px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 12px; padding: 14px;
}
.g-tool-card__cat { font-size: 12px; color: #6b7280; margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.g-tool-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 0;
  border-bottom: 1px solid #f9fafb; font-size: 14px;
}
.g-tool-item:last-child { border-bottom: none; }
.g-tool-item__level { font-size: 10px; color: #9ca3af; margin-left: auto; }

/* ===== Me Stats ===== */
.g-me-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.g-me-stat {
  flex: 1; min-width: 90px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 12px; padding: 14px; text-align: center;
}
.g-me-stat__val { font-size: 22px; font-weight: 800; }
.g-me-stat__label { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.g-me-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.g-me-bar-fill,.g-me-bar__fill { height: 100%; border-radius: 4px; }
.g-me-bar-text { font-size: 12px; color: #6b7280; margin-top: 6px; }

/* ===== Assess ===== */
.g-assess-desc { color: #6b7280; margin-bottom: 16px; font-size: 15px; }
.g-assess-ready { padding: 14px 18px; background: #f0fdf4; border: 1px solid #10b981; border-radius: 10px; color: #059669; font-size: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.g-assess-wait { padding: 14px 18px; background: #fef9c3; border: 1px solid #ca8a04; border-radius: 10px; color: #713f12; font-size: 15px; }

/* Assess Card */
.g-assess-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 20px; }
.g-assess-card__title { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.g-assess-card__subtitle { font-size: 12px; color: #9ca3af; margin-bottom: 16px; }

/* Assess Badge - Current level */
.g-assess-badge { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 12px; background: linear-gradient(135deg, #eff6ff, #f0fdf4); border: 1px solid #93c5fd; margin-bottom: 14px; }
.g-assess-badge__icon { font-size: 36px; }
.g-assess-badge__label { font-size: 12px; color: #6b7280; text-transform: uppercase; font-weight: 600; }
.g-assess-badge__name { font-size: 17px; font-weight: 700; color: #111827; }
.g-assess-badge__score { font-size: 13px; color: #059669; font-weight: 600; margin-top: 2px; }
.g-assess-badge--csp { background: linear-gradient(135deg, #fef3c7, #fef9c3); border-color: #fbbf24; }
.g-assess-badge--none { background: #f9fafb; border-color: #e5e7eb; opacity: 0.8; }
.g-assess-csp-scores { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.g-assess-csp-scores span { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: #fef3c7; color: #92400e; font-weight: 600; }

/* Next level goal */
.g-assess-next { padding: 12px 16px; background: #faf5ff; border: 1px solid #d8b4fe; border-radius: 10px; font-size: 13px; color: #6b21a8; margin-bottom: 14px; line-height: 1.6; }
.g-assess-next strong { color: #7c3aed; }

/* Progress bar */
.g-assess-progress-bar { height: 8px; background: #e5e7eb; border-radius: 4px; margin: 8px 0; overflow: hidden; }
.g-assess-progress-fill { height: 100%; background: linear-gradient(90deg, #7c3aed, #a855f7); border-radius: 4px; transition: width 0.6s ease; }

/* Dimension stats */
.g-assess-dimensions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font-size: 12px; color: #6b7280; }
.g-assess-dimensions span { padding: 2px 8px; background: #f3f4f6; border-radius: 6px; }

/* Level Ladder */
.g-assess-ladder { margin-top: 12px; }
.g-assess-ladder__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; font-size: 13px; }
.g-assess-ladder__item--done { background: #f0fdf4; }
.g-assess-ladder__item--current { background: #eff6ff; border: 1px dashed #93c5fd; }
.g-assess-ladder__icon { font-size: 18px; min-width: 28px; text-align: center; }
.g-assess-ladder__name { min-width: 44px; font-weight: 600; color: #374151; }
.g-assess-ladder__bar { flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.g-assess-ladder__bar div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2563eb, #38bdf8); transition: width 0.5s ease; }
.g-assess-ladder__item--done .g-assess-ladder__bar div { background: linear-gradient(90deg, #059669, #34d399); }
.g-assess-ladder__pct { min-width: 36px; text-align: right; font-weight: 600; color: #6b7280; font-size: 12px; }

/* Summary footer */
.g-assess-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding: 14px; background: #f9fafb; border-radius: 10px; border: 1px solid #e5e7eb; }
.g-assess-summary__item { font-size: 12px; color: #6b7280; padding: 4px 10px; background: #fff; border-radius: 6px; border: 1px solid #e5e7eb; }
.g-assess-summary__item strong { color: #111827; }

/* ===== Footer ===== */
.g-footer { padding: 16px 20px; color: #64748b; font-size: 13px; text-align: center; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .g-popover__body { flex-direction: column; }
  .g-popover__know, .g-popover__tasks { flex: none; border-right: none; }
  .g-popover__body--full .g-popover__know { flex: none; }
  .g-popover__body--intro .g-popover__know { padding: 20px; }
  .g-node { width: 110px !important; padding: 8px 6px 7px; }
  .g-node--chapter { width: 145px !important; padding: 12px 10px 10px; }
  .g-node--active { width: 125px !important; }
  .g-node__icon { width: 36px !important; height: 36px !important; font-size: 18px !important; }
  .g-node--chapter .g-node__icon { width: 42px !important; height: 42px !important; font-size: 22px !important; }
  .g-node__title { font-size: 11px; }
  .g-panel { padding: 16px; }
  .g-me-stat { min-width: 70px; }
  .g-me-stat__val { font-size: 18px; }
  .g-zone-nav { padding: 6px 12px; }
  .g-nav-btn { font-size: 11px; padding: 4px 8px; }
  .g-lb-table th, .g-lb-table td { padding: 8px 10px; font-size: 12px; }
}

/* 节点高亮动画 — optimized with will-change */
.g-node--highlight {
  animation: nodeGlow 1.5s ease-in-out infinite !important;
  will-change: box-shadow;
}
@keyframes nodeGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(245,158,11,0.4), 0 0 40px rgba(245,158,11,0.15); }
  50% { box-shadow: 0 0 30px rgba(245,158,11,0.7), 0 0 60px rgba(245,158,11,0.35); }
}



/* ===== 用户信息横条（地图 HUD 合并） ===== */
.g-userbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; margin-bottom: 6px;
  background: linear-gradient(135deg, rgba(30,41,59,0.95), rgba(15,23,42,0.95));
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 10px;
  flex-wrap: wrap;
}
.g-userbar__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.g-userbar__avatar-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; flex-shrink: 0;
}
.g-userbar__info {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.g-userbar__rank {
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.g-userbar__level {
  font-size: 11px; color: #94a3b8; white-space: nowrap;
}
.g-userbar__xp {
  flex: 1; min-width: 120px; max-width: 260px;
  display: flex; flex-direction: column; gap: 3px;
}
.g-userbar__xp-bar {
  height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden;
}
.g-userbar__xp-fill {
  height: 100%; border-radius: 3px; transition: width 0.4s;
}
.g-userbar__xp-text {
  font-size: 10px; color: #64748b;
}
.g-userbar__stats {
  display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: #94a3b8;
}
.g-userbar__stats span { white-space: nowrap; }
.g-userbar__sfx {
  background: none; border: none; color: #64748b; cursor: pointer; font-size: 14px; padding: 0; line-height: 1;
}
.g-userbar__sfx:hover { color: #facc15; }

/* ===== Game Viewport - 自适应窗口高度，到底部章节按钮刚好可见 ===== */
#tab-map.g-panel--active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
  padding: 12px 24px 0;
}
.g-viewport {
  flex: 1;
  min-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  border-radius: 12px;
  background: #0f172a;
  border: 2px solid rgba(71,85,105,0.3);
}


/* ===== Chapter Navigation (保留备用) ===== */
.g-chapter-nav {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}
.g-chapter-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff;
  color: #374151; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.g-chapter-btn:hover { background: #eef2ff; border-color: #6366f1; color: #6366f1; }
.g-chapter-btn--list { margin-left: auto; width: auto; padding: 0 10px; font-size: 16px; }
.g-chapter-info { flex: 1; text-align: center; }
.g-chapter-label { font-size: 15px; font-weight: 700; color: #1e293b; }
.g-chapter-progress { display: block; font-size: 11px; color: #6b7280; margin-top: 2px; }

/* ===== Chapter List Popup ===== */
.g-chapter-list {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.g-chapter-list__inner {
  background: #fff; border-radius: 16px; padding: 24px;
  max-width: 500px; width: 90%; max-height: 80vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.g-chapter-list__title { margin: 0 0 16px; font-size: 20px; font-weight: 700; color: #1e293b; }
.g-chapter-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 8px;
  transition: all 0.2s; border: 2px solid transparent;
}
.g-chapter-card:hover { background: #f8fafc; }
.g-chapter-card--current { border-color: #6366f1; background: #eef2ff; }
.g-chapter-card--done { border-color: #10b981; background: #f0fdf4; }
.g-chapter-card__icon { font-size: 28px; flex-shrink: 0; }
.g-chapter-card__info { flex: 1; min-width: 0; }
.g-chapter-card__name { font-size: 14px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.g-chapter-card__bar { height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.g-chapter-card__bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.g-chapter-card__meta { font-size: 11px; color: #6b7280; display: flex; gap: 8px; }

/* ===== Chapter Tabs - 底部章节小按钮 ===== */
.g-chapter-tabs {
  display: flex; gap: 4px; padding: 8px 16px; flex-wrap: wrap;
  justify-content: center;
}
.g-chtab-btn {
  padding: 4px 10px; border-radius: 12px; border: 1px solid rgba(71,85,105,0.4);
  background: rgba(30,41,59,0.7); font-size: 11px; color: #94a3b8; cursor: pointer;
  white-space: nowrap; transition: all 0.15s; font-weight: 600;
}
.g-chtab-btn:hover { background: rgba(99,102,241,0.15); border-color: #6366f1; color: #e0e7ff; transform: translateY(-1px); }
/* 已通关 — 绿色调，清晰醒目 */
.g-chtab-btn--done {
  background: rgba(16,185,129,0.12); color: #34d399; border-color: rgba(16,185,129,0.3);
}
.g-chtab-btn--done:hover { background: rgba(16,185,129,0.22); color: #6ee7b7; border-color: rgba(16,185,129,0.55); }
/* 进行中 — 紫色调，表示当前可访问 */
.g-chtab-btn--inprogress {
  background: rgba(99,102,241,0.12); color: #a5b4fc; border-color: rgba(99,102,241,0.35);
}
.g-chtab-btn--inprogress:hover { background: rgba(99,102,241,0.22); color: #c7d2fe; border-color: rgba(99,102,241,0.55); }
/* 锁定 — 灰色调，不可点击 */
.g-chtab-btn--locked {
  background: rgba(30,41,59,0.3); color: #475569; border-color: rgba(71,85,105,0.15); cursor: not-allowed; opacity: 0.5;
}
.g-chtab-btn--locked:hover { background: rgba(30,41,59,0.3); color: #475569; border-color: rgba(71,85,105,0.15); transform: none; }
/* 当前选中叠加 */
.g-chtab-btn--active { box-shadow: 0 0 8px rgba(99,102,241,0.3); font-weight: 700; transform: translateY(-1px); }
.g-chtab-btn--done.g-chtab-btn--active { background: #10b981; color: #fff; border-color: #10b981; box-shadow: 0 0 10px rgba(16,185,129,0.4); }
.g-chtab-btn--inprogress.g-chtab-btn--active { background: #6366f1; color: #fff; border-color: #6366f1; }
.g-chtab-btn--locked.g-chtab-btn--active { background: #475569; color: #fff; border-color: #475569; }


/* ===== Updated Tools Grid ===== */
.g-tool-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: #fff; border: 1px solid #e5e7eb;
  margin-bottom: 6px; transition: all 0.2s;
}
.g-tool-item--owned {
  background: #f0fdf4; border-color: #bbf7d0;
}
.g-tool-item__icon { font-size: 22px; flex-shrink: 0; }
.g-tool-item__info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.g-tool-item__name {
  font-size: 14px; font-weight: 600; color: #1e293b;
}
.g-tool-item__level {
  font-size: 11px; color: #059669;
}
.g-tool-item__how {
  font-size: 11px; color: #94a3b8; font-style: italic;
}
.g-tool-item__badge {
  font-size: 16px; flex-shrink: 0;
}
.g-tool-item__badge--locked {
  opacity: 0.3;
}


/* ===== 移动端全面适配 (max-width: 768px) ===== */
@media (max-width: 768px) {
  .gamify-root { padding: 4px; }
  
  /* 标签页 - 移动端横向滚动 + 可换行 */
  .g-tabs { overflow-x: auto; overflow-y: hidden; white-space: nowrap; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; position: sticky; top: 64px; max-height: 52px; justify-content: flex-start; }
  .g-tabs-center { flex: 0 0 auto; display: contents; }
  .g-tab { padding: 6px 10px; font-size: 11px; flex-shrink: 0; }
  
  /* 章节切换 */
  .g-chapter-tabs { flex-wrap: wrap; gap: 3px; }
  .g-chtab-btn { padding: 4px 8px; font-size: 9px; }
  
  /* 地图视口 */
  #tab-map.g-panel--active { display: flex !important; flex-direction: column; height: calc(100vh - 110px); padding: 8px 4px 0; }
  .g-viewport { flex: 1; min-height: 300px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .g-map { min-width: 320px; gap: 6px; }
  
  /* 节点 */
  .g-node { width: 100px !important; min-height: 70px; padding: 6px 4px; }
  .g-node--chapter { width: 135px !important; padding: 10px 8px; }
  .g-node--active { width: 115px !important; }
  .g-node--boss { width: 120px !important; padding: 10px 6px; }
  .g-node__icon { width: 32px !important; height: 32px !important; font-size: 16px !important; }
  .g-node__title { font-size: 8px; line-height: 1.1; }
  .g-node__stars { font-size: 9px; }
  .g-node__xp { font-size: 8px; }
  
  /* Popover */
  .g-popover__card { max-width: 95vw; max-height: 80vh; border-radius: 12px; }
  .g-popover__body { flex-direction: column !important; }
  .g-popover__know, .g-popover__tasks { width: 100% !important; padding: 12px; }
  .g-popover__know { border-right: none !important; border-bottom: 1px solid #e5e7eb; }
  .g-popover__header { padding: 10px 14px; }
  .g-popover__title { font-size: 14px; }
  .g-popover__close { font-size: 20px; }
  
  /* 选择题 */
  .g-choice-option { padding: 8px 10px; font-size: 12px; }
  .g-choice-radio { width: 16px; height: 16px; }
  
  /* Boss 弹窗 */
  .g-boss-modal { max-width: 95vw; padding: 16px; }
  .g-boss-modal__title { font-size: 16px; }
  .g-boss-modal__pid { font-size: 11px; padding: 6px 10px; }
  .g-boss-modal__confirm { font-size: 13px; padding: 10px 20px; }
  
  /* 排行榜 */
  .g-lb-table td, .g-lb-table th { padding: 5px 6px; font-size: 10px; }
  
  /* 我的冒险 */
  .g-me-stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .g-me-stat__val { font-size: 16px; }
  .g-me-stat__label { font-size: 9px; }
  
  /* 工具页 */
  .g-tools-grid { grid-template-columns: 1fr; gap: 6px; }
  .g-tool-item { padding: 8px 10px; }
  .g-tool-item__name { font-size: 12px; }
  
  /* 结果展示 */
  .g-result__score { font-size: 14px; }
  .g-result__xp { font-size: 16px; }
  .g-result__stars { font-size: 24px; }
  
  /* 操作按钮行 */
  .g-action-row { flex-direction: column; gap: 6px; }
  .g-action-row button, .g-action-row a { width: 100%; text-align: center; }
  
  /* PID 链接 */
  .pid-links { flex-wrap: wrap; gap: 4px; }
  .pid-links a { padding: 5px 10px; font-size: 10px; }
  
  /* 页脚 */
  .g-footer { font-size: 10px; padding: 8px; }
  
  /* 用户横条移动端 */
  .g-userbar { gap: 6px; padding: 6px 10px; }
  .g-userbar__avatar { width: 28px; height: 28px; font-size: 15px; }
  .g-userbar__xp { min-width: 80px; max-width: 140px; }
  .g-userbar__stats { font-size: 10px; gap: 6px; }
  .g-userbar__xp-text { font-size: 9px; }
  
  /* 教师管理面板 */
  .gamify-teacher-tabs { flex-wrap: wrap; gap: 4px; }
  .gamify-teacher-tab { padding: 6px 10px; font-size: 11px; }
  .gamify-teacher-toolbar { flex-wrap: wrap; gap: 6px; }
  .gamify-teacher-toolbar input { width: 100% !important; }
  .gamify-stats-summary > div { flex-wrap: wrap; }
  
  /* 触摸优化 */
  .g-node, .g-tab, .g-chtab-btn, button, .g-choice-option {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== 音效开关按钮 ===== */
.g-sfx-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.15);
  color: #e2e8f0; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, opacity 0.25s;
  padding: 0; line-height: 1; position: relative;
}
.g-sfx-btn::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid transparent; transition: border-color 0.25s;
}
.g-sfx-btn:hover {
  background: rgba(99,102,241,0.25);
  border-color: rgba(99,102,241,0.6);
  box-shadow: 0 0 12px rgba(99,102,241,0.25);
}
.g-sfx-btn:active { transform: scale(0.92); }
.g-sfx-btn--off {
  opacity: 0.4; border-color: rgba(148,163,184,0.2);
  background: rgba(148,163,184,0.08);
}
.g-sfx-btn--off:hover {
  opacity: 0.6; border-color: rgba(148,163,184,0.4);
  background: rgba(148,163,184,0.15);
  box-shadow: 0 0 8px rgba(148,163,184,0.15);
}
.sfx-toggle-wrap {
  padding: 0 !important; background: transparent !important;
  display: flex; align-items: center;
}

/* ===== 成就徽章墙 ===== */
.g-badges-desc { color: #6b7280; font-size: 14px; margin-bottom: 16px; }
.g-badges-summary { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.g-badges-stat { flex: 1; min-width: 80px; text-align: center; padding: 14px 8px; background: #f9fafb; border-radius: 12px; border: 1px solid #e5e7eb; }
.g-badges-stat__num { display: block; font-size: 24px; font-weight: 700; color: #4f46e5; }
.g-badges-stat__label { display: block; font-size: 11px; color: #6b7280; margin-top: 4px; }
.g-badges-grid {}
.g-badges-type { margin-bottom: 20px; }
.g-badges-type__title { font-size: 15px; font-weight: 700; color: #374151; margin-bottom: 12px; padding-left: 4px; border-left: 3px solid #4f46e5; }
.g-badges-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.g-badge-card { position: relative; padding: 16px; border-radius: 14px; border: 2px solid #e5e7eb; background: #fff; transition: transform 0.2s, box-shadow 0.2s; }
.g-badge-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.g-badge-card--claimed { border-color: #86efac; background: #f0fdf4; }
.g-badge-card--achieved { border-color: #fbbf24; background: #fffbeb; }
.g-badge-card--locked { opacity: 0.65; background: #f9fafb; }
.g-badge-card__icon { font-size: 36px; text-align: center; margin-bottom: 8px; }
.g-badge-card__status { position: absolute; top: 10px; right: 12px; font-size: 18px; }
.g-badge-card__name { font-size: 15px; font-weight: 700; color: #111827; text-align: center; margin-bottom: 6px; }
.g-badge-card__desc { font-size: 12px; color: #6b7280; text-align: center; margin-bottom: 8px; line-height: 1.4; }
.g-badge-card__req { font-size: 11px; color: #9ca3af; text-align: center; margin-bottom: 8px; }
.g-badge-card__progress { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.g-badge-card__fill { height: 100%; background: linear-gradient(90deg, #4f46e5, #818cf8); border-radius: 3px; transition: width 0.6s ease; }
.g-badge-card--claimed .g-badge-card__fill { background: linear-gradient(90deg, #059669, #34d399); }
.g-badge-card--achieved .g-badge-card__fill { background: linear-gradient(90deg, #d97706, #fbbf24); }
.g-badge-card__pct { font-size: 10px; color: #9ca3af; text-align: center; margin-bottom: 8px; }
.g-badge-card__claim { display: block; width: 100%; padding: 8px; border-radius: 8px; border: none; background: #f59e0b; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.g-badge-card__claim:hover { background: #d97706; }
.g-badge-card__claimed { text-align: center; font-size: 12px; color: #059669; font-weight: 600; }
.g-badge-card__title { text-align: center; font-size: 11px; color: #8b5cf6; margin-top: 6px; font-style: italic; }

/* Toast */
.g-toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 24px; border-radius: 12px; font-size: 14px; z-index: 9999; box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== 每日挑战 ===== */
.g-daily-desc { color: #6b7280; font-size: 14px; margin-bottom: 16px; }
.g-daily-header { margin-bottom: 16px; }
.g-daily-hero { text-align: center; padding: 24px; background: linear-gradient(135deg, #fef3c7, #fffbeb); border-radius: 14px; border: 1px solid #fbbf24; }
.g-daily-hero__icon { font-size: 40px; margin-bottom: 8px; }
.g-daily-hero__date { font-size: 16px; font-weight: 700; color: #92400e; }
.g-daily-hero__streak { font-size: 14px; color: #b45309; margin-top: 6px; }
.g-daily-hero__streak strong { color: #d97706; }
.g-daily-hero__done { font-size: 15px; color: #059669; margin-top: 10px; padding: 10px; background: #d1fae5; border-radius: 8px; }
.g-daily-start { margin-top: 14px; padding: 12px 32px; border-radius: 12px; border: none; background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform 0.15s; }
.g-daily-start:hover { transform: scale(1.04); }
.g-daily-question { padding: 14px 16px; background: #f9fafb; border-radius: 10px; border: 1px solid #e5e7eb; margin-bottom: 10px; }
.g-daily-q__num { font-size: 14px; font-weight: 700; color: #374151; margin-bottom: 8px; }
.g-daily-q__text { font-size: 14px; color: #1f2937; margin-bottom: 10px; line-height: 1.5; }
.g-daily-options { display: flex; flex-direction: column; gap: 6px; }
.g-daily-opt { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; border: 1px solid #d1d5db; cursor: pointer; transition: all 0.15s; }
.g-daily-opt:hover { background: #eef2ff; border-color: #6366f1; }
.g-daily-opt--selected { background: #eef2ff; border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,0.2); }
.g-daily-opt__radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d1d5db; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.g-daily-opt--selected .g-daily-opt__radio { border-color: #4f46e5; background: #4f46e5; }
.g-daily-opt__text { font-size: 14px; color: #374151; }
.g-daily-submit { display: block; width: 100%; margin-top: 16px; padding: 12px; border-radius: 10px; border: none; background: #2563eb; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.g-daily-submit:hover { background: #1d4ed8; }
.g-daily-result-card { background: #fff; border-radius: 14px; border: 1px solid #e5e7eb; padding: 20px; }
.g-daily-result__header { text-align: center; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px; }
.g-daily-result__score { font-size: 28px; font-weight: 700; color: #111827; }
.g-daily-result__xp { font-size: 18px; color: #059669; font-weight: 700; margin-top: 4px; }
.g-daily-result__bonus { font-size: 13px; color: #d97706; font-weight: 600; margin-top: 2px; }
.g-daily-result__item { display: flex; gap: 12px; padding: 12px; border-radius: 10px; margin-bottom: 8px; }
.g-daily-result__item--ok { background: #f0fdf4; }
.g-daily-result__item--ng { background: #fef2f2; }
.g-daily-result__icon { font-size: 20px; flex-shrink: 0; }
.g-daily-result__title { font-size: 14px; font-weight: 600; color: #111827; }
.g-daily-result__answer { font-size: 12px; color: #6b7280; margin-top: 4px; }
.g-daily-result__exp { font-size: 12px; color: #374151; margin-top: 6px; line-height: 1.4; }
.g-daily-refresh { margin-top: 12px; padding: 8px 20px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #374151; font-size: 13px; cursor: pointer; }
.g-daily-refresh:hover { background: #f3f4f6; }

/* ---- 移动端适配 ---- */
@media (max-width: 768px) {
  .g-badges-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .g-badge-card { padding: 12px; }
  .g-badge-card__icon { font-size: 28px; }
  .g-badge-card__name { font-size: 13px; }
  .g-daily-opt { padding: 8px 10px; }
  .g-daily-opt__text { font-size: 12px; }
  .g-rec-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .g-rec-item__go { width: 100%; text-align: center; }
  .g-rec-weak-item { flex-wrap: wrap; gap: 6px; }
  .g-rec-weak-item__go { width: 100%; text-align: center; }
}

/* ===== 🧭 学习路径推荐卡片 ===== */
.g-recommend-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  overflow: hidden;
}
.g-recommend-card__header {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: #f9fafb; border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.g-recommend-card__title {
  font-size: 15px; font-weight: 700; color: #374151; margin-right: auto;
}
.g-recommend-card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.g-recommend-card__btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid #d1d5db;
  background: #fff; color: #374151; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.g-recommend-card__btn:hover { border-color: #6366f1; color: #4f46e5; background: #eef2ff; }
.g-recommend-card__btn--ai {
  background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; border-color: transparent;
}
.g-recommend-card__btn--ai:hover { background: linear-gradient(135deg, #6d28d9, #9333ea); color: #fff; }
.g-recommend-card__body { padding: 14px 18px; }
.g-recommend-empty { text-align: center; padding: 20px; color: #9ca3af; font-size: 13px; }

/* 推荐项 */
.g-rec-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: #f9fafb; border-radius: 10px; border: 1px solid #e5e7eb;
}
.g-rec-item__icon { font-size: 28px; flex-shrink: 0; }
.g-rec-item__info { flex: 1; min-width: 0; }
.g-rec-item__title { font-size: 15px; font-weight: 700; color: #111827; }
.g-rec-item__meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.g-rec-item__tip { font-size: 12px; color: #8b5cf6; font-weight: 600; margin-top: 4px; }
.g-rec-item__go {
  padding: 8px 16px; border-radius: 8px; border: none;
  background: #4f46e5; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0; transition: background 0.15s;
}
.g-rec-item__go:hover { background: #4338ca; }

/* 进度条 */
.g-rec-progress { height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 8px; overflow: hidden; }
.g-rec-progress__fill { height: 100%; background: #4f46e5; border-radius: 3px; transition: width 0.4s; }
.g-rec-progress__label { font-size: 10px; color: #9ca3af; margin-top: 3px; }

/* 题目链接 */
.g-rec-pids { margin-top: 8px; padding: 8px 12px; background: #f0fdf4; border-radius: 8px; font-size: 12px; }
.g-rec-pids__label { color: #374151; font-weight: 600; }
.g-rec-pid-link { color: #2563eb; text-decoration: none; font-weight: 600; margin-left: 4px; }
.g-rec-pid-link:hover { text-decoration: underline; }

/* 总结 */
.g-rec-summary { text-align: center; padding: 8px 0; font-size: 12px; color: #6b7280; }

/* 薄弱知识点标签 */
.g-rec-weak-summary { text-align: center; font-size: 13px; color: #374151; margin-bottom: 8px; }
.g-rec-weak-tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; margin-left: 4px; }
.g-rec-weak-tag--high { background: #fef2f2; color: #dc2626; }
.g-rec-weak-tag--med { background: #fffbeb; color: #d97706; }
.g-rec-weak-tag--low { background: #f0fdf4; color: #059669; }

/* 薄弱项列表 */
.g-rec-weak-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 6px;
  font-size: 13px;
}
.g-rec-weak--high { background: #fef2f2; border-left: 3px solid #dc2626; }
.g-rec-weak--med { background: #fffbeb; border-left: 3px solid #f59e0b; }
.g-rec-weak--low { background: #f0fdf4; border-left: 3px solid #10b981; }
.g-rec-weak-item__icon { font-size: 18px; flex-shrink: 0; }
.g-rec-weak-item__title { font-weight: 600; color: #111827; min-width: 120px; }
.g-rec-weak-item__acc { color: #ef4444; font-weight: 600; }
.g-rec-weak-item__tries { color: #6b7280; font-size: 11px; }
.g-rec-weak-item__go {
  margin-left: auto; padding: 4px 12px; border-radius: 6px; border: 1px solid #d1d5db;
  background: #fff; color: #374151; font-size: 11px; cursor: pointer; flex-shrink: 0;
}
.g-rec-weak-item__go:hover { border-color: #6366f1; color: #4f46e5; }

/* 复习列表 */
.g-rec-review-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #f9fafb; border-radius: 8px; border: 1px solid #e5e7eb;
  margin-bottom: 6px; font-size: 13px; flex-wrap: wrap;
}
.g-rec-review-item__icon { font-size: 18px; flex-shrink: 0; }
.g-rec-review-item__title { font-weight: 600; color: #111827; min-width: 100px; }
.g-rec-review-item__reason { color: #6b7280; font-size: 12px; flex: 1; min-width: 150px; }
.g-rec-review-item__progress { color: #9ca3af; font-size: 11px; }
.g-rec-review-item__go {
  padding: 4px 12px; border-radius: 6px; border: none;
  background: #4f46e5; color: #fff; font-size: 11px; cursor: pointer; flex-shrink: 0;
}
.g-rec-review-item__go:hover { background: #4338ca; }

/* ============================================================
   Phase 8: 剧情对话覆盖层
   ============================================================ */
.g-dialogue-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  animation: dlgFadeIn 0.5s ease;
}
.g-dialogue-overlay--hiding {
  animation: dlgFadeOut 0.4s ease forwards;
  pointer-events: none;
}
@keyframes dlgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dlgFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.g-dialogue-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.g-dialogue-close {
  position: absolute;
  top: 16px; right: 16px;
  z-index: 10;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(15, 23, 42, 0.6);
  color: rgba(255,255,255,0.8);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.g-dialogue-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
}

.g-dialogue-stage {
  position: relative; z-index: 1;
  width: 100%; max-width: 720px;
  padding: 0 24px 40px;
  display: flex; align-items: flex-end; gap: 16px;
  animation: dlgStageUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dlgStageUp {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* NPC 头像 */
.g-dialogue-avatar {
  width: 72px; height: 72px; min-width: 72px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  border: 3px solid rgba(255,255,255,0.2);
  transition: transform 0.2s;
  margin-bottom: 8px;
}
.g-dialogue-avatar:hover { transform: scale(1.05); }

/* 对话气泡 */
.g-dialogue-bubble {
  flex: 1;
  background: linear-gradient(135deg, #2d2b55, #3b3663);
  border: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 20px 20px 6px 20px;
  padding: 20px 24px;
  position: relative;
  min-height: 80px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: dlgBubbleIn 0.5s ease;
}
@keyframes dlgBubbleIn {
  from { transform: scaleX(0.95); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

/* 旁白气泡风格 */
.g-dialogue-bubble--system {
  background: linear-gradient(135deg, #1e293b, #334155);
  border-color: rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  text-align: center;
}

.g-dialogue-speaker {
  font-size: 16px; font-weight: 700; color: #e0e7ff;
  margin-bottom: 2px;
}
.g-dialogue-title {
  font-size: 12px; color: #a5b4fc; margin-bottom: 12px;
  font-weight: 500;
}
.g-dialogue-bubble--system .g-dialogue-title { text-align: center; }

.g-dialogue-text {
  font-size: 15px; line-height: 1.8; color: #f1f5f9;
  min-height: 27px;
}
.g-dialogue-bubble--system .g-dialogue-text {
  text-align: center; font-style: italic; color: #94a3b8;
}

.g-dialogue-emotion {
  position: absolute; top: -14px; right: 16px;
  font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.g-dialogue-hint {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: rgba(148, 163, 184, 0.6);
  animation: dlgHintPulse 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes dlgHintPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* 叙事文字样式 */
.g-intro__narrative {
  font-style: italic;
  background: linear-gradient(135deg, #faf5ff, #f0f9ff);
  border-left-color: #8B5CF6 !important;
}

/* 重温对话按钮 */
.g-btn-replay {
  padding: 8px 20px;
  border-radius: 10px;
  border: 1.5px solid #c4b5fd;
  background: #f5f3ff;
  color: #7c3aed;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.g-btn-replay:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
  transform: translateY(-1px);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .g-dialogue-stage {
    padding: 0 12px 24px; gap: 10px;
  }
  .g-dialogue-avatar {
    width: 52px; height: 52px; min-width: 52px; font-size: 24px;
    margin-bottom: 4px;
  }
  .g-dialogue-bubble {
    padding: 14px 16px; border-radius: 16px 16px 4px 16px;
  }
  .g-dialogue-text { font-size: 13px; line-height: 1.6; }
  .g-dialogue-speaker { font-size: 14px; }
}

/* ===== Speedrun Overlay ===== */
.g-sr-overlay {
  position: fixed; inset: 0;
  z-index: 9500;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(3px);
  display: none;
}
.g-sr-overlay--active {
  display: flex; align-items: center; justify-content: center;
}

/* ===== Speedrun Card ===== */
.g-sr-card {
  position: relative;
  width: 620px; max-width: 94vw; max-height: 85vh;
  background: linear-gradient(160deg, #1e1b4b, #312e81);
  border: 2px solid rgba(139, 92, 246, 0.5);
  border-radius: 24px;
  padding: 0;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 50px rgba(99, 102, 241, 0.25);
  color: #e0e7ff;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex; flex-direction: column;
}
.g-sr-overlay--active .g-sr-card {
  transform: translateY(0);
}

/* Header */
.g-sr-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.25);
  text-align: center;
  flex-shrink: 0;
}
.g-sr-header__icon { font-size: 36px; display: block; margin-bottom: 6px; }
.g-sr-header__title { font-size: 20px; font-weight: 700; color: #fbbf24; margin: 0; }
.g-sr-header__sub { font-size: 13px; color: #a5b4fc; margin: 4px 0 0; }

/* ===== Progress bar ===== */
.g-sr-progress-bar {
  height: 4px; background: rgba(255,255,255,0.1);
  margin: 0 28px; border-radius: 2px; flex-shrink: 0;
}
.g-sr-progress-fill {
  height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 2px; width: 0;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.g-sr-progress-text {
  text-align: center; font-size: 12px; color: #94a3b8;
  padding: 6px 0 4px; flex-shrink: 0;
}

/* ===== Quiz area ===== */
.g-sr-quiz {
  padding: 16px 28px 10px;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}
.g-sr-quiz::-webkit-scrollbar { width: 4px; }
.g-sr-quiz::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 10px; }

.g-sr-question {
  font-size: 16px; font-weight: 600; color: #e0e7ff;
  margin-bottom: 16px; line-height: 1.5;
}

/* Options */
.g-sr-options {
  display: flex; flex-direction: column; gap: 10px;
}
.g-sr-opt {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left; color: #cbd5e1; font-size: 14px;
  font-family: inherit;
}
.g-sr-opt:hover:not(:disabled) {
  border-color: rgba(139,92,246,0.5);
  background: rgba(139,92,246,0.12);
  transform: translateX(3px);
}
.g-sr-opt:disabled { cursor: default; }
.g-sr-opt.g-sr-opt--correct {
  border-color: rgba(16,185,129,0.6);
  background: rgba(16,185,129,0.15);
  color: #6ee7b7;
}
.g-sr-opt.g-sr-opt--wrong {
  border-color: rgba(239,68,68,0.5);
  background: rgba(239,68,68,0.12);
  color: #fca5a5;
}
.g-sr-opt-label {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(139,92,246,0.2); color: #a5b4fc;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.g-sr-opt--correct .g-sr-opt-label {
  background: rgba(16,185,129,0.3); color: #6ee7b7;
}
.g-sr-opt--wrong .g-sr-opt-label {
  background: rgba(239,68,68,0.3); color: #fca5a5;
}
.g-sr-opt-text { flex: 1; }

/* ===== Result area ===== */
.g-sr-result {
  padding: 24px 28px; text-align: center;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
}
.g-sr-result-icon { font-size: 56px; }
.g-sr-result-title { font-size: 22px; font-weight: 700; color: #fbbf24; }
.g-sr-result-score { font-size: 15px; color: #cbd5e1; }
.g-sr-result-score strong { color: #fbbf24; font-size: 18px; }
.g-sr-result-chapter {
  background: rgba(139,92,246,0.12);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 14px; padding: 14px 20px;
  margin-top: 4px; width: 100%;
}
.g-sr-result-chapter-name { font-size: 16px; font-weight: 700; color: #e0e7ff; margin-bottom: 4px; }
.g-sr-result-chapter-desc { font-size: 12px; color: #94a3b8; }
.g-sr-result-actions {
  display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; justify-content: center;
}

/* Buttons */
.g-sr-btn {
  padding: 8px 20px; border-radius: 10px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
  font-family: inherit;
}
.g-sr-btn--go {
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.g-sr-btn--go:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,0.45); }

/* Footer */
.g-sr-footer {
  padding: 10px 28px 16px;
  text-align: center;
  border-top: 1px solid rgba(139,92,246,0.15);
  flex-shrink: 0;
}
.g-sr-btn--skip {
  background: none; border: 1px solid rgba(255,255,255,0.15); color: #94a3b8;
  padding: 8px 20px; border-radius: 10px; font-size: 13px; cursor: pointer;
  transition: all 0.2s; font-family: inherit;
}
.g-sr-btn--skip:hover { border-color: rgba(255,255,255,0.35); color: #e0e7ff; }

/* XP animation sparkles (for after unlock) */
.g-sr-sparkle {
  position: fixed; z-index: 9600; pointer-events: none;
  animation: srSparkleFly 1s ease-out forwards;
}
@keyframes srSparkleFly {
  0% { opacity: 1; transform: translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.3); }
}/* ======== 补充样式：阶段步骤指示器（Phase Steps） ======== */
.g-phase-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 12px 0;
  margin: 12px 0;
  position: relative;
}

.g-phase-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.g-phase-step__num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #334155;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.g-phase-step__label {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.g-phase-step__line {
  width: 40px;
  height: 2px;
  background: #334155;
  margin: 0 4px;
  margin-bottom: 24px;
  transition: background 0.3s ease;
  align-self: center;
}

.g-phase-step--active .g-phase-step__num {
  background: #6366f1;
  border-color: #818cf8;
  color: #fff;
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
}

.g-phase-step--active .g-phase-step__label {
  color: #818cf8;
  font-weight: 600;
}

.g-phase-step--active + .g-phase-step__line,
.g-phase-step__line.has-active {
  background: #6366f1;
}

/* ======== 阶段导航按钮 ======== */
.g-phase-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  margin-top: 4px;
}

.g-phase-btn {
  padding: 8px 20px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
}

.g-phase-btn:hover {
  background: rgba(99,102,241,0.15);
  border-color: #6366f1;
}

.g-phase-btn--next {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
  font-weight: 600;
}

.g-phase-btn--next:hover {
  background: #818cf8;
}

.g-phase-btn--prev {
  background: transparent;
  border-color: #334155;
  color: #94a3b8;
}

.g-phase-btn--prev:hover {
  color: #f1f5f9;
  border-color: #94a3b8;
}

.g-phase-status {
  font-size: 12px;
  color: #64748b;
  min-width: 100px;
  text-align: center;
}

/* ======== 每日挑战 UI ======== */
.g-daily-status {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.g-daily-quiz {
  padding: 16px 0;
}

.g-daily-result {
  padding: 16px 0;
  text-align: center;
}

.g-daily-rank {
  padding: 12px 0;
}

.g-daily-rank table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.g-daily-rank th {
  text-align: left;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid #334155;
}

.g-daily-rank td {
  padding: 8px;
  color: #f1f5f9;
  border-bottom: 1px solid rgba(51,65,85,0.5);
}

/* ======== 节点弹窗徽章 ======== */
.g-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(99,102,241,0.15);
  color: #818cf8;
  margin-right: 6px;
  vertical-align: middle;
}

.g-cleared-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(16,185,129,0.15);
  color: #10b981;
  vertical-align: middle;
}

/* ======== 前往下一关按钮 ======== */
.g-btn-gonext {
  padding: 10px 28px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.g-btn-gonext:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.4);
}

.g-btn-gonext:active {
  transform: translateY(0);
}

/* ===== 软开放：预览徽标 ===== */
.g-preview-badge {
  position: absolute; top: 4px; right: 6px;
  font-size: 10px; background: #818cf8; color: #fff;
  padding: 1px 6px; border-radius: 4px; z-index: 2;
}

/* ===== 软开放：确认闯关按钮 ===== */
.g-confirm-btn {
  display: block; width: 100%; margin: 8px 0 12px;
  padding: 10px 0; border-radius: 8px; border: none;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.g-confirm-btn:hover { opacity: 0.92; transform: scale(1.02); }

/* ===== 软开放：确认弹窗 ===== */
.g-confirm-modal {
  position: fixed; z-index: 9999; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
}
.g-confirm-modal__inner {
  width: 360px; max-width: 90vw;
  background: #1e1b4b; border-radius: 16px;
  padding: 24px; box-shadow: 0 0 40px rgba(0,0,0,0.6);
}

/* ===== 软开放：Zone tab 预览态 ===== */
.g-chtab-btn--preview {
  border: 1.5px dashed #6366f1 !important;
  opacity: 0.7;
}
.g-chtab-btn--preview:hover { opacity: 1; }
