/* ============================================================
 * styles/vhome.css —— 视觉化游戏主界面（v3.1 视觉升级）
 * 推翻"零位图"约束，用 AI 生图作为游戏画面素材
 * ============================================================ */

/* ============ Hero 主城 ============ */
.vhome-hero {
  position: relative;
  width: 100%;
  min-height: 420px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  isolation: isolate;
}

.vhome-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
  z-index: 0;
  transform: scale(1.05);
  transition: transform 8s ease-in-out;
}

.vhome-hero:hover .vhome-hero-bg {
  transform: scale(1.08);
}

.vhome-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(7, 17, 24, 0.45) 0%,
      rgba(7, 17, 24, 0.25) 30%,
      rgba(7, 17, 24, 0.55) 70%,
      rgba(7, 17, 24, 0.85) 100%);
  z-index: 1;
}

/* 顶部状态条 */
.vhome-hero-status {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  color: #f8f6ee;
}

.vhome-realm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(8, 18, 26, 0.55);
  border: 1px solid rgba(216, 242, 78, 0.35);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.vhome-realm-icon {
  width: 10px;
  height: 10px;
  background: #d8f24e;
  border-radius: 50%;
  box-shadow: 0 0 10px #d8f24e, 0 0 20px rgba(216, 242, 78, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.vhome-realm-name {
  font-weight: 600;
  color: #f8f6ee;
}

.vhome-stats {
  display: flex;
  gap: 12px;
}

.vhome-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(8, 18, 26, 0.55);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  color: #f8f6ee;
}

.vhome-stat-icon {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #d8f24e 0%, #b8c93c 50%, transparent 70%);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(216, 242, 78, 0.6);
}

.vhome-stat-val {
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* 主标题区 */
.vhome-hero-body {
  position: relative;
  z-index: 2;
  padding: 60px 24px 80px;
  color: #f8f6ee;
}

.vhome-title {
  font-size: 48px;
  font-weight: 900;
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, #fff 0%, #d8f24e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(216, 242, 78, 0.4)); }
  50% { filter: drop-shadow(0 0 24px rgba(216, 242, 78, 0.7)); }
}

.vhome-subtitle {
  font-size: 14px;
  letter-spacing: 0.32em;
  margin: 0 0 18px;
  color: rgba(248, 246, 238, 0.7);
  text-transform: none;
}

.vhome-realm-text {
  font-size: 16px;
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.vhome-realm-layer {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.vhome-realm-sep {
  opacity: 0.5;
}

.vhome-realm-progress {
  opacity: 0.85;
  font-size: 14px;
}

.vhome-progress-card {
  max-width: 360px;
  background: rgba(8, 18, 26, 0.5);
  border: 1px solid rgba(248, 246, 238, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.vhome-progress-bar {
  height: 6px;
  background: rgba(248, 246, 238, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.vhome-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d8f24e 0%, #b8c93c 100%);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(216, 242, 78, 0.6);
  transition: width 600ms ease-out;
}

.vhome-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(248, 246, 238, 0.7);
  letter-spacing: 0.05em;
}

/* 器灵角色 */
.vhome-spirit {
  position: absolute;
  right: 12px;
  bottom: 0;
  z-index: 3;
  pointer-events: none;
  width: 200px;
  height: 280px;
  animation: spiritFloat 4s ease-in-out infinite;
}

@keyframes spiritFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}

.vhome-spirit-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.vhome-spirit-name {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(216, 242, 78, 0.9);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* ============ 区段通用 ============ */
.vhome-section-head {
  padding: 0 20px;
  margin-bottom: 14px;
}

.vhome-section-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 4px;
  color: var(--text-1, #f0e9d8);
}

.vhome-section-sub {
  font-size: 12px;
  letter-spacing: 0.16em;
  margin: 0;
  color: var(--text-3, rgba(240, 233, 216, 0.5));
}

/* ============ 功能入口卡片 ============ */
.vhome-actions {
  padding: 0 16px 24px;
}

.vhome-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 4px;
}

.vhome-action-card {
  position: relative;
  background: var(--bg-card, rgba(20, 32, 42, 0.6));
  border: 1px solid var(--accent, rgba(216, 242, 78, 0.3));
  border-radius: 12px;
  padding: 14px 8px 10px;
  color: var(--text-1, #f0e9d8);
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  isolation: isolate;
}

.vhome-action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--accent, rgba(216, 242, 78, 0.2)), transparent 70%);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: -1;
}

.vhome-action-card:hover,
.vhome-action-card:focus {
  transform: translateY(-2px);
  border-color: var(--accent, #d8f24e);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  outline: none;
}

.vhome-action-card:hover::before,
.vhome-action-card:focus::before {
  opacity: 1;
}

.vhome-action-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent, #d8f24e);
  position: relative;
  margin-bottom: 2px;
}

.vhome-action-icon-skills {
  background: radial-gradient(circle, var(--yanling-primary, #4ed3c1) 0%, rgba(78, 211, 193, 0.4) 70%);
  box-shadow: 0 0 16px rgba(78, 211, 193, 0.5);
}

.vhome-action-icon-errors {
  background: radial-gradient(circle, var(--jielu-primary, #d8b87a) 0%, rgba(216, 184, 122, 0.4) 70%);
  box-shadow: 0 0 16px rgba(216, 184, 122, 0.5);
}

.vhome-action-icon-trial {
  background: radial-gradient(circle, var(--henglu-primary, #d8b450) 0%, rgba(216, 180, 80, 0.4) 70%);
  box-shadow: 0 0 16px rgba(216, 180, 80, 0.5);
}

.vhome-action-icon-realms {
  background: radial-gradient(circle, var(--dianjing-primary, #d87090) 0%, rgba(216, 112, 144, 0.4) 70%);
  box-shadow: 0 0 16px rgba(216, 112, 144, 0.5);
}

.vhome-action-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.vhome-action-sub {
  font-size: 10px;
  color: var(--text-3, rgba(240, 233, 216, 0.5));
  letter-spacing: 0.12em;
}

/* ============ 九秘境卡片网格 ============ */
.vhome-realms {
  padding: 12px 16px 24px;
}

.vhome-realm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 4px;
}

.vhome-realm-card {
  position: relative;
  aspect-ratio: 1 / 1.2;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card, #14202a);
  transition: transform 240ms ease, box-shadow 240ms ease;
  --lane-color: rgba(216, 242, 78, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.vhome-realm-card:hover,
.vhome-realm-card:focus {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--lane-color);
  outline: none;
}

.vhome-realm-card[data-progress="done"] {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(216, 242, 78, 0.8);
}

.vhome-realm-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 600ms ease;
}

.vhome-realm-card:hover .vhome-realm-img {
  transform: scale(1.08);
}

.vhome-realm-card[data-progress="idle"] .vhome-realm-img {
  filter: saturate(0.6) brightness(0.65);
}

.vhome-realm-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(8, 18, 26, 0.1) 0%,
    rgba(8, 18, 26, 0.4) 50%,
    rgba(8, 18, 26, 0.92) 100%);
}

.vhome-realm-portrait {
  position: absolute;
  right: 0;
  bottom: 0;
  height: 90%;
  width: auto;
  object-fit: contain;
  object-position: bottom right;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  transition: transform 400ms ease, opacity 400ms ease;
}

.vhome-realm-card:hover .vhome-realm-portrait {
  transform: translateY(-4px) scale(1.05);
}

.vhome-realm-card[data-progress="idle"] .vhome-realm-portrait {
  opacity: 0.45;
  filter: grayscale(0.4) brightness(0.7);
}

.vhome-realm-body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  color: #f8f6ee;
  z-index: 2;
}

.vhome-realm-card:has(.vhome-realm-portrait) .vhome-realm-body {
  padding-right: 60px;
}

.vhome-realm-glyph {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 18, 26, 0.7);
  border: 1px solid var(--lane-color, rgba(216, 242, 78, 0.6));
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--lane-color, #d8f24e);
  letter-spacing: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.vhome-realm-name {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.vhome-realm-motif {
  font-size: 10px;
  letter-spacing: 0.16em;
  margin: 0 0 8px;
  opacity: 0.75;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.vhome-realm-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.vhome-realm-progress-text {
  font-weight: 600;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.vhome-realm-bar {
  flex: 1;
  height: 3px;
  background: rgba(248, 246, 238, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.vhome-realm-bar-fill {
  height: 100%;
  background: var(--lane-color, #d8f24e);
  border-radius: 999px;
  box-shadow: 0 0 6px var(--lane-color, rgba(216, 242, 78, 0.6));
  transition: width 600ms ease;
}

/* ============ 任务卷轴 ============ */
.vhome-quests {
  padding: 12px 16px 32px;
}

.vhome-quest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
}

.vhome-quest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card, rgba(20, 32, 42, 0.6));
  border: 1px solid rgba(248, 246, 238, 0.08);
  border-radius: 12px;
  transition: border-color 200ms ease;
}

.vhome-quest[data-done="1"] {
  border-color: rgba(216, 242, 78, 0.4);
  background: rgba(20, 32, 42, 0.4);
}

.vhome-quest[data-done="1"] .vhome-quest-name {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: rgba(216, 242, 78, 0.4);
}

.vhome-quest-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 242, 78, 0.6) 0%, transparent 70%);
  position: relative;
}

.vhome-quest-icon::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--bg-card, #14202a);
}

.vhome-quest[data-done="1"] .vhome-quest-icon {
  background: #d8f24e;
  box-shadow: 0 0 12px rgba(216, 242, 78, 0.6);
}

.vhome-quest[data-done="1"] .vhome-quest-icon::after {
  content: '✓';
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #14202a;
  font-weight: 800;
}

.vhome-quest-body {
  flex: 1;
  min-width: 0;
}

.vhome-quest-name {
  font-size: 13px;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  color: var(--text-1, #f0e9d8);
}

.vhome-quest-bar {
  height: 3px;
  background: rgba(248, 246, 238, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.vhome-quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #d8f24e 0%, #b8c93c 100%);
  border-radius: 999px;
  transition: width 400ms ease;
}

.vhome-quest-num {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-3, rgba(240, 233, 216, 0.5));
  letter-spacing: 0.05em;
  min-width: 36px;
  text-align: right;
}

.vhome-quest-claim,
.vhome-quest-reward {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(216, 242, 78, 0.15);
  border: 1px solid rgba(216, 242, 78, 0.4);
  color: #d8f24e;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: background 200ms ease;
}

.vhome-quest-claim:hover {
  background: rgba(216, 242, 78, 0.3);
}

.vhome-quest-reward {
  background: transparent;
  border-color: rgba(248, 246, 238, 0.2);
  color: var(--text-3, rgba(240, 233, 216, 0.5));
  cursor: default;
}

/* ============ 响应式 ============ */
@media (min-width: 600px) {
  .vhome-hero {
    min-height: 520px;
  }
  .vhome-title { font-size: 64px; }
  .vhome-spirit {
    width: 260px;
    height: 360px;
  }
  .vhome-action-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
  .vhome-realm-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .vhome-realm-name { font-size: 17px; }
}

@media (max-width: 420px) {
  .vhome-hero {
    min-height: 360px;
  }
  .vhome-title { font-size: 36px; letter-spacing: 0.12em; }
  .vhome-hero-body { padding: 32px 18px 60px; }
  .vhome-spirit {
    width: 140px;
    height: 200px;
    right: 4px;
  }
  .vhome-realm-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vhome-hero-bg,
  .vhome-spirit,
  .vhome-realm-card,
  .vhome-action-card,
  .vhome-realm-img {
    animation: none !important;
    transition: none !important;
  }
}

/* ============================================================
 * v3.1 答题界面视觉层 —— 秘境场景背景 + 守护者立绘
 * 给 .insc（铭刻）和 .drv（推演）界面叠加画面
 * ============================================================ */

/* 场景背景：固定铺满，cover 裁切 */
.level-visual-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
  animation: levelBgFadeIn 400ms ease;
}

@keyframes levelBgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 渐变遮罩：上深下浅（顶部放进度条，底部留白可读） */
.level-visual-grad {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg,
    rgba(8, 14, 20, 0.82) 0%,
    rgba(8, 14, 20, 0.55) 40%,
    rgba(8, 14, 20, 0.45) 60%,
    rgba(8, 14, 20, 0.75) 100%);
  z-index: 1;
  pointer-events: none;
}

/* 守护者立绘：浮在右侧，半透明，不遮挡正文 */
.level-guardian {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 240px;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  object-position: bottom right;
  z-index: 2;
  opacity: 0.55;
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  animation: guardianFloat 5s ease-in-out infinite;
  transition: opacity 300ms ease;
}

.level-guardian:hover {
  opacity: 0.85;
}

@keyframes guardianFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 答题内容提到最顶层 */
.insc,
.drv {
  position: relative;
  z-index: 3;
}

/* 导航返回按钮也需要提层级 */
.navback {
  position: relative;
  z-index: 4;
}

/* 移动端隐藏守护者立绘（避免遮挡答题区） */
@media (max-width: 600px) {
  .level-guardian {
    display: none;
  }
  .level-visual-grad {
    background: linear-gradient(180deg,
      rgba(8, 14, 20, 0.88) 0%,
      rgba(8, 14, 20, 0.65) 50%,
      rgba(8, 14, 20, 0.88) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .level-visual-bg,
  .level-guardian {
    animation: none !important;
    transition: none !important;
  }
}