/* Upgrade page — skin upgrader widget, history table, SEO block */

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}
.breadcrumb a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}
.breadcrumb a:hover {
  color: var(--gold-300);
}
.breadcrumb [aria-current="page"] {
  color: var(--gold-300);
  font-weight: 700;
}

/* ---------- Hero / intro ---------- */
.upgrade-hero {
  padding: 20px 0 8px;
  max-width: 900px;
}
.upgrade-h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.25;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.upgrade-lead {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 640px;
  line-height: 1.6;
}

/* ---------- Widget layout ---------- */
.upgrade-widget-section {
  margin: 32px auto 48px;
}

.upgrade-widget {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.upgrade-zone {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.upgrade-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.upgrade-zone-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.upgrade-total {
  display: none;
}

.upgrade-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ---------- Inventory grid (left zone) ---------- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  flex: 1;
}

.inventory-grid-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.15);
}

.inventory-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 24px;
}

.badge-login-required {
  background: rgba(229, 179, 88, 0.12);
  border: 1px solid rgba(229, 179, 88, 0.4);
  color: var(--gold-300);
}

.inventory-empty-text {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 260px;
  line-height: 1.5;
}

.inv-item {
  position: relative;
  background: var(--bg-3);
  border: 2px solid var(--rarity-color, var(--border-soft));
  border-radius: var(--radius-md);
  padding: 8px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  opacity: 0.82;
}
.inv-item:hover {
  transform: translateY(-3px);
  opacity: 1;
}
.inv-item.selected {
  opacity: 1;
  background: rgba(229, 179, 88, 0.08);
  box-shadow: 0 0 0 1px var(--rarity-color, var(--gold-500)), var(--shadow-gold-glow);
}
.inv-item.selected::after {
  content: "\2713";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: var(--text-inverse);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inv-item-img-wrap {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inv-item-img-wrap img {
  max-height: 52px;
  max-width: 100%;
  object-fit: contain;
}
.inv-item-name {
  font-size: 10.5px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inv-item-price {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--gold-300);
}

.selected-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}
.selected-total strong {
  font-size: 16px;
  color: var(--gold-300);
  font-family: var(--font-display);
}

/* ---------- Gauge zone (center) ---------- */
.upgrade-zone-gauge {
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  gap: 4px;
}

.gauge-wrap {
  padding: 10px 0 6px;
}

.gauge {
  --chance: 45;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(
    var(--gold-400) calc(var(--chance) * 1%),
    var(--bg-3) calc(var(--chance) * 1%)
  );
  position: relative;
  transition: background 0.25s ease;
}
.gauge::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
}
.gauge-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.gauge-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--gold-300);
  line-height: 1;
}
.gauge-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gauge-slider-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 700;
  margin-top: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gauge-slider {
  width: 100%;
  margin-top: 10px;
  accent-color: var(--gold-500);
  cursor: pointer;
  height: 6px;
  border-radius: 4px;
  background: var(--bg-3);
  appearance: none;
  -webkit-appearance: none;
}
.gauge-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold-gradient);
  box-shadow: 0 0 0 3px rgba(212, 160, 57, 0.25);
  cursor: pointer;
}
.gauge-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--gold-gradient);
  box-shadow: 0 0 0 3px rgba(212, 160, 57, 0.25);
  cursor: pointer;
}

.gauge-multiplier {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.gauge-multiplier span {
  color: var(--gold-300);
  font-weight: 800;
}

.upgrade-cta {
  width: 100%;
  margin-top: 20px;
}

/* ---------- Target zone (right) ---------- */
.upgrade-zone-target {
  align-items: center;
  text-align: center;
}
.upgrade-zone-target .upgrade-zone-head {
  width: 100%;
  justify-content: center;
}

.target-card {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}
.target-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(140px 100px at 50% 0%, rgba(229, 179, 88, 0.18), transparent 70%);
  pointer-events: none;
}
.target-img-wrap {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.target-img-wrap img {
  max-height: 120px;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  transition: opacity 0.15s ease;
}
.target-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
}
.target-rarity-badge {
  background: rgba(229, 179, 88, 0.12);
  color: var(--gold-300);
  position: relative;
  z-index: 1;
}
.target-price {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-300);
  position: relative;
  z-index: 1;
}

/* ---------- History table ---------- */
.upgrade-history-section {
  margin: 48px auto;
}

.history-table {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.history-row {
  display: grid;
  grid-template-columns: 1.4fr 2.2fr 0.8fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}
.history-row-head {
  background: var(--bg-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 800;
}
.history-body .history-row {
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
}
.history-body .history-row:hover {
  background: rgba(229, 179, 88, 0.04);
}

.history-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-user img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-soft);
}
.history-user span {
  font-weight: 700;
  color: var(--text-secondary);
}

.history-col-swap {
  display: flex;
  align-items: center;
}

.history-swap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.history-swap-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.history-swap-item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.history-swap-item span {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.history-swap-arrow {
  color: var(--gold-400);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.history-chance {
  font-weight: 700;
  color: var(--text-secondary);
}

.badge-win {
  background: rgba(75, 191, 123, 0.14);
  color: var(--success);
}
.badge-lose {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

/* ---------- How it works steps ---------- */
.upgrade-how {
  margin: 48px auto;
}
.how-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.how-step {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.how-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold-gradient);
  color: var(--text-inverse);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.how-step p {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .upgrade-widget {
    grid-template-columns: 1fr;
  }
  .upgrade-zone-gauge {
    order: -1;
  }
  .gauge {
    width: 150px;
    height: 150px;
  }
}

@media (max-width: 900px) {
  .inventory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .history-row {
    grid-template-columns: 1fr 1.6fr 0.6fr 0.8fr;
    padding: 10px 14px;
  }
  .history-swap-item span {
    max-width: 80px;
  }
  .how-steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .upgrade-h1 {
    font-size: 26px;
  }
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .history-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .history-row-head {
    display: none;
  }
  .history-body .history-row {
    padding: 14px;
    border-radius: var(--radius-md);
    margin: 10px 0;
    border: 1px solid var(--border-subtle);
  }
  .history-chance::before {
    content: attr(data-label) " ";
    color: var(--text-muted);
    font-weight: 400;
  }
  .how-steps {
    grid-template-columns: 1fr 1fr;
  }
}
