[v-cloak] { display: none; }
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  min-height:100vh;display:flex;justify-content:center;
  background: #fdfbff;
}
/* game background */
body.in-game {
  background:
    radial-gradient(circle at 12% 8%, #ffe27a 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, #7ee8fa 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, #ff9ec4 0%, transparent 55%),
    linear-gradient(165deg,#6ec6ff 0%, #8f7bff 55%, #ff8fc4 100%);
  background-attachment:fixed;
}
/* settings/parent background */
body.in-settings {
  background:
    radial-gradient(circle at 12% 8%, rgba(255,226,122,0.6) 0%, transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(126,232,250,0.6) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(255,158,196,0.6) 0%, transparent 55%),
    linear-gradient(165deg, #a4daff 0%, #bcaeff 55%, #ffb6d8 100%);
  background-attachment:fixed;
}

#app {
  width: 100%;
  padding: 12px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}
.phone{width:100%;max-width:430px}

/* HUD */
.hud{
  background:rgba(255,255,255,.92);border-radius:22px;padding:10px 12px 12px;
  box-shadow:0 8px 0 rgba(120,90,200,.35), inset 0 -3px 0 rgba(0,0,0,.05);
  margin-bottom:16px;
}
/* Parent / Settings HUD overrides */
.hud.light-hud {
  box-shadow: 0 8px 0 rgba(200,200,220,.35), inset 0 -3px 0 rgba(0,0,0,.05);
}

.hud-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:9px;gap:12px}
.back{display:inline-flex;align-items:center;justify-content:center;min-height:44px;min-width:44px;font-size:14px;font-weight:700;color:#5a4bbd;background:#e2dfff;border:1.5px solid #dcd6ff;border-radius:12px;padding:6px 11px;cursor:pointer;box-shadow:0 2px 4px rgba(0,0,0,.08)}
.back:active{opacity:0.8;transform:translateY(1px)}
.stats{display:flex;gap:6px}
.stat{
  background:#fff;border-radius:14px;padding:5px 9px;text-align:center;min-width:64px;
  box-shadow:0 3px 0 #dcd6ff;
}
.stat .k{font-size:11px;color:#9b93c9;font-weight:700;letter-spacing:.5px}
.stat .v{font-size:19px;font-weight:900;color:#5a4bbd;line-height:1.15}
.combo .v{color:#ff7043}
.bar{height:14px;border-radius:99px;background:#e4e0f7;overflow:hidden;box-shadow:inset 0 2px 3px rgba(0,0,0,.08)}
.bar i{display:block;height:100%;border-radius:99px;
  background:linear-gradient(90deg,#7ced8d,#38d9a9 50%,#20c997);
  box-shadow:0 0 10px rgba(56,217,169,.8);transition:width .35s}

/* 棋盘 */
.board{display:grid;gap:10px;margin-bottom:12px}
.board.grid-4x4 { grid-template-columns: repeat(4, 1fr); }
.board.grid-4x6 { grid-template-columns: repeat(4, 1fr); }
.board.grid-6x6 { grid-template-columns: repeat(6, 1fr); }

.card{
  aspect-ratio:1;border-radius:20px;display:flex;align-items:center;justify-content:center;
  font-size:26px;font-weight:900;color:#fff;cursor:pointer;user-select:none;
  transition:transform .12s ease, box-shadow .12s ease, opacity .3s;
  position:relative;overflow:hidden;
  min-width: 44px; min-height: 44px;
}
@supports not (aspect-ratio: 1) {
  .card { padding-top: 100%; height: 0; }
  .card span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
}

.card::after{content:"";position:absolute;inset:3px 3px auto 3px;height:38%;border-radius:16px 16px 40px 40px;background:rgba(255,255,255,.28)}
.card span{position:relative;z-index:1;text-shadow:0 2px 0 rgba(0,0,0,.16)}
.expr{background:linear-gradient(180deg,#5bc8ff,#2f7bff);box-shadow:0 6px 0 #1f56b8, inset 0 2px 0 rgba(255,255,255,.4)}
.num{background:linear-gradient(180deg,#ffd166,#ff8a3d);box-shadow:0 6px 0 #c96a1f, inset 0 2px 0 rgba(255,255,255,.4)}

.card:active{transform:translateY(4px);box-shadow:0 2px 0 rgba(0,0,0,.35)}
.card.selected{transform:translateY(-2px) scale(1.04);box-shadow:0 0 0 4px #fff, 0 8px 18px rgba(0,0,0,.28);}
.card.matched{opacity:0;transform:scale(.4) rotate(12deg);pointer-events:none}
.card.empty{opacity:0;pointer-events:none}
.card.error{animation:shake .32s}
@keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-6px)}75%{transform:translateX(6px)}}

/* 连击气泡 */
.burst{
  position:fixed;left:50%;top:38%;transform:translate(-50%,-50%) scale(.6);
  font-size:34px;font-weight:900;color:#fff;text-shadow:0 4px 0 #ff5c8a,0 0 22px rgba(255,255,255,.9);
  opacity:0;pointer-events:none;transition:all .35s cubic-bezier(.2,1.6,.4,1);z-index:9;
}
.burst.on{opacity:1;transform:translate(-50%,-50%) scale(1.15)}

.tip{
  background:rgba(255,255,255,.9);border-radius:16px;padding:10px 14px;
  font-size:14px;font-weight:700;color:#6b5fb5;text-align:center;box-shadow:0 4px 0 rgba(120,90,200,.25);
  margin-top:12px;
}

.foot{margin-top:12px;display:flex;gap:10px}
.btn{
  flex:1;border:0;border-radius:18px;padding:12px 4px;font-size:15px;font-weight:900;color:#fff;
  background:linear-gradient(180deg,#5ee7a0,#20c997);box-shadow:0 6px 0 #159c73;cursor:pointer;
  min-height: 56px;
  white-space: nowrap;
}
.btn.alt{background:linear-gradient(180deg,#ff9a6a,#ff5c8a);box-shadow:0 6px 0 #d23262}
.btn:active{transform:translateY(4px);box-shadow:0 2px 0 rgba(0,0,0,.3)}

/* 模态框与设置、家长面板样式 */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
  padding: 20px;
}
.candy-card {
  background: #fff; border-radius: 24px; padding: 24px 20px;
  box-shadow: 0 12px 0 rgba(120,90,200,.35), 0 20px 30px rgba(0,0,0,.2);
  width: 100%; max-width: 340px; text-align: center;
}
.candy-title {
  color: #5a4bbd; font-size: 28px; font-weight: 900; margin-bottom: 15px;
}
.level-subtitle {
  font-size: 14px; font-weight: 600; color: rgba(90, 75, 189, 0.7); margin-bottom: 10px;
}
.stars { display: flex; justify-content: center; gap: 8px; margin-bottom: 15px; height: 38px; }
.star {
  display: inline-block;
  width: 36px;
  height: 36px;
  background-color: #d1cfdb;
  clip-path: polygon(50% 0%, 61.8% 38.2%, 100% 38.2%, 69.1% 61.8%, 80.9% 100%, 50% 76.4%, 19.1% 100%, 30.9% 61.8%, 0% 38.2%, 38.2% 38.2%);
  transform: scale(0.6);
  opacity: 0;
  animation: starIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.star-on {
  background-color: #ffd700;
}
.star:nth-child(1) { animation-delay: 0ms; }
.star:nth-child(2) { animation-delay: 80ms; }
.star:nth-child(3) { animation-delay: 160ms; }
@keyframes starIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.grid-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px;
}
.g-stat {
  background: #f4f2ff; border-radius: 12px; padding: 10px;
  box-shadow: inset 0 -3px 0 #e6e0ff;
}
.g-stat .k { font-size: 11px; color: #7a6bd6; font-weight: 700; margin-bottom: 4px; }
.g-stat .v { font-size: 20px; font-weight: 900; color: #5a4bbd; }

/* Settings elements */
.section { margin-bottom: 20px; }
h3 { color: #5a4bbd; font-size: 16px; margin-bottom: 10px; text-align: left; padding-left: 5px; }
.table-selector, .grid-selector {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.table-btn, .grid-btn {
  padding: 10px 15px; border: 1.5px solid #dcd6ff; border-radius: 99px;
  background: #fff; font-size: 15px; font-weight: 700; color: #7a6bd6;
  cursor: pointer; min-width: 44px; min-height: 44px;
  box-shadow: 0 3px 0 #dcd6ff;
  transition: all .2s;
}
.table-btn.active, .grid-btn.active {
  background: #7a6bd6; color: #fff; border-color: #7a6bd6;
  box-shadow: 0 6px 0 #5a4bbd; transform: translateY(-3px);
}
.table-btn:active:not(.active), .grid-btn:active:not(.active) {
  background: #f4f2ff; transform: translateY(3px); box-shadow: 0 0 0 #dcd6ff;
}
.table-btn.active:active, .grid-btn.active:active {
  transform: translateY(1px); box-shadow: 0 2px 0 #5a4bbd;
}

/* Parent Panel */
.parent-stats-container { margin-top: 15px; text-align: left; }
.stat-card {
  background: #fff; border-radius: 16px; padding: 12px 15px; margin-bottom: 10px;
  border: 1.5px solid #f0edff; box-shadow: 0 4px 10px rgba(120,90,200,.05);
}
.stat-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.stat-label { font-size: 18px; font-weight: 900; color: #5a4bbd; }
.top-error-tag {
  background: #ff7043; color: #fff; font-size: 14px; font-weight: 700;
  padding: 4px 8px; border-radius: 6px; box-shadow: 0 2px 0 #d84315;
  white-space: nowrap;
}
.stat-bar-bg { height: 8px; background: #f0edff; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.stat-bar-fg { height: 100%; background: linear-gradient(90deg,#5ee7a0,#20c997); transition: width .3s; }
.stat-bar-fg.error-bar { background: linear-gradient(90deg,#ffb74d,#ff7043); }
.stat-text { font-size: 14px; font-weight: 700; color: #7a6bd6; }
