:root {
  --orange: #ff8a3d;
  --orange-deep: #e66612;
  --orange-light: #ffc46b;
  --cream: #fff3d9;
  --cream-deep: #ffe2ae;
  --ink: #71350f;
  --ink-soft: #a86430;
  --board: #20374f;
  --gold: #ffbe2e;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  background: #4f8d50;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

.bg-photo,
.bg-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-photo {
  inset: -8%;
  background: url("images/gen/gptimg_1795282951_look.png") center / cover no-repeat;
  filter: blur(19px) saturate(1.32) brightness(0.96);
  transform: scale(1.04);
}

.bg-wash {
  background:
    radial-gradient(58% 34% at 72% 8%, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 72%),
    radial-gradient(46% 30% at 16% 14%, rgba(255, 244, 189, 0.42), rgba(255, 244, 189, 0) 75%),
    linear-gradient(180deg, rgba(89, 184, 255, 0.3) 0%, rgba(255, 176, 115, 0.14) 36%, rgba(61, 139, 65, 0.42) 72%, rgba(31, 88, 41, 0.6) 100%),
    radial-gradient(76% 44% at 50% 102%, rgba(19, 63, 31, 0.56), rgba(19, 63, 31, 0) 75%);
}

.bg-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 9% 78%, rgba(255, 245, 177, 0.42) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 68%, rgba(255, 245, 177, 0.35) 0 2.5px, transparent 3.5px),
    radial-gradient(circle at 82% 88%, rgba(255, 255, 255, 0.32) 0 1.8px, transparent 2.8px),
    radial-gradient(circle at 18% 91%, rgba(255, 255, 255, 0.28) 0 1.6px, transparent 2.6px);
  opacity: 0.8;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.mp-icon[hidden] {
  display: none !important;
}

.game {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 540px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px calc(8px + env(safe-area-inset-bottom, 0px));
}

/* ---------- top hud ---------- */

.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px 40px;
  gap: 7px;
  align-items: stretch;
  min-height: 72px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffaf0 0%, #fff0cf 52%, #ffe2ac 100%);
  box-shadow:
    0 4px 0 rgba(160, 84, 23, 0.34),
    0 8px 16px rgba(69, 35, 4, 0.18),
    inset 0 2px 0 #fff;
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -26px;
  left: -10px;
  width: 74%;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(3px);
  pointer-events: none;
}

.level-card,
.moves-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px 5px;
}

.card-label {
  position: relative;
  z-index: 1;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.card-value {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 #fff, 0 2px 0 rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.moves-card.low {
  animation: lowPulse 0.8s ease-in-out infinite;
}

.moves-card.low .card-value {
  color: #d2331d;
}

.goal-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6px 10px 8px;
}

.goal-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  line-height: 1;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

.goal-target {
  font-size: 9px;
  color: #b57742;
  letter-spacing: 0;
  white-space: nowrap;
}

.goal-target b {
  font-size: 10px;
  color: #8b4c1c;
  font-variant-numeric: tabular-nums;
}

.goal-score {
  position: relative;
  z-index: 1;
  margin-top: 1px;
  font-size: 23px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 1px 0 #fff;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}

.goal-score.bump {
  transform: scale(1.12);
}

.goal-track {
  position: relative;
  z-index: 1;
  height: 8px;
  margin-top: 4px;
  border-radius: 99px;
  background: #d4b083;
  box-shadow: inset 0 2px 3px rgba(102, 56, 16, 0.35), 0 1px 0 #fff;
}

.goal-fill {
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #8cdf56 0%, #ffd83d 56%, #ff9d2e 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: width 0.4s cubic-bezier(0.25, 0.9, 0.3, 1);
}

.goal-star {
  position: absolute;
  top: 50%;
  width: 13px !important;
  height: 13px !important;
  transform: translate(-50%, -50%);
  color: #c8a97e;
  filter: drop-shadow(0 1px 0 #fff);
  transition: color 0.2s ease, transform 0.2s ease;
}

.goal-star:last-child {
  left: 97% !important;
}

.goal-star.on {
  color: #ffb400;
  filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 0 3px rgba(255, 170, 0, 0.8));
  transform: translate(-50%, -50%) scale(1.08);
}

.pause-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-height: 40px;
  align-self: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffbd64 0%, #ff912f 52%, #f27315 100%);
  box-shadow:
    0 4px 0 #c65b0a,
    0 8px 14px rgba(88, 38, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
  color: #fff;
  cursor: pointer;
}

.pause-btn .mp-icon {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 0 rgba(126, 55, 0, 0.5));
}

.pause-btn:active,
.btn:active,
.overlay button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c65b0a, 0 3px 8px rgba(88, 38, 0, 0.25);
}

/* ---------- board ---------- */

.stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1px 0;
}

.board-frame {
  position: relative;
  width: min(100%, calc(100dvh - 218px), 560px);
  aspect-ratio: 1 / 1;
  padding: 7px;
  border-radius: 27px;
  background:
    linear-gradient(180deg, #ffe8ad 0%, #ffcb70 24%, #f6a63f 66%, #df7b1f 100%);
  box-shadow:
    0 18px 34px rgba(58, 28, 3, 0.38),
    0 5px 0 rgba(137, 67, 12, 0.65),
    inset 0 2px 2px rgba(255, 255, 255, 0.9),
    inset 0 -4px 7px rgba(145, 70, 9, 0.42);
}

.board-frame::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 3;
}

.board-frame::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 14px;
  right: 14px;
  height: 22%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 2;
}

.board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3px;
  width: 100%;
  height: 100%;
  padding: 5px;
  border-radius: 21px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 8px, transparent 8px 16px),
    linear-gradient(180deg, #28435f 0%, #1d344c 48%, #172a3e 100%);
  box-shadow:
    inset 0 6px 14px rgba(0, 0, 0, 0.55),
    inset 0 -2px 0 rgba(255, 255, 255, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.28);
  touch-action: none;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.032);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  touch-action: none;
}

.cell.alt {
  background: rgba(0, 0, 0, 0.08);
}

.cell::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 55%);
  pointer-events: none;
}

.cell.sel {
  background: rgba(255, 240, 168, 0.22);
  box-shadow:
    inset 0 0 0 2px rgba(255, 231, 137, 0.95),
    0 0 14px rgba(255, 190, 55, 0.85);
}

.cell.sel .gem {
  transform: scale(1.1);
  filter: drop-shadow(0 0 7px rgba(255, 232, 138, 0.95)) drop-shadow(0 3px 2px rgba(0, 0, 0, 0.3));
}

.cell.hint .gem {
  animation: hintWiggle 0.72s ease-in-out infinite;
}

.gem {
  position: relative;
  width: 92%;
  height: 92%;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.35));
  transform-origin: 50% 54%;
  transition: transform 0.13s ease, filter 0.13s ease;
  pointer-events: none;
  will-change: transform;
}

.gem::after {
  content: "";
  position: absolute;
  top: 11%;
  left: 16%;
  width: 30%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 72%);
  transform: rotate(-28deg);
  opacity: 0.7;
  pointer-events: none;
}

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

.gem.swap {
  animation: swapPop 0.18s ease;
}

.gem.pop {
  animation: gemPop 0.24s cubic-bezier(0.4, 0, 0.7, 1) forwards;
}

.gem.drop {
  animation: gemDrop 0.3s cubic-bezier(0.2, 0.85, 0.35, 1.08);
}

.pop-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  height: 22%;
  border: 2px solid rgba(255, 240, 160, 0.9);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ringOut 0.4s ease-out forwards;
  pointer-events: none;
}

.float-layer {
  position: absolute;
  z-index: 5;
  inset: 9px;
  border-radius: 21px;
  overflow: hidden;
  pointer-events: none;
}

.float-score {
  position: absolute;
  z-index: 2;
  font-size: clamp(18px, 4.8vw, 24px);
  font-weight: 900;
  color: #fffdf0;
  white-space: nowrap;
  text-shadow:
    0 2px 0 #a95400,
    0 -1px 0 #a95400,
    1px 0 0 #a95400,
    -1px 0 0 #a95400,
    0 0 12px rgba(255, 184, 40, 0.95);
  transform: translate(-50%, -50%);
  animation: floatUp 0.9s ease-out forwards;
}

.combo-burst[hidden] {
  display: none;
}

.combo-burst {
  position: absolute;
  z-index: 6;
  inset: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 21px;
  pointer-events: none;
  opacity: 0;
}

.combo-burst.show {
  animation: burstShow 1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

.burst-title {
  font-size: clamp(30px, 9.5vw, 46px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: #ffe067;
  -webkit-text-stroke: 2.5px #8a3800;
  text-shadow:
    0 4px 0 #a84a00,
    0 7px 0 rgba(111, 42, 0, 0.65),
    0 0 22px rgba(255, 180, 30, 0.85);
  transform: rotate(-2deg);
}

.burst-points {
  padding: 0 14px;
  border-radius: 99px;
  font-size: clamp(19px, 5.4vw, 27px);
  font-weight: 900;
  line-height: 1.35;
  color: #fff8d0;
  background: linear-gradient(90deg, rgba(93, 45, 0, 0), rgba(93, 45, 0, 0.34) 18%, rgba(93, 45, 0, 0.34) 82%, rgba(93, 45, 0, 0));
  text-shadow: 0 2px 0 #a34c00, 0 0 12px rgba(255, 190, 40, 0.95);
  transform: rotate(-2deg);
}

.toast {
  position: absolute;
  z-index: 8;
  top: 14%;
  left: 50%;
  max-width: 86%;
  padding: 8px 15px;
  border: 1px solid rgba(255, 236, 180, 0.45);
  border-radius: 99px;
  background: rgba(54, 30, 8, 0.9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  color: #ffe9b9;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

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

/* ---------- combo panel ---------- */

.combo-panel {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 7px 11px 7px 7px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 21px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.5) 0 16%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #fffaf0 0%, #ffedc9 50%, #ffdfa9 100%);
  box-shadow:
    0 7px 0 rgba(152, 77, 20, 0.22),
    0 12px 22px rgba(62, 31, 5, 0.2),
    inset 0 2px 0 #fff;
  overflow: hidden;
}

.combo-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 175, 71, 0.22);
  pointer-events: none;
}

.combo-orb {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 3px solid #fff6d5;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, #fff4ae 0%, #ffc84d 37%, #ff9020 78%, #ef6d0c 100%);
  box-shadow:
    0 4px 9px rgba(150, 66, 0, 0.36),
    inset 0 -4px 8px rgba(183, 81, 0, 0.45),
    inset 0 2px 2px rgba(255, 255, 255, 0.7);
  color: #6d3100;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.combo-panel.hot .combo-orb {
  transform: scale(1.06);
  box-shadow:
    0 0 18px rgba(255, 180, 40, 0.9),
    0 4px 9px rgba(150, 66, 0, 0.4),
    inset 0 -4px 8px rgba(183, 81, 0, 0.45),
    inset 0 2px 2px rgba(255, 255, 255, 0.7);
  animation: orbPulse 0.55s ease-in-out infinite alternate;
}

.orb-label {
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  opacity: 0.78;
}

.orb-value {
  margin-top: 1px;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.combo-main {
  flex: 1 1 auto;
  min-width: 0;
}

.combo-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
  color: var(--ink-soft);
  font-size: 11px;
}

.combo-bonus {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.combo-best {
  margin-left: auto;
  padding-right: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #b57a44;
  white-space: nowrap;
}

.combo-track {
  position: relative;
  height: 11px;
  margin-top: 5px;
  border-radius: 99px;
  background: linear-gradient(180deg, #65401e, #4a2d13);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), 0 1px 0 #fff;
  overflow: hidden;
}

.combo-track::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 2px;
  height: 2px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.combo-fill {
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0 38%, rgba(255, 255, 255, 0) 39%),
    linear-gradient(90deg, #ffcf4a 0%, #ffa129 52%, #ff7420 100%);
  box-shadow: 0 0 10px rgba(255, 165, 32, 0.7);
  transition: width 0.28s cubic-bezier(0.25, 0.9, 0.3, 1);
}

.combo-panel.hot .combo-fill {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48) 0 38%, rgba(255, 255, 255, 0) 39%),
    linear-gradient(90deg, #ffe35a 0%, #ff8a24 50%, #ff4d19 100%);
  animation: fillGlow 0.55s ease-in-out infinite alternate;
}

.hint-line {
  flex: 0 0 auto;
  margin: -1px 0 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(20, 48, 22, 0.55);
}

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(36, 22, 7, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.overlay[hidden] {
  display: none;
}

.sheet {
  width: 100%;
  max-width: 340px;
  padding: 20px 20px 18px;
  border: 3px solid #ffd28d;
  border-radius: 28px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, #fffdf6 0%, #fff3d8 58%, #ffe9be 100%);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.45),
    0 6px 0 rgba(150, 76, 20, 0.28),
    inset 0 2px 0 #fff;
  text-align: center;
  animation: sheetIn 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.star-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 8px;
}

.end-star {
  width: 36px !important;
  height: 36px !important;
  color: #d8c3a2;
  filter: drop-shadow(0 2px 0 #fff);
  transform: scale(0.9);
  transition: color 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}

.end-star.on {
  color: #ffb400;
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 0 9px rgba(255, 170, 0, 0.65));
  transform: scale(1.08);
}

.sheet h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #71350f;
  text-shadow: 0 1px 0 #fff;
}

.sheet-sub {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #a16531;
}

.final-score {
  margin-top: 8px;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #71350f;
  text-shadow:
    0 2px 0 #fff,
    0 4px 0 rgba(255, 255, 255, 0.55),
    0 0 18px rgba(255, 178, 40, 0.35);
  font-variant-numeric: tabular-nums;
}

.best-line {
  margin: 8px 0 16px;
  font-size: 12px;
  color: #b07845;
  font-weight: 600;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 17px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn + .btn {
  margin-top: 10px;
}

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

.btn.primary {
  border: 2px solid #fff1cb;
  background: linear-gradient(180deg, #ffbd5c 0%, #ff912f 48%, #f47615 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(122, 50, 0, 0.35);
  box-shadow:
    0 6px 0 #c65b0a,
    0 12px 18px rgba(155, 66, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.btn.ghost {
  border: 2px solid #f0c78e;
  background: linear-gradient(180deg, #fffdf6, #fff2d7);
  color: #9a5b25;
  box-shadow: 0 4px 0 #e2b87f;
}

.pause-sheet .btn {
  margin-top: 10px;
}

.pause-sheet .sheet-sub {
  margin-bottom: 16px;
}

button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

/* ---------- animations ---------- */

@keyframes gemPop {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.18) rotate(4deg); opacity: 1; filter: drop-shadow(0 0 12px rgba(255, 240, 150, 0.95)); }
  100% { transform: scale(0.1) rotate(-18deg); opacity: 0; }
}

@keyframes gemDrop {
  0% { transform: translateY(-72%) scale(0.9); opacity: 0.2; }
  70% { transform: translateY(4%) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes swapPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.13); }
  100% { transform: scale(1); }
}

@keyframes hintWiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-5deg) scale(1.05); }
  65% { transform: rotate(5deg) scale(1.05); }
}

@keyframes ringOut {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.5); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.6); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  65% { opacity: 1; transform: translate(-50%, -95%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -155%) scale(0.94); }
}

@keyframes burstShow {
  0% { opacity: 0; transform: scale(0.45) rotate(-7deg); }
  18% { opacity: 1; transform: scale(1.08) rotate(-2deg); }
  32% { transform: scale(1) rotate(-2deg); }
  78% { opacity: 1; transform: scale(1) rotate(-2deg); }
  100% { opacity: 0; transform: scale(1.12) rotate(-2deg); }
}

@keyframes lowPulse {
  0%, 100% { box-shadow: 0 4px 0 rgba(160, 84, 23, 0.34), 0 8px 16px rgba(69, 35, 4, 0.18), inset 0 2px 0 #fff; }
  50% { box-shadow: 0 0 0 3px rgba(255, 90, 50, 0.3), 0 4px 0 rgba(160, 84, 23, 0.34), 0 8px 16px rgba(69, 35, 4, 0.18), inset 0 2px 0 #fff; }
}

@keyframes orbPulse {
  from { transform: scale(1.03); }
  to { transform: scale(1.1); }
}

@keyframes fillGlow {
  from { box-shadow: 0 0 6px rgba(255, 165, 32, 0.55); }
  to { box-shadow: 0 0 14px rgba(255, 120, 20, 0.95); }
}

@keyframes sheetIn {
  0% { opacity: 0; transform: translateY(18px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-height: 640px) {
  .game {
    gap: 6px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .hud { min-height: 64px; grid-template-columns: 52px minmax(0, 1fr) 52px 38px; gap: 6px; }
  .card-value { font-size: 22px; }
  .goal-score { font-size: 20px; }
  .board-frame { width: min(100%, calc(100dvh - 198px), 560px); border-radius: 23px; }
  .combo-panel { min-height: 58px; }
  .combo-orb { width: 44px; height: 44px; }
  .orb-value { font-size: 16px; }
  .combo-track { height: 9px; }
  .hint-line { font-size: 10px; }
}

@media (max-height: 540px) {
  .hint-line { display: none; }
  .board-frame { width: min(100%, calc(100dvh - 172px), 560px); }
}

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