/* ==========================================================================
   COMPONENT STYLES: NAVBAR, RACE TRACK, JOURNEY MAP, GIFTS, TABLES
   ========================================================================== */

/* Top Navigation Bar */
.game-nav {
  background: var(--bg-card);
  border-bottom: 2px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.nav-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Nav Menu Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  list-style: none;
  background: var(--bg-card-alt);
  padding: 0.25rem;
  border-radius: var(--radius-full);
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-item a:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.7);
}

.nav-item.active a {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

/* Nav Actions (Save/Load/Sound) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.save-status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.save-status-pill.unsaved {
  background: #FFFBEB;
  color: #92400E;
  border-color: #FDE68A;
}

@media (max-width: 1260px) {
  .nav-container {
    justify-content: center;
    gap: 0.75rem;
  }
}

@media (max-width: 820px) {
  .nav-links {
    overflow-x: auto;
    max-width: 100%;
    justify-content: flex-start;
    border-radius: var(--radius-md);
    padding: 0.35rem;
  }
}

/* ==========================================================================
   RACE TRACK LEADERBOARD (Top 20)
   ========================================================================== */
.racetrack-card {
  background: linear-gradient(180deg, #1E1B4B 0%, #0F172A 100%);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 2px solid #312E81;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}

.racetrack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.racetrack-title {
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
}

.racetrack-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-btn-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem;
  border-radius: var(--radius-full);
}

.filter-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn.active {
  background: var(--accent-orange);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.5);
}

/* Light Theme / Segmented Filter Buttons */
.filter-btn-group.light-group {
  background: #E2E8F0;
  border: 1.5px solid #CBD5E1;
  padding: 3px;
  gap: 4px;
}

.filter-btn-group.light-group .filter-btn,
.filter-btn.filter-btn-light {
  color: #1E293B;
  font-weight: 800;
  border: 1px solid transparent;
  background: transparent;
}

.filter-btn-group.light-group .filter-btn:hover,
.filter-btn.filter-btn-light:hover {
  color: #0F172A;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-btn-group.light-group .filter-btn.active,
.filter-btn.filter-btn-light.active,
.filter-btn-group.light-group .filter-btn.active:hover,
.filter-btn.filter-btn-light.active:hover {
  background: var(--accent-orange);
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.45);
  border-color: transparent;
}

/* Track Arena */
.track-arena {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow-x: auto;
}

/* Milestones Bar at the top of the track */
.track-milestones {
  display: flex;
  justify-content: space-between;
  padding-left: 170px;
  padding-right: 40px;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: #94A3B8;
  position: relative;
  min-width: 600px;
}

.track-milestones::after {
  content: '';
  position: absolute;
  left: 170px;
  right: 40px;
  bottom: -4px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
}

.milestone-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Lane item */
.race-lane {
  display: flex;
  align-items: center;
  margin-bottom: 0.55rem;
  position: relative;
  height: 48px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
}

.race-lane:hover {
  background: rgba(255, 255, 255, 0.07);
}

.race-lane.lane-first {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.lane-info {
  width: 170px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
}

.lane-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.lane-rank.rank-1 {
  background: var(--accent-yellow);
  color: #000000;
}
.lane-rank.rank-2 {
  background: #E2E8F0;
  color: #000000;
}
.lane-rank.rank-3 {
  background: #F97316;
  color: #FFFFFF;
}

.lane-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

/* Lane Track Bar */
.lane-track {
  flex: 1;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  padding-right: 40px;
}

.lane-finish-line {
  position: absolute;
  right: 15px;
  top: 0;
  bottom: 0;
  width: 8px;
  background: repeating-linear-gradient(
    45deg,
    #FFFFFF,
    #FFFFFF 4px,
    #000000 4px,
    #000000 8px
  );
  border-radius: 2px;
  opacity: 0.7;
}

/* Runner Avatar on Track */
.runner-badge {
  position: absolute;
  transform: translateX(0);
  transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.95);
  color: #0F172A;
  padding: 0.2rem 0.5rem 0.2rem 0.25rem;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 10;
}

.runner-badge:hover {
  transform: scale(1.1);
  z-index: 20;
}

.runner-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
}

.runner-pts {
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--primary);
}

.lane-first .runner-badge {
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.8);
  border: 2px solid var(--accent-yellow);
}

/* ==========================================================================
   PODIUM & LEADERBOARD (Top 5 Today / Top 3 Overall)
   ========================================================================== */
.podium-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
  min-height: 220px;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 160px;
}

.podium-slot-1 { order: 2; transform: translateY(-15px); }
.podium-slot-2 { order: 1; }
.podium-slot-3 { order: 3; }

.podium-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 0.5rem;
  position: relative;
  background: var(--bg-card);
  border: 4px solid var(--border-light);
  box-shadow: var(--shadow-md);
}

.podium-slot-1 .podium-avatar {
  width: 88px;
  height: 88px;
  border-color: var(--accent-yellow);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.podium-slot-2 .podium-avatar { border-color: #94A3B8; }
.podium-slot-3 .podium-avatar { border-color: #F97316; }

.podium-pillar {
  width: 100%;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  color: #FFFFFF;
  font-weight: 800;
}

.podium-slot-1 .podium-pillar {
  height: 120px;
  background: linear-gradient(180deg, #FBBF24, #D97706);
  box-shadow: 0 6px 0 #B45309;
}

.podium-slot-2 .podium-pillar {
  height: 90px;
  background: linear-gradient(180deg, #94A3B8, #64748B);
  box-shadow: 0 6px 0 #475569;
}

.podium-slot-3 .podium-pillar {
  height: 70px;
  background: linear-gradient(180deg, #FB923C, #EA580C);
  box-shadow: 0 6px 0 #C2410C;
}

/* ==========================================================================
   REALISTIC LIFE-JOURNEY ADVENTURE MAP
   ========================================================================== */
.adventure-map-card {
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.map-legend-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-card-alt);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.color-dot {
  background: linear-gradient(135deg, #10B981, #06B6D4);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.gray-dot {
  background: #94A3B8;
  border: 1px solid #64748B;
}

.legend-pulse-line {
  display: inline-block;
  width: 16px;
  height: 3px;
  background: #F59E0B;
  border-radius: 2px;
  box-shadow: 0 0 8px #F59E0B;
}

.map-zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   MAP SWITCHER (Life Stages Map vs Student Journey Map)
   ========================================================================== */
.map-switcher-nav {
  display: inline-flex;
  align-items: center;
  background: var(--bg-card-alt);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  gap: 0.35rem;
  flex-wrap: wrap;
}

.map-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.map-tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.map-tab-btn.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
  transform: scale(1.02);
}

.map-tab-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #E2E8F0;
  color: #475569;
  transition: all 0.2s ease;
}

.map-tab-btn.active .map-tab-badge {
  background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
  color: var(--primary);
}

.map-viewport-container {
  position: relative;
  width: 100%;
  background: #0B1329;
  overflow: hidden;
  user-select: none;
  cursor: grab;
}

.map-viewport-container.is-dragging {
  cursor: grabbing;
}

.map-viewport-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

#adventure-map-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 480px;
  max-height: 82vh;
}

/* SVG Flowing Trail Animations */
@keyframes trailDashFlow {
  from {
    stroke-dashoffset: 64;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.trail-dash-flow {
  animation: trailDashFlow 1.5s linear infinite;
}

@keyframes radarWavePulse {
  0% {
    r: 12;
    opacity: 0.95;
    stroke-width: 3.5;
  }
  70% {
    opacity: 0.4;
  }
  100% {
    r: 44;
    opacity: 0;
    stroke-width: 0.5;
  }
}

.radar-pulse-ring {
  animation: radarWavePulse 2.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  transform-origin: center;
}

@keyframes avatarHoverFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.avatar-player-token {
  animation: avatarHoverFloat 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
}

/* Destination Hotspot Interactivity */
.map-dest-hotspot {
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.map-dest-hotspot:hover {
  filter: drop-shadow(0 4px 14px rgba(245, 158, 11, 0.6));
}

.map-dest-hotspot:hover .dest-highlight-border {
  stroke: #F59E0B !important;
  stroke-width: 3.5 !important;
}

/* Milestone Inspector Card (Floating Details Modal) */
.milestone-inspector-card {
  position: absolute;
  bottom: 1.25rem;
  right: 1.25rem;
  max-width: 360px;
  width: calc(100% - 2.5rem);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
  padding: 1.25rem;
  z-index: 60;
  animation: slideInspectorUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInspectorUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.inspector-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.inspector-close-btn:hover {
  color: #DC2626;
  background: #FEE2E2;
}

/* Quick Map Stage Ticker */
.map-stage-ticker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  scrollbar-width: thin;
}

.ticker-node {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-card-alt);
  color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.ticker-node:hover {
  transform: translateY(-2px);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.ticker-node.achieved {
  background: #F0FDF4;
  color: #15803D;
  border-color: #86EFAC;
}

.ticker-node.current {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  color: #92400E;
  border: 2px solid #F59E0B;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px) scale(1.04);
}

.ticker-node.locked {
  background: #F8FAFC;
  color: #94A3B8;
  border-color: #E2E8F0;
  opacity: 0.75;
}

/* Checkpoint Node & Stage Circle retained for wardrobe & overview */
.checkpoint-node {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1rem;
  text-align: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.checkpoint-node.unlocked {
  border-color: var(--accent-teal);
  background: #F0FDFA;
}

.checkpoint-node.active-stage {
  border-color: var(--secondary);
  background: #FAF5FF;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.2), var(--shadow-md);
  transform: translateY(-4px) scale(1.02);
}

.checkpoint-node.locked {
  opacity: 0.6;
  background: #F8FAFC;
  filter: grayscale(80%);
}

.stage-badge-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  background: #FFFFFF;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.checkpoint-node.unlocked .stage-badge-circle {
  border-color: var(--accent-teal);
  background: #CCFBF1;
}

.checkpoint-node.active-stage .stage-badge-circle {
  border-color: var(--secondary);
  background: #EDE9FE;
  animation: bounceSmall 1.5s infinite;
}

.stage-name {
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.stage-req {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* ==========================================================================
   LOTTERY & GIFT WHEEL / MYSTERY BOX
   ========================================================================== */
.gift-draw-box {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  border-radius: var(--radius-lg);
  color: #FFFFFF;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.wheel-canvas-wrap {
  position: relative;
  width: 320px;
  height: 320px;
  margin: 1.5rem auto;
}

.wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid var(--accent-yellow);
  z-index: 20;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Mystery Card Deck (3D Flip & Interactive) */
.cards-deck-arena {
  perspective: 1000px;
}

.mystery-card {
  width: 125px;
  height: 180px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  cursor: pointer;
  border-radius: var(--radius-md);
  user-select: none;
}

.mystery-card:hover:not(.flipped) {
  transform: translateY(-8px) scale(1.04);
}

.mystery-card.flipped {
  transform: rotateY(180deg);
  cursor: default;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

/* Card Back (Face Down with mystical pattern) */
.card-back {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
  border: 3px solid #FCD34D;
  color: #FCD34D;
  text-align: center;
}

.card-back-inner {
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(252, 211, 77, 0.45);
  border-radius: calc(var(--radius-md) - 4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
}

.card-back-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  animation: cardPulse 2s infinite ease-in-out;
}

@keyframes cardPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Card Front (Face Up revealed prize) */
.card-front {
  background: #FFFFFF;
  color: #0F172A;
  border: 3px solid #F59E0B;
  transform: rotateY(180deg);
  text-align: center;
}

/* Mystery Treasure Chests */
.chest-item {
  width: 130px;
  padding: 1.15rem 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.chest-item:hover:not(.chest-opened) {
  transform: translateY(-6px) scale(1.06);
  background: rgba(255, 255, 255, 0.16);
  border-color: #FCD34D;
}

.chest-icon {
  font-size: 4rem;
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.35));
}

.chest-item.chest-shaking .chest-icon {
  animation: chestShake 0.6s infinite ease-in-out;
}

@keyframes chestShake {
  0%, 100% { transform: rotate(0deg) scale(1.05); }
  20% { transform: rotate(-12deg) scale(1.15); }
  40% { transform: rotate(12deg) scale(1.15); }
  60% { transform: rotate(-10deg) scale(1.15); }
  80% { transform: rotate(10deg) scale(1.15); }
}

.chest-item.chest-opened {
  background: rgba(254, 243, 199, 0.2);
  border: 2px solid #FCD34D;
  cursor: default;
}

.chest-item.chest-opened .chest-icon {
  transform: scale(1.2);
}

.chest-title {
  font-weight: 800;
  font-size: 0.85rem;
  color: #F8FAFC;
  margin-top: 0.5rem;
}

/* Scratch & Win Ticket */
.scratch-card-wrapper {
  position: relative;
  width: 280px;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 4px solid #FCD34D;
  background: #FFFFFF;
}

.scratch-underneath {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(circle, #FFFBEB 0%, #FEF3C7 100%);
  padding: 1rem;
  box-sizing: border-box;
}

/* ==========================================================================
   DATA TABLES (Points, Attendance, Roster)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.game-table {
  width: 100%;
  border-collapse: collapse;
  background: #FFFFFF;
  font-size: 0.9rem;
  text-align: left;
}

.game-table th {
  background: var(--bg-card-alt);
  padding: 0.85rem 1rem;
  font-weight: 800;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.game-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

.game-table tr:hover td {
  background: #F8FAFC;
}

/* Student Avatar Card (Roster) */
.student-card {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.student-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.student-card-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 0.75rem;
  background: var(--bg-card-alt);
  border: 3px solid var(--border-light);
}

.student-card-name {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.student-card-roll {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.student-card-points {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

/* Milestone Top Tag (Grey in Stage 0, evolving into bright improvement colors) */
.milestone-top-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.avatar-wrapper-with-milestone {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pool Chips (Random Student Selector) */
.pool-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: #FFFFFF;
  border: 1.5px solid var(--accent-green);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0F172A;
  transition: all 0.15s ease;
  user-select: none;
}

.pool-chip:hover {
  background: #F0FDF4;
  border-color: #15803D;
  transform: translateY(-1px);
}

.pool-chip-remove {
  color: #EF4444;
  font-weight: 900;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.15rem;
  transition: transform 0.1s ease;
}

.pool-chip-remove:hover {
  transform: scale(1.25);
}

.pool-chip-excluded {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: #FFFFFF;
  border: 1.5px dashed #DC2626;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #991B1B;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.pool-chip-excluded:hover {
  background: #FEE2E2;
  border-style: solid;
  transform: translateY(-1px);
}

.pool-chip-restore {
  color: #16A34A;
  font-weight: 900;
  font-size: 0.9rem;
}

/* --- AVATAR SYSTEM & 3D HUMAN LIFE EVOLUTION STYLES --- */
.avatar-style-tab {
  border: 1px solid transparent;
  color: var(--text-muted);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.avatar-style-tab.active {
  background: var(--primary) !important;
  color: #FFFFFF !important;
  box-shadow: var(--shadow-sm);
}

.avatar-human {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.student-card:hover .avatar-human {
  transform: scale(1.06);
}

.evolution-stage-node:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--primary) !important;
  opacity: 1 !important;
  filter: none !important;
}

/* --- RPG GEAR DOCK ON STUDENT CARD --- */
.gear-dock {
  width: 100%;
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  margin-top: 0.35rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gear-dock:hover {
  border-color: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.gear-dock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  padding: 0 0.15rem;
}

.gear-dock-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.gear-dock-action {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--primary);
  transition: color 0.15s;
}

.gear-dock:hover .gear-dock-action {
  color: var(--primary-dark);
  text-decoration: underline;
}

.gear-slots-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
}

.gear-slot-item {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1.5px solid var(--border);
  transition: transform 0.15s ease;
}

.gear-slot-item:hover {
  transform: scale(1.05);
}

.gear-slot-icon {
  font-size: 1.15rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.gear-slot-name {
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gear-slot-tier {
  font-size: 0.55rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.85;
}

/* Rarity Tiers */
.tier-starter {
  border-color: #94A3B8;
}
.tier-text-starter { color: #64748B; }

.tier-common {
  border-color: #10B981;
}
.tier-text-common { color: #059669; }

.tier-rare {
  border-color: #3B82F6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.2);
}
.tier-text-rare { color: #2563EB; }

.tier-epic {
  border-color: #A855F7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.25);
}
.tier-text-epic { color: #7C3AED; }

.tier-legendary {
  border-color: #F59E0B;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}
.tier-text-legendary { color: #D97706; }

/* Empty Inventory Slot */
.gear-slot-item.slot-empty {
  border: 1.5px dashed #CBD5E1;
  background: #F8FAFC;
  opacity: 0.8;
  cursor: pointer;
}

.gear-slot-item.slot-empty:hover {
  border-color: var(--primary);
  opacity: 1;
  background: #EEF2FF;
  transform: scale(1.06);
}

.gear-slot-item.slot-empty .gear-slot-icon {
  opacity: 0.45;
  filter: grayscale(1);
}

.tier-text-empty {
  color: #94A3B8;
  font-weight: 700;
}

/* --- STUDENT ARMORY & WARDROBE MODAL STYLES --- */
.wardrobe-hero-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card-alt);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.wardrobe-avatar-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  background: #FFFFFF;
}

.wardrobe-info-wrap {
  flex: 1;
}

.wardrobe-hero-name {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 0.15rem;
}

.wardrobe-hero-roll {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-left: 0.4rem;
}

.wardrobe-hero-stage {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.wardrobe-points-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.wardrobe-safe-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #10B981;
  background: rgba(16, 185, 129, 0.12);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.wardrobe-tabs-bar {
  display: flex;
  gap: 0.4rem;
  background: var(--bg-card-alt);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.wardrobe-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.wardrobe-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.3);
}

.wardrobe-tab-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.wardrobe-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
  padding: 0.25rem 0.25rem 0.5rem 0.25rem;
}

.wardrobe-item-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.wardrobe-item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wardrobe-item-card.is-equipped {
  border-color: #10B981 !important;
  background: rgba(16, 185, 129, 0.05);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.wardrobe-item-card.is-locked {
  opacity: 0.65;
  background: var(--bg-card-alt);
  filter: grayscale(0.2);
}

.wardrobe-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.35rem;
}

.wardrobe-item-icon {
  font-size: 1.6rem;
}

.wardrobe-tier-badge {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid;
}

.tier-badge-starter { background: #F1F5F9; color: #475569; border-color: #CBD5E1; }
.tier-badge-common { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.tier-badge-rare { background: #EFF6FF; color: #1E40AF; border-color: #BFDBFE; }
.tier-badge-epic { background: #FAF5FF; color: #6B21A8; border-color: #E9D5FF; }
.tier-badge-legendary { background: #FFFBEB; color: #92400E; border-color: #FDE68A; }

.wardrobe-item-name {
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.wardrobe-item-perk {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  min-height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wardrobe-item-footer {
  width: 100%;
  margin-top: auto;
}

.wardrobe-status-badge {
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  width: 100%;
}

.badge-equipped {
  background: #10B981;
  color: #FFFFFF;
}

.wardrobe-lock-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  padding: 0.3rem 0.2rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.lock-req {
  color: #D97706;
  font-weight: 900;
}

.lock-remaining {
  font-size: 0.62rem;
  opacity: 0.85;
}

/* Practical Exercises & Completion Tracking */
.tracking-row.row-completed {
  background-color: rgba(16, 185, 129, 0.04);
}

.tracking-row.row-completed:hover {
  background-color: rgba(16, 185, 129, 0.08);
}

.btn-verified-active {
  background: #10B981 !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 0 #059669 !important;
}

.exercise-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.exercise-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Attendance Quick-Tap Grid */
.quick-tap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .quick-tap-grid {
    grid-template-columns: 1fr !important;
  }
}



