:root{
  --bg1:#ffe1ec;
  --bg2:#e3d9ff;
  --card:#fffaf5;
  --primary:#ff6f9c;
  --primary-dark:#ff4d85;
  --accent:#8b6bff;
  --good:#2ecc71;
  --bad:#ff4d5e;
  --gold:#e0a800;
  --text:#4a3b52;
  --text-soft:#8a7a92;
  --shadow:0 20px 50px rgba(90,40,70,.25);
  --font-num:'Segoe UI','Helvetica Neue',Helvetica,Arial,'PingFang SC','Microsoft YaHei',sans-serif;
}

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html,body{ height:100%; }
body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:'ZCOOL KuaiLe','PingFang SC','Microsoft YaHei',sans-serif;
  background:
    radial-gradient(circle at 20% 20%, var(--bg1), transparent 60%),
    radial-gradient(circle at 80% 80%, var(--bg2), transparent 60%),
    linear-gradient(160deg,#fdf2f8,#f1e9ff);
  color:var(--text);
  overflow:hidden;
  user-select:none;
}

.phone-frame{
  position:relative;
  width:min(440px,94vw);
  height:min(780px,94vh);
  background:var(--card);
  border-radius:32px;
  overflow:hidden;
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
  border:6px solid #fff;
}

/* ---------- HUD ---------- */
.hud{
  display:flex;
  align-items:center;
  gap:8px;
  padding:14px 14px 6px;
  z-index:6;
}
.hud-item{
  background:rgba(255,255,255,.7);
  border-radius:14px;
  padding:6px 10px;
  display:flex;
  flex-direction:column;
  align-items:center;
  min-width:52px;
  box-shadow:0 2px 8px rgba(0,0,0,.06);
}
.hud-item .label{ font-size:10px; color:var(--text-soft); white-space:nowrap; }
.hud-item .value{ font-family:var(--font-num); font-size:17px; font-weight:700; color:var(--text); }
.hud-item.score{ flex:1; }
.hud-item.timer.warning .value{ color:var(--bad); animation:pulseWarn .5s infinite; }

.hud-icons{ margin-left:auto; display:flex; gap:6px; flex-shrink:0; }
.icon-btn{
  width:34px; height:34px;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,.7);
  font-size:15px;
  cursor:pointer;
  box-shadow:0 2px 8px rgba(0,0,0,.06);
  flex-shrink:0;
}
.icon-btn:active{ transform:scale(.92); }

/* ---------- Goal progress ---------- */
.goal-bar{
  height:8px;
  margin:0 16px 6px;
  background:rgba(0,0,0,.08);
  border-radius:6px;
  overflow:hidden;
  flex-shrink:0;
}
.goal-fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg,var(--accent),var(--primary));
  border-radius:6px;
  transition:width .25s ease;
}
.goal-fill.reached{
  background:linear-gradient(90deg,#ffd166,#ff9f1c);
  animation:pulseWarn .6s infinite;
}

.sub-bar{
  text-align:center;
  padding:0 12px 8px;
  min-height:18px;
  z-index:6;
}
.round-hint{
  font-size:12px;
  color:var(--accent);
  line-height:1.4;
}

/* ---------- Props dock ----------
   Its own row below the arena (not floating over it) — items can drift to
   the bottom of the play area, and an overlaid dock there caused misclicks
   between tapping a clothing item and tapping a prop button. */
.props-dock{
  display:flex;
  justify-content:center;
  gap:12px;
  padding:2px 12px 10px;
  flex-shrink:0;
  z-index:6;
}

.prop-btn{
  position:relative;
  width:46px; height:46px;
  border-radius:50%;
  border:none;
  background:rgba(255,255,255,.92);
  font-size:21px;
  box-shadow:0 4px 10px rgba(90,40,70,.22);
  cursor:pointer;
  flex-shrink:0;
}
.prop-btn:active{ transform:scale(.9); }
.prop-btn.empty{ opacity:.45; background:rgba(255,255,255,.55); }
.prop-btn.active{ box-shadow:0 0 0 3px var(--accent), 0 4px 10px rgba(90,40,70,.22); }
.prop-btn .prop-count{
  position:absolute; bottom:-3px; right:-3px;
  background:var(--primary-dark); color:#fff;
  font-family:var(--font-num); font-size:10px; font-weight:700;
  border-radius:8px; padding:1px 5px; line-height:1.3;
  box-shadow:0 1px 3px rgba(0,0,0,.25);
  min-width:13px;
}
.prop-btn.empty .prop-count{ background:var(--text-soft); }

/* ---------- Arena ---------- */
.arena{
  position:relative;
  flex:1;
  margin:0 10px 10px;
  border-radius:22px;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,255,255,.9), transparent 40%),
    linear-gradient(180deg,#fff7fb,#f4eeff);
  overflow:hidden;
  touch-action:none;
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.6);
}
.arena.shake{ animation:shakeArena .28s ease; }

.item{
  position:absolute;
  left:0; top:0;
  display:flex;
  align-items:center;
  justify-content:center;
  touch-action:none;
  cursor:pointer;
}
.item .glyph{
  display:inline-block;
  line-height:1;
  filter:drop-shadow(0 5px 6px rgba(90,40,70,.28));
  transition:opacity .22s ease, transform .22s ease;
  pointer-events:none;
}
.glyph.correct-pop{ animation:popScale .3s ease forwards; }
.glyph.fading{ opacity:0; transform:scale(.55); }
.glyph.wrong-flash{ animation:wrongFlash .3s ease; }
.glyph.shiny{ animation:shinyPulse 1s ease-in-out infinite; }
.glyph.hint-glow{ animation:hintPulse .5s ease-in-out 3; }
.glyph.trap-flicker{ animation:trapFlicker .5s ease-in-out; }

/* ---------- Mascot easter-egg ---------- */
.mascot{
  position:absolute;
  left:0; top:0;
  font-size:30px;
  line-height:1;
  cursor:pointer;
  z-index:9;
  filter:drop-shadow(0 4px 6px rgba(0,0,0,.25));
  animation:mascotBob .4s ease-in-out infinite alternate;
}

/* ---------- Fog obstruction ----------
   Uses backdrop-filter to blur whatever drifts underneath it (the clothes),
   not just its own translucent shape — a plain semi-transparent white blob
   was invisible against the near-white arena background. */
.fog{
  position:absolute;
  left:-200px;
  width:190px; height:190px;
  border-radius:50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(200,190,225,.65), rgba(200,190,225,.3) 45%, rgba(200,190,225,0) 72%);
  backdrop-filter:blur(9px);
  -webkit-backdrop-filter:blur(9px);
  border:1px solid rgba(255,255,255,.5);
  pointer-events:none;
  z-index:7;
  animation-name:fogDrift;
  animation-timing-function:linear;
  animation-fill-mode:forwards;
}

.fx-layer{ position:absolute; inset:0; pointer-events:none; z-index:8; }
.fx-pop{
  position:absolute;
  font-family:var(--font-num);
  font-weight:800;
  font-size:17px;
  transform:translate(-50%,-50%);
  animation:fxFloat .72s ease forwards;
  white-space:nowrap;
}
.fx-pop.good{ color:var(--good); text-shadow:0 1px 2px rgba(0,0,0,.15); }
.fx-pop.bad{ color:var(--bad); text-shadow:0 1px 2px rgba(0,0,0,.15); }
.fx-pop.shiny{ color:var(--gold); text-shadow:0 1px 2px rgba(0,0,0,.15); }
.fx-pop.combo{
  font-size:24px;
  color:var(--accent);
  text-shadow:0 2px 4px rgba(0,0,0,.2);
  animation:fxFloatBig .9s ease forwards;
}

/* ---------- Overlays ---------- */
.overlay{
  position:absolute; inset:0;
  background:rgba(60,30,50,.45);
  backdrop-filter:blur(3px);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:10;
  padding:20px;
}
.overlay.hidden{ display:none; }
#shopOverlay{ z-index:20; }

.overlay-card{
  background:var(--card);
  border-radius:24px;
  padding:26px 24px;
  text-align:center;
  width:100%;
  max-width:320px;
  max-height:92%;
  overflow-y:auto;
  box-shadow:0 20px 40px rgba(0,0,0,.25);
}
.game-logo{ font-size:40px; margin-bottom:6px; }
.overlay-card h1{ font-size:24px; color:var(--primary-dark); margin-bottom:10px; }
.tagline{ font-size:13.5px; color:var(--text-soft); line-height:1.6; margin-bottom:14px; }
.tagline strong{ color:var(--primary-dark); }

.stat-row{
  display:flex; justify-content:center; gap:20px;
  font-size:12.5px; color:var(--text-soft);
  margin-bottom:8px;
}
.stat-row b{ font-family:var(--font-num); color:var(--text); font-size:14px; }

.best-score{ font-size:13px; color:var(--accent); margin-bottom:16px; }
.best-score span{ font-family:var(--font-num); font-weight:700; }

.level-badge{
  display:inline-block;
  background:linear-gradient(135deg,var(--accent),#6a4cff);
  color:#fff; font-size:13px; font-weight:700;
  padding:5px 16px; border-radius:999px;
  margin-bottom:10px;
  font-family:var(--font-num);
}
.level-badge.special{
  background:linear-gradient(135deg,#ff8a3d,#ff4d4d);
  animation:pulseWarn 1s infinite;
}

.story-box{
  display:flex; align-items:center; gap:10px;
  background:rgba(255,111,156,.08);
  border-radius:14px;
  padding:10px 12px;
  margin-bottom:14px;
  text-align:left;
}
.story-avatar{ font-size:30px; flex-shrink:0; }
.story-place{ font-size:10px; color:var(--accent); font-weight:700; margin-bottom:2px; }
.story-line{ font-size:12.5px; color:var(--text); line-height:1.4; }

.story-mood{ font-size:34px; margin-bottom:4px; }

.goal-info{
  display:flex; justify-content:center; gap:18px;
  font-size:13px; color:var(--text-soft);
  margin-bottom:12px;
}
.goal-info b{ font-family:var(--font-num); color:var(--text); }

.mechanic-tip{
  display:none;
  background:#fff2cc; color:#7a5b00;
  border-radius:12px; padding:9px 11px;
  font-size:11.5px; line-height:1.5;
  margin-bottom:14px;
  text-align:left;
}
.mechanic-tip.show{ display:block; }

.props-row{
  display:flex; justify-content:center; gap:10px;
  flex-wrap:wrap;
  margin-bottom:16px;
}
.props-row .mini-prop{
  display:flex; flex-direction:column; align-items:center;
  font-size:18px;
  background:rgba(139,107,255,.1);
  border-radius:12px;
  padding:6px 10px;
  min-width:40px;
}
.props-row .mini-prop span{
  font-family:var(--font-num); font-size:11px; font-weight:700;
  color:var(--text-soft); margin-top:2px;
}
.props-row .empty-note{ font-size:11.5px; color:var(--text-soft); }

.primary-btn{
  width:100%;
  padding:14px;
  border:none;
  border-radius:999px;
  background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  color:#fff;
  font-size:17px;
  font-weight:700;
  box-shadow:0 10px 20px rgba(255,77,133,.4);
  cursor:pointer;
  font-family:inherit;
  transition:transform .15s ease;
}
.primary-btn:active{ transform:scale(.96); }
.primary-btn.hidden{ display:none; }

.ghost-btn{
  width:100%;
  padding:11px;
  margin-top:10px;
  border-radius:999px;
  border:2px solid var(--primary);
  background:transparent;
  color:var(--primary-dark);
  font-size:14px; font-weight:700;
  cursor:pointer;
  font-family:inherit;
}
.ghost-btn:active{ transform:scale(.97); }

.text-link{
  display:block;
  background:none; border:none;
  color:var(--text-soft);
  font-size:11px; text-decoration:underline;
  cursor:pointer;
  margin:14px auto 0;
  font-family:inherit;
}

.hint-small{ font-size:11px; color:var(--text-soft); margin-top:12px; }

.result-row{
  display:flex;
  justify-content:space-between;
  font-size:14px;
  color:var(--text-soft);
  margin-bottom:8px;
  padding:0 4px;
}
.result-row span{ font-family:var(--font-num); font-weight:700; color:var(--text); }
.result-row.coins span{ color:var(--gold); }
.result-row.best{
  display:none;
  justify-content:center;
  color:var(--primary-dark);
  font-weight:800;
  font-size:14px;
  margin:10px 0;
}
.result-row.best.show{ display:flex; }

.stars-row{ font-size:32px; letter-spacing:6px; margin-bottom:12px; }

.revive-choice{ margin-top:6px; }
.revive-choice.hidden{ display:none; }
.revive-note{ font-size:12.5px; color:var(--text-soft); margin-bottom:8px; }
.revive-note b{ font-family:var(--font-num); color:var(--primary-dark); }
.no-revive-hint{ margin-top:6px; }
.no-revive-hint.hidden{ display:none; }
.no-revive-hint p{ font-size:12.5px; color:var(--text-soft); margin-bottom:6px; }

/* ---------- Shop ---------- */
.shop-card{ max-width:340px; }
.coin-balance{
  font-size:17px; color:var(--gold); font-weight:700;
  margin-bottom:14px;
}
.coin-balance span{ font-family:var(--font-num); }
.shop-list{ text-align:left; margin-bottom:14px; }
.shop-row{
  display:flex; align-items:center; gap:10px;
  background:rgba(139,107,255,.08);
  border-radius:14px; padding:10px 12px; margin-bottom:8px;
}
.shop-row .icon{ font-size:26px; flex-shrink:0; }
.shop-row .info{ flex:1; min-width:0; }
.shop-row .info .name{ font-size:14px; font-weight:700; color:var(--text); }
.shop-row .info .desc{ font-size:11px; color:var(--text-soft); line-height:1.4; }
.shop-row .info .owned{ font-size:10px; color:var(--accent); font-family:var(--font-num); margin-top:2px; }
.shop-row .buy-btn{
  border:none; border-radius:999px;
  background:linear-gradient(135deg,var(--primary),var(--primary-dark));
  color:#fff; font-family:var(--font-num); font-size:12px; font-weight:700;
  padding:8px 13px; cursor:pointer; white-space:nowrap; flex-shrink:0;
}
.shop-row .buy-btn:disabled{ background:#cbc3d1; cursor:not-allowed; }
.shop-row .buy-btn:active:not(:disabled){ transform:scale(.94); }

/* ---------- Level select ---------- */
.level-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:8px;
  margin-bottom:16px;
  max-height:340px;
  overflow-y:auto;
  padding:2px;
}
.level-cell{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px;
  padding:8px 4px;
  border:none; border-radius:12px;
  background:rgba(139,107,255,.1);
  cursor:pointer;
}
.level-cell:active{ transform:scale(.94); }
.level-cell.current{ background:linear-gradient(135deg,var(--accent),#6a4cff); }
.level-cell .lv-num{ font-family:var(--font-num); font-size:15px; font-weight:700; color:var(--text); }
.level-cell.current .lv-num{ color:#fff; }
.level-cell .lv-stars{ font-size:9px; letter-spacing:1px; min-height:11px; }
.level-cell:disabled{ opacity:.4; cursor:not-allowed; }
.level-cell:disabled:active{ transform:none; }

.dex-progress{ font-size:12.5px; color:var(--accent); margin-bottom:12px; }
.dex-grid{ grid-template-columns:repeat(4, 1fr); }
.dex-cell{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:2px; padding:10px 4px;
  border-radius:12px;
  background:rgba(139,107,255,.1);
}
.dex-cell .dex-emoji{ font-size:22px; }
.dex-cell.undiscovered .dex-emoji{ filter:grayscale(1) opacity(.35); }
.dex-cell .dex-name{ font-size:9px; color:var(--text-soft); text-align:center; line-height:1.2; }
.dex-cell.undiscovered .dex-name{ color:#c8bfcf; }

/* ---------- Keyframes ---------- */
@keyframes popScale{
  0%{ transform:scale(1); opacity:1; }
  55%{ transform:scale(1.5); opacity:1; }
  100%{ transform:scale(.2); opacity:0; }
}
@keyframes wrongFlash{
  0%{ filter:none; }
  30%{ filter:brightness(.55) saturate(4) hue-rotate(-30deg); }
  100%{ filter:none; }
}
@keyframes shakeArena{
  0%,100%{ transform:translateX(0); }
  20%{ transform:translateX(-8px); }
  40%{ transform:translateX(7px); }
  60%{ transform:translateX(-5px); }
  80%{ transform:translateX(4px); }
}
@keyframes fxFloat{
  0%{ transform:translate(-50%,-50%) translateY(0); opacity:1; }
  100%{ transform:translate(-50%,-50%) translateY(-46px); opacity:0; }
}
@keyframes fxFloatBig{
  0%{ transform:translate(-50%,-50%) translateY(0) scale(.6); opacity:0; }
  25%{ transform:translate(-50%,-50%) translateY(-6px) scale(1.15); opacity:1; }
  100%{ transform:translate(-50%,-50%) translateY(-54px) scale(1); opacity:0; }
}
@keyframes pulseWarn{
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.18); }
}
@keyframes shinyPulse{
  0%,100%{ filter:drop-shadow(0 0 6px gold) drop-shadow(0 0 2px #fff6cc); transform:scale(1); }
  50%{ filter:drop-shadow(0 0 14px gold) drop-shadow(0 0 6px #fff6cc); transform:scale(1.08); }
}
@keyframes hintPulse{
  0%,100%{ filter:drop-shadow(0 0 4px #5fc9ff); }
  50%{ filter:drop-shadow(0 0 14px #5fc9ff) drop-shadow(0 0 6px #5fc9ff); }
}
@keyframes trapFlicker{
  0%,100%{ filter:drop-shadow(0 5px 6px rgba(90,40,70,.28)); }
  25%,75%{ filter:drop-shadow(0 0 10px #ff3b3b) brightness(1.35) saturate(1.6); }
  50%{ filter:drop-shadow(0 5px 6px rgba(90,40,70,.28)); }
}
@keyframes mascotBob{
  0%{ margin-top:0px; }
  100%{ margin-top:-6px; }
}
@keyframes fogDrift{
  0%{ transform:translateX(0); opacity:0; }
  12%{ opacity:.85; }
  85%{ opacity:.85; }
  100%{ transform:translateX(var(--travel,300px)); opacity:0; }
}

@media (max-height:680px){
  .hud{ padding:10px 12px 4px; }
  .hud-item{ padding:4px 8px; }
  .hud-item .value{ font-size:15px; }
  .game-logo{ font-size:30px; }
  .overlay-card{ padding:18px 18px; }
  .overlay-card h1{ font-size:20px; }
}
