/* Medieval Theme CSS Variables */
:root {
  --bg-primary: #1a0a1a;
  --bg-secondary: #2d1b3d;
  --bg-tertiary: #1a1025;
  --bg-stone: #1e1428;
  --gold: #d4af37;
  --gold-light: #f4d03f;
  --gold-dark: #a67c00;
  --royal-purple: #6b2d5b;
  --royal-purple-light: #8e4585;
  --parchment: #f4e4bc;
  --parchment-dark: #d4c4a0;
  --crimson: #8b0000;
  --text-light: #e8dcc8;
  --text-muted: #9a8b7a;
  --border-gold: #c9a227;
}

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

body {
  font-family: 'Cinzel', 'Times New Roman', serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
  color: var(--text-light);
  min-height: 100vh;
}

/* Medieval Headings */
h1, h2, h3, .game-title, .join-title, .game-logo {
  font-family: 'MedievalSharp', 'Cinzel', serif;
}

/* Gem Colors - Enhanced Jewel Look */
.gem-diamond {
  background: linear-gradient(135deg, #ffffff 0%, #e8e8e8 25%, #b8b8b8 50%, #e8e8e8 75%, #ffffff 100%);
  color: #333;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.8), 0 0 15px rgba(255, 255, 255, 0.3);
}
.gem-sapphire {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 25%, #1d4ed8 50%, #3b82f6 75%, #1e3a8a 100%);
  box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.5), 0 0 15px rgba(30, 58, 138, 0.4);
}
.gem-emerald {
  background: linear-gradient(135deg, #064e3b 0%, #10b981 25%, #059669 50%, #10b981 75%, #064e3b 100%);
  box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.5), 0 0 15px rgba(6, 78, 59, 0.4);
}
.gem-ruby {
  background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 25%, #dc2626 50%, #ef4444 75%, #7f1d1d 100%);
  box-shadow: inset 0 0 10px rgba(239, 68, 68, 0.5), 0 0 15px rgba(127, 29, 29, 0.4);
}
.gem-onyx {
  background: linear-gradient(135deg, #0f0f0f 0%, #374151 25%, #1f2937 50%, #374151 75%, #0f0f0f 100%);
  box-shadow: inset 0 0 10px rgba(55, 65, 81, 0.5), 0 0 15px rgba(0, 0, 0, 0.6);
}
.gem-gold {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-light) 25%, var(--gold) 50%, var(--gold-light) 75%, var(--gold-dark) 100%);
  color: #1a0a0a;
  box-shadow: inset 0 0 10px rgba(244, 208, 63, 0.6), 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Gem token styles */
.gem-token {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  border: 3px solid var(--gold);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.gem-token:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.6);
}

.gem-token.selected {
  transform: scale(1.15);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.9);
  border-color: var(--gold-light);
  animation: gemGlow 1.5s ease-in-out infinite;
}

@keyframes gemGlow {
  0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.9); }
  50% { box-shadow: 0 0 40px rgba(244, 208, 63, 1); }
}

.gem-token.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(50%);
}

/* Distinct gem shapes */
.gem-diamond {
  border-radius: 8px !important;
  transform: rotate(45deg);
  border-color: rgba(200, 200, 200, 0.8) !important;
}
.gem-diamond .gem-count {
  display: inline-block;
  transform: rotate(-45deg);
}
.gem-diamond:hover {
  transform: rotate(45deg) scale(1.1);
}

/* Gem Bank specific - smaller diamond */
.gem-bank .gem-token.gem-diamond {
  width: 42px !important;
  height: 42px !important;
}

.gem-sapphire {
  border-radius: 50% / 35% !important;
  border-color: rgba(100, 149, 237, 0.8) !important;
}

.gem-emerald {
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border: none !important;
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}

.gem-ruby {
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40% !important;
  border-color: rgba(255, 100, 100, 0.7) !important;
}

.gem-onyx {
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
  border: none !important;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
}

.gem-gold {
  border-radius: 50% !important;
  border-color: rgba(255, 215, 0, 0.8) !important;
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
}

/* Card styles - Medieval Parchment Look */
.card {
  background: linear-gradient(145deg, rgba(244, 228, 188, 0.12) 0%, rgba(212, 196, 160, 0.08) 100%);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
  border: 2px solid var(--border-gold);
  transition: all 0.2s;
  cursor: pointer;
  box-shadow:
    inset 0 0 20px rgba(212, 175, 55, 0.1),
    0 4px 15px rgba(0, 0, 0, 0.4);
}

.card:hover {
  border-color: var(--gold-light);
  transform: translateY(-3px);
  box-shadow:
    inset 0 0 25px rgba(212, 175, 55, 0.2),
    0 8px 25px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(212, 175, 55, 0.3);
}

.card-points {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--gold-light);
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.5), 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.card-bonus {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}

.card-cost {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2.5rem;
}

.card-cost-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

/* Noble styles - Royal Treatment */
.noble {
  background: linear-gradient(135deg, var(--royal-purple) 0%, #4a1942 50%, var(--royal-purple-light) 100%);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  border: 3px solid var(--gold);
  box-shadow:
    inset 0 0 30px rgba(212, 175, 55, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.5);
}

.noble-points {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--gold-light);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  font-family: 'MedievalSharp', serif;
}

.noble-requires {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 0.5rem;
}

/* Button styles - Medieval Embossed */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  color: #1a0a0a;
  border: 2px solid var(--gold-dark);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 10px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-light) 50%, var(--gold) 100%);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 6px 15px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(212, 175, 55, 0.4);
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(107, 45, 91, 0.8) 0%, rgba(74, 25, 66, 0.9) 100%);
  color: var(--text-light);
  border: 2px solid var(--gold);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-secondary:hover {
  background: linear-gradient(180deg, var(--royal-purple-light) 0%, var(--royal-purple) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 6px 15px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(107, 45, 91, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(30%);
}

/* Input styles - Parchment Feel */
.input {
  padding: 0.75rem 1rem;
  border: 2px solid var(--gold);
  border-radius: 4px;
  background: rgba(244, 228, 188, 0.1);
  color: var(--text-light);
  font-size: 1rem;
  font-family: 'Cinzel', serif;
  outline: none;
  transition: all 0.2s;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.input:focus {
  border-color: var(--gold-light);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(212, 175, 55, 0.4);
}

.input::placeholder {
  color: var(--text-muted);
}

/* Modal styles - Royal Decree */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 5, 15, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(145deg, var(--bg-stone) 0%, var(--bg-primary) 100%);
  border-radius: 8px;
  padding: 2rem;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 3px solid var(--gold);
  box-shadow:
    inset 0 0 30px rgba(212, 175, 55, 0.1),
    0 0 50px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(212, 175, 55, 0.2);
}

.modal h2 {
  margin-bottom: 1.5rem;
  color: var(--gold-light);
  font-family: 'MedievalSharp', serif;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  text-align: center;
  border-bottom: 2px solid var(--border-gold);
  padding-bottom: 0.75rem;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(145deg, var(--bg-stone) 0%, var(--bg-primary) 100%);
  color: var(--text-light);
  padding: 1rem 2rem;
  border-radius: 4px;
  border: 2px solid var(--gold);
  opacity: 0;
  transition: all 0.3s;
  z-index: 2000;
  font-family: 'Cinzel', serif;
}

.toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error {
  background: linear-gradient(145deg, #4a1515 0%, #2d0a0a 100%);
  border-color: var(--crimson);
}

.toast.success {
  background: linear-gradient(145deg, #1a4a2e 0%, #0a2d1a 100%);
  border-color: #2ecc71;
}

/* Player badge */
.player-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(107, 45, 91, 0.3);
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  font-size: 0.9rem;
}

.player-badge.active {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #1a0a0a;
  border-color: var(--gold-light);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.5);
}

.player-badge.ai {
  background: rgba(107, 45, 91, 0.5);
  border-color: var(--royal-purple-light);
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Utility classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-gold { color: var(--gold-light); text-shadow: 0 0 5px rgba(212, 175, 55, 0.3); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }

/* Decorative medieval border utility */
.ornate-border {
  border: 3px solid var(--gold);
  box-shadow:
    inset 0 0 20px rgba(212, 175, 55, 0.1),
    0 0 20px rgba(0, 0, 0, 0.5);
}
