/* ========================================
   REUSABLE COMPONENTS
   ======================================== */

/* ========================================
   BUTTONS
   ======================================== */
.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent-cyan);
  color: var(--bg-dark);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.625rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 0 6px 0 var(--shadow-color);
  position: relative;
}

.game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--shadow-color);
  color: var(--bg-dark);
}

.game-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--shadow-color);
}

.game-btn--green {
  background: var(--accent-green);
}

.game-btn--yellow {
  background: var(--accent-yellow);
}

.game-btn--pink {
  background: var(--accent-pink);
  color: var(--text-primary);
}

.game-btn--outline {
  background: transparent;
  border: 3px solid var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: none;
}

.game-btn--outline:hover {
  background: var(--accent-cyan);
  color: var(--bg-dark);
  transform: none;
  box-shadow: none;
}

/* ========================================
   CARDS
   ======================================== */
.game-card {
  background: var(--bg-card);
  border: 3px solid var(--bg-light);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  transition: all 0.2s ease;
}

.game-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.game-card--highlight {
  border-color: var(--accent-yellow);
}

/* ========================================
   STAT BARS
   ======================================== */
.stat-bar {
  margin-bottom: var(--space-md);
}

.stat-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.stat-bar-label {
  font-family: 'VT323', monospace;
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.stat-bar-value {
  font-family: 'VT323', monospace;
  font-size: 1.25rem;
  color: var(--accent-yellow);
}

.stat-bar-track {
  height: 16px;
  background: var(--bg-medium);
  border: 2px solid var(--bg-light);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: linear-gradient(
    180deg,
    var(--accent-green) 0%,
    #3cb82a 100%
  );
  transition: width 0.5s ease;
  position: relative;
}

.stat-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.stat-bar--blue .stat-bar-fill {
  background: linear-gradient(180deg, var(--xp-blue) 0%, #3a7cc9 100%);
}

.stat-bar--purple .stat-bar-fill {
  background: linear-gradient(180deg, var(--mana-purple) 0%, #7b3dbe 100%);
}

.stat-bar--yellow .stat-bar-fill {
  background: linear-gradient(180deg, var(--accent-yellow) 0%, #ccad31 100%);
}

/* ========================================
   BADGES / TAGS
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-light);
  border: 2px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--accent-cyan);
}

.badge--green {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.badge--yellow {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

.badge--pink {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

/* ========================================
   ACHIEVEMENT BADGES
   ======================================== */
.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  text-align: center;
}

.achievement-icon {
  width: 64px;
  height: 64px;
  background: var(--bg-light);
  border: 3px solid var(--accent-yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.achievement-icon::before {
  content: '';
  width: 32px;
  height: 32px;
  background: var(--accent-yellow);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.achievement.locked .achievement-icon {
  border-color: var(--text-muted);
  opacity: 0.5;
}

.achievement.locked .achievement-icon::before {
  background: var(--text-muted);
}

.achievement-name {
  font-family: 'VT323', monospace;
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.achievement.locked .achievement-name {
  color: var(--text-muted);
}

/* ========================================
   SPEECH BUBBLE
   ======================================== */
.speech-bubble {
  background: var(--bg-light);
  border: 3px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  position: relative;
  margin-top: var(--space-lg);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -12px;
  left: var(--space-lg);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 12px solid var(--accent-cyan);
}

.speech-bubble::after {
  content: '';
  position: absolute;
  top: -6px;
  left: calc(var(--space-lg) + 3px);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 9px solid var(--bg-light);
}

.speech-bubble-text {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  color: var(--text-primary);
  font-style: italic;
}

/* ========================================
   LEVEL CARD (for Projects)
   ======================================== */
.level-card {
  background: var(--bg-card);
  border: 3px solid var(--bg-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.level-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.level-preview {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg-medium);
  overflow: hidden;
}

.level-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.level-number {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  background: var(--accent-yellow);
  color: var(--bg-dark);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
}

.level-info {
  padding: var(--space-md);
}

.level-name {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.75rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.level-desc {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.level-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.level-card.locked {
  opacity: 0.6;
  pointer-events: none;
}

.level-card.locked .level-preview::after {
  content: '?';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', cursive;
  font-size: 3rem;
  color: var(--text-muted);
}

/* ========================================
   QUEST CARD (for Blog)
   ======================================== */
.quest-card {
  position: relative;
  background: #f4e4bc;
  border: 3px solid #c9a86c;
  border-radius: var(--radius-sm);
  padding: var(--space-lg);
  color: #3d2914;
  transition: all 0.2s ease;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.2);
}

.quest-card::before {
  content: '';
  position: absolute;
  top: -8px;
  left: var(--space-lg);
  width: 16px;
  height: 16px;
  background: #c9a86c;
  border-radius: 50%;
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.2);
}

.quest-card:hover {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

.quest-type {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: #8b4513;
  margin-bottom: var(--space-xs);
  display: block;
}

.quest-date {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #6b4423;
  margin-bottom: var(--space-sm);
}

.quest-title {
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  color: #3d2914;
  margin-bottom: var(--space-sm);
  font-weight: 700;
}

.quest-preview {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: #5a3d1e;
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.quest-accept {
  display: inline-block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  color: #8b4513;
  text-decoration: none;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid #8b4513;
  transition: all 0.2s ease;
}

.quest-accept:hover {
  color: #5a2d0a;
  border-color: #5a2d0a;
}

/* ========================================
   PAGE TITLE
   ======================================== */
.page-title {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.page-title h1 {
  font-size: 1.5rem;
  color: var(--text-primary);
  text-shadow: 4px 4px 0 var(--shadow-color);
  margin-bottom: var(--space-sm);
}

@media (min-width: 768px) {
  .page-title h1 {
    font-size: 2rem;
  }
}

.page-title-sub {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--text-secondary);
}

/* ========================================
   SECTION DIVIDER
   ======================================== */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-2xl) 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--bg-light) 0px,
    var(--bg-light) 8px,
    transparent 8px,
    transparent 16px
  );
}

.section-divider-icon {
  width: 24px;
  height: 24px;
  background: var(--accent-cyan);
  transform: rotate(45deg);
}

/* ========================================
   TREASURE CARDS (Underground Experience)
   ======================================== */
.treasure-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 768px) {
  .treasure-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .treasure-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.treasure-card {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(61, 41, 20, 0.95) 0%,
    rgba(90, 61, 30, 0.9) 50%,
    rgba(61, 41, 20, 0.95) 100%
  );
  border: 4px solid #8b6914;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow: hidden;
  transition: all 0.4s ease;

  /* Initial state for scroll animation */
  opacity: 0;
  transform: translateY(40px);
}

.treasure-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Glowing edge effect */
.treasure-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    transparent 30%,
    rgba(76, 201, 240, 0.4) 50%,
    transparent 70%
  );
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.treasure-card:hover::before {
  opacity: 1;
}

.treasure-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent-cyan);
  box-shadow:
    0 0 20px rgba(76, 201, 240, 0.3),
    0 12px 32px rgba(0, 0, 0, 0.4);
}

/* Crystal/Gem Icon */
.treasure-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-md);
  background: linear-gradient(
    135deg,
    var(--accent-cyan) 0%,
    var(--accent-purple) 50%,
    var(--accent-pink) 100%
  );
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  animation: crystal-glow 3s ease-in-out infinite;
}

@keyframes crystal-glow {
  0%, 100% {
    filter: brightness(1);
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
  }
  50% {
    filter: brightness(1.3);
    box-shadow: 0 0 25px rgba(76, 201, 240, 0.8);
  }
}

.treasure-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  color: var(--accent-yellow);
  margin-bottom: var(--space-xs);
  text-align: center;
  line-height: 1.6;
}

.treasure-company {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--accent-cyan);
  text-align: center;
  margin-bottom: var(--space-xs);
}

.treasure-period {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: #a8a8a8;
  text-align: center;
  margin-bottom: var(--space-md);
}

.treasure-desc {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: #d4c4a8;
  line-height: 1.6;
  margin-bottom: var(--space-md);
  text-align: center;
}

/* Gem-style tags */
.treasure-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.gem-tag {
  padding: var(--space-xs) var(--space-sm);
  background: rgba(76, 201, 240, 0.15);
  border: 2px solid var(--accent-cyan);
  border-radius: 2px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--accent-cyan);
}

/* Locked treasure card */
.treasure-card.locked {
  opacity: 0.6;
  filter: grayscale(0.3);
}

.treasure-card.locked.visible {
  opacity: 0.6;
}

.treasure-card.locked .treasure-icon {
  background: linear-gradient(135deg, #666 0%, #888 50%, #666 100%);
  animation: none;
}

.treasure-card.locked .treasure-title,
.treasure-card.locked .treasure-company {
  color: var(--text-muted);
}

.treasure-card.locked::after {
  content: '?';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', cursive;
  font-size: 2.5rem;
  color: var(--text-muted);
  opacity: 0.5;
}
