/* ============================================================
   VALA FORGE — Global Styles
   Mobile-first · Noir/Or · Luxury Dark Forge
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cinzel+Decorative:wght@400;700;900&family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  --gold: #C9A84C;
  --gold-light: #E8C97A;
  --gold-dim: #8A6F32;
  --gold-glow: rgba(201,168,76,0.3);
  --ember: #FF6B2B;
  --black: #060606;
  --dark: #0c0c0c;
  --dark2: #141414;
  --dark3: #1c1c1c;
  --text: #D4C5A9;
  --text-dim: #7A7060;
  --text-muted: #3A3530;
  --white: #F0EBE0;
  --font-display: 'Cinzel Decorative', serif;
  --font-title: 'Cinzel', serif;
  --font-body: 'Rajdhani', sans-serif;
  --radius: 8px;
  --nav-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: 0.35;
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }

/* ── PARTICLES ── */
#particles {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  opacity: 0.4;
}

/* ── NAV ── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  background: rgba(6,6,6,0.92);
  border-bottom: 1px solid rgba(201,168,76,0.1);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold-dim);
  text-decoration: none;
  letter-spacing: 0.15em;
}
.nav-logo span { color: var(--gold); }

.nav-links {
  display: flex; gap: 1.5rem; list-style: none;
}
.nav-links a {
  font-family: var(--font-title);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px; background: var(--gold);
  transform: scaleX(0); transition: transform 0.2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--gold); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

/* ── CONTAINER ── */
.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── SECTION HEADER ── */
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.eyebrow {
  display: block;
  font-family: var(--font-title);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2rem);
  color: var(--white);
  letter-spacing: 0.05em;
}

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 2rem) 1.5rem 4rem;
  position: relative; overflow: hidden;
}
.hero-glow {
  position: absolute; top: 20%; left: 50%;
  transform: translateX(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(201,168,76,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-eyebrow {
  font-family: var(--font-title);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 1.25rem;
  animation: fadeUp 0.8s ease both;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 10vw, 4.5rem);
  color: var(--white);
  line-height: 1.05;
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.8s 0.1s ease both;
}
.hero-title em {
  font-style: normal;
  color: var(--gold);
  text-shadow: 0 0 40px var(--gold-glow);
}
.hero-sub {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  animation: fadeUp 0.8s 0.2s ease both;
}
.btn-hero {
  display: inline-block;
  padding: 0.9rem 2rem;
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--black);
  background: linear-gradient(135deg, var(--gold-dim), var(--gold), var(--gold-light));
  border: none; border-radius: var(--radius);
  text-decoration: none; cursor: pointer;
  box-shadow: 0 0 30px var(--gold-glow);
  animation: fadeUp 0.8s 0.3s ease both;
  transition: all 0.25s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-hero:hover { transform: translateY(-2px); box-shadow: 0 0 50px var(--gold-glow); }
.btn-hero:active { transform: translateY(0); }

.scroll-indicator {
  position: absolute; bottom: 2rem; left: 50%;
  transform: translateX(-50%);
}
.scroll-dot {
  width: 1px; height: 40px;
  background: linear-gradient(to bottom, var(--gold-dim), transparent);
  margin: 0 auto;
  animation: scrollPulse 2s ease infinite;
}

/* ── LORE ── */
.lore-section {
  padding: 4rem 1.5rem;
  position: relative; z-index: 1;
}
.lore-wrap { max-width: 600px; margin: 0 auto; text-align: center; }
.lore-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 1.5rem 0;
}
.lore-quote {
  font-family: var(--font-title);
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  font-weight: 400;
  color: var(--text);
  line-height: 1.9;
  font-style: normal;
  margin-bottom: 1.5rem;
}
.lore-quote em { color: var(--gold); font-style: normal; }
.lore-body {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.8;
}

/* ── HOW IT WORKS ── */
.how-section {
  padding: 4rem 0;
  position: relative; z-index: 1;
}
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.step-card {
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.1);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  position: relative;
  transition: border-color 0.3s;
}
.step-card:hover { border-color: rgba(201,168,76,0.25); }
.step-num {
  font-family: var(--font-title);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
}
.step-glyph {
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
  display: block;
}
.step-card h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--white);
  margin-bottom: 0.6rem;
}
.step-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ── FORGE SECTION ── */
.forge-section {
  padding: 4rem 0 6rem;
  position: relative; z-index: 1;
}
.forge-step { width: 100%; }
.forge-step.hidden { display: none; }

.forge-box {
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}

.forge-label {
  display: block;
  font-family: var(--font-title);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
}
.forge-input {
  width: 100%;
  background: var(--dark2);
  border: 1px solid var(--text-muted);
  border-radius: 6px;
  padding: 0.875rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--white);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 1rem;
  -webkit-appearance: none;
}
.forge-input::placeholder { color: var(--text-muted); }
.forge-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.08);
}

.forge-error {
  font-size: 0.78rem;
  color: #e05555;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}

.btn-forge-action {
  width: 100%;
  padding: 0.9rem;
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--black);
  background: linear-gradient(135deg, var(--gold-dim), var(--gold), var(--gold-light));
  border: none; border-radius: 6px;
  cursor: pointer; touch-action: manipulation;
  min-height: 52px;
  box-shadow: 0 0 25px var(--gold-glow);
  transition: all 0.22s;
  -webkit-appearance: none;
}
.btn-forge-action:active { transform: scale(0.98); }

.forge-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; margin-top: 1rem;
  font-size: 0.8rem; color: var(--text-dim);
  font-family: var(--font-body);
}
.loading-dots { display: flex; gap: 4px; }
.loading-dots span {
  width: 6px; height: 6px;
  background: var(--gold-dim);
  border-radius: 50%;
  animation: dotBounce 1.2s ease infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

/* VCM Display */
.vcm-reveal {
  text-align: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(201,168,76,0.1);
  margin-bottom: 1.5rem;
}
.vcm-label {
  font-family: var(--font-title);
  font-size: 0.58rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.5rem;
}
.vcm-number {
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3rem);
  color: var(--gold);
  text-shadow: 0 0 30px var(--gold-glow);
  font-weight: 900;
  letter-spacing: 0.05em;
}
.vcm-unit {
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
  margin-top: 0.25rem;
}
.vcm-state-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 3px;
  font-family: var(--font-title);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.forge-message {
  text-align: center;
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  font-style: italic;
}
.forge-message.error { color: #e05555; font-style: normal; }

.pseudo-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.confirm-label {
  display: flex; align-items: flex-start; gap: 0.75rem;
  cursor: pointer; margin: 1.25rem 0;
  font-size: 0.8rem; color: var(--text-dim);
  line-height: 1.5;
}
.confirm-label input[type="checkbox"] { display: none; }
.confirm-box {
  width: 18px; height: 18px; min-width: 18px;
  border: 1px solid var(--text-muted);
  border-radius: 3px; background: var(--dark2);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; margin-top: 1px;
}
.confirm-label input:checked ~ .confirm-box {
  background: var(--gold-dim);
  border-color: var(--gold);
}
.confirm-label input:checked ~ .confirm-box::after {
  content: '✓'; color: var(--black); font-size: 0.7rem; font-weight: 700;
}

.btn-forge-main {
  width: 100%;
  padding: 1rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--black);
  background: linear-gradient(135deg, var(--gold-dim), var(--gold), var(--gold-light));
  border: none; border-radius: 6px;
  cursor: pointer; touch-action: manipulation;
  min-height: 56px;
  box-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(201,168,76,0.1);
  transition: all 0.22s;
  -webkit-appearance: none;
  animation: goldPulse 2s ease infinite;
}
.btn-forge-main:active { transform: scale(0.98); }

/* ── FORGE ANIMATION ── */
.forge-anim-wrap {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem 1.5rem;
  gap: 1.5rem;
}
.hammer-container { position: relative; text-align: center; }
.hammer-emoji {
  font-size: 4rem;
  display: block;
  animation: hammerStrike 0.4s ease infinite;
  transform-origin: bottom right;
}
.anvil-line {
  width: 80px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}
.spark-container {
  position: absolute;
  pointer-events: none;
}
.forge-anim-text {
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
  animation: textPulse 1s ease infinite;
}

/* ── CARD 3D ── */
.result-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 1.5rem;
}
.result-title {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-align: center;
}

.scene {
  width: 300px; height: 460px;
  perspective: 1000px; -webkit-perspective: 1000px;
  user-select: none; flex-shrink: 0;
  touch-action: none; cursor: grab;
}
.scene:active { cursor: grabbing; }
.flipper {
  width: 100%; height: 100%; position: relative;
  transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
}
.face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform: translateZ(0.1px); -webkit-transform: translateZ(0.1px);
}
.face-back {
  transform: rotateY(180deg) translateZ(0.1px);
  -webkit-transform: rotateY(180deg) translateZ(0.1px);
}
.card-inner {
  position: absolute; inset: 0;
  border-radius: 15px; overflow: hidden;
  background: #020202; isolation: isolate;
}
.card-frame {
  position: absolute; inset: 0;
  z-index: 20; pointer-events: none;
}
.card-artwork {
  position: absolute; inset: 0; overflow: hidden;
}
.card-artwork img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top center; display: block;
}
.card-artwork::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(to bottom, transparent, rgba(2,2,2,0.65) 38%, rgba(2,2,2,0.96) 72%, #020202 100%);
}
.card-header-overlay {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.82), rgba(0,0,0,0.3) 70%, transparent);
}
.cn {
  font-family: var(--font-body);
  font-size: 0.48rem; font-weight: 700;
  letter-spacing: 0.45em; color: rgba(201,168,76,0.55);
  text-transform: uppercase;
}
.ce {
  font-family: var(--font-display);
  font-size: 0.88rem; font-weight: 900;
  color: #F4EFE4; letter-spacing: 0.08em; text-align: center;
  text-shadow: 0 0 25px rgba(201,168,76,0.3), 0 2px 8px rgba(0,0,0,1);
}
.card-footer-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
  padding: 0 16px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.cf-line {
  display: flex; align-items: center; gap: 6px; width: 68%; margin-bottom: 1px;
}
.cf-line::before, .cf-line::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.35));
}
.cf-line::after { background: linear-gradient(270deg, transparent, rgba(201,168,76,0.35)); }
.cf-diamond { width: 5px; height: 5px; background: rgba(201,168,76,0.5); transform: rotate(45deg); }
.cp {
  font-family: var(--font-title);
  font-size: 0.82rem; font-weight: 700;
  color: #EBE3D2; letter-spacing: 0.2em; text-align: center;
}
.cr {
  font-family: var(--font-body);
  font-size: 0.54rem; font-weight: 700;
  letter-spacing: 0.4em; text-align: center; color: #e05555;
}
.card-wm {
  position: absolute; bottom: 4px; right: 10px; z-index: 11;
  font-family: var(--font-display); font-size: 0.27rem;
  letter-spacing: 0.3em; color: rgba(201,168,76,0.12);
}
.card-back-inner {
  position: absolute; inset: 0;
  border-radius: 15px; overflow: hidden; background: #020202;
}
.card-back-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-tap-hint {
  font-size: 0.6rem; color: var(--text-muted);
  letter-spacing: 0.15em; text-align: center;
}

/* Result buttons */
.result-btns {
  display: flex; flex-direction: column; gap: 0.75rem; width: 100%;
  max-width: 300px;
}
.rbtn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  border: none; border-radius: 6px; cursor: pointer;
  min-height: 52px; touch-action: manipulation; -webkit-appearance: none;
  transition: all 0.2s;
}
.rbtn svg { width: 15px; height: 15px; flex-shrink: 0; pointer-events: none; }
.rbtn-share { background: #0c1220; color: #6fa3ff; border: 1px solid rgba(100,150,255,0.25); }
.rbtn-share:active { background: #111a30; }
.rbtn-save { background: #130f04; color: var(--gold); border: 1px solid rgba(201,168,76,0.25); }
.rbtn-save:active { background: #1c1508; }
.rbtn-again { background: var(--dark); color: var(--text-dim); border: 1px solid var(--text-muted); }
.rbtn-again:active { background: var(--dark2); }

/* ── RARITY TABLE ── */
.rarity-section {
  padding: 4rem 0;
  position: relative; z-index: 1;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rarity-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-body); font-size: 0.85rem;
  min-width: 280px;
}
.rarity-table th {
  font-family: var(--font-title);
  font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-dim); padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(201,168,76,0.15);
  text-align: left;
}
.rarity-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
}
.rarity-table tr:hover td { background: rgba(201,168,76,0.03); }

.badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  font-family: var(--font-title);
  font-size: 0.52rem; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
}
.badge.common    { background: rgba(150,150,150,0.12); color: #a0a0a0; border: 1px solid rgba(150,150,150,0.2); }
.badge.uncommon  { background: rgba(80,200,120,0.1); color: #64c87a; border: 1px solid rgba(80,200,120,0.25); }
.badge.rare      { background: rgba(80,140,255,0.1); color: #6496ff; border: 1px solid rgba(80,140,255,0.25); }
.badge.epic      { background: rgba(160,80,255,0.1); color: #b464ff; border: 1px solid rgba(160,80,255,0.25); }
.badge.legendary { background: rgba(255,180,40,0.1); color: #ffb428; border: 1px solid rgba(255,180,40,0.25); }
.badge.mythic    { background: rgba(255,80,80,0.1); color: #ff6464; border: 1px solid rgba(255,80,80,0.25); }
.badge.divine    { background: rgba(201,168,76,0.12); color: var(--gold-light); border: 1px solid rgba(201,168,76,0.35); box-shadow: 0 0 8px rgba(201,168,76,0.15); }

/* ── FOOTER ── */
footer {
  border-top: 1px solid rgba(201,168,76,0.08);
  padding: 3rem 1.5rem;
  position: relative; z-index: 1;
}
.footer-inner { text-align: center; }
.footer-logo {
  font-family: var(--font-display);
  font-size: 0.9rem; color: var(--gold-dim);
  letter-spacing: 0.15em; margin-bottom: 0.5rem;
}
.footer-logo span { color: var(--gold); }
.footer-tagline { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1.25rem; letter-spacing: 0.1em; }
.footer-nav { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.footer-nav a { font-family: var(--font-title); font-size: 0.58rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.footer-nav a:hover { color: var(--gold); }
.footer-copy { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.1em; }

/* ── MODALS ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.28s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: 14px; padding: 1.5rem;
  width: 320px; max-width: 92vw;
  display: flex; flex-direction: column; gap: 0.9rem;
  box-shadow: 0 30px 90px rgba(0,0,0,0.95);
  max-height: 90vh; overflow-y: auto;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 0.62rem; letter-spacing: 0.35em;
  color: var(--gold); text-align: center; text-transform: uppercase;
}
.modal-preview { border-radius: 8px; overflow: hidden; border: 1px solid rgba(201,168,76,0.12); }
.modal-preview img { width: 100%; display: block; }
.modal-msg {
  background: var(--dark2); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px; padding: 0.65rem 0.8rem;
  font-size: 0.66rem; color: var(--text-dim); line-height: 1.65;
}
.share-btns { display: flex; flex-direction: column; gap: 0.4rem; }
.sbtn {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.75rem 1rem; border-radius: 7px; cursor: pointer;
  font-family: var(--font-body); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  border: none; min-height: 52px; touch-action: manipulation; -webkit-appearance: none;
  transition: all 0.18s;
}
.sbtn svg { width: 17px; height: 17px; flex-shrink: 0; pointer-events: none; }
.sbtn-x { background: #141414; color: #ddd; border: 1px solid rgba(255,255,255,0.09); }
.sbtn-x:active { background: #1e1e1e; }
.sbtn-wa { background: #061408; color: #25d366; border: 1px solid rgba(37,211,102,0.18); }
.sbtn-wa:active { background: #091c0c; }
.sbtn-copy { background: #0e0a02; color: var(--gold); border: 1px solid rgba(201,168,76,0.18); }
.sbtn-copy:active { background: #161005; }
.modal-close {
  font-family: var(--font-body); font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(100,90,80,0.45); background: none; border: none;
  cursor: pointer; text-align: center; padding: 0.4rem;
  min-height: 44px; touch-action: manipulation;
}

/* Save viewer */
.img-viewer {
  position: fixed; inset: 0; background: #000; z-index: 99999;
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
}
.img-viewer.open { display: flex; }
.img-viewer img {
  max-width: 90%; max-height: 75vh;
  object-fit: contain; border-radius: 12px;
  -webkit-touch-callout: default;
}
.img-viewer-hint {
  color: rgba(201,168,76,0.7); font-family: var(--font-body);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.15em;
  text-align: center; text-transform: uppercase;
}
.img-viewer-close {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: #aaa; font-family: var(--font-body); font-size: 0.65rem;
  font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0.6rem 1.5rem; border-radius: 5px; cursor: pointer;
  touch-action: manipulation; min-height: 48px; -webkit-appearance: none;
}

/* ── UNIVERSE PAGE ── */
.universe-hero {
  padding: calc(var(--nav-h) + 3rem) 1.5rem 3rem;
  text-align: center;
}
.universe-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 3rem);
  color: var(--white); margin-bottom: 1rem;
}
.universe-hero h1 em { font-style: normal; color: var(--gold); }
.universe-intro {
  max-width: 560px; margin: 0 auto;
  font-size: 0.9rem; color: var(--text-dim); line-height: 1.8;
}
.universe-intro p + p { margin-top: 1rem; }

.entities-section { padding: 3rem 0; }
.entities-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.entity-card {
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.1);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s;
  cursor: pointer;
}
.entity-card:hover { border-color: rgba(201,168,76,0.3); transform: translateY(-2px); }
.entity-card-img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover; display: block;
}
.entity-card-info { padding: 0.75rem; }
.entity-card-name {
  font-family: var(--font-display);
  font-size: 0.55rem; font-weight: 700;
  color: var(--gold); letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 0.25rem;
}
.entity-card-essence {
  font-size: 0.7rem; color: var(--text-dim); line-height: 1.4;
}
.entity-card-signal {
  font-family: var(--font-title);
  font-size: 0.6rem; color: var(--text-muted);
  font-style: italic; margin-top: 0.35rem;
}

.states-section { padding: 3rem 0; }
.states-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.state-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.08);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.state-num {
  font-family: var(--font-title); font-size: 0.55rem;
  color: var(--text-muted); letter-spacing: 0.2em; min-width: 20px;
}
.state-info { flex: 1; }
.state-name-text {
  font-family: var(--font-title); font-size: 0.78rem; font-weight: 700;
  color: var(--white); letter-spacing: 0.1em; margin-bottom: 0.2rem;
}
.state-desc { font-size: 0.72rem; color: var(--text-dim); line-height: 1.5; }
.state-badge-wrap { flex-shrink: 0; }

/* ── LEADERBOARD PAGE ── */
.lb-hero {
  padding: calc(var(--nav-h) + 3rem) 1.5rem 2rem;
  text-align: center;
}
.lb-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 3rem);
  color: var(--white); margin-bottom: 0.75rem;
}
.lb-hero p { font-size: 0.9rem; color: var(--text-dim); }

.lb-section { padding: 2rem 0 5rem; }
.lb-loading {
  text-align: center; padding: 3rem;
  font-family: var(--font-title); font-size: 0.7rem;
  letter-spacing: 0.2em; color: var(--text-muted);
}

.podium {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem; margin-bottom: 2.5rem;
}
.podium-card {
  background: var(--dark);
  border: 1px solid rgba(201,168,76,0.1);
  border-radius: var(--radius); padding: 1rem 0.75rem;
  text-align: center; position: relative;
}
.podium-card.rank-1 { border-color: rgba(201,168,76,0.35); box-shadow: 0 0 20px rgba(201,168,76,0.08); }
.podium-card.rank-2 { border-color: rgba(200,200,200,0.2); }
.podium-card.rank-3 { border-color: rgba(180,120,60,0.2); }
.podium-rank {
  font-family: var(--font-display); font-size: 1rem; font-weight: 900;
  margin-bottom: 0.5rem;
}
.rank-1 .podium-rank { color: var(--gold); text-shadow: 0 0 20px var(--gold-glow); }
.rank-2 .podium-rank { color: #c0c0c0; }
.rank-3 .podium-rank { color: #cd7f32; }
.podium-img {
  width: 60px; height: 90px; object-fit: cover;
  border-radius: 6px; margin: 0 auto 0.5rem;
  display: block;
  border: 1px solid rgba(201,168,76,0.15);
}
.podium-pseudo {
  font-family: var(--font-title); font-size: 0.55rem; font-weight: 700;
  color: var(--white); letter-spacing: 0.1em; margin-bottom: 0.3rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.podium-info { font-size: 0.6rem; color: var(--text-dim); }

.lb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lb-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-body); font-size: 0.82rem;
  min-width: 400px;
}
.lb-table th {
  font-family: var(--font-title); font-size: 0.55rem;
  font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-dim); padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(201,168,76,0.12);
  text-align: left;
}
.lb-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text); vertical-align: middle;
}
.lb-table tr:hover td { background: rgba(201,168,76,0.02); }
.lb-rank-cell { color: var(--gold-dim); font-family: var(--font-title); font-size: 0.7rem; font-weight: 600; }
.lb-card-thumb { width: 30px; height: 45px; object-fit: cover; border-radius: 4px; display: block; border: 1px solid rgba(201,168,76,0.1); }
.lb-pseudo { font-family: var(--font-title); font-size: 0.72rem; font-weight: 700; color: var(--white); letter-spacing: 0.05em; }
.lb-wallet { font-size: 0.68rem; color: var(--text-muted); font-family: monospace; }
.lb-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: 0.8rem; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(1); }
  50%       { opacity: 0.8; transform: scaleY(1.2); }
}
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1); opacity: 1; }
}
@keyframes hammerStrike {
  0%   { transform: rotate(-30deg) translateY(0); }
  50%  { transform: rotate(10deg) translateY(8px); }
  100% { transform: rotate(-30deg) translateY(0); }
}
@keyframes textPulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}
@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 30px var(--gold-glow); }
  50%       { box-shadow: 0 0 60px var(--gold-glow), 0 0 100px rgba(201,168,76,0.08); }
}
@keyframes sparkFly {
  0%   { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}
@keyframes cardReveal {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.card-reveal-anim { animation: cardReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* ── RESPONSIVE DESKTOP ── */
@media (min-width: 600px) {
  .steps-grid { grid-template-columns: 1fr 1fr 1fr; }
  .entities-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .states-grid { grid-template-columns: 1fr 1fr; }
  .result-btns { flex-direction: row; max-width: none; }
  .rbtn { flex: 1; }
  #navbar { padding: 0 2rem; }
  .container { padding: 0 2rem; }
}

@media (min-width: 768px) {
  .entities-grid { grid-template-columns: repeat(5, 1fr); }
}

.hidden { display: none !important; }
