/* 悠悠公园 —— 奶油马卡龙风（参考磨耳乐园风格） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --ink: #4a4458;
  --ink-soft: #71698a;
  --paper: #fff9ee;
  --paper-2: #fff4e3;
  --green: #6fce87;
  --green-dark: #4fae68;
  --pink: #f66;
  --shadow: 0 10px 24px rgba(80, 60, 110, 0.18), 0 3px 8px rgba(80, 60, 110, 0.12);
  --r-lg: 26px;
}
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #a9d8ef 0%, #bcdfe4 38%, #d8ecd7 70%, #eef4d9 100%);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

#video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; visibility: hidden; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; }

/* ---------- 通用页面层 ---------- */
.page {
  position: fixed; inset: 0; z-index: 10;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.overlay { background: rgba(40, 32, 60, 0.35); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 18px; }

/* ---------- 首页 ---------- */
#home .home-wrap { max-width: 1020px; margin: 0 auto; padding: 22px 20px 46px; }
.lang-switch { position: fixed; top: 14px; right: 14px; z-index: 20; display: flex; gap: 6px; }
.lang-btn {
  border: none; background: var(--paper); color: var(--ink);
  padding: 7px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(90, 70, 120, 0.18);
}
.lang-btn.active { background: var(--ink); color: var(--paper); }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; font-size: 19px; color: var(--ink); margin-bottom: 24px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; background: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; font-size: 21px;
  box-shadow: 0 3px 8px rgba(90, 70, 120, 0.18);
}
.brand small { font-weight: 600; color: var(--ink-soft); font-size: 12px; margin-left: 4px; letter-spacing: 0.4px; }

.hero { text-align: center; padding-top: 12px; }
.hero-tag {
  display: inline-block; background: rgba(255, 249, 238, 0.8); color: var(--ink-soft);
  font-weight: 700; font-size: 13px; padding: 5px 14px; border-radius: 999px; margin-bottom: 13px;
}
#hero-title {
  font-size: clamp(26px, 5vw, 40px); font-weight: 900; line-height: 1.3;
  max-width: 640px; margin: 0 auto 13px; color: var(--ink);
}
.hero-sub { color: var(--ink-soft); font-size: clamp(14px, 2.4vw, 16.5px); max-width: 560px; margin: 0 auto 22px; line-height: 1.65; }
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; font-weight: 800; font-size: 16.5px;
  padding: 13px 30px; color: var(--ink); text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cta:active { transform: scale(0.96); }
.cta-green { background: var(--green); color: #143a1e; box-shadow: 0 5px 0 var(--green-dark), 0 12px 20px rgba(79, 174, 104, 0.35); }
.cta-green:hover { transform: translateY(-2px); }
.cta-white { background: var(--paper); box-shadow: 0 5px 0 #e8d9be, 0 12px 20px rgba(90, 70, 120, 0.16); }
.cta-white:hover { transform: translateY(-2px); }
.cta-small { padding: 10px 22px; font-size: 14.5px; }
.cta-play { width: 96px; height: 96px; padding: 0; border-radius: 50%; font-size: 30px; }
.cta-play .tri { margin-left: 6px; font-size: 34px; }

.sec-title { margin: 42px 0 18px; text-align: center; font-size: clamp(20px, 3.4vw, 25px); font-weight: 900; }
.steps .sec-title { color: var(--ink); }

.step-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .step-cards { grid-template-columns: 1fr; } }
.step-card {
  background: var(--paper); border-radius: var(--r-lg); padding: 22px 20px 20px;
  box-shadow: var(--shadow); position: relative; text-align: left;
}
.step-num {
  position: absolute; top: -13px; left: 18px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--pink); color: #fff; font-weight: 900;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  box-shadow: 0 4px 8px rgba(240, 90, 90, 0.4);
}
.step-card h3 { font-size: 17px; margin-bottom: 8px; }
.step-card p { color: var(--ink-soft); font-size: 13.6px; line-height: 1.7; }

#pick { scroll-margin-top: 10px; }
#game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
@media (max-width: 760px) { #game-grid { grid-template-columns: repeat(2, 1fr); } }
.game-card {
  border: none; background: var(--paper); border-radius: var(--r-lg);
  padding: 18px 12px 15px; text-align: center; color: var(--ink);
  box-shadow: var(--shadow); transition: transform 0.14s ease, box-shadow 0.14s ease;
  display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative;
}
.game-card:hover { transform: translateY(-4px) scale(1.02); }
.game-card .glow {
  width: 74px; height: 74px; border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 5px; background: var(--card-color, #ffe9d2);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.06);
}
.game-card .name { font-size: 16.5px; font-weight: 800; }
.game-card .desc { font-size: 12px; color: var(--ink-soft); line-height: 1.55; min-height: 36px; }
.game-card .best {
  font-size: 11.5px; font-weight: 700; color: #fff; background: var(--ink);
  padding: 3px 10px; border-radius: 999px; margin-top: 2px;
}
.game-card .best.zero { background: #cfc7dc; color: #6b637f; }

.safe-note { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 40px; }
.home-foot { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 14px; padding-bottom: 8px; opacity: 0.85; }

/* ---------- 面板（设置/错误/结算） ---------- */
.panel {
  background: var(--paper); border-radius: 30px; padding: 30px 28px 26px;
  width: min(480px, 94vw); margin: 40px auto; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 15px; align-items: center;
  position: relative;
}
@media (max-width: 560px) { .panel { margin: 18px auto; padding: 24px 18px 20px; } }

/* 设置页 */
.setup-panel { width: min(520px, 94vw); }
.corner-back { position: absolute; top: 14px; right: 14px; }
.setup-head { display: flex; gap: 16px; align-items: center; width: 100%; }
.setup-icon {
  width: 88px; height: 88px; min-width: 88px; border-radius: 24px; font-size: 46px;
  display: flex; align-items: center; justify-content: center; background: var(--card-color, #ffe9d2);
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.07);
}
.setup-titles h2 { font-size: 27px; font-weight: 900; margin-bottom: 6px; }
.tag-row { display: flex; gap: 7px; flex-wrap: wrap; }
.tag {
  font-size: 12px; font-weight: 800; padding: 4px 11px; border-radius: 999px;
  background: var(--tag-bg, #ffe1e6); color: var(--tag-ink, #d64562);
}

.howto { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 9px; }
.howto li {
  display: flex; gap: 12px; align-items: flex-start; background: var(--paper-2);
  border-radius: 16px; padding: 12px 15px; font-size: 14.5px; font-weight: 600; line-height: 1.6;
}
.howto .num {
  min-width: 26px; height: 26px; border-radius: 50%; margin-top: 1px;
  background: var(--pink); color: #fff; font-weight: 900; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center;
}
.train-line, .best-line { font-size: 12.5px; color: var(--ink-soft); width: 100%; text-align: center; }
.hint { font-size: 12px; color: #b8aecc; text-align: center; }

/* 体态检测层 */
.check-layer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; justify-content: center; pointer-events: none;
}
.check-card {
  pointer-events: auto; background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 16px 22px 18px; width: min(430px, 96vw); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center;
}
.check-card h3 { font-size: 21px; font-weight: 900; color: var(--green-dark); }
.check-card p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; }
.check-btns { display: flex; gap: 10px; }

/* 摄像头错误 */
.err-icon {
  width: 84px; height: 84px; border-radius: 50%; background: #ffe4e6;
  display: flex; align-items: center; justify-content: center; font-size: 40px;
}
.tips { width: 100%; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tips li {
  background: var(--paper-2); border-radius: 14px; padding: 11px 14px;
  font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); display: flex; gap: 8px;
}
.tips li::before { content: '💡'; }

/* 加载 */
.loading-panel { gap: 12px; }
.loading-icon { font-size: 60px; line-height: 1.1; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 5px solid #ffe3c9; border-top-color: var(--pink);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--ink-soft); font-weight: 700; }

/* 结算 */
.over-title { font-size: 40px; font-weight: 900; color: var(--pink); text-shadow: 0 2px 0 #fff; }
.stars-row { display: flex; gap: 8px; font-size: 44px; line-height: 1; }
.stars-row .s { filter: grayscale(1); opacity: 0.25; transform: scale(0.85); transition: all .35s ease; }
.stars-row .s.on { filter: none; opacity: 1; transform: scale(1.15); animation: starPop .45s ease; }
@keyframes starPop { 0% { transform: scale(0.2); } 60% { transform: scale(1.45); } 100% { transform: scale(1.15); } }
.over-score b { font-size: 62px; font-weight: 900; color: var(--ink); }
.over-score span { font-size: 18px; color: var(--ink-soft); margin-left: 6px; }
.over-best { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.over-best .nb { display: inline-block; background: var(--pink); color: #fff; font-size: 12px; padding: 2.5px 10px; border-radius: 999px; margin-left: 6px; animation: blink 1s ease infinite alternate; }
@keyframes blink { from { transform: scale(1); } to { transform: scale(1.08); } }
.over-extra { font-size: 13px; color: var(--green-dark); font-weight: 700; min-height: 18px; }

/* ---------- 游戏 HUD ---------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 12;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px; pointer-events: none;
}
#hud-left { display: flex; gap: 10px; align-items: center; }
.hud-mid { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; }
.hud-right { display: flex; gap: 10px; align-items: center; }
.chip {
  pointer-events: auto; border: none; background: var(--paper); color: var(--ink);
  border-radius: 16px; font-weight: 800; box-shadow: var(--shadow);
}
.icon-btn { width: 46px; height: 46px; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; border-radius: 16px; }
.icon-btn:active { transform: scale(0.93); }
/* 参考设计里的右上角圆形按钮（音量 / 最大化 / 设置） */
.round-btn {
  width: 52px; height: 52px; border-radius: 50%;
  font-size: 22px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); box-shadow: var(--shadow);
}
.round-btn:active { transform: scale(0.93); }
#game.off { visibility: hidden; }
@media (max-width: 700px) {
  .round-btn { width: 42px; height: 42px; font-size: 18px; }
}
.game-chip { height: 46px; padding: 0 18px; font-size: 17px; display: inline-flex; align-items: center; gap: 8px; }
.game-chip b { color: var(--pink); }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 52px; border-radius: 18px; padding: 0 20px;
}
.score-pill { background: var(--paper); box-shadow: var(--shadow); }
.score-pill i { font-style: normal; font-size: 22px; }
.score-pill b { font-size: 28px; font-weight: 900; }
.time-pill { background: #6c5b78; color: var(--paper); box-shadow: var(--shadow); }
.time-pill b { font-size: 24px; font-weight: 800; }
.time-pill.urgent { background: var(--pink); animation: blink .6s ease infinite alternate; }

@media (max-width: 700px) {
  .game-chip { display: none; }
  .hud-mid { position: static; transform: none; }
  .icon-btn { width: 40px; height: 40px; font-size: 17px; }
  .round-btn { width: 42px; height: 42px; font-size: 18px; }
  .pill { height: 44px; padding: 0 14px; }
  .score-pill b { font-size: 22px; }
  #hero-title { padding: 0 6px; }
}

/* ---------- 游戏内设置弹窗 ---------- */
.modal-layer {
  background: rgba(40, 32, 60, 0.45);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.settings-panel { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; min-width: 300px; }
.settings-panel h2 { color: var(--pink); font-size: 30px; font-weight: 900; }
.set-sub { color: var(--ink-soft); font-weight: 700; }
.diff-row { display: flex; gap: 12px; }
.diff-btn {
  border: none; background: var(--paper-2); color: var(--ink);
  border-radius: 22px; padding: 14px 20px; font-size: 18px; font-weight: 900;
  box-shadow: var(--shadow); display: inline-flex; align-items: center; gap: 6px;
}
.diff-btn.active { background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-dark, #d64a6a), 0 12px 20px rgba(214, 80, 110, 0.35); }
.set-note { font-size: 12.5px; color: var(--ink-soft); }
