@import url('https://fonts.googleapis.com/css2?family=Alfa+Slab+One&family=Courier+Prime:ital,wght@0,400;0,700;1,400&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #191512;
  --bg-dark-gradient: radial-gradient(circle at 50% 30%, #26201b 0%, #120f0d 100%);
  --bg-card: #eee8db;
  --bg-card-inset: #e2dbcb;
  
  --gold-primary: #d9ab38;
  --gold-hover: #c49729;
  --gold-glow: rgba(217, 171, 56, 0.25);
  
  --text-light: #f5f0eb;
  --text-dark: #191512;
  --text-muted: #9c9288;
  --text-dim: #70675f;
  
  --rarity-common: #008080;
  --rarity-common-bg: #e2f2f2;
  --rarity-rare: #c04838;
  --rarity-rare-bg: #fbebe8;
  --rarity-legendary: #d9ab38;
  --rarity-legendary-bg: #fdf7e7;
  
  --font-serif: 'Alfa Slab One', cursive, serif;
  --font-mono: 'Courier Prime', monospace;
  --font-sans: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-dark);
  background-image: var(--bg-dark-gradient);
  color: var(--text-light);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Navigation */
.header {
  border-bottom: 1px solid rgba(217, 171, 56, 0.2);
  background: rgba(25, 21, 18, 0.95);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--gold-primary);
  text-decoration: none;
  letter-spacing: 2px;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.02);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
  padding-bottom: 4px;
}

.nav-link:hover {
  color: var(--text-light);
}

.nav-link.active {
  color: var(--gold-primary);
  font-weight: 700;
  border-bottom: 2px solid var(--gold-primary);
}

/* Hamburger Toggle Button (Hidden on Desktop) */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--gold-primary);
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  width: 38px;
  height: 34px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.hamburger-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--gold-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open .hamburger-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Main Container Layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Hero Title Section */
.hero-header {
  text-align: center;
  margin-bottom: 2.5rem;
  max-width: 650px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 3rem;
  color: var(--gold-primary);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Landing Page Frame Box (Matching Image 5) */
.landing-frame-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 750px;
}

.landing-gold-box {
  border: 3px solid var(--gold-primary);
  outline: 2px dashed var(--gold-primary);
  outline-offset: -10px;
  padding: 2.5rem 4rem;
  background: rgba(36, 30, 26, 0.6);
  margin-bottom: 2rem;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6), inset 0 0 20px rgba(217, 171, 56, 0.1);
}

.landing-gold-title {
  font-family: var(--font-serif);
  font-size: 3.5rem;
  color: var(--gold-primary);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 4px 10px rgba(0,0,0,0.8);
}

.landing-subtext {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-bottom: 2.5rem;
}

.sublink {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-decoration: underline;
  text-decoration-style: dashed;
  margin-top: 1.5rem;
  transition: color 0.2s ease;
}

.sublink:hover {
  color: var(--gold-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  padding: 0.9rem 2.2rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-gold {
  background: var(--gold-primary);
  color: var(--text-dark);
  box-shadow: 0 4px 15px var(--gold-glow), 0 2px 4px rgba(0,0,0,0.4);
}

.btn-gold:hover {
  background: var(--gold-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 171, 56, 0.4);
}

.btn-gold:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-dark {
  background: #28221d;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-dark:hover {
  background: #362e28;
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

body.spin-page #spinBtn {
  flex-shrink: 0;
  margin-top: 0.25rem;
  padding: clamp(0.55rem, 1.4vh, 0.85rem) clamp(1.4rem, 3.5vw, 2.1rem);
  font-size: clamp(0.9rem, 2vh, 1.05rem);
}

/* Wheel Container (Spin Screen) */
/* Spin Page Viewport-Fit Layout (Zero Scroll) */
body.spin-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.spin-page .header {
  flex-shrink: 0;
}

body.spin-page .main-content {
  flex: 1;
  min-height: 0;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

body.spin-page .hero-header {
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

body.spin-page .page-title {
  font-size: clamp(1.5rem, 4vh, 2.6rem);
  margin-bottom: 0.2rem;
}

body.spin-page .page-subtitle {
  font-size: clamp(0.8rem, 1.8vh, 0.95rem);
  line-height: 1.35;
  max-width: 580px;
}

.wheel-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0 0.5rem;
  flex-shrink: 1;
  min-height: 0;
}

.wheel-pointer {
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 24px solid var(--gold-primary);
  position: absolute;
  top: -10px;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}

.wheel-container {
  width: min(380px, 44vh, 75vw);
  height: min(380px, 44vh, 75vw);
  border-radius: 50%;
  border: 7px solid #2d2621;
  box-shadow: 0 0 0 3px var(--gold-primary), 0 15px 35px rgba(0,0,0,0.7);
  overflow: hidden;
  position: relative;
  flex-shrink: 1;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
}

/* Result Ticket Card Component (Matching Image 3) */
.ticket-modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(12, 10, 8, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ticket-modal-container.active {
  opacity: 1;
  pointer-events: auto;
}

.ticket-card {
  background: var(--bg-card);
  color: var(--text-dark);
  width: 420px;
  max-width: 90vw;
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  position: relative;
  overflow: hidden;
  padding: 2rem;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ticket-modal-container.active .ticket-card {
  transform: translateY(0) scale(1);
}

/* Ticket Side Notch Cutouts */
.ticket-card::before,
.ticket-card::after {
  content: "";
  position: absolute;
  top: 65%;
  width: 24px;
  height: 24px;
  background: #120f0d;
  border-radius: 50%;
  z-index: 5;
}

.ticket-card::before {
  left: -12px;
}

.ticket-card::after {
  right: -12px;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.ticket-category-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  line-height: 1.1;
  color: var(--text-dark);
  margin-bottom: 1rem;
  position: relative;
}

/* Rarity Stamp Badge */
.stamp-badge {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  padding: 0.25rem 0.75rem;
  border: 2px solid currentColor;
  text-transform: uppercase;
  letter-spacing: 2px;
  transform: rotate(-6deg);
  border-radius: 2px;
  margin-bottom: 1.25rem;
}

.stamp-common {
  color: var(--rarity-common);
  border-color: var(--rarity-common);
}

.stamp-rare {
  color: var(--rarity-rare);
  border-color: var(--rarity-rare);
}

.stamp-legendary {
  color: var(--rarity-legendary);
  border-color: var(--rarity-legendary);
  background: #fff8e6;
}

.ticket-quote-box {
  background: var(--bg-card-inset);
  border: 1px dashed #c4bcab;
  padding: 1.25rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.5;
  color: #2b2520;
  margin-bottom: 1.5rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ticket-perforated-line {
  border-top: 2px dashed #c4bcab;
  margin: 1.25rem 0;
}

.ticket-footer-text {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.ticket-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.ticket-actions .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
}

/* Gallery Header & Controls */
.gallery-header-bar {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
  margin-bottom: 2.5rem;
}

.gallery-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gallery-title-group h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--gold-primary);
}

.sort-select-wrapper {
  position: relative;
}

.sort-select {
  background: #241e1a;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
}

/* Empty State Component (Matching Image 2) */
.empty-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  width: 100%;
}

.empty-icon-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #211c18;
  border: 2px dashed #473d35;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.empty-subtitle {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 2px;
  max-width: 500px;
  margin-bottom: 2.5rem;
  text-transform: uppercase;
}

/* Gallery Grid & Cards (Matching Image 4) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  width: 100%;
}

.gallery-card {
  background: var(--bg-card);
  color: var(--text-dark);
  border-radius: 6px;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.7);
}

/* Card Cutout Notches */
.gallery-card::before,
.gallery-card::after {
  content: "";
  position: absolute;
  top: 70%;
  width: 16px;
  height: 16px;
  background: #191512;
  border-radius: 50%;
}

.gallery-card::before {
  left: -8px;
}

.gallery-card::after {
  right: -8px;
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-number {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.card-badge {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  letter-spacing: 1px;
}

.card-badge.legendary {
  background: var(--rarity-legendary);
  color: var(--text-dark);
}

.card-badge.rare {
  background: var(--rarity-rare);
  color: #ffffff;
}

.card-badge.common {
  background: var(--rarity-common);
  color: #ffffff;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.card-body-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.5;
  color: #2b2520;
  margin-bottom: 1.5rem;
}

.card-perforation {
  border-top: 2px dashed #c4bcab;
  margin-bottom: 1rem;
}

.card-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-category-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.upvote-btn {
  background: #28221d;
  color: var(--text-light);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  position: relative;
}

.upvote-btn:hover {
  background: var(--gold-primary);
  color: var(--text-dark);
  transform: scale(1.1);
}


.upvote-btn .vote-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--gold-primary);
  color: var(--text-dark);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
}

/* Toast Container */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #241e1a;
  color: var(--gold-primary);
  border: 1px solid var(--gold-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  z-index: 300;
  box-shadow: 0 10px 25px rgba(0,0,0,0.8);
  transition: opacity 0.3s ease;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .page-title { font-size: 2.2rem; }
  .landing-gold-title { font-size: 2.2rem; }
  .landing-gold-box { padding: 1.5rem 1.5rem; }
  .wheel-container { width: 300px; height: 300px; }
  
  .header {
    position: relative;
  }
  
  .nav-container {
    padding: 0.85rem 1.25rem;
    position: relative;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(25, 21, 18, 0.98);
    border-bottom: 2px solid var(--gold-primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.85);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 0;
    display: none;
    z-index: 250;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    border-bottom: 1px solid rgba(217, 171, 56, 0.15);
    text-align: left;
    width: 100%;
    box-sizing: border-box;
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .nav-link.active {
    border-bottom: 1px solid rgba(217, 171, 56, 0.15);
    border-left: 4px solid var(--gold-primary);
    background: rgba(217, 171, 56, 0.08);
  }

  /* Gallery Header Filter Bar Mobile Stack */
  .gallery-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
  }

  .sort-select-wrapper {
    width: 100%;
  }

  .sort-select {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .page-title { font-size: 1.8rem; letter-spacing: 1px; }
  .landing-gold-title { font-size: 1.7rem; letter-spacing: 2px; }
  .landing-gold-box { padding: 1.25rem 1rem; max-width: 92vw; }
  .wheel-container { width: 280px; height: 280px; max-width: 85vw; max-height: 85vw; }
  .wheel-wrapper { margin: 1rem 0 1.5rem; }
  .brand-logo { font-size: 1.3rem; letter-spacing: 1px; }
  .ticket-card { width: 92vw; padding: 1.25rem 1rem; }
  .ticket-category-title { font-size: 1.6rem; }
  .empty-title { font-size: 2rem; }
  .empty-state-container { padding: 2.5rem 1rem; }
  .empty-icon-circle { width: 100px; height: 100px; font-size: 2rem; margin-bottom: 1.5rem; }
  
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    width: 100%;
  }

  .gallery-card {
    width: 100%;
    padding: 1.25rem 1.15rem;
    box-sizing: border-box;
    min-height: auto;
  }

  .upvote-btn {
    min-width: 44px;
    min-height: 44px;
  }
}

