/* ==========================================================================
   苍匣 CangXia · 匣子首页
   首屏只放一只可以打开的匣子，向下才进入信息展示。
   ========================================================================== */

:root {
  --header-h: 77px;
  /* 屏幕底部留给匣灵的「走廊」：开匣卡片和游戏 / 应用页都停在走廊上沿 */
  --hub-lane: max(150px, 24vh);
}

@media (max-width: 760px) {
  /* 窄屏匣灵缩得更小，但也要多留一点落脚的地方 */
  :root { --hub-lane: max(160px, 28vh); }
}



/* 首屏视觉与交互全部在 scene.css，这里只留菜单与信息面板的样式 */

/* 开匣功能：点一下匣子，两个入口卡片就从箱口被扔出来、铺满大半个页面，
   卡片顶部是宣传 banner 轮播；匣灵缩小落进屏幕底部的「走廊」里继续跳舞。
   没有面板、没有遮罩，收起时再飞回箱子里 ---- */

.hub {
  /* 入口卡片从箱口（屏幕中央偏下）飞出来的起点 */
  --from-x: 0;
  --from-y: clamp(30px, 7vh, 90px);
  --from-rot: 0deg;
  position: fixed;
  inset: 0;
  z-index: 60;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  margin: 0;
  padding: clamp(96px, 11vh, 128px) clamp(16px, 4vw, 64px) var(--hub-lane);
  border: 0;
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
  /* 整层不拦鼠标：点空白、再点一次匣子都交给页面自己处理 */
  pointer-events: none;
}

.hub[open] {
  display: flex;
}

/* 入口卡片就是页面本身，不再是白色面板 */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 30px);
  width: min(1520px, 100%);
  /* 撑满页头与走廊之间的整块地方：卡片跟着变大，内容比屏幕高时自动从下方撑出去滚动 */
  height: 100%;
  margin: 0 auto;
  transition: opacity 0.3s ease;
}

/* 点进游戏 / 应用页时卡片先淡出，页面收起后再淡回来（dialog 一直开着，匣灵不用重新落位） */
.hub.is-behind .hub-grid,
.hub.is-behind .hub-close {
  opacity: 0;
}

/* 透明不等于点不到：.hub-option 自己声明了 pointer-events: auto，会重新把整张卡
   变成可命中区，只在 .hub-grid 上关掉是不够的 —— 淡出的入口卡片会继续盖在
   游戏 / 应用页的卡片上吃点击（表现：点游戏回到开匣界面）。整棵子树一起按住。 */
.hub.is-behind .hub-grid,
.hub.is-behind .hub-grid *,
.hub.is-behind .hub-close {
  pointer-events: none;
}

.hub-close {
  position: fixed;
  bottom: clamp(16px, 4vh, 40px);
  right: clamp(14px, 3.2vw, 40px);
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 1px solid #e3ebf7;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 26px rgba(20, 38, 80, 0.14);
  color: var(--ink);
  font-size: 19px;
  pointer-events: auto;
  animation: hub-close-in 0.4s 0.24s ease backwards;
  transition: opacity 0.3s ease, transform 0.26s ease, background-color 0.26s ease, color 0.26s ease;
}

.hub-close:hover {
  background: var(--ink);
  color: #ffffff;
  transform: rotate(90deg);
}

/* 依次从箱口被扔出来，最后各就各位；fill 用 backwards，动画结束后让位给 hover 的 transform */
.hub[open] .hub-option { animation: hub-throw 0.72s cubic-bezier(0.2, 0.9, 0.25, 1) backwards; }
.hub[open] .hub-option:nth-child(1) { --from-x: 56%; --from-rot: 6deg; }
.hub[open] .hub-option:nth-child(2) { --from-x: -56%; --from-rot: -6deg; animation-delay: 0.09s; }

/* 收起：一起飞回箱口，比扔出来更快 */
.hub[open].is-closing .hub-option {
  animation: hub-retract 0.3s cubic-bezier(0.4, 0, 0.72, 0.2) forwards;
  animation-delay: 0s;
}

.hub[open].is-closing .hub-close { animation: hub-close-out 0.2s ease forwards; }

@keyframes hub-throw {
  0% {
    opacity: 0;
    transform: translate(var(--from-x, 0), var(--from-y, 0)) scale(0.34) rotate(var(--from-rot, 0deg));
  }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

@keyframes hub-retract {
  0% { opacity: 1; transform: none; }
  100% {
    opacity: 0;
    transform: translate(var(--from-x, 0), var(--from-y, 0)) scale(0.36) rotate(var(--from-rot, 0deg));
  }
}

@keyframes hub-close-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes hub-close-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.hub-option {
  --tone: var(--blue);
  --tone-soft: #eef5ff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: clamp(320px, 56vh, 900px);
  padding: clamp(13px, 1.4vw, 20px) clamp(16px, 1.6vw, 26px) clamp(18px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: clamp(22px, 2vw, 30px);
  background:
    radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.94), transparent 48%),
    var(--tone-soft);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  pointer-events: auto;
  box-shadow: 0 22px 52px rgba(20, 38, 80, 0.13);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 两张卡片的色相也只走三族色：游戏=蜜金、应用=电蓝（之前的粉 / 薄荷绿都收掉） */
.hub-games { --tone: #c2571d; --tone-soft: #fff4ea; }
.hub-apps { --tone: var(--blue-dark); --tone-soft: #eef4ff; }

/* 卡片顶部的宣传 banner：还没有真图时先用渐变海报占位，轮播由 main.js 切换 */
.hub-promo {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-height: clamp(160px, 24vh, 340px);
  max-height: clamp(220px, 42vh, 620px);
  margin-bottom: clamp(14px, 1.4vw, 20px);
  border-radius: clamp(16px, 1.5vw, 22px);
  overflow: hidden;
  background: var(--tone);
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.hub-promo-slide {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  padding: clamp(11px, 1.2vw, 16px);
  border-radius: inherit;
  background-image:
    repeating-linear-gradient(var(--ang, 135deg), rgba(255, 255, 255, 0.12) 0 2px, rgba(255, 255, 255, 0) 2px 18px),
    radial-gradient(circle at 78% 14%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 58%),
    linear-gradient(var(--ang, 135deg), var(--c1, #8ab6ff), var(--c2, #3d63ff));
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.7s ease, transform 1.6s ease;
}

.hub-promo-slide.is-active { opacity: 1; transform: scale(1); }

/* 底部压暗一层，保证随机配色下文字始终清晰，也让真图换成同一套叠加层 */
.hub-promo-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(14, 22, 42, 0.46), rgba(14, 22, 42, 0) 54%);
  pointer-events: none;
}

.hub-promo-img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-promo-ghost {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: clamp(10px, 1.4vw, 22px);
  transform: translateY(-50%) rotate(-8deg);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: clamp(42px, 4.8vw, 82px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  opacity: 0.24;
  pointer-events: none;
  user-select: none;
}

.hub-promo-name {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-size: clamp(16px, 1.6vw, 24px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(16, 26, 52, 0.3);
}

.hub-promo-dots {
  position: absolute;
  z-index: 3;
  right: clamp(11px, 1.2vw, 16px);
  bottom: clamp(11px, 1.2vw, 16px);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hub-promo-dot {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.46);
  transition: width 0.32s ease, background-color 0.32s ease;
}

.hub-promo-dot.is-on {
  width: 14px;
  background: #ffffff;
}

.hub-option::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -62px;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  pointer-events: none;
}

.hub-option:hover {
  border-color: color-mix(in srgb, var(--tone) 32%, #ffffff);
  box-shadow: 0 30px 64px rgba(31, 54, 105, 0.18);
  transform: translateY(-6px);
}

.hub-option:active { transform: translateY(-2px) scale(0.992); }

.hub-option-mark {
  position: absolute;
  z-index: 4;
  top: clamp(22px, 2.4vw, 32px);
  left: clamp(22px, 2.4vw, 32px);
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  background: #ffffff;
  color: var(--tone);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(16, 26, 52, 0.18);
}

.hub-option-title {
  position: relative;
  z-index: 2;
  color: var(--ink);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 700;
  line-height: 1.3;
}

.hub-option-desc {
  position: relative;
  z-index: 2;
  margin-top: auto;
  max-width: 46ch;
  padding-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.hub-option-arrow {
  position: absolute;
  top: clamp(22px, 2.4vw, 32px);
  right: clamp(22px, 2.4vw, 32px);
  z-index: 4;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
  color: var(--tone);
  font-size: 14px;
  transition: transform 0.26s ease, background-color 0.26s ease, color 0.26s ease;
}

.hub-option:hover .hub-option-arrow {
  background: var(--tone);
  color: #ffffff;
  transform: rotate(45deg);
}

/* 窄屏：卡片竖排铺满，匣灵缩在下方角落（断点和 scene.css 保持一致） */
@media (max-width: 760px) {
  .hub {
    padding: calc(var(--header-h) + 16px) 12px var(--hub-lane);
  }

  /* 竖排时也从中间的箱口上下飞出来 */
  .hub[open] .hub-option:nth-child(1) { --from-x: 0; --from-y: 60%; --from-rot: 4deg; }
  .hub[open] .hub-option:nth-child(2) { --from-x: 0; --from-y: -60%; --from-rot: -4deg; }

  .hub-close {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }

  .hub-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: minmax(220px, 1fr);
    gap: 10px;
    width: 100%;
    height: 100%;
  }

  .hub-option {
    min-height: 0;
    padding: 11px 13px 14px;
    border-radius: 22px;
  }

  .hub-promo {
    min-height: 108px;
    max-height: none;
    margin-bottom: 10px;
    border-radius: 16px;
  }

  .hub-promo-name { font-size: 15px; }
  .hub-promo-ghost { font-size: 34px; }
  .hub-promo-dot { width: 4px; height: 4px; }
  .hub-promo-dot.is-on { width: 12px; }

  .hub-option-mark {
    top: 20px;
    left: 20px;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    font-size: 12px;
  }

  .hub-option-title { font-size: 20px; }

  .hub-option-desc {
    max-width: none;
    padding: 6px 0 0;
    font-size: 13px;
    line-height: 1.6;
  }

  .hub-option-arrow { top: 20px; right: 20px; width: 28px; height: 28px; font-size: 12px; }
  .hub-option::after { right: -30px; bottom: -40px; width: 104px; height: 104px; }
}

/* 信息面板内容 ---------------------------------------------------------- */

.info-lede {
  max-width: 640px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.info-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: clamp(28px, 4vw, 44px);
}

.info-stat {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(31, 54, 105, 0.04);
}

.info-stat strong {
  display: block;
  color: var(--ink);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.info-stat span {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
}

.info-block { margin-top: clamp(40px, 5vw, 58px); }

.info-block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.info-block-head h3 {
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.4;
}

.info-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.info-link span { transition: transform 0.2s ease; }
.info-link:hover { border-color: var(--blue); }
.info-link:hover span { transform: translate(2px, -2px); }

.info-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.info-game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.info-tool,
.info-game {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.info-tool:hover,
.info-game:hover {
  border-color: #bfd2ef;
  box-shadow: 0 10px 24px rgba(31, 54, 105, 0.07);
  transform: translateY(-2px);
}

.info-tool-mark,
.info-game-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid #dce8fa;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.info-tool:nth-child(3n + 2) .info-tool-mark,
.info-game:nth-child(3n + 2) .info-game-mark {
  border-color: #ffe1cc;
  background: #fff4ee;
  color: #a25b2b;
}

.info-tool:nth-child(3n) .info-tool-mark,
.info-game:nth-child(3n) .info-game-mark {
  border-color: #cfe0ff;
  background: #f2f7ff;
  color: var(--blue-dark);
}

.info-tool:nth-child(4n) .info-tool-mark,
.info-game:nth-child(4n) .info-game-mark {
  border-color: #f7e2b4;
  background: #fff9ec;
  color: #9a6b12;
}

.info-tool-copy,
.info-game-copy { min-width: 0; }

.info-tool-title,
.info-game-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-tool-meta,
.info-game-meta {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-tool-arrow,
.info-game-arrow {
  color: var(--muted-2);
  font-size: 12px;
  transition: color 0.2s ease, transform 0.2s ease;
}
.info-tool:hover .info-tool-arrow,
.info-game:hover .info-game-arrow {
  color: var(--blue);
  transform: translateX(2px);
}

.info-studio {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(24px, 4vw, 50px);
  align-items: center;
  margin-top: clamp(40px, 5vw, 58px);
  padding: clamp(24px, 4vw, 38px);
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 107, 255, 0.3), transparent 42%),
    linear-gradient(135deg, #111a2c 0%, #18243a 58%, #101b2e 100%);
  color: #ffffff;
  overflow: hidden;
}

.info-studio::after {
  content: "";
  position: absolute;
  right: -130px;
  bottom: -190px;
  width: 380px;
  height: 380px;
  border: 1px dashed rgba(255, 212, 107, 0.22);
  border-radius: 50%;
  pointer-events: none;
}

.info-studio-copy { position: relative; z-index: 1; }

.info-studio h3 {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 700;
  line-height: 1.35;
}

.info-studio-copy > p {
  max-width: 340px;
  margin-top: 12px;
  color: rgba(230, 239, 252, 0.72);
  font-size: 14px;
  line-height: 1.75;
}

.info-studio-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}
.info-studio-link span { transition: transform 0.22s ease; }
.info-studio-link:hover {
  border-color: rgba(255, 212, 107, 0.45);
  background: rgba(255, 212, 107, 0.12);
  transform: translateY(-2px);
}
.info-studio-link:hover span { transform: translate(2px, -2px); }

.info-studio .studio-works {
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 0;
}

.info-studio .studio-work {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.info-studio .studio-work-mark,
.info-studio .studio-work:nth-child(2) .studio-work-mark {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #cfe3ff;
}

.info-studio .studio-work-title { color: #ffffff; }
.info-studio .studio-work-meta { color: rgba(230, 239, 252, 0.72); }

.info-studio .studio-work-state,
.info-studio .studio-work:nth-child(2) .studio-work-state {
  background: rgba(255, 212, 107, 0.14);
  color: #ffd46b;
}

/* 动效 ------------------------------------------------------------------ */

/* 小屏 ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .info-game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-studio { grid-template-columns: minmax(0, 1fr); }
  .info-studio .studio-works { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .info-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  :root { --header-h: 67px; }

  .info-lede { font-size: 14px; }
  .info-stat { padding: 15px 16px; }
  .info-block-head { align-items: flex-start; }
  .info-tool-grid,
  .info-game-grid { grid-template-columns: minmax(0, 1fr); }
  .info-studio { padding: 22px 18px; border-radius: 24px; }
  .info-studio .studio-works { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 390px) {
  .info-tool,
  .info-game { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 8px 10px; }
  .info-tool-mark,
  .info-game-mark { width: 36px; height: 36px; }
  .info-stat strong { font-size: 26px; }
}





