/* ============================================================
   咕咕嘎嘎的勋章收集 — 样式表
   浅米色柔和背景 / 圆润可爱卡通风 / 移动端竖屏优先
   ============================================================ */

:root {
  --cream:        #F7F1E4;
  --cream-deep:   #EFE6D2;
  --card:         #FFFBF2;
  --ink:          #6B5B46;
  --ink-soft:     #A2937C;
  --accent:       #F0A868;
  --accent-deep:  #DE8F4C;
  --pink:         #F2878E;
  --blue:         #8FC9D8;
  --mint:         #8FCFB4;
  --shadow:       0 8px 20px rgba(150, 125, 90, .18);
  --radius:       26px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          "Heiti SC", "Noto Sans CJK SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { position: fixed; inset: 0; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%,  #FDF8EE 0%, var(--cream) 55%, var(--cream-deep) 100%);
}

/* ---------- 界面切换 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 18px
           calc(16px + env(safe-area-inset-bottom));
  animation: screenIn .28s ease both;
}
.screen.is-active { display: flex; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 通用按钮 ---------- */
.btn {
  font-family: var(--font);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  border-radius: 999px;
  padding: 15px 40px;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
  touch-action: manipulation;
  user-select: none;
}
.btn:active { transform: scale(.94); }

.btn--primary {
  background: linear-gradient(180deg, #F7BC7E 0%, var(--accent-deep) 100%);
  color: #fff;
  box-shadow: 0 6px 0 #C87A3C, 0 12px 22px rgba(190, 130, 70, .3);
}
.btn--primary:active { box-shadow: 0 3px 0 #C87A3C, 0 6px 12px rgba(190, 130, 70, .28); }

.btn--ghost {
  background: var(--card);
  color: var(--accent-deep);
  box-shadow: 0 5px 0 #E3D6BC, 0 10px 18px rgba(150, 125, 90, .14);
  border: 2px solid #EFE2C8;
}
.btn--ghost:active { box-shadow: 0 2px 0 #E3D6BC, 0 5px 10px rgba(150, 125, 90, .12); }

/* ============================================================
   开始界面
   ============================================================ */
.home__inner {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home__char {
  width: min(56vw, 220px);
  aspect-ratio: 488 / 940;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: floaty 3.4s ease-in-out infinite;
}
.home__char img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 12px 18px rgba(150, 125, 90, .22));
}

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

.home__title {
  margin: 18px 0 26px;
  font-size: clamp(25px, 7.2vw, 34px);
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--ink);
  text-align: center;
  text-shadow: 0 3px 0 #fff, 0 5px 12px rgba(150, 125, 90, .18);
}

.home__buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
  max-width: 260px;
}

.home__badge {
  margin-top: 30px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 251, 242, .82);
  border-radius: 999px;
  padding: 9px 22px;
  box-shadow: inset 0 0 0 2px #F0E5CE;
}
.home__badge span { color: var(--accent-deep); font-size: 18px; }

.home__tip {
  margin-top: 16px;
  font-size: 12.5px;
  color: #BCAE95;
  letter-spacing: .5px;
}

/* ============================================================
   小衣橱
   ============================================================ */
.wardrobe {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wardrobe__title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 22px;
  text-shadow: 0 3px 0 #fff;
}

.wardrobe__list {
  display: flex;
  flex-direction: row;
  gap: 12px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 12px;
  scrollbar-width: none;
}
.wardrobe__list::-webkit-scrollbar { display: none; }

.skin-card {
  flex: 0 0 auto;
  width: 30%;
  max-width: 132px;
  min-width: 104px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 8px 14px;
  text-align: center;
  cursor: pointer;
  border: 3px solid transparent;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, opacity .16s ease;
  position: relative;
}
.skin-card:active { transform: scale(.96); }

.skin-card.is-unlocked { border-color: #F5D9AE; }
.skin-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(240, 168, 104, .22), var(--shadow);
}

.skin-card__figure {
  position: relative;
  width: 100%;
  aspect-ratio: 488 / 940;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 8px;
  padding-bottom: 16px;   /* 给锁定图标留位 */
}
.skin-card__figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 5px 8px rgba(150, 125, 90, .2));
}

.skin-card.is-locked { opacity: .95; cursor: not-allowed; }
.skin-card.is-locked .skin-card__figure img { filter: grayscale(.94) brightness(1.08); }
.skin-card.is-locked .skin-card__name { color: var(--ink-soft); }

.skin-card__lock {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  width: 26%;
  filter: drop-shadow(0 3px 5px rgba(120, 100, 70, .32));
}

.skin-card__name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.35;
}

.skin-card__cond {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}
.skin-card.is-unlocked .skin-card__cond { color: var(--accent-deep); }

.skin-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
}
.skin-card.is-selected .skin-card__check { display: flex; }

.btn--back { margin-top: 18px; }

/* ============================================================
   游戏界面
   ============================================================ */
.screen--game { justify-content: flex-start; padding: 0; }

.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
  pointer-events: none;
}

.hud__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 1px;
  letter-spacing: 1px;
}
.hud__score {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  text-shadow: 0 2px 0 #fff, 0 4px 10px rgba(150, 125, 90, .2);
}

.hud__left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hud__combo {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: var(--pink);
  letter-spacing: .5px;
  background: rgba(255, 251, 242, .9);
  border-radius: 999px;
  padding: 2px 10px;
  box-shadow: 0 2px 6px rgba(150, 125, 90, .16);
  opacity: 0;
  transform: scale(.7);
  transition: opacity .2s ease, transform .2s ease;
}
.hud__combo.is-on { opacity: 1; transform: none; }

.hud__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.lives { display: flex; gap: 4px; }
.lives img {
  width: 25px;
  height: 25px;
  filter: drop-shadow(0 2px 3px rgba(150, 125, 90, .25));
  transition: transform .2s ease, opacity .2s ease;
}
.lives img.is-lost { opacity: .26; transform: scale(.8); filter: grayscale(1); }

.buffs { display: flex; gap: 6px; }
.buff {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 251, 242, .9);
  border-radius: 999px;
  padding: 3px 8px 3px 4px;
  box-shadow: 0 2px 6px rgba(150, 125, 90, .16);
  animation: buffIn .22s ease both;
}
.buff img { width: 19px; height: 19px; }
.buff__time {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
@keyframes buffIn { from { transform: scale(.5); opacity: 0; } to { transform: none; opacity: 1; } }

.stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.stage__items { position: absolute; inset: 0; }

.item {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  filter: drop-shadow(0 6px 8px rgba(150, 125, 90, .22));
  pointer-events: none;
}
.item img { display: block; width: 100%; height: 100%; }

.stage__player {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 92px;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  pointer-events: none;
  z-index: 10;
}
.stage__player img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 14px rgba(150, 125, 90, .26));
}
.stage__player.is-hit { animation: playerHit .32s ease; }
@keyframes playerHit {
  0%, 100% { filter: drop-shadow(0 10px 14px rgba(150, 125, 90, .26)); }
  30%      { filter: drop-shadow(0 10px 14px rgba(150, 125, 90, .26)) hue-rotate(-25deg) brightness(1.15); }
}

.stage__shield {
  position: absolute;
  left: 50%;
  top: 34%;
  width: 118%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(143, 201, 216, .28) 45%, rgba(143, 201, 216, 0) 70%);
  border-radius: 50%;
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
}
.stage__player.has-shield .stage__shield { opacity: 1; }

.stage__fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.float-score {
  position: absolute;
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-deep);
  text-shadow: 0 2px 0 #fff, 0 3px 8px rgba(150, 125, 90, .3);
  animation: floatUp .85s ease-out forwards;
  white-space: nowrap;
}
.float-score.is-bonus { color: var(--pink); }
@keyframes floatUp {
  0%   { transform: translate(-50%, 0) scale(.6); opacity: 0; }
  22%  { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -62px) scale(1); opacity: 0; }
}

.combo-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 900;
  color: var(--pink);
  text-shadow: 0 3px 0 #fff, 0 6px 16px rgba(200, 110, 120, .4);
  animation: comboPop .95s cubic-bezier(.2, 1.4, .4, 1) forwards;
  white-space: nowrap;
  z-index: 12;
}
@keyframes comboPop {
  0%   { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; }
  25%  { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; }
  70%  { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%, -90px) scale(.9); opacity: 0; }
}

.stage__banner {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  z-index: 14;
  padding: 12px 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,251,242,.97), rgba(250,240,222,.97));
  box-shadow: 0 8px 22px rgba(150, 125, 90, .26);
  font-size: 17px;
  font-weight: 800;
  color: var(--accent-deep);
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.stage__banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }

/* ============================================================
   结束界面
   ============================================================ */
.over {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.over__title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 26px;
  text-shadow: 0 3px 0 #fff, 0 5px 14px rgba(150, 125, 90, .2);
}

.over__stats {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 30px;
}

.stat {
  background: var(--card);
  border-radius: 20px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  border: 2px solid #F3E9D6;
}
.stat__value {
  font-size: 27px;
  font-weight: 800;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
}

.over__buttons {
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: 100%;
  max-width: 250px;
}

/* ============================================================
   适配
   ============================================================ */
@media (min-width: 560px) and (min-height: 620px) {
  #app { max-width: 460px; }
  .stage__player { width: 108px; }
}

@media (max-height: 620px) {
  .home__char { width: min(42vw, 168px); }
  .home__title { margin: 12px 0 18px; }
  .home__badge { margin-top: 18px; }
}

@media (hover: hover) {
  .btn:hover { filter: brightness(1.05); }
}
