/* ===================================================
   base.css —— 变量、重置、背景装饰、首页
   =================================================== */

:root {
  /* 主题色：鲜艳饱和 */
  --sky1: #8fe3ff;
  --sky2: #d9f7ff;
  --sky3: #fff3c4;
  --grass1: #8ceb8c;
  --grass2: #3fc167;
  --crab: #ff5f5f;
  --crab-d: #ce3535;
  --sun: #ffd93d;
  --sun-d: #e2ab00;
  --purple: #a274ff;
  --purple-d: #7c48e0;
  --blue: #4bb8ff;
  --blue-d: #2a8ed1;
  --pink: #ff8ec7;
  --mint: #58e0c0;
  --ink: #36304d;
  --ink-soft: #6d6690;
  --card: #ffffff;

  --radius: 24px;
  --radius-s: 16px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --shadow-card: 0 12px 0 rgba(54, 48, 77, 0.13), 0 18px 34px rgba(54, 48, 77, 0.18);
  --border-w: 4px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 45%, var(--sky3) 78%, #e8ffd8 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---------- 屏幕容器 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}
.screen.active {
  display: flex;
  animation: screenIn 0.38s cubic-bezier(0.22, 1.4, 0.5, 1) both;
}
@keyframes screenIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- 背景装饰 ---------- */
.bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.bg-deco .sun {
  position: absolute;
  top: 3%;
  right: 5%;
  font-size: 68px;
  animation: sunSpin 14s linear infinite;
  filter: drop-shadow(0 0 18px rgba(255, 200, 60, 0.8));
}
.bg-deco .sun .ico { width: 1em; height: 1em; }
@keyframes sunSpin {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.12); }
  100% { transform: rotate(360deg) scale(1); }
}
.bg-deco .cloud {
  position: absolute;
  font-size: 54px;
  opacity: 0.85;
  filter: drop-shadow(0 6px 10px rgba(80, 130, 180, 0.18));
}
.bg-deco .c1 { top: 6%;  left: 4%;  animation: cloudDrift 26s ease-in-out infinite; }
.bg-deco .c2 { top: 20%; left: 58%; font-size: 42px; animation: cloudDrift 34s ease-in-out infinite reverse; }
.bg-deco .c3 { top: 46%; left: 12%; font-size: 34px; animation: cloudDrift 30s ease-in-out infinite; }
@keyframes cloudDrift {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(46px) translateY(-14px); }
}
.bg-deco .bubble {
  position: absolute;
  bottom: -60px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 32% 30%, rgba(255,255,255,0.9), rgba(150, 225, 255, 0.35));
  animation: bubbleUp linear infinite;
}
.bg-deco .b1 { left: 8%;  width: 26px; height: 26px; animation-duration: 13s; }
.bg-deco .b2 { left: 46%; width: 18px; height: 18px; animation-duration: 17s; animation-delay: 4s; }
.bg-deco .b3 { left: 82%; width: 34px; height: 34px; animation-duration: 15s; animation-delay: 8s; }
@keyframes bubbleUp {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.75; }
  100% { transform: translateY(-108vh) scale(1.1); opacity: 0; }
}

/* ===================================================
   首页
   =================================================== */
#screen-home {
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  z-index: 1;
}
.home-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 30px 26px;
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.72);
  border: var(--border-w) solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 46px rgba(60, 90, 140, 0.22);
  backdrop-filter: blur(6px);
  max-width: 720px;
  margin: auto;
}

.game-kicker {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fff;
  background: var(--purple);
  padding: 5px 16px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--purple-d);
}

.game-title {
  margin: 12px 0 2px;
  font-size: clamp(34px, 6.2vw, 60px);
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 2px;
}
.game-title span { color: var(--ink); }
.game-title em {
  font-style: normal;
  display: inline-block;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 rgba(255, 95, 95, 0.9);
  transform: rotate(-3deg);
}
.game-sub {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* 主视觉插画 */
.home-hero {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: min(38vh, 320px);
  margin: 10px 0 14px;
}
.hero-art {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 22px;
  border: 4px solid #fff;
  box-shadow: 0 12px 26px rgba(54, 48, 77, 0.22);
  overflow: hidden;
}
.hero-art > img { object-position: center bottom; }

.hero-star {
  position: absolute;
  font-size: 26px;
  color: #fff;
  animation: starTwinkle 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 217, 61, 0.9));
  z-index: 2;
}
.hero-star.s1 { left: 14%; top: 18%; }
.hero-star.s2 { right: 12%; top: 34%; animation-delay: 0.8s; }
@keyframes starTwinkle {
  0%, 100% { transform: scale(0.7) rotate(0); opacity: 0.4; }
  50%      { transform: scale(1.2) rotate(20deg); opacity: 1; }
}

/* 按钮组 */
.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 6px;
}
.home-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ===================================================
   通用页头（地图 / 勋章 / 错题本）
   =================================================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin-bottom: 12px;
}
.page-head h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}
.head-badge {
  font-size: 15px;
  font-weight: 800;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 4px 0 rgba(54, 48, 77, 0.2);
}
.map-note {
  flex: 0 0 auto;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-soft);
  padding: 10px;
}

/* ===================================================
   加载页
   =================================================== */
#boot {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 45%, var(--sky3) 78%, #e8ffd8 100%);
  transition: opacity 0.5s ease;
}
#boot.done { opacity: 0; pointer-events: none; }

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.boot-art {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 5px solid #fff;
  box-shadow: 0 12px 26px rgba(54, 48, 77, 0.25), 0 0 0 9px rgba(255, 255, 255, 0.5);
  animation: bootBob 1.7s ease-in-out infinite;
}
@keyframes bootBob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}
.boot-text {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink);
}
.boot-bar {
  width: min(320px, 68vw);
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 4px 0 rgba(54, 48, 77, 0.18);
}
.boot-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(115deg, var(--mint) 0 12px, #8ff0d8 12px 24px);
  transition: width 0.25s ease;
}

/* ===================================================
   插画与图标通用规则
   ---------------------------------------------------
   所有插画都塞进自己的容器里：不变形、不撑破布局
   =================================================== */
.art { display: block; }

.art > img,
.lv-icon > img,
img.node-art,
img.avatar-art,
img.medal-art,
img.mc-art,
img.ending-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
}

/* 内联 SVG 图标：始终跟随父级字号 */
.ico {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.12em;
  flex: 0 0 auto;
}

/* ---------- 矮屏微调 ---------- */
@media (max-height: 560px) {
  .boot-art { width: 92px; height: 92px; }
  .boot-text { font-size: 14px; }
  .home-wrap { padding: 16px 20px 18px; border-radius: 26px; }
  .home-hero { max-height: 30vh; }
}
