* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: radial-gradient(circle at 20% 30%, #1a2a3a, #050a10);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
  padding: clamp(8px, 2vw, 20px);
}

.game-container {
  max-width: 1400px;
  width: 100%;
  background: rgba(8, 18, 28, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid #e6c87a55;
  border-radius: clamp(24px, 5vw, 48px);
  padding: clamp(12px, 3vw, 24px);
  box-shadow: 0 30px 45px #000000b0, 0 0 0 1px #6a5a3a inset;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.5vw, 20px);
}

.top-bar {
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: space-between;
  background: #0d1622e0;
  border-radius: 60px;
  padding: clamp(6px, 1.5vw, 12px) clamp(16px, 3vw, 28px);
  border: 1px solid #efcd8f55;
  gap: 10px;
  overflow: hidden;
}

.balance-area {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f2e40;
  padding: 6px 20px 6px 16px;
  border-radius: 40px;
  border-left: 6px solid #f5c542;
  flex-shrink: 0;
  white-space: nowrap;
}

.balance-value {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 900;
  color: #ffecb3;
  text-shadow: 0 0 10px #ffecb3;
}

.profit-badge {
  background: #15222e;
  padding: 6px 20px;
  border-radius: 36px;
  color: #d1e2f5;
  font-weight: 600;
  border-bottom: 3px solid #4f7396;
  font-size: clamp(14px, 3vw, 18px);
  flex-shrink: 0;
  white-space: nowrap;
}

.icon-btn {
  background: #1f3243;
  border: none;
  color: #f8e3b0;
  padding: 8px 16px;
  border-radius: 34px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 #0d1923;
  font-size: clamp(14px, 3vw, 16px);
  white-space: nowrap !important;
  flex-shrink: 0;
  transition: 0.05s linear;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0d1923;
}

.card-showcase {
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
  margin: 5px 0;
}

.flip-card {
  width: clamp(220px, 42vw, 340px);
  height: clamp(280px, 54vw, 440px);
  position: relative;
  transition: transform 0.45s;
  transform-style: preserve-3d;
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 28px;
  box-shadow: 0 20px 30px #000, 0 0 0 3px #dbb56b inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card-back {
  background: linear-gradient(145deg, #1a2635, #0a121c);
  transform: rotateY(180deg);
  border: 3px solid #b89b5e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-content {
  font-size: clamp(100px, 22vw, 160px);
  font-weight: 900;
  color: #f5d742;
  text-shadow: 0 0 40px gold, 0 4px 12px black;
  line-height: 1;
  text-align: center;
}

.card-front {
  background: #1e2e3c;
  border: 3px solid #f3d27e;
  padding: 20px;
  transition: background 0.2s;
  color: white;
  text-shadow: 0 2px 6px black;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.card-title {
  font-size: clamp(36px, 8vw, 56px);
  font-weight: 900;
  letter-spacing: 2px;
  background: rgba(0,0,0,0.2);
  padding: 8px 20px;
  border-radius: 50px;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s;
  text-align: center;
}

.card-price {
  font-size: clamp(26px, 5vw, 40px);
  background: rgba(0,0,0,0.3);
  padding: 8px 28px;
  border-radius: 50px;
  font-weight: bold;
  color: #ffeaae;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.2s;
  text-align: center;
}

.card-front.reveal .card-title,
.card-front.reveal .card-price {
  opacity: 1;
}

.card-glow {
  animation: cardPulse 0.8s;
}

.vibrate {
  animation: vibrate 0.1s linear 3;
}

@keyframes cardPulse {
  50% { box-shadow: 0 0 60px 20px #ffeeaa, 0 20px 30px #000, 0 0 0 3px #dbb56b inset; }
}

@keyframes vibrate {
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
}

.gacha-section {
  display: flex;
  justify-content: center;
  margin: 5px 0;
  position: relative;
}

.gacha-wrapper {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.gacha-circle {
  background: radial-gradient(circle at 30% 30%, #f5d742, #b87c1b);
  width: clamp(140px, 30vw, 200px);
  height: clamp(140px, 30vw, 200px);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 5px solid #ffeaaf;
  box-shadow: 0 15px 0 #7a5010, 0 0 35px #ffd966;
  cursor: pointer;
  transition: 0.08s linear;
  user-select: none;
  font-weight: 900;
  color: #2b1f00;
  text-shadow: 0 1px 2px #ffeeaa;
  position: relative;
  z-index: 2;
}

.gacha-circle.pressed {
  transform: translateY(8px);
  box-shadow: 0 7px 0 #7a5010, 0 0 60px #ffbf00;
}

.gacha-circle.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.5);
  transform: none;
}

.gacha-text {
  font-size: clamp(24px, 6vw, 40px);
  color: #2b1f00 !important;
}

.gacha-cost {
  font-size: clamp(16px, 3vw, 24px);
  background: #00000055;
  padding: 4px 12px;
  border-radius: 30px;
  color: #ffeaae;
  margin-top: 5px;
}

.tenpull-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  pointer-events: none;
  z-index: 5;
  display: none;
  transition: 0.08s linear;
}

.gacha-circle.pressed + .tenpull-ring {
  transform: translateY(8px);
}

.tenpull-ring svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px gold);
  transform: rotate(-90deg);
}

.ring-bg {
  stroke: rgba(255,215,0,0.3);
  stroke-width: 6;
}

.ring-progress {
  stroke: #ffdd77;
  stroke-width: 6;
  stroke-dasharray: 276.46, 276.46;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px #ffbb33);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vw, 25px);
}

.mine-btn {
  background: #3d5a73;
  border: none;
  padding: 14px 24px;
  border-radius: 50px;
  color: #f5e3b0;
  font-weight: bold;
  font-size: clamp(18px, 4vw, 26px);
  box-shadow: 0 8px 0 #1e2f3d;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.05s linear;
}

.mine-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #1e2f3d;
}

.sell-buttons {
  display: flex;
  gap: 12px;
}

.btn-premium {
  background: #3f7840;
  border: none;
  padding: 14px 22px;
  border-radius: 48px;
  color: #fffac2;
  font-size: clamp(16px, 3.5vw, 22px);
  font-weight: bold;
  box-shadow: 0 8px 0 #1d3a1d;
  cursor: pointer;
  transition: 0.05s linear;
}

.btn-premium:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #1d3a1d;
}

.btn-keep {
  background: #3e4f63;
  box-shadow: 0 8px 0 #253240;
}

.btn-keep:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #253240;
}

.btn-premium:disabled, .btn-keep:disabled {
  opacity: 0.65;
  transform: none;
  cursor: not-allowed;
  filter: grayscale(0.15);
  box-shadow: 0 8px 0 #1d3a1d;
}

.boss-quote-mini {
  text-align: center;
  color: #fad98b;
  min-height: 28px;
  font-style: italic;
  text-shadow: 0 0 8px #fad98b;
}

.warehouse-section {
  background: #0b1924e0;
  border-radius: 24px;
  padding: 14px;
  border: 1px solid #dfc087;
}

.wh-header-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.drag-sell-zone {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, #f5d742, #b87c1b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: bold;
  box-shadow: 0 4px 0 #7a5010;
  transition: transform 0.12s cubic-bezier(0.2, 1.2, 0.4, 1), background 0.1s;
  cursor: grab;
  flex-shrink: 0;
  margin-left: 4px;
}

.drag-sell-zone.drag-over {
  transform: scale(1.25);
  background: radial-gradient(circle at 30% 30%, #ffef70, #e6a32e);
  box-shadow: 0 6px 0 #7a5010;
}

.warehouse-grid-compact {
  position: relative;
  background: #0b131e;
  border-radius: 16px;
  border: 2px solid #6a5a3a;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 500px;
  margin: 0 auto;
  overflow: hidden;
  touch-action: none;
}

.grid-bg {
  display: grid;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
}

.grid-cell-bg {
  border: 1px solid #4a6077;
  background: #1b2a38;
}

#itemsLayerCompact {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
}

.warehouse-item {
  position: absolute;
  border: 2px solid #ffeaaf;
  box-shadow: 0 0 10px rgba(0,0,0,0.6);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 3px black;
  border-radius: 5px;
  will-change: left, top;
  transition: transform 0.1s;
  background-size: 400% 400%;
  background-position: 0% 50%;
  z-index: 25;
}

.warehouse-item.selected {
  border: 4px solid #f5e56b;
  box-shadow: 0 0 0 2px #fff, 0 0 30px gold;
  filter: brightness(1.05);
  transform: scale(0.98);
  z-index: 30;
}

.warehouse-item.dragging {
  opacity: 0.9;
  box-shadow: 0 0 40px 10px cyan;
  z-index: 99999 !important;
  transform: scale(0.92);
  cursor: grabbing;
}

.rainbow-item {
  animation: rainbowFlow 1.5s linear infinite !important;
  background-size: 400% 400% !important;
  box-shadow: 0 0 30px 10px #ff66ff, 0 0 50px 20px #66ffff, 0 0 70px 30px #ffcc66 !important;
  transform: scale(1.03) !important;
  border: 3px solid #fff !important;
}

@keyframes rainbowFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.debuff-panel {
  margin-top: 8px;
  padding: 6px;
  background: #1f2a33b0;
  border-radius: 24px;
}

.rate-panel {
  background: #0a101cd9;
  border-radius: 28px;
  padding: 12px 16px;
  border: 1px solid #e6c87a;
  font-size: clamp(12px, 3vw, 14px);
}

.rate-title {
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  color: #ffdfaa;
  font-size: 1.1rem;
  text-shadow: 0 0 8px #ffdfaa;
}

.rate-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
}

.rate-item {
  background: #1f2a33a0;
  border-radius: 40px;
  padding: 4px 12px;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  backdrop-filter: blur(2px);
}

.rate-name {
  font-weight: bold;
}

.rate-prob {
  color: #ffd966;
  text-shadow: 0 0 5px #ffd966;
}

.rate-price {
  color: #b9f6ca;
  font-size: 0.85em;
}

.bank-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.bank-card {
  background: linear-gradient(145deg,#1e2e3f,#0f1a24);
  border: 3px solid #dbb56b;
  border-radius: 48px;
  padding: 28px;
  width: min(400px, 90vw);
  position: relative;
}

.bank-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 32px;
  cursor: pointer;
  color: #e0b87b;
}

.bank-title {
  font-size: clamp(24px,6vw,36px);
  margin-bottom: 20px;
  text-align: center;
  text-shadow: 0 0 10px #e0b87b;
}

.bank-info {
  background: #0c1722;
  padding: 12px;
  border-radius: 24px;
  margin-bottom: 20px;
}

.bank-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bank-btn {
  background: #1e3a4e;
  border: 2px solid #c2a562;
  color: #ffefc0;
  padding: 14px;
  border-radius: 40px;
  font-size: clamp(16px,4vw,20px);
  cursor: pointer;
}

.mine-flash {
  animation: flashMine 0.8s ease-in-out 3;
}

@keyframes flashMine {
  0% { background: #3d5a73; box-shadow: 0 8px 0 #1e2f3d; }
  30% { background: #ffb347; box-shadow: 0 8px 0 #b95f00; color: #1e2f3d; }
  70% { background: #ffb347; box-shadow: 0 8px 0 #b95f00; color: #1e2f3d; }
  100% { background: #3d5a73; box-shadow: 0 8px 0 #1e2f3d; }
}

* {
  color: white;
}

.gacha-text {
  color: #2b1f00 !important;
}