:root {
  --orange: #FF8A3D;
  --orange-deep: #F26A12;
  --cream: #FFF6E4;
  --brown: #6B3410;
  --brown-soft: #A06A38;
  --gap: 4px;
  --cell: 40px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--brown);
  background: #F27A22;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.app {
  position: relative;
  width: 100%;
  max-width: 540px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px calc(8px + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(130% 65% at 50% 0%, #FFC27C 0%, #FF9E52 45%, #FF8233 100%);
  box-shadow: 0 0 60px rgba(120, 45, 0, .25);
}

/* ---------- background decor ---------- */
.sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

.cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, rgba(255, 245, 216, .85), rgba(255, 209, 150, .35) 62%, rgba(255, 190, 120, 0) 72%);
}
.cloud-a { width: 300px; height: 190px; left: -110px; bottom: -80px; }
.cloud-b { width: 250px; height: 160px; right: -100px; bottom: -40px; opacity: .8; }
.cloud-c { width: 190px; height: 120px; left: 34%; bottom: -70px; opacity: .55; }

.cloud-band {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -55px;
  height: 175px;
  background: radial-gradient(52% 100% at 50% 100%, rgba(255, 244, 216, .5) 0%, rgba(255, 240, 205, 0) 71%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .55;
}
.orb-1 {
  width: 130px;
  height: 130px;
  left: -48px;
  top: 37%;
  background: radial-gradient(circle at 42% 36%, rgba(255, 241, 206, .75), rgba(255, 190, 120, 0) 70%);
}
.orb-2 {
  width: 158px;
  height: 158px;
  right: -66px;
  top: 50%;
  background: radial-gradient(circle at 58% 42%, rgba(255, 226, 172, .6), rgba(255, 170, 90, 0) 72%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(4px);
}
.g1 {
  width: 6px; height: 6px; right: 22px; top: 16%;
  background: #FFF6D8;
  box-shadow: 0 0 12px 3px rgba(255, 245, 200, .7);
  animation: twinkle 3s ease-in-out infinite;
}
.g2 {
  width: 4px; height: 4px; left: 18px; top: 34%;
  background: #FFE6A8;
  box-shadow: 0 0 10px 2px rgba(255, 235, 170, .6);
  animation: twinkle 3s 1.2s ease-in-out infinite;
}

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.chip {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(#FFFDF4, #FFEBC8);
  border: 1.5px solid rgba(255, 255, 255, .88);
  box-shadow: 0 3px 8px rgba(154, 62, 0, .18), inset 0 1px 0 #fff;
  font-size: 13px;
  font-weight: 800;
  color: #8A4515;
  white-space: nowrap;
}

.chip-dot {
  width: 24px;
  height: 24px;
  margin-left: -6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(#FFD34E, #FFA51F);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 1px 2px rgba(160, 80, 0, .3);
}
.chip-dot .mp-icon { width: 15px; height: 15px; }

.best-chip {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #A76534;
}
.best-chip b { margin-left: 2px; font-size: 13px; color: #E8610E; }

.top-actions { margin-left: auto; display: flex; gap: 7px; }

.round-btn {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .9);
  background: linear-gradient(#FFFDF4, #FFE7BE);
  color: #B25E1E;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 8px rgba(154, 62, 0, .2), inset 0 1px 0 #fff;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.round-btn .mp-icon { width: 19px; height: 19px; }
.round-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 3px rgba(154, 62, 0, .2), inset 0 1px 0 #fff;
}
.round-btn.muted { color: #BCA48E; }
.round-btn .slash {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 21px;
  height: 2px;
  border-radius: 2px;
  background: #D9534F;
  transform: translate(-50%, -50%) rotate(-45deg);
  box-shadow: 0 0 0 1px #FFF6E4;
}
.round-btn.muted .slash { display: block; }

/* ---------- status ---------- */
.status-row {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.status-card {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 17px;
  padding: 8px 12px 10px;
  background: linear-gradient(160deg, #FFFCF2, #FFEDCD);
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: 0 4px 10px rgba(154, 62, 0, .16), inset 0 1px 0 #fff;
}

.status-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
  margin-bottom: 7px;
}
.s-label { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #B0794A; }
.s-score {
  font-size: 21px;
  line-height: 1;
  font-weight: 900;
  color: #7A3C0D;
  font-variant-numeric: tabular-nums;
  transition: transform .15s ease, color .15s ease;
}
.s-score.bump { transform: scale(1.16); color: #F26A12; }
.s-target { font-size: 11px; font-weight: 700; color: #B99B7D; }
.s-target em { font-style: normal; }

.bar {
  position: relative;
  height: 9px;
  border-radius: 99px;
  overflow: hidden;
  background: #F1D8B6;
  box-shadow: inset 0 1px 2px rgba(120, 60, 0, .24);
}
.bar-fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFB13D, #FF7A18);
  transition: width .32s cubic-bezier(.2, .8, .3, 1);
}
.bar-fill.done { background: linear-gradient(90deg, #FFD34E, #FF9E1B); }
.bar-shine {
  position: absolute;
  top: 0; bottom: 0;
  left: -30%;
  width: 30%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0));
  transform: skewX(-18deg);
  animation: shineMove 3.2s ease-in-out infinite;
}

.moves-card {
  flex: 0 0 auto;
  width: 68px;
  border-radius: 17px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(160deg, #FFB347, #FF7A1C);
  border: 1.5px solid rgba(255, 255, 255, .72);
  box-shadow: 0 4px 10px rgba(204, 88, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .5);
}
.moves-card b {
  font-size: 25px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(180, 70, 0, .35);
}
.moves-card span { font-size: 10px; font-weight: 700; opacity: .92; }
.moves-card.low { animation: lowPulse .9s ease-in-out infinite; }

/* ---------- board ---------- */
.board-area {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board {
  position: relative;
  flex: 0 0 auto;
  border-radius: 26px;
  padding: 7px;
  background: linear-gradient(160deg, #FFE4B4 0%, #FFC47E 45%, #F7A956 100%);
  border: 2px solid rgba(255, 251, 240, .95);
  box-shadow:
    0 12px 26px rgba(151, 60, 0, .3),
    inset 0 2px 0 rgba(255, 255, 255, .9),
    inset 0 -3px 8px rgba(190, 100, 20, .25);
  overflow: hidden;
}

.board.enter { animation: boardEnter .42s cubic-bezier(.2, 1.1, .3, 1) both; }
@keyframes boardEnter {
  0% { transform: scale(.9); opacity: .35; }
  65% { transform: scale(1.015); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.board-inner {
  position: absolute;
  inset: 7px;
  padding: 7px;
  border-radius: 19px;
  overflow: hidden;
  background: linear-gradient(165deg, #8A4A1D, #6B3410);
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, .38), inset 0 -1px 0 rgba(255, 255, 255, .12);
}

.slots {
  position: absolute;
  inset: 7px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: var(--gap);
}
.slot {
  border-radius: 9px;
  background: rgba(255, 236, 206, .08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22), 0 1px 0 rgba(255, 255, 255, .05);
}

.pieces {
  position: absolute;
  inset: 7px;
  touch-action: none;
}

.candy {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  transition: transform .23s cubic-bezier(.22, .9, .28, 1);
  cursor: pointer;
}
.candy-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  transition: transform .14s ease, filter .14s ease;
}
.candy-inner svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 3px rgba(70, 22, 0, .3));
}
.candy.sel .candy-inner {
  transform: scale(1.12) translateY(-2px);
  filter: brightness(1.15) drop-shadow(0 0 7px #FFE38A);
}
.candy.hint .candy-inner { animation: hintPulse 1s ease-in-out infinite; }
.candy.pop { z-index: 4; }
.candy.pop .candy-inner { animation: popOut .24s ease-out forwards; }
.candy.bad .candy-inner { animation: shake .3s ease-in-out; }
.candy.spin .candy-inner { animation: spin .42s ease-in-out; }

/* ---------- fx ---------- */
.fx-layer {
  position: absolute;
  inset: 7px;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}
.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: sparkFly .62s ease-out forwards;
}
.float-score {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 17px;
  font-weight: 900;
  color: #FFF6D8;
  white-space: nowrap;
  text-shadow: 0 2px 0 #D95900, 0 4px 10px rgba(0, 0, 0, .35);
  animation: floatUp .9s ease-out forwards;
}
.float-score.big { font-size: 22px; color: #FFE262; }

.combo-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.combo-banner.show { opacity: 1; }
.combo-banner span {
  display: block;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(160deg, rgba(255, 212, 88, .98), rgba(255, 122, 24, .98));
  border: 2px solid #FFF6D8;
  box-shadow: 0 8px 22px rgba(160, 50, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .6);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(180, 70, 0, .4);
  animation: comboPop .35s cubic-bezier(.2, 1.4, .4, 1) both;
}

/* ---------- bottom bar ---------- */
.bottom-bar {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.combo-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(#FFF9EC, #FFE9C4);
  border: 1.5px solid #fff;
  box-shadow: 0 3px 8px rgba(154, 62, 0, .16);
  font-size: 12px;
  font-weight: 700;
  color: #A76534;
  white-space: nowrap;
}
.combo-chip .mp-icon { width: 18px; height: 18px; color: #FF6D2D; }
.combo-chip b { margin-left: 2px; font-size: 14px; color: #E8610E; }

.boosters { display: flex; align-items: flex-end; gap: 10px; }

.booster {
  position: relative;
  width: 58px;
  height: 66px;
  padding: 0;
  border: 0;
  background: none;
  color: #B4551C;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s ease;
}
.booster:active { transform: translateY(2px) scale(.96); }

.b-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  border-radius: 18px;
  background: linear-gradient(160deg, #FFE0B2, #FFB25F);
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: 0 4px 10px rgba(154, 62, 0, .22), inset 0 2px 0 rgba(255, 255, 255, .65);
  transition: background .15s ease, color .15s ease;
}
.b-icon .mp-icon { width: 25px; height: 25px; }
.b-label {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  color: #FFF6E4;
  text-shadow: 0 1px 2px rgba(120, 45, 0, .45);
}
.b-count {
  position: absolute;
  top: -3px;
  right: -1px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(#FF6B5E, #E23A2E);
  border: 1.5px solid #FFF6E4;
  box-shadow: 0 2px 4px rgba(150, 30, 0, .3);
}
.booster.active .b-icon {
  color: #fff;
  background: linear-gradient(#FFD34E, #FF8A1E);
  animation: boosterPulse .8s ease-in-out infinite;
}
.booster.empty { opacity: .48; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  transition: opacity .26s ease, visibility .26s ease;
}
.overlay.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.start-overlay {
  background:
    radial-gradient(100% 80% at 50% 0%, rgba(255, 188, 104, .78), rgba(255, 121, 30, .9));
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}
.end-overlay, .help-overlay {
  background: rgba(72, 30, 0, .48);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.help-overlay { z-index: 50; }

.panel {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 24px 22px;
  border-radius: 30px;
  text-align: center;
  background: linear-gradient(170deg, #FFFEF8 0%, #FFF4DC 55%, #FFE9C4 100%);
  border: 2px solid #fff;
  box-shadow: 0 22px 50px rgba(120, 45, 0, .35), inset 0 2px 0 #fff;
  animation: panelIn .42s cubic-bezier(.2, 1.1, .3, 1) both;
  scrollbar-width: none;
}
.panel::-webkit-scrollbar { display: none; }

.logo-candies {
  position: relative;
  width: 196px;
  height: 82px;
  margin: 0 auto 4px;
}
.logo-candy {
  position: absolute;
  top: 10px;
  left: 18px;
  width: 60px;
  height: 60px;
}
.logo-candy svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 5px 6px rgba(130, 55, 0, .28)); }
.lc1 { --rot: -18deg; }
.lc2 { top: 0; left: 68px; width: 70px; height: 70px; z-index: 2; --rot: 0deg; animation-delay: .2s; }
.lc3 { left: auto; right: 16px; --rot: 16deg; animation-delay: .4s; }
.lc1, .lc2, .lc3 { animation: bob 2.8s ease-in-out infinite; }
.logo-spark {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFF6C8;
  box-shadow: 0 0 10px 2px rgba(255, 242, 168, .9);
  animation: twinkle 1.8s ease-in-out infinite;
}
.spark-1 { left: 4px; top: 0; }
.spark-2 { right: 0; bottom: 6px; animation-delay: .8s; }

.game-title {
  margin: 2px 0 0;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #F0670B;
  filter: drop-shadow(0 2px 0 #FFF8E8);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .game-title {
    color: transparent;
    background: linear-gradient(180deg, #FFC24E 0%, #FF8A1E 55%, #F0670B 100%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}
.tagline {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #B47A4B;
}

.level-card {
  margin: 17px 0 18px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(160deg, #FFF8E9, #FFE9C2);
  border: 1.5px dashed #EDBE7E;
  box-shadow: inset 0 2px 6px rgba(190, 120, 40, .08);
}
.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: #A35A23;
}
.lc-level { color: #E8610E; }
.lc-moves b { font-size: 18px; color: #E8610E; }
.level-card-goal { margin-top: 6px; text-align: left; font-size: 12px; color: #A97C55; }
.level-card-goal b { font-size: 15px; color: #F06A0E; }

.btn {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn .mp-icon { width: 23px; height: 23px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #FFBE4E 0%, #FF8A1E 60%, #F7740B 100%);
  text-shadow: 0 1px 2px rgba(170, 60, 0, .35);
  box-shadow: 0 6px 0 #C95800, 0 10px 18px rgba(190, 80, 0, .32), inset 0 2px 0 rgba(255, 255, 255, .6);
}
.btn-primary:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #C95800, 0 3px 8px rgba(190, 80, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .5);
}
.btn-ghost {
  margin-top: 10px;
  height: 42px;
  font-size: 13px;
  font-weight: 700;
  color: #B07C4D;
  background: transparent;
}
.btn-ghost:active { transform: translateY(1px); color: #8A5326; }

.btn-start { margin-top: 2px; }

.best-line {
  margin-top: 16px;
  font-size: 12px;
  color: #B08A66;
}
.best-line b { font-size: 15px; color: #E8610E; }
.howto {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.65;
  color: #B08A66;
}

/* end panel */
.end-panel { padding-top: 20px; }
.end-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #FFD34E, #FF8A1E);
  border: 3px solid #FFF6E4;
  box-shadow: 0 8px 18px rgba(190, 80, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .55);
}
.end-badge .mp-icon { width: 32px; height: 32px; }
.end-badge.lose { background: linear-gradient(160deg, #CDB6A2, #8C7666); }
.end-title { margin: 4px 0 0; font-size: 27px; font-weight: 900; color: #8A4515; }
.end-sub { margin: 6px 0 0; font-size: 12px; color: #B08A66; }

.stars { display: flex; justify-content: center; gap: 12px; margin: 16px 0 14px; }
.star-ico { width: 38px; height: 38px; color: #E6D3BC; }
.star-ico.on {
  color: #FFC42E;
  filter: drop-shadow(0 3px 4px rgba(220, 120, 0, .35));
  animation: starPop .4s both;
}
.star-ico:nth-child(2).on { animation-delay: .12s; }
.star-ico:nth-child(3).on { animation-delay: .24s; }

.end-score {
  margin: 0 auto 12px;
  padding: 10px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: linear-gradient(160deg, #FFF8E9, #FFE9C2);
  border: 1.5px solid #fff;
  box-shadow: inset 0 2px 6px rgba(190, 120, 40, .08);
}
.end-score span { font-size: 11px; font-weight: 700; color: #B08A66; }
.end-score b { font-size: 34px; line-height: 1.1; font-weight: 900; color: #F06A0E; }

.end-stats { display: flex; gap: 8px; margin-bottom: 16px; }
.end-stat {
  flex: 1;
  padding: 8px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, .65);
  border: 1px solid #F3DFC4;
}
.end-stat span { font-size: 10px; color: #B08A66; }
.end-stat b { font-size: 15px; color: #8A4515; }

/* help */
.help-panel { text-align: left; }
.help-title { margin: 0 0 14px; font-size: 22px; font-weight: 900; text-align: center; color: #8A4515; }
.help-list { margin: 0 0 18px; padding-left: 20px; font-size: 13px; line-height: 1.8; color: #8A5B34; }
.help-list li { margin-bottom: 8px; }
.help-list b { color: #E8610E; }
.panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  color: #A06A38;
  background: #F6E3C6;
  cursor: pointer;
}
.panel-close .mp-icon { width: 18px; height: 18px; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(106px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 86vw;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(89, 40, 8, .92);
  color: #FFF2D9;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- animations ---------- */
@keyframes panelIn {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-6px) rotate(var(--rot, 0deg)); }
}
@keyframes twinkle {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.25); }
}
@keyframes shineMove {
  0% { left: -30%; }
  55%, 100% { left: 115%; }
}
@keyframes lowPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); background: linear-gradient(160deg, #FF7A5C, #EF4A22); }
}
@keyframes hintPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 3px 3px rgba(70, 22, 0, .3)); }
  50% { transform: scale(1.13); filter: drop-shadow(0 0 10px #FFF3A8) brightness(1.18); }
}
@keyframes popOut {
  0% { transform: scale(1); opacity: 1; }
  38% { transform: scale(1.24); filter: brightness(1.45); opacity: 1; }
  100% { transform: scale(.08); opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-4deg); }
  45% { transform: translateX(4px) rotate(4deg); }
  70% { transform: translateX(-3px) rotate(-2deg); }
}
@keyframes spin {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(.82); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}
@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  18% { opacity: 1; transform: translate(-50%, -62%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -165%) scale(1); }
}
@keyframes comboPop {
  0% { transform: scale(.55) rotate(-6deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes starPop {
  0% { transform: scale(.2) rotate(-30deg); opacity: 0; }
  70% { transform: scale(1.18) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes boosterPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 90, .65), 0 4px 10px rgba(154, 62, 0, .22); }
  50% { box-shadow: 0 0 0 7px rgba(255, 214, 90, 0), 0 4px 10px rgba(154, 62, 0, .22); }
}

/* ---------- small screens ---------- */
@media (max-height: 720px) {
  .app { gap: 6px; padding-top: calc(6px + env(safe-area-inset-top)); }
  .status-card { padding: 7px 11px 8px; }
  .s-score { font-size: 19px; }
  .moves-card b { font-size: 22px; }
  .board { border-radius: 22px; padding: 6px; }
  .board-inner { inset: 6px; padding: 6px; border-radius: 16px; }
  .slots, .pieces, .fx-layer { inset: 6px; }
  .booster { height: 58px; }
  .b-icon { width: 46px; height: 46px; border-radius: 16px; }
  .b-icon .mp-icon { width: 22px; height: 22px; }
  .combo-chip { height: 34px; font-size: 11px; }
  .start-panel { padding: 18px 18px 20px; }
  .game-title { font-size: 29px; }
  .level-card { margin: 13px 0 14px; }
  .logo-candies { height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
