:root {
  --ink: #253242;
  --muted: #6a7380;
  --paper: #fff7e8;
  --tile: #fff1d9;
  --tile-alt: #ffd9c4;
  --teal: #2aa7a1;
  --teal-dark: #17817d;
  --mint: #d9fff2;
  --gold: #ffc94d;
  --rose: #fa6d91;
  --plum: #8b5ac9;
  --sky: #78c9f7;
  --wood: #9c6231;
  --shadow: 0 14px 32px rgba(35, 31, 32, 0.16);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(84, 191, 200, 0.58), rgba(255, 241, 202, 0.78) 39%, rgba(255, 220, 166, 0.9)),
    radial-gradient(circle at 18% 12%, #ffe278 0 9%, transparent 10%),
    linear-gradient(90deg, rgba(138, 88, 41, 0.1) 0 1px, transparent 1px 22px),
    #ffe6bc;
  display: grid;
  place-items: center;
  overflow: hidden;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

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

.game-shell {
  position: relative;
  width: min(100vw, 480px);
  min-height: 100vh;
  padding: 10px clamp(8px, 2.8vw, 16px) 14px;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 8px;
  overflow: hidden;
}

.topbar,
.orders-strip,
.actionbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
}

.topbar {
  min-height: 46px;
}

.level-badge,
.stat,
.icon-button,
.chest-progress,
.order-card,
.tool-button,
.primary-action {
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(58, 41, 34, 0.13);
}

.level-badge {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fffbe7, #ffdc70);
  border: 3px solid #ffffff;
  outline: 2px solid #e5ac22;
  line-height: 1;
}

.level-label {
  font-size: 10px;
  font-weight: 800;
  color: #8c6413;
}

.level-badge strong {
  display: block;
  font-size: 20px;
}

.stat {
  height: 38px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  background: #3b6f9f;
}

.stat svg,
.icon-button svg,
.chest-progress svg,
.tool-button svg,
.primary-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stat-energy {
  background: linear-gradient(180deg, #33b8ff, #1f74dd);
}

.stat-energy svg {
  fill: #fff34d;
  stroke: #fff34d;
}

.stat-coin {
  background: linear-gradient(180deg, #ffc94d, #f29923);
}

.stat-coin svg {
  fill: #ffe38b;
}

.stat-gem {
  background: linear-gradient(180deg, #ff89cd, #c73fd0);
}

.stat-gem svg {
  fill: #ffc2ee;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fff7d5, #ffb640);
  color: #9a5a00;
}

.orders-strip {
  align-items: stretch;
  min-height: 82px;
}

.chest-progress {
  width: 82px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #25505e;
  background:
    linear-gradient(180deg, #fffdf5, #caeef4),
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(42, 125, 115, 0.06) 8px 16px);
}

.chest-progress svg {
  color: #d58e20;
  fill: #ffca53;
}

.chest-progress span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.chest-progress strong {
  font-size: 14px;
}

.orders-list {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.order-card {
  position: relative;
  min-width: 0;
  padding: 7px 7px 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 229, 0.94));
  border: 2px solid rgba(255, 255, 255, 0.82);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
}

.order-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, #ff6a74, #ffc94d);
}

.order-face {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #6b3f2c 0 10%, transparent 11%),
    radial-gradient(circle at 38% 46%, #2d2730 0 4%, transparent 5%),
    radial-gradient(circle at 62% 46%, #2d2730 0 4%, transparent 5%),
    radial-gradient(circle at 50% 58%, #d65b55 0 5%, transparent 6%),
    #f5b47a;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 5px rgba(50, 40, 35, 0.18);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.order-face img {
  width: 138%;
  height: 138%;
  object-fit: contain;
  transform: translateY(8%);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.order-title {
  display: block;
  font-size: 11px;
  font-weight: 900;
  color: #4c5a6b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-need {
  margin-top: 3px;
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-item {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffffff, #eef9ff);
  border: 1px solid #cfe5ed;
  box-shadow: 0 2px 6px rgba(48, 72, 78, 0.12);
}

.mini-item .item-art {
  transform: scale(0.42);
}

.mini-item-img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(53, 45, 40, 0.14));
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.order-reward {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: -2px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff4c7;
  color: #8b6413;
  font-size: 10px;
  font-weight: 900;
}

.order-progress {
  grid-column: 1 / -1;
  height: 7px;
  background: #e7edf1;
  border-radius: 99px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(56, 62, 72, 0.12);
}

.order-progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, #40c483, #ffcc45);
}

.route-stage {
  height: clamp(82px, 17vh, 108px);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(79, 179, 188, 0.75), rgba(162, 214, 199, 0.52)),
    linear-gradient(90deg, #c8914f 0 13%, transparent 13% 87%, #c8914f 87%);
  box-shadow: var(--shadow);
}

.stand-scene {
  position: relative;
  height: 100%;
  background:
    linear-gradient(180deg, transparent 0 46%, #2d9d8c 47% 71%, #256b59 72% 100%);
}

.awning {
  position: absolute;
  left: 50%;
  top: 0;
  width: 78%;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 0 0 12px 12px;
  background: repeating-linear-gradient(90deg, #f95f7e 0 22px, #fff1d8 22px 44px);
  box-shadow: 0 5px 0 rgba(130, 63, 55, 0.2);
}

.menu-board {
  position: absolute;
  left: 50%;
  top: 35px;
  transform: translateX(-50%);
  padding: 4px 11px;
  border-radius: 7px;
  color: #fff9d9;
  background: #5b3b26;
  border: 2px solid #d99a57;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(38, 28, 19, 0.22);
}

.fruit-crate {
  position: absolute;
  bottom: 12px;
  width: 54px;
  height: 26px;
  border-radius: 5px;
  background:
    radial-gradient(circle at 18% 22%, #ffd84f 0 8%, transparent 9%),
    radial-gradient(circle at 38% 18%, #ef5b45 0 8%, transparent 9%),
    radial-gradient(circle at 58% 25%, #6bcf64 0 8%, transparent 9%),
    linear-gradient(180deg, #c88745, #8d562d);
  border: 2px solid #704321;
  box-shadow: 0 5px 10px rgba(35, 55, 48, 0.2);
}

.crate-left {
  left: 6%;
}

.crate-right {
  right: 6%;
}

.traveler {
  position: absolute;
  bottom: 14px;
  width: 52px;
  height: 58px;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 36% 36%, #263548 0 4%, transparent 5%),
    radial-gradient(circle at 64% 36%, #263548 0 4%, transparent 5%),
    radial-gradient(ellipse at 50% 56%, #d75b62 0 8%, transparent 9%),
    radial-gradient(ellipse at 50% 22%, #4f2c22 0 30%, transparent 31%),
    #f2b283;
  border: 4px solid #ffffff;
  box-shadow: 0 8px 16px rgba(45, 65, 75, 0.22);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.traveler img {
  width: 134%;
  height: 134%;
  object-fit: contain;
  transform: translateY(-2%);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.traveler-left {
  left: 20%;
}

.traveler-right {
  right: 20%;
  background:
    radial-gradient(circle at 36% 36%, #263548 0 4%, transparent 5%),
    radial-gradient(circle at 64% 36%, #263548 0 4%, transparent 5%),
    radial-gradient(ellipse at 50% 56%, #d75b62 0 8%, transparent 9%),
    radial-gradient(ellipse at 50% 19%, #26222a 0 31%, transparent 32%),
    #a9654d;
}

.serve-bubble {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 84px;
  height: 42px;
  display: grid;
  place-items: center;
  transform: translate(-50%, 8px) scale(0.86);
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #65df55, #24ad42);
  border: 4px solid #ffffff;
  color: #ffffff;
  box-shadow: 0 8px 12px rgba(44, 92, 58, 0.25);
  transition: transform 180ms ease, opacity 180ms ease;
}

.serve-bubble svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
}

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

.board-wrap {
  position: relative;
  align-self: start;
  width: 100%;
  max-width: 448px;
  margin: 0 auto;
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 228, 196, 0.46)),
    repeating-linear-gradient(0deg, rgba(126, 74, 36, 0.08) 0 2px, transparent 2px 28px),
    #e9b370;
  box-shadow: var(--shadow);
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: clamp(5px, 1.4vw, 8px);
  aspect-ratio: 1;
  touch-action: none;
}

.cell {
  position: relative;
  min-width: 0;
  padding: 0;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.36) 0 9%, transparent 10%),
    var(--tile);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.58),
    inset 0 -5px 0 rgba(141, 88, 58, 0.05);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.cell:nth-child(2n) {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.34) 0 9%, transparent 10%),
    var(--tile-alt);
}

.cell.empty::after {
  content: "";
  width: 18%;
  height: 18%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.cell.selected {
  outline: 3px solid #35d4bd;
  outline-offset: -4px;
}

.cell.drop-target {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 3px rgba(42, 209, 181, 0.9),
    0 0 0 4px rgba(42, 209, 181, 0.18),
    0 10px 18px rgba(34, 92, 88, 0.18);
}

.cell.bad-drop {
  box-shadow:
    inset 0 0 0 3px rgba(239, 82, 92, 0.88),
    0 0 0 4px rgba(239, 82, 92, 0.16);
}

.cell.drag-source .item {
  opacity: 0.28;
  transform: scale(0.86);
}

.cell.hint {
  animation: hintPulse 1.15s ease-in-out infinite;
}

.item {
  width: 86%;
  height: 86%;
  min-width: 0;
  border-radius: 9px;
  background:
    linear-gradient(180deg, #ffffff, #effbff);
  display: grid;
  place-items: center;
  box-shadow:
    0 7px 12px rgba(62, 53, 60, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.75);
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-drag: none;
}

.item::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.9) 0 6%, transparent 7%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 48%);
  pointer-events: none;
  z-index: 1;
}

.item-img {
  position: relative;
  z-index: 2;
  width: 94%;
  height: 82%;
  object-fit: contain;
  display: block;
  transform: translateY(-2px);
  filter:
    drop-shadow(0 6px 4px rgba(60, 45, 40, 0.16))
    saturate(1.06);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.premium-item {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 239, 148, 0.62), transparent 40%),
    linear-gradient(180deg, #ffffff, #fff5db 56%, #ecfbff);
  box-shadow:
    0 9px 14px rgba(122, 83, 28, 0.22),
    inset 0 0 0 2px rgba(255, 255, 255, 0.88),
    inset 0 0 0 4px rgba(255, 204, 75, 0.22);
}

.tier-chip {
  position: absolute;
  right: 3px;
  top: 3px;
  z-index: 3;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  background: linear-gradient(180deg, #ffe56a, #ff9e26);
  border: 1px solid #ffffff;
  color: #6d4310;
  font-size: 7px;
  font-weight: 1000;
  box-shadow: 0 2px 3px rgba(80, 50, 20, 0.18);
}

.cell:active .item {
  transform: scale(0.94);
}

.item.pop {
  animation: popIn 260ms cubic-bezier(.2, 1.6, .35, 1);
}

.item.sellable {
  filter: saturate(1.25);
}

.item-art {
  position: relative;
  z-index: 2;
  width: 54px;
  height: 54px;
  transform-origin: center;
}

.item-name {
  position: absolute;
  left: 50%;
  bottom: 2px;
  z-index: 4;
  max-width: 86%;
  transform: translateX(-50%);
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 8.5px;
  font-weight: 900;
  color: #536171;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-drink-1::before {
  content: "";
  position: absolute;
  inset: 12px 12px 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 60% 32%, #fff29b 0 12%, transparent 13%),
    #f7ce31;
  box-shadow: inset -5px -5px 0 rgba(214, 151, 26, 0.3);
}

.art-drink-1::after {
  content: "";
  position: absolute;
  left: 29px;
  top: 5px;
  width: 11px;
  height: 16px;
  border-radius: 9px 0 9px 0;
  background: #76c85d;
  transform: rotate(34deg);
}

.art-drink-2::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 16px;
  width: 31px;
  height: 21px;
  border-radius: 50%;
  border: 8px solid #f2b928;
  border-left-color: #ffd84e;
  transform: rotate(-22deg);
}

.art-drink-2::after {
  content: "";
  position: absolute;
  left: 35px;
  top: 9px;
  width: 12px;
  height: 28px;
  border-radius: 8px;
  background: #ffcf52;
  transform: rotate(35deg);
}

.art-drink-3::before,
.art-drink-4::before,
.art-drink-5::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 10px;
  width: 28px;
  height: 37px;
  border-radius: 7px 7px 13px 13px;
  border: 4px solid #77c5e8;
  background: linear-gradient(180deg, #ffe765 0 24%, #f7a33b 25% 76%, #ffc75a 77%);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.45);
}

.art-drink-3::after,
.art-drink-4::after,
.art-drink-5::after {
  content: "";
  position: absolute;
  left: 34px;
  top: 2px;
  width: 5px;
  height: 28px;
  border-radius: 4px;
  background: #e54a63;
  transform: rotate(18deg);
}

.art-drink-4::before {
  background:
    radial-gradient(circle at 39% 20%, #ffffff 0 8%, transparent 9%),
    radial-gradient(circle at 64% 28%, #ffffff 0 8%, transparent 9%),
    linear-gradient(180deg, #b8fff2 0 22%, #47c0e0 23% 54%, #ffb13c 55%);
  border-color: #6aaee8;
}

.art-drink-5::before {
  left: 11px;
  width: 37px;
  border-radius: 16px 16px 13px 13px;
  background:
    radial-gradient(circle at 30% 16%, #7bd259 0 10%, transparent 11%),
    radial-gradient(circle at 52% 13%, #e6537f 0 10%, transparent 11%),
    radial-gradient(circle at 72% 18%, #7bd259 0 10%, transparent 11%),
    linear-gradient(180deg, #fdd967 0 30%, #ff8d46 31% 74%, #6ac9f0 75%);
  border-color: #89d5ff;
}

.art-dessert-1::before,
.art-dessert-2::before,
.art-dessert-3::before,
.art-dessert-4::before,
.art-dessert-5::before {
  content: "";
  position: absolute;
}

.art-dessert-1::before {
  left: 18px;
  top: 22px;
  width: 26px;
  height: 27px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: repeating-linear-gradient(45deg, #c98d36 0 5px, #f0bd62 5px 10px);
}

.art-dessert-1::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 12px;
  width: 34px;
  height: 20px;
  border-radius: 18px 18px 9px 9px;
  background: #fff3c1;
  box-shadow: inset -5px -5px 0 rgba(224, 180, 90, 0.28);
}

.art-dessert-2::before {
  left: 13px;
  top: 12px;
  width: 36px;
  height: 33px;
  border-radius: 48% 52% 46% 54%;
  background:
    radial-gradient(circle at 36% 32%, #f8e0a3 0 9%, transparent 10%),
    #f4a7d3;
  box-shadow: inset -6px -7px 0 rgba(194, 79, 141, 0.2);
}

.art-dessert-2::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 28px;
  width: 28px;
  height: 22px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: #d0913d;
}

.art-dessert-3::before {
  left: 10px;
  top: 14px;
  width: 42px;
  height: 30px;
  border-radius: 52% 48% 48% 52%;
  background:
    radial-gradient(circle at 28% 39%, #8c4d32 0 8%, transparent 9%),
    radial-gradient(circle at 58% 30%, #8c4d32 0 8%, transparent 9%),
    radial-gradient(circle at 67% 61%, #8c4d32 0 8%, transparent 9%),
    #d99a57;
  box-shadow: inset -6px -5px 0 rgba(122, 76, 36, 0.2);
}

.art-dessert-4::before {
  left: 10px;
  top: 14px;
  width: 42px;
  height: 30px;
  border-radius: 52% 48% 48% 52%;
  background:
    linear-gradient(120deg, transparent 0 42%, #ffdf68 43% 57%, transparent 58%),
    radial-gradient(circle at 28% 39%, #7e402f 0 8%, transparent 9%),
    radial-gradient(circle at 67% 61%, #7e402f 0 8%, transparent 9%),
    #b46a42;
}

.art-dessert-5::before {
  left: 12px;
  top: 18px;
  width: 39px;
  height: 28px;
  border-radius: 4px 15px 8px 8px;
  background:
    linear-gradient(180deg, #f776a2 0 32%, #fff0c9 33% 62%, #da9a57 63%);
  box-shadow: inset -5px -5px 0 rgba(140, 75, 50, 0.18);
}

.art-dessert-5::after {
  content: "";
  position: absolute;
  left: 39px;
  top: 18px;
  width: 12px;
  height: 28px;
  border-radius: 0 16px 7px 0;
  background: #fff4d7;
}

.art-street-1::before,
.art-street-2::before,
.art-street-3::before,
.art-street-4::before,
.art-street-5::before {
  content: "";
  position: absolute;
}

.art-street-1::before {
  left: 18px;
  top: 8px;
  width: 22px;
  height: 42px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(180deg, #ffe45f 0 5px, #f8bd3b 5px 10px);
  box-shadow: inset -5px 0 0 rgba(176, 102, 28, 0.22);
  transform: rotate(-12deg);
}

.art-street-1::after {
  content: "";
  position: absolute;
  left: 36px;
  top: 9px;
  width: 8px;
  height: 16px;
  border-radius: 9px 0;
  background: #6fbe55;
  transform: rotate(28deg);
}

.art-street-2::before {
  left: 17px;
  top: 7px;
  width: 23px;
  height: 43px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 38% 28%, #733f22 0 8%, transparent 9%),
    radial-gradient(circle at 60% 54%, #733f22 0 7%, transparent 8%),
    repeating-linear-gradient(180deg, #ffdb58 0 5px, #de8d31 5px 10px);
  box-shadow: 0 4px 0 #875027;
  transform: rotate(14deg);
}

.art-street-3::before {
  left: 14px;
  top: 12px;
  width: 34px;
  height: 35px;
  border-radius: 9px 9px 15px 15px;
  border: 4px solid #e0f3ff;
  background:
    radial-gradient(circle at 36% 36%, #ffdc58 0 9%, transparent 10%),
    radial-gradient(circle at 62% 48%, #f56c4d 0 8%, transparent 9%),
    radial-gradient(circle at 46% 68%, #7ccd66 0 8%, transparent 9%),
    #fff1c8;
}

.art-street-3::after {
  content: "";
  position: absolute;
  left: 36px;
  top: 3px;
  width: 5px;
  height: 31px;
  border-radius: 5px;
  background: #5bbf8a;
  transform: rotate(18deg);
}

.art-street-4::before {
  left: 7px;
  top: 20px;
  width: 48px;
  height: 22px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 22% 32%, #fff4c9 0 4%, transparent 5%),
    radial-gradient(circle at 46% 28%, #fff4c9 0 4%, transparent 5%),
    radial-gradient(circle at 70% 35%, #fff4c9 0 4%, transparent 5%),
    linear-gradient(180deg, #cf7635, #8d4d28);
  box-shadow: inset 0 7px 0 rgba(255, 214, 130, 0.35);
}

.art-street-4::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 17px;
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background: #7bd35e;
}

.art-street-5::before {
  left: 8px;
  top: 15px;
  width: 48px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 42%, #ffd64e 0 12%, transparent 13%),
    radial-gradient(circle at 52% 35%, #de5a42 0 12%, transparent 13%),
    radial-gradient(circle at 68% 54%, #70c75e 0 12%, transparent 13%),
    #e7f2f1;
  border: 4px solid #f9ffff;
  box-shadow: 0 4px 0 rgba(88, 92, 92, 0.18);
}

.float-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10;
}

.flying-item {
  position: fixed;
  width: var(--fly-size, 58px);
  height: var(--fly-size, 58px);
  z-index: 12;
  transition: transform 220ms cubic-bezier(.25, .8, .18, 1), opacity 220ms ease;
}

.merge-effect {
  position: fixed;
  left: 0;
  top: 0;
  width: clamp(92px, 20vw, 150px);
  height: clamp(92px, 20vw, 150px);
  z-index: 14;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.merge-effect img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.74) rotate(-4deg);
  animation: mergeFrame 300ms ease-out forwards;
  filter: drop-shadow(0 0 8px rgba(255, 228, 95, 0.45));
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--drag-size, 58px);
  height: var(--drag-size, 58px);
  z-index: 30;
  pointer-events: none;
  transform: translate(-50%, -57%) scale(1.08) rotate(-4deg);
  filter: saturate(1.12);
  box-shadow:
    0 24px 32px rgba(28, 41, 48, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.drag-ghost::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(37, 50, 66, 0.18);
  filter: blur(2px);
}

.drag-ghost.snap-back {
  transition: left 140ms ease, top 140ms ease, transform 140ms ease, opacity 140ms ease;
  transform: translate(-50%, -50%) scale(0.86);
  opacity: 0.3;
}

.score-pop {
  position: fixed;
  z-index: 13;
  transform: translate(-50%, -50%);
  color: #fff;
  background: linear-gradient(180deg, #5edc7d, #22a64f);
  border: 3px solid #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(44, 70, 45, 0.25);
  animation: scoreFloat 760ms ease forwards;
}

.actionbar {
  min-height: 68px;
  justify-content: space-between;
  padding-top: 2px;
  margin-top: clamp(8px, 1.6vh, 14px);
}

.tool-button,
.primary-action {
  height: 58px;
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 7px;
  color: #27515f;
  background:
    linear-gradient(180deg, #ffffff, #d3f8ff);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(50, 70, 80, 0.14);
}

.tool-button {
  width: 61px;
}

.primary-action {
  flex: 1;
  max-width: 190px;
  color: #ffffff;
  background:
    linear-gradient(180deg, #4bd1b0, #208f87);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
  position: relative;
  overflow: hidden;
}

.primary-action::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 5px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.primary-action:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.72;
}

.tool-button.active {
  color: #ffffff;
  background: linear-gradient(180deg, #ff9b68, #e35c4d);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: clamp(176px, 22vh, 196px);
  max-width: min(420px, calc(100vw - 24px));
  transform: translate(-50%, 16px);
  opacity: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(37, 50, 66, 0.92);
  color: white;
  font-weight: 800;
  font-size: 13px;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
  z-index: 20;
}

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

@keyframes popIn {
  0% { transform: scale(0.55); filter: brightness(1.5); }
  70% { transform: scale(1.16); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes hintPulse {
  0%, 100% { filter: brightness(1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58), 0 0 0 0 rgba(53, 212, 189, 0); }
  50% { filter: brightness(1.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58), 0 0 0 5px rgba(53, 212, 189, 0.28); }
}

@keyframes scoreFloat {
  0% { opacity: 0; transform: translate(-50%, -24%) scale(0.74); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -112%) scale(1.04); }
}

@keyframes mergeFrame {
  0% { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  20% { opacity: 1; }
  72% { opacity: 1; transform: scale(1.1) rotate(3deg); }
  100% { opacity: 0; transform: scale(1.34) rotate(8deg); }
}

/* Modern fixed HUD pass */
.game-shell {
  min-height: 100dvh;
  max-height: 100dvh;
  height: 100dvh;
  grid-template-rows: 48px 164px auto 62px;
  align-content: start;
  gap: 7px;
  padding: 7px clamp(7px, 2.4vw, 12px) 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)),
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.32) 0 16%, transparent 17%);
}

.topbar {
  min-height: 48px;
  height: 48px;
  align-items: center;
  gap: 6px;
}

.level-badge {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 11px;
  outline: 0;
  border: 3px solid #ffffff;
  background: linear-gradient(180deg, #68d4ff 0 45%, #2b7edc 46%);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.16);
  box-shadow: 0 7px 0 rgba(32, 91, 151, 0.22), 0 8px 18px rgba(36, 83, 130, 0.2);
}

.level-label {
  color: #ffffff;
}

.stat {
  height: 38px;
  border-radius: 10px;
  justify-content: flex-start;
  padding: 0 10px;
  font-size: 15px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), 0 8px 14px rgba(28, 54, 88, 0.13);
}

.stat svg {
  flex: 0 0 22px;
}

.stat-energy {
  flex: 1.1 1 0;
}

.stat-coin,
.stat-gem {
  flex: 0.88 1 0;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 11px;
  background: linear-gradient(180deg, #ffeff8, #e44bb4);
  color: #ffffff;
  box-shadow: inset 0 -4px 0 rgba(129, 36, 101, 0.22), 0 8px 15px rgba(154, 54, 120, 0.18);
}

.route-stage {
  position: relative;
  height: 164px;
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.36) 0 7%, transparent 8%),
    radial-gradient(circle at 88% 16%, rgba(255, 255, 255, 0.28) 0 8%, transparent 9%),
    radial-gradient(circle at 50% -8%, rgba(255, 236, 151, 0.26) 0 18%, transparent 19%),
    linear-gradient(180deg, #56b9f4 0 54%, #235a9f 55% 100%);
  box-shadow: 0 14px 28px rgba(34, 70, 126, 0.22);
}

.stand-scene {
  height: 116px;
  background:
    linear-gradient(180deg, transparent 0 62%, rgba(27, 123, 156, 0.18) 63%),
    linear-gradient(90deg, rgba(255,255,255,0.14) 0 1px, transparent 1px 34px);
}

.awning {
  left: 50%;
  top: 58px;
  width: 82%;
  height: 18px;
  z-index: 1;
  border-radius: 10px 10px 0 0;
  opacity: 0.95;
  box-shadow: 0 4px 0 rgba(108, 39, 58, 0.16);
}

.menu-board {
  display: none;
}

.fruit-crate {
  bottom: 32px;
  width: 58px;
  height: 26px;
  z-index: 3;
}

.crate-left {
  left: 11px;
}

.crate-right {
  right: 11px;
}

.traveler {
  bottom: 34px;
  width: 66px;
  height: 72px;
  z-index: 4;
  border: 4px solid #ffffff;
  box-shadow: 0 10px 18px rgba(22, 50, 88, 0.24);
}

.traveler::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -21px;
  width: 76px;
  height: 36px;
  transform: translateX(-50%);
  border-radius: 22px 22px 8px 8px;
  background: linear-gradient(180deg, #fff7df, #f7a64c);
  z-index: -1;
}

.traveler-left {
  left: 28%;
  transform: translateX(-50%);
}

.traveler-right {
  right: 28%;
  transform: translateX(50%);
}

.go-button {
  position: absolute;
  left: 50%;
  top: 42px;
  z-index: 6;
  min-width: 78px;
  height: 42px;
  transform: translateX(-50%);
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(180deg, #6df36a, #27c64a);
  border: 3px solid #dfffe0;
  font-size: 20px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(15, 96, 36, 0.25);
  box-shadow: inset 0 -5px 0 rgba(18, 128, 45, 0.24), 0 9px 18px rgba(29, 103, 61, 0.32);
  cursor: pointer;
}

.go-button:active {
  transform: translateX(-50%) translateY(2px) scale(0.98);
}

.reward-ticker {
  position: absolute;
  left: 50%;
  top: 88px;
  z-index: 5;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
}

.reward-pill {
  height: 24px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #9a5b18;
  font-size: 12px;
  font-weight: 950;
  box-shadow: 0 5px 10px rgba(45, 65, 72, 0.18);
}

.reward-pill.big {
  color: #2e6c92;
}

.event-stack {
  position: absolute;
  right: 8px;
  top: 28px;
  z-index: 7;
}

.event-card {
  width: 54px;
  height: 56px;
  display: grid;
  place-items: center;
  gap: 1px;
  border-radius: 13px;
  color: #ffffff;
  background: linear-gradient(180deg, #ffb950, #f27938);
  border: 3px solid rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 -4px 0 rgba(136, 64, 17, 0.2), 0 9px 15px rgba(90, 54, 32, 0.2);
  font-size: 9px;
  font-weight: 950;
}

.event-card svg {
  width: 25px;
  height: 25px;
  fill: #ffe478;
  stroke: #ffffff;
}

.orders-strip {
  position: absolute;
  left: 8px;
  right: 8px;
  width: auto;
  bottom: 7px;
  z-index: 8;
  height: 65px;
  min-height: 65px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: stretch;
  gap: 7px;
}

.chest-progress {
  width: auto;
  min-width: 0;
  height: 65px;
  padding: 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, #eaffff, #c7eff9);
  box-shadow: inset 0 -3px 0 rgba(54, 123, 145, 0.1), 0 7px 12px rgba(45, 73, 96, 0.16);
}

.orders-list {
  height: 65px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.order-card {
  height: 65px;
  padding: 6px 7px 5px;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: 36px 7px 14px;
  gap: 4px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0 72%, #eef8ff 73%);
  box-shadow: inset 0 -3px 0 rgba(82, 119, 148, 0.08), 0 7px 12px rgba(45, 73, 96, 0.16);
}

.order-card::before {
  width: 4px;
}

.order-face {
  width: 32px;
  height: 32px;
  grid-row: 1 / 2;
}

.order-title {
  font-size: 10.5px;
  line-height: 1.1;
}

.order-need {
  margin-top: 2px;
  gap: 3px;
  flex-wrap: nowrap;
}

.mini-item {
  width: 24px;
  height: 24px;
}

.mini-item .item-art {
  transform: scale(0.39);
}

.order-progress {
  height: 7px;
  grid-column: 1 / -1;
  grid-row: 2;
}

.order-reward {
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: start;
  margin-top: 0;
  font-size: 9px;
  line-height: 1;
  padding: 2px 7px;
  background: linear-gradient(180deg, #fff7d8, #ffe58d);
}

.board-wrap {
  width: 100%;
  max-width: 456px;
  padding: 8px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 215, 188, 0.2)),
    repeating-linear-gradient(90deg, rgba(145, 86, 48, 0.1) 0 2px, transparent 2px 30px),
    #cfb2a7;
  box-shadow: 0 12px 26px rgba(61, 65, 78, 0.2);
}

.board {
  gap: clamp(3px, 1vw, 5px);
}

.board .cell {
  min-height: 0;
}

.cell {
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.26) 0 7%, transparent 8%),
    #d8c1b7;
}

.cell:nth-child(2n) {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.24) 0 7%, transparent 8%),
    #c7aaa0;
}

.item {
  width: 92%;
  height: 92%;
  border-radius: 9px;
}

.actionbar {
  height: 62px;
  min-height: 62px;
  margin-top: 0;
  align-items: center;
  gap: 8px;
}

.tool-button,
.primary-action {
  height: 56px;
  border-radius: 10px;
}

.tool-button {
  width: 62px;
}

.primary-action {
  max-width: none;
}

.toast {
  bottom: clamp(178px, 23vh, 200px);
}

.debug-panel {
  position: fixed;
  left: 8px;
  top: 8px;
  z-index: 80;
  display: none;
  max-width: min(430px, calc(100vw - 16px));
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(16, 24, 35, 0.9);
  color: #d9fff7;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

body.debug-layout .debug-panel {
  display: block;
}

body.debug-layout .game-shell,
body.debug-layout .topbar,
body.debug-layout .route-stage,
body.debug-layout .orders-strip,
body.debug-layout .board-wrap,
body.debug-layout .actionbar {
  outline: 2px solid rgba(255, 0, 120, 0.78);
  outline-offset: -2px;
}

body.debug-layout .board-wrap {
  outline-color: rgba(0, 255, 210, 0.9);
}

@media (orientation: landscape) and (max-height: 760px) {
  body {
    padding: 0;
  }

  .game-shell {
    width: min(100vw, calc(100dvh * 0.56));
    min-width: 320px;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    grid-template-rows: 42px 118px minmax(0, 1fr) 54px;
    gap: 5px;
    padding: 5px;
    border-radius: 12px;
  }

  .topbar {
    height: 42px;
    min-height: 42px;
  }

  .level-badge {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .stat {
    height: 34px;
    font-size: 13px;
    padding: 0 8px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .route-stage {
    height: 118px;
  }

  .stand-scene {
    height: 72px;
  }

  .awning {
    top: 44px;
    height: 14px;
  }

  .traveler {
    bottom: 24px;
    width: 48px;
    height: 52px;
  }

  .traveler::before {
    width: 58px;
    height: 25px;
    bottom: -14px;
  }

  .go-button {
    top: 30px;
    height: 32px;
    min-width: 58px;
    border-radius: 10px;
    font-size: 15px;
  }

  .reward-ticker {
    top: 64px;
  }

  .reward-pill {
    height: 20px;
    min-width: 34px;
    font-size: 10px;
  }

  .event-stack {
    top: 16px;
  }

  .event-card {
    width: 42px;
    height: 44px;
    font-size: 7.5px;
  }

  .fruit-crate {
    bottom: 22px;
    width: 42px;
    height: 20px;
  }

  .orders-strip {
    left: 5px;
    right: 5px;
    bottom: 5px;
    height: 47px;
    min-height: 47px;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 5px;
  }

  .orders-list,
  .chest-progress,
  .order-card {
    height: 47px;
  }

  .chest-progress {
    padding: 4px;
  }

  .chest-progress span {
    font-size: 9px;
  }

  .chest-progress strong {
    font-size: 12px;
  }

  .order-card {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: 25px 5px 10px;
    gap: 2px 4px;
    padding: 4px;
  }

  .order-face {
    width: 24px;
    height: 24px;
    border-width: 2px;
  }

  .order-title {
    font-size: 8.5px;
  }

  .mini-item {
    width: 18px;
    height: 18px;
  }

  .mini-item .item-art {
    transform: scale(0.3);
  }

  .order-progress {
    height: 5px;
  }

  .order-reward {
    font-size: 7.5px;
    padding: 1px 5px;
  }

  .board-wrap {
    width: min(100%, calc(100dvh - 226px));
    max-width: none;
    max-height: none;
    align-self: center;
    padding: 5px;
  }

  .actionbar {
    height: 54px;
    min-height: 54px;
    gap: 6px;
  }

  .tool-button,
  .primary-action {
    height: 48px;
    font-size: 9px;
  }

  .tool-button {
    width: 50px;
  }

  .toast {
    bottom: 62px;
    font-size: 11px;
    padding: 7px 10px;
  }

  .drag-ghost {
    transform: translate(-50%, -52%) scale(1.02) rotate(-3deg);
  }
}

/* Final safety overrides: floating items must never inherit board item percentages. */
.item.drag-ghost,
.item.flying-item {
  width: var(--drag-size, var(--fly-size, 58px));
  height: var(--drag-size, var(--fly-size, 58px));
  min-width: 0;
  max-width: 96px;
  max-height: 96px;
}

.item.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  pointer-events: none;
  transform: translate(-50%, -52%) scale(1.04) rotate(-3deg);
}

.item.flying-item {
  position: fixed;
  z-index: 12;
}

@media (min-width: 720px) {
  body {
    padding: 16px;
  }

  .game-shell {
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - 32px);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 24px 80px rgba(30, 60, 80, 0.26);
  }
}

@media (max-width: 370px) {
  .orders-list {
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .orders-strip {
    min-height: 76px;
    gap: 5px;
  }

  .chest-progress {
    width: 72px;
    padding: 6px;
  }

  .order-card {
    padding: 6px 5px;
    gap: 4px;
  }

  .order-face {
    width: 29px;
    height: 29px;
  }

  .mini-item {
    width: 22px;
    height: 22px;
  }

  .order-reward {
    font-size: 9px;
    padding: 1px 6px;
  }

  .route-stage {
    height: 154px;
  }

  .traveler {
    transform: scale(0.82);
    transform-origin: bottom center;
  }

  .tool-button {
    width: 54px;
    height: 54px;
  }

  .primary-action {
    height: 54px;
  }

  .game-shell {
    grid-template-rows: 48px 154px auto 58px;
    gap: 6px;
    padding-bottom: 7px;
  }

  .stand-scene {
    height: 108px;
  }

  .orders-strip {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 6px;
    height: 62px;
    min-height: 62px;
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .orders-list,
  .chest-progress,
  .order-card {
    height: 62px;
  }

  .traveler {
    bottom: 30px;
  }

  .go-button {
    top: 39px;
    height: 39px;
    min-width: 72px;
    font-size: 18px;
  }

  .reward-ticker {
    top: 82px;
  }

  .event-stack {
    top: 24px;
  }

  .event-card {
    width: 50px;
    height: 52px;
  }

  .tool-button,
  .primary-action {
    height: 52px;
  }

  .actionbar {
    height: 58px;
    min-height: 58px;
  }
}

@media (orientation: landscape) and (max-height: 760px) {
  body {
    padding: 0;
  }

  .game-shell {
    width: min(100vw, calc(100dvh * 0.56));
    min-width: 320px;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    grid-template-rows: 42px 118px minmax(0, 1fr) 54px;
  }

  .route-stage {
    height: 118px;
  }

  .stand-scene {
    height: 72px;
  }

  .board-wrap {
    width: min(100%, calc(100dvh - 226px));
    max-width: none;
    max-height: none;
  }

  .actionbar {
    height: 54px;
    min-height: 54px;
  }
}
