/* ============================================================
 * Lootty — Visual System
 * ============================================================ */

:root {
  /* Surface */
  --void: #05070b;
  --hull: #0d1117;
  --plank: #161d27;
  --plank-2: #1d2531;
  --line: #232c39;
  --line-2: #2f3a4a;

  /* Ink */
  --ink: #f4ecd8;        /* parchment white */
  --ink-dim: #a8b0c0;
  --ink-faint: #6b7383;

  /* Pirate palette */
  --blood: #ff3c2c;       /* jolly-roger red */
  --blood-deep: #b32218;
  --gold: #ffc83a;        /* gold coin */
  --gold-deep: #c98b0a;
  --jolly: #f4ecd8;       /* skull white */
  --sea: #1ea0c4;         /* deep sea */
  --kraken: #6b39ff;      /* kraken awakening */
  --aurora: #28d8b8;      /* tentacle teal */

  /* Rarity */
  --r-common: #8c97a8;
  --r-uncommon: #4cc476;
  --r-rare: #3a86ff;
  --r-sr: #b14cff;
  --r-leader: #ffc83a;
  --r-sec: linear-gradient(135deg,#ff3c2c,#ffc83a 50%,#ff3c2c);
  --r-mr: linear-gradient(135deg,#fff,#a8b0c0 50%,#fff);
  --r-grail: conic-gradient(from 0deg, #ff3c2c, #ffc83a, #28d8b8, #6b39ff, #ff3c2c);

  /* Type */
  --f-display: "Bebas Neue", "Anton", system-ui;
  --f-body: "Manrope", -apple-system, system-ui;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: #000; color: var(--ink); font-family: var(--f-body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; }

/* ============================================================
 * Stage scaling
 * ============================================================ */
.gr-stage {
  position: fixed; inset: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(255,60,44,0.18), transparent 60%),
    radial-gradient(80% 50% at 50% 100%, rgba(107,57,255,0.12), transparent 60%),
    #05070b;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.gr-stage::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,200,58,0.05) 0, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,200,58,0.04) 0, transparent 2px),
    radial-gradient(circle at 40% 80%, rgba(40,216,184,0.04) 0, transparent 2px),
    radial-gradient(circle at 85% 20%, rgba(255,200,58,0.05) 0, transparent 2px);
  background-size: 80px 80px, 100px 100px, 120px 120px, 90px 90px;
  pointer-events: none;
}
.gr-stage-inner { transform-origin: center center; }

/* App shell — replaces phone frame. A standalone web product. */
.gr-shell {
  width: 440px; height: 900px;
  border-radius: 28px;
  background: var(--void);
  border: 1px solid var(--line);
  box-shadow:
    0 60px 120px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,200,58,0.04),
    inset 0 0 0 1px rgba(255,255,255,0.02);
  position: relative; overflow: hidden;
}
.gr-shell-mark {
  position: absolute; top: 18px; left: 22px; z-index: 100;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-display); letter-spacing: 0.8px; font-size: 14px; color: var(--gold);
  pointer-events: none;
}
.gr-shell-url {
  position: absolute; top: 18px; right: 22px; z-index: 100;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.4px;
  color: var(--ink-faint); pointer-events: none;
}

/* ============================================================
 * Screen — base
 * ============================================================ */
.gr-screen {
  position: absolute; inset: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--f-body);
  display: flex; flex-direction: column;
}
.gr-screen .body { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.gr-screen .body::-webkit-scrollbar { display: none; }
.gr-screen .body { scrollbar-width: none; }

/* Status bar removed entirely for web product — hide if still rendered */
.gr-statusbar { display: none; }

/* Top app bar with title + actions */
.gr-appbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 20px 16px; flex-shrink: 0;
}
.gr-appbar h1 {
  margin: 0; font-family: var(--f-display); font-size: 34px; font-weight: 400;
  letter-spacing: 0.5px; line-height: 1;
}
.gr-appbar .right { display: flex; gap: 8px; align-items: center; }

.gr-balance {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px 0 10px; border-radius: 999px;
  background: linear-gradient(135deg, #1c2330, #11161e);
  border: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 12px; font-weight: 600;
  color: var(--gold);
}
.gr-balance svg { width: 14px; height: 14px; }

/* Pill button */
.gr-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--ink-dim); font-size: 12px; font-weight: 600;
}
.gr-pill.accent { color: var(--gold); border-color: rgba(255,200,58,0.3); background: rgba(255,200,58,0.06); }
.gr-pill.live { color: #fff; background: var(--blood); border-color: var(--blood); }
.gr-pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: gr-pulse 1.2s ease-in-out infinite; }

@keyframes gr-pulse { 50% { opacity: 0.3; } }

/* ============================================================
 * Tab bar — 4 columns (web product, no native RIP button)
 * ============================================================ */
.gr-tabbar {
  position: relative; flex-shrink: 0;
  height: 72px;
  background: linear-gradient(180deg, transparent 0%, rgba(5,7,11,0.92) 40%, rgba(5,7,11,0.98) 100%);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: 14px;
}
.gr-tabbar .tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-faint); font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; padding-top: 10px;
  position: relative;
}
.gr-tabbar .tab.active { color: var(--gold); }
.gr-tabbar .tab.active::after {
  content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px;
  background: var(--gold); border-radius: 2px;
  box-shadow: 0 0 8px var(--gold);
}
.gr-tabbar .tab svg { width: 22px; height: 22px; }

/* ============================================================
 * Cards / sections
 * ============================================================ */
.gr-card {
  background: linear-gradient(170deg, var(--plank-2) 0%, var(--plank) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}
.gr-card.glow::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(60% 40% at 50% 0%, rgba(255,200,58,0.12), transparent 60%);
}

.gr-section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 4px 20px 10px;
}
.gr-section-title h2 {
  margin: 0; font-family: var(--f-display); font-size: 22px; font-weight: 400; letter-spacing: 0.6px;
}
.gr-section-title .more {
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-faint);
  letter-spacing: 0.5px; text-transform: uppercase;
}

/* ============================================================
 * Holo / foil utility
 * ============================================================ */
.gr-holo {
  position: relative; overflow: hidden;
}
.gr-holo::before {
  content: ""; position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, #ff3c2c, #ffc83a, #28d8b8, #3a86ff, #6b39ff, #ff3c2c);
  filter: blur(28px); opacity: 0.55;
  animation: gr-holo-spin 6s linear infinite;
}
.gr-holo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: gr-holo-shimmer 3.5s linear infinite;
  mix-blend-mode: overlay;
}
@keyframes gr-holo-spin { to { transform: rotate(360deg); } }
@keyframes gr-holo-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Foil stripes on packs */
.gr-foil-stripes {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(
    60deg,
    rgba(255,255,255,0.0) 0px,
    rgba(255,255,255,0.06) 2px,
    rgba(255,255,255,0.0) 8px,
    rgba(0,0,0,0.12) 10px,
    rgba(0,0,0,0.0) 18px
  );
  mix-blend-mode: overlay;
}

/* Subtle paper grain for the cards/UI */
.gr-grain::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ============================================================
 * Pack thumbnail (in shop grid)
 * ============================================================ */
.gr-pack-tile {
  position: relative;
  border-radius: 16px; overflow: hidden;
  background: var(--plank);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.gr-pack-tile:active { transform: scale(0.97); }
.gr-pack-tile .gr-pack-cover {
  aspect-ratio: 5/6; position: relative; overflow: hidden;
}
.gr-pack-tile .meta {
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.gr-pack-tile .nm { font-family: var(--f-display); font-size: 20px; letter-spacing: 0.5px; line-height: 1; }
.gr-pack-tile .row {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-faint);
}
.gr-pack-tile .price { color: var(--gold); font-weight: 700; }
.gr-pack-tile .badge {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 4px;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.15);
  color: var(--ink);
}
.gr-pack-tile .max {
  position: absolute; bottom: 8px; left: 10px;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--gold); text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* ============================================================
 * Card (illustration container)
 * ============================================================ */
.gr-card-frame {
  aspect-ratio: 5/7;
  border-radius: 12px; overflow: hidden; position: relative;
  border: 2px solid currentColor;
  background: var(--plank);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.06);
}

/* ============================================================
 * Buttons
 * ============================================================ */
.gr-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold) 0%, #ff8a2c 50%, var(--blood) 100%);
  color: #0a0a0a;
  font-family: var(--f-display); font-size: 20px; letter-spacing: 0.6px;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 30px rgba(255,60,44,0.45), inset 0 -3px 0 rgba(0,0,0,0.18), inset 0 2px 0 rgba(255,255,255,0.35);
}
.gr-btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: gr-holo-shimmer 2.4s linear infinite;
}
.gr-btn-primary:active { transform: scale(0.985); }

.gr-btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px;
  border-radius: 14px;
  background: var(--plank);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700; font-size: 14px; letter-spacing: 0.3px;
}
.gr-btn-secondary:active { transform: scale(0.985); }

/* ============================================================
 * Hero pack (in shop)
 * ============================================================ */
.gr-hero {
  position: relative;
  margin: 0 16px 18px;
  height: 200px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.gr-hero .copy {
  position: absolute; left: 18px; top: 16px; right: 110px; z-index: 2;
}
.gr-hero .tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 8px; border-radius: 4px;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.15);
}
.gr-hero h2 {
  margin: 12px 0 4px; font-family: var(--f-display); font-size: 38px;
  letter-spacing: 0.5px; line-height: 0.9; text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.gr-hero .sub { font-size: 12px; color: rgba(255,255,255,0.85); }
.gr-hero .ctaPill {
  position: absolute; bottom: 16px; left: 18px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(255,255,255,0.97); color: #0a0a0a;
  font-family: var(--f-display); font-size: 16px; letter-spacing: 0.4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.gr-hero .countdown {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  font-family: var(--f-mono); font-size: 11px;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 10px; border-radius: 8px;
  color: var(--gold);
}

/* ============================================================
 * Lists
 * ============================================================ */
.gr-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--plank);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.gr-row .nm { font-size: 13px; font-weight: 700; }
.gr-row .sub { font-family: var(--f-mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px; letter-spacing: 0.3px; }
.gr-row .right { margin-left: auto; text-align: right; }
.gr-row .right .val { font-family: var(--f-mono); color: var(--gold); font-weight: 700; font-size: 13px; }
.gr-row .right .meta { font-family: var(--f-mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px; }

/* ============================================================
 * Anim utilities
 * ============================================================ */
@keyframes gr-float { 0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); } 50% { transform: translateY(-8px) rotate(var(--rot, 0deg)); } }
@keyframes gr-spin-slow { to { transform: rotate(360deg); } }
@keyframes gr-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gr-fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gr-scale-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes gr-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes gr-rays {
  0% { transform: rotate(0deg) scale(1); opacity: 0.0; }
  20% { opacity: 1; }
  100% { transform: rotate(360deg) scale(1.1); opacity: 0.5; }
}
@keyframes gr-confetti {
  0% { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--dr, 540deg)); opacity: 0; }
}

.fade-in { animation: gr-fade-in 0.35s ease both; }
.fade-up { animation: gr-fade-up 0.5s ease both; }
.scale-in { animation: gr-scale-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }

/* ============================================================
 * Marquee / scrolling lucky-pulls
 * ============================================================ */
.gr-marquee {
  display: flex; gap: 18px; padding: 6px 0;
  animation: gr-marquee 28s linear infinite;
}
@keyframes gr-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.gr-marquee-item {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-dim);
}
.gr-marquee-item .val { color: var(--gold); font-weight: 700; }
.gr-marquee-item .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--blood); }

/* ============================================================
 * Volatility slider
 * ============================================================ */
.gr-volatility {
  position: relative;
  padding: 14px 12px 10px;
  background: linear-gradient(90deg, #1a2230 0%, #2b1b3a 50%, #3a0f0f 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.gr-vol-track {
  position: relative;
  height: 36px;
  margin-bottom: 10px;
}
.gr-volatility .knob {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: grab;
}
.gr-vol-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
}
/* legacy alias */
.gr-volatility .scale { display: none; }

/* ============================================================
 * Progress bars
 * ============================================================ */
.gr-track {
  height: 8px; background: var(--plank-2); border-radius: 99px; overflow: hidden;
}
.gr-track > .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blood), var(--gold));
  border-radius: 99px;
}

/* ============================================================
 * Misc tokens
 * ============================================================ */
.text-mono { font-family: var(--f-mono); }
.text-disp { font-family: var(--f-display); letter-spacing: 0.4px; }
.text-dim { color: var(--ink-dim); }
.text-faint { color: var(--ink-faint); }
.text-gold { color: var(--gold); }
.text-blood { color: var(--blood); }
