:root {
  color-scheme: light;
  font-family: ui-rounded, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --cream: #fff9e9;
  --ink: #31505a;
  --muted: #6f8a8f;
  --teal: #2f9f91;
  --teal-dark: #22796f;
  --mint: #bcebdd;
  --coral: #f77868;
  --yellow: #ffd166;
  --board-size: min(93vw, 510px);
  --cell-size: calc((var(--board-size) - 48px) / 7);
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  color: var(--ink);
  background: #d8eee5;
  overflow-x: hidden;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #1f7aa7;
  outline-offset: 2px;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(237, 255, 247, 0.18), rgba(255, 248, 225, 0.52)),
    url("./assets/clubhouse-bg.webp") center 48% / cover no-repeat;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(23, 89, 81, 0.1), transparent 25%, transparent 75%, rgba(23, 89, 81, 0.1));
  backdrop-filter: blur(1px);
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(86px + env(safe-area-inset-bottom));
  position: relative;
}

.game-header {
  padding: 3px 2px 8px;
}

.brand-row,
.resource-row,
.section-title-row,
.selection-bar,
.selected-preview,
.selection-actions,
.bottom-nav {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 9px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-copy h1 {
  margin: 0;
  color: #276e68;
  font-size: clamp(1.2rem, 5.2vw, 1.68rem);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.brand-copy small {
  display: block;
  margin-top: -1px;
  color: #47756f;
  font-size: 0.65rem;
  font-weight: 800;
  text-align: right;
}

.level-badge,
.round-button {
  border: 0;
  cursor: pointer;
}

.level-badge {
  width: 50px;
  height: 50px;
  padding: 0;
  position: relative;
  border: 4px solid #fff6cf;
  border-radius: 17px;
  background: linear-gradient(145deg, #65cbbb, #2a9d8f);
  box-shadow: 0 5px 0 #247a70, 0 7px 14px rgba(30, 82, 76, 0.24);
}

.level-badge__avatar {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.08));
}

.level-badge__number {
  position: absolute;
  right: -5px;
  bottom: -6px;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 2px solid white;
  border-radius: 11px;
  color: white;
  background: var(--coral);
  font-size: 0.73rem;
  line-height: 17px;
  font-weight: 800;
}

.round-button {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: rgba(255, 250, 229, 0.9);
  box-shadow: 0 4px 0 rgba(67, 112, 104, 0.34);
  font-size: 1.16rem;
}

.xp-track {
  height: 9px;
  margin-top: 5px;
  padding: 2px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(45, 101, 95, 0.22);
  box-shadow: inset 0 1px 2px rgba(29, 85, 79, 0.22);
}

.xp-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd166, #ff9f5a);
  transition: width 350ms ease;
}

.resource-row {
  gap: 7px;
  margin-top: 10px;
}

.resource-pill {
  min-width: 0;
  height: 38px;
  padding: 3px 10px 3px 4px;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  color: #315f5b;
  background: rgba(255, 252, 234, 0.9);
  box-shadow: 0 3px 0 rgba(80, 122, 114, 0.25), 0 5px 12px rgba(39, 84, 78, 0.1);
}

button.resource-pill {
  cursor: pointer;
}

.resource-pill__icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffe4a0;
  font-size: 0.87rem;
}

.energy-icon {
  background: #fff17d;
}

.resource-pill strong {
  font-size: 0.91rem;
  line-height: 1;
}

.resource-pill small {
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1;
  white-space: nowrap;
}

.orders-section {
  padding: 7px 0 6px;
}

.section-title-row {
  justify-content: space-between;
  padding: 0 3px 5px;
}

.section-title-row h2 {
  margin: 0;
  font-size: 0.92rem;
}

.section-title-row h2 span {
  margin-right: 7px;
  color: #2d746c;
}

.section-title-row h2 em,
.swipe-hint {
  color: #668783;
  font-size: 0.63rem;
  font-style: normal;
  font-weight: 700;
}

.orders-list {
  display: flex;
  gap: 8px;
  padding: 0 3px 5px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.orders-list::-webkit-scrollbar {
  display: none;
}

.order-card {
  min-width: min(248px, 73vw);
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 7px;
  scroll-snap-align: start;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 18px;
  background: rgba(255, 250, 234, 0.93);
  box-shadow: 0 4px 0 rgba(67, 116, 108, 0.22), 0 7px 15px rgba(52, 84, 80, 0.12);
}

.order-card.ready {
  border-color: #f9cc57;
  animation: readyPulse 1.4s ease-in-out infinite;
}

.customer-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #dff5e9, #b8e8d8);
  font-size: 1.45rem;
}

.order-main {
  min-width: 0;
}

.order-main strong {
  display: block;
  overflow: hidden;
  color: #36615d;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-items {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.order-item {
  height: 27px;
  padding: 1px 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 9px;
  background: #eef6e8;
  font-size: 1rem;
  box-shadow: inset 0 -2px 0 rgba(68, 116, 99, 0.1);
}

.order-item b {
  color: #52706e;
  font-size: 0.61rem;
}

.order-action {
  min-width: 52px;
  min-height: 42px;
  padding: 5px 7px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: #9ab0aa;
  box-shadow: 0 3px 0 #718b84;
  font-size: 0.66rem;
  font-weight: 800;
}

.ready .order-action {
  cursor: pointer;
  background: linear-gradient(#ffbc59, #f1874d);
  box-shadow: 0 3px 0 #c86535;
}

.order-reward {
  display: block;
  margin-top: 1px;
  font-size: 0.61rem;
  white-space: nowrap;
}

.board-wrap {
  width: var(--board-size);
  margin: 0 auto;
  position: relative;
}

.merge-board {
  width: 100%;
  aspect-ratio: 1;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  position: relative;
  touch-action: pan-y;
  border: 4px solid rgba(255, 249, 220, 0.95);
  border-radius: 24px;
  background: rgba(80, 155, 138, 0.62);
  box-shadow:
    0 7px 0 rgba(38, 111, 99, 0.45),
    0 13px 25px rgba(36, 85, 76, 0.25),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.board-cell {
  min-width: 0;
  min-height: 0;
  padding: 1px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: clamp(8px, 2.4vw, 14px);
  background: rgba(235, 249, 231, 0.74);
  box-shadow: inset 0 -3px 0 rgba(48, 120, 103, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  cursor: pointer;
  touch-action: pan-y;
}

.board-cell.has-item {
  touch-action: none;
}

.board-cell:nth-child(3n + 1) {
  background: rgba(249, 244, 215, 0.78);
}

.board-cell.selected {
  z-index: 2;
  box-shadow: 0 0 0 3px #ffd35e, 0 0 18px rgba(255, 206, 74, 0.75), inset 0 -3px 0 rgba(48, 120, 103, 0.1);
}

.board-cell.merge-target {
  animation: targetBounce 0.65s ease-in-out infinite alternate;
  box-shadow: 0 0 0 3px #fff3a2, 0 0 16px #ffe16b;
}

.board-cell.is-dragging {
  opacity: 0.36;
}

.board-cell.spawned {
  animation: itemPop 360ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

.board-cell.merged {
  animation: mergeBurst 480ms cubic-bezier(0.2, 1.5, 0.4, 1);
}

.item-token {
  width: 91%;
  height: 91%;
  display: grid;
  place-items: center;
  position: relative;
  user-select: none;
  border-radius: 37%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(227, 244, 233, 0.94));
  box-shadow: 0 3px 0 rgba(62, 115, 103, 0.19), 0 4px 8px rgba(44, 89, 79, 0.13);
  font-size: clamp(1.25rem, 7.5vw, 2.35rem);
  line-height: 1;
}

.item-token[data-kind="snack"] {
  background: linear-gradient(145deg, #fffdf2, #ffe9cb);
}

.item-token[data-kind="gear"] {
  background: linear-gradient(145deg, #f2fffb, #cceee6);
}

.item-token[data-kind="generator"] {
  overflow: visible;
  background: linear-gradient(145deg, #ffe477, #f6a84c);
  box-shadow: 0 4px 0 #c66f3f, 0 5px 12px rgba(118, 73, 39, 0.24);
}

.item-token__emoji {
  display: block;
  transform: translateY(-1px);
  filter: drop-shadow(0 2px 1px rgba(47, 79, 72, 0.15));
  pointer-events: none;
}

.item-token__level {
  position: absolute;
  right: -1px;
  bottom: -1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid white;
  border-radius: 9px;
  color: white;
  background: #499d91;
  font-size: 0.56rem;
  line-height: 13px;
  font-weight: 800;
}

.generator-tag {
  position: absolute;
  left: 50%;
  bottom: -7px;
  z-index: 2;
  padding: 1px 5px;
  transform: translateX(-50%);
  border: 1px solid white;
  border-radius: 7px;
  color: white;
  background: #ef6e5f;
  font-size: 0.48rem;
  font-style: normal;
  white-space: nowrap;
  box-shadow: 0 2px 0 #bb4a42;
}

.generator-tag.cooling {
  background: #668f8a;
  box-shadow: 0 2px 0 #476e69;
}

.board-message {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  padding: 8px 13px;
  transform: translate(-50%, -50%) scale(0.86);
  opacity: 0;
  border: 2px solid white;
  border-radius: 16px;
  color: white;
  background: rgba(42, 108, 99, 0.94);
  box-shadow: 0 5px 16px rgba(25, 72, 66, 0.28);
  font-size: 0.78rem;
  font-weight: 800;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
}

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

.selection-bar {
  width: var(--board-size);
  min-height: 55px;
  margin: 9px auto 0;
  padding: 6px 8px;
  justify-content: space-between;
  gap: 8px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  background: rgba(255, 251, 232, 0.9);
  box-shadow: 0 4px 0 rgba(67, 116, 108, 0.24);
  scroll-margin-bottom: calc(82px + env(safe-area-inset-bottom));
}

.selected-preview {
  min-width: 0;
  gap: 7px;
}

.selected-preview__icon {
  width: 39px;
  height: 39px;
  display: grid;
  flex: 0 0 39px;
  place-items: center;
  border-radius: 12px;
  background: #e4f2e7;
  font-size: 1.35rem;
}

.selected-preview strong,
.selected-preview small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-preview strong {
  max-width: 155px;
  color: #3c6e68;
  font-size: 0.74rem;
}

.selected-preview small {
  max-width: 165px;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.62rem;
}

.selection-actions {
  gap: 5px;
}

.mini-action {
  min-width: 47px;
  min-height: 38px;
  padding: 6px 7px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: #4da99d;
  box-shadow: 0 3px 0 #317f75;
  font-size: 0.61rem;
  font-weight: 800;
  cursor: pointer;
}

.mini-action--sell {
  background: #f29659;
  box-shadow: 0 3px 0 #c66e3a;
}

.mini-action:disabled {
  opacity: 0.42;
  filter: grayscale(0.55);
  cursor: default;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(9px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(calc(100% - 24px), 520px);
  height: 66px;
  padding: 5px 19px;
  justify-content: space-around;
  transform: translateX(-50%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 25px;
  background: rgba(255, 249, 225, 0.95);
  box-shadow: 0 6px 0 rgba(53, 112, 102, 0.42), 0 10px 24px rgba(38, 80, 72, 0.2);
  backdrop-filter: blur(10px);
}

.nav-button {
  width: 70px;
  height: 51px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 0;
  border-radius: 16px;
  color: #50746f;
  background: transparent;
  cursor: pointer;
}

.nav-button span {
  font-size: 1.45rem;
  line-height: 1;
}

.nav-button small {
  margin-top: 3px;
  font-size: 0.64rem;
  font-weight: 800;
}

.nav-button.active {
  color: #2e8277;
  background: #dff3e9;
}

.nav-button--primary {
  width: 77px;
  height: 67px;
  margin-top: -21px;
  border: 4px solid #fff7d9;
  border-radius: 25px;
  color: white;
  background: linear-gradient(#f9b956, #f17857);
  box-shadow: 0 5px 0 #b85c41, 0 7px 14px rgba(109, 68, 46, 0.22);
}

.nav-button--primary span {
  font-size: 1.9rem;
}

.nav-button--primary small {
  color: white;
}

.nav-button i {
  position: absolute;
  right: 5px;
  top: 3px;
  width: 10px;
  height: 10px;
  display: none;
  border: 2px solid white;
  border-radius: 50%;
  background: #ff4e4e;
}

.nav-button i.show {
  display: block;
}

.pressable {
  transition: transform 100ms ease, filter 100ms ease;
}

.pressable:active {
  transform: translateY(2px) scale(0.97);
  filter: brightness(0.98);
}

.tutorial[hidden],
.modal[hidden] {
  display: none;
}

.tutorial {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.tutorial::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 57, 53, 0.47);
}

.tutorial__spotlight {
  position: fixed;
  z-index: 1;
  border: 4px solid #ffe46f;
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(20, 57, 53, 0.48), 0 0 24px #ffe46f;
  animation: spotlightPulse 1.2s ease-in-out infinite alternate;
  pointer-events: none;
  transition: all 320ms ease;
}

.tutorial__card {
  width: min(calc(100% - 28px), 430px);
  min-height: 82px;
  padding: 12px 52px 12px 65px;
  display: flex;
  align-items: center;
  position: fixed;
  left: 50%;
  bottom: calc(87px + env(safe-area-inset-bottom));
  z-index: 2;
  transform: translateX(-50%);
  border: 3px solid white;
  border-radius: 21px;
  background: #fff9df;
  box-shadow: 0 7px 0 #d1a968, 0 12px 25px rgba(31, 64, 58, 0.26);
  pointer-events: auto;
}

.tutorial__card .coach-face {
  position: absolute;
  left: 11px;
  font-size: 2.55rem;
}

.tutorial__card strong {
  color: #2e756c;
  font-size: 0.82rem;
}

.tutorial__card p {
  margin: 3px 0 0;
  color: #607b77;
  font-size: 0.66rem;
  line-height: 1.45;
}

.tutorial__card button {
  position: absolute;
  right: 10px;
  top: 9px;
  padding: 2px 5px;
  border: 0;
  color: #8aa09b;
  background: transparent;
  font-size: 0.57rem;
  cursor: pointer;
}

.tutorial__card--top {
  top: max(112px, calc(env(safe-area-inset-top) + 92px));
  bottom: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(25, 57, 54, 0.56);
  backdrop-filter: blur(3px);
}

.modal__panel {
  width: min(100%, 430px);
  max-height: min(86dvh, 680px);
  padding: 20px 18px 18px;
  overflow-y: auto;
  position: relative;
  border: 4px solid white;
  border-radius: 28px;
  background: #fff9e8;
  box-shadow: 0 8px 0 #b6c9a9, 0 18px 40px rgba(28, 62, 57, 0.3);
  animation: modalIn 260ms cubic-bezier(0.22, 1.3, 0.36, 1);
}

.modal__close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  position: absolute;
  right: 12px;
  top: 11px;
  z-index: 2;
  border: 0;
  border-radius: 50%;
  color: white;
  background: #ef796b;
  box-shadow: 0 3px 0 #bb544a;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.modal-heading {
  margin: 0 44px 6px 0;
  color: #2e776e;
  font-size: 1.32rem;
}

.modal-subtitle {
  margin: 0 0 14px;
  color: #728985;
  font-size: 0.72rem;
  line-height: 1.55;
}

.shop-list,
.collection-grid,
.stat-grid {
  display: grid;
  gap: 9px;
}

.shop-item {
  min-height: 72px;
  padding: 10px;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 9px;
  border-radius: 17px;
  background: #eef5e6;
  box-shadow: inset 0 -3px 0 rgba(52, 109, 92, 0.1);
}

.shop-item__icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: white;
  font-size: 1.8rem;
}

.shop-item strong,
.shop-item small {
  display: block;
}

.shop-item strong {
  color: #3e6b64;
  font-size: 0.78rem;
}

.shop-item small {
  margin-top: 2px;
  color: #758b86;
  font-size: 0.6rem;
}

.buy-button,
.primary-button,
.danger-button {
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.buy-button {
  min-width: 64px;
  padding: 8px 9px;
  border-radius: 11px;
  background: #ef9157;
  box-shadow: 0 3px 0 #c26536;
  font-size: 0.66rem;
}

.buy-button:disabled {
  opacity: 0.48;
  cursor: default;
}

.primary-button,
.danger-button {
  width: 100%;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 13px;
  background: #3ba497;
  box-shadow: 0 4px 0 #287b72;
  font-size: 0.74rem;
}

.danger-button {
  background: #e87366;
  box-shadow: 0 4px 0 #b95047;
}

.setting-row {
  padding: 11px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dce7d5;
  font-size: 0.75rem;
  font-weight: 800;
}

.toggle {
  min-width: 58px;
  padding: 5px 9px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: #3da396;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 800;
}

.collection-grid {
  grid-template-columns: repeat(3, 1fr);
}

.collection-card {
  min-height: 90px;
  padding: 8px 3px;
  text-align: center;
  border-radius: 15px;
  background: #edf4e8;
}

.collection-card.locked {
  filter: grayscale(1);
  opacity: 0.48;
}

.collection-card span,
.collection-card strong,
.collection-card small {
  display: block;
}

.collection-card span {
  font-size: 2rem;
}

.collection-card strong {
  margin-top: 2px;
  color: #466e68;
  font-size: 0.64rem;
}

.collection-card small {
  color: #839692;
  font-size: 0.54rem;
}

.stat-grid {
  grid-template-columns: repeat(2, 1fr);
  margin: 12px 0;
}

.stat-card {
  padding: 12px 8px;
  text-align: center;
  border-radius: 15px;
  background: #eaf4e6;
}

.stat-card strong,
.stat-card small {
  display: block;
}

.stat-card strong {
  color: #2f8177;
  font-size: 1.2rem;
}

.stat-card small {
  color: #748985;
  font-size: 0.61rem;
}

.levelup-card {
  padding: 5px 0 2px;
  text-align: center;
}

.levelup-card .big-emoji {
  display: block;
  font-size: 4.8rem;
  animation: heroBounce 0.8s ease-in-out infinite alternate;
}

.levelup-card h2 {
  margin: 4px 0 0;
  color: #2d8075;
  font-size: 1.65rem;
}

.levelup-card p {
  margin: 3px 0 12px;
  color: #6e8984;
  font-size: 0.75rem;
}

.reward-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.reward-chip {
  min-width: 82px;
  padding: 8px;
  border-radius: 14px;
  background: #edf5e6;
  font-size: 0.73rem;
  font-weight: 800;
}

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 120;
  width: min(calc(100% - 32px), 390px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  width: max-content;
  max-width: 100%;
  margin: 5px auto;
  padding: 8px 13px;
  border: 2px solid white;
  border-radius: 14px;
  color: white;
  background: rgba(45, 112, 102, 0.96);
  box-shadow: 0 4px 12px rgba(29, 70, 64, 0.26);
  font-size: 0.7rem;
  font-weight: 800;
  animation: toastInOut 2.4s both;
}

.drag-ghost {
  width: var(--cell-size);
  height: var(--cell-size);
  display: none;
  place-items: center;
  position: fixed;
  z-index: 150;
  transform: translate(-50%, -58%) scale(1.08);
  pointer-events: none;
  filter: drop-shadow(0 10px 7px rgba(30, 66, 59, 0.25));
}

.drag-ghost.show {
  display: grid;
}

.rotate-tip {
  display: none;
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 110;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  width: 9px;
  height: 15px;
  position: absolute;
  top: -20px;
  border-radius: 3px;
  animation: confettiFall var(--duration) linear forwards;
}

.floating-reward {
  position: fixed;
  z-index: 130;
  color: #fff;
  text-shadow: 0 2px 0 rgba(65, 80, 48, 0.3);
  font-size: 0.95rem;
  font-weight: 800;
  pointer-events: none;
  animation: floatUp 900ms ease-out forwards;
}

@keyframes itemPop {
  0% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
  75% { transform: scale(1.13) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

@keyframes mergeBurst {
  0% { transform: scale(0.45); filter: brightness(1.7); }
  55% { transform: scale(1.25); filter: brightness(1.15); }
  100% { transform: scale(1); filter: none; }
}

@keyframes targetBounce {
  to { filter: brightness(1.13); }
}

@keyframes readyPulse {
  50% { box-shadow: 0 4px 0 rgba(201, 145, 43, 0.35), 0 0 16px rgba(255, 209, 82, 0.7); }
}

@keyframes spotlightPulse {
  to { box-shadow: 0 0 0 9999px rgba(20, 57, 53, 0.48), 0 0 34px #fff292; }
}

@keyframes modalIn {
  from { transform: translateY(18px) scale(0.92); opacity: 0; }
}

@keyframes toastInOut {
  0% { transform: translateY(15px) scale(0.9); opacity: 0; }
  12%, 82% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-8px) scale(0.96); opacity: 0; }
}

@keyframes confettiFall {
  to { transform: translate3d(var(--drift), 105vh, 0) rotate(720deg); }
}

@keyframes floatUp {
  to { transform: translateY(-60px) scale(1.15); opacity: 0; }
}

@keyframes heroBounce {
  to { transform: translateY(-8px) rotate(4deg); }
}

@media (min-width: 700px) {
  :root {
    --board-size: min(56vh, 510px);
  }

  .app-shell {
    padding-top: 16px;
  }

  .backdrop {
    background-size: auto 150%;
  }
}

@media (max-height: 735px) {
  .app-shell {
    padding-top: 5px;
  }

  .game-header {
    padding-bottom: 4px;
  }

  .brand-row {
    transform: scale(0.94);
    transform-origin: center top;
    margin-bottom: -3px;
  }

  .resource-row {
    margin-top: 5px;
  }

  .orders-section {
    padding-top: 3px;
  }

  .order-card {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  :root {
    --board-size: min(93vw, 440px);
  }

  .selection-bar {
    min-height: 50px;
    margin-top: 7px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .resource-pill {
    padding-right: 6px;
  }

  .resource-pill small {
    display: none;
  }

  .selected-preview small {
    max-width: 122px;
  }

  .mini-action {
    min-width: 43px;
    padding-left: 5px;
    padding-right: 5px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .rotate-tip {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #315f5b;
    background: rgba(255, 249, 226, 0.97);
    text-align: center;
  }

  .rotate-tip span {
    font-size: 3.5rem;
    animation: rotatePhone 1.4s ease-in-out infinite alternate;
  }

  .rotate-tip strong {
    font-size: 1.2rem;
  }

  .rotate-tip small {
    color: #718b86;
    font-size: 0.75rem;
  }
}

@keyframes rotatePhone {
  from { transform: rotate(90deg); }
  to { transform: rotate(0deg); }
}

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

@media (display-mode: standalone) {
  .app-shell {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}
