:root {
  --bg: #14100c;
  --bg-panel: #1d1712;
  --bg-panel-2: #241c15;
  --border: #3a2c1e;
  --copper: #b87333;
  --brass: #c9a227;
  --copper-light: #d99a5c;
  --text: #ece3d6;
  --text-dim: #b3a591;
  --text-faint: #7a6f5e;
  --danger: #d64545;
  --success: #6fae5a;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);

  /* Minecraft-style item rarity colors */
  --rarity-common: #c6c6c6;
  --rarity-uncommon: #ffff55;
  --rarity-epic: #ff55ff;

  --mx: 0px;
  --my: 0px;
  --scroll: 0px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Rubik", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(184,115,51,.08), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(201,162,39,.06), transparent 45%);
  min-height: 100vh;
  position: relative;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Background decorative gears (parallax on mouse move + scroll) */
.bg-gears { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.gear { position: absolute; fill: none; stroke: var(--copper); opacity: .06; will-change: transform; }
.gear path, .gear circle { fill: var(--copper); }
.gear-1 {
  width: 380px; height: 380px; top: -80px; right: -100px;
  animation: spin 90s linear infinite;
  transform: translate3d(calc(var(--mx) * -0.6), calc(var(--my) * -0.6 + var(--scroll) * 0.05), 0) rotate(0deg);
}
.gear-2 {
  width: 260px; height: 260px; bottom: -60px; left: -80px;
  animation: spin-rev 70s linear infinite;
  transform: translate3d(calc(var(--mx) * 0.8), calc(var(--my) * 0.8 - var(--scroll) * 0.08), 0);
}
.gear-3 {
  width: 160px; height: 160px; top: 45%; left: 55%; opacity: .04;
  animation: spin 50s linear infinite;
  transform: translate3d(calc(var(--mx) * -1.1), calc(var(--my) * -1.1 + var(--scroll) * 0.1), 0);
}
.gear-4 {
  width: 220px; height: 220px; top: 20%; left: -60px; opacity: .05;
  animation: spin-rev 110s linear infinite;
  transform: translate3d(calc(var(--mx) * 0.5), calc(var(--my) * 0.5 - var(--scroll) * 0.04), 0);
}
.gear-5 {
  width: 140px; height: 140px; bottom: 15%; right: 8%; opacity: .05;
  animation: spin 65s linear infinite;
  transform: translate3d(calc(var(--mx) * -0.9), calc(var(--my) * -0.9 + var(--scroll) * 0.07), 0);
}
@keyframes spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes spin-rev { from { rotate: 0deg; } to { rotate: -360deg; } }
.gear-1, .gear-2, .gear-3, .gear-4, .gear-5 { rotate: 0deg; }

/* Header */
.site-header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #1a140e, #14100c);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand { display: flex; align-items: center; gap: 12px; }

/* Generic gear icon: a real SVG shape, not an emoji glyph, so it renders
   identically on every OS/browser instead of falling back to a system emoji font. */
.icon-gear {
  fill: currentColor;
  stroke: none;
  display: block;
}

.brand-gear {
  width: 28px;
  height: 28px;
  color: var(--brass);
  display: inline-block;
  animation: spin 12s linear infinite;
  line-height: 0;
}
.brand-gear .icon-gear { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.brand-title b { color: var(--copper-light); }
.brand-sub { font-size: 12px; color: var(--text-faint); }

.btn-ghost {
  border: 1px solid var(--copper);
  color: var(--copper-light);
  padding: 8px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--copper); color: #1a140e; }

/* Hero: big gradient metallic title + steam */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 56px 20px 34px;
  overflow: hidden;
}
.hero-title {
  margin: 0;
  font-size: clamp(38px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #f0d9b5 0%, var(--copper-light) 35%, var(--copper) 62%, var(--brass) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--copper-light);
  filter: drop-shadow(0 4px 18px rgba(184,115,51,.35));
}
.hero-title span {
  background: linear-gradient(180deg, #ffe9c2 0%, var(--brass) 45%, #8a6a10 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin: 10px 0 0;
  color: var(--text-dim);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
}
.hero-steam {
  position: absolute;
  top: 0;
  left: 50%;
  width: 260px;
  height: 100%;
  transform: translateX(-50%);
  pointer-events: none;
}
.hero-steam span {
  position: absolute;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,154,92,.20), rgba(217,154,92,0) 70%);
  filter: blur(3px);
  animation: steam-rise 6s ease-in infinite;
  opacity: 0;
}
.hero-steam span:nth-child(1) { left: 20%; animation-delay: 0s; }
.hero-steam span:nth-child(2) { left: 42%; animation-delay: 1.5s; width: 26px; height: 26px; }
.hero-steam span:nth-child(3) { left: 58%; animation-delay: 3s; }
.hero-steam span:nth-child(4) { left: 78%; animation-delay: 4.4s; width: 22px; height: 22px; }
@keyframes steam-rise {
  0%   { transform: translateY(0) scale(.6); opacity: 0; }
  15%  { opacity: .55; }
  70%  { opacity: .18; }
  100% { transform: translateY(-140px) scale(1.6); opacity: 0; }
}

main.wrap { position: relative; z-index: 1; padding-top: 12px; padding-bottom: 140px; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.nickname-panel label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.nickname-row { display: flex; align-items: center; gap: 10px; }
#nickname {
  flex: 1;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}
#nickname:focus { border-color: var(--copper); }
.nickname-status { font-size: 20px; width: 22px; text-align: center; }
.nickname-status.ok { color: var(--success); }
.nickname-status.bad { color: var(--danger); }
.hint { color: var(--text-faint); font-size: 12.5px; margin: 10px 0 0; }

.section-title {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--copper-light);
  margin: 0 0 16px;
  border-left: 3px solid var(--brass);
  padding-left: 10px;
}

.state-line { color: var(--text-faint); font-size: 13px; margin-bottom: 10px; min-height: 16px; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* Product card as a Minecraft-inspired inventory slot */
.product-card {
  --rc: var(--rarity-common);
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s, transform .15s, box-shadow .2s;
  position: relative;
}
.product-card:hover { border-color: var(--copper); transform: translateY(-3px); }

.product-card.rarity-uncommon { --rc: var(--rarity-uncommon); }
.product-card.rarity-epic { --rc: var(--rarity-epic); }

.product-card.rarity-uncommon:hover,
.product-card.rarity-epic:hover { border-color: var(--rc); }

.product-card.rarity-epic {
  animation: epic-pulse 2.6s ease-in-out infinite;
}
@keyframes epic-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,85,255,.15), 0 0 14px rgba(255,85,255,.10); }
  50%      { box-shadow: 0 0 0 1px rgba(255,85,255,.35), 0 0 26px rgba(255,85,255,.28); }
}

.product-image {
  width: 100%;
  height: 96px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2b2b2b, #1a1a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
  position: relative;
  border: 2px solid #0c0c0c;
  box-shadow:
    inset 2px 2px 0 rgba(0,0,0,.55),
    inset -2px -2px 0 rgba(255,255,255,.05),
    0 0 0 2px rgba(0,0,0,.4),
    0 0 10px 1px color-mix(in srgb, var(--rc) 55%, transparent);
}
.product-image::after {
  /* rarity ring */
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 6px;
  border: 2px solid var(--rc);
  opacity: .8;
  pointer-events: none;
}
.product-image img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.5));
  transition: transform .15s ease;
}
.product-image .item-fallback-icon {
  width: 44px;
  height: 44px;
  color: var(--copper-light);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.5));
  transition: transform .15s ease;
}
.product-card:hover .product-image img,
.product-card:hover .product-image .item-fallback-icon { transform: scale(1.12); }

.product-image img.bounce,
.product-image .item-fallback-icon.bounce { animation: item-bounce .45s cubic-bezier(.34,1.6,.64,1); }
@keyframes item-bounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45) rotate(-6deg); }
  65%  { transform: scale(.88) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}

.product-name { font-weight: 600; font-size: 15px; }
.rarity-uncommon .product-name { color: var(--rarity-uncommon); }
.rarity-epic .product-name { color: var(--rarity-epic); }

.product-desc { color: var(--text-faint); font-size: 12.5px; min-height: 16px; }
.product-qty { color: var(--text-dim); font-size: 12px; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 8px; }
.product-price { color: var(--brass); font-weight: 700; font-size: 16px; white-space: nowrap; }
.product-old-price { color: var(--text-faint); text-decoration: line-through; font-size: 12px; margin-right: 6px; }

.btn-add {
  background: linear-gradient(180deg, var(--copper-light), var(--copper));
  border: none;
  color: #211407;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  white-space: nowrap;
}
.btn-add:hover { filter: brightness(1.1); }
.btn-add:active { transform: scale(.97); }
.btn-add.in-cart { background: var(--bg-panel); color: var(--brass); border: 1px solid var(--brass); }

/* Cart - desktop sidebar */
.cart {
  position: fixed;
  top: 90px;
  right: 24px;
  width: 310px;
  max-height: calc(100vh - 120px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 24px rgba(184,115,51,.08);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.cart-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .5px;
  background: linear-gradient(180deg, rgba(201,162,39,.08), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.cart-gear { color: var(--brass); animation: spin 12s linear infinite; display: inline-flex; width: 15px; height: 15px; line-height: 0; }
.cart-gear .icon-gear { width: 15px; height: 15px; }
.cart-toggle .cart-gear { width: 24px; height: 24px; }
.cart-toggle .cart-gear .icon-gear { width: 24px; height: 24px; }
.cart-count {
  margin-left: auto;
  background: var(--copper);
  color: #1a140e;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  transition: transform .15s;
}
.cart-count.bump { animation: count-bump .3s ease; }
@keyframes count-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.cart-items { padding: 10px 14px; overflow-y: auto; flex: 1; }
.cart-empty { color: var(--text-faint); font-size: 13px; text-align: center; padding: 20px 0; }

.cart-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-name { flex: 1; font-size: 13.5px; }
.cart-item-qty-controls { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { border-color: var(--copper); }
.cart-item-qty { min-width: 18px; text-align: center; font-size: 13px; }
.cart-item-price { font-size: 13px; color: var(--brass); font-weight: 600; min-width: 54px; text-align: right; }
.cart-item-remove { color: var(--text-faint); background: none; border: none; cursor: pointer; font-size: 15px; }
.cart-item-remove:hover { color: var(--danger); }

.cart-footer { padding: 14px 16px; border-top: 1px solid var(--border); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
#cart-total { color: var(--brass); }

.email-field { display: block; margin-bottom: 12px; }
.email-field span { display: block; font-size: 11.5px; color: var(--text-faint); margin-bottom: 5px; }
.email-field input {
  width: 100%;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.email-field input:focus { border-color: var(--copper); }

.btn-pay {
  width: 100%;
  background: linear-gradient(180deg, var(--brass), #a5820f);
  border: none;
  color: #1a140e;
  font-weight: 800;
  font-size: 15px;
  padding: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .5px;
  transition: filter .15s, transform .1s;
}
.btn-pay:disabled { opacity: .4; cursor: not-allowed; }
.btn-pay:not(:disabled):hover { filter: brightness(1.08); }
.btn-pay:not(:disabled):active { transform: scale(.98); }

.checkout-error { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; text-align: center; }

/* Mobile cart toggle */
.cart-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 25;
  background: linear-gradient(180deg, var(--copper-light), var(--copper));
  border: none;
  color: #1a140e;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 22px;
}
.cart-toggle .cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: #fff;
}

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 18px 0 90px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

/* Responsive */
@media (max-width: 880px) {
  .cart {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: auto;
    max-height: 78vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(105%);
    transition: transform .25s ease;
  }
  .cart.open { transform: translateY(0); }
  .cart-toggle { display: flex; }
  main.wrap { padding-bottom: 100px; }
}

@media (max-width: 480px) {
  .site-header .wrap { height: 62px; }
  .brand-title { font-size: 16px; }
  .brand-sub { font-size: 10.5px; }
  .btn-ghost { padding: 6px 10px; font-size: 12px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .hero { padding: 36px 16px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .gear, .brand-gear, .cart-gear, .product-card.rarity-epic, .hero-steam span, .product-image img.bounce, .cart-count.bump {
    animation: none !important;
  }
}
