/* ==========================================================================
   BULLDROP — Upgrade page
   Upgrade machine · item pickers · skin grid · best upgrades
   Depends on shared.css + game-shared.css
   ========================================================================== */

.upgrade__lead { margin-bottom: 22px; }

/* ---------- Upgrade machine ---------- */
.machine {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 34px 30px 74px;
  margin-bottom: 26px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(70% 90% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 65%),
    linear-gradient(180deg, #1b1e28, #12141c);
  overflow: hidden;
}

.machine__slot { display: grid; place-items: center; }

/* Pedestal the item sits on */
.machine__pedestal {
  position: relative;
  display: grid;
  place-items: center;
  width: min(240px, 100%);
  aspect-ratio: 1 / 1;
}
.machine__pedestal::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 4%;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(255, 255, 255, 0.16), transparent 70%);
}
.machine__pedestal img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.6));
}

/* Central chance dial */
.machine__core { display: grid; place-items: center; }
.machine__dial {
  display: grid;
  place-items: center;
  width: clamp(120px, 15vw, 170px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.09);
  background:
    conic-gradient(from 180deg, rgba(255, 89, 95, 0.22) 0deg, rgba(255, 255, 255, 0.03) 8deg),
    #0e1017;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.7);
}
.machine__chance {
  font-size: clamp(20px, 2.6vw, 28px);
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Action row pinned to the bottom of the machine */
.machine__action {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(460px, calc(100% - 40px));
}
.machine__bolt {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--gold);
  transition: background-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.machine__bolt:hover { background: var(--gold-dim); transform: translateY(-2px); }
.machine__bolt svg { width: 20px; height: 20px; }

.machine__go {
  flex: 1;
  gap: 10px;
  padding: 15px 24px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg-elevated);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 700;
}
.machine__go svg { width: 17px; height: 17px; }
.machine__go:hover {
  background: #ffffff;
  border-color: transparent;
  color: #14161f;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Item pickers ---------- */
.picker-grid {
  display: grid;
  grid-template-columns: 0.86fr 1fr;
  gap: 18px;
  margin-bottom: 40px;
}

.picker { display: grid; align-content: start; gap: 16px; }

.picker__head { display: grid; gap: 14px; }
.picker__head--row {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: space-between;
}
.picker__title { font-size: 19px; }

/* Game filter row */
.gamebar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  padding-bottom: 2px;
}
.gamebar::-webkit-scrollbar { display: none; }
.gamebar__btn {
  flex: 0 0 auto;
  min-width: 62px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-inset);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease),
    border-color var(--t) var(--ease);
}
.gamebar__btn:hover { color: var(--text-soft); border-color: var(--line-strong); }
.gamebar__btn.is-active {
  background: rgba(255, 176, 46, 0.14);
  border-color: rgba(255, 176, 46, 0.4);
  color: var(--gold);
}

/* ---------- Skin grid ---------- */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
  /* thin scrollbar so the panel keeps its shape */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.skin-grid::-webkit-scrollbar { width: 6px; }
.skin-grid::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
}

.skin {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 2px;
  width: 100%;
  padding: 10px 11px 11px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-align: left;
  overflow: hidden;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.skin:hover { transform: translateY(-3px); box-shadow: var(--sh-md); }

/* Rarity backgrounds mirror the reference tiles */
.skin--common { background: linear-gradient(160deg, #2b6ea8, #1d4a72); }
.skin--rare   { background: linear-gradient(160deg, #6b3fd0, #47269b); }
.skin--epic   { background: linear-gradient(160deg, #9b3fd0, #6a1f9c); }
.skin--legend { background: linear-gradient(160deg, #d0344f, #961f38); }

.skin img {
  width: 100%;
  height: 76px;
  margin-bottom: 4px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
}
.skin__type {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
}
.skin__name {
  width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skin__price {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ---------- Best upgrades ---------- */
.best-up { margin-bottom: 34px; }

.best-up__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.upcard {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.upcard:hover { transform: translateY(-4px); border-color: var(--line-strong); }

.upcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.upcard__user {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--text-soft);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upcard__avatar {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--glass-2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
}
.upcard__chance {
  flex-shrink: 0;
  color: var(--text-mute);
  font-size: 11.5px;
  font-weight: 700;
}
.upcard__chance i { font-style: normal; color: var(--text-dim); }

.upcard__body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.upcard__from {
  display: grid;
  place-items: center;
  min-height: 104px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, #d0344f, #961f38);
}
.upcard__stake {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.upcard__to {
  display: grid;
  justify-items: start;
  align-content: end;
  gap: 1px;
  min-height: 104px;
  padding: 8px 10px 9px;
  border-radius: var(--r-md);
  overflow: hidden;
}
.upcard__to--epic   { background: linear-gradient(160deg, #9b3fd0, #6a1f9c); }
.upcard__to--legend { background: linear-gradient(160deg, #d0344f, #961f38); }
.upcard__to--gold   { background: linear-gradient(160deg, #d9a12a, #a06d10); }

.upcard__to img {
  width: 100%;
  height: 54px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}
.upcard__type { font-size: 9.5px; color: rgba(255, 255, 255, 0.6); }
.upcard__name {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Centred arrow badge between the two tiles */
.upcard__arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green);
  color: #04250f;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.upcard__arrow svg { width: 15px; height: 15px; }

.upcard__foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-mute);
  font-size: 11.5px;
  font-weight: 600;
}

/* ---------- SEO note ---------- */
.seo-note {
  padding: 24px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--bg-surface);
}
.seo-note__title { margin-bottom: 12px; font-size: 18px; }
.seo-note__text {
  max-width: 90ch;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.75;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .best-up__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .picker-grid { grid-template-columns: 1fr; }
  .skin-grid { max-height: none; }
}

@media (max-width: 768px) {
  .machine { padding: 24px 18px 70px; gap: 12px; }
  .machine__dial { width: clamp(96px, 22vw, 130px); }
  .picker__head--row { grid-template-columns: 1fr; }
  .field-row { width: 100%; }
  .mini-field { flex: 1; }
}

@media (max-width: 560px) {
  .skin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .best-up__list { grid-template-columns: 1fr; }
  /* Machine stacks: give / dial / get */
  .machine { grid-template-columns: 1fr; }
  .machine__core { order: -1; }
}
