:root {
  color-scheme: light;
  --red: #FF2442;
  --red-deep: #E01836;
  --red-light: #FF5A78;
  --red-soft: #FFE8EC;
  --red-softer: #FFF5F7;
  --red-line: #FFD6DD;
  --ink: #1A1A1A;
  --ink-2: #5B5B5B;
  --ink-3: #9B9B9B;
  --card-shadow: 0 2px 8px rgba(255, 36, 66, .15);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #FFFFFF;
}

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

button {
  font-family: inherit;
  color: inherit;
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.game {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(6px + env(safe-area-inset-top)) 16px calc(8px + env(safe-area-inset-bottom));
  background: #FFFFFF;
}

/* ---------- HUD ---------- */
.hud {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 7px;
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hud-center { align-items: center; }
.hud-right { align-items: flex-end; }

.hud-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .06em;
  line-height: 1;
}

.hud-label .mp-icon {
  width: 12px;
  height: 12px;
  color: var(--red);
}

.hud-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.hud-value b {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.hud-value em {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
}

.hud-value .hud-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  transform: translateY(-1px);
}

.sound-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 1px;
  padding: 0;
  border: 1px solid #E7E7E7;
  border-radius: 50%;
  background: #FFFFFF;
  color: #7E7E7E;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
  transition: transform .12s ease, color .15s ease, background .15s ease;
}

.sound-btn .mp-icon {
  width: 18px;
  height: 18px;
}

.sound-btn:active {
  transform: scale(.9);
}

.sound-btn.is-off {
  color: #C0C0C0;
  background: #F7F7F7;
}

.hud-score {
  color: var(--red);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -.04em;
  transition: transform .15s ease;
}

.hud-score.bump {
  animation: scoreBump .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

/* ---------- progress ---------- */
.progress {
  position: relative;
  flex: 0 0 auto;
  height: 22px;
  margin: 2px 2px 9px;
  border-radius: 99px;
  background: #F2F2F2;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .04);
  overflow: hidden;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--red);
  transition: width .42s cubic-bezier(.25, .8, .35, 1);
}

.progress-label {
  position: absolute;
  top: 50%;
  right: 4px;
  display: block;
  height: 16px;
  padding: 0 8px;
  transform: translateY(-50%);
  border-radius: 99px;
  background: rgba(255, 255, 255, .95);
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  line-height: 16px;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  pointer-events: none;
}

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

.board {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 1.5px solid #C6C6C6;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(26, 26, 26, .08), inset 0 -1px 0 rgba(0, 0, 0, .02);
  color: var(--ink);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  transition: opacity .18s ease, border-color .18s ease, box-shadow .18s ease, filter .18s ease;
  will-change: transform;
}

.tile .mp-icon {
  display: block;
  pointer-events: none;
}

.fruit-art {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  line-height: 0;
  pointer-events: none;
}

.fruit-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.fruit-rare {
  position: absolute;
  top: -2px;
  right: -2px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 27%;
  height: auto;
  min-width: 10px;
  max-width: 16px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
  background: linear-gradient(145deg, #FF5A78 0%, var(--red) 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 5px rgba(255, 36, 66, .35);
  pointer-events: none;
  transform: scale(.92);
}

.tile.is-rare .fruit-rare {
  display: flex;
}

.tile.is-hidden .fruit-rare {
  display: none;
}

.fruit-rare .mp-icon {
  width: 58%;
  height: 58%;
  color: #FFFFFF;
}

.tile.is-free {
  border-color: #ADADAD;
  box-shadow: 0 2px 7px rgba(26, 26, 26, .12), inset 0 -1px 0 rgba(0, 0, 0, .03);
}

.tile.is-free:active {
  transform: scale(.93);
}

.tile.is-blocked {
  opacity: .6;
  filter: grayscale(.4);
  cursor: default;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.tile.is-hidden.is-blocked {
  opacity: .5;
  filter: none;
}

.card-back {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background:
    linear-gradient(135deg, #FAFAFA 25%, #F0F0F0 25%, #F0F0F0 50%, #FAFAFA 50%, #FAFAFA 75%, #F0F0F0 75%);
  background-size: 14px 14px;
  color: #B8B8B8;
}

.tile.is-hidden .card-back {
  display: flex;
}

.card-back .mp-icon {
  width: 38%;
  height: 38%;
  color: #B8B8B8;
}

.tile.is-hidden .fruit-art {
  visibility: hidden;
}

.tile.reveal {
  animation: tileReveal .32s cubic-bezier(.34, 1.4, .64, 1);
}

@keyframes tileReveal {
  0% { transform: scale(.84); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.tile.shake {
  animation: tileShake .3s ease;
}

@keyframes tileShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px) rotate(-2deg); }
  45% { transform: translateX(3px) rotate(2deg); }
  70% { transform: translateX(-2px); }
}

.tile.deal {
  animation: tileDeal .34s cubic-bezier(.22, 1.2, .36, 1) backwards;
  animation-delay: var(--deal-delay, 0ms);
}

@keyframes tileDeal {
  0% { opacity: 0; transform: scale(.55) translateY(12px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.board.shuffling .tile {
  animation: shuffleFlip .44s ease both;
  animation-delay: var(--shuffle-delay, 0ms);
}

@keyframes shuffleFlip {
  0% { transform: rotateY(0) scale(1); }
  45% { transform: rotateY(90deg) scale(.86); opacity: .5; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

/* combo badge */
.combo {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 16px 7px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--red) 0%, var(--red-light) 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(255, 36, 66, .28);
  opacity: 0;
  transform: translate(-50%, -10px) scale(.85);
  transition: opacity .18s ease, transform .22s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
  white-space: nowrap;
}

.combo.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.combo b {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.2;
}

.combo span {
  font-size: 9.5px;
  font-weight: 500;
  opacity: .9;
  letter-spacing: .08em;
  line-height: 1.2;
}

/* guide pill */
.guide {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 3px;
  padding: 6px 13px;
  border-radius: 99px;
  background: rgba(255, 232, 236, .94);
  border: 1px solid rgba(255, 194, 205, .8);
  color: var(--red);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}

.guide.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* level announcement */
.level-announce {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 46%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 30px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--red-line);
  box-shadow: 0 10px 30px rgba(255, 36, 66, .16);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.82);
  pointer-events: none;
}

.level-announce.show {
  animation: announceIn 1.15s cubic-bezier(.3, 1, .4, 1) both;
}

.level-announce b {
  font-size: 22px;
  font-weight: 900;
  color: var(--red);
  letter-spacing: -.02em;
}

.level-announce span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .14em;
}

@keyframes announceIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.82); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  76% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(.96); }
}

/* ---------- slots ---------- */
.slot-zone {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.slot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3px 7px;
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.slot-meta > span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slot-meta .mp-icon {
  width: 12px;
  height: 12px;
  color: var(--ink-3);
}

.slot-tip {
  margin-left: 3px;
  color: #C1A6AC;
  font-style: normal;
  font-weight: 500;
}

.atlas-link {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 9px 0 7px;
  border: 1px solid #E3E3E3;
  border-radius: 99px;
  background: #FFFFFF;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(26, 26, 26, .05);
  transition: transform .12s ease, background .15s ease;
}

.atlas-link:active {
  transform: scale(.94);
  background: #F5F5F5;
}

.atlas-link .mp-icon {
  width: 13px;
  height: 13px;
  color: var(--ink-2);
}

.atlas-link b {
  font-size: 10.5px;
  font-weight: 900;
}

.slots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.slot-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 1px dashed #E0E0E0;
  background: #FFFFFF;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .03);
}

.slot-cell.filled {
  border: 1px solid #D8D8D8;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(26, 26, 26, .1);
}

.slot-cell .mp-icon {
  width: 58%;
  height: 58%;
}

.slot-cell.locked {
  flex-direction: column;
  gap: 1px;
  border-style: dashed;
  border-color: #DADADA;
  background: #FAFAFA;
  color: #ADADAD;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease;
}

.slot-cell.locked:active {
  transform: scale(.93);
  background: #F3F3F3;
}

.slot-cell.locked .mp-icon {
  width: 15px;
  height: 15px;
  color: #ADADAD;
}

.slot-lock-txt {
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--red);
  transform: scale(.94);
}

.slot-cell.incoming .fruit-art {
  opacity: 0;
}

.slot-cell.land {
  animation: slotLand .26s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes slotLand {
  0% { transform: scale(.72); }
  62% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.slot-cell.pop {
  animation: slotPop .24s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes slotPop {
  0% { transform: scale(.7); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.slot-cell.clearing {
  animation: slotClear .26s ease-in both;
}

@keyframes slotClear {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.14); opacity: 1; }
  100% { transform: scale(.35); opacity: 0; }
}

/* ---------- tools ---------- */
.tools {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 34px;
  padding: 12px 0 1px;
}

.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.tool-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(155deg, #FF415D 0%, var(--red) 52%, var(--red-deep) 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(255, 36, 66, .30), inset 0 -2px 0 rgba(0, 0, 0, .08);
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.tool-orb .mp-icon {
  width: 26px;
  height: 26px;
}

.tool:active .tool-orb {
  transform: scale(.91);
  box-shadow: 0 2px 6px rgba(255, 36, 66, .26);
}

.tool-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .02em;
  line-height: 1;
}

.tool-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  border: 1px solid var(--red-line);
  background: #FFFFFF;
  color: var(--red);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(255, 36, 66, .18);
}

.tool.is-empty .tool-orb {
  background: linear-gradient(155deg, #F7F7F7 0%, #ECECEC 100%);
  color: #B8B8B8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .06), inset 0 -2px 0 rgba(0, 0, 0, .03);
}

.tool.is-empty .tool-name {
  color: #B0B0B0;
}

.tool.is-empty .tool-badge {
  color: #9A9A9A;
  border-color: #E6E6E6;
  box-shadow: none;
}

/* ---------- fx ---------- */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 450;
  overflow: hidden;
  pointer-events: none;
}

.fly-tile {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #BDBDBD;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 10px 22px rgba(26, 26, 26, .18);
  color: var(--ink);
  z-index: 250;
  pointer-events: none;
  will-change: transform, opacity;
}

.fx-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  animation: dotFly .62s cubic-bezier(.15, .7, .3, 1) forwards;
}

@keyframes dotFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.15); opacity: 0; }
}

.fx-ring {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 2px solid rgba(255, 36, 66, .55);
  border-radius: 50%;
  animation: ringOut .5s ease-out forwards;
}

@keyframes ringOut {
  0% { transform: scale(.4); opacity: 1; }
  100% { transform: scale(2.6); opacity: 0; }
}

.score-float {
  position: fixed;
  z-index: 260;
  font-size: 19px;
  font-weight: 900;
  color: var(--red);
  letter-spacing: -.02em;
  text-shadow: 0 2px 8px rgba(255, 255, 255, .95);
  transform: translate(-50%, -50%);
  animation: floatUp .72s cubic-bezier(.2, .8, .4, 1) forwards;
  pointer-events: none;
  white-space: nowrap;
}

.score-float small {
  font-size: 10px;
  font-weight: 800;
  margin-left: 3px;
  vertical-align: 2px;
}

@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  18% { transform: translate(-50%, -60%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -170%) scale(1); opacity: 0; }
}

.confetti {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(105vh) rotate(560deg); opacity: .1; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: calc(132px + env(safe-area-inset-bottom));
  max-width: 84vw;
  padding: 9px 17px;
  border-radius: 99px;
  background: rgba(26, 26, 26, .88);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- masks / sheets ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(26, 26, 26, .42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s ease both;
}

.mask[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 24px 20px 16px;
  border-radius: 22px;
  background: #FFFFFF;
  text-align: center;
  box-shadow: 0 20px 55px rgba(20, 10, 14, .24);
  animation: sheetIn .28s cubic-bezier(.3, 1.3, .55, 1) both;
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #F6F6F6;
  color: #8A8A8A;
  cursor: pointer;
}

.sheet-close .mp-icon {
  width: 16px;
  height: 16px;
}

.sheet-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 18px;
  background: var(--red-soft);
  color: var(--red);
}

.sheet-icon .mp-icon {
  width: 28px;
  height: 28px;
}

.sheet h3 {
  margin: 0 0 7px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
}

.sheet p {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 46px;
  margin-bottom: 9px;
  border: 0;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

.action-btn:active { transform: scale(.975); }

.action-btn .mp-icon {
  width: 19px;
  height: 19px;
}

.action-share {
  background: var(--red-soft);
  color: var(--red);
}

.action-ad {
  background: linear-gradient(150deg, #FF415D 0%, var(--red) 55%, var(--red-deep) 100%);
  color: #FFFFFF;
  box-shadow: 0 6px 15px rgba(255, 36, 66, .26);
}

.sheet-cancel {
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

/* ad */
.ad-mask {
  background: rgba(20, 12, 14, .72);
}

.ad-box {
  width: 258px;
  padding: 24px 24px 22px;
  border-radius: 22px;
  background: #1C1214;
  color: #FFFFFF;
  text-align: center;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .4);
  animation: sheetIn .26s cubic-bezier(.3, 1.3, .55, 1) both;
}

.ad-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  color: #C9A9AF;
}

.ad-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: livePulse 1s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.ad-count {
  margin: 14px 0 6px;
  font-size: 54px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.ad-box p {
  margin: 0 0 16px;
  font-size: 11px;
  color: #B9A3A8;
}

.ad-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .14);
  overflow: hidden;
}

.ad-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red), var(--red-light));
  transition: width 3s linear;
}

/* ---------- result ---------- */
.result-card {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 26px 20px 18px;
  border-radius: 24px;
  background: #FFFFFF;
  text-align: center;
  box-shadow: 0 22px 60px rgba(20, 10, 14, .26);
  overflow: hidden;
  animation: sheetIn .3s cubic-bezier(.3, 1.25, .55, 1) both;
}

.result-card::before {
  content: "";
  position: absolute;
  top: -74px;
  left: 50%;
  width: 240px;
  height: 180px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 232, 236, .95), rgba(255, 232, 236, 0));
  pointer-events: none;
}

.result-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 11px;
  border-radius: 50%;
  background: linear-gradient(155deg, #FF415D 0%, var(--red) 55%, var(--red-deep) 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(255, 36, 66, .30);
}

.result-badge .mp-icon {
  width: 32px;
  height: 32px;
}

.result-card.lose .result-badge {
  background: linear-gradient(155deg, #BDBDBD 0%, #9C9C9C 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .14);
}

.result-card h2 {
  position: relative;
  margin: 0 0 4px;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--ink);
}

.result-sub {
  position: relative;
  margin: 0 0 15px;
  font-size: 11.5px;
  color: var(--ink-3);
}

.result-stats {
  position: relative;
  display: flex;
  padding: 12px 4px;
  border-radius: 15px;
  border: 1px solid #FFE3E8;
  background: var(--red-softer);
}

.stat {
  position: relative;
  flex: 1;
}

.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14%;
  width: 1px;
  height: 72%;
  background: #FFE0E6;
}

.stat b {
  display: block;
  margin-bottom: 2px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.stat span {
  font-size: 9.5px;
  color: var(--ink-3);
}

.result-best {
  position: relative;
  margin: 10px 0 15px;
  font-size: 11px;
  color: var(--ink-3);
}

.result-best b {
  color: var(--red);
  font-weight: 800;
}

.result-actions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-card.lose .result-stats,
.result-card.lose .result-best {
  display: none;
}

.result-card.lose .result-sub {
  margin-bottom: 18px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 47px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease;
}

.btn .mp-icon {
  width: 19px;
  height: 19px;
}

.btn:active { transform: scale(.975); }

.btn-primary {
  background: linear-gradient(150deg, #FF415D 0%, var(--red) 55%, var(--red-deep) 100%);
  color: #FFFFFF;
  box-shadow: 0 7px 18px rgba(255, 36, 66, .30);
}

.btn-ghost {
  background: var(--red-soft);
  color: var(--red);
}

.btn[hidden] { display: none; }

/* ---------- fruit atlas ---------- */
body.atlas-open {
  overflow: hidden;
}

.atlas-mask {
  z-index: 470;
  padding: 12px;
  background: rgba(26, 26, 26, .5);
}

.atlas-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 460px;
  height: 88vh;
  max-height: 780px;
  border-radius: 24px;
  background: #FFFFFF;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(20, 10, 14, .3);
  animation: sheetIn .3s cubic-bezier(.3, 1.25, .55, 1) both;
}

.atlas-hero {
  position: relative;
  flex: 0 0 auto;
  height: 132px;
  overflow: hidden;
  background: var(--red-soft);
}

.atlas-hero img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.atlas-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(24, 10, 14, .04) 0%, rgba(24, 10, 14, .16) 46%, rgba(24, 10, 14, .8) 100%);
  pointer-events: none;
}

.atlas-hero-text {
  position: absolute;
  left: 18px;
  right: 60px;
  bottom: 13px;
  color: #FFFFFF;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

.atlas-hero-text h2 {
  margin: 0 0 3px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.atlas-hero-text p {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .02em;
  opacity: .94;
}

.atlas-hero-text b {
  color: #FFD6DD;
  font-weight: 900;
}

.atlas-close {
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .2);
  color: #FFFFFF;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.atlas-close .mp-icon {
  width: 16px;
  height: 16px;
  color: #FFFFFF;
}

.atlas-search {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  margin: 10px 14px 4px;
  padding: 0 10px 0 12px;
  border: 1px solid #FFE3E8;
  border-radius: 12px;
  background: var(--red-softer);
}

.atlas-search .mp-icon {
  width: 15px;
  height: 15px;
  color: var(--red);
}

.atlas-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}

.atlas-search input::placeholder {
  color: #C1A6AC;
}

.atlas-search input::-webkit-search-cancel-button {
  display: none;
}

.atlas-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #FFE8EC;
  color: var(--red);
  cursor: pointer;
}

.atlas-clear .mp-icon {
  width: 11px;
  height: 11px;
  color: var(--red);
}

.atlas-clear:active {
  transform: scale(.9);
}

.atlas-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 14px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.atlas-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px 0 10px;
}

.atlas-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 8px 4px 7px;
  border: 1px solid #FFE3E8;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 1px 4px rgba(255, 36, 66, .06);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease;
}

.atlas-item:active {
  transform: scale(.96);
  box-shadow: 0 1px 2px rgba(255, 36, 66, .08);
}

.atlas-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  line-height: 0;
  pointer-events: none;
}

.atlas-art:empty {
  border-radius: 50%;
  background: var(--red-softer);
}

.atlas-name {
  width: 100%;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
}

.atlas-id {
  margin-top: 1px;
  color: #C7AFB4;
  font-size: 8px;
  letter-spacing: .02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.atlas-item-rare {
  position: absolute;
  top: 5px;
  right: 5px;
}

.rare-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FF5A78 0%, var(--red) 100%);
  box-shadow: 0 1px 2px rgba(255, 36, 66, .3);
  vertical-align: middle;
}

.atlas-more {
  padding: 4px 0 12px;
  text-align: center;
  color: #C1A6AC;
  font-size: 10px;
  line-height: 1.4;
}

.atlas-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid #FFEFF2;
  color: var(--ink-3);
  font-size: 9.5px;
  line-height: 1.3;
}

.atlas-foot > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.atlas-rare-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

@media (max-height: 660px) {
  .tools { gap: 28px; padding-top: 9px; }
  .tool-orb { width: 50px; height: 50px; }
  .tool-orb .mp-icon { width: 23px; height: 23px; }
  .slot-zone { margin-top: 6px; }
  .hud-value b { font-size: 20px; }
  .atlas-sheet { height: 92vh; }
  .atlas-hero { height: 108px; }
}

@media (max-width: 350px) {
  .game { padding-left: 11px; padding-right: 11px; }
  .tools { gap: 24px; }
  .atlas-mask { padding: 8px; }
  .atlas-grid { gap: 6px; }
  .atlas-art { width: 40px; height: 40px; }
  .atlas-hero { height: 116px; }
  .atlas-item { padding: 7px 3px 6px; }
}

/* Card-size containment: keep artwork inside square tiles at every viewport size. */
#board .tile, #board .card {
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 13px;
  background: #fff;
  border: 1px solid #FFD6DD;
  box-shadow: 0 2px 4px rgba(26,26,26,.12);
}
#board .fruit-art, #slots .fruit-art {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 82%;
  max-height: 82%;
  flex: none;
}
.fruit-art svg { display: block; width: 100%; height: 100%; overflow: hidden; }
#progressFill { background: #FF2442; }
