@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #030712;
  --bg-secondary: #070a14;
  --bg-card: rgba(11, 14, 20, 0.85);
  --bg-card-hover: rgba(18, 24, 38, 0.95);
  
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-cyan: #38bdf8;
  --accent-pink: #ec4899;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;

  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #a855f7 100%);
  --gradient-glow: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(168, 85, 247, 0.35) 100%);
  --gradient-purple: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(168, 85, 247, 0.18);
  --border-glow: rgba(168, 85, 247, 0.4);
  
  --radius-pill: 9999px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-main: 0 20px 40px -15px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 30px rgba(168, 85, 247, 0.35);
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 20% 15%, rgba(59, 130, 246, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(168, 85, 247, 0.12) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* Container */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header.app-header {
  padding: 40px 0 24px;
  text-align: center;
  position: relative;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.brand-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

header h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffffff 40%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

header p.subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 24px;
}

/* Main Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 32px;
  margin-top: 24px;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Glass Card */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-main);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(168, 85, 247, 0.3);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: #fff;
}

.panel-title icon {
  font-size: 1.4rem;
}

/* Game Selector Tabs */
.game-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: rgba(7, 10, 20, 0.8);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.game-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.game-tab-btn:hover {
  color: #fff;
  background: rgba(168, 85, 247, 0.1);
}

.game-tab-btn.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.45);
}

/* Input Form Controls */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-label span.hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

textarea.deck-input {
  width: 100%;
  height: 240px;
  background: rgba(5, 7, 12, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

textarea.deck-input:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

/* Preset Buttons */
.presets-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.preset-chip {
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: rgba(168, 85, 247, 0.2);
  color: #fff;
  border-color: rgba(168, 85, 247, 0.45);
}

/* Settings Form Elements */
.select-input, .number-input, .text-input {
  width: 100%;
  background: rgba(5, 7, 12, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.select-input:focus, .number-input:focus, .text-input:focus {
  outline: none;
  border-color: var(--accent-purple);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
  user-select: none;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

.checkbox-group span {
  font-size: 0.9rem;
  color: var(--text-primary);
}

/* Security / Anti-Counterfeit Notice Box */
.notice-box {
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
}

.notice-box header {
  padding: 0;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c084fc;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.notice-box p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Primary Action CTA Button */
.cta-button {
  width: 100%;
  padding: 18px 24px;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, box-shadow 0.25s ease;
  margin-top: 24px;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.55);
}

.cta-button:active {
  transform: translateY(0);
}

.cta-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Console Log & Status Box */
.log-panel {
  margin-top: 24px;
  background: rgba(5, 7, 10, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #94a3b8;
  height: 150px;
  overflow-y: auto;
}

.log-entry {
  margin-bottom: 4px;
}

.log-entry.info { color: var(--accent-blue); }
.log-entry.success { color: var(--accent-green); }
.log-entry.warn { color: var(--accent-gold); }

/* Footer */
footer.app-footer {
  margin-top: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Interactive Review Checklist Panel */
.review-panel {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 24px;
}
.card-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  transition: background 0.2s, border-color 0.2s;
}
.card-item-row:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(59, 130, 246, 0.4);
}
.card-item-row.disabled {
  opacity: 0.45;
  background: rgba(0, 0, 0, 0.2);
}
.card-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.card-info {
  flex: 1;
  min-width: 0;
}
.card-title {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.card-meta span {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}
.card-qty-input {
  width: 50px;
  padding: 4px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
}

/* Progress Stepper Bar */
.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 650px;
  margin: 0 auto 36px auto;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.step-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.step-tab:not(.disabled):hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.step-tab.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.45);
}
.step-tab.completed {
  color: #34d399;
}
.step-tab.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
}
.step-tab.active .step-num {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  transform: scale(1.05);
}
.step-tab.completed .step-num {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.step-connector {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.5) 0%, rgba(255, 255, 255, 0.1) 100%);
  max-width: 80px;
}

/* Sliding Tiles Viewport */
.tiles-viewport {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}
.tiles-slider {
  display: flex;
  width: 200%;
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
.tile-page {
  width: 50%;
  flex-shrink: 0;
  padding: 0 6px;
  box-sizing: border-box;
}

/* Card Versions Modal & Clickable Thumbs */
.card-thumb.clickable {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-thumb.clickable:hover {
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.8);
}
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}
.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
}
.modal-header h3 {
  margin: 0;
  color: #fff;
  font-size: 1.2rem;
}
.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.2s;
}
.close-modal-btn:hover { color: #fff; }
.modal-loading {
  padding: 40px;
  text-align: center;
  color: var(--accent-cyan);
  font-weight: 600;
}
.versions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 70px);
}
.version-card-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.version-card-item:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--accent-blue);
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}
.version-img {
  width: 110px;
  height: 154px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.version-meta {
  font-size: 0.75rem;
  color: #d1d5db;
  line-height: 1.3;
  width: 100%;
}
.version-set {
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.version-price {
  color: #34d399;
  font-weight: 600;
  margin-top: 2px;
}

/* --- Global Loading Overlay & Animations --- */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.loading-modal-box {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.88) 100%);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  width: 90%;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(59, 130, 246, 0.15);
  position: relative;
  overflow: hidden;
}

.loading-modal-box::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #06b6d4, #3b82f6);
  background-size: 200% 100%;
  animation: shimmerBorder 3s linear infinite;
}

@keyframes shimmerBorder {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.loader-spinner-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dual-ring-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: #3b82f6;
  border-bottom-color: #a855f7;
  animation: spinDualRing 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.dual-ring-spinner::after {
  content: "";
  position: absolute;
  top: 6px; left: 6px; right: 6px; bottom: 6px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-left-color: #06b6d4;
  border-right-color: #34d399;
  animation: spinDualRingReverse 0.8s linear infinite;
}

@keyframes spinDualRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinDualRingReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

.loader-icon {
  font-size: 28px;
  z-index: 2;
  animation: pulseIcon 1.5s ease-in-out infinite alternate;
}

@keyframes pulseIcon {
  0% { transform: scale(0.9); opacity: 0.8; filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6)); }
  100% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.9)); }
}

.loading-title {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  letter-spacing: 0.5px;
}

.loading-subtitle {
  color: #94a3b8;
  font-size: 0.95rem;
  margin: 0 0 28px 0;
  line-height: 1.5;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #06b6d4);
  background-size: 200% 100%;
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: shimmerBar 2s linear infinite;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
}

@keyframes shimmerBar {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.loading-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #cbd5e1;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.loading-step-text {
  font-weight: 500;
  color: var(--accent-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
  text-align: left;
}

.loading-timer {
  font-family: monospace;
  font-size: 0.9rem;
  color: #f87171;
  font-weight: 600;
  background: rgba(248, 113, 113, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Inline Spinner for Buttons */
.spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spinInline 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: -3px;
}

@keyframes spinInline {
  to { transform: rotate(360deg); }
}

.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
}

/* --- Buy Unproxied Cards Modal & Store Styles --- */
.buy-btn {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.buy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45) !important;
  filter: brightness(1.1);
}
.buy-single-link:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fff !important;
  transform: translateY(-1px);
}
.store-card.active-store:hover {
  border-color: #f59e0b !important;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.2);
}

