:root {
  --bg: #0f1117;
  --bg-2: #161a24;
  --panel: #1b2030;
  --panel-2: #232a3d;
  --line: #2e3650;
  --text: #eef1f8;
  --muted: #9aa3b8;
  --green: #7cff6b;
  --gold: #ffd84a;
  --grad: linear-gradient(90deg, var(--green), var(--gold));
  --red: #ff6b6b;
  --blue: #6b9bff;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 255, 107, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(255, 216, 74, 0.08), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

img.px { image-rendering: pixelated; image-rendering: crisp-edges; }

button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* --------------------------------------------------------------- header */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: rgba(15, 17, 23, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 36px; height: 36px; }
.wordmark {
  font-family: Silkscreen, monospace;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 1px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.preview-badge {
  font-family: Silkscreen, monospace;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px dashed var(--gold);
  color: var(--gold);
}

.cart-button {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
}
.cart-button:hover { border-color: var(--green); }
.cart-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cart-button.bump { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.12); } }
.cart-count {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--grad);
  color: #10140c;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

/* ----------------------------------------------------------------- main */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }

.thanks {
  margin: 20px 0 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(124, 255, 107, 0.12);
  border: 1px solid rgba(124, 255, 107, 0.45);
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: center;
  padding: 48px 0 28px;
}
.hero h1 {
  font-family: Silkscreen, monospace;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.1;
  margin: 0 0 14px;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 18px; max-width: 560px; margin: 0 0 22px; }
.hero p strong { color: var(--text); }

.server {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.server-label { color: var(--muted); font-size: 14px; }
.server code { font: 600 16px/1 ui-monospace, Consolas, monospace; color: var(--gold); }
.server button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 0;
  background: var(--grad);
  color: #10140c;
  font-weight: 700;
}
.status { font-size: 13px; color: var(--muted); }
.status.up::before, .status.down::before { content: "●"; margin-right: 5px; }
.status.up::before { color: var(--green); }
.status.down::before { color: var(--red); }

.hero-art { position: relative; height: 280px; }
.hero-logo {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 176px;
  height: 176px;
  filter: drop-shadow(0 14px 30px rgba(124, 255, 107, 0.35));
  animation: bob 4s ease-in-out infinite;
}
.float { position: absolute; width: 72px; height: 72px; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45)); }
.float.a { top: 6%; left: 8%; animation: bob 3.4s ease-in-out infinite; }
.float.b { top: 2%; right: 10%; animation: bob 4.2s ease-in-out infinite 0.6s; }
.float.c { bottom: 4%; left: 14%; animation: bob 3.8s ease-in-out infinite 1.1s; }
.float.d { bottom: 6%; right: 6%; animation: bob 4.6s ease-in-out infinite 0.3s; }
@keyframes bob { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .float, .hero-logo { animation: none; } }

/* ------------------------------------------------------------- branches */
.pick { font-family: Silkscreen, monospace; font-size: 18px; color: var(--muted); margin: 8px 0 12px; }

.branches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.branch {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.branch:hover { transform: translateY(-2px); }
.branch img { width: 56px; height: 56px; flex: none; }
.branch-words { display: flex; flex-direction: column; gap: 2px; }
.branch-words strong { font-size: 18px; }
.branch-words small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.branch.active { background: var(--panel-2); }
.branch-gold.active { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 216, 74, 0.12); }
.branch-red.active { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.12); }
.branch-green.active { border-color: var(--green); box-shadow: 0 0 0 4px rgba(124, 255, 107, 0.12); }

/* ------------------------------------------------------------- products */
.shelf { margin-bottom: 34px; }
.shelf-head h2 { font-family: Silkscreen, monospace; font-size: 26px; margin: 0 0 4px; }
.shelf-head p { color: var(--muted); margin: 0 0 16px; max-width: 760px; }

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-3px); border-color: #45507a; }
.card.hot { border-color: rgba(255, 216, 74, 0.55); }
.card.rarity-epic { border-color: rgba(255, 85, 255, 0.5); }
.card.rarity-legendary { border-color: rgba(255, 170, 0, 0.6); }
.card.rarity-mythic { border-color: rgba(255, 85, 85, 0.6); }

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--grad);
  color: #10140c;
  font-size: 12px;
  font-weight: 700;
}

.art {
  position: relative;
  display: grid;
  place-items: center;
  height: 120px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, 0.07), transparent 65%);
}
.art img { width: 96px; height: 96px; transition: transform 0.2s ease; }
.card:hover .art img { transform: scale(1.08) rotate(-3deg); }
.count {
  position: absolute;
  bottom: 8px;
  right: 14px;
  font-family: Silkscreen, monospace;
  font-weight: 700;
  font-size: 20px;
  color: var(--gold);
  text-shadow: 2px 2px 0 #3a2a00;
}

.card h3 { margin: 0 0 4px; font-size: 18px; }
.desc { margin: 0 0 14px; color: var(--muted); font-size: 14px; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-size: 20px; font-weight: 700; }
.add {
  padding: 9px 18px;
  border-radius: 10px;
  border: 0;
  background: var(--grad);
  color: #10140c;
  font-weight: 700;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.add:hover:not(:disabled) { filter: brightness(1.08); }
.add:active:not(:disabled) { transform: scale(0.96); }

/* ----------------------------------------------------------------- odds */
.odds {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.odds summary { cursor: pointer; font-weight: 600; }
.odds ul { list-style: none; margin: 14px 0 6px; padding: 0; display: grid; gap: 8px; }
.odds li { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 12px; }
.odds-name { font-weight: 700; }
.odds-bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.odds-fill { display: block; height: 100%; border-radius: 999px; }
.odds-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.odds-note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.rainbow {
  background: linear-gradient(90deg, #ff5555, #ffaa00, #ffff55, #55ff55, #55ffff, #5555ff, #ff55ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rainbow-bg { background: linear-gradient(90deg, #ff5555, #ffaa00, #ffff55, #55ff55, #55ffff, #5555ff, #ff55ff); }

/* ----------------------------------------------------------------- cart */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.cart {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4);
  transform: translateX(105%);
  transition: transform 0.25s ease;
}
.cart.open { transform: none; }
body.cart-open .scrim { opacity: 1; pointer-events: auto; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.cart-head h2 { margin: 0; font-family: Silkscreen, monospace; font-size: 22px; }
.cart-head button { border: 0; background: none; color: var(--muted); font-size: 20px; }

.lines { list-style: none; margin: 0; padding: 12px 20px; overflow-y: auto; flex: 1; }
.line { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line img { width: 44px; height: 44px; }
.line-words { display: flex; flex-direction: column; }
.line-words small { color: var(--muted); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.qty span { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.cart-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.name-label { display: block; font-weight: 600; margin-bottom: 6px; }
.name-row { display: flex; align-items: center; gap: 10px; }
.head { width: 40px; height: 40px; border-radius: 8px; image-rendering: pixelated; background: var(--panel); }
.name-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 600 16px/1.2 ui-monospace, Consolas, monospace;
}
.small { color: var(--muted); font-size: 13px; margin: 8px 0; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0 12px; font-size: 18px; }
.total strong { font-size: 24px; }
.checkout {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 0;
  background: var(--grad);
  color: #10140c;
  font-weight: 800;
  font-size: 17px;
}
.cart-msg { color: var(--red); font-size: 14px; min-height: 0; margin: 8px 0 0; }
.cart-msg:empty { display: none; }

/* --------------------------------------------------------------- dialog */
.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  padding: 26px;
  max-width: 380px;
  text-align: center;
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialog img { width: 64px; height: 64px; }
.dialog h2 { font-family: Silkscreen, monospace; margin: 8px 0; }
.dialog p { color: var(--muted); }
.dialog button { padding: 10px 26px; border-radius: 10px; border: 0; background: var(--grad); color: #10140c; font-weight: 700; }

/* --------------------------------------------------------------- footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 16px 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 4px 0; }
.footer a { color: var(--gold); margin-right: 10px; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-art { height: 180px; order: -1; }
  .hero-logo { width: 120px; height: 120px; }
  .float { width: 52px; height: 52px; }
  .branches { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .wordmark { font-size: 18px; }
  .cart-button span:not(.cart-count) { display: none; }
  .odds li { grid-template-columns: 90px 1fr 56px; gap: 8px; }
}
