#hud {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 2px 16px 6px;
  font-size: 17px;
  font-weight: 700;
}

.hud-box {
  background: none;
  border: none;
  color: #e7eaf3;
  font: inherit;
  cursor: pointer;
}

.xpbar {
  align-self: center;
  width: 90px;
  height: 8px;
  background: #1c2340;
  border-radius: 999px;
  overflow: hidden;
}

#xpfill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4da3ff, #a78bfa);
  transition: width 0.3s;
}

#orders {
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  flex: 0 0 auto;
  height: 86px;
}

.order {
  flex: 1;
  background: #171c30;
  border: 1px solid #2a3358;
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  min-height: 74px;
}

.order.ready {
  border-color: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.25);
}

.order .reqs {
  display: flex;
  gap: 6px;
}

.order .reward {
  font-size: 12px;
  color: #ffd064;
  font-weight: 700;
}

#board-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

#board {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  grid-template-rows: repeat(8, var(--cell));
  gap: 4px;
}

.cell {
  background: #181d31;
  border-radius: 8px;
  position: relative;
  touch-action: none;
}

.cell.drop-ok {
  outline: 2px solid #4ade80;
}

.item {
  position: absolute;
  inset: 6%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}

.item .lv {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #0f1320;
  border: 1px solid #33406e;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
}

.item .shape {
  width: 78%;
  height: 78%;
}

.item.gem .shape {
  transform: rotate(45deg) scale(0.86);
  border-radius: 18%;
}

.item.leaf .shape {
  border-radius: 0 50% 0 50%;
}

.item.star .shape {
  font-size: calc(var(--cell) * 0.6);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item.star .shape::before {
  content: '★';
}

.item.gen::after {
  content: '⚡';
  position: absolute;
  top: -4px;
  left: -4px;
  font-size: 13px;
}

.item.gen .shape {
  animation: pulse 1.6s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 224, 102, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(255, 224, 102, 0); }
}

/* chain palettes by level (brightness grows) */
.shape.g1 { background: #2f6fd4; }
.shape.g2 { background: #3d85ea; }
.shape.g3 { background: #4da3ff; }
.shape.g4 { background: #6db4ff; }
.shape.g5 { background: #8ec4ff; }
.shape.g6 { background: #afd4ff; }
.shape.g7 { background: #cfe4ff; }
.shape.g8 { background: #eaf3ff; }
.shape.l1 { background: #1f8f4a; }
.shape.l2 { background: #27a857; }
.shape.l3 { background: #34c168; }
.shape.l4 { background: #4ade80; }
.shape.l5 { background: #74e89f; }
.shape.l6 { background: #a4f0c0; }
.shape.l7 { background: #d2f7e0; }
.item.star .shape { background: none; }
.item.star .shape.s1 { color: #b8860b; }
.item.star .shape.s2 { color: #d4a017; }
.item.star .shape.s3 { color: #fbbf24; }
.item.star .shape.s4 { color: #ffd064; }
.item.star .shape.s5 { color: #ffe08f; }
.item.star .shape.s6 { color: #fff3cf; }
.item.gen .shape { filter: grayscale(0.3); }

#sellbar {
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
}

#sellbar .btn {
  width: 100%;
}

#toast {
  bottom: calc(72px + env(safe-area-inset-bottom));
}

#drag-ghost {
  position: fixed;
  width: var(--ghost, 48px);
  height: var(--ghost, 48px);
  pointer-events: none;
  z-index: 30;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}

.item.pop {
  animation: pop 0.22s ease-out;
}

@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
