/* ─── Inherit base styles ─── */
@import url('../style.css');

/* ─── Game Container ─── */
#game-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 140px 24px 40px; /* extra top for auth bar */
  text-align: center;
  min-height: 80vh;
}

/* ═══════════════════════════════════
   AUTH BAR — fixed below the nav
   ═══════════════════════════════════ */
#auth-bar {
  position: fixed; top: 64px; left: 0; right: 0;
  z-index: 90;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,215,0,0.1);
  padding: 8px 24px;
  display: flex; justify-content: center; align-items: center;
}
#auth-signed-out, #auth-signed-in {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; justify-content: center;
}
.auth-label {
  font-size: 13px; color: rgba(255,255,255,0.45);
  font-family: 'Inter', -apple-system, sans-serif;
}

/* Auth buttons */
.auth-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: 'Inter', -apple-system, sans-serif;
}
.auth-btn:hover { transform: translateY(-1px); }
.auth-btn:active { transform: scale(0.97); }

.auth-btn-google {
  background: #fff; color: #333;
}
.auth-btn-google:hover { box-shadow: 0 2px 12px rgba(255,255,255,0.2); }

.auth-btn-email {
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.12);
}
.auth-btn-email:hover { border-color: rgba(255,255,255,0.25); }

.auth-btn-signout {
  background: transparent; color: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px; padding: 4px 12px;
}
.auth-btn-signout:hover { color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* User info when signed in */
.auth-user-name {
  font-size: 14px; font-weight: 600; color: #fff;
  font-family: 'Inter', -apple-system, sans-serif;
}
.auth-sync-badge {
  font-size: 12px; color: #34D399;
  font-family: 'Courier New', monospace;
  padding: 3px 10px; border-radius: 6px;
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.15);
}

/* ═══════════════════════════════════
   EMAIL MODAL
   ═══════════════════════════════════ */
.auth-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.auth-modal-inner {
  background: #111; border: 1px solid rgba(255,215,0,0.15);
  border-radius: 16px; padding: 32px;
  width: 340px; max-width: 90vw; position: relative;
  text-align: center;
}
.auth-modal-inner h3 {
  font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 20px;
  font-family: 'Inter', -apple-system, sans-serif;
}
.auth-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 14px; border-radius: 10px;
  background: #0A0A0A; color: #fff; font-size: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 12px; outline: none;
  font-family: 'Inter', -apple-system, sans-serif;
  transition: border-color 0.2s;
}
.auth-input:focus { border-color: #FFD700; }
.auth-input::placeholder { color: rgba(255,255,255,0.25); }
.auth-error {
  color: #ef4444; font-size: 13px; min-height: 18px;
  margin-bottom: 8px; font-family: 'Inter', -apple-system, sans-serif;
}
.auth-modal-actions {
  display: flex; gap: 10px; justify-content: center;
  margin-top: 8px;
}
.auth-modal-actions .btn-primary {
  cursor: pointer; border: none; font-family: inherit; font-size: 14px;
}
.auth-modal-actions .btn-secondary-game {
  font-size: 13px; padding: 10px 18px;
}
.auth-modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 20px; cursor: pointer;
  transition: color 0.2s;
}
.auth-modal-close:hover { color: #fff; }
#game-container h1 {
  font-size: 36px; font-weight: 800; margin-bottom: 8px;
  font-family: 'Inter', -apple-system, sans-serif;
}
#game-container h2 {
  font-size: 28px; font-weight: 700; margin-bottom: 20px;
  font-family: 'Inter', -apple-system, sans-serif;
}
.game-subtitle {
  font-size: 15px; color: rgba(255,255,255,0.4); margin-bottom: 40px;
  font-family: 'Inter', -apple-system, sans-serif;
}

/* ═════════════════════════════════
   PACK — Wikipedia pack image
   ═════════════════════════════════ */
#pack-wrapper {
  display: flex; justify-content: center; margin-bottom: 24px;
}
#pack {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.3s;
  user-select: none;
}
#pack:hover { transform: translateY(-8px) scale(1.03); }
#pack:active { transform: scale(0.97); }
.pack-img {
  width: 200px; height: auto;
  border-radius: 8px;
  filter: drop-shadow(0 8px 32px rgba(255,215,0,0.15));
  pointer-events: none;
}
.pack-text {
  font-size: 11px; font-weight: 700; letter-spacing: 3px;
  color: #FFD700; font-family: 'Courier New', monospace;
  margin-top: 12px;
}
#pack-count { font-size: 13px; color: rgba(255,255,255,0.2); margin-top: 8px; }

/* Wiggle animation on click */
@keyframes packWiggle {
  0%   { transform: rotate(0deg) scale(1.02); }
  15%  { transform: rotate(-6deg) scale(1.06); }
  30%  { transform: rotate(6deg) scale(1.08); }
  45%  { transform: rotate(-8deg) scale(1.06); }
  60%  { transform: rotate(7deg) scale(1.04); }
  75%  { transform: rotate(-4deg) scale(1.02); }
  90%  { transform: rotate(3deg) scale(1.01); }
  100% { transform: rotate(0deg) scale(1.02); }
}
#pack.wiggling {
  animation: packWiggle 0.5s ease-in-out infinite;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   CARD CAROUSEL — Stacked reveal with arrows
   Cards fan out behind the active card
   ═══════════════════════════════════════════ */
#cards-view { position: relative; }

/* Navigation counter */
.carousel-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-bottom: 16px;
}
.carousel-nav .nav-arrow {
  width: 40px; height: 40px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.15);
  background: transparent; color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color .2s, background .2s;
  font-family: inherit;
}
.carousel-nav .nav-arrow:hover {
  border-color: #FFD700; background: rgba(255,215,0,0.08);
}
.carousel-counter {
  font-size: 16px; color: rgba(255,255,255,0.5);
  font-family: 'Courier New', monospace;
  min-width: 48px;
}

/* Card stack container */
.card-stack {
  position: relative;
  width: 300px; height: 520px;
  margin: 0 auto 24px;
}
/* Side peek zones */
.card-stack .side-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 60px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.3); font-size: 24px;
  cursor: pointer; z-index: 20;
  transition: background .2s, color .2s;
  font-family: inherit;
}
.card-stack .side-arrow:hover {
  background: rgba(255,255,255,0.06); color: #FFD700;
}
.card-stack .side-arrow.left { left: -60px; }
.card-stack .side-arrow.right { right: -60px; }

/* Individual card in the stack */
.card-stack .game-card {
  position: absolute;
  top: 50%; left: 50%;
  width: 270px;
  transform: translate(-50%, -50%);
  transition: transform 0.4s ease, opacity 0.4s ease, z-index 0s;
}
/* Behind cards (fanned out) */
.card-stack .game-card.behind-1 {
  transform: translate(-50%, -50%) translateX(20px) rotate(4deg) scale(0.95);
  opacity: 0.6; z-index: 3;
}
.card-stack .game-card.behind-2 {
  transform: translate(-50%, -50%) translateX(36px) rotate(7deg) scale(0.9);
  opacity: 0.35; z-index: 2;
}
.card-stack .game-card.behind-3 {
  transform: translate(-50%, -50%) translateX(48px) rotate(10deg) scale(0.85);
  opacity: 0.2; z-index: 1;
}
.card-stack .game-card.before-1 {
  transform: translate(-50%, -50%) translateX(-20px) rotate(-4deg) scale(0.95);
  opacity: 0.6; z-index: 3;
}
.card-stack .game-card.before-2 {
  transform: translate(-50%, -50%) translateX(-36px) rotate(-7deg) scale(0.9);
  opacity: 0.35; z-index: 2;
}
.card-stack .game-card.hidden-card {
  transform: translate(-50%, -50%) translateX(60px) rotate(12deg) scale(0.8);
  opacity: 0; z-index: 0; pointer-events: none;
}
/* Active card */
.card-stack .game-card.active-card {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; z-index: 10;
}

/* ═══════════════════════════════════
   CARD DESIGN — Matches wikigacha app
   ═══════════════════════════════════ */
.game-card {
  background: #111;
  border-radius: 14px;
  text-align: left;
  border: 3px solid rgba(255,255,255,0.08);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

/* Rarity borders with glow */
.game-card.rarity-lr {
  border-color: #FF6B6B;
  box-shadow: 0 0 20px rgba(255,107,107,0.35), inset 0 0 12px rgba(255,107,107,0.08);
}
.game-card.rarity-ur {
  border-color: #FFD700;
  box-shadow: 0 0 20px rgba(255,215,0,0.3), inset 0 0 12px rgba(255,215,0,0.08);
}
.game-card.rarity-ssr {
  border-color: #C084FC;
  box-shadow: 0 0 16px rgba(192,132,252,0.25), inset 0 0 10px rgba(192,132,252,0.06);
}
.game-card.rarity-sr {
  border-color: #60A5FA;
  box-shadow: 0 0 14px rgba(96,165,250,0.2), inset 0 0 8px rgba(96,165,250,0.05);
}
.game-card.rarity-r {
  border-color: #34D399;
  box-shadow: 0 0 12px rgba(52,211,153,0.2), inset 0 0 8px rgba(52,211,153,0.05);
}
.game-card.rarity-uc {
  border-color: rgba(156,163,175,0.4);
  box-shadow: 0 0 8px rgba(156,163,175,0.1);
}
.game-card.rarity-c {
  border-color: rgba(107,114,128,0.3);
}

/* Card header */
.card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px 10px;
  background: rgba(255,255,255,0.03);
}
.card-rarity-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 24px; border-radius: 5px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.5px;
  flex-shrink: 0;
}
.game-card-title {
  font-size: 14px; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; flex: 1;
}

/* Card image */
.card-thumb {
  width: 100%; height: 180px;
  object-fit: cover; display: block;
  background: #0A0A0A;
}
.card-thumb-placeholder {
  width: 100%; height: 180px;
  background: #0A0A0A;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: rgba(255,255,255,0.15);
}

/* Card description */
.game-card-desc {
  font-size: 12px; color: rgba(255,255,255,0.55);
  line-height: 1.55; padding: 10px 14px 12px;
  display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden; flex: 1; min-height: 70px;
}

/* Stats — ATK red / DEF blue */
.game-card-stats {
  display: flex;
  background: rgba(0,0,0,0.5);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.stat-atk, .stat-def {
  flex: 1; padding: 10px 8px 12px; text-align: center;
}
.stat-atk { border-right: 1px solid rgba(255,255,255,0.06); }
.stat-label {
  font-size: 11px; font-weight: 800; letter-spacing: 3px;
  font-family: 'Courier New', monospace;
  display: block; margin-bottom: 2px;
}
.stat-atk .stat-label { color: #ef4444; }
.stat-def .stat-label { color: #3b82f6; }
.stat-value {
  font-size: 26px; font-weight: 900;
  font-family: 'Courier New', monospace;
  color: #fff; letter-spacing: -0.5px;
}

/* Q-Score */
.game-card-qscore {
  font-size: 10px; color: rgba(255,255,255,0.15);
  text-align: center; padding: 4px 0 8px;
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.5);
}

/* ─── Buttons ─── */
.game-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 16px;
}
.btn-secondary-game {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: #FFD700;
  padding: 12px 24px; border-radius: 12px;
  font-weight: 700; font-size: 14px;
  border: 2px solid rgba(255,215,0,0.25);
  cursor: pointer; font-family: inherit;
  transition: transform .2s, border-color .2s;
}
.btn-secondary-game:hover {
  transform: translateY(-2px); border-color: #FFD700;
}
#game-container .btn-primary {
  cursor: pointer; border: none; font-family: inherit;
}

/* ─── Collection Grid ─── */
#collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
#collection-grid .game-card {
  width: 100%;
  position: static;
  opacity: 1;
  transform: none;
}

/* ─── Collection Stats ─── */
#collection-stats {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 24px;
}
.stat-pill {
  padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
  background: #0A0A0A; color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,215,0,0.08);
  font-family: 'Courier New', monospace;
}

/* ─── Loading ─── */
#loading p { color: rgba(255,255,255,0.4); font-size: 14px; margin-top: 16px; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto;
  border: 3px solid rgba(255,255,255,0.06);
  border-top-color: #FFD700; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── CTA Banner ─── */
#cta-banner {
  margin-top: 40px; padding: 16px 24px;
  background: #0A0A0A;
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: 12px; text-align: center;
}
#cta-banner p { color: rgba(255,255,255,0.5); font-size: 14px; margin: 0; }
#cta-banner a { color: #FFD700; font-weight: 700; }
#cta-banner a:hover { text-decoration: underline; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .card-stack { width: 260px; height: 470px; }
  .card-stack .game-card { width: 240px; }
  .card-thumb, .card-thumb-placeholder { height: 140px; }
  .stat-value { font-size: 22px; }
  .pack-img { width: 160px; }
  #game-container h1 { font-size: 28px; }
  .card-stack .side-arrow.left { left: -48px; }
  .card-stack .side-arrow.right { right: -48px; }
  #collection-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Auth bar mobile */
  #auth-bar { padding: 6px 12px; }
  .auth-label { font-size: 11px; }
  .auth-btn { font-size: 12px; padding: 5px 12px; }
  .auth-user-name { font-size: 13px; }
  .auth-modal-inner { padding: 24px 20px; }
}
