:root {
  --bg: #121212;
  --bg-2: #1e1e1e;
  --panel: #1a1a1a;
  --panel-strong: #242424;
  --line: #333333;
  --text: #ffffff;
  --muted: #a0a0a0;
  --yellow: #f1c40f;
  --yellow-2: #f39c12;
  --blue: #3498db;
  --pink: #e74c3c;
  --green: #2ecc71;
  --danger: #e74c3c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
a {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 70px;
}

.ambient {
  display: none;
}

.ambient-left {
  display: none;
}

.ambient-right {
  display: none;
}

.site-header,
.section-heading,
.dashboard-grid,
.auth-layout,
.hero-card,
.stats-grid {
  display: flex;
  gap: 24px;
}

.site-header,
.section-heading {
  justify-content: space-between;
  align-items: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 12px;
  color: #10131f;
  font-size: 1.05rem;
  font-weight: 800;
  background: var(--yellow);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--yellow);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

h2 {
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  line-height: 0.98;
}

h3 {
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
}

.hero-text,
.section-text,
.feature-card p,
.dashboard-note {
  color: var(--muted);
  line-height: 1.7;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.flash {
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
}

.flash-success {
  color: #e8fff6;
  border-color: rgba(77, 228, 170, 0.28);
  background: rgba(77, 228, 170, 0.12);
}

.flash-error {
  color: #ffe8ee;
  border-color: rgba(255, 125, 143, 0.3);
  background: rgba(255, 125, 143, 0.12);
}

.ghost-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
  cursor: pointer;
}

.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.pokemon-card:hover {
  transform: translateY(-2px);
}

.ghost-button {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.primary-button {
  color: #12141f;
  font-weight: 700;
  background: var(--yellow);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.secondary-button {
  color: var(--text);
  border-color: var(--blue);
  background: rgba(52, 152, 219, 0.1);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.hero-card,
.panel,
.auth-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card,
.panel {
  padding: 30px;
}

.hero-card-large {
  flex: 1.15;
  display: grid;
  gap: 28px;
}

.auth-layout {
  align-items: stretch;
  margin-top: 42px;
}

.auth-panel-wrap {
  flex: 0.9;
  display: grid;
  gap: 22px;
}

.feature-grid,
.stats-grid,
.breakdown-grid {
  display: grid;
  gap: 16px;
}

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.feature-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
}

.auth-panel {
  padding: 26px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-form label {
  display: grid;
  gap: 8px;
}

.auth-form span {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  outline: none;
  color: var(--text);
  background: rgba(3, 6, 16, 0.45);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.auth-form input:focus {
  border-color: rgba(85, 166, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(85, 166, 255, 0.12);
}

.dashboard {
  display: grid;
  gap: 24px;
  margin-top: 34px;
}

.dashboard-hero {
  align-items: stretch;
}

.hero-copy {
  flex: 1.1;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.stats-grid {
  flex: 0.95;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.mini-stat {
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.stat-card span,
.mini-stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong,
.mini-stat strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
}

.rare-highlight {
  background:
    radial-gradient(circle at top right, rgba(255, 95, 209, 0.22), transparent 36%),
    radial-gradient(circle at left, rgba(85, 166, 255, 0.14), transparent 30%),
    rgba(255, 255, 255, 0.05);
}

.dashboard-grid {
  align-items: start;
}

.opening-panel {
  flex: 1.2;
}

.sidebar-panel {
  flex: 0.72;
}

.section-heading-stack {
  justify-content: flex-start;
}

.tear-stage {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.pack-shell {
  position: relative;
  min-height: 410px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pack-shell::before {
  display: none;
}

.pack-shell[data-opened="true"] .pack-top {
  transform: translateY(-105%);
  opacity: 0;
}

.pack-shell[data-opened="true"] .pack-front {
  transform: translateY(12px) scale(0.98);
  opacity: 0.4;
  filter: blur(2px);
}

.pack-shell.is-ready {
  animation: pack-ready 800ms ease;
}

.pack-foil {
  display: none;
}

.pack-top,
.pack-front {
  position: relative;
  z-index: 1;
  transition: transform 480ms ease, opacity 480ms ease, filter 480ms ease;
}

.pack-top {
  padding: 4px 8px 26px;
}

.tear-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(5, 8, 18, 0.5);
  overflow: visible;
}

.tear-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 212, 77, 0.18), rgba(255, 95, 209, 0.48));
  transition: width 60ms linear;
}

.tear-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  transform: translate(-6px, -50%);
  background:
    radial-gradient(circle at 30% 30%, #fff8c8, var(--yellow) 55%, #d89f00 100%);
  box-shadow: 0 14px 28px rgba(255, 212, 77, 0.35);
  cursor: grab;
}

.tear-handle:active {
  cursor: grabbing;
}

.tear-label {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.pack-front {
  display: grid;
  place-items: center;
  min-height: 310px;
  text-align: center;
}

.pack-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #10131d;
  font-weight: 800;
  background: var(--yellow);
}

.pack-title {
  display: grid;
  gap: 8px;
}

.pack-title strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.pack-title span {
  color: rgba(255, 255, 255, 0.84);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.pack-mon {
  width: 210px;
  margin: 18px auto 0;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.4));
}

.opening-hint {
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.reveal-grid,
.collection-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(208px, 1fr));
  margin-top: 24px;
}

.card-slot {
  perspective: 1400px;
}

.pokemon-card {
  position: relative;
  width: 100%;
  min-height: 334px;
  padding: 0;
  border: 0;
  background: transparent;
  transform-style: preserve-3d;
  transition: transform 540ms ease;
  cursor: pointer;
}

.pokemon-card.revealed {
  transform: rotateY(180deg);
}

.pokemon-card.is-static,
.pokemon-card.is-static:hover {
  transform: none;
  cursor: default;
}

.pokemon-card.is-static .card-back {
  display: none;
}

.pokemon-card.is-static .card-front {
  position: relative;
  transform: none;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  overflow: hidden;
  backface-visibility: hidden;
}

.card-back {
  display: grid;
  place-items: center;
  gap: 10px;
  color: #fffbe4;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.back-glow {
  display: none;
}

.back-logo {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.card-back small {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.card-front {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  transform: rotateY(180deg);
  border: 1px solid var(--line);
  background: #2a2a2a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.pokemon-card[data-rarity="rare"] .card-front {
  background: #333333;
}

.pokemon-card[data-rarity="epic"] .card-front,
.pokemon-card[data-rarity="legendary"] .card-front {
  background: #444444;
}

.card-header,
.card-subtitle,
.type-row,
.attack-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-header {
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.pokemon-name {
  font-size: 1.08rem;
}

.hp-value,
.rarity-pill,
.type-pill,
.set-pill,
.damage-value {
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  background: var(--panel);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
}

.pokemon-title {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.card-art-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 164px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.pokemon-image {
  width: 90%;
  height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.26));
}

.type-row {
  font-size: 0.8rem;
}

.attack-box {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

.attack-name {
  font-size: 0.92rem;
}

.breakdown-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 22px;
}

.dashboard-note {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 26px;
  text-align: center;
  border-radius: 28px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

@keyframes foil-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pack-ready {
  0% {
    transform: scale(0.98) rotate(-1deg);
  }
  50% {
    transform: scale(1.02) rotate(1deg);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 1024px) {
  .dashboard-hero,
  .dashboard-grid,
  .auth-layout,
  .site-header,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 1240px);
    padding-top: 18px;
  }

  .hero-card,
  .panel,
  .auth-panel {
    padding: 22px;
    border-radius: 24px;
  }

  .feature-grid,
  .stats-grid,
  .breakdown-grid,
  .reveal-grid,
  .collection-grid {
    grid-template-columns: 1fr;
  }

  .pack-shell {
    min-height: 360px;
  }

  .pack-mon {
    width: 170px;
  }
}

/* ========================
   V2.0 UPGRADE BANNER
   ======================== */
.v2-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 87, 34, 0.1));
  border: 1px solid rgba(255, 193, 7, 0.4);
  border-radius: 14px;
  animation: bannerPulse 3s ease-in-out infinite;
}

@keyframes bannerPulse {
  0%, 100% { border-color: rgba(255, 193, 7, 0.4); }
  50% { border-color: rgba(255, 193, 7, 0.8); }
}

.v2-banner-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.v2-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  background: linear-gradient(135deg, #f1c40f, #f39c12);
  color: #000;
  font-weight: 900;
  font-size: 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.v2-banner strong {
  display: block;
  font-size: 1rem;
  color: #fff;
}

.v2-banner p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.v2-upgrade-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #f1c40f, #e67e22);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(241, 196, 15, 0.3);
}

.v2-upgrade-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(241, 196, 15, 0.5);
}

/* ========================
   MOBILE NAVIGATION
   ======================== */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
}

/* ========================
   MODAL RESPONSIVE
   ======================== */
.pack-modal-dialog {
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.push-pack {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.push-pack:hover {
  transform: scale(1.05);
  box-shadow: 0 20px 50px rgba(241, 196, 15, 0.4);
}

.push-pack:active {
  transform: scale(0.97);
}

/* ========================
   TABLET (max 1024px)
   ======================== */
@media (max-width: 1024px) {
  .dashboard-hero,
  .dashboard-grid,
  .auth-layout,
  .site-header,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .v2-upgrade-button {
    width: 100%;
    justify-content: center;
  }
}

/* ========================
   MOBILE (max 720px)
   ======================== */
@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 1240px);
    padding-top: 16px;
    padding-bottom: 50px;
  }

  .site-header {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .hero-card,
  .panel,
  .auth-panel {
    padding: 18px;
    border-radius: 16px;
  }

  .feature-grid,
  .stats-grid,
  .breakdown-grid,
  .reveal-grid,
  .collection-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pack-shell {
    min-height: 300px;
  }

  .pack-mon {
    width: 140px;
  }

  /* V2 Banner Mobile */
  .v2-banner {
    padding: 14px 16px;
    gap: 12px;
  }

  .v2-banner-left {
    gap: 12px;
  }

  .v2-banner strong {
    font-size: 0.9rem;
  }

  .v2-banner p {
    font-size: 0.78rem;
  }

  /* Modal Mobile */
  .pack-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .pack-modal-dialog {
    max-height: 95vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px;
  }

  .pack-modal-head {
    margin-bottom: 16px;
  }

  .pack-push-stage {
    min-height: 260px;
    padding: 24px 12px;
  }

  .push-pack {
    width: 180px;
  }

  .reveal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Auth Mobile */
  .auth-layout {
    gap: 16px;
  }

  .auth-panel {
    padding: 20px 16px;
  }

  /* Collection Mobile */
  .collection-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Buttons Mobile */
  .hero-actions {
    flex-direction: column;
    gap: 10px;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Section headings mobile */
  .section-heading {
    gap: 8px;
  }

  h2 {
    font-size: 1.4rem;
  }

  h3 {
    font-size: 1.1rem;
  }
}

/* ========================
   PACK MODAL STYLES
   ======================== */
.pack-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pack-modal[hidden] {
  display: none !important;
}

.pack-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.pack-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.pack-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.pack-push-stage {
  display: grid;
  place-items: center;
  padding: 40px 20px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--panel);
  margin-bottom: 24px;
  min-height: 350px;
  overflow: hidden;
}

.push-pack {
  position: relative;
  width: 220px;
  background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
  border: 2px solid rgba(241, 196, 15, 0.4);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  user-select: none;
  touch-action: none;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 20px rgba(241, 196, 15, 0.15);
}

.push-pack.is-thrown {
  transform: translateY(-200%) scale(0.8) rotate(20deg) !important;
  opacity: 0;
  transition: transform 0.4s ease-in, opacity 0.3s ease-in;
  pointer-events: none;
}

.push-pack-image {
  margin-top: 16px;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.5));
}

.push-pack-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}

body.modal-open {
  overflow: hidden;
}

/* ========================
   SELL CARD BUTTON
   ======================== */
.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sell-card-button {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.sell-card-button:hover {
  background: #2980b9;
  transform: translateY(-2px);
}

.sale-price {
  color: var(--yellow);
  font-weight: bold;
  font-size: 0.85rem;
}

/* meta viewport is in HTML head */
