/* ===== Global overlay defaults ===== */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  transition: opacity .35s ease;
  background: radial-gradient(1200px 800px at 50% 60%, rgba(0,0,0,.35), rgba(0,0,0,.92));
}
.hidden { opacity: 0; pointer-events: none; }

/* ===== OPS Menu ===== */
.ops-shell {
  display: grid;
  gap: 22px;
  align-items: center;
  justify-items: center;
  width: min(92vw, 920px);
}
.ops-title {
  letter-spacing: 0.12em;
  font-weight: 800;
  font-size: clamp(18px, 2.2vw, 26px);
  color: #ffe680;
  text-shadow: 0 0 24px rgba(255, 64, 64, 0.2);
}
.ops-panel {
  width: 100%;
  padding: 26px;
  border-radius: 14px;
  background: rgba(12, 15, 22, 0.65);
  border: 1px solid rgba(255, 102, 102, 0.35);
  box-shadow: 0 0 40px rgba(255, 64, 64, 0.18);
  backdrop-filter: blur(6px);
  display: grid;
  gap: 14px;
}
.ops-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ops-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20, 24, 32, 0.7);
  color: #eaeaea;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, background .2s ease, border-color .2s ease;
  backdrop-filter: blur(4px);
}
.ops-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.ops-btn:active { transform: translateY(0); filter: brightness(.95); }
.ops-btn.primary {
  background: linear-gradient(90deg, #ff6666, #ff4040);
  border: none;
  color: #fff;
  text-shadow: 0 0 12px rgba(0,0,0,.3);
}
.ops-btn.accent {
  background: linear-gradient(90deg, #58a6ff, #2b7bff);
  border: none;
  color: #fff;
}
.ops-btn.ghost { background: rgba(20, 24, 32, 0.55); }
.ops-stats { font-size: 14px; opacity: .9; }

/* ===== Crate Screen ===== */
#crates {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto auto;
  z-index: 25;
  transition: opacity .35s ease;
}
#crates.hidden { opacity: 0; pointer-events: none; }

/* Background */
.ops-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(1000px 700px at 50% 60%, rgba(10,16,24,0.4), rgba(8,12,18,0.95)),
              url("../assets/crate_bg.png") center/cover no-repeat;
  filter: saturate(1.05);
  z-index: 0;
}

/* ===== Crate Image (reliable drop) ===== */
#crateImg {
  position: fixed;
  left: 50%;
  top: 58vh;
  transform: translate(-50%, -120vh);
  width: 200px;
  height: 200px;
  opacity: 0;
  z-index: 999999;
  pointer-events: none;
  transition:
    transform 0.9s cubic-bezier(.22,1,.36,1),
    opacity 0.6s ease;
}
#crateImg.drop {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== Red13 Quip ===== */
.reward-card {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(80vw, 700px);
  text-align: center;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 900;
  color: #ffcc66;
  text-shadow: 0 0 18px rgba(255, 80, 80, 0.45);
  opacity: 0;
  transition: opacity .6s ease;
  z-index: 9999;
}
.reward-card.show { opacity: 1; }

/* ===== Crate Buttons ===== */
#crates:not(.hidden) .crate-options {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  z-index: 9999;
}
#crates:not(.hidden) .crate-card {
  cursor: pointer;
  display: grid;
  gap: 10px;
  padding: 20px 26px;
  border-radius: 18px;
  background: rgba(15,20,28,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  width: 260px;
  color: #fff;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}
#crates:not(.hidden) .crate-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.25);
  background: rgba(20,26,36,0.96);
}
#crates:not(.hidden) .crate-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
#crates:not(.hidden) .crate-thumb {
  width: 70px;
  height: 70px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
#crates:not(.hidden) .crate-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hide gameplay canvas while in crates */
#crates:not(.hidden) ~ .wrap,
#crates:not(.hidden) ~ #game,
#crates:not(.hidden) ~ canvas {
  display: none !important;
}

/* ===== HUD ===== */
.crate-hud {
  position: absolute;
  top: 30px;
  right: 40px;
  display: flex;
  gap: 12px;
  z-index: 9999;
}
.hud-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(10,14,20,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
  color: #fff;
  font-size: 0.9rem;
}
.hud-pill.gc { color: #ffcc00; }
.hud-pill.bp { color: #36d399; }

/* ===== Item Name Above Crate (Persistent) ===== */
#crateItemLabel {
  position: fixed;
  background: rgba(15, 18, 24, 0.85);
  color: #ffe680;
  font-weight: 900;
  font-size: 20px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 99999;
}
#crateItemLabel.show { opacity: 1; }
