:root {
  --bg: #071c39;
  --bg-deep: #05172f;
  --board-a: #0d2a51;
  --board-b: #163860;
  --line: #31557f;
  --line-soft: #29486e;
  --text: #f7f9ff;
  --muted: #aabbd8;
  --green: #45d867;
  --green-dark: #22a948;
  --board-w: 520px;
  --ui-scale: 1;
  --radius: 18px;
  --shadow: 0 16px 42px rgba(0, 9, 28, .28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); }
body {
  color: var(--text);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
  touch-action: manipulation;
}
button { font: inherit; }
.board-item, .producer { color: inherit; }

.app {
  width: 100%;
  height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 50% 38%, rgba(24, 64, 112, .16), transparent 40%),
    linear-gradient(180deg, #092142 0%, var(--bg-deep) 100%);
}

.corner-hud {
  position: fixed;
  z-index: 30;
  inset: 0 0 auto 0;
  pointer-events: none;
}
.wallet {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  top: max(14px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(22px, 3.2vmin, 32px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
  pointer-events: auto;
}
.crown { font-size: 1.05em; filter: drop-shadow(0 3px 0 rgba(0,0,0,.13)); }
.pause-button {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  top: max(14px, env(safe-area-inset-top));
  width: clamp(42px, 5.6vmin, 54px);
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  pointer-events: auto;
}
.pause-button span {
  width: 7px;
  height: 28px;
  max-height: 56%;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 0 rgba(0,0,0,.16);
}
.pause-button:active { transform: scale(.92); }

.game-column {
  width: var(--board-w);
  height: auto;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(8px, 1.25svh, 14px);
  padding-top: 8px;
  padding-bottom: 8px;
  transform: translate(-50%, -50%) scale(var(--ui-scale));
  transform-origin: 50% 50%;
}

.score-hud { flex: 0 0 auto; text-align: center; }
.score {
  font-size: clamp(42px, 7.8vmin, 78px);
  font-weight: 950;
  line-height: .88;
  letter-spacing: -2px;
  text-shadow: 0 4px 0 rgba(0,0,0,.10);
}
.level {
  margin-top: clamp(8px, 1.1svh, 13px);
  color: #baddff;
  font-size: clamp(16px, 2.6vmin, 25px);
  font-weight: 950;
  letter-spacing: .05em;
}
.level-progress-row {
  width: calc(100% - clamp(20px, 5vw, 56px));
  margin: clamp(8px, 1svh, 12px) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0;
}
.level-track {
  height: clamp(8px, 1.25vmin, 12px);
  border-radius: 999px;
  background: #294a77;
  overflow: visible;
  position: relative;
}
.level-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .28s ease;
  position: relative;
}
.level-fill::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  right: -9px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(0,0,0,.16);
}
.level-fill[style*="0%"]::after { right: -9px; }
.level-count { display: none; }

.pressure-hud {
  --pressure-color: #d9853d;
  width: calc(100% - clamp(20px, 5vw, 56px));
  min-height: 22px;
  margin: 7px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(200, 216, 238, .72);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .08em;
}
.pressure-move,
.pressure-next {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
}
.pressure-caption {
  opacity: .66;
}
.pressure-pips {
  display: inline-flex;
  gap: 4px;
}
.pressure-pips i {
  width: 15px;
  height: 5px;
  border-radius: 999px;
  background: rgba(129, 156, 190, .22);
  box-shadow: inset 0 0 0 1px rgba(194, 218, 247, .08);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.pressure-pips i.filled {
  background: var(--pressure-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--pressure-color) 35%, transparent);
  transform: scaleY(1.12);
}
.pressure-next {
  padding-left: 10px;
  border-left: 1px solid rgba(165, 191, 224, .13);
}
.pressure-next img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.pressure-next b {
  color: rgba(236, 243, 253, .84);
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: .05em;
}

.board {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 6 / 8;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: clamp(3px, .45vmin, 4px) solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.015);
  background: var(--board-a);
}
.board-cell {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
}
.board-cell.a { background: var(--board-a); }
.board-cell.b { background: var(--board-b); }
.board-cell.merge-source { z-index: 5; }

.board-item {
  width: 94%;
  height: 94%;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transform: translateZ(0);
  animation: itemIn .2s cubic-bezier(.2,.9,.2,1.28);
}
.board-item:active { transform: scale(.92); }
.board-item.no-pair { animation: noPair .28s ease; }
.board-item.upgrade { animation: upgrade .42s cubic-bezier(.2,.85,.2,1.25); }
.board-item img {
  width: 98%;
  height: 98%;
  object-fit: contain;
  pointer-events: none;
  filter: var(--item-filter, none) drop-shadow(0 6px 5px rgba(0,0,0,.20));
}
.item-progress {
  position: absolute;
  z-index: 4;
  left: 7%;
  right: 7%;
  top: 4%;
  pointer-events: none;
}
.item-track {
  position: relative;
  height: clamp(10px, 1.35vmin, 14px);
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(4, 16, 38, .96), rgba(17, 34, 59, .94));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    inset 0 -1px 0 rgba(0,0,0,.22),
    0 0 0 1px rgba(255,255,255,.16);
}
.item-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--category-color, #fff) 82%, white 18%), var(--category-color, #fff));
  transition: width .2s ease;
  box-shadow: 0 0 10px color-mix(in srgb, var(--category-color, #fff) 45%, transparent);
}
.item-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.98);
  font-size: clamp(8px, 1.28vmin, 11px);
  line-height: 1;
  font-weight: 1000;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.82);
  letter-spacing: .01em;
}
.item-max .item-track { background: rgba(69,216,103,.35); }
.item-max .item-fill { width: 100% !important; background: var(--green); }
.item-max .item-label { color: #effff1; }

.separator {
  flex: 0 0 auto;
  width: 100%;
  height: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(2px, .7vw, 7px);
}
.separator i {
  display: block;
  width: clamp(10px, 2.4vw, 22px);
  height: 4px;
  border-radius: 999px;
  background: #61799d;
  opacity: .82;
}

.producer-lane {
  flex: 0 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(42px, .95fr);
  gap: clamp(7px, 1.2vw, 12px);
  align-items: stretch;
}
.crate-slots {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(5px, .9vw, 9px);
}
.crate-slot, .add-crate {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: clamp(10px, 1.5vmin, 15px);
}
.crate-slot {
  position: relative;
  background: #f8fafc;
  border: clamp(2px, .34vmin, 3px) solid #c8d2df;
  box-shadow: 0 5px 0 #a7b5c6, 0 9px 14px rgba(0,0,0,.18);
  overflow: hidden;
}
.crate-slot.empty::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 8px;
  border: 2px dashed rgba(54, 75, 102, .12);
}
.producer {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
}
.producer:active { transform: translateY(2px) scale(.96); }
.producer .crate-art {
  position: absolute;
  inset: 3%;
  width: 94%;
  height: 94%;
  object-fit: contain;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.18));
  pointer-events: none;
}
.producer .category-icon {
  position: absolute;
  width: 60%;
  height: 60%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  background: transparent;
  border: 0;
  padding: 0;
  filter: var(--item-filter, none) drop-shadow(0 4px 4px rgba(0,0,0,.28));
  pointer-events: none;
}
.producer::after {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 11px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--category-color) 38%, transparent);
  pointer-events: none;
}
.add-crate {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #50df70 0%, #23b948 100%);
  box-shadow: 0 6px 0 #148836, 0 10px 16px rgba(0,0,0,.18);
  font-size: clamp(34px, 6.5vmin, 58px);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.add-crate:active { transform: translateY(4px); box-shadow: 0 2px 0 #158e37, 0 6px 10px rgba(0,0,0,.14); }
.add-crate:disabled { opacity: .35; filter: grayscale(.8); cursor: default; transform: none; }


.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 12, 29, .76);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.pause-overlay.show { opacity: 1; visibility: visible; }
.pause-card {
  width: min(390px, calc(100vw - 28px));
  max-height: min(680px, calc(100dvh - 30px));
  overflow: auto;
  padding: 18px;
  background: #f7f9fd;
  color: #153153;
  border: 1px solid #d7e0eb;
  border-radius: 24px;
  box-shadow: 0 22px 68px rgba(0,0,0,.34);
  display: grid;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #b7c6d7 transparent;
}
.pause-card::-webkit-scrollbar { width: 7px; }
.pause-card::-webkit-scrollbar-track { background: transparent; margin: 16px 0; }
.pause-card::-webkit-scrollbar-thumb { background: #b7c6d7; border-radius: 999px; border: 2px solid #f7f9fd; }
.pause-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pause-title { font-size: 27px; line-height: 1; font-weight: 1000; letter-spacing: -.03em; }
.pause-subtitle { margin-top: 5px; color: #8092a9; font-size: 10px; line-height: 1; font-weight: 1000; letter-spacing: .16em; }
.pause-close {
  width: 40px;
  height: 40px;
  padding: 0 0 3px;
  border: 1px solid #d9e2ed;
  border-radius: 12px;
  background: #edf2f7;
  color: #536b85;
  font-size: 25px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}
.pause-close:active { transform: scale(.94); }
.settings-group {
  padding: 13px;
  border: 1px solid #dce5ef;
  border-radius: 17px;
  background: #fff;
  display: grid;
  gap: 12px;
}
.settings-group.compact { gap: 7px; }
.settings-group-title { color: #8798ac; font-size: 10px; font-weight: 1000; letter-spacing: .13em; }
.setting-row {
  display: grid;
  grid-template-columns: 92px minmax(92px, 1fr) 38px;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}
.setting-copy { min-width: 0; display: grid; gap: 2px; }
.setting-copy b { color: #173758; font-size: 13px; line-height: 1.05; font-weight: 950; }
.setting-copy span { color: #94a2b3; font-size: 9px; line-height: 1.05; font-weight: 750; }
.setting-value { color: #58708a; font-size: 11px; font-weight: 950; text-align: right; font-variant-numeric: tabular-nums; }
.custom-slider {
  --slider-value: 50%;
  height: 30px;
  display: grid;
  align-items: center;
  cursor: pointer;
  outline: none;
  touch-action: none;
}
.custom-slider-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #dce5ee;
  box-shadow: inset 0 1px 2px rgba(32, 64, 96, .10);
}
.custom-slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--slider-value);
  border-radius: inherit;
  background: #42cf64;
}
.custom-slider-thumb {
  position: absolute;
  left: var(--slider-value);
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid #42cf64;
  box-shadow: 0 3px 8px rgba(26, 73, 111, .20);
}
.custom-slider:focus-visible .custom-slider-track { box-shadow: 0 0 0 3px rgba(69,216,103,.18), inset 0 1px 2px rgba(32,64,96,.10); }
.setting-toggle {
  width: 100%;
  min-height: 48px;
  padding: 8px 7px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  color: #173758;
  cursor: pointer;
}
.setting-toggle + .setting-toggle { border-top: 1px solid #edf1f5; }
.setting-toggle > span { display: grid; gap: 3px; }
.setting-toggle b { font-size: 13px; line-height: 1; font-weight: 950; }
.setting-toggle small { color: #94a2b3; font-size: 9px; line-height: 1; font-weight: 750; }
.setting-toggle i {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d9e2eb;
  box-shadow: inset 0 1px 2px rgba(31,66,101,.12);
  transition: background .16s ease;
}
.setting-toggle i::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(34,63,92,.22);
  transition: transform .18s cubic-bezier(.2,.8,.2,1);
}
.setting-toggle[aria-checked="true"] i { background: #45d867; }
.setting-toggle[aria-checked="true"] i::after { transform: translateX(18px); }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.menu-button {
  border: 0;
  min-height: 48px;
  border-radius: 14px;
  background: #e7edf4;
  color: #173758;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .035em;
  cursor: pointer;
}
.menu-button.primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.menu-button.danger { background: #edf1f5; color: #7a8796; }
.menu-button:active { transform: translateY(2px); }
@media (max-height: 610px) {
  .pause-card { gap: 9px; padding: 13px; border-radius: 20px; }
  .settings-group { padding: 9px 11px; gap: 7px; }
  .setting-row { min-height: 34px; }
  .setting-toggle { min-height: 40px; }
  .pause-title { font-size: 23px; }
}

.merge-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  object-fit: contain;
  transition: transform .22s cubic-bezier(.32,.72,.3,1), opacity .22s ease;
  will-change: transform, opacity;
}
.merge-ring {
  position: fixed;
  z-index: 95;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 3px solid var(--ring-color, #fff);
  pointer-events: none;
  animation: ring .42s ease-out forwards;
}

@keyframes itemIn { from { opacity: 0; transform: scale(.72); } to { opacity: 1; transform: scale(1); } }
@keyframes noPair { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
@keyframes upgrade { 0% { transform: scale(.9); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes ring { from { transform: translate(-50%,-50%) scale(.3); opacity: 1; } to { transform: translate(-50%,-50%) scale(5.2); opacity: 0; } }

@media (max-height: 560px) {
  .game-column { gap: 5px; }
  .score { font-size: 34px; }
  .level { margin-top: 4px; font-size: 14px; }
  .level-progress-row { margin-top: 5px; }
  .separator { height: 5px; }
  .wallet { top: max(8px, env(safe-area-inset-top)); }
  .pause-button { top: max(6px, env(safe-area-inset-top)); }
}

@media (max-width: 440px) {
  .producer-lane { gap: 6px; }
  .crate-slots { gap: 4px; }
  .crate-slot { border-width: 2px; box-shadow: 0 4px 0 #a7b5c6, 0 7px 11px rgba(0,0,0,.16); }
  .item-progress { left: 4%; right: 4%; grid-template-columns: 1fr; gap: 3px; }
  .item-count { text-align: center; min-width: 0; font-size: 8px; padding: 2px 5px; }
}


.board-item.dragging-source {
  opacity: .2;
  transform: scale(.9);
}
.drag-source-cell {
  z-index: 4;
}
.board-cell.drop-empty::after,
.board-cell.drop-merge::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 14px;
  pointer-events: none;
}
.board-cell.drop-empty::after {
  border: 2px dashed rgba(255,255,255,.34);
  background: rgba(255,255,255,.06);
}
.board-cell.drop-merge::after {
  border: 2px solid rgba(255,255,255,.42);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), 0 0 22px rgba(255,255,255,.10);
  background: color-mix(in srgb, var(--green) 18%, transparent);
}
.drag-ghost {
  position: fixed !important;
  z-index: 120;
  margin: 0;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .98;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 42%, rgba(255,255,255,.12), rgba(255,255,255,0) 55%);
}
.drag-ghost img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: block;
  filter: var(--item-filter, none) drop-shadow(0 10px 10px rgba(0,0,0,.22));
}

.cell-flash {
  position: fixed;
  z-index: 126;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--flash-color, #fff) 72%, white 28%) 0%, color-mix(in srgb, var(--flash-color, #fff) 30%, transparent) 58%, transparent 72%);
  animation: cellFlash .34s ease-out forwards;
}
@keyframes cellFlash {
  from { transform: translate(-50%, -50%) scale(.2); opacity: .95; }
  to { transform: translate(-50%, -50%) scale(var(--flash-scale, 1.1)); opacity: 0; }
}

.soft-ring {
  position: fixed;
  z-index: 124;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--ring-color, #fff) 68%, white 32%);
  box-shadow: 0 0 12px color-mix(in srgb, var(--ring-color, #fff) 34%, transparent);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: softRing .36s ease-out forwards;
}
@keyframes softRing {
  from { transform: translate(-50%, -50%) scale(.25); opacity: .85; }
  to { transform: translate(-50%, -50%) scale(1.45); opacity: 0; }
}

.merge-absorbed-source {
  opacity: .08;
  transform: scale(.86);
  transition: opacity .16s ease, transform .16s ease;
}
.drag-ghost.merge-collector {
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.18));
}
.absorbed-ghost {
  pointer-events: none;
}

.drag-ghost .item-progress,
.merge-item-ghost .item-progress {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 4%;
  z-index: 2;
  pointer-events: none;
}
.merge-item-ghost {
  position: fixed;
  z-index: 102;
  margin: 0;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: .98;
  display: grid;
  place-items: center;
  border-radius: 16px;
}
.merge-item-ghost img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  display: block;
  filter: var(--item-filter, none) drop-shadow(0 10px 10px rgba(0,0,0,.22));
}

.drag-ghost.board-item,
.merge-item-ghost.board-item {
  position: fixed !important;
  z-index: 120;
  margin: 0;
  inset: auto;
  pointer-events: none;
  opacity: .98;
}
.drag-ghost.board-item {
  box-shadow: 0 12px 24px rgba(0,0,0,.18);
}
.merge-item-ghost.board-item {
  z-index: 102;
}
.merge-target-pulse {
  z-index: 103 !important;
}
.drag-ghost.board-item img,
.merge-item-ghost.board-item img {
  width: 98%;
  height: 98%;
}
.drag-ghost.board-item .item-progress,
.merge-item-ghost.board-item .item-progress {
  left: 7%;
  right: 7%;
  top: 4%;
}

.hide-progress .item-progress {
  opacity: 0 !important;
  visibility: hidden !important;
}


.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 112;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  contain: strict;
}

.board {
  transform-origin: 50% 50%;
  will-change: transform;
}

.board-item,
.producer,
.add-crate {
  -webkit-tap-highlight-color: transparent;
}

.board-item img {
  will-change: transform, filter;
}




/* Progressive board: the run begins with two full-width rows. */
.board-cell.locked-cell {
  background: #081a33 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.018);
  pointer-events: none;
}
.board-cell.locked-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.018) 0 6px, transparent 6px 12px);
  pointer-events: none;
}
.unlock-gate {
  --gate-row: 2;
  position: absolute;
  z-index: 22;
  left: 10px;
  right: 10px;
  top: calc(var(--gate-row) * 12.5%);
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-top: 1px solid rgba(128, 158, 196, .14);
  transition: top .46s cubic-bezier(.2,.82,.2,1), opacity .2s ease;
}
.unlock-gate.hidden { opacity: 0; }
.unlock-gate-pill {
  min-height: 24px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(6, 20, 40, .90);
  border: 1px solid rgba(154, 185, 221, .16);
  box-shadow: 0 8px 22px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.06);
  color: rgba(226,237,250,.72);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  backdrop-filter: blur(8px);
}
.unlock-gate-pill b {
  color: #f3f8ff;
  font-size: 10px;
  letter-spacing: .04em;
}
.unlock-lock {
  width: 13px;
  height: 11px;
  border-radius: 3px;
  background: #7187a5;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}
.unlock-lock::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: 3px;
  top: -6px;
  border: 2px solid #7187a5;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  box-sizing: border-box;
}
.board-cell.row-unlocking {
  animation: rowUnlock .62s cubic-bezier(.16,.86,.22,1) both;
}
.board.board-expanded {
  animation: boardExpand .5s cubic-bezier(.2,.82,.2,1);
}
@keyframes rowUnlock {
  0% { filter: brightness(.55); transform: scale(.92); opacity: .2; }
  48% { filter: brightness(1.42); transform: scale(1.035); opacity: 1; }
  100% { filter: brightness(1); transform: scale(1); opacity: 1; }
}
@keyframes boardExpand {
  0%,100% { transform: scale(1); }
  42% { transform: scale(1.008); }
}

.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  background: rgba(5, 23, 47, .96);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}
.game-over-overlay.show { opacity: 1; visibility: visible; }
.game-over-content {
  width: min(340px, 88vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.game-over-logo {
  width: min(48vw, 265px);
  height: auto;
  display: block;
  margin-bottom: clamp(18px, 3.2vh, 28px);
  filter: drop-shadow(0 10px 20px rgba(0,0,0,.22));
}
.game-over-kicker {
  color: #8aa6c7;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .17em;
}
.game-over-title {
  margin-top: 7px;
  color: #f7f9ff;
  font-size: clamp(34px, 8vw, 48px);
  line-height: .9;
  font-weight: 1000;
  letter-spacing: -.045em;
}
.game-over-score-label {
  margin-top: clamp(24px, 4vh, 34px);
  color: #7892b3;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .13em;
}
.game-over-money {
  margin-top: 5px;
  color: #58df78;
  font-size: clamp(34px, 8vw, 46px);
  line-height: 1;
  font-weight: 1000;
}
.game-over-level {
  margin-top: 6px;
  color: #b8cae1;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
}
.game-over-best {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}
.game-over-best span {
  color: #6f89aa;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: .12em;
}
.game-over-best b {
  color: #d9e7f7;
  font-size: 17px;
  font-weight: 1000;
}
.game-over-actions {
  width: 100%;
  margin-top: clamp(24px, 4.2vh, 34px);
  display: grid;
  gap: 11px;
}
.game-over-restart,
.game-over-menu {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .05em;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.game-over-restart {
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 0 var(--green-dark);
}
.game-over-menu {
  background: #e7edf4;
  color: #173758;
}
.game-over-restart:active,
.game-over-menu:active { transform: translateY(2px) scale(.99); }
.game-over-restart:active { box-shadow: 0 2px 0 var(--green-dark); }

.board-cell.next-unlock-cell::after {
  content: none;
}
.board-cell.next-unlock-cell::before {
  opacity: 1;
}
.unlock-gate-pill {
  transform: translateY(-50%);
}
@media (max-height: 560px) {
  .pressure-hud { min-height: 17px; margin-top: 4px; gap: 8px; }
  .pressure-move, .pressure-next { min-height: 17px; }
  .pressure-next img { width: 15px; height: 15px; }
  .pressure-pips i { width: 12px; height: 4px; }
}

/* v34: board-only 2048-style loop. Bottom producers and pressure HUD were removed. */
.game-column {
  justify-content: center;
  gap: clamp(8px, 1.4vh, 14px);
}
.score-hud { margin-bottom: 2px; }
.board { flex: 0 0 auto; }


/* v36: upcoming unlock feedback lives directly on the slots that will open. */
.board-cell.next-unlock-cell {
  overflow: visible;
  box-shadow:
    inset 0 0 0 1px rgba(119, 224, 144, .24),
    inset 0 0 18px rgba(79, 205, 110, .045);
}
.board-cell.next-unlock-cell::before { opacity: .48; }
.slot-unlock-preview {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 10%;
  width: calc(100% - 8px);
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}
.slot-unlock-preview b,
.slot-unlock-preview span {
  display: block;
  max-width: 100%;
  white-space: nowrap;
}
.slot-unlock-preview b {
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(8, 27, 51, .94);
  border: 1px solid rgba(139, 228, 160, .24);
  box-shadow: 0 4px 11px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.055);
  color: #edf8f0;
  font-size: clamp(7px, 1.18vmin, 9px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .035em;
}
.slot-unlock-preview span {
  color: rgba(126, 225, 150, .78);
  font-size: clamp(6px, 1.02vmin, 8px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .025em;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
@media (max-width: 440px) {
  .slot-unlock-preview { top: 8%; width: calc(100% - 4px); gap: 1px; }
  .slot-unlock-preview b { padding: 2px 4px; font-size: 7px; }
  .slot-unlock-preview span { font-size: 6px; }
}


/* v38: board chests + keys. Both are mergeable tier lines; matching key/chest tiers open. */
.board-cell.drop-open::after {
  content: "";
  position: absolute;
  inset: 6%;
  z-index: 7;
  border-radius: 14px;
  pointer-events: none;
  border: 2px solid rgba(250, 211, 96, .78);
  background: rgba(250, 211, 96, .08);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.06),
    0 0 18px rgba(250, 211, 96, .18);
  animation: openTargetPulse .7s ease-in-out infinite alternate;
}
@keyframes openTargetPulse {
  from { opacity: .55; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

.special-item {
  --special-color: #f0c35b;
  overflow: visible;
}
.special-item:active { transform: scale(.94); }
.special-art {
  position: relative;
  width: 84%;
  height: 84%;
  pointer-events: none;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.22));
}
.special-tier {
  position: absolute;
  right: 4%;
  bottom: 4%;
  z-index: 5;
  min-width: 25px;
  height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(7, 24, 48, .94);
  border: 1px solid color-mix(in srgb, var(--special-color) 58%, white 12%);
  color: #f7fbff;
  font-size: clamp(7px, 1.08vmin, 9px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .02em;
  box-shadow: 0 4px 10px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.07);
  pointer-events: none;
}

/* Chest: chunky, flat, readable at tiny board-cell sizes. */
.chest-art {
  width: 88%;
  height: 76%;
  margin-top: 4%;
}
.chest-body,
.chest-lid,
.chest-band,
.chest-lock {
  position: absolute;
  display: block;
}
.chest-body {
  left: 8%;
  right: 8%;
  bottom: 8%;
  height: 48%;
  border-radius: 9px 9px 12px 12px;
  background: color-mix(in srgb, var(--special-color) 68%, #6f421f 32%);
  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.14),
    inset 0 -5px 0 rgba(67, 39, 21, .24),
    0 0 0 2px rgba(20, 29, 42, .28);
}
.chest-lid {
  left: 6%;
  right: 6%;
  top: 8%;
  height: 40%;
  border-radius: 17px 17px 8px 8px;
  background: color-mix(in srgb, var(--special-color) 76%, #81512a 24%);
  box-shadow:
    inset 0 4px 0 rgba(255,255,255,.17),
    inset 0 -5px 0 rgba(54,35,23,.2),
    0 0 0 2px rgba(20, 29, 42, .3);
}
.chest-band {
  left: 45%;
  top: 7%;
  bottom: 7%;
  width: 11%;
  border-radius: 5px;
  background: color-mix(in srgb, var(--special-color) 58%, #fff2a6 42%);
  box-shadow: inset 0 0 0 1px rgba(69,52,20,.18);
}
.chest-lock {
  left: 50%;
  top: 46%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%,-50%);
  border-radius: 5px;
  background: color-mix(in srgb, var(--special-color) 54%, #fff1a0 46%);
  box-shadow: 0 2px 0 rgba(82,58,18,.28), inset 0 1px 0 rgba(255,255,255,.32);
}
.chest-lock::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 7px;
  transform: translate(-50%,-36%);
  border-radius: 3px;
  background: rgba(61,48,24,.65);
}

/* Key: same tier color language as the chest so matching is instantly readable. */
.key-art {
  width: 86%;
  height: 86%;
  transform: rotate(-14deg);
}
.key-ring,
.key-shaft,
.key-tooth {
  position: absolute;
  display: block;
  background: color-mix(in srgb, var(--special-color) 74%, #fff4b0 26%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.28),
    0 0 0 2px rgba(25,35,49,.22),
    0 5px 7px rgba(0,0,0,.16);
}
.key-ring {
  width: 42%;
  aspect-ratio: 1;
  left: 8%;
  top: 16%;
  border-radius: 50%;
}
.key-ring::after {
  content: "";
  position: absolute;
  inset: 27%;
  border-radius: 50%;
  background: var(--board-a);
  box-shadow: inset 0 0 0 2px rgba(20,31,45,.18);
}
.key-shaft {
  left: 40%;
  top: 44%;
  width: 48%;
  height: 15%;
  border-radius: 999px;
}
.key-tooth {
  width: 13%;
  height: 24%;
  border-radius: 3px 3px 5px 5px;
}
.key-tooth-a { left: 68%; top: 49%; }
.key-tooth-b { left: 80%; top: 45%; height: 30%; }

.special-item.item-max .special-tier {
  min-width: 31px;
  color: #ecfff1;
  border-color: rgba(106, 226, 132, .48);
  background: rgba(24, 89, 48, .93);
}

@media (max-width: 440px) {
  .special-tier {
    right: 2%;
    bottom: 2%;
    min-width: 21px;
    height: 14px;
    padding: 0 4px;
    font-size: 7px;
  }
}

.special-item.pair-ready::before {
  content: "";
  position: absolute;
  inset: 4%;
  z-index: -1;
  border-radius: 16px;
  pointer-events: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--special-color) 34%, transparent),
              0 0 14px color-mix(in srgb, var(--special-color) 18%, transparent);
  animation: pairReady 1.25s ease-in-out infinite alternate;
}
@keyframes pairReady {
  from { opacity: .25; transform: scale(.94); }
  to { opacity: .72; transform: scale(1.02); }
}


/* Merge value feedback: queued, compact and independent from board re-renders. */
.float-text {
  position: fixed;
  z-index: 138;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  font-size: clamp(13px, 2.15vmin, 17px);
  line-height: 1;
  font-weight: 1000;
  letter-spacing: -.02em;
  color: var(--float-color, #fff);
  text-shadow:
    0 2px 0 rgba(3, 13, 28, .50),
    0 3px 7px rgba(0, 0, 0, .24);
  -webkit-font-smoothing: antialiased;
  transform: translate3d(-50%, 0, 0);
  will-change: transform, opacity;
  contain: layout style paint;
}
.float-text-merge {
  font-size: clamp(12px, 1.95vmin, 16px);
}
.float-text-upgrade {
  font-size: clamp(15px, 2.5vmin, 20px);
  letter-spacing: .025em;
}
.float-text-reward {
  font-size: clamp(14px, 2.25vmin, 18px);
}
.float-text-tier {
  font-size: clamp(12px, 2vmin, 16px);
}

/* v42: real locked-crate + key sprites. The uploaded gray metal art is tinted per tier. */
.special-art.chest-art,
.special-art.key-art {
  position: relative;
  width: 92%;
  height: 92%;
  margin: 0;
  display: grid;
  place-items: center;
  filter: none;
  overflow: visible;
}

.special-art.chest-art {
  width: 94%;
  height: 94%;
}

.special-art.chest-art .crate-base-art,
.special-art.chest-art .crate-lock-art,
.special-art.key-art .key-image-art {
  position: absolute;
  display: block;
  object-fit: contain;
  pointer-events: none;
  margin: 0;
}

.special-art.chest-art .crate-base-art {
  inset: 2%;
  width: 96%;
  height: 96%;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.22));
}

/* The tier-colored padlock sits physically on the crate face. */
.special-art.chest-art .crate-lock-art {
  left: 50%;
  top: 52%;
  width: 45%;
  height: 45%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.28));
  z-index: 3;
}

.special-art.key-art {
  transform: none;
}

.special-art.key-art .key-image-art {
  inset: 2%;
  width: 96%;
  height: 96%;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.22));
}

/* Disable the old CSS-drawn special art now that the real sprites are in use. */
.chest-body,
.chest-lid,
.chest-band,
.chest-lock,
.key-ring,
.key-shaft,
.key-tooth {
  display: none !important;
}

/* Keep the tier badge readable without obscuring the actual lock/key artwork. */
.chest-item .special-tier,
.key-item .special-tier {
  right: 1%;
  bottom: 1%;
}

@media (max-width: 440px) {
  .special-art.chest-art .crate-lock-art {
    width: 47%;
    height: 47%;
  }
}

/* Detached drag/merge copies must never inherit the board item's spawn animation.
   The board animation owns `transform`, which would override the centering translate. */
.drag-ghost.board-item,
.merge-item-ghost.board-item {
  animation: none !important;
  transition: none !important;
  transform: translate(-50%, -50%) !important;
  transform-origin: 50% 50% !important;
}

/* v46: crates are intentionally smaller than coins and keys. */
.special-art.chest-art {
  width: 78%;
  height: 78%;
}
.special-art.chest-art .crate-base-art {
  inset: 4%;
  width: 92%;
  height: 92%;
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.20));
}
.special-art.chest-art .crate-lock-art {
  top: 51%;
  width: 43%;
  height: 43%;
}
.opened-chest .special-art.chest-art {
  width: 76%;
  height: 76%;
}
.opened-chest .special-tier {
  background: rgba(8, 27, 51, .9);
  border-color: rgba(255,255,255,.16);
  color: #fff;
  min-width: 26px;
  text-align: center;
}
.opened-chest::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  opacity: .55;
}
.lock-open-ghost {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 4px rgba(0,0,0,.28));
}

@media (max-width: 440px) {
  .special-art.chest-art {
    width: 76%;
    height: 76%;
  }
  .opened-chest .special-art.chest-art {
    width: 74%;
    height: 74%;
  }
}


/* v50 boot + main menu */
.app.preplay .corner-hud,
.app.preplay .game-column {
  opacity: 0;
  pointer-events: none;
}
.boot-screen,
.menu-screen {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 28%, rgba(39, 92, 149, .18), transparent 42%), linear-gradient(180deg, #092142 0%, var(--bg-deep) 100%);
  transition: opacity .34s ease, visibility .34s ease;
}
.boot-screen.hidden,
.menu-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-logo,
.menu-logo {
  max-width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 28px rgba(0,0,0,.24));
}
.boot-logo {
  width: min(46vw, 336px);
  max-height: 18svh;
  opacity: 0;
  transform: translateY(12px) scale(.9);
  will-change: transform, opacity;
}
.boot-logo.logo-floating {
  opacity: 1;
  transform: none;
  animation: logoFloat 2.8s ease-in-out infinite;
}
.menu-logo {
  width: min(50vw, 384px);
  max-height: 22svh;
  will-change: transform, opacity;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}
.boot-loading-block {
  width: min(82vw, 420px);
  margin-top: clamp(18px, 4.8vh, 34px);
}
.boot-bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(41, 74, 119, .9);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.18);
}
.boot-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, #6af187 0%, #39cf63 100%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.14);
  transition: width .18s ease;
}
.boot-loading-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.boot-info,
.boot-percent {
  color: #d7e8ff;
  font-size: clamp(12px, 1.8vmin, 15px);
  font-weight: 900;
  letter-spacing: .025em;
}
.boot-info {
  color: #a9c4e8;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.menu-screen {
  gap: clamp(18px, 3.8vh, 28px);
}
.menu-actions-stack {
  width: min(82vw, 340px);
  display: grid;
  gap: 12px;
}
.menu-big-button {
  min-height: 58px;
  font-size: 16px;
  box-shadow: 0 6px 0 var(--green-dark);
}
.menu-mid-button {
  min-height: 50px;
  font-size: 13px;
}
.menu-best-strip {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #baddff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
}
.menu-best-strip b {
  color: #fff;
  font-size: 18px;
  letter-spacing: 0;
}
.menu-best-strip small {
  font-size: 12px;
  color: #8cc0ff;
}
.pause-overlay.menu-mode .pause-actions {
  display: none;
}
.stats-card {
  width: min(92vw, 430px);
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stats-tile {
  min-height: 88px;
  border-radius: 16px;
  background: #f2f6fb;
  border: 1px solid #dce6f2;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 7px;
}
.stats-tile span {
  color: #7790ac;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
}
.stats-tile b {
  color: #173758;
  font-size: 22px;
  line-height: 1;
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .boot-logo {
    width: min(52vw, 280px);
    max-height: 16svh;
  }
  .menu-logo {
    width: min(58vw, 320px);
    max-height: 19svh;
  }
}


/* v53 main menu cleanup */
.menu-actions-stack {
  margin-top: 2px;
}
.menu-best-strip {
  margin-top: 8px;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}
.menu-best-strip span {
  color: #8db6e6;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .12em;
}
.menu-best-strip b {
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}
.menu-best-strip small {
  color: #8cc0ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
}


/* v54 polished boot/menu motion */
.menu-screen {
  gap: clamp(13px, 2.6vh, 21px);
}
.menu-best-strip {
  margin: 1px 0 7px;
  min-height: 57px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  opacity: 1;
  will-change: transform, opacity;
}
.menu-best-strip span {
  font-size: 10px;
  letter-spacing: .14em;
  opacity: .76;
}
.menu-best-strip b {
  font-size: clamp(22px, 3.2vmin, 27px);
  text-shadow: 0 3px 0 rgba(0,0,0,.12);
}
.menu-best-strip small {
  font-size: 11px;
  opacity: .84;
}
.menu-actions-stack {
  margin-top: 0;
  gap: 11px;
  will-change: transform, opacity;
}
.menu-big-button,
.menu-mid-button {
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;
}
.menu-big-button:hover,
.menu-mid-button:hover {
  filter: brightness(1.035);
}
.menu-big-button:active,
.menu-mid-button:active {
  transform: translateY(2px) scale(.985);
}
.boot-loading-block {
  will-change: transform, opacity;
}
.boot-screen.hidden {
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .boot-logo.logo-floating { animation: none; }
}

.pause-overlay.menu-mode { z-index: 90; }


/* v57 wrong-move pressure feedback */
.board-item.no-pair {
  animation: wrongMoveShake .30s ease;
}
@keyframes wrongMoveShake {
  0%, 100% { transform: translateX(0); }
  24% { transform: translateX(-5px) rotate(-2deg); }
  48% { transform: translateX(5px) rotate(2deg); }
  72% { transform: translateX(-3px) rotate(-1deg); }
}


/* v58 first-play guided tutorial */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 82;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.tutorial-overlay.show { opacity: 1; visibility: visible; }
.tutorial-focus-layer { position: absolute; inset: 0; pointer-events: none; }
.tutorial-hand {
  position: fixed;
  z-index: 84;
  width: clamp(42px, 7vmin, 62px);
  height: auto;
  opacity: 0;
  transform: translate(-20%, -12%);
  transform-origin: 45% 72%;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.34));
  pointer-events: none;
  will-change: transform, left, top, opacity;
}
.tutorial-hand.show { opacity: 1; }
.tutorial-card {
  position: fixed;
  z-index: 85;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(430px, calc(100vw - 28px));
  padding: 16px 17px 15px;
  border-radius: 20px;
  background: #f7fbff;
  color: #12345b;
  box-shadow: 0 12px 34px rgba(0, 8, 24, .30);
  transform: translateX(-50%);
  pointer-events: auto;
}
.tutorial-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.tutorial-step-label,
.tutorial-progress {
  color: #5f7fa5;
  font-size: 10px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .12em;
}
.tutorial-title {
  color: #153a64;
  font-size: clamp(17px, 2.4vmin, 21px);
  line-height: 1.05;
  font-weight: 1000;
  letter-spacing: .015em;
}
.tutorial-text {
  margin-top: 8px;
  color: #527092;
  font-size: clamp(12px, 1.8vmin, 14px);
  line-height: 1.38;
  font-weight: 750;
}
.tutorial-next {
  width: 100%;
  min-height: 42px;
  margin-top: 13px;
  border: 0;
  border-radius: 13px;
  background: #45d867;
  color: #082d19;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .06em;
  cursor: pointer;
  box-shadow: 0 4px 0 #22a948;
}
.tutorial-next:active { transform: translateY(2px); box-shadow: 0 2px 0 #22a948; }
.tutorial-next.hidden { display: none; }
.tutorial-active .pause-button { opacity: .28; }
.board-cell.tutorial-focus {
  z-index: 6;
  outline: 3px solid rgba(255,255,255,.88);
  outline-offset: -4px;
  animation: tutorialCellPulse 1.05s ease-in-out infinite;
}
.board-cell.tutorial-dest { outline-color: #65e983; }
.score-hud.tutorial-hud-focus {
  position: relative;
  z-index: 6;
  animation: tutorialHudPulse 1.15s ease-in-out infinite;
}
.board.tutorial-board-focus { animation: tutorialHudPulse 1.15s ease-in-out infinite; }
@keyframes tutorialCellPulse {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}
@keyframes tutorialHudPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .78; transform: scale(1.015); }
}
@media (orientation: landscape) and (max-height: 620px) {
  .tutorial-card {
    left: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: 12px;
    width: min(330px, 38vw);
    transform: none;
    padding: 13px 14px 12px;
  }
  .tutorial-text { font-size: 11px; }
  .tutorial-next { min-height: 36px; margin-top: 10px; }
}
@media (max-width: 520px) {
  .tutorial-card { padding: 14px 15px 13px; border-radius: 18px; }
  .tutorial-text { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .board-cell.tutorial-focus,
  .score-hud.tutorial-hud-focus,
  .board.tutorial-board-focus { animation: none; }
}

/* v59 strict tutorial interaction lock */
.tutorial-active .board-cell {
  pointer-events: none;
}
.tutorial-active .board-cell.tutorial-focus {
  pointer-events: auto;
}
.tutorial-active .pause-button {
  pointer-events: none;
}


/* MortgageCalculator main-menu brand */
.menu-brand-logo {
  position: absolute;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(72vw, 460px);
  max-height: 42px;
  height: auto;
  object-fit: contain;
  transform: translateX(-50%);
  user-select: none;
  pointer-events: none;
}

@media (max-width: 520px) {
  .menu-brand-logo {
    width: min(78vw, 360px);
    max-height: 34px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}
