@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

@import "tailwindcss";
@import "tw-animate-css";

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-destructive: var(--destructive);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
}

:root {
  --radius: 0.5rem;
  
  /* === Background Colors (Depth Levels) === */
  --bg-base: #060811;
  --bg-surface: #0C1020;
  --bg-elevated: #111628;
  --bg-sunken: #181f35;
  
  /* === Border Colors === */
  --border-subtle: #1e2a45;
  --border-default: #2a3a60;
  --border-focus: #5B8FFF;
  
  /* === Text Colors === */
  --text-primary: #c8d8f8;
  --text-secondary: #7a92c0;
  --text-muted: #4a5f8a;
  --text-disabled: #2a3a60;
  
  /* === Mana Element Colors === */
  --mana-fire: #E8734A;
  --mana-water: #3BAFDA;
  --mana-air: #C8D8F8;
  --mana-earth: #B8860B;
  --mana-light: #D4A843;
  --mana-dark: #4B0082;
  --mana-death: #8B7D8B;
  --mana-transfer: #00CED1;
  --mana-metal: #708090;
  --mana-sand: #C2B280;
  --mana-lightning: #FFD700;
  --mana-crystal: #B0E0E6;
  --mana-stellar: #FF8C00;
  --mana-void: #1A0A2E;
  
  /* === Semantic UI Colors === */
  --color-success: #27AE60;
  --color-warning: #F39C12;
  --color-danger: #C0392B;
  --color-info: #3B6FE8;
  
  /* === Rarity Colors === */
  --rarity-common: #9CA3AF;
  --rarity-common-glow: rgba(156, 163, 175, 0.25);
  --rarity-uncommon: #22C55E;
  --rarity-uncommon-glow: rgba(34, 197, 94, 0.25);
  --rarity-rare: #3B82F6;
  --rarity-rare-glow: rgba(59, 130, 246, 0.25);
  --rarity-epic: #A855F7;
  --rarity-epic-glow: rgba(168, 85, 247, 0.25);
  --rarity-legendary: #F59E0B;
  --rarity-legendary-glow: rgba(245, 158, 11, 0.375);
  --rarity-mythic: #E8734A;
  --rarity-mythic-glow: rgba(232, 115, 74, 0.25);
  
  /* === Interactive Colors === */
  --interactive-primary: #3B6FE8;
  --interactive-primary-hover: #5B8FFF;
  --interactive-secondary: #2a3a60;
  --interactive-secondary-hover: #3a4a70;
  --interactive-danger: #C0392B;
  --interactive-danger-hover: #E74C3C;
  --interactive-disabled: #1e2a45;
  
  /* === Typography === */
  --font-display: 'Cinzel', serif;
  --font-body: 'Source Serif 4', 'Crimson Text', Georgia, serif;
  --font-ui: 'JetBrains Mono', monospace;
  
  /* === Shadow System === */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-glow-gold: 0 0 15px rgba(212, 168, 67, 0.4);
  --shadow-glow-purple: 0 0 15px rgba(124, 92, 191, 0.4);
  --shadow-glow-accent: 0 0 15px rgba(60, 111, 232, 0.4);
  
  /* === Mana Loop Design Tokens (Strategy Spec) === */
  --bg-void: #0d0d0f;
  --bg-panel: #141418;
  --bg-raised: #242430;
  --mana-raw: #8b7fd4;
  --mana-transference: #1abc9c;
  --border-accent: rgba(255, 255, 255, 0.22);

  /* === Legacy Shadcn Variables (mapped to new system) === */
  --background: var(--bg-base);
  --foreground: var(--text-primary);
  --card: var(--bg-surface);
  --card-foreground: var(--text-primary);
  --popover: var(--bg-elevated);
  --popover-foreground: var(--text-primary);
  --primary: var(--interactive-primary);
  --primary-foreground: #ffffff;
  --secondary: var(--bg-sunken);
  --secondary-foreground: var(--text-primary);
  --muted: var(--bg-sunken);
  --muted-foreground: var(--text-secondary);
  --accent: var(--interactive-secondary);
  --accent-foreground: var(--text-primary);
  --destructive: var(--color-danger);
  --border: var(--border-subtle);
  --input: var(--border-subtle);
  --ring: var(--border-focus);
  --chart-1: var(--mana-fire);
  --chart-2: var(--mana-water);
  --chart-3: var(--mana-light);
  --chart-4: var(--color-success);
  --chart-5: var(--mana-lightning);
  --sidebar: var(--bg-surface);
  --sidebar-foreground: var(--text-primary);
  --sidebar-primary: var(--mana-light);
  --sidebar-primary-foreground: #0C1020;
  --sidebar-accent: var(--interactive-secondary);
  --sidebar-accent-foreground: var(--text-primary);
  --sidebar-border: var(--border-subtle);
  --sidebar-ring: var(--mana-light);
  
  /* Legacy game colors (kept for compatibility) */
  --game-bg: var(--bg-base);
  --game-bg1: var(--bg-surface);
  --game-bg2: var(--bg-elevated);
  --game-bg3: var(--bg-sunken);
  --game-border: var(--border-subtle);
  --game-border2: var(--border-default);
  --game-text: var(--text-primary);
  --game-text2: var(--text-secondary);
  --game-text3: var(--text-muted);
  --game-gold: var(--mana-light);
  --game-gold2: #A87830;
  --game-purple: #7C5CBF;
  --game-purpleL: #A07EE0;
  --game-accent: var(--interactive-primary);
  --game-accentL: var(--interactive-primary-hover);
  --game-danger: var(--color-danger);
  --game-success: var(--color-success);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
    font-family: var(--font-body);
  }
}

/* Game-specific styles */
.game-root {
  font-family: var(--font-body);
  background: var(--game-bg);
  color: var(--game-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at 20% 10%, #0D1535 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, #0A0A20 0%, transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(30,42,69,0.15) 40px, rgba(30,42,69,0.15) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(30,42,69,0.15) 40px, rgba(30,42,69,0.15) 41px);
}

.game-title {
  font-family: var(--font-display);
  background: linear-gradient(135deg, var(--game-gold) 0%, var(--game-purpleL) 50%, var(--game-accentL) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-panel-title {
  font-family: var(--font-display);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.game-mono {
  font-family: var(--font-ui);
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--game-border2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--game-purple);
}

/* Mana bar animation */
@keyframes mana-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.mana-bar-animated {
  animation: mana-pulse 2s ease-in-out infinite;
}

/* Glow effects */
.glow-gold {
  box-shadow: 0 0 15px rgba(212, 168, 67, 0.4);
}

.glow-purple {
  box-shadow: 0 0 15px rgba(124, 92, 191, 0.4);
}

.glow-accent {
  box-shadow: 0 0 15px rgba(60, 111, 232, 0.4);
}

/* Gather button glow animation */
@keyframes gather-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(59, 111, 232, 0.3), 0 0 10px rgba(59, 111, 232, 0.2);
  }
  50% {
    box-shadow: 0 0 15px rgba(59, 111, 232, 0.5), 0 0 25px rgba(59, 111, 232, 0.3);
  }
}

.animate-gather-glow {
  animation: gather-glow 2s ease-in-out infinite;
}

/* Active scale effect for buttons - using CSS only */
.active\:scale-95:active {
  transform: scale(0.95);
}

/* Button hover effects */
.btn-game {
  transition: all 0.2s ease;
}

.btn-game:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Card hover effects */
.card-game {
  transition: all 0.2s ease;
}

.card-game:hover {
  border-color: var(--game-border2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Element pill styles */
.elem-pill {
  transition: all 0.15s ease;
}

.elem-pill:hover {
  filter: brightness(1.2);
  transform: scale(1.02);
}

/* Calendar day styles */
.day-cell {
  transition: all 0.15s ease;
}

.day-current {
  box-shadow: 0 0 8px rgba(60, 111, 232, 0.5);
}

.day-incursion {
  border-color: rgba(192, 57, 43, 0.6) !important;
}

/* Game over overlay */
.game-overlay {
  backdrop-filter: blur(8px);
  background: rgba(6, 8, 17, 0.92);
}

/* Pact badge */
.pact-badge {
  box-shadow: 0 0 10px rgba(212, 168, 67, 0.3);
}

/* Spell card active */
.spell-active {
  border-color: var(--game-gold);
  background: rgba(212, 168, 67, 0.1);
}

/* Tab active */
.tab-active {
  color: var(--game-gold);
  border-bottom-color: var(--game-gold);
}

/* Skill dot filled */
.skill-dot-filled {
  background: var(--game-purpleL);
  box-shadow: 0 0 6px rgba(160, 126, 224, 0.5);
}

/* Log entry */
.log-entry-new {
  color: var(--game-text);
}

.log-entry-old {
  color: var(--game-text2);
}
