/* 
 * TCG-Dice Design System & Premium Styles
 * Implements a dark fantasy theme with glassmorphism, responsive grid layouts, 
 * glowing rarities, 3D card flips, and 3D rolling dice.
 */

/* --- CORE DESIGN SYSTEM TOKENS --- */
:root {
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* App Background Palette */
  --bg-gradient: radial-gradient(circle at center, #110e24 0%, #08060f 100%);
  --panel-bg: rgba(22, 18, 41, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

  /* Element Colors (Mana colors) */
  --color-green: #10b981;
  --color-green-glow: rgba(16, 185, 129, 0.35);
  --color-blue: #3b82f6;
  --color-blue-glow: rgba(59, 130, 246, 0.35);
  --color-black: #9333ea;
  --color-black-glow: rgba(147, 51, 234, 0.35);
  --color-white: #e2e8f0;
  --color-white-glow: rgba(226, 232, 240, 0.25);
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.35);
  --color-colorless: #6b7280;
  --color-colorless-glow: rgba(107, 114, 128, 0.2);

  /* Rarities */
  --rarity-common: #9ca3af;
  --rarity-uncommon: #10b981;
  --rarity-rare: #3b82f6;
  --rarity-epic: #a855f7;
  --rarity-legendary: #fbbf24;

  --rarity-common-glow: 0 0 10px rgba(156, 163, 175, 0.3);
  --rarity-uncommon-glow: 0 0 12px rgba(16, 185, 129, 0.4);
  --rarity-rare-glow: 0 0 15px rgba(59, 130, 246, 0.5);
  --rarity-epic-glow: 0 0 18px rgba(168, 85, 247, 0.6);
  --rarity-legendary-glow: 0 0 25px rgba(251, 191, 36, 0.8);

  /* Combat Colors */
  --color-hp: #10b981;
  --color-dmg: #ef4444;
  --color-gold: #fbbf24;
}

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

body {
  font-family: var(--font-body);
  background: #08060f;
  background-image: var(--bg-gradient);
  color: #f1f5f9;
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: 0.02em;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* --- ANIMATED SPACE BACKGROUND --- */
.stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.stars,
.stars2,
.stars3 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
}

.stars {
  background-image:
    radial-gradient(1px 1px at 25px 35px, #fff, transparent),
    radial-gradient(1px 1px at 50px 120px, #fff, transparent),
    radial-gradient(2px 2px at 125px 230px, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1px 1px at 200px 80px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 310px 420px, #fff, transparent),
    radial-gradient(1px 1px at 450px 210px, rgba(255, 255, 255, 0.4), transparent);
  background-size: 550px 550px;
  animation: animStars 120s linear infinite;
}

.stars2 {
  background-image:
    radial-gradient(1.5px 1.5px at 75px 250px, #fff, transparent),
    radial-gradient(2px 2px at 180px 40px, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(1px 1px at 290px 380px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 410px 190px, #fff, transparent),
    radial-gradient(2px 2px at 520px 480px, rgba(255, 255, 255, 0.8), transparent);
  background-size: 700px 700px;
  animation: animStars 180s linear infinite;
  opacity: 0.6;
}

.stars3 {
  background-image:
    radial-gradient(2px 2px at 150px 150px, #a855f7, transparent),
    radial-gradient(2px 2px at 350px 350px, #3b82f6, transparent),
    radial-gradient(3px 3px at 550px 50px, #ef4444, transparent);
  background-size: 900px 900px;
  animation: animStars 240s linear infinite;
  opacity: 0.3;
}

@keyframes animStars {
  from {
    transform: translateY(0px);
  }

  to {
    transform: translateY(-900px);
  }
}

/* --- APP LAYOUT --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Navbar */
#global-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 30px;
  background: rgba(13, 9, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #fbbf24, #ef4444, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
}

.logo-icon {
  font-size: 1.8rem;
  animation: spinSlow 15s linear infinite;
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.5));
}

@keyframes spinSlow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.header-nav {
  display: flex;
  gap: 10px;
}

.nav-link {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: #fff;
  background: rgba(124, 58, 237, 0.3);
  box-shadow: inset 0 0 10px rgba(139, 92, 246, 0.2), 0 0 10px rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.header-profile {
  display: flex;
  align-items: center;
}

.credits-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--color-gold);
  font-weight: 600;
  font-family: var(--font-title);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
}

.gold-coin {
  animation: pulseGold 2s infinite alternate;
}

@keyframes pulseGold {
  from {
    transform: scale(1);
    filter: drop-shadow(0 0 2px var(--color-gold));
  }

  to {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px var(--color-gold));
  }
}

#screens-container {
  flex: 1;
  display: flex;
  position: relative;
}

.screen {
  flex: 1;
  width: 100%;
  padding: 30px;
  animation: fadeIn 0.4s ease-out forwards;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- MAIN MENU DESIGN --- */
#main-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 68px);
  padding: 20px;
}

.menu-hero {
  max-width: 600px;
  width: 100%;
  text-align: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  padding: 40px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.title-glow-wrap {
  margin-bottom: 25px;
}

.game-title {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #f59e0b 20%, #ef4444 50%, #8b5cf6 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.35));
}

.game-subtitle {
  font-size: 1.1rem;
  color: #94a3b8;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-top: 5px;
  font-weight: 500;
}

.quick-status {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.credits-badge {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  padding: 6px 16px;
  border-radius: 12px;
  color: var(--color-gold);
  font-weight: 500;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  position: relative;
  overflow: hidden;
}

.menu-btn i {
  font-size: 2rem;
  width: 40px;
  text-align: center;
  transition: transform 0.3s ease;
}

.menu-btn .btn-text {
  display: flex;
  flex-direction: column;
}

.menu-btn .btn-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 600;
}

.menu-btn .btn-desc {
  font-size: 0.85rem;
  color: #64748b;
}

.menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.menu-btn:hover i {
  transform: scale(1.15) rotate(5deg);
}

.menu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Glowing effects for buttons */
.primary-glow {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(239, 68, 68, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.primary-glow:hover {
  border-color: rgba(139, 92, 246, 0.8);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(239, 68, 68, 0.2));
}

.secondary-glow:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.disabled-mode {
  opacity: 0.5;
  cursor: not-allowed;
}

.disabled-mode:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.03);
}

.disabled-mode i {
  color: #64748b;
}

.reset-btn {
  margin-top: 15px;
  background: transparent;
  border: none;
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px;
}

.reset-btn:hover {
  color: var(--color-dmg);
  transform: none;
}

/* --- HEADER AND SECTION GENERAL --- */
.view-header {
  margin-bottom: 25px;
}

.view-header h2 {
  font-size: 2rem;
  color: #fff;
  margin-bottom: 4px;
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.view-header p {
  color: #64748b;
  font-size: 0.95rem;
}

/* --- CARD LIBRARY STYLES --- */
.filter-bar {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  padding: 16px 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.item-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 12px;
}

.filter-tab {
  padding: 8px 20px;
  font-weight: 500;
  border-radius: 8px;
  color: #94a3b8;
}

.filter-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.filter-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}

.filter-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.filter-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-select-wrap label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
}

.filter-select-wrap select {
  background: rgba(13, 9, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  color: #cbd5e1;
  font-family: var(--font-body);
  outline: none;
}

.search-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-input-wrap label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 12px;
  color: #64748b;
}

.search-box input {
  width: 100%;
  background: rgba(13, 9, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 10px 10px 35px;
  color: #fff;
  font-family: var(--font-body);
  outline: none;
}

.search-box input:focus {
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

.library-stats {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 15px;
  padding-left: 5px;
}

/* Grid layout for cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding-top: 12px;
  overflow: visible;
}

/* --- THE TCG CARD COMPONENT DESIGN (CORE AESTHETIC) --- */
.tcg-card {
  aspect-ratio: 5 / 7;
  width: 100%;
  border-radius: 16px;
  background: #141124;
  border: 2px solid #231f3d;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  cursor: grab;
}

.tcg-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.25);
  z-index: 10;
}

/* Card wrapper to sync card and badge movement on hover */
.card-wrapper {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-wrapper:hover {
  transform: translateY(-8px) scale(1.03);
  z-index: 50;
}

/* Inside wrapper, prevent card from applying double transform/z-index */
.card-wrapper .tcg-card:hover {
  transform: none !important;
  z-index: auto !important;
}

/* Forward hover effects to the card inside the wrapper */
.card-wrapper:hover .tcg-card {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Count badge for deckbuilder catalog cards */
.card-count-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: #334155;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-title);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  z-index: 20;
  pointer-events: none;
}

.card-count-badge.maxed {
  background: var(--color-green);
  color: #fff;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Colors by Element type */
.tcg-card.card-red {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 4px 15px var(--color-red-glow);
}

.tcg-card.card-green {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 15px var(--color-green-glow);
}

.tcg-card.card-blue {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 15px var(--color-blue-glow);
}

.tcg-card.card-white {
  border-color: rgba(226, 232, 240, 0.4);
  box-shadow: 0 4px 15px var(--color-white-glow);
}

.tcg-card.card-black {
  border-color: rgba(147, 51, 234, 0.4);
  box-shadow: 0 4px 15px var(--color-black-glow);
}

.tcg-card.card-colorless {
  border-color: rgba(107, 114, 128, 0.4);
  box-shadow: 0 4px 15px var(--color-colorless-glow);
}

/* Glow overlay by rarity */
.tcg-card.rarity-common::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 10px rgba(156, 163, 175, 0.05);
}

.tcg-card.rarity-uncommon::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.08);
}

.tcg-card.rarity-rare::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 16px rgba(59, 130, 246, 0.12);
}

.tcg-card.rarity-epic::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.18);
}

.tcg-card.rarity-legendary::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  box-shadow: inset 0 0 25px rgba(251, 191, 36, 0.25);
}

/* Card Components */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.card-cost {
  display: flex;
  gap: 2px;
}

.cost-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
}

.cost-dot.red {
  background: var(--color-red);
}

.cost-dot.green {
  background: var(--color-green);
}

.cost-dot.blue {
  background: var(--color-blue);
}

.cost-dot.white {
  background: #94a3b8;
  color: #1e1b4b;
}

.cost-dot.black {
  background: #4c1d95;
}

.cost-dot.generic {
  background: #475569;
}

.card-art-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.art-placeholder-icon {
  font-size: 2.2rem;
  opacity: 0.25;
  transition: opacity 0.3s;
}

.card-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
}

.card-art-img.portrait-art {
  object-position: center top;
}

.tcg-card:hover .art-placeholder-icon {
  opacity: 0.45;
}

.card-type-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(13, 9, 28, 0.8);
  color: #94a3b8;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-text-box {
  height: 75px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.3;
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 24px;
}

.card-rarity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.card-rarity-dot.common {
  background: var(--rarity-common);
  box-shadow: var(--rarity-common-glow);
}

.card-rarity-dot.uncommon {
  background: var(--rarity-uncommon);
  box-shadow: var(--rarity-uncommon-glow);
}

.card-rarity-dot.rare {
  background: var(--rarity-rare);
  box-shadow: var(--rarity-rare-glow);
}

.card-rarity-dot.epic {
  background: var(--rarity-epic);
  box-shadow: var(--rarity-epic-glow);
}

.card-rarity-dot.legendary {
  background: var(--rarity-legendary);
  box-shadow: var(--rarity-legendary-glow);
}

.card-stat-hp {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-green);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 1px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-dice-slot {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-dice-slot.equipped {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c084fc;
}

/* Card Ownership counts */
.card-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--rarity-epic);
  border: 2px solid #141124;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

/* --- THE 3D CSS SPINNING DICE COMPONENT --- */
.dice-3d-container {
  width: 40px;
  height: 40px;
  perspective: 200px;
  display: inline-block;
}

.dice-3d {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.3s ease-out;
}

.dice-face {
  position: absolute;
  width: 40px;
  height: 40px;
  background: #1e1b4b;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1), 0 0 5px rgba(0, 0, 0, 0.5);
  backface-visibility: hidden;
}

/* Dice Colors */
.dice-3d.dice-red .dice-face {
  background: #b91c1c;
  border-color: #f87171;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2), 0 0 10px var(--color-red-glow);
}

.dice-3d.dice-green .dice-face {
  background: #065f46;
  border-color: #34d399;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2), 0 0 10px var(--color-green-glow);
}

.dice-3d.dice-blue .dice-face {
  background: #1e3a8a;
  border-color: #60a5fa;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2), 0 0 10px var(--color-blue-glow);
}

.dice-3d.dice-white .dice-face {
  background: #e2e8f0;
  color: #1e1b4b;
  border-color: #94a3b8;
}

.dice-3d.dice-black .dice-face {
  background: #3b0764;
  border-color: #c084fc;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2), 0 0 10px var(--color-black-glow);
}

.dice-3d.dice-gold .dice-face {
  background: #d97706;
  border-color: #fbbf24;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3), 0 0 12px rgba(251, 191, 36, 0.4);
}

/* Face rotations to form a 3D Cube */
.dice-face[data-face="1"] {
  transform: rotateY(0deg) translateZ(20px);
}

.dice-face[data-face="2"] {
  transform: rotateY(90deg) translateZ(20px);
}

.dice-face[data-face="3"] {
  transform: rotateY(180deg) translateZ(20px);
}

.dice-face[data-face="4"] {
  transform: rotateY(-90deg) translateZ(20px);
}

.dice-face[data-face="5"] {
  transform: rotateX(90deg) translateZ(20px);
}

.dice-face[data-face="6"] {
  transform: rotateX(-90deg) translateZ(20px);
}

/* Active rolling keyframe animation */
.dice-3d.rolling {
  animation: rollAnimation 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) infinite;
}

@keyframes rollAnimation {
  0% {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  }

  50% {
    transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg);
  }

  100% {
    transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg);
  }
}

/* Static transforms for winning outcomes */
.dice-show-1 {
  transform: rotateX(0deg) rotateY(0deg);
}

.dice-show-2 {
  transform: rotateX(0deg) rotateY(-90deg);
}

.dice-show-3 {
  transform: rotateX(0deg) rotateY(-180deg);
}

.dice-show-4 {
  transform: rotateX(0deg) rotateY(90deg);
}

.dice-show-5 {
  transform: rotateX(-90deg) rotateY(0deg);
}

.dice-show-6 {
  transform: rotateX(90deg) rotateY(0deg);
}

/* --- DECKBUILDER SCREEN --- */
.db-dashboard {
  animation: fadeIn 0.4s ease-out;
  padding: 10px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 15px;
}

.dashboard-header h3 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
}

/* Decks grid on dashboard */
.decks-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 10px;
}

/* Visual Deck Card Box */
.deck-card-box {
  background: rgba(20, 16, 38, 0.55);
  border: 1.5px solid rgba(139, 92, 246, 0.12);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 190px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.deck-card-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(to right, var(--color-blue), var(--color-purple));
  opacity: 0.8;
}

.deck-card-box.starter-deck::before {
  background: linear-gradient(to right, #059669, #10b981);
}

.deck-card-box:hover {
  transform: translateY(-6px);
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.18), 0 4px 15px rgba(0, 0, 0, 0.5);
}

.deck-card-main {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex: 1;
}

.deck-card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rarity-epic);
  font-size: 1.4rem;
}

.starter-deck .deck-card-icon-wrap {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.deck-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-card-name {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

.deck-card-count {
  font-size: 0.8rem;
  color: #94a3b8;
}

.deck-card-colors {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.deck-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.deck-color-dot.red { background: var(--color-red); }
.deck-color-dot.green { background: var(--color-green); }
.deck-color-dot.blue { background: var(--color-blue); }
.deck-color-dot.white { background: #cbd5e1; }
.deck-color-dot.black { background: var(--color-black); }

.deck-card-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.62rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.deck-card-actions {
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 12px;
  margin-top: 8px;
}

.deck-card-btn {
  flex: 1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

.deck-card-btn.edit-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.deck-card-btn.edit-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.deck-card-btn.delete-btn {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.deck-card-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.deck-card-btn.active-play-btn {
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  cursor: default;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.deck-card-btn.set-active-btn {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c084fc;
}

.deck-card-btn.set-active-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.45);
  color: #fff;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

/* Active Play Deck visual container override */
.deck-card-box.active-play-deck {
  border-color: rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12), 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

.deck-card-box.active-play-deck::before {
  background: linear-gradient(to right, #10b981, #34d399) !important;
}

/* Neues Deck erstellen Placeholder */
.new-deck-placeholder {
  border: 2px dashed rgba(139, 92, 246, 0.25);
  background: rgba(139, 92, 246, 0.02);
  justify-content: center;
  align-items: center;
}

.new-deck-placeholder::before {
  display: none;
}

.new-deck-placeholder:hover {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.04);
}

.new-deck-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--rarity-epic);
  margin-bottom: 10px;
  transition: all 0.3s;
}

.new-deck-placeholder:hover .new-deck-icon-wrap {
  transform: scale(1.1);
  border-color: var(--color-purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

.new-deck-label {
  font-family: var(--font-title);
  font-weight: 500;
  color: #94a3b8;
  font-size: 0.92rem;
}

.new-deck-placeholder:hover .new-deck-label {
  color: #fff;
}

/* Fullscreen Deck Editor layout */
.db-editor {
  animation: fadeIn 0.4s ease-out;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 15px;
}

.editor-deck-title-area {
  flex: 1;
  margin: 0 30px;
  max-width: 450px;
}

.back-to-decks-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
}

.back-to-decks-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.deck-actions-top {
  display: flex;
  gap: 10px;
}

.deckbuilder-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 25px;
  max-height: calc(100vh - 180px);
}

.db-active-deck-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-height: calc(100vh - 180px);
}

.db-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
}

.db-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.active-deck-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.active-deck-meta {
  margin-bottom: 12px;
}

.deck-name-edit {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  width: 100%;
  padding-bottom: 4px;
  margin-bottom: 6px;
  outline: none;
}

.deck-name-edit:focus {
  border-bottom-color: var(--color-blue);
}

.deck-card-counter {
  font-size: 0.8rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.count-warning {
  color: var(--color-dmg);
  font-weight: 600;
}

.deck-items-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  padding-right: 2px;
}

.deck-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.02);
  font-size: 0.85rem;
}

.deck-item-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.deck-item-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.deck-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dice-select-dropdown {
  background: rgba(13, 9, 28, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.72rem;
  font-family: var(--font-body);
  outline: none;
}

.remove-item-btn {
  color: #64748b;
  font-size: 0.85rem;
  padding: 4px;
}

.remove-item-btn:hover {
  color: var(--color-dmg);
}

.deck-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.db-save-btn {
  background: var(--color-green);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
}

.db-save-btn:hover {
  background: #059669;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.db-delete-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-dmg);
  font-weight: 600;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
}

.db-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

.db-catalog {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-height: calc(100vh - 120px);
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 12px;
}

.catalog-filters {
  display: flex;
  gap: 6px;
}

.cat-filter-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.cat-filter-btn:hover {
  color: #fff;
}

.cat-filter-btn.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.catalog-cards-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
  padding-top: 12px;
  padding-left: 8px;
  padding-right: 8px;
}

/* Reduced size cards for Catalog view */
.catalog-cards-grid .tcg-card {
  padding: 8px;
  font-size: 0.75rem;
}

.catalog-cards-grid .card-title {
  font-size: 0.8rem;
}

.catalog-cards-grid .card-text-box {
  height: 55px;
  font-size: 0.65rem;
}

/* --- SHOP & BOOSTER PACK OPENINGS --- */
.shop-inventory-section {
  max-width: 900px;
  margin: 0 auto 30px auto;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.15) 0%, rgba(15, 10, 25, 0.4) 100%);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: 24px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.shop-inventory-section h3 {
  font-family: var(--font-title);
  color: #fff;
  font-size: 1.2rem;
  margin-top: 0;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shop-inventory-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.shop-inventory-card {
  flex: 1;
  min-width: 250px;
  background: rgba(9, 6, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, border-color 0.2s;
}

.shop-inventory-card:hover {
  transform: translateY(-2px);
  border-color: rgba(147, 51, 234, 0.3);
}

.inv-card-visual {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.inv-card-details {
  flex: 1;
}

.inv-card-details h4 {
  margin: 0 0 4px 0;
  font-family: var(--font-title);
  font-size: 1rem;
  color: #fff;
}

.inv-card-details p {
  margin: 0;
  font-size: 0.85rem;
  color: #94a3b8;
}

.inv-count-badge {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.1rem;
  color: #a855f7;
  text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.inv-open-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.inv-open-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 900px;
  margin: 40px auto 0 auto;
}

.shop-item-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 24px;
  padding: 30px;
  text-align: center;
  position: relative;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shop-item-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--rarity-legendary);
  color: #1e1b4b;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}

.shop-item-visual {
  width: 150px;
  height: 180px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
}

.shop-item-card:hover .shop-item-visual {
  transform: scale(1.05) rotate(2deg);
}

.booster-pack-wrapper {
  font-size: 5rem;
}

.booster-icon-gold {
  color: var(--rarity-epic);
  filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.4));
  animation: floatIcon 3s ease-in-out infinite alternate;
}

.dice-box-wrapper {
  font-size: 5rem;
}

.dice-icon-epic {
  color: var(--rarity-legendary);
  filter: drop-shadow(0 0 15px rgba(251, 191, 36, 0.4));
  animation: floatIcon 3s ease-in-out infinite alternate-reverse;
}

@keyframes floatIcon {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

.shop-item-desc {
  font-size: 0.88rem;
  color: #64748b;
  margin: 8px 0 20px 0;
  line-height: 1.4;
  height: 50px;
}

.shop-price {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gold);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shop-buy-btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  color: #fff;
}

/* --- BOOSTER OPENING OVERLAY MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 13, 0.92);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  max-width: 1100px;
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  border-radius: 28px;
  padding: 40px;
  position: relative;
  overflow: hidden;
  animation: scaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-container h3 {
  font-size: 2.2rem;
  text-align: center;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.modal-container p {
  text-align: center;
  color: #64748b;
  margin-bottom: 30px;
}

.booster-reveal-grid {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  justify-content: center;
}

.modal-close-btn {
  padding: 12px 35px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  color: #fff;
}

/* 3D Flip Card Styles for Opening Reveal */
.flip-card-wrapper {
  perspective: 1000px;
  width: 180px;
  height: 252px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flip-card-wrapper.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
}

.flip-card-back {
  background: linear-gradient(135deg, #1e1b4b 0%, #0c0a21 100%);
  border: 3px solid #7c3aed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.booster-back-pattern {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px double #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #c084fc;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
  animation: pulsePurple 2s infinite alternate;
}

@keyframes pulsePurple {
  from {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
  }

  to {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(124, 58, 237, 0.7);
  }
}

.flip-card-front {
  transform: rotateY(180deg);
}

/* Specific styling for dice opened cards in booster */
.dice-card-booster {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  border-color: #4b5563;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.dice-card-booster .dice-3d-container {
  transform: scale(1.5);
  margin-bottom: 10px;
}

/* --- PVE CAMPAIGN MAP --- */
.campaign-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 600px;
  margin: 40px auto 0 auto;
  gap: 10px;
}

.campaign-node {
  width: 100%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
  transition: all 0.3s ease;
}

.campaign-node.locked {
  opacity: 0.55;
}

.node-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #94a3b8;
}

.campaign-node.active .node-icon {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  color: #c084fc;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.node-info {
  flex: 1;
}

.node-info h4 {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 2px;
}

.node-info p {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 6px;
}

.reward-tag {
  font-size: 0.75rem;
  color: var(--color-gold);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.node-play-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.campaign-node.active .node-play-btn {
  background: var(--color-green);
  color: #fff;
  border-color: #059669;
}

.campaign-node.active .node-play-btn:hover {
  background: #059669;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.node-play-btn:disabled {
  background: rgba(0, 0, 0, 0.2);
  color: #64748b;
  cursor: not-allowed;
  border-color: transparent;
}

.campaign-line {
  width: 4px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
}

.campaign-line.active {
  background: linear-gradient(to bottom, #7c3aed, rgba(255, 255, 255, 0.05));
}

/* --- BATTLE ARENA (PLAYGROUND) --- */
#battle-view {
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  padding: 15px;
  background: radial-gradient(circle at center, #0e0921 0%, #04030a 100%);
  gap: 15px;
  position: relative;
  overflow: hidden;
}

/* Arena Header */
.battle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 20px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.opponent-hero,
.player-hero {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 35%;
}

.hero-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.enemy-avatar {
  border-color: var(--color-red);
  color: var(--color-red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.player-avatar {
  border-color: var(--color-blue);
  color: var(--color-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.hero-stats-wrap {
  flex: 1;
}

.hero-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  display: block;
  margin-bottom: 4px;
}

.hp-bar-outer {
  width: 100%;
  height: 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  margin-bottom: 6px;
}

.hp-bar-inner {
  height: 100%;
  background: var(--color-hp);
  border-radius: 8px;
  transition: width 0.4s ease-out;
}

.enemy-hp-bar {
  background: var(--color-dmg);
}

.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.mana-crystals {
  display: flex;
  gap: 4px;
}

.mana-crystal {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

/* Glowing crystals by active color */
.mana-crystal.filled-red {
  background: var(--color-red);
  box-shadow: 0 0 8px var(--color-red);
}

.mana-crystal.filled-green {
  background: var(--color-green);
  box-shadow: 0 0 8px var(--color-green);
}

.mana-crystal.filled-blue {
  background: var(--color-blue);
  box-shadow: 0 0 8px var(--color-blue);
}

.mana-crystal.filled-white {
  background: #cbd5e1;
  box-shadow: 0 0 8px #cbd5e1;
}

.mana-crystal.filled-black {
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
}

.mana-crystal.filled-generic {
  background: #94a3b8;
  box-shadow: 0 0 8px #94a3b8;
}

.phase-display-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.phase-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #c084fc;
  text-shadow: 0 0 10px rgba(192, 132, 252, 0.4);
  text-transform: uppercase;
}

.event-title-badge {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-red);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

/* Global Round Event Slide-in Banner */
.global-event-banner {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 500px;
  width: 90%;
  background: rgba(239, 68, 68, 0.15);
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 12px 20px;
  animation: slideDownIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes slideDownIn {
  from {
    transform: translate(-50%, -40px);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.event-banner-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.event-icon {
  font-size: 1.6rem;
  color: var(--color-red);
  animation: shakeAlert 1s infinite alternate;
}

@keyframes shakeAlert {
  0% {
    transform: scale(1) rotate(-5deg);
  }

  100% {
    transform: scale(1.15) rotate(5deg);
  }
}

.event-banner-text h4 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 2px;
}

.event-banner-text p {
  font-size: 0.78rem;
  color: #fca5a5;
}

/* Battleground Board Layout */
.battle-board-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  padding: 15px;
}

.board-row {
  display: flex;
  gap: 15px;
  align-items: stretch;
  width: 100%;
}

.artifacts-container {
  min-width: 140px;
  max-width: 240px;
  min-height: 160px;
  background: rgba(15, 10, 25, 0.4);
  border: 2px dashed rgba(147, 51, 234, 0.15);
  border-radius: 12px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 6px;
  padding: 15px 10px 10px 10px;
  position: relative;
  transition: all 0.3s ease;
}

.artifacts-container:hover {
  background: rgba(15, 10, 25, 0.6);
  border-color: rgba(147, 51, 234, 0.3);
}

.artifacts-container::before {
  content: 'Artefakte';
  position: absolute;
  top: -10px;
  left: 15px;
  font-size: 0.65rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-blue);
  background: #090610;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(147, 51, 234, 0.15);
  letter-spacing: 0.05em;
  pointer-events: none;
}

.artifacts-container .board-unit-wrapper {
  transform: scale(0.85);
  margin: -10px 0;
}

.artifact-glow-icon {
  font-size: 2.2rem;
  color: #a855f7;
  text-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
}

.board-lane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  padding: 10px;
  min-height: 160px;
  position: relative;
}

.board-lane::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.01);
  border-radius: 12px;
  pointer-events: none;
}

.field-divider {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(0, 0, 0, 0.15);
  margin: 8px 0;
}

.combat-log-display {
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.end-turn-btn {
  background: var(--color-blue);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  padding: 8px 24px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.end-turn-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* Battle Units styles on board */
.board-unit-wrapper {
  width: 110px;
  aspect-ratio: 5/7;
  perspective: 600px;
  position: relative;
  transition: transform 0.2s;
}

.board-unit-wrapper.shaking {
  animation: unitShake 0.4s ease-in-out;
}

@keyframes unitShake {

  0%,
  100% {
    transform: rotate(0);
  }

  20%,
  60% {
    transform: translateX(-8px) rotate(-3deg);
  }

  40%,
  80% {
    transform: translateX(8px) rotate(3deg);
  }
}

.board-unit-wrapper.attacking {
  animation: unitAttackStrike 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes unitAttackStrike {
  0% {
    transform: translateY(0) scale(1);
  }

  40% {
    transform: translateY(-40px) scale(1.05);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

/* Board Unit representation cards */
.board-unit-card {
  width: 100%;
  height: 100%;
  background: #100d21;
  border: 2px solid #231f3d;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

/* Element color tags for board units */
.board-unit-card.red {
  border-color: var(--color-red);
}

.board-unit-card.green {
  border-color: var(--color-green);
}

.board-unit-card.blue {
  border-color: var(--color-blue);
}

.board-unit-card.white {
  border-color: #cbd5e1;
}

.board-unit-card.black {
  border-color: var(--color-black);
}

.unit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.unit-title-text {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.65rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.unit-body-desc {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  margin: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Shows the equipped die inside the unit on board */
.unit-body-desc .dice-3d-container {
  transform: scale(0.7);
}

/* Active targeting line helpers */
.board-unit-wrapper.attack-candidate:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
  cursor: crosshair;
  border-radius: 12px;
}

.board-unit-wrapper.attack-candidate.selected-attacker {
  transform: scale(1.05);
  border-radius: 12px;
  box-shadow: 0 0 20px var(--color-blue);
  animation: pulsingBorderBlue 1.5s infinite alternate;
}

@keyframes pulsingBorderBlue {
  from {
    outline: 2px solid rgba(59, 130, 246, 0.5);
  }

  to {
    outline: 4px solid rgba(59, 130, 246, 1);
  }
}

.board-unit-wrapper.attack-target {
  cursor: crosshair;
}

.board-unit-wrapper.attack-target:hover {
  transform: scale(1.05);
  border-radius: 12px;
  box-shadow: 0 0 20px var(--color-dmg);
  animation: pulsingBorderRed 1.5s infinite alternate;
}

@keyframes pulsingBorderRed {
  from {
    outline: 2px solid rgba(239, 68, 68, 0.5);
  }

  to {
    outline: 4px solid rgba(239, 68, 68, 1);
  }
}

/* Taunt border styling */
.board-unit-wrapper.unit-taunt {
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.25);
}

.board-unit-wrapper.unit-taunt::before {
  content: '\f3ed';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-gold);
  color: #1e1b4b;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Shield indicators */
.board-unit-card.has-shield::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--color-blue);
  border-radius: 10px;
  box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.5);
  pointer-events: none;
  animation: pulseShieldGlow 2s infinite alternate;
}

@keyframes pulseShieldGlow {
  from {
    opacity: 0.4;
  }

  to {
    opacity: 0.85;
  }
}

.unit-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.unit-stat-display {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 4px;
}

.unit-stat-display.hp {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-green);
}

.unit-status-traits {
  display: flex;
  gap: 2px;
  font-size: 0.55rem;
}

.trait-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.trait-dot.haste {
  background: #f59e0b;
}

.trait-dot.lifesteal {
  background: #ec4899;
}

.trait-dot.doubleRoll {
  background: #8b5cf6;
}

/* Floating damage numbers animation */
.floating-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.8rem;
  z-index: 50;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  animation: floatNumberUp 1s ease-out forwards;
}

.floating-indicator.damage {
  color: var(--color-dmg);
}

.floating-indicator.healing {
  color: var(--color-hp);
}

@keyframes floatNumberUp {
  0% {
    transform: translate(-50%, -20px) scale(0.5);
    opacity: 0;
  }

  25% {
    transform: translate(-50%, -50px) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -100px) scale(0.9);
    opacity: 0;
  }
}

/* Battle Footer (Hand Zone & Piles) */
.battle-player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 15px 20px;
  border-radius: 16px;
  height: 200px;
  position: relative;
  z-index: 90;
  /* Keep the entire hand footer in the foreground over the board */
}

.pile-status {
  width: 70px;
  height: 100px;
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
}

.pile-count {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.pile-label {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
}

.hand-zone-wrapper {
  flex: 1;
  margin: 0 20px;
  height: 180px;
  overflow: visible;
  /* Avoid browser-enforced clipping on hover scaling */
  display: flex;
  align-items: center;
}

.hand-zone {
  display: flex;
  gap: 10px;
  padding-bottom: 5px;
  width: 100%;
  justify-content: center;
  /* Center player hand cards in the zone */
}

/* Hand cards are smaller */
.hand-zone .tcg-card {
  width: 100px;
  height: 140px;
  padding: 6px;
  flex-shrink: 0;
  transition: all 0.2s;
  cursor: pointer;
}

.hand-zone .tcg-card:hover {
  transform: translateY(-30px) scale(1.15);
  z-index: 100;
}

.hand-zone .card-title {
  font-size: 0.68rem;
}

.hand-zone .card-text-box {
  display: none;
  /* Hide description in tiny hand card to keep layout clean */
}

.hand-zone .card-footer {
  height: 18px;
}

.hand-zone .card-stat-hp,
.hand-zone .card-dice-slot {
  font-size: 0.65rem;
  padding: 1px 4px;
}

/* Dynamic Targeting overlay when casting spell or choosing attack */
.spell-targeting-active {
  cursor: crosshair !important;
}

/* Match outcome overlays styling */
.match-outcome-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  color: var(--color-gold);
}

.match-reward-panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 15px;
  margin: 20px 0;
}

.match-reward-panel h4 {
  font-size: 0.85rem;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.reward-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.25rem;
  color: var(--color-gold);
  font-family: var(--font-title);
  font-weight: 700;
}

/* --- CAMPAIGN TUTORIAL SPEECH DIALOG PANEL --- */
.tutorial-overlay {
  position: absolute;
  bottom: 170px;
  left: 30px;
  right: 30px;
  background: rgba(13, 9, 28, 0.95);
  border: 2px solid var(--color-blue);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: slideUpIn 0.4s ease-out forwards;
}

@keyframes slideUpIn {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tutorial-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.tutorial-content {
  flex: 1;
}

.tutorial-content h4 {
  font-size: 0.9rem;
  color: var(--color-blue);
  margin-bottom: 2px;
}

.tutorial-content p {
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.tutorial-next-btn {
  background: var(--color-blue);
  color: #fff;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 600;
}

.tutorial-next-btn:hover {
  background: #2563eb;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(13, 9, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes toastIn {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 3px solid var(--color-green);
}

.toast.info {
  border-left: 3px solid var(--color-blue);
}

.toast.error {
  border-left: 3px solid var(--color-red);
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 900px) {
  #global-header {
    padding: 10px 15px;
  }

  .header-logo span {
    display: none;
  }

  .deckbuilder-layout {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .db-sidebar,
  .db-catalog {
    max-height: 450px;
  }

  .battle-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .opponent-hero,
  .player-hero {
    width: 100%;
  }
}

/* --- PLAYGROUND TWO-COLUMN GRID --- */
.battle-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 15px;
  width: 100%;
  min-height: calc(100vh - 98px);
}

.battle-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.battle-sidebar {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: var(--glass-shadow);
  border-radius: 20px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-height: calc(100vh - 98px);
  overflow-y: auto;
}

.sidebar-panel {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
}

.sidebar-panel h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #c084fc;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sidebar-event-card {
  padding: 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #cbd5e1;
  border-left: 3px solid transparent;
}

.sidebar-event-card.empty {
  color: #64748b;
  font-style: italic;
  text-align: center;
  padding: 15px 0;
  border: none;
}

.sidebar-event-card.event-red {
  border-left-color: var(--color-red);
  background: rgba(239, 68, 68, 0.05);
}

.sidebar-event-card.event-green {
  border-left-color: var(--color-green);
  background: rgba(16, 185, 129, 0.05);
}

.sidebar-event-card.event-blue {
  border-left-color: var(--color-blue);
  background: rgba(59, 130, 246, 0.05);
}

.sidebar-event-card.event-white {
  border-left-color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-event-card.event-black {
  border-left-color: var(--color-black);
  background: rgba(147, 51, 234, 0.05);
}

.sidebar-event-card.event-colorless {
  border-left-color: var(--color-colorless);
  background: rgba(107, 114, 128, 0.05);
}

.roll-log-list {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.log-empty-msg {
  color: #64748b;
  font-style: italic;
  text-align: center;
  font-size: 0.75rem;
  padding: 20px 0;
}

.log-entry {
  font-size: 0.74rem;
  line-height: 1.35;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 2.5px solid var(--color-blue);
  color: #cbd5e1;
}

.log-entry.log-entry-damage {
  border-left-color: var(--color-dmg);
}

.log-entry.log-entry-heal {
  border-left-color: var(--color-hp);
}

.log-entry-time {
  font-size: 0.62rem;
  color: #64748b;
  display: block;
  margin-top: 3px;
  text-align: right;
}

.sidebar-menu-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.forfeit-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-dmg);
}

.forfeit-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* Equipped Dice Selector Styling in Deckbuilder */
.dice-select-dropdown {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 160px;
}

.dice-select-dropdown:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.dice-select-dropdown.rarity-common {
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.dice-select-dropdown.rarity-uncommon {
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.dice-select-dropdown.rarity-rare {
  background: rgba(59, 130, 246, 0.08);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.dice-select-dropdown.rarity-epic {
  background: rgba(168, 85, 247, 0.08);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.dice-select-dropdown.rarity-legendary {
  background: rgba(234, 179, 8, 0.08);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.4);
  font-weight: 600;
  text-shadow: 0 0 4px rgba(234, 179, 8, 0.2);
}

.dice-select-dropdown.empty-dice-slot {
  background: rgba(244, 63, 94, 0.04);
  color: #fb7185;
  border: 1px dashed rgba(244, 63, 94, 0.25);
}

.dice-select-dropdown option {
  background: #0f172a;
  color: #cbd5e1;
}

/* --- PREMIUM CARD HOVER PREVIEW ZOOM SYSTEM --- */
.card-hover-preview {
  position: fixed;
  display: flex;
  flex-direction: row;
  gap: 20px;
  z-index: 99999;
  pointer-events: none;
  background: rgba(11, 8, 25, 0.94);
  border: 1.5px solid rgba(139, 92, 246, 0.35);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85), 0 0 30px rgba(139, 92, 246, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInZoom 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 480px;
  align-items: stretch;
  width: max-content;
}

@keyframes fadeInZoom {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.hover-preview-card-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hover-preview-card-container .tcg-card {
  width: 180px;
  height: 250px;
  font-size: 0.95rem;
}

.hover-preview-card-container .card-art-img {
  max-height: 100px;
}

/* Force description text visible in preview mode */
.card-hover-preview .card-text-box {
  display: block !important;
  font-size: 0.78rem !important;
  line-height: 1.35 !important;
  opacity: 0.9 !important;
  max-height: none !important;
  overflow: visible !important;
  margin-top: 5px !important;
}

.hover-preview-info-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 230px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 16px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Custom scrollbar for details panel */
.hover-preview-info-panel::-webkit-scrollbar {
  width: 4px;
}
.hover-preview-info-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.hover-preview-info-panel::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.4);
  border-radius: 4px;
}
.hover-preview-info-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.6);
}

.preview-info-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.preview-detail-row {
  font-size: 0.8rem;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 10px;
  color: #e2e8f0;
}

.preview-detail-row.error {
  border-color: rgba(244, 63, 94, 0.25);
  background: rgba(244, 63, 94, 0.03);
}

.preview-detail-row i {
  margin-right: 6px;
}

.preview-detail-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 3px;
  line-height: 1.3;
}

/* Graveyard Preview Popover */
.graveyard-preview-popup {
  position: fixed;
  width: 350px;
  max-height: 400px;
  background: rgba(9, 6, 16, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px;
  pointer-events: auto;
}

.graveyard-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--color-dmg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.graveyard-empty-msg {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
  font-style: italic;
}

.graveyard-popup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.graveyard-popup-grid::-webkit-scrollbar {
  width: 4px;
}

.graveyard-popup-grid::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.graveyard-popup-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.graveyard-popup-grid .tcg-card {
  transform: scale(0.65);
  transform-origin: top left;
  width: 130px;
  height: 190px;
  margin-bottom: -66px;
  margin-right: -45px;
}

/* Dice Roll Carousel (RNG Spinner) */
.dice-roll-carousel {
  position: fixed;
  inset: 0;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  background: transparent;
  transition: opacity 0.2s ease;
}

.dice-roll-carousel.visible {
  opacity: 1;
  pointer-events: auto;
}

.carousel-modal-content {
  position: absolute;
  width: 220px;
  max-width: 220px;
  box-sizing: border-box;
  overflow: hidden;
  background: rgba(16, 12, 30, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(147, 51, 234, 0.35);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6), 0 0 20px rgba(147, 51, 234, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 10;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dice-roll-carousel.visible .carousel-modal-content {
  transform: scale(1);
}

.carousel-reel-outer {
  position: relative;
  width: 200px;
  height: 60px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

.carousel-reel-outer.shake {
  animation: reelShake 0.4s ease-out;
}

@keyframes reelShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.carousel-marker {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--color-blue), transparent);
  z-index: 20;
  pointer-events: none;
}

.carousel-marker::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid var(--color-blue);
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.8));
}

.carousel-marker::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--color-blue);
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.8));
}

.carousel-strip {
  display: flex;
  gap: 4px;
  position: absolute;
  left: 0;
  height: 52px;
  transition: transform 2.5s cubic-bezier(0.12, 0.8, 0.2, 1.15);
  will-change: transform;
  align-items: center;
}

.carousel-tile {
  width: 40px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.4);
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.carousel-tile.dice-red { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }
.carousel-tile.dice-blue { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.2); }
.carousel-tile.dice-green { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.2); }
.carousel-tile.dice-white { background: rgba(248, 250, 252, 0.15); border-color: rgba(248, 250, 252, 0.2); }
.carousel-tile.dice-black { background: rgba(15, 10, 25, 0.6); border-color: rgba(255, 255, 255, 0.08); }

.carousel-tile.winner {
  transform: scale(1.15);
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #fff;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.7);
  z-index: 10;
}

.carousel-tile.crit-tile {
  border: 1.5px dashed rgba(234, 179, 8, 0.4);
  color: var(--color-gold);
}

.carousel-tile.winner.crit-tile {
  background: rgba(234, 179, 8, 0.25);
  border: 1.5px solid #eab308;
  box-shadow: 0 0 25px rgba(234, 179, 8, 0.9);
  animation: critGlowPulse 1s infinite alternate;
}

@keyframes critGlowPulse {
  0% { filter: drop-shadow(0 0 3px rgba(234, 179, 8, 0.5)); }
  100% { filter: drop-shadow(0 0 10px rgba(234, 179, 8, 0.9)); }
}

.crit-ring {
  position: absolute;
  width: 40px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid #eab308;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
}

.crit-ring.active {
  animation: critRingExpand 0.6s cubic-bezier(0.1, 0.8, 0.1, 1) forwards;
}

@keyframes critRingExpand {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; border-width: 1px; }
}

.carousel-result-display {
  min-height: 18px;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  transition: opacity 0.2s ease;
  opacity: 0;
  margin-top: 2px;
}

.carousel-result-display.visible {
  opacity: 1;
}

.carousel-result-display.crit-highlight {
  color: var(--color-gold);
  text-shadow: 0 0 15px rgba(234, 179, 8, 0.6);
  font-weight: 700;
}

/* --- DICE SYNTHESIS (FORGE) VIEW --- */
.synthesis-layout {
  display: grid;
  grid-template-columns: 4fr 5fr 3fr;
  gap: 24px;
  margin-top: 15px;
  height: calc(100vh - 180px);
  min-height: 550px;
}

.synthesis-panel {
  background: rgba(16, 12, 30, 0.6);
  border: 1px solid rgba(147, 51, 234, 0.15);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
}

.synthesis-panel h3 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* Inventory panel styling */
.inventory-panel {
  max-height: 100%;
}

.inventory-dice-grid {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 20px 12px 12px 12px;
}

.rarity-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rarity-group-header {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rarity-group-header.common { color: var(--rarity-common); }
.rarity-group-header.uncommon { color: var(--rarity-uncommon); }
.rarity-group-header.rare { color: var(--rarity-rare); }
.rarity-group-header.epic { color: var(--rarity-epic); }
.rarity-group-header.legendary { color: var(--rarity-legendary); }

.rarity-sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.inventory-dice-grid::-webkit-scrollbar {
  width: 6px;
}
.inventory-dice-grid::-webkit-scrollbar-thumb {
  background: rgba(147, 51, 234, 0.3);
  border-radius: 4px;
}

/* Forge panel styling */
.forge-panel {
  align-items: center;
}

.forge-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 30px;
}

.forge-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 140px;
  width: 100%;
}

.forge-slot {
  width: 90px;
  height: 120px;
  border-radius: 12px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.forge-slot.empty {
  border: 2px dashed rgba(147, 51, 234, 0.25);
  background: rgba(147, 51, 234, 0.03);
}

.forge-slot.empty:hover {
  border-color: rgba(147, 51, 234, 0.6);
  background: rgba(147, 51, 234, 0.08);
  box-shadow: 0 0 15px rgba(147, 51, 234, 0.15);
}

.forge-slot.empty::before {
  content: '+';
  font-size: 2rem;
  color: rgba(147, 51, 234, 0.3);
}

.forge-slot.filled {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0f0b20;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.forge-slot.filled:hover {
  border-color: var(--color-dmg);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.forge-slot.filled:hover::after {
  content: '\f1f8';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  inset: 0;
  background: rgba(15, 11, 32, 0.85);
  color: var(--color-dmg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.forge-cost-area {
  text-align: center;
}

.cost-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

.cost-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cost-value.insufficient {
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  animation: costBlink 1s infinite alternate;
}

@keyframes costBlink {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

.synthesize-btn {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 14px 36px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.synthesize-btn:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.7);
  background: linear-gradient(135deg, #b55fe6, #4f46e5);
}

.synthesize-btn:active:not(.disabled) {
  transform: translateY(0);
}

.synthesize-btn.disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
  cursor: not-allowed;
}

/* Preview panel styling */
.preview-panel {
  align-items: center;
}

.outcome-preview-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 20px;
}

.outcome-preview-card {
  width: 130px;
  height: 182px;
  background: #0f0b20;
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.preview-card-inner {
  flex: 1;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-mystery-shroud {
  font-size: 3.5rem;
  color: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  width: 100%;
  transition: all 0.3s ease;
}

.preview-card-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
  margin-top: 10px;
}

.outcome-success-rate {
  font-size: 0.85rem;
  color: #94a3b8;
}

.outcome-success-rate .rate-val {
  color: var(--color-green);
  font-weight: 700;
}

.outcome-description {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  line-height: 1.5;
  max-width: 220px;
  min-height: 45px;
}

/* Glow shrouds for outcome rarity */
.outcome-preview-card.glowing-uncommon {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.25);
}
.outcome-preview-card.glowing-uncommon .preview-mystery-shroud {
  color: rgba(99, 102, 241, 0.6);
  text-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}
.outcome-preview-card.glowing-uncommon .preview-card-title {
  color: var(--color-blue);
}

.outcome-preview-card.glowing-rare {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.35);
}
.outcome-preview-card.glowing-rare .preview-mystery-shroud {
  color: rgba(168, 85, 247, 0.7);
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}
.outcome-preview-card.glowing-rare .preview-card-title {
  color: var(--rarity-rare);
}

.outcome-preview-card.glowing-epic {
  border-color: rgba(236, 72, 153, 0.6);
  box-shadow: 0 0 35px rgba(236, 72, 153, 0.45);
}
.outcome-preview-card.glowing-epic .preview-mystery-shroud {
  color: rgba(236, 72, 153, 0.8);
  text-shadow: 0 0 25px rgba(236, 72, 153, 0.6);
}
.outcome-preview-card.glowing-epic .preview-card-title {
  color: var(--rarity-epic);
}

.outcome-preview-card.glowing-legendary {
  border-color: rgba(234, 179, 8, 0.7);
  box-shadow: 0 0 45px rgba(234, 179, 8, 0.6);
}
.outcome-preview-card.glowing-legendary .preview-mystery-shroud {
  color: rgba(234, 179, 8, 0.9);
  text-shadow: 0 0 30px rgba(234, 179, 8, 0.7);
  animation: pulseGold 2s infinite alternate;
}
.outcome-preview-card.glowing-legendary .preview-card-title {
  color: var(--color-gold);
}

@keyframes pulseGold {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(234, 179, 8, 0.5)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 15px rgba(234, 179, 8, 0.9)); }
}

/* Fusing flash animation */
.forge-slots-container.fusing {
  animation: forgeFuseFlash 0.8s ease-out;
}

@keyframes forgeFuseFlash {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(2) drop-shadow(0 0 30px #a855f7); }
  100% { transform: scale(1); filter: brightness(1); }
}

/* ==========================================
   NETRUNNER PROFILE DASHBOARD VIEW (NEON ENTROPY)
   ========================================== */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  grid-template-rows: auto auto;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: var(--font-body);
}

.profile-card {
  background: rgba(10, 10, 12, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.profile-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.08);
}

.profile-card .panel-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

/* KACHEL A: Netrunner ID */
.netrunner-id-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-container {
  margin-bottom: 20px;
  position: relative;
}

.avatar-holo-frame {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #10b981, #06b6d4, #6366f1);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
  position: relative;
  overflow: hidden;
  animation: holoPulse 3s infinite alternate;
}

.avatar-holo-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #0f0b20;
}

@keyframes holoPulse {
  0% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.3); }
  100% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.6); }
}

.username-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 15px;
}

.username-wrap .neon-text {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.user-title {
  font-size: 0.85rem;
  color: #06b6d4;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.level-badge-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.level-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.level-val {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-bar-container {
  width: 100%;
  max-width: 280px;
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 7px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  border-radius: 7px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
}

/* KACHEL B: Kampf-Matrix */
.combat-matrix-panel {
  display: flex;
  flex-direction: column;
}

.rank-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.rank-shield {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px 36px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  min-width: 180px;
}

.rank-icon {
  font-size: 2.2rem;
  color: #ea33f7;
  text-shadow: 0 0 15px rgba(234, 51, 247, 0.5);
  margin-bottom: 8px;
}

.rank-name {
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: 0.05em;
}

.modes-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mode-stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.mode-name {
  display: block;
  font-size: 0.76rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.mode-vals {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.val-divider {
  color: rgba(255, 255, 255, 0.15);
}

.mode-winrate {
  font-size: 0.74rem;
  color: #64748b;
}

.mode-winrate span {
  font-weight: 700;
}

.neon-green { color: #10b981; text-shadow: 0 0 8px rgba(16, 185, 129, 0.3); }
.neon-blue { color: #06b6d4; text-shadow: 0 0 8px rgba(6, 182, 212, 0.3); }
.neon-red { color: #ef4444; text-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }

/* KACHEL C: Terminal-RNG-Daten */
.rng-metrics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.rng-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.rng-metric-row span {
  color: #94a3b8;
}

.rng-metric-row strong {
  font-family: var(--font-title);
  color: #fff;
}

.neon-pink {
  color: #ec4899;
  text-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

.factions-usage-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-section-title {
  font-family: var(--font-title);
  font-size: 0.82rem;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.faction-usage-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faction-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.faction-bar-row .faction-label {
  font-size: 0.72rem;
  font-weight: 700;
  width: 90px;
  text-transform: uppercase;
}

.faction-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  overflow: hidden;
}

.faction-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.faction-percent {
  font-size: 0.72rem;
  font-weight: 700;
  width: 35px;
  text-align: right;
  color: #94a3b8;
}

/* Faction coloring classes */
.fill-green { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.fill-blue { background: #3b82f6; box-shadow: 0 0 8px rgba(59, 130, 246, 0.5); }
.fill-black { background: #a855f7; box-shadow: 0 0 8px rgba(168, 85, 247, 0.5); }
.fill-white { background: #cbd5e1; box-shadow: 0 0 8px rgba(203, 213, 225, 0.5); }
.fill-red { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }

/* KACHEL D: Sammlungs-Zentralrechner */
.mainframe-progress-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.mainframe-bar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
}

.ratio-val {
  color: #fff;
  font-family: var(--font-title);
}

.progress-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.fill-purple { background: linear-gradient(90deg, #a855f7, #6366f1); box-shadow: 0 0 10px rgba(168, 85, 247, 0.4); }

.rarity-pills-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.rarity-pill-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rarity-pill-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rarity-pill-val {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

/* Rarity specific text shadows */
.color-common { color: #94a3b8; }
.color-uncommon { color: var(--color-blue); text-shadow: 0 0 6px rgba(59, 130, 246, 0.3); }
.color-rare { color: var(--rarity-rare); text-shadow: 0 0 6px rgba(168, 85, 247, 0.3); }
.color-epic { color: var(--rarity-epic); text-shadow: 0 0 6px rgba(236, 72, 153, 0.3); }
.color-legendary { color: var(--color-gold); text-shadow: 0 0 6px rgba(234, 179, 8, 0.3); }

/* Responsive adjustments */
@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
}

/* ==========================================
   DIGITAL GLITCH PAGE TRANSITION SYSTEM (PERFORMANCE OPTIMIZED)
   ========================================== */
@keyframes glitch-slice-1 {
  0% { clip-path: inset(20% 0 70% 0); }
  20% { clip-path: inset(60% 0 10% 0); }
  40% { clip-path: inset(10% 0 85% 0); }
  60% { clip-path: inset(80% 0 5% 0); }
  80% { clip-path: inset(45% 0 45% 0); }
  100% { clip-path: inset(30% 0 55% 0); }
}

@keyframes glitch-slice-2 {
  0% { clip-path: inset(50% 0 35% 0); }
  25% { clip-path: inset(15% 0 75% 0); }
  50% { clip-path: inset(85% 0 5% 0); }
  75% { clip-path: inset(30% 0 60% 0); }
  100% { clip-path: inset(70% 0 15% 0); }
}

.screen-glitch {
  position: relative;
}

.screen-glitch::before,
.screen-glitch::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

.screen-glitch::before {
  animation: glitch-slice-1 0.15s infinite linear alternate-reverse;
  left: 3px;
  filter: hue-rotate(90deg) saturate(1.8);
  background: rgba(255, 0, 193, 0.06);
  mix-blend-mode: screen;
}

.screen-glitch::after {
  animation: glitch-slice-2 0.2s infinite linear alternate;
  left: -3px;
  filter: hue-rotate(270deg) saturate(1.8);
  background: rgba(0, 255, 240, 0.06);
  mix-blend-mode: screen;
}