/* 魔方星球 · 儿童友好主题皮肤层
   仅改变外观，不触碰原应用功能逻辑 */

:root {
  --xh-bg: #f4f7ff;
  --xh-bg-2: #ffffff;
  --xh-ink: #1d2440;
  --xh-muted: #65708c;
  --xh-line: #e3e9f7;
  --xh-primary: #4f6bff;
  --xh-primary-d: #3a52d8;
  --xh-radius: 22px;
  --xh-shadow: 0 10px 30px rgba(60, 80, 170, .12);
}

* { box-sizing: border-box; }

html, body {
  background: var(--xh-bg) !important;
  color: var(--xh-ink) !important;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

/* 让原应用整体在浅色主题下运行 */
.orbit-app {
  --bg: #f4f7ff !important;
  --panel: #ffffff !important;
  --panel2: #f7f9ff !important;
  --line: #e3e9f7 !important;
  --text: #1d2440 !important;
  --muted: #65708c !important;
  --green: #4f6bff !important;
  color-scheme: light !important;
  background: var(--xh-bg) !important;
  min-height: 100vh;
}

/* ---------- 顶部品牌条 ---------- */
.xh-topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px;
  height: 68px; padding: 0 26px;
  background: #ffffff;
  border-bottom: 1px solid var(--xh-line);
  box-shadow: 0 4px 18px rgba(60, 80, 170, .07);
}
.xh-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; letter-spacing: .5px;
  color: var(--xh-ink);
}
.xh-brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #4f6bff, #8f6bff);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 6px 14px rgba(79, 107, 255, .35);
}
.xh-brand-mark svg { width: 44px; height: 30px; }
.xh-brand-mark .xh-art-float { animation: none; }
.xh-brand-sub { color: var(--xh-primary); font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.xh-topbar-spacer { flex: 1; }
.xh-topbar-note {
  font-size: 13px; color: var(--xh-muted);
  background: #f0f4ff; padding: 8px 14px; border-radius: 999px;
}

/* ---------- 左右滑动大卡片菜单 ---------- */
.xh-menu-wrap {
  position: sticky; top: 68px; z-index: 55;
  background: var(--xh-bg);
  padding: 18px 0 10px;
  border-bottom: 1px solid var(--xh-line);
}
.xh-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px 12px;
}
.xh-menu-title { font-size: 15px; font-weight: 700; color: var(--xh-ink); }
.xh-menu-arrows { display: flex; gap: 8px; }
.xh-menu-arrows button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--xh-line); background: #fff;
  color: var(--xh-primary); font-size: 18px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
}
.xh-menu-arrows button:hover { background: #eef2ff; }

.xh-cards {
  display: flex; gap: 16px;
  overflow-x: auto; scroll-behavior: smooth;
  padding: 6px 26px 14px;
  scrollbar-width: none;
}
.xh-cards::-webkit-scrollbar { display: none; }

.xh-card {
  flex: 0 0 228px; min-height: 216px;
  border-radius: var(--xh-radius);
  background: #fff;
  border: 2px solid transparent;
  box-shadow: var(--xh-shadow);
  padding: 0; cursor: pointer;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .18s ease;
  position: relative; overflow: hidden;
  text-align: left;
  animation: xh-card-in .5s ease backwards;
}
.xh-card:nth-child(1) { animation-delay: .02s; }
.xh-card:nth-child(2) { animation-delay: .08s; }
.xh-card:nth-child(3) { animation-delay: .14s; }
.xh-card:nth-child(4) { animation-delay: .20s; }
.xh-card:nth-child(5) { animation-delay: .26s; }
.xh-card:nth-child(6) { animation-delay: .32s; }
.xh-card:nth-child(7) { animation-delay: .38s; }

@keyframes xh-card-in {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.xh-card:hover { transform: translateY(-7px) rotate(-1deg); box-shadow: 0 20px 44px rgba(60, 80, 170, .24); }
.xh-card.is-active { border-color: var(--xh-card-accent); transform: translateY(-4px); }

/* 炫彩渐变插画区 */
.xh-card-art {
  height: 128px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--xh-c1), var(--xh-c2));
  display: block;
}
.xh-card-art::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 18%, rgba(255,255,255,.5) 0%, transparent 42%);
}
.xh-card-art .xh-art {
  position: absolute; left: 50%; top: 50%; width: 132px; height: 88px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 6px rgba(0,0,0,.12));
}
.xh-card-badge {
  position: absolute; top: 10px; left: 12px; z-index: 2;
  min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 999px; background: rgba(255,255,255,.88);
  color: var(--xh-c2); font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.xh-card-text { padding: 13px 16px 16px; }
.xh-card-title { font-size: 18px; font-weight: 800; color: var(--xh-ink); line-height: 1.1; }
.xh-card-sub { font-size: 12px; color: var(--xh-muted); margin-top: 7px; line-height: 1.5; }

/* 各卡片炫彩配色 */
.xh-card[data-k="training"] { --xh-card-accent:#4f6bff; --xh-c1:#5b8cff; --xh-c2:#7f5bff; }
.xh-card[data-k="learn"]    { --xh-card-accent:#00b3a4; --xh-c1:#22d3b0; --xh-c2:#0aa0c8; }
.xh-card[data-k="timer"]    { --xh-card-accent:#ff8a3d; --xh-c1:#ffb347; --xh-c2:#ff6f61; }
.xh-card[data-k="battle"]   { --xh-card-accent:#ff4d6d; --xh-c1:#ff6b8a; --xh-c2:#ff3d5e; }
.xh-card[data-k="match"]    { --xh-card-accent:#9b6bff; --xh-c1:#b06bff; --xh-c2:#7b5bff; }
.xh-card[data-k="record"]   { --xh-card-accent:#2fb35c; --xh-c1:#5ed36a; --xh-c2:#22b08c; }
.xh-card[data-k="settings"] { --xh-card-accent:#7b879e; --xh-c1:#98a6c4; --xh-c2:#6b7a99; }

/* 插画动画 */
.xh-art-float { animation: xh-float 3.2s ease-in-out infinite; }
@keyframes xh-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.xh-art-spin { animation: xh-spin 9s linear infinite; }
@keyframes xh-spin { to { transform: rotate(360deg); } }
.xh-spark { animation: xh-twinkle 1.8s ease-in-out infinite; }
.xh-card:nth-child(even) .xh-spark { animation-delay: .7s; }
@keyframes xh-twinkle { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.xh-hand { transform-origin: 50px 34px; animation: xh-spin 4s linear infinite; }
.xh-bolt { animation: xh-twinkle 1s ease-in-out infinite; }
.xh-art-rise { animation: xh-float 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .xh-card, .xh-art-float, .xh-art-spin, .xh-spark, .xh-hand, .xh-bolt, .xh-art-rise { animation: none !important; }
}

/* 隐藏原左侧导航，把主内容顶上来 */
.orbit-app > .orbit-nav { display: none !important; }
.orbit-main { margin-left: 0 !important; }
.xh-menu-host { display: block; }

/* 训练舞台保留原沉浸式深色背景；仅在顶部与菜单区呈现儿童风明亮主题。
   这样训练面板的白字仍然可读，功能与可读性不受影响。 */
.xh-stage-note {
  padding: 14px 26px 0;
  color: var(--xh-muted);
  font-size: 12px;
}

/* 原主内容区留白与卡片化 */
.orbit-content { padding: 22px 26px 60px !important; max-width: 1280px; margin: 0 auto; }

/* 顶部问候与设备条的浅色适配 */
.orbit-header { background: transparent !important; border-bottom: 0 !important; }
.desktop-greeting { color: var(--xh-ink) !important; }

/* 移动端适配 */
@media (max-width: 760px) {
  .xh-topbar { height: 58px; padding: 0 16px; }
  .xh-brand { font-size: 17px; }
  .xh-topbar-note { display: none; }
  .xh-menu-wrap { top: 58px; padding-top: 12px; }
  .xh-menu-head { padding: 0 16px 10px; }
  .xh-cards { padding: 4px 16px 12px; gap: 12px; }
  .xh-card { flex-basis: 172px; min-height: 186px; }
  .xh-card-art { height: 104px; }
  .xh-card-art .xh-art { width: 108px; height: 72px; }
  .xh-card-text { padding: 11px 13px 13px; }
  .xh-card-title { font-size: 16px; }
  .orbit-content { padding: 16px 14px 48px !important; }
}
